From: ptitSeb
Date: Sat, 12 Oct 2013 09:33:40 +0000 (+0200)
Subject: Glide Plugin GLES2 port from mupen64plus-ae, but with special FrameSkip code
X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=98e75f2d18c02c233da543560f76282f04fc796c;p=mupen64plus-pandora.git
Glide Plugin GLES2 port from mupen64plus-ae, but with special FrameSkip code
---
diff --git a/source/gles2glide64/.hgignore b/source/gles2glide64/.hgignore
new file mode 100644
index 0000000..60b3ba8
--- /dev/null
+++ b/source/gles2glide64/.hgignore
@@ -0,0 +1,4 @@
+syntax: regexp
+
+^projects/unix/_obj/
+^projects/unix/mupen64plus-video-glide64mk2.so$
diff --git a/source/gles2glide64/INSTALL b/source/gles2glide64/INSTALL
new file mode 100644
index 0000000..7529bb6
--- /dev/null
+++ b/source/gles2glide64/INSTALL
@@ -0,0 +1,26 @@
+Mupen64Plus-Video-Glide64mk2 INSTALL
+------------------------------------
+
+This text file was written to explain the installation process of the
+Mupen64Plus-Video-Glide64mk2 module.
+
+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-Video-Glide64mk2 module for installation in a
+home folder for a single user, you may build it like this (replacing
+ with your desired local installation path):
+
+$ cd projects/unix
+$ make all
+$ make install LIBDIR= SHAREDIR=
+
+
diff --git a/source/gles2glide64/LICENSES b/source/gles2glide64/LICENSES
new file mode 100644
index 0000000..fdb70c2
--- /dev/null
+++ b/source/gles2glide64/LICENSES
@@ -0,0 +1,356 @@
+Mupen64Plus-video-glide64mk2 LICENSE
+------------------------------------
+
+Mupen64Plus-video-glide64mk2 is licensed under the GNU General Public License version 2.
+
+The authors of Mupen64Plus-video-glide64mk2 are:
+ * Sven Eckelmann
+ * Wahrhaft
+ * Riley Labrecque
+ * and others.
+
+Mupen64Plus-video-glide64mk2 is based on the 10th anniversary release of the Glide64
+plugin, which is GPL-licensed and was originally written by Gonetz and others.
+
+ 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/source/gles2glide64/Makefile b/source/gles2glide64/Makefile
new file mode 100755
index 0000000..ee2e96b
--- /dev/null
+++ b/source/gles2glide64/Makefile
@@ -0,0 +1,165 @@
+PIC ?= 1
+NO_ASM := 1
+CFLAGS += -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -mtune=cortex-a8 -fsigned-char -DNO_ASM -DPAULSCODE -Ofast
+CFLAGS += -I ../../../../mupen64plus-bundle-src-2.0/source/mupen64plus-core/src/api/
+CFLAGS += `sdl-config --cflags`
+
+SHARED = -shared
+SRCDIR := src
+
+MODULE := gles2glide64
+SHARED_LIBRARIES := SDL core
+STATIC_LIBRARIES := png
+ARM_MODE := arm
+
+C_INCLUDES := \
+ $(M64P_API_INCLUDES) \
+ $(SDL_INCLUDES) \
+
+SOURCE := \
+ $(SRCDIR)/Glitch64/combiner.cpp \
+ $(SRCDIR)/Glitch64/geometry.cpp \
+ $(SRCDIR)/Glitch64/glitchmain.cpp \
+ $(SRCDIR)/Glitch64/textures.cpp \
+ $(SRCDIR)/Glide64/osal_dynamiclib_unix.c \
+ $(SRCDIR)/Glide64/3dmath.cpp \
+ $(SRCDIR)/Glide64/Combine.cpp \
+ $(SRCDIR)/Glide64/Config.cpp \
+ $(SRCDIR)/Glide64/CRC.cpp \
+ $(SRCDIR)/Glide64/Debugger.cpp \
+ $(SRCDIR)/Glide64/DepthBufferRender.cpp \
+ $(SRCDIR)/Glide64/FBtoScreen.cpp \
+ $(SRCDIR)/Glide64/FrameSkipper.cpp \
+ $(SRCDIR)/Glide64/Ini.cpp \
+ $(SRCDIR)/Glide64/Keys.cpp \
+ $(SRCDIR)/Glide64/Main.cpp \
+ $(SRCDIR)/Glide64/rdp.cpp \
+ $(SRCDIR)/Glide64/TexBuffer.cpp \
+ $(SRCDIR)/Glide64/TexCache.cpp \
+ $(SRCDIR)/Glide64/ticks.c \
+ $(SRCDIR)/Glide64/Util.cpp \
+
+CFLAGS += \
+ $(COMMON_CFLAGS) \
+ -D__CRC_OPT \
+ -D__HASHMAP_OPT \
+ -D__TRIBUFFER_OPT \
+ -D__VEC4_OPT \
+ -DUSE_SDL \
+ -fsigned-char \
+ #-DSDL_NO_COMPAT \
+
+ifeq ($(PIC), 1)
+ CFLAGS += -fPIC
+else
+ CFLAGS += -fno-PIC
+endif
+
+CPPFLAGS := $(CPPFLAGS)
+
+LDLIBS := \
+ -lGLESv2 \
+ -lEGL \
+ -lrt \
+
+# Use for ARM7a:
+CFLAGS += -DARM_ASM
+CFLAGS += -D__NEON_OPT
+
+LDFLAGS += $(SHARED)
+
+include $(BUILD_SHARED_LIBRARY)
+
+# set base program pointers and flags
+CC = $(CROSS_COMPILE)gcc
+CXX = $(CROSS_COMPILE)g++
+RM ?= rm -f
+INSTALL ?= install
+MKDIR ?= mkdir -p
+COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -gdwarf-2 -c
+COMPILE.cc = $(Q_CXX)$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -gdwarf-2 -c
+LINK.o = $(Q_LD)$(CXX) $(CXXFLAGS) $(LDFLAGS) $(TARGET_ARCH) -gdwarf-2
+
+# set installation options
+ifeq ($(PREFIX),)
+ PREFIX := /usr/local
+endif
+ifeq ($(SHAREDIR),)
+ SHAREDIR := $(PREFIX)/share/mupen64plus
+endif
+ifeq ($(LIBDIR),)
+ LIBDIR := $(PREFIX)/lib
+endif
+ifeq ($(PLUGINDIR),)
+ PLUGINDIR := $(LIBDIR)/mupen64plus
+endif
+
+OBJDIR = _obj$(POSTFIX)
+
+# generate a list of object files build, make a temporary directory for them
+OBJECTS := $(patsubst $(SRCDIR)/%.c, $(OBJDIR)/%.o, $(filter %.c, $(SOURCE)))
+OBJECTS += $(patsubst $(SRCDIR)/%.cpp, $(OBJDIR)/%.o, $(filter %.cpp, $(SOURCE)))
+OBJDIRS = $(dir $(OBJECTS))
+$(shell $(MKDIR) $(OBJDIRS))
+
+# build targets
+TARGET = mupen64plus-video-gles2n64.so
+
+targets:
+ @echo "Mupen64plus-video-rice N64 Graphics plugin makefile. "
+ @echo " Targets:"
+ @echo " all == Build Mupen64plus-video-rice plugin"
+ @echo " clean == remove object files"
+ @echo " rebuild == clean and re-build all"
+ @echo " install == Install Mupen64Plus-video-rice plugin"
+ @echo " uninstall == Uninstall Mupen64Plus-video-rice plugin"
+ @echo " Options:"
+ @echo " BITS=32 == build 32-bit binaries on 64-bit machine"
+ @echo " NO_ASM=1 == build without inline assembly code (x86 MMX/SSE)"
+ @echo " APIDIR=path == path to find Mupen64Plus Core headers"
+ @echo " OPTFLAGS=flag == compiler optimization (default: -O3)"
+ @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 " Install Options:"
+ @echo " PREFIX=path == install/uninstall prefix (default: /usr/local)"
+ @echo " SHAREDIR=path == path to install shared data files (default: PREFIX/share/mupen64plus)"
+ @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)"
+ $(INSTALL) -d "$(DESTDIR)$(SHAREDIR)"
+
+uninstall:
+ $(RM) "$(DESTDIR)$(PLUGINDIR)/$(TARGET)"
+
+clean:
+ $(RM) -r $(OBJDIR) $(TARGET)
+
+rebuild: clean all
+
+# build dependency files
+CFLAGS += -MD
+-include $(OBJECTS:.o=.d)
+
+CXXFLAGS += $(CFLAGS)
+
+# standard build rules
+$(OBJDIR)/%.o: $(SRCDIR)/%.c
+ $(COMPILE.c) -o $@ $<
+
+$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
+ $(COMPILE.cc) -o $@ $<
+
+$(TARGET): $(OBJECTS)
+ $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
+
+.PHONY: all clean install uninstall targets
diff --git a/source/gles2glide64/RELEASE b/source/gles2glide64/RELEASE
new file mode 100644
index 0000000..dc4f5a6
--- /dev/null
+++ b/source/gles2glide64/RELEASE
@@ -0,0 +1,13 @@
+Mupen64Plus-Video-Glide64mk2 RELEASE
+-------------------------------------
+
+Mupen64Plus-Video-Glide64mk2 v2.0 - July 4, 2013
+------------------------------------------------
+ - lots of bug fixing and cleanup
+ - remove wxwidgets dependencies
+ - ported old 32-bit x86 assembly language code to C for other platforms/CPUs
+ - add Visual Studio 2012 project files
+ - convert to Mupen64Plus build system and API
+ - merged wahrhaft's Glide64 and Glitch64 changes from earlier porting effort
+ - ported later changes from Mudlord's repository
+ - add initial source code from Gonetz's google code repo "10th anniversary Glide64 release"
diff --git a/source/gles2glide64/data/Glide64mk2.ini b/source/gles2glide64/data/Glide64mk2.ini
new file mode 100755
index 0000000..045c849
--- /dev/null
+++ b/source/gles2glide64/data/Glide64mk2.ini
@@ -0,0 +1,1776 @@
+;_____________________________________________________________________
+; SETTINGS:
+; This section contains the plugin settings, such as
+; resolution.
+;
+; resolution - specifies which resolution to use
+; Resolutions are as follows:
+; 0 - 320, 200
+; 1 - 320, 240
+; 2 - 400, 256
+; 3 - 512, 384
+; 4 - 640, 200
+; 5 - 640, 350
+; 6 - 640, 400
+; 7 - 640, 480
+; 8 - 800, 600
+; 9 - 960, 720
+; 10 - 856, 480
+; 11 - 512, 256
+; 12 - 1024, 768
+; 13 - 1280, 1024
+; 14 - 1600, 1200
+; 15 - 400, 300
+; 16 - 1152, 864
+; 17 - 1280, 960
+; 18 - 1600, 1024
+; 19 - 1792, 1344
+; 20 - 1856, 1392
+; 21 - 1920, 1440
+; 22 - 2048, 1536
+; 23 - 2048, 2048
+; Note: some video cards or monitors do not support all
+; resolutions!
+;
+; Note#2:For compatibility issues always distribute this
+; file with the resolution: 640, 480 (7)
+;
+
+[SETTINGS]
+card_id = 0
+resolution=8
+filter_cache = 0
+autodetect_ucode = 1
+ucode = 2
+wireframe = 0
+wfmode=1
+filtering = 1
+depthmode = 0
+fog = 1
+buff_clear = 1
+vsync = 1
+swapmode = 1
+run_in_window = 0
+show_fps = 0
+clock = 0
+clock_24_hr = 0
+wrap_big_tex = 0
+custom_ini = 1
+hotkeys = 1
+ssformat=1
+logging = 0
+log_clear = 0
+unk_as_red = 0
+log_unk = 0
+unk_clear = 0
+new_swap = 1
+hires_motionblur = 0
+flame_corona = 0
+fb_smart = 1
+fb_read_always = 0
+fb_clear = 0
+fb_hires = 1
+fb_depth_clear = 0
+motionblur = 1
+elogging = 0
+lodmode = 0
+fb_get_info = 0
+fb_render = 1
+detect_cpu_write = 0
+fillrec_depth_compare = 0
+tex_wrap_hack = 0
+read_back_to_screen = 0
+advanced_options = 0
+texenh_options = 0
+ghq_fltr = 0
+ghq_cmpr = 0
+ghq_enht = 0
+ghq_hirs = 0
+ghq_enht_cmpr = 0
+ghq_enht_tile = 0
+ghq_enht_f16bpp = 0
+ghq_enht_gz = 1
+ghq_enht_nobg=0
+ghq_hirs_cmpr = 0
+ghq_hirs_tile = 0
+ghq_hirs_f16bpp = 0
+ghq_hirs_gz = 1
+ghq_hirs_altcrc = 1
+ghq_cache_save = 1
+ghq_cache_size=0
+ghq_hirs_let_texartists_fly = 0
+ghq_hirs_dump = 0
+wrpResolution=0
+wrpVRAM=0
+wrpFBO=0
+wrpAnisotropic=0
+
+; UCODE:
+; These are ucode crcs used in the uCode detector.
+; If a crc is not found here, the plugin will ask you
+; to add it. All these values are in hexadecimal.
+;
+; uCodes:
+; -1 - Unknown, display error
+; 0 - RSP SW 2.0X (Super Mario 64)
+; 1 - F3DEX 1.XX (Star Fox 64)
+; 2 - F3DEX 2.XX (The Legend of Zelda: Ocarina of Time)
+; 3 - F3DEX ? (WaveRace)
+; 4 - RSP SW 2.0D EXT (Star Wars: Shadows of the Empire)
+; 5 - RSP SW 2.0 (Diddy Kong Racing);
+; 6 - S2DEX 1.XX (Yoshi's Story - SimCity 2000)
+; 7 - RSP SW PD (Perfect Dark)
+; 8 - F3DEXBG 2.08 (Conker's Bad Fur Day)
+
+[UCODE]
+006bd77f=0
+03044b84=2
+030f4b84=2
+05165579=1
+05777c62=1
+057e7c62=1
+07200895=0
+0bf36d36=9
+0d7bbffb=-1
+0d7cbffb=5
+0ff79527=2
+0ff795bf=-1
+1118b3e0=1
+1517a281=1
+168e9cd5=2
+1a1e18a0=2
+1a1e1920=2
+1a62dbaf=2
+1a62dc2f=2
+1de712ff=1
+1ea9e30f=6
+1f120bbb=21
+21f91834=2
+21f91874=2
+22099872=2
+24cd885b=1
+26a7879a=1
+299d5072=6
+2b291027=2
+2b5a89c2=6
+2c7975d6=1
+2d3fe3f1=1
+2f71d1d5=2
+2f7dd1d5=2
+327b933d=1
+339872a6=1
+377359b6=2
+3a1c2b34=0
+3a1cbac3=0
+3f7247fb=0
+3ff1a4ca=1
+4165e1fd=0
+4340ac9b=1
+440cfad6=1
+47d46e86=7
+485abff2=2
+4fe6df78=1
+5182f610=0
+5257cd2a=1
+5414030c=1
+5414030d=1
+559ff7d4=1
+5b5d36e3=4
+5b5d3763=3
+5d1d6f53=0
+5d3099f1=2
+5df1408c=1
+5ef4e34a=1
+6075e9eb=1
+60c1dcc4=1
+6124a508=2
+630a61fb=2
+63be08b1=5
+63be08b3=5
+64ed27e5=1
+65201989=2
+65201a09=2
+66c0b10a=1
+679e1205=2
+6bb745c9=6
+6d8f8f8a=2
+6e4d50af=0
+6eaa1da8=1
+72a4f34e=1
+73999a23=1
+74af0a74=6
+753be4a5=2
+794c3e28=6
+7df75834=1
+7f2d0a2e=1
+82f48073=1
+832fcb99=1
+841ce10f=1
+844b55b5=-1
+863e1ca7=1
+86b1593e=-1
+8805ffea=1
+8d5735b2=1
+8d5735b3=1
+8ec3e124=-1
+93d11f7b=2
+93d11ffb=2
+93d1ff7b=2
+9551177b=2
+955117fb=2
+95cd0062=2
+97d1b58a=1
+a2d0f88e=2
+a346a5cc=1
+aa86cb1d=2
+aae4a5b9=2
+ad0a6292=2
+ad0a6312=2
+ae08d5b9=0
+b1821ed3=1
+b4577b9c=1
+b54e7f93=0
+b62f900f=2
+ba65ea1e=2
+ba86cb1d=8
+bc03e969=0
+bc45382e=2
+be78677c=1
+bed8b069=1
+c3704e41=1
+c46dbc3d=1
+c99a4c6c=1
+c901ce73=2
+c901cef3=2
+cb8c9b6c=2
+cee7920f=1
+cfa35a45=2
+d1663234=1
+d20dedbf=6
+d2a9f59c=1
+d41db5f7=1
+d5604971=0
+d57049a5=1
+d5c4dc96=-1
+d5d68b1f=0
+d67c2f8b=0
+d802ec04=1
+da13ab96=2
+de7d67d4=2
+e1290fa2=2
+e41ec47e=0
+e65cb4ad=2
+e89c2b92=1
+e9231df2=1
+ec040469=1
+ee47381b=1
+ef54ee35=1
+f9893f70=21
+fb816260=1
+ff372492=21
+
+
+
+; Game specific settings
+;
+; In the [DEFAULT] section there are the default options for a game, which can
+; be overriden in the section with the game's internal name.
+
+[DEFAULT]
+filtering = 0
+fog = 1
+buff_clear = 1
+swapmode = 1
+lodmode = 0
+fb_smart = 0
+fb_hires = 1
+fb_get_info = 0
+fb_read_always = 0
+fb_render = 1
+fb_crc_mode = 1
+read_back_to_screen = 0
+detect_cpu_write = 0
+alt_tex_size = 0
+use_sts1_only = 0
+PPL = 0
+fast_crc = 1
+force_microcheck = 0
+force_quad3d = 0
+texrect_zbuf = 0
+fix_tex_coord = 0
+optimize_texrect = 1
+optimize_write = 0
+hires_buf_clear = 1
+depthmode = 1
+fb_clear = 0
+fb_read_alpha = 0
+ignore_previous = 0
+soft_depth_compare = 0
+force_depth_compare = 0
+force_calc_sphere = 0
+texrect_compare_less = 0
+texture_correction = 1
+fillcolor_fix = 0
+depth_bias = 20
+increase_texrect_edge = 0
+decrease_fillrect_edge = 0
+stipple_mode = 2
+stipple_pattern = 1041204192
+clip_zmax = 1
+clip_zmin = 0
+adjust_aspect = 1
+correct_viewport = 0
+aspect = 0
+zmode_compare_less = 0
+old_style_adither = 0
+n64_z_scale = 0
+
+[1080 SNOWBOARDING]
+optimize_texrect = 1
+alt_tex_size = 1
+depthmode = 0
+swapmode = 2
+fb_smart = 1
+fb_hires = 1
+fb_clear = 1
+
+[A Bug's Life]
+depthmode = 0
+
+[AERO FIGHTERS ASSAUL]
+clip_zmin = 1
+
+[AIDYN_CHRONICLES]
+depthmode = 1
+
+[All-Star Baseball 20]
+force_depth_compare = 1
+
+[All-Star Baseball 99]
+force_depth_compare = 1
+depthmode = 1
+buff_clear = 0
+
+[All Star Baseball 99]
+force_depth_compare = 1
+depthmode = 1
+buff_clear = 0
+
+[All-Star Baseball '0]
+force_depth_compare = 1
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+
+[ARMYMENAIRCOMBAT]
+increase_texrect_edge = 1
+depthmode = 1
+
+[BURABURA POYON]
+fix_tex_coord = 1
+depthmode = 0
+
+;Bakushou Jinsei 64 - Mezease! Resort Ou.
+[ÊÞ¸¼®³¼Þݾ²64]
+fb_info_disable = 1
+depthmode = 0
+
+[BAKU-BOMBERMAN]
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+
+[BAKUBOMB2]
+filtering = 1
+depthmode = 0
+
+[BANGAIOH]
+depthmode = 1
+
+[Banjo-Kazooie]
+filtering = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+
+[BANJO KAZOOIE 2]
+filtering = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+
+[BANJO TOOIE]
+filtering = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+
+[BASS HUNTER 64]
+fix_tex_coord = 1
+depthmode = 1
+buff_clear = 0
+swapmode = 2
+
+[BATTLEZONE]
+force_depth_compare = 1
+depthmode = 1
+
+[BEETLE ADVENTURE JP]
+wrap_big_tex = 1
+n64_z_scale = 1
+filtering = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+
+[Beetle Adventure Rac]
+wrap_big_tex = 1
+n64_z_scale = 1
+filtering = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+
+[Big Mountain 2000]
+depthmode = 1
+
+[BIOFREAKS]
+depthmode = 0
+buff_clear = 0
+fb_smart = 1
+fb_hires = 1
+
+[BioHazard II]
+detect_cpu_write = 1
+adjust_aspect = 0
+n64_z_scale = 1
+fix_tex_coord = 128
+depthmode = 0
+swapmode = 2
+fb_smart = 1
+fb_hires = 1
+
+[Blast Corps]
+depthmode = 1
+swapmode = 0
+fb_smart = 1
+fb_hires = 1
+fb_read_alpha = 1
+
+[Blastdozer]
+depthmode = 1
+swapmode = 0
+fb_smart = 1
+fb_hires = 1
+fb_read_alpha = 1
+
+[blitz2k]
+lodmode = 2
+
+[Body Harvest]
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+
+[BOMBERMAN64E]
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+
+[BOMBERMAN64U]
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+
+[BOMBERMAN64U2]
+filtering = 1
+depthmode = 0
+
+[Bottom of the 9th]
+optimize_texrect = 0
+filtering = 1
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+
+[BRUNSWICKBOWLING]
+depthmode = 0
+buff_clear = 0
+swapmode = 0
+
+[Bust A Move 3 DX]
+filtering = 2
+depthmode = 1
+
+[Bust A Move '99]
+filtering = 2
+depthmode = 1
+
+[Bust A Move 2]
+fix_tex_coord = 1
+filtering = 2
+depthmode = 1
+fog = 0
+
+[CARMAGEDDON64]
+wrap_big_tex = 1
+filtering = 1
+depthmode = 1
+
+[CASTLEVANIA]
+depthmode = 0
+fb_clear = 1
+old_style_adither = 1
+
+[CASTLEVANIA2]
+depthmode = 0
+fb_clear = 1
+
+[CENTRE COURT TENNIS]
+soft_depth_compare = 1
+depthmode = 0
+
+[Chameleon Twist2]
+filtering = 1
+depthmode = 0
+
+[CHOPPER_ATTACK]
+filtering = 1
+depthmode = 0
+
+[CITY TOUR GP]
+force_microcheck = 1
+filtering = 1
+depthmode = 1
+
+[Command&Conquer]
+fix_tex_coord = 1
+aspect = 2
+filtering = 1
+depthmode = 1
+fog = 0
+
+[CONKER BFD]
+optimize_texrect = 1
+ignore_previous = 1
+lodmode = 1
+filtering = 1
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+fb_clear = 1
+
+[Cruis'n USA]
+filtering = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+fb_clear = 1
+
+[CruisnExotica]
+filtering = 1
+depthmode = 1
+buff_clear = 0
+swapmode = 0
+
+[custom robo]
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+
+[CUSTOMROBOV2]
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+
+[CyberTiger]
+fix_tex_coord = 16
+depthmode = 0
+
+[DAFFY DUCK STARRING]
+depthmode = 1
+wrap_big_tex = 1
+
+[DARK RIFT]
+force_microcheck = 1
+
+[DeadlyArts]
+soft_depth_compare = 1
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+clip_zmin = 1
+
+[DERBYSTALLION 64]
+fix_tex_coord = 1
+depthmode = 0
+
+[D K DISPLAY]
+depthmode = 1
+fb_clear = 1
+
+[Donald Duck Goin' Qu]
+detect_cpu_write = 1
+depthmode = 0
+
+[Donald Duck Quack At]
+detect_cpu_write = 1
+depthmode = 0
+
+[DONKEY KONG 64]
+lodmode = 1
+depth_bias = 64
+depthmode = 1
+fb_clear = 1
+
+[Doom64]
+fillcolor_fix = 1
+depthmode = 1
+
+;Doraemon - Mittsu no Seireiseki (J)
+[ÄÞ×´ÓÝ Ð¯Âɾ²Ú²¾·]
+read_back_to_screen = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+
+;Doraemon 3 - Nobita no Machi SOS! (J)
+[ÄÞ×´ÓÝ3 ÉËÞÀÉÏÁSOS!]
+clip_zmin = 1
+
+[DR.MARIO 64]
+fix_tex_coord = 256
+optimize_write = 1
+read_back_to_screen = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 0
+
+[DRACULA MOKUSHIROKU]
+depthmode = 0
+fb_clear = 1
+
+[DRACULA MOKUSHIROKU2]
+depthmode = 0
+fb_clear = 1
+
+[Dual heroes JAPAN]
+filtering = 1
+depthmode = 0
+swapmode = 0
+
+[Dual heroes PAL]
+filtering = 1
+depthmode = 0
+swapmode = 0
+
+[Dual heroes USA]
+filtering = 1
+depthmode = 0
+swapmode = 0
+
+[DUKE NUKEM]
+increase_primdepth = 1
+depthmode = 0
+
+[EARTHWORM JIM 3D]
+increase_primdepth = 1
+filtering = 1
+depthmode = 0
+buff_clear = 0
+
+;Eikou no Saint Andrew
+[´²º³É¾ÝıÝÄÞØ°½]
+correct_viewport = 1
+
+[Eltail]
+filtering = 2
+depthmode = 1
+
+[EVANGELION]
+depthmode = 1
+
+[EXCITEBIKE64]
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+
+[extreme_g]
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+
+[extremeg]
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+
+[´¸½ÄذÑG2]
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+fb_clear = 1
+
+[Extreme G 2]
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+fb_clear = 1
+
+[F1 POLE POSITION 64]
+clip_zmin = 1
+filtering = 2
+depthmode = 1
+
+[F1RacingChampionship]
+depthmode = 0
+buff_clear = 0
+swapmode = 0
+
+[F1 WORLD GRAND PRIX]
+soft_depth_compare = 1
+wrap_big_tex = 1
+depthmode = 0
+buff_clear = 0
+
+[F1 WORLD GRAND PRIX2]
+wrap_big_tex = 1
+soft_depth_compare = 1
+depthmode = 0
+buff_clear = 0
+
+[F-ZERO X]
+depthmode = 1
+
+;Fushigi no Dungeon - Furai no Shiren 2 (J)
+[F3 ̳ײɼÚÝ2]
+decrease_fillrect_edge = 1
+depthmode = 0
+
+[Fighting Force]
+depthmode = 1
+
+[G.A.S.P!!Fighters'NE]
+soft_depth_compare = 1
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+clip_zmin = 1
+
+[GANBAKE GOEMON]
+optimize_texrect = 0
+alt_tex_size = 1
+filtering = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+
+;Ganbare Goemon - Neo Momoyama Bakufu no Odori
+[¶ÞÝÊÞÚ\ ºÞ´ÓÝ]
+optimize_texrect = 0
+alt_tex_size = 1
+filtering = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+
+[GAUNTLET LEGENDS]
+depthmode = 1
+swapmode = 2
+
+[Getter Love!!]
+zmode_compare_less = 1
+texrect_compare_less = 1
+filtering = 2
+depthmode = 1
+
+[Gex 3 Deep Cover Gec]
+filtering = 1
+depthmode = 0
+
+[GEX: ENTER THE GECKO]
+filtering = 1
+depthmode = 0
+
+[Glover]
+filtering = 1
+depthmode = 0
+
+[GOEMON2 DERODERO]
+filtering = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+
+[GOEMONS GREAT ADV]
+filtering = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+
+[GOLDENEYE]
+lodmode = 1
+depth_bias = 40
+filtering = 1
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+
+[GOLDEN NUGGET 64]
+filtering = 2
+depthmode = 1
+
+[GT64]
+force_microcheck = 1
+filtering = 1
+depthmode = 1
+
+; Hamster Monogatori
+[ÊѽÀ°ÓɶÞÀØ64]
+force_microcheck = 1
+depthmode = 0
+
+[HARVESTMOON64]
+zmode_compare_less = 1
+depthmode = 0
+fog = 0
+
+; Harvest Moon 64 JAP
+[ÎÞ¸¼Þ®³ÓɶÞÀØ2]
+zmode_compare_less = 1
+depthmode = 0
+fog = 0
+
+; Heiwa Pachinko World
+[HEIWA ÊßÁݺ ܰÙÄÞ64]
+depthmode = 0
+fog = 0
+swapmode = 2
+fb_smart = 1
+fb_hires = 1
+
+[HEXEN]
+detect_cpu_write = 1
+filtering = 1
+depthmode = 1
+buff_clear = 0
+swapmode = 2
+
+[HSV ADVENTURE RACING]
+wrap_big_tex = 1
+n64_z_scale = 1
+filtering = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+
+[Holy Magic Century]
+filtering = 2
+depthmode = 1
+
+[HUMAN GRAND PRIX]
+filtering = 2
+depthmode = 0
+
+[·×¯Ä¶²¹Â 64ÀÝòÀÞÝ]
+filtering = 1
+depthmode = 0
+buff_clear = 0
+
+[Iggy's Reckin' Balls]
+fix_tex_coord = 512
+depthmode = 0
+
+[I S S 64]
+depthmode = 1
+swapmode = 2
+old_style_adither = 1
+
+[I.S.S.2000]
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+
+[ITF 2000]
+filtering = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+
+[IT&F SUMMERGAMES]
+filtering = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+
+[J_league 1997]
+fix_tex_coord = 1
+depthmode = 1
+swapmode = 0
+
+;J.League Eleven Beat 1997
+[Jذ¸Þ\ ²ÚÌÞÝËÞ°Ä1997]
+fb_smart=1
+fb_hires=1
+
+[J LEAGUE LIVE 64]
+wrap_big_tex = 1
+depthmode = 1
+
+[J WORLD SOCCER3]
+depthmode = 1
+swapmode = 2
+
+[JEREMY MCGRATH SUPER]
+depthmode = 0
+swapmode = 0
+
+[JET FORCE GEMINI]
+read_back_to_screen = 1
+decrease_fillrect_edge = 1
+alt_tex_size = 1
+depthmode = 1
+swapmode = 2
+fb_smart = 1
+fb_hires = 1
+
+[J F G DISPLAY]
+read_back_to_screen = 1
+decrease_fillrect_edge = 1
+alt_tex_size = 1
+depthmode = 1
+swapmode = 2
+fb_smart = 1
+fb_hires = 1
+
+[KEN GRIFFEY SLUGFEST]
+read_back_to_screen = 2
+depthmode = 1
+swapmode = 0
+fb_smart = 1
+fb_hires = 1
+
+[Kirby64]
+filtering = 1
+depthmode = 0
+buff_clear = 0
+swapmode = 0
+
+[Killer Instinct Gold]
+filtering = 1
+depthmode = 0
+fog = 0
+buff_clear = 0
+
+[KNIFE EDGE]
+wrap_big_tex = 1
+fast_crc = 0
+filtering = 1
+depthmode = 1
+
+[Knockout Kings 2000]
+fb_info_disable = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+fb_clear = 1
+fb_read_alpha = 1
+
+[LAMBORGHINI]
+use_sts1_only = 1
+
+[LCARS - WT_Riker]
+depthmode = 1
+
+[LEGORacers]
+detect_cpu_write = 1
+depthmode = 1
+buff_clear = 0
+fb_smart = 1
+fb_hires = 1
+fb_read_alpha = 1
+
+[LET'S SMASH]
+soft_depth_compare = 1
+depthmode = 0
+
+[Lode Runner 3D]
+swapmode = 0
+
+[LT DUCK DODGERS]
+wrap_big_tex = 1
+depthmode = 1
+
+[MACE]
+fix_tex_coord = 8
+filtering = 1
+depthmode = 1
+
+[MAGICAL TETRIS]
+force_microcheck = 1
+depthmode = 1
+fog = 0
+
+;Mahjong Master (J)
+[ϰ¼Þ¬Ý ϽÀ°]
+n64_z_scale = 1
+texrect_compare_less = 1
+zmode_compare_less = 1
+
+[MAJORA'S MASK]
+wrap_big_tex = 1
+filtering = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+fb_clear = 1
+fb_crc_mode = 0
+
+[MARIOKART64]
+fast_crc = 0
+stipple_mode = 1
+stipple_pattern = 4286595040
+depthmode = 1
+
+[MarioGolf64]
+fb_info_disable = 1
+ignore_aux_copy = 1
+buff_clear = 0
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+fb_clear = 1
+
+[MarioParty]
+clip_zmin = 1
+depthmode = 0
+swapmode = 2
+
+[MarioParty2]
+depthmode = 0
+swapmode = 2
+
+[MarioParty3]
+fix_tex_coord = 1
+depthmode = 0
+
+[MARIO STORY]
+useless_is_useless = 1
+hires_buf_clear = 0
+optimize_texrect = 0
+filtering = 1
+depthmode = 1
+swapmode = 2
+fb_smart = 1
+fb_hires = 1
+fb_read_alpha = 1
+
+[MASTERS'98]
+wrap_big_tex = 1
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+
+[Mega Man 64]
+increase_texrect_edge = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+
+[MGAH VOL1]
+force_microcheck = 1
+depthmode = 1
+zmode_compare_less = 1
+fb_smart = 1
+
+[Mia Hamm Soccer 64]
+buff_clear = 0
+
+[MICKEY USA]
+alt_tex_size = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+fb_clear = 1
+
+[MICKEY USA PAL]
+alt_tex_size = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+fb_clear = 1
+
+[MICROMACHINES64TURBO]
+depthmode = 0
+
+[Mini Racers]
+force_microcheck = 1
+buff_clear = 0
+fb_smart = 1
+fb_hires = 1
+swapmode = 0
+
+[MISCHIEF MAKERS]
+tex_wrap_hack = 0
+depthmode = 1
+fog = 0
+
+[MLB FEATURING K G JR]
+read_back_to_screen = 2
+depthmode = 1
+
+[MK_MYTHOLOGIES]
+depthmode = 1
+
+[MO WORLD LEAGUE SOCC]
+buff_clear = 0
+
+[Monaco GP Racing 2]
+depthmode = 0
+buff_clear = 0
+
+[Monaco Grand Prix]
+depthmode = 0
+buff_clear = 0
+
+;Morita Shogi 64
+[ÓØÀ¼®³·Þ64]
+correct_viewport = 1
+
+[MortalKombatTrilogy]
+filtering = 2
+depthmode = 1
+
+[MS. PAC-MAN MM]
+detect_cpu_write = 1
+depthmode = 1
+
+[MYSTICAL NINJA]
+alt_tex_size = 1
+optimize_texrect = 0
+filtering = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+
+[MYSTICAL NINJA2 SG]
+alt_tex_size = 1
+optimize_texrect = 0
+filtering = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+
+[NASCAR 99]
+depthmode = 0
+buff_clear = 0
+swapmode = 0
+
+[NASCAR 2000]
+depthmode = 0
+buff_clear = 0
+swapmode = 0
+
+[NBA Courtside 2]
+depthmode = 0
+buff_clear = 0
+swapmode = 0
+
+[NBA JAM 2000]
+buff_clear = 0
+
+[NBA JAM 99]
+buff_clear = 0
+
+[NBA LIVE 2000]
+adjust_aspect = 0
+
+[NBA Live 99]
+swapmode = 0
+adjust_aspect = 0
+
+[NEWTETRIS]
+pal230 = 1
+fix_tex_coord = 1
+increase_texrect_edge = 1
+depthmode = 0
+fog = 0
+
+[NFL BLITZ]
+lodmode = 2
+
+[NFL BLITZ 2001]
+lodmode = 2
+
+[NFL BLITZ SPECIAL ED]
+lodmode = 2
+
+[NFL QBC '99]
+force_depth_compare = 1
+wrap_big_tex = 1
+depthmode = 0
+
+[NFL QBC 2000]
+wrap_big_tex = 1
+depthmode = 0
+swapmode = 0
+
+[NFL Quarterback Club]
+wrap_big_tex = 1
+depthmode = 0
+swapmode = 0
+
+[NINTAMAGAMEGALLERY64]
+force_microcheck = 1
+depthmode = 0
+
+[NITRO64]
+fb_smart = 1
+fb_hires = 1
+
+[NUCLEARSTRIKE64]
+buff_clear = 0
+
+; Nushi Zuri 64
+[ǼÂÞØ64]
+force_microcheck = 1
+wrap_big_tex = 0
+depthmode = 0
+buff_clear = 0
+
+[OgreBattle64]
+fb_info_disable = 1
+force_depth_compare = 1
+depthmode = 1
+
+[PACHINKO365NICHI]
+correct_viewport = 1
+
+[PAPER MARIO]
+useless_is_useless = 1
+hires_buf_clear = 0
+optimize_texrect = 0
+filtering = 1
+depthmode = 1
+swapmode = 2
+fb_smart = 1
+fb_hires = 1
+fb_read_alpha = 1
+
+[Parlor PRO 64]
+force_microcheck = 1
+filtering = 1
+depthmode = 1
+
+[Perfect Dark]
+useless_is_useless = 1
+decrease_fillrect_edge = 1
+optimize_texrect = 0
+filtering = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+fb_clear = 1
+
+[PERFECT STRIKER]
+depthmode = 1
+swapmode = 2
+
+[Pilot Wings64]
+depthmode = 1
+buff_clear = 0
+
+[PUZZLE LEAGUE N64]
+PPL = 1
+force_microcheck = 1
+fix_tex_coord = 1
+filtering = 2
+depthmode = 1
+fog = 0
+buff_clear = 0
+fb_smart = 1
+fb_hires = 0
+fb_read_alpha = 1
+
+[PUZZLE LEAGUE]
+PPL = 1
+force_microcheck = 1
+fix_tex_coord = 1
+filtering = 2
+depthmode = 1
+fog = 0
+buff_clear = 0
+fb_smart = 1
+fb_hires = 0
+fb_read_alpha = 1
+
+[POKEMON SNAP]
+fast_crc = 0
+depthmode = 1
+fb_smart = 1
+fb_hires = 0
+fb_clear = 1
+
+[POKEMON STADIUM]
+optimize_texrect = 0
+depthmode = 1
+fast_crc = 0
+buff_clear = 0
+fb_smart = 1
+fb_hires = 0
+fb_read_alpha = 1
+fb_crc_mode = 2
+
+[POKEMON STADIUM 2]
+optimize_texrect = 0
+swapmode = 2
+depthmode = 1
+fast_crc = 0
+buff_clear = 0
+fb_smart = 1
+fb_hires = 1
+fb_read_alpha = 1
+fb_crc_mode = 2
+
+[POKEMON STADIUM G&S]
+optimize_texrect = 0
+depthmode = 1
+fast_crc = 0
+buff_clear = 0
+fb_smart = 1
+fb_hires = 0
+fb_read_alpha = 1
+fb_crc_mode = 2
+
+[POLARISSNOCROSS]
+fix_tex_coord = 5
+depthmode = 1
+
+[PowerLeague64]
+force_quad3d = 1
+
+[Quake]
+force_microcheck = 1
+swapmode = 2
+buff_clear = 0
+
+[QUAKE II]
+fb_smart = 1
+fb_hires = 1
+
+[quarterback_club_98]
+optimize_texrect = 0
+hires_buf_clear = 0
+filtering = 1
+depthmode = 1
+swapmode = 0
+buff_clear = 0
+fb_smart = 1
+fb_hires = 1
+fb_read_alpha = 1
+
+[Quest 64]
+depthmode = 1
+
+[Racing Simulation 2]
+depthmode = 0
+buff_clear = 0
+
+[RAINBOW SIX]
+increase_texrect_edge = 1
+depthmode = 1
+
+[Rally'99]
+filtering = 1
+depthmode = 1
+buff_clear = 0
+fb_smart = 1
+fb_hires = 1
+
+[RALLY CHALLENGE]
+filtering = 1
+depthmode = 1
+buff_clear = 0
+fb_smart = 1
+fb_hires = 1
+
+[Rayman 2]
+depthmode = 0
+detect_cpu_write = 1
+
+[READY 2 RUMBLE]
+fix_tex_coord = 64
+depthmode = 0
+
+[Ready to Rumble]
+fix_tex_coord = 1
+depthmode = 0
+
+[Resident Evil II]
+detect_cpu_write = 1
+adjust_aspect = 0
+n64_z_scale = 1
+fix_tex_coord = 128
+depthmode = 0
+swapmode = 2
+fb_smart = 1
+fb_hires = 1
+
+[Re-Volt]
+texture_correction = 0
+depthmode = 1
+
+[RIDGE RACER 64]
+force_calc_sphere = 1
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+
+[ROAD RASH 64]
+depthmode = 0
+swapmode = 2
+
+[Robopon64]
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+
+[ROCKETROBOTONWHEELS]
+clip_zmin = 1
+
+[RockMan Dash]
+increase_texrect_edge = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+
+[RONALDINHO SOCCER]
+depthmode = 1
+swapmode = 2
+old_style_adither = 1
+
+[RTL WLS2000]
+buff_clear = 0
+
+[RUGRATS IN PARIS]
+depthmode = 1
+
+[RUSH 2049]
+force_texrect_zbuf = 1
+filtering = 1
+depthmode = 0
+
+[SCARS]
+filtering = 1
+depthmode = 0
+
+[SD HIRYU STADIUM]
+force_microcheck = 1
+depthmode = 0
+
+[Shadow of the Empire]
+swapmode = 2
+
+[Shadowman]
+depthmode = 0
+
+[Silicon Valley]
+filtering = 1
+depthmode = 0
+
+[Snobow Kids 2]
+swapmode = 0
+filtering = 1
+
+[SNOWBOARD KIDS2]
+swapmode = 0
+filtering = 1
+
+[South Park: Chef's L]
+fix_tex_coord = 4
+filtering = 2
+depthmode = 1
+fog = 0
+buff_clear = 0
+
+[South Park Chef's Lu]
+fix_tex_coord = 4
+filtering = 1
+depthmode = 1
+fog = 0
+buff_clear = 0
+
+[SPACE DYNAMITES]
+force_microcheck = 1
+
+[SPIDERMAN]
+fast_crc = 0
+
+[STARCRAFT 64]
+detect_cpu_write = 1
+aspect = 2
+filtering = 2
+depthmode = 1
+fog = 0
+
+[STAR SOLDIER]
+force_microcheck = 1
+filtering = 1
+depthmode = 1
+swapmode = 0
+
+[STAR TWINS]
+read_back_to_screen = 1
+decrease_fillrect_edge = 1
+alt_tex_size = 1
+depthmode = 1
+swapmode = 2
+fb_smart = 1
+fb_hires = 1
+
+[STAR WARS EP1 RACER]
+swapmode = 2
+
+[SUPERROBOTSPIRITS]
+aspect = 2
+
+;Super Robot Taisen 64 (J)
+[½°Êß°ÛÎÞ¯ÄÀ²¾Ý64]
+fast_crc = 0
+use_sts1_only = 1
+fb_smart = 1
+fb_hires = 1
+
+[Supercross]
+depthmode = 1
+buff_clear = 0
+
+[SUPER MARIO 64]
+depth_bias = 32
+lodmode = 1
+filtering = 1
+depthmode = 1
+
+[SUPERMARIO64]
+depth_bias = 32
+lodmode = 1
+filtering = 1
+depthmode = 1
+
+[SUPERMAN]
+detect_cpu_write = 1
+
+;Susume! Taisen Puzzle Dama Toukon! Marumata Chou (J)
+[½½Ò!À²¾ÝÊß½ÞÙÀÞÏ]
+force_microcheck = 1
+depthmode = 1
+fog = 0
+swapmode = 0
+
+;Tamagotchi World 64 (J)
+[ÐÝÅÃÞÀϺޯÁܰÙÄÞ]
+use_sts1_only = 1
+depthmode = 0
+fog = 0
+
+[Taz Express]
+filtering = 1
+depthmode = 0
+buff_clear = 0
+
+[TELEFOOT SOCCER 2000]
+buff_clear = 0
+
+[TETRISPHERE]
+alt_tex_size = 1
+use_sts1_only = 1
+increase_texrect_edge = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+fb_crc_mode = 2
+
+[TG RALLY 2]
+filtering = 1
+depthmode = 1
+buff_clear = 0
+swapmode = 2
+
+[THE LEGEND OF ZELDA]
+depth_bias = 60
+filtering = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+fb_clear = 1
+
+[THE MASK OF MUJURA]
+wrap_big_tex = 1
+filtering = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+fb_clear = 1
+fb_crc_mode = 0
+
+[THPS2]
+filtering = 1
+depthmode = 0
+
+[THPS3]
+filtering = 1
+depthmode = 0
+
+[Tigger's Honey Hunt]
+zmode_compare_less = 1
+depthmode = 0
+buff_clear = 0
+
+[TOM AND JERRY]
+depth_bias = 2
+filtering = 1
+depthmode = 0
+
+[Tonic Trouble]
+depthmode = 0
+detect_cpu_write = 1
+
+[TONY HAWK PRO SKATER]
+filtering = 1
+depthmode = 0
+
+[TONY HAWK SKATEBOARD]
+filtering = 1
+depthmode = 0
+
+[Top Gear Hyper Bike]
+fb_info_disable = 1
+swapmode = 2
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+fb_clear = 1
+
+[Top Gear Overdrive]
+fb_info_disable = 1
+depthmode = 0
+buff_clear = 0
+
+[TOP GEAR RALLY]
+depth_bias = 64
+fillcolor_fix = 1
+depthmode = 0
+
+[TOP GEAR RALLY 2]
+filtering = 1
+depthmode = 1
+buff_clear = 0
+swapmode = 2
+
+[TRIPLE PLAY 2000]
+wrap_big_tex = 1
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+
+[TROUBLE MAKERS]
+mischief_tex_hack = 0
+depthmode = 1
+fog = 0
+
+[TSUMI TO BATSU]
+filtering = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+fb_clear = 1
+
+[TSUWAMONO64]
+force_microcheck = 1
+depthmode = 0
+
+[TWINE]
+filtering = 1
+depthmode = 0
+
+[TWISTED EDGE]
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+fb_clear = 1
+
+[Ultraman Battle JAPA]
+depthmode = 0
+
+[Virtual Pool 64]
+depthmode = 1
+buff_clear = 0
+
+[V-RALLY]
+fix_tex_coord = 3
+filtering = 1
+depthmode = 0
+buff_clear = 0
+swapmode = 0
+
+[Waialae Country Club]
+wrap_big_tex = 1
+depthmode = 0
+fb_smart = 1
+fb_hires = 1
+
+[WAVE RACE 64]
+pal230 = 1
+
+[WILD CHOPPERS]
+filtering = 1
+depthmode = 0
+
+[Wipeout 64]
+filtering = 1
+depthmode = 0
+swapmode = 2
+
+[WONDER PROJECT J2]
+depthmode = 0
+buff_clear = 0
+swapmode = 0
+
+[World Cup 98]
+depthmode = 0
+swapmode = 0
+fb_smart = 1
+fb_hires = 1
+
+[WRESTLEMANIA 2000]
+depthmode = 0
+
+[YAKOUTYUU2]
+depthmode = 0
+
+[YOSHI STORY]
+fix_tex_coord = 32
+filtering = 1
+depthmode = 1
+fog = 0
+
+[ZELDA MAJORA'S MASK]
+wrap_big_tex = 1
+filtering = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+fb_clear = 1
+fb_crc_mode = 0
+
+[ZELDA MASTER QUEST]
+depth_bias = 60
+filtering = 1
+depthmode = 1
+fb_smart = 1
+fb_hires = 1
+fb_clear = 1
+
+[MUPEN64PLUS]
+
+;End Of Original File
diff --git a/source/gles2glide64/doc/fxt1-license b/source/gles2glide64/doc/fxt1-license
new file mode 100644
index 0000000..234c6c6
--- /dev/null
+++ b/source/gles2glide64/doc/fxt1-license
@@ -0,0 +1,244 @@
+3DFX FXT1 Source Code General Public License
+
+
+1. PREAMBLE
+
+ This license is for software that provides texture compression and
+ decompression, particularly in the context of video games. The license
+ is intended to offer terms similar to some standard General Public
+ Licenses designed to foster open standards and unrestricted
+ accessibility to source code. Some of these licenses require that, as
+ a condition of the license of the software, any derivative works
+ (that is, new software which is a work containing the original program
+ or a portion of it) must be available for general use, without
+ restriction other than for a minor transfer fee, and that the source
+ code for such derivative works must likewise be made available. The
+ only restriction is that such derivative works must be subject to
+ the same General Public License terms as the original work.
+
+ This 3dfx FXT1 Source Code General Public License differs from the
+ standard licenses of this type in that it does not require the entire
+ derivative work to be made available under the terms of this license
+ nor is the recipient required to make available the source code for
+ the entire derivative work. Rather, the license is limited to only the
+ identifiable portion of the derivative work that is derived from the
+ licensed software. The precise terms and conditions for copying,
+ distribution and modification follow.
+
+
+2. DEFINITIONS
+
+ 2.1 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 3dfx FXT1 Source Code General
+ Public License.
+
+ 2.2 The term "Program" as used in this Agreement refers to 3DFX's
+ FXT1 source code and object code and any Derivative Work.
+
+ 2.3 "Derivative Work" means, for the purpose of the License, that
+ portion of any work that contains the Program or the identifiable
+ portion of a work that is derived from the Program, either verbatim or
+ with modifications and/or translated into another language, and that
+ performs texture compression and decompression. It does not include
+ any other portions of a work.
+
+ 2.4 "Modifications of the Program" means any work, which includes a
+ Derivative Work, and includes the whole of such work.
+
+ 2.5 "License" means this 3dfx FXT1 Source Code General Public License.
+
+ 2.6 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, any
+ associated interface definition files, and the scripts used to control
+ compilation and installation of the executable work.
+
+ 2.7 "3dfx" means 3dfx Interactive, Inc.
+
+
+3. LICENSED ACTIVITIES
+
+ 3.1 COPYING - You may copy and distribute verbatim copies of the
+ Program's Source Code as you receive it, in any medium, subject to the
+ provision of section 3.3 and provided also that:
+
+ (a) you conspicuously and appropriately publish on each copy
+ an appropriate copyright notice (3dfx Interactive, Inc. 1999), a notice
+ that recipients who wish to copy, distribute or modify the Program can
+ only do so subject to this License, and a disclaimer of warranty as
+ set forth in section 5;
+
+ (b) keep intact all the notices that refer to this License and
+ to the absence of any warranty; and
+
+ (c) give all recipients of the Program a copy of this License
+ along with the Program or instructions on how to easily receive a copy
+ of this License.
+
+
+ 3.2 MODIFICATION OF THE PROGRAM/DERIVATIVE WORKS - You may modify your
+ copy or copies of the Program or any portion of it, and copy and
+ distribute such modifications subject to the provisions of section 3.3
+ and provided that you also meet all of the following conditions:
+
+ (a) you conspicuously and appropriately publish on each copy
+ of a Derivative Work an appropriate copyright notice, a notice that
+ recipients who wish to copy, distribute or modify the Derivative Work
+ can only do so subject to this License, and a disclaimer of warranty
+ as set forth in section 5;
+
+ (b) keep intact all the notices that refer to this License and
+ to the absence of any warranty; and
+
+ (c) give all recipients of the Derivative Work a copy of this
+ License along with the Derivative Work or instructions on how to easily
+ receive a copy of this License.
+
+ (d) You must cause the modified files of the Derivative Work
+ to carry prominent notices stating that you changed the files and the
+ date of any change.
+
+ (e) You must cause any Derivative Work that you distribute or
+ publish to be licensed at no charge to all third parties under the
+ terms of this License.
+
+ (f) If the Derivative Work normally reads commands
+ interactively when run, you must cause it, when started running for
+ such interactive use, to print or display an announcement as follows:
+
+ "COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED THIS
+ SOFTWARE IS FREE AND PROVIDED "AS IS," WITHOUT WARRANTY OF ANY KIND,
+ EITHER EXPRESSED OR IMPLIED. SEE THE 3DFX FXT1 GENERAL PUBLIC LICENSE
+ FOR A FULL TEXT OF THE DISTRIBUTION AND NON-WARRANTY PROVISIONS
+ (REQUEST COPY FROM INFO@3DFX.COM)."
+
+ (g) The requirements of this section 3.2 do not apply to the
+ modified work as a whole but only to the Derivative Work. It is not
+ the intent of this License 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 Works.
+
+
+ 3.3 DISTRIBUTION
+
+ (a) All copies of the Program or Derivative Works which are
+ distributed must include in the file headers the following language
+ verbatim:
+
+ "THIS SOFTWARE IS SUBJECT TO COPYRIGHT PROTECTION AND IS OFFERED
+ ONLY PURSUANT TO THE 3DFX FXT1 GENERAL PUBLIC LICENSE. A COPY OF THIS
+ LICENSE MAY BE OBTAINED FROM THE DISTRIBUTOR OR BY CONTACTING 3DFX
+ INTERACTIVE INC (info@3dfx.com). THIS PROGRAM. IS PROVIDED "AS IS"
+ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED. SEE THE
+ 3DFX FXT1 GENERAL PUBLIC LICENSE FOR A FULL TEXT OF THE NON-WARRANTY
+ PROVISIONS.
+
+ USE, DUPLICATION OR DISCLOSURE BY THE GOVERNMENT IS SUBJECT TO
+ RESTRICTIONS AS SET FORTH IN SUBDIVISION (C)(1)(II) OF THE RIGHTS
+ IN TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 252.227-7013,
+ AND/OR IN SIMILAR OR SUCCESSOR CLAUSES IN THE FAR, DOD OR NASA FAR
+ SUPPLEMENT. UNPUBLISHED RIGHTS RESERVED UNDER THE COPYRIGHT LAWS OF
+ THE UNITED STATES.
+
+ COPYRIGHT 3DFX INTERACTIVE, INC. 1999, ALL RIGHTS RESERVED"
+
+ (b) You may distribute the Program or a Derivative Work in
+ object code or executable form under the terms of Sections 3.1 and 3.2
+ provided that you also do one of the following:
+
+ (1) Accompany it with the complete corresponding
+ machine-readable source code, which must be distributed under the
+ terms of Sections 3.1 and 3.2; or,
+
+ (2) 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 3.1 and 3.2 on a medium
+ customarily used for software interchange; or,
+
+ (3) 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 3.3(b)(2) above.)
+
+ (c) 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 code.
+
+ (d) If distribution of executable code 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.
+
+ (e) Each time you redistribute the Program or any Derivative
+ Work, the recipient automatically receives a license from 3dfx and
+ successor licensors to copy, distribute or modify the Program and
+ Derivative Works subject to the terms and conditions of the License.
+ 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.
+
+ (f) You may not copy, modify, sublicense, or distribute the
+ Program or any Derivative Works except as expressly provided under
+ this License. Any attempt otherwise to copy, modify, sublicense or
+ distribute the Program or any Derivative Works 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.
+
+
+4. MISCELLANEOUS
+
+ 4.1 Acceptance of this License is voluntary. By using, modifying or
+ distributing the Program or any Derivative Work, 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. Nothing else grants you permission to modify or distribute the
+ Program or Derivative Works and doing so without acceptance of this
+ License is in violation of the U.S. and international copyright laws.
+
+ 4.2 If the distribution and/or use of the Program or Derivative Works
+ 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.
+
+ 4.3 This License is to be construed according to the laws of the
+ State of California and you consent to personal jurisdiction in the
+ State of California in the event it is necessary to enforce the
+ provisions of this License.
+
+
+5. NO WARRANTIES
+
+ 5.1 TO THE EXTENT PERMITTED BY APPLICABLE LAW, THERE IS NO WARRANTY
+ FOR THE PROGRAM. OR DERIVATIVE WORKS THE COPYRIGHT HOLDERS AND/OR
+ OTHER PARTIES PROVIDE THE PROGRAM AND ANY DERIVATIVE WORKS"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 AND ANY DERIVATIVE WORK IS WITH YOU.
+ SHOULD THE PROGRAM OR ANY DERIVATIVE WORK PROVE DEFECTIVE, YOU ASSUME
+ THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 5.2 IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL 3DFX
+ INTERACTIVE, INC., OR ANY OTHER COPYRIGHT HOLDER, OR ANY OTHER PARTY
+ WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM OR DERIVATIVE WORKS 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 OR DERIVATIVE WORKS (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 OR
+ DERIVATIVE WORKS TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH
+ HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+
diff --git a/source/gles2glide64/doc/gpl-license b/source/gles2glide64/doc/gpl-license
new file mode 100644
index 0000000..d511905
--- /dev/null
+++ b/source/gles2glide64/doc/gpl-license
@@ -0,0 +1,339 @@
+ 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/source/gles2glide64/pandora.diff b/source/gles2glide64/pandora.diff
new file mode 100644
index 0000000..b1a10fe
--- /dev/null
+++ b/source/gles2glide64/pandora.diff
@@ -0,0 +1,1500 @@
+diff -Naur ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glide64/3dmath.cpp ./Glide64/3dmath.cpp
+--- ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glide64/3dmath.cpp 2013-09-06 22:05:28.000000000 +0200
++++ ./Glide64/3dmath.cpp 2013-09-14 09:41:13.000000000 +0200
+@@ -202,15 +202,109 @@
+ }
+ }
+
++#ifdef __ARM_NEON__
++void MultMatrix_neon( float m0[4][4], float m1[4][4], float dest[4][4])
++{
++ asm volatile (
++ "vld1.32 {d0, d1}, [%1]! \n\t" //q0 = m1
++ "vld1.32 {d2, d3}, [%1]! \n\t" //q1 = m1+4
++ "vld1.32 {d4, d5}, [%1]! \n\t" //q2 = m1+8
++ "vld1.32 {d6, d7}, [%1] \n\t" //q3 = m1+12
++ "vld1.32 {d16, d17}, [%0]! \n\t" //q8 = m0
++ "vld1.32 {d18, d19}, [%0]! \n\t" //q9 = m0+4
++ "vld1.32 {d20, d21}, [%0]! \n\t" //q10 = m0+8
++ "vld1.32 {d22, d23}, [%0] \n\t" //q11 = m0+12
++
++ "vmul.f32 q12, q8, d0[0] \n\t" //q12 = q8 * d0[0]
++ "vmul.f32 q13, q8, d2[0] \n\t" //q13 = q8 * d2[0]
++ "vmul.f32 q14, q8, d4[0] \n\t" //q14 = q8 * d4[0]
++ "vmul.f32 q15, q8, d6[0] \n\t" //q15 = q8 * d6[0]
++ "vmla.f32 q12, q9, d0[1] \n\t" //q12 = q9 * d0[1]
++ "vmla.f32 q13, q9, d2[1] \n\t" //q13 = q9 * d2[1]
++ "vmla.f32 q14, q9, d4[1] \n\t" //q14 = q9 * d4[1]
++ "vmla.f32 q15, q9, d6[1] \n\t" //q15 = q9 * d6[1]
++ "vmla.f32 q12, q10, d1[0] \n\t" //q12 = q10 * d0[0]
++ "vmla.f32 q13, q10, d3[0] \n\t" //q13 = q10 * d2[0]
++ "vmla.f32 q14, q10, d5[0] \n\t" //q14 = q10 * d4[0]
++ "vmla.f32 q15, q10, d7[0] \n\t" //q15 = q10 * d6[0]
++ "vmla.f32 q12, q11, d1[1] \n\t" //q12 = q11 * d0[1]
++ "vmla.f32 q13, q11, d3[1] \n\t" //q13 = q11 * d2[1]
++ "vmla.f32 q14, q11, d5[1] \n\t" //q14 = q11 * d4[1]
++ "vmla.f32 q15, q11, d7[1] \n\t" //q15 = q11 * d6[1]
++
++ "vst1.32 {d24, d25}, [%2]! \n\t" //d = q12
++ "vst1.32 {d26, d27}, [%2]! \n\t" //d+4 = q13
++ "vst1.32 {d28, d29}, [%2]! \n\t" //d+8 = q14
++ "vst1.32 {d30, d31}, [%2] \n\t" //d+12 = q15
++
++ :"+r"(m0), "+r"(m1), "+r"(dest):
++ : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
++ "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23",
++ "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31",
++ "memory"
++ );
++}
++
++void Normalize_neon(float v[3])
++{
++ asm volatile (
++ "vld1.32 {d4}, [%0]! \n\t" //d4={x,y}
++ "flds s10, [%0] \n\t" //d5[0] = z
++ "sub %0, %0, #8 \n\t" //d5[0] = z
++ "vmul.f32 d0, d4, d4 \n\t" //d0= d4*d4
++ "vpadd.f32 d0, d0, d0 \n\t" //d0 = d[0] + d[1]
++ "vmla.f32 d0, d5, d5 \n\t" //d0 = d0 + d5*d5
++
++ "vmov.f32 d1, d0 \n\t" //d1 = d0
++ "vrsqrte.f32 d0, d0 \n\t" //d0 = ~ 1.0 / sqrt(d0)
++ "vmul.f32 d2, d0, d1 \n\t" //d2 = d0 * d1
++ "vrsqrts.f32 d3, d2, d0 \n\t" //d3 = (3 - d0 * d2) / 2
++ "vmul.f32 d0, d0, d3 \n\t" //d0 = d0 * d3
++ "vmul.f32 d2, d0, d1 \n\t" //d2 = d0 * d1
++ "vrsqrts.f32 d3, d2, d0 \n\t" //d3 = (3 - d0 * d3) / 2
++ "vmul.f32 d0, d0, d3 \n\t" //d0 = d0 * d4
++
++ "vmul.f32 q2, q2, d0[0] \n\t" //d0= d2*d4
++ "vst1.32 {d4}, [%0]! \n\t" //d2={x0,y0}, d3={z0, w0}
++ "fsts s10, [%0] \n\t" //d2={x0,y0}, d3={z0, w0}
++
++ :"+r"(v) :
++ : "d0", "d1", "d2", "d3", "d4", "d5", "memory"
++ );
++}
++
++float DotProduct_neon( float v0[3], float v1[3] )
++{
++ float dot;
++ asm volatile (
++ "vld1.32 {d8}, [%1]! \n\t" //d8={x0,y0}
++ "vld1.32 {d10}, [%2]! \n\t" //d10={x1,y1}
++ "flds s18, [%1, #0] \n\t" //d9[0]={z0}
++ "flds s22, [%2, #0] \n\t" //d11[0]={z1}
++ "vmul.f32 d12, d8, d10 \n\t" //d0= d2*d4
++ "vpadd.f32 d12, d12, d12 \n\t" //d0 = d[0] + d[1]
++ "vmla.f32 d12, d9, d11 \n\t" //d0 = d0 + d3*d5
++ "fmrs %0, s24 \n\t" //r0 = s0
++ : "=r"(dot), "+r"(v0), "+r"(v1):
++ : "d8", "d9", "d10", "d11", "d12"
++
++ );
++ return dot;
++}
++
++#endif
++
+ // 2008.03.29 H.Morii - added SSE 3DNOW! 3x3 1x3 matrix multiplication
+ // and 3DNOW! 4x4 4x4 matrix multiplication
+ // 2011-01-03 Balrog - removed because is in NASM format and not 64-bit compatible
+ // This will need fixing.
++#ifndef __ARM_NEON__
+ MULMATRIX MulMatrices = MulMatricesC;
+ TRANSFORMVECTOR TransformVector = TransformVectorC;
+ TRANSFORMVECTOR InverseTransformVector = InverseTransformVectorC;
+ DOTPRODUCT DotProduct = DotProductC;
+ NORMALIZEVECTOR NormalizeVector = NormalizeVectorC;
++#endif
+
+ void MulMatricesSSE(float m1[4][4],float m2[4][4],float r[4][4])
+ {
+@@ -361,6 +455,7 @@
+
+ void math_init()
+ {
++#ifndef __ARM_NEON__
+ #ifndef _DEBUG
+ int IsSSE = FALSE;
+ #if defined(__GNUC__) && !defined(NO_ASM) && !defined(NOSSE)
+@@ -429,4 +524,5 @@
+ }
+
+ #endif //_DEBUG
++#endif //__ARM_NEON__
+ }
+diff -Naur ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glide64/3dmath.h ./Glide64/3dmath.h
+--- ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glide64/3dmath.h 2013-09-06 22:05:28.000000000 +0200
++++ ./Glide64/3dmath.h 2013-09-14 19:01:12.000000000 +0200
+@@ -42,7 +42,22 @@
+ void calc_sphere (VERTEX *v);
+
+ void math_init();
++#ifdef __ARM_NEON__
++float DotProductC(register float *v1, register float *v2);
++void NormalizeVectorC(float *v);
++void TransformVectorC(float *src, float *dst, float mat[4][4]);
++void InverseTransformVectorC (float *src, float *dst, float mat[4][4]);
++void MulMatricesC(float m1[4][4],float m2[4][4],float r[4][4]);
++void MultMatrix_neon( float m0[4][4], float m1[4][4], float dest[4][4]);
++void Normalize_neon(float v[3]);
++float DotProduct_neon( float v0[3], float v1[3] );
+
++#define MulMatrices MulMatricesC //MultMatrix_neon
++#define TransformVector TransformVectorC
++#define InverseTransformVector InverseTransformVectorC
++#define DotProduct DotProductC //DotProduct_neon
++#define NormalizeVector NormalizeVectorC //Normalize_neon
++#else
+ typedef void (*MULMATRIX)(float m1[4][4],float m2[4][4],float r[4][4]);
+ extern MULMATRIX MulMatrices;
+ typedef void (*TRANSFORMVECTOR)(float *src,float *dst,float mat[4][4]);
+@@ -52,3 +67,4 @@
+ extern DOTPRODUCT DotProduct;
+ typedef void (*NORMALIZEVECTOR)(float *v);
+ extern NORMALIZEVECTOR NormalizeVector;
++#endif
+diff -Naur ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glide64/3dmathneon.cpp ./Glide64/3dmathneon.cpp
+--- ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glide64/3dmathneon.cpp 1970-01-01 01:00:00.000000000 +0100
++++ ./Glide64/3dmathneon.cpp 2013-09-13 23:05:47.000000000 +0200
+@@ -0,0 +1,133 @@
++#include "3dmath.h"
++
++static void MultMatrix_neon( float m0[4][4], float m1[4][4], float dest[4][4])
++{
++ asm volatile (
++ "vld1.32 {d0, d1}, [%1]! \n\t" //q0 = m1
++ "vld1.32 {d2, d3}, [%1]! \n\t" //q1 = m1+4
++ "vld1.32 {d4, d5}, [%1]! \n\t" //q2 = m1+8
++ "vld1.32 {d6, d7}, [%1] \n\t" //q3 = m1+12
++ "vld1.32 {d16, d17}, [%0]! \n\t" //q8 = m0
++ "vld1.32 {d18, d19}, [%0]! \n\t" //q9 = m0+4
++ "vld1.32 {d20, d21}, [%0]! \n\t" //q10 = m0+8
++ "vld1.32 {d22, d23}, [%0] \n\t" //q11 = m0+12
++
++ "vmul.f32 q12, q8, d0[0] \n\t" //q12 = q8 * d0[0]
++ "vmul.f32 q13, q8, d2[0] \n\t" //q13 = q8 * d2[0]
++ "vmul.f32 q14, q8, d4[0] \n\t" //q14 = q8 * d4[0]
++ "vmul.f32 q15, q8, d6[0] \n\t" //q15 = q8 * d6[0]
++ "vmla.f32 q12, q9, d0[1] \n\t" //q12 = q9 * d0[1]
++ "vmla.f32 q13, q9, d2[1] \n\t" //q13 = q9 * d2[1]
++ "vmla.f32 q14, q9, d4[1] \n\t" //q14 = q9 * d4[1]
++ "vmla.f32 q15, q9, d6[1] \n\t" //q15 = q9 * d6[1]
++ "vmla.f32 q12, q10, d1[0] \n\t" //q12 = q10 * d0[0]
++ "vmla.f32 q13, q10, d3[0] \n\t" //q13 = q10 * d2[0]
++ "vmla.f32 q14, q10, d5[0] \n\t" //q14 = q10 * d4[0]
++ "vmla.f32 q15, q10, d7[0] \n\t" //q15 = q10 * d6[0]
++ "vmla.f32 q12, q11, d1[1] \n\t" //q12 = q11 * d0[1]
++ "vmla.f32 q13, q11, d3[1] \n\t" //q13 = q11 * d2[1]
++ "vmla.f32 q14, q11, d5[1] \n\t" //q14 = q11 * d4[1]
++ "vmla.f32 q15, q11, d7[1] \n\t" //q15 = q11 * d6[1]
++
++ "vst1.32 {d24, d25}, [%2]! \n\t" //d = q12
++ "vst1.32 {d26, d27}, [%2]! \n\t" //d+4 = q13
++ "vst1.32 {d28, d29}, [%2]! \n\t" //d+8 = q14
++ "vst1.32 {d30, d31}, [%2] \n\t" //d+12 = q15
++
++ :"+r"(m0), "+r"(m1), "+r"(dest):
++ : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
++ "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23",
++ "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31",
++ "memory"
++ );
++}
++
++static void TransformVectorNormalize_neon(float vec[3], float mtx[4][4])
++{
++ asm volatile (
++ "vld1.32 {d0}, [%1] \n\t" //Q0 = v
++ "flds s2, [%1, #8] \n\t" //Q0 = v
++ "vld1.32 {d18, d19}, [%0]! \n\t" //Q1 = m
++ "vld1.32 {d20, d21}, [%0]! \n\t" //Q2 = m+4
++ "vld1.32 {d22, d23}, [%0] \n\t" //Q3 = m+8
++
++ "vmul.f32 q2, q9, d0[0] \n\t" //q2 = q9*Q0[0]
++ "vmla.f32 q2, q10, d0[1] \n\t" //Q5 += Q1*Q0[1]
++ "vmla.f32 q2, q11, d1[0] \n\t" //Q5 += Q2*Q0[2]
++
++ "vmul.f32 d0, d4, d4 \n\t" //d0 = d0*d0
++ "vpadd.f32 d0, d0, d0 \n\t" //d0 = d[0] + d[1]
++ "vmla.f32 d0, d5, d5 \n\t" //d0 = d0 + d1*d1
++
++ "vmov.f32 d1, d0 \n\t" //d1 = d0
++ "vrsqrte.f32 d0, d0 \n\t" //d0 = ~ 1.0 / sqrt(d0)
++ "vmul.f32 d2, d0, d1 \n\t" //d2 = d0 * d1
++ "vrsqrts.f32 d3, d2, d0 \n\t" //d3 = (3 - d0 * d2) / 2
++ "vmul.f32 d0, d0, d3 \n\t" //d0 = d0 * d3
++ "vmul.f32 d2, d0, d1 \n\t" //d2 = d0 * d1
++ "vrsqrts.f32 d3, d2, d0 \n\t" //d3 = (3 - d0 * d3) / 2
++ "vmul.f32 d0, d0, d3 \n\t" //d0 = d0 * d4
++
++ "vmul.f32 q2, q2, d0[0] \n\t" //d0= d2*d4
++
++ "vst1.32 {d4}, [%1] \n\t" //Q4 = m+12
++ "fsts s10, [%1, #8] \n\t" //Q4 = m+12
++ : "+r"(mtx): "r"(vec)
++ : "d0","d1","d2","d3","d18","d19","d20","d21","d22", "d23", "memory"
++ );
++}
++
++static void Normalize_neon(float v[3])
++{
++ asm volatile (
++ "vld1.32 {d4}, [%0]! \n\t" //d4={x,y}
++ "flds s10, [%0] \n\t" //d5[0] = z
++ "sub %0, %0, #8 \n\t" //d5[0] = z
++ "vmul.f32 d0, d4, d4 \n\t" //d0= d4*d4
++ "vpadd.f32 d0, d0, d0 \n\t" //d0 = d[0] + d[1]
++ "vmla.f32 d0, d5, d5 \n\t" //d0 = d0 + d5*d5
++
++ "vmov.f32 d1, d0 \n\t" //d1 = d0
++ "vrsqrte.f32 d0, d0 \n\t" //d0 = ~ 1.0 / sqrt(d0)
++ "vmul.f32 d2, d0, d1 \n\t" //d2 = d0 * d1
++ "vrsqrts.f32 d3, d2, d0 \n\t" //d3 = (3 - d0 * d2) / 2
++ "vmul.f32 d0, d0, d3 \n\t" //d0 = d0 * d3
++ "vmul.f32 d2, d0, d1 \n\t" //d2 = d0 * d1
++ "vrsqrts.f32 d3, d2, d0 \n\t" //d3 = (3 - d0 * d3) / 2
++ "vmul.f32 d0, d0, d3 \n\t" //d0 = d0 * d4
++
++ "vmul.f32 q2, q2, d0[0] \n\t" //d0= d2*d4
++ "vst1.32 {d4}, [%0]! \n\t" //d2={x0,y0}, d3={z0, w0}
++ "fsts s10, [%0] \n\t" //d2={x0,y0}, d3={z0, w0}
++
++ :"+r"(v) :
++ : "d0", "d1", "d2", "d3", "d4", "d5", "memory"
++ );
++}
++
++static float DotProduct_neon( float v0[3], float v1[3] )
++{
++ float dot;
++ asm volatile (
++ "vld1.32 {d8}, [%1]! \n\t" //d8={x0,y0}
++ "vld1.32 {d10}, [%2]! \n\t" //d10={x1,y1}
++ "flds s18, [%1, #0] \n\t" //d9[0]={z0}
++ "flds s22, [%2, #0] \n\t" //d11[0]={z1}
++ "vmul.f32 d12, d8, d10 \n\t" //d0= d2*d4
++ "vpadd.f32 d12, d12, d12 \n\t" //d0 = d[0] + d[1]
++ "vmla.f32 d12, d9, d11 \n\t" //d0 = d0 + d3*d5
++ "fmrs %0, s24 \n\t" //r0 = s0
++ : "=r"(dot), "+r"(v0), "+r"(v1):
++ : "d8", "d9", "d10", "d11", "d12"
++
++ );
++ return dot;
++}
++
++void MathInitNeon()
++{
++ MulMatrices = MultMatrix_neon;
++ //TransformVectorNormalize = TransformVectorNormalize_neon;
++ NormalizeVector = Normalize_neon;
++ DotProduct = DotProduct_neon;
++}
+diff -Naur ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glide64/Config.cpp ./Glide64/Config.cpp
+--- ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glide64/Config.cpp 2013-09-06 22:05:29.000000000 +0200
++++ ./Glide64/Config.cpp 2013-09-07 10:51:27.000000000 +0200
+@@ -89,7 +89,7 @@
+ { 640, 480 },
+ { 800, 600 },
+ { 960, 720 },
+- { 856, 480 },
++ { 800, 480 },
+ { 512, 256 },
+ { 1024, 768 },
+ { 1280, 1024 },
+diff -Naur ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glide64/CRC.cpp ./Glide64/CRC.cpp
+--- ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glide64/CRC.cpp 2013-09-06 22:05:28.000000000 +0200
++++ ./Glide64/CRC.cpp 2013-09-08 13:12:00.000000000 +0200
+@@ -43,6 +43,7 @@
+ //
+ //****************************************************************
+ //*
++
+ #define CRC32_POLYNOMIAL 0x04C11DB7
+
+ unsigned int CRCTable[ 256 ];
+@@ -140,3 +141,4 @@
+ return Crc32;
+ }
+ //*/
++
+diff -Naur ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glide64/FBtoScreen.cpp ./Glide64/FBtoScreen.cpp
+--- ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glide64/FBtoScreen.cpp 2013-09-06 22:05:29.000000000 +0200
++++ ./Glide64/FBtoScreen.cpp 2013-09-08 11:57:33.000000000 +0200
+@@ -165,12 +165,15 @@
+ for (wxUint32 w = 0; w < 256; w++)
+ {
+ col = *(src++);
+- r = (wxUint8)((col >> 24)&0xFF);
++ r = (wxUint8)((col >> (24+3))&0x1F);
++ g = (wxUint8)((col >> (16+2))&0x3F);
++ b = (wxUint8)((col >> (8+3))&0x1F);
++/* r = (wxUint8)((col >> 24)&0xFF);
+ r = (wxUint8)((float)r / 255.0f * 31.0f);
+ g = (wxUint8)((col >> 16)&0xFF);
+ g = (wxUint8)((float)g / 255.0f * 63.0f);
+ b = (wxUint8)((col >> 8)&0xFF);
+- b = (wxUint8)((float)b / 255.0f * 31.0f);
++ b = (wxUint8)((float)b / 255.0f * 31.0f);*/ //*SEB*
+ *(dst++) = (r << 11) | (g << 5) | b;
+ }
+ src += (fb_info.width - 256);
+@@ -261,12 +264,15 @@
+ if (idx >= bound)
+ break;
+ c32 = src32[idx];
+- r = (wxUint8)((c32 >> 24)&0xFF);
++ r = (wxUint8)((c32 >> (24+3))&0x1F);
++ g = (wxUint8)((c32 >> (16+2))&0x3F);
++ b = (wxUint8)((c32 >> (8+3))&0x1F);
++/* r = (wxUint8)((c32 >> 24)&0xFF);
+ r = (wxUint8)((float)r / 255.0f * 31.0f);
+ g = (wxUint8)((c32 >> 16)&0xFF);
+ g = (wxUint8)((float)g / 255.0f * 63.0f);
+ b = (wxUint8)((c32 >> 8)&0xFF);
+- b = (wxUint8)((float)b / 255.0f * 31.0f);
++ b = (wxUint8)((float)b / 255.0f * 31.0f);*/ //*SEB*
+ a = (c32&0xFF) ? 1 : 0;
+ *(dst++) = (a<<15) | (r << 10) | (g << 5) | b;
+ }
+diff -Naur ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glide64/Gfx_1.3.h ./Glide64/Gfx_1.3.h
+--- ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glide64/Gfx_1.3.h 2013-09-06 22:05:29.000000000 +0200
++++ ./Glide64/Gfx_1.3.h 2013-09-08 16:22:57.000000000 +0200
+@@ -106,6 +106,8 @@
+ // ** TAKE OUT BEFORE RELEASE!!! **
+ //#define LOGGING // log of spec functions called
+ //#define LOG_KEY // says "Key!!!" in the log when space bar is pressed
++//#define EXT_LOGGING
++//#define PERFORMANCE
+
+ //#define LOG_UCODE
+
+@@ -120,15 +122,15 @@
+
+ #define FPS // fps counter able? (not enabled necessarily)
+
+-#define LOGNOTKEY // Log if not pressing:
+-#define LOGKEY 0x11 // this key (CONTROL)
++//#define LOGNOTKEY // Log if not pressing:
++//#define LOGKEY 0x11 // this key (CONTROL)
+
+ //#define LOG_COMMANDS // log the whole 64-bit command as (0x........, 0x........)
+
+ #define CATCH_EXCEPTIONS // catch exceptions so it doesn't freeze and will report
+ // "The gfx plugin has caused an exception" instead.
+
+-#define FLUSH // flush the file buffer. slower logging, but makes sure
++//#define FLUSH // flush the file buffer. slower logging, but makes sure
+ // the command is logged before continuing (in case of
+ // crash or exception, the log will not be cut short)
+ #ifndef _ENDUSER_RELEASE_
+@@ -144,7 +146,7 @@
+
+
+ // Usually enabled
+-#define LARGE_TEXTURE_HANDLING // allow large-textured objects to be split?
++//#define LARGE_TEXTURE_HANDLING // allow large-textured objects to be split?
+
+ #ifdef ALTTAB_FIX
+ extern HHOOK hhkLowLevelKybd;
+@@ -189,7 +191,6 @@
+
+ int CheckKeyPressed(int key, int mask);
+
+-//#define PERFORMANCE
+ #ifdef PERFORMANCE
+ extern int64 perf_cur;
+ extern int64 perf_next;
+diff -Naur ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glide64/Main.cpp ./Glide64/Main.cpp
+--- ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glide64/Main.cpp 2013-09-06 22:05:29.000000000 +0200
++++ ./Glide64/Main.cpp 2013-09-15 17:06:29.000000000 +0200
+@@ -170,7 +170,7 @@
+ // 60=0x0, 70=0x1, 72=0x2, 75=0x3, 80=0x4, 90=0x5, 100=0x6, 85=0x7, 120=0x8, none=0xff
+
+ #ifdef PAULSCODE
+-#include "ae_bridge.h"
++//#include "ae_bridge.h"
+ #include "FrameSkipper.h"
+ FrameSkipper frameSkipper;
+ #endif
+@@ -1768,12 +1768,13 @@
+ EXPORT void CALL RomClosed (void)
+ {
+ VLOG ("RomClosed ()\n");
++printf("RomClosed ()\n");
+
+ CLOSE_RDP_LOG ();
+ CLOSE_RDP_E_LOG ();
+ rdp.window_changed = TRUE;
+ romopen = FALSE;
+- if (fullscreen && evoodoo)
++// if (fullscreen && evoodoo)//*SEB*
+ ReleaseGfx ();
+ }
+
+@@ -1973,9 +1974,6 @@
+ wxUint32 update_screen_count = 0;
+ EXPORT void CALL UpdateScreen (void)
+ {
+-#ifdef PAULSCODE
+- frameSkipper.update();
+-#endif
+ #ifdef LOG_KEY
+ if (CheckKeyPressed(G64_VK_SPACE, 0x0001))
+ {
+@@ -2020,6 +2018,9 @@
+ no_dlist = true;
+ ClearCache ();
+ UpdateScreen();
++#ifdef PAULSCODE
++ frameSkipper.update();
++#endif
+ return;
+ }
+ //*/
+@@ -2035,11 +2036,17 @@
+ rdp.updatescreen = 1;
+ newSwapBuffers ();
+ }
++#ifdef PAULSCODE
++ frameSkipper.update();
++#endif
+ return;
+ }
+ //*/
+ if (settings.swapmode == 0)
+ newSwapBuffers ();
++#ifdef PAULSCODE
++ frameSkipper.update();
++#endif
+ }
+
+ static void DrawWholeFrameBufferToScreen()
+diff -Naur ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glide64/rdp.cpp ./Glide64/rdp.cpp
+--- ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glide64/rdp.cpp 2013-09-06 22:05:29.000000000 +0200
++++ ./Glide64/rdp.cpp 2013-09-13 22:23:52.000000000 +0200
+@@ -56,6 +56,10 @@
+ extern FrameSkipper frameSkipper;
+ #endif
+
++#ifdef PERFORMANCE
++#include "ticks.h"
++#endif
++
+ /*
+ const int NumOfFormats = 3;
+ SCREEN_SHOT_FORMAT ScreenShotFormats[NumOfFormats] = { {wxT("BMP"), wxT("bmp"), wxBITMAP_TYPE_BMP}, {wxT("PNG"), wxT("png"), wxBITMAP_TYPE_PNG}, {wxT("JPEG"), wxT("jpeg"), wxBITMAP_TYPE_JPEG} };
+@@ -633,18 +637,21 @@
+
+ EXPORT void CALL ProcessDList(void)
+ {
+- SoftLocker lock(mutexProcessDList);
++// SoftLocker lock(mutexProcessDList);
+ #ifdef PAULSCODE
+- if (frameSkipper.willSkipNext() || !lock.IsOk()) //mutex is busy
++ if (frameSkipper.willSkipNext() /*|| !lock.IsOk()*/) //mutex is busy
+ #else
+- if (!lock.IsOk()) //mutex is busy
++ if (/*!lock.IsOk()*/0) //mutex is busy
+ #endif
+ {
++// printf("Frameskip, reason=%s\n", (lock.IsOk())?"lock":"frameskip");
+ if (!fullscreen)
+ drawNoFullscreenMessage();
+ // Set an interrupt to allow the game to continue
+ *gfx.MI_INTR_REG |= 0x20;
+ gfx.CheckInterrupts();
++ *gfx.MI_INTR_REG |= 0x01;
++ gfx.CheckInterrupts();
+ return;
+ }
+
+@@ -717,7 +724,18 @@
+ unimp.close();
+ }
+ #endif
+-
++/*
++#ifdef PAULSCODE
++ if (frameSkipper.willSkipNext())
++ {
++ *gfx.MI_INTR_REG |= 0x20;
++ gfx.CheckInterrupts();
++ *gfx.MI_INTR_REG |= 0x01;
++ gfx.CheckInterrupts();
++ return;
++ }
++#endif
++*/
+ //* Set states *//
+ if (settings.swapmode > 0)
+ SwapOK = TRUE;
+@@ -818,7 +836,7 @@
+ rdp.pc[rdp.pc_i] = (a+8) & BMASK;
+
+ #ifdef PERFORMANCE
+- perf_cur = wxDateTime::UNow();
++ perf_cur = ticksGetTicks();
+ #endif
+ // Process this instruction
+ gfx_instruction[settings.ucode][rdp.cmd0>>24] ();
+@@ -837,9 +855,13 @@
+ }
+
+ #ifdef PERFORMANCE
+- perf_next = wxDateTime::UNow();
+- sprintf (out_buf, "perf %08lx: %016I64d\n", a-8, (perf_next-perf_cur).Format(_T("%l")).mb_str());
++ perf_next = ticksGetTicks();
++ sprintf (out_buf, "perf %08x: %lli\n", a-8, (perf_next-perf_cur));
++#ifdef RDP_LOGGING
+ rdp_log << out_buf;
++#else
++ printf(out_buf);
++#endif
+ #endif
+
+ } while (!rdp.halt);
+diff -Naur ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glide64/Util.cpp ./Glide64/Util.cpp
+--- ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glide64/Util.cpp 2013-09-06 22:05:29.000000000 +0200
++++ ./Glide64/Util.cpp 2013-09-08 12:39:52.000000000 +0200
+@@ -289,29 +289,29 @@
+ deltaZ = dzdx = 0;
+ if (linew == 0 && (fb_depth_render_enabled || (rdp.rm & 0xC00) == 0xC00))
+ {
+- double X0 = vtx[0]->sx / rdp.scale_x;
+- double Y0 = vtx[0]->sy / rdp.scale_y;
+- double X1 = vtx[1]->sx / rdp.scale_x;
+- double Y1 = vtx[1]->sy / rdp.scale_y;
+- double X2 = vtx[2]->sx / rdp.scale_x;
+- double Y2 = vtx[2]->sy / rdp.scale_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 = vtx[0]->sz - vtx[2]->sz;
+- double diffz_12 = vtx[1]->sz - vtx[2]->sz;
+- double fdzdx = (diffz_02 * diffy_12 - diffz_12 * diffy_02) / denom;
++ float X0 = vtx[0]->sx / rdp.scale_x;
++ float Y0 = vtx[0]->sy / rdp.scale_y;
++ float X1 = vtx[1]->sx / rdp.scale_x;
++ float Y1 = vtx[1]->sy / rdp.scale_y;
++ float X2 = vtx[2]->sx / rdp.scale_x;
++ float Y2 = vtx[2]->sy / rdp.scale_y;
++ float diffy_02 = Y0 - Y2;
++ float diffy_12 = Y1 - Y2;
++ float diffx_02 = X0 - X2;
++ float diffx_12 = X1 - X2;
++
++ float denom = (diffx_02 * diffy_12 - diffx_12 * diffy_02);
++ if(denom*denom > 0.0f)
++ {
++ float diffz_02 = vtx[0]->sz - vtx[2]->sz;
++ float diffz_12 = vtx[1]->sz - vtx[2]->sz;
++ float fdzdx = (diffz_02 * diffy_12 - diffz_12 * diffy_02) / denom;
+ if ((rdp.rm & 0xC00) == 0xC00) {
+ // Calculate deltaZ per polygon for Decal z-mode
+- double fdzdy = (diffz_02 * diffx_12 - diffz_12 * diffx_02) / denom;
+- double fdz = fabs(fdzdx) + fabs(fdzdy);
++ float fdzdy = (diffz_02 * diffx_12 - diffz_12 * diffx_02) / denom;
++ float fdz = fabs(fdzdx) + fabs(fdzdy);
+ if ((settings.hacks & hack_Zelda) && (rdp.rm & 0x800))
+- fdz *= 4.0; // Decal mode in Zelda sometimes needs mutiplied deltaZ to work correct, e.g. roads
++ fdz *= 4.0f; // Decal mode in Zelda sometimes needs mutiplied deltaZ to work correct, e.g. roads
+ deltaZ = max(8, (int)fdz);
+ }
+ dzdx = (int)(fdzdx * 65536.0);
+@@ -881,12 +881,12 @@
+ //*/
+
+ typedef struct {
+- double d;
+- double x;
+- double y;
++ float d; //*SEB* was doubles
++ float x;
++ float y;
+ } LineEuqationType;
+
+-static double EvaLine(LineEuqationType &li, double x, double y)
++static float EvaLine(LineEuqationType &li, float x, float y) //*SEB* all double before
+ {
+ return li.x*x+li.y*y+li.d;
+ }
+@@ -906,7 +906,7 @@
+ }
+
+
+-__inline double interp3p(float a, float b, float c, double r1, double r2)
++__inline float interp3p(float a, float b, float c, float r1, float r2) //*SEB* r1 and r2 and function was double
+ {
+ return (a)+(((b)+((c)-(b))*(r2))-(a))*(r1);
+ }
+@@ -915,34 +915,34 @@
+ (a+(((b)+((c)-(b))*(r2))-(a))*(r1))
+ */
+
+-static void InterpolateColors3(VERTEX &v1, VERTEX &v2, VERTEX &v3, VERTEX &out)
++static void InterpolateColors3(VERTEX &v1, VERTEX &v2, VERTEX &v3, VERTEX &out) //*SEB* all double before
+ {
+
+ LineEuqationType line;
+ Create1LineEq(line, v2, v3, v1);
+
+- double aDot = (out.x*line.x + out.y*line.y);
+- double bDot = (v1.sx*line.x + v1.sy*line.y);
++ float aDot = (out.x*line.x + out.y*line.y);
++ float bDot = (v1.sx*line.x + v1.sy*line.y);
+
+- double scale1 = ( - line.d - aDot) / ( bDot - aDot );
++ float scale1 = ( - line.d - aDot) / ( bDot - aDot );
+
+- double tx = out.x + scale1 * (v1.sx - out.x);
+- double ty = out.y + scale1 * (v1.sy - out.y);
++ float tx = out.x + scale1 * (v1.sx - out.x);
++ float ty = out.y + scale1 * (v1.sy - out.y);
+
+- double s1 = 101.0, s2 = 101.0;
+- double den = tx - v1.sx;
+- if (fabs(den) > 1.0)
++ float s1 = 101.0, s2 = 101.0;
++ float den = tx - v1.sx;
++ if (fabsf(den) > 1.0)
+ s1 = (out.x-v1.sx)/den;
+ if (s1 > 100.0f)
+ s1 = (out.y-v1.sy)/(ty-v1.sy);
+
+ den = v3.sx - v2.sx;
+- if (fabs(den) > 1.0)
++ if (fabsf(den) > 1.0)
+ s2 = (tx-v2.sx)/den;
+ if (s2 > 100.0f)
+ s2 =(ty-v2.sy)/(v3.sy-v2.sy);
+
+- double w = 1.0/interp3p(v1.oow,v2.oow,v3.oow,s1,s2);
++ float w = 1.0/interp3p(v1.oow,v2.oow,v3.oow,s1,s2);
+
+ out.r = real_to_char(interp3p(v1.r*v1.oow,v2.r*v2.oow,v3.r*v3.oow,s1,s2)*w);
+ out.g = real_to_char(interp3p(v1.g*v1.oow,v2.g*v2.oow,v3.g*v3.oow,s1,s2)*w);
+@@ -976,8 +976,8 @@
+ */
+ float deltaS, deltaT;
+ float deltaX, deltaY;
+- double deltaTexels, deltaPixels, lodFactor = 0;
+- double intptr;
++ float deltaTexels, deltaPixels, lodFactor = 0; //*SEB* double before
++ float intptr; //*SEB* double before
+ float s_scale = rdp.tiles[rdp.cur_tile].width / 255.0f;
+ float t_scale = rdp.tiles[rdp.cur_tile].height / 255.0f;
+ if (settings.lodmode == 1)
+@@ -1019,7 +1019,7 @@
+ float lod_fraction = 1.0f;
+ if (lod_tile < rdp.cur_tile + rdp.mipmap_level)
+ {
+- lod_fraction = max((float)modf(lodFactor / pow(2.,lod_tile),&intptr), rdp.prim_lodmin / 255.0f);
++ lod_fraction = max((float)modff(lodFactor / powf(2.,lod_tile),&intptr), (float)rdp.prim_lodmin / 255.0f);
+ }
+ float detailmax;
+ if (cmb.dc0_detailmax < 0.5f)
+diff -Naur ../../../../git/mupen64plus-ae/jni/gles2glide64/src/GlideHQ/TxDbg.cpp ./GlideHQ/TxDbg.cpp
+--- ../../../../git/mupen64plus-ae/jni/gles2glide64/src/GlideHQ/TxDbg.cpp 2013-09-06 22:05:30.000000000 +0200
++++ ./GlideHQ/TxDbg.cpp 2013-09-07 12:06:11.000000000 +0200
+@@ -28,6 +28,8 @@
+ #include
+ #include
+
++#define _GLIBCXX_HAVE_BROKEN_VSWPRINTF 1
++
+ TxDbg::TxDbg()
+ {
+ _level = DBG_LEVEL;
+diff -Naur ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glitch64/combiner.cpp ./Glitch64/combiner.cpp
+--- ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glitch64/combiner.cpp 2013-09-06 22:05:30.000000000 +0200
++++ ./Glitch64/combiner.cpp 2013-09-14 10:16:36.000000000 +0200
+@@ -29,6 +29,8 @@
+ #include "glide.h"
+ #include "main.h"
+
++#define GLchar char
++
+ void vbo_draw();
+
+ static int fct[4], source0[4], operand0[4], source1[4], operand1[4], source2[4], operand2[4];
+@@ -117,10 +119,11 @@
+ // using gl_FragCoord is terribly slow on ATI and varying variables don't work for some unknown
+ // reason, so we use the unused components of the texture2 coordinates
+ static const char* fragment_shader_dither =
+-" float dithx = (gl_TexCoord[2].b + 1.0)*0.5*1000.0; \n"
++" \n"
++/*" float dithx = (gl_TexCoord[2].b + 1.0)*0.5*1000.0; \n"
+ " float dithy = (gl_TexCoord[2].a + 1.0)*0.5*1000.0; \n"
+ " if(texture2D(ditherTex, vec2((dithx-32.0*floor(dithx/32.0))/32.0, \n"
+-" (dithy-32.0*floor(dithy/32.0))/32.0)).a > 0.5) discard; \n"
++" (dithy-32.0*floor(dithy/32.0))/32.0)).a > 0.5) discard; \n"*/
+ ;
+
+ static const char* fragment_shader_default =
+@@ -165,11 +168,16 @@
+ "} \n"
+ ;
+
++static const char* fragment_shader_alt_end =
++" \n"
++"} \n"
++;
++
+ static const char* vertex_shader =
+ SHADER_HEADER
+ "#define Z_MAX 65536.0 \n"
+ "attribute highp vec4 aVertex; \n"
+-"attribute highp vec4 aColor; \n"
++"attribute mediump vec4 aColor; \n" //*SEB* highp -> lowp
+ "attribute highp vec4 aMultiTexCoord0; \n"
+ "attribute highp vec4 aMultiTexCoord1; \n"
+ "attribute float aFog; \n"
+@@ -245,7 +253,7 @@
+
+ // creating a fake texture
+ glBindTexture(GL_TEXTURE_2D, default_texture);
+- glTexImage2D(GL_TEXTURE_2D, 0, 3, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture);
++ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+
+@@ -286,7 +294,7 @@
+ strlen(fragment_shader_end)+1);
+ strcpy(fragment_shader, fragment_shader_header);
+ strcat(fragment_shader, fragment_shader_default);
+- strcat(fragment_shader, fragment_shader_end);
++ strcat(fragment_shader, fragment_shader_end); /*SEB*/
+ glShaderSource(fragment_shader_object, 1, (const GLchar**)&fragment_shader, NULL);
+ free(fragment_shader);
+
+@@ -408,6 +416,7 @@
+ int dither_enabled;
+ int blackandwhite0;
+ int blackandwhite1;
++ int alpha_test; //*SEB*
+ GLuint fragment_shader_object;
+ GLuint program_object;
+ int texture0_location;
+@@ -489,6 +498,8 @@
+ int i;
+ int chroma_color_location;
+ int log_length;
++
++ int noalpha;
+
+ need_to_compile = 0;
+
+@@ -502,6 +513,7 @@
+ prog.texture0_combinera == texture0_combinera_key &&
+ prog.texture1_combinera == texture1_combinera_key &&
+ prog.fog_enabled == fog_enabled &&
++ prog.alpha_test == alpha_test && //*SEB*
+ prog.chroma_enabled == chroma_enabled &&
+ prog.dither_enabled == dither_enabled &&
+ prog.blackandwhite0 == blackandwhite0 &&
+@@ -514,11 +526,13 @@
+ }
+ }
+
+- if(shader_programs != NULL)
+- shader_programs = (shader_program_key*)realloc(shader_programs, (number_of_programs+1)*sizeof(shader_program_key));
++ if(shader_programs != NULL) {
++ if ((number_of_programs+1)>1024)
++ shader_programs = (shader_program_key*)realloc(shader_programs, (number_of_programs+1)*sizeof(shader_program_key));
++ }
+ else
+- shader_programs = (shader_program_key*)malloc(sizeof(shader_program_key));
+- //printf("number of shaders %d\n", number_of_programs);
++ shader_programs = (shader_program_key*)malloc(sizeof(shader_program_key)*1024);
++ //printf("number of shaders %d\n", number_of_programs);
+
+ shader_programs[number_of_programs].color_combiner = color_combiner_key;
+ shader_programs[number_of_programs].alpha_combiner = alpha_combiner_key;
+@@ -531,6 +545,7 @@
+ shader_programs[number_of_programs].dither_enabled = dither_enabled;
+ shader_programs[number_of_programs].blackandwhite0 = blackandwhite0;
+ shader_programs[number_of_programs].blackandwhite1 = blackandwhite1;
++ shader_programs[number_of_programs].alpha_test = alpha_test; //*SEB*
+
+ if(chroma_enabled)
+ {
+@@ -557,7 +572,10 @@
+ strcat(fragment_shader, fragment_shader_color_combiner);
+ strcat(fragment_shader, fragment_shader_alpha_combiner);
+ if(fog_enabled) strcat(fragment_shader, fragment_shader_fog);
+- strcat(fragment_shader, fragment_shader_end);
++ if (alpha_test)
++ strcat(fragment_shader, fragment_shader_end);
++ else
++ strcat(fragment_shader, fragment_shader_alt_end); //*SEB*
+ if(chroma_enabled) strcat(fragment_shader, fragment_shader_chroma);
+
+ shader_programs[number_of_programs].fragment_shader_object = glCreateShader(GL_FRAGMENT_SHADER);
+@@ -1719,7 +1737,7 @@
+ glActiveTexture(GL_TEXTURE2);
+ glEnable(GL_TEXTURE_2D);
+ glBindTexture(GL_TEXTURE_2D, 33*1024*1024);
+- glTexImage2D(GL_TEXTURE_2D, 0, 4, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture);
++ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 32, 32, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
+ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
+ glDisable(GL_TEXTURE_2D);
+diff -Naur ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glitch64/geometry.cpp ./Glitch64/geometry.cpp
+--- ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glitch64/geometry.cpp 2013-09-06 22:05:30.000000000 +0200
++++ ./Glitch64/geometry.cpp 2013-09-12 22:13:33.000000000 +0200
+@@ -34,7 +34,7 @@
+ #define VERTEX_SIZE sizeof(VERTEX) //Size of vertex struct
+
+ #ifdef PAULSCODE
+-#include "ae_bridge.h"
++//#include "ae_bridge.h"
+ static float polygonOffsetFactor;
+ static float polygonOffsetUnits;
+ #endif
+@@ -338,8 +338,11 @@
+ void FindBestDepthBias()
+ {
+ #ifdef PAULSCODE
+- int hardwareType = Android_JNI_GetHardwareType();
+- Android_JNI_GetPolygonOffset(hardwareType, 1, &polygonOffsetFactor, &polygonOffsetUnits);
++/* int hardwareType = Android_JNI_GetHardwareType();
++ Android_JNI_GetPolygonOffset(hardwareType, 1, &polygonOffsetFactor, &polygonOffsetUnits);*/
++// glPolygonOffset(0.2f, 0.2f);
++ polygonOffsetFactor=0.2f;
++ polygonOffsetUnits=0.2f;
+ #else
+ float f, bestz = 0.25f;
+ int x;
+@@ -386,7 +389,11 @@
+ if (level)
+ {
+ #ifdef PAULSCODE
+- glPolygonOffset(polygonOffsetFactor, polygonOffsetUnits);
++// glPolygonOffset(polygonOffsetFactor, polygonOffsetUnits);
++ if(w_buffer_mode)
++ glPolygonOffset(1.0f, -(float)level*polygonOffsetUnits);
++ else
++ glPolygonOffset(0, (float)level*3.0f);
+ #else
+ if(w_buffer_mode)
+ glPolygonOffset(1.0f, -(float)level*zscale/255.0f);
+@@ -408,13 +415,13 @@
+ grDrawTriangle( const void *a, const void *b, const void *c )
+ {
+ LOG("grDrawTriangle()\r\n\t");
+-
++/*
+ if(nvidia_viewport_hack && !render_to_texture)
+ {
+ glViewport(0, viewport_offset, viewport_width, viewport_height);
+ nvidia_viewport_hack = 0;
+ }
+-
++*/
+ reloadTexture();
+
+ if(need_to_compile) compile_shader();
+@@ -588,13 +595,13 @@
+ {
+ void **pointers = (void**)pointers2;
+ LOG("grDrawVertexArray(%d,%d)\r\n", mode, Count);
+-
++/*
+ if(nvidia_viewport_hack && !render_to_texture)
+ {
+ glViewport(0, viewport_offset, viewport_width, viewport_height);
+ nvidia_viewport_hack = 0;
+ }
+-
++*/
+ reloadTexture();
+
+ if(need_to_compile) compile_shader();
+@@ -612,13 +619,13 @@
+ grDrawVertexArrayContiguous(FxU32 mode, FxU32 Count, void *pointers, FxU32 stride)
+ {
+ LOG("grDrawVertexArrayContiguous(%d,%d,%d)\r\n", mode, Count, stride);
+-
++/*
+ if(nvidia_viewport_hack && !render_to_texture)
+ {
+ glViewport(0, viewport_offset, viewport_width, viewport_height);
+ nvidia_viewport_hack = 0;
+ }
+-
++*/
+ if(stride != 156)
+ {
+ LOGINFO("Incompatible stride\n");
+diff -Naur ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glitch64/glitchmain.cpp ./Glitch64/glitchmain.cpp
+--- ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glitch64/glitchmain.cpp 2013-09-06 22:05:30.000000000 +0200
++++ ./Glitch64/glitchmain.cpp 2013-09-15 17:13:49.000000000 +0200
+@@ -656,6 +656,9 @@
+ #ifdef _WIN32
+ glCompressedTexImage2DARB = (PFNGLCOMPRESSEDTEXIMAGE2DPROC)wglGetProcAddress("glCompressedTexImage2DARB");
+ #endif
++/*SEB*/
++ glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
++ glPixelStorei(GL_PACK_ALIGNMENT, 1);
+
+
+ #ifdef _WIN32
+@@ -806,6 +809,7 @@
+ fullscreen = 0;
+ }
+ #else
++ CoreVideo_Quit();
+ //SDL_QuitSubSystem(SDL_INIT_VIDEO);
+ //sleep(2);
+ #endif
+@@ -823,7 +827,7 @@
+ int i;
+ static int fbs_init = 0;
+
+- //printf("grTextureBufferExt(%d, %d, %d, %d, %d, %d, %d)\r\n", tmu, startAddress, lodmin, lodmax, aspect, fmt, evenOdd);
++ //printf("grTextureBufferExt(%d, %d, %d, %d, %d, %d, %d)\r\n", tmu, startAddress, lodmin, lodmax, aspect, fmt, evenOdd);
+ LOG("grTextureBufferExt(%d, %d, %d, %d %d, %d, %d)\r\n", tmu, startAddress, lodmin, lodmax, aspect, fmt, evenOdd);
+ if (lodmin != lodmax) display_warning("grTextureBufferExt : loading more than one LOD");
+ if (!use_fbo) {
+@@ -907,8 +911,8 @@
+ tmu_usage[rtmu].min = pBufferAddress;
+ if ((unsigned int) tmu_usage[rtmu].max < pBufferAddress+size)
+ tmu_usage[rtmu].max = pBufferAddress+size;
+- // printf("tmu %d usage now %gMb - %gMb\n",
+- // rtmu, tmu_usage[rtmu].min/1024.0f, tmu_usage[rtmu].max/1024.0f);
++ //printf("tmu %d usage now %gMb - %gMb\n",
++ // rtmu, tmu_usage[rtmu].min/1024.0f, tmu_usage[rtmu].max/1024.0f);
+
+
+ width = pBufferWidth;
+@@ -927,14 +931,14 @@
+ texbufs[i].fmt = fmt;
+ if (i == texbuf_i)
+ texbuf_i = (texbuf_i+1)&(NB_TEXBUFS-1);
+- //printf("texbuf %x fmt %x\n", pBufferAddress, fmt);
++ //printf("texbuf %x fmt %x\n", pBufferAddress, fmt);
+
+ // ZIGGY it speeds things up to not delete the buffers
+ // a better thing would be to delete them *sometimes*
+ // remove_tex(pBufferAddress+1, pBufferAddress + size);
+ add_tex(pBufferAddress);
+
+- //printf("viewport %dx%d\n", width, height);
++ //printf("viewport %dx%d\n", width, height);
+ if (height > screen_height) {
+ glViewport( 0, viewport_offset + screen_height - height, width, height);
+ } else
+@@ -1009,7 +1013,6 @@
+ }
+ }
+ }
+-
+ remove_tex(pBufferAddress, pBufferAddress + width*height*2/*grTexFormatSize(fmt)*/);
+ //create new FBO
+ glGenFramebuffers( 1, &(fbs[nb_fb].fbid) );
+@@ -1768,6 +1771,7 @@
+ GrLfbInfo_t *info )
+ {
+ LOG("grLfbLock(%d,%d,%d,%d,%d)\r\n", type, buffer, writeMode, origin, pixelPipeline);
++//printf("grLfbLock(%d,%d,%d,%d,%d)\r\n", type, buffer, writeMode, origin, pixelPipeline);
+ if (type == GR_LFB_WRITE_ONLY)
+ {
+ display_warning("grLfbLock : write only");
+@@ -1792,12 +1796,32 @@
+ if(buffer != GR_BUFFER_AUXBUFFER)
+ {
+ if (writeMode == GR_LFBWRITEMODE_888) {
++/*SEB*/
++ buf = (unsigned char*)malloc(width*height*4);
+ //printf("LfbLock GR_LFBWRITEMODE_888\n");
+ info->lfbPtr = frameBuffer;
+ info->strideInBytes = width*4;
+ info->writeMode = GR_LFBWRITEMODE_888;
+ info->origin = origin;
+ //glReadPixels(0, viewport_offset, width, height, GL_BGRA, GL_UNSIGNED_BYTE, frameBuffer);
++ glReadPixels(0, viewport_offset, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
++
++/*SEB*/
++ unsigned char *p=buf;
++ for (j=0; jorigin = origin;
+ glReadPixels(0, viewport_offset, width, height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
+
++/*SEB*/
++ unsigned char *p=buf;
+ for (j=0; j> 3) << 11) |
+ ((buf[j*width*4+i*4+1] >> 2) << 5) |
+- (buf[j*width*4+i*4+2] >> 3);
++ (buf[j*width*4+i*4+2] >> 3);*/
++ *(f++) =
++ ((*(p) >> 3) << 11) |
++ ((*(p+1) >> 2) << 5) |
++ (*(p+2) >> 3);
++ p+=4;
+ }
+ }
+ free(buf);
+@@ -1826,6 +1858,7 @@
+ info->strideInBytes = width*2;
+ info->writeMode = GR_LFBWRITEMODE_ZA16;
+ info->origin = origin;
++ //*SEB* *TODO* check alignment
+ glReadPixels(0, viewport_offset, width, height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer);
+ }
+ }
+@@ -1855,6 +1888,7 @@
+ unsigned short *frameBuffer = (unsigned short*)dst_data;
+ unsigned short *depthBuffer = (unsigned short*)dst_data;
+ LOG("grLfbReadRegion(%d,%d,%d,%d,%d,%d)\r\n", src_buffer, src_x, src_y, src_width, src_height, dst_stride);
++//printf("grLfbReadRegion(%d,%d,%d,%d,%d,%d)\r\n", src_buffer, src_x, src_y, src_width, src_height, dst_stride);
+
+ switch(src_buffer)
+ {
+@@ -1876,15 +1910,22 @@
+ buf = (unsigned char*)malloc(src_width*src_height*4);
+
+ glReadPixels(src_x, (viewport_offset)+height-src_y-src_height, src_width, src_height, GL_RGBA, GL_UNSIGNED_BYTE, buf);
+-
+ for (j=0; j> 3) << 11) |
+ ((buf[(src_height-j-1)*src_width*4+i*4+1] >> 2) << 5) |
+- (buf[(src_height-j-1)*src_width*4+i*4+2] >> 3);
++ (buf[(src_height-j-1)*src_width*4+i*4+2] >> 3);*/
++ *(f++) =
++ ((*(p) >> 3) << 11) |
++ ((*(p+1) >> 2) << 5) |
++ (*(p+2) >> 3);
++ p+=4;
+ }
+ }
+ free(buf);
+@@ -1892,15 +1933,19 @@
+ else
+ {
+ buf = (unsigned char*)malloc(src_width*src_height*2);
+-
+- glReadPixels(src_x, (viewport_offset)+height-src_y-src_height, src_width, src_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, depthBuffer);
++//*SEB read in buf, not depthBuffer.
++ glReadPixels(src_x, (viewport_offset)+height-src_y-src_height, src_width, src_height, GL_DEPTH_COMPONENT, GL_UNSIGNED_SHORT, buf);
+
+ for (j=0;j>10)&0x1F)<<3;
+ buf[j*tex_width*4+i*4+1]=((col>>5)&0x1F)<<3;
+ buf[j*tex_width*4+i*4+2]=((col>>0)&0x1F)<<3;
+- buf[j*tex_width*4+i*4+3]= (col>>15) ? 0xFF : 0;
++ buf[j*tex_width*4+i*4+3]= (col>>15) ? 0xFF : 0;*/
++ const unsigned int col = *(f++);
++ *(p)=((col>>10)&0x1F)<<3;
++ *(p+1)=((col>>5)&0x1F)<<3;
++ *(p+2)=((col>>0)&0x1F)<<3;
++ *(p+3)= (col>>15) ? 0xFF : 0;
++ p+=4;
+ }
++ p+=comp_tex;
++ f+=comp_stride;
+ }
+ break;
+ case GR_LFBWRITEMODE_555:
+@@ -1969,12 +2029,20 @@
+ {
+ for (i=0; i>10)&0x1F)<<3;
+ buf[j*tex_width*4+i*4+1]=((col>>5)&0x1F)<<3;
+ buf[j*tex_width*4+i*4+2]=((col>>0)&0x1F)<<3;
+- buf[j*tex_width*4+i*4+3]=0xFF;
++ buf[j*tex_width*4+i*4+3]=0xFF;*/
++ const unsigned int col = *(f++);
++ *(p)=((col>>10)&0x1F)<<3;
++ *(p+1)=((col>>5)&0x1F)<<3;
++ *(p+2)=((col>>0)&0x1F)<<3;
++ *(p+3)=0xFF;
++ p+=4;
+ }
++ p+=comp_tex;
++ f+=comp_stride;
+ }
+ break;
+ case GR_LFBWRITEMODE_565:
+@@ -1982,12 +2050,20 @@
+ {
+ for (i=0; i>11)&0x1F)<<3;
+ buf[j*tex_width*4+i*4+1]=((col>>5)&0x3F)<<2;
+ buf[j*tex_width*4+i*4+2]=((col>>0)&0x1F)<<3;
+- buf[j*tex_width*4+i*4+3]=0xFF;
++ buf[j*tex_width*4+i*4+3]=0xFF;*/
++ const unsigned int col = *(f++);
++ *(p)=((col>>11)&0x1F)<<3;
++ *(p+1)=((col>>5)&0x3F)<<2;
++ *(p+2)=((col>>0)&0x1F)<<3;
++ *(p+3)=0xFF;
++ p+=4;
+ }
++ p+=comp_tex;
++ f+=comp_stride;
+ }
+ break;
+ default:
+@@ -2006,7 +2082,7 @@
+ #endif
+
+ glBindTexture(GL_TEXTURE_2D, default_texture);
+- glTexImage2D(GL_TEXTURE_2D, 0, 4, tex_width, tex_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, buf);
++ glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, tex_width, tex_height, 0, GL_RGBA, GL_UNSIGNED_BYTE, buf);
+ free(buf);
+
+ set_copy_shader();
+diff -Naur ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glitch64/textures.cpp ./Glitch64/textures.cpp
+--- ../../../../git/mupen64plus-ae/jni/gles2glide64/src/Glitch64/textures.cpp 2013-09-06 22:05:31.000000000 +0200
++++ ./Glitch64/textures.cpp 2013-09-13 11:32:50.000000000 +0200
+@@ -26,6 +26,7 @@
+ #include "glide.h"
+ #include "main.h"
+ #include
++#include
+
+ /* Napalm extensions to GrTextureFormat_t */
+ #define GR_TEXFMT_ARGB_CMP_FXT1 0x11
+@@ -107,7 +108,7 @@
+ }
+ glDeleteTextures(n, t);
+ free(t);
+- //printf("RMVTEX nbtex is now %d (%06x - %06x)\n", nbTex, idmin, idmax);
++//printf("RMVTEX nbtex is now %d (%06x - %06x)\n", nbTex, idmin, idmax);
+ }
+
+
+@@ -115,7 +116,7 @@
+ {
+ texlist *aux = list;
+ texlist *aux2;
+- //printf("ADDTEX nbtex is now %d (%06x)\n", nbTex, id);
++//printf("ADDTEX nbtex is now %d (%06x)\n", nbTex, id);
+ if (list == NULL || id < list->id)
+ {
+ nbTex++;
+@@ -435,8 +436,11 @@
+ factor = -1;
+ else
+ factor = grTexFormat2GLPackedFmt(info->format, &gltexfmt, &glpixfmt, &glpackfmt);
+-
++//printf("grTexDownloadMipmap, id=%x, size=%ix%i, format=%x\n", startAddress+1, width, height, info->format);
+ if (factor < 0) {
++ gltexfmt = GL_RGBA;
++ glpixfmt = GL_RGBA;
++ glpackfmt = GL_UNSIGNED_BYTE;
+
+ // VP fixed the texture conversions to be more accurate, also swapped
+ // the for i/j loops so that is is less likely to break the memory cache
+@@ -444,7 +448,7 @@
+ switch(info->format)
+ {
+ case GR_TEXFMT_ALPHA_8:
+- for (i=0; idata)[m];
++ ((unsigned short*)texture)[n] = texel|(texel<<8);
++ m++;
++ n++;
++ }
++ }
++
++ glformat = gltexfmt = glpixfmt = GL_LUMINANCE_ALPHA;
++ glpackfmt = GL_UNSIGNED_BYTE;
++ factor = 1;
+ break;
+ case GR_TEXFMT_INTENSITY_8: // I8 support - H.Morii
+- for (i=0; idata, width*height);
++ glformat = gltexfmt = glpixfmt = GL_LUMINANCE;
++ glpackfmt = GL_UNSIGNED_BYTE;
+ factor = 1;
+- glformat = GL_ALPHA;
+ break;
+ case GR_TEXFMT_ALPHA_INTENSITY_44:
+ #if 1
+@@ -480,9 +503,9 @@
+ {
+ for (j=0; jdata)[m];
++/* unsigned int texel = (unsigned int)((unsigned char*)info->data)[m];
+ #if 1
+- /* accurate conversion */
++ // accurate conversion
+ unsigned int texel_hi = (texel & 0x000000F0) << 20;
+ unsigned int texel_low = texel & 0x0000000F;
+ texel_low |= (texel_low << 4);
+@@ -493,61 +516,90 @@
+ texel_hi |= ((texel_low << 16) | (texel_low << 8) | texel_low);
+ #endif
+ ((unsigned int*)texture)[n] = texel_hi;
++*/
++ unsigned char texel = ((unsigned char*)info->data)[m];
++ unsigned short texel_hi = (texel & 0x000000F0) << 4;
++ unsigned short texel_low = texel & 0x0000000F;
++ texel_low |= (texel_low << 4);
++ texel_hi |= ((texel_hi << 4) | (texel_low));
++ ((unsigned short*)texture)[n] = texel_hi;
+ m++;
+ n++;
+ }
+ }
+ factor = 1;
+- glformat = GL_LUMINANCE_ALPHA;
++ glformat = gltexfmt = glpixfmt = GL_LUMINANCE_ALPHA;
++ glpackfmt = GL_UNSIGNED_BYTE;
++// glformat = GL_LUMINANCE_ALPHA;
+ #endif
+ break;
+ case GR_TEXFMT_RGB_565:
+- for (i=0; idata)[m];
++ {*/
++/* unsigned int texel = (unsigned int)((unsigned short*)info->data)[m];
+ unsigned int B = texel & 0x0000F800;
+ unsigned int G = texel & 0x000007E0;
+ unsigned int R = texel & 0x0000001F;
+ #if 0
+- /* accurate conversion */
++ // accurate conversion
+ ((unsigned int*)texture)[n] = 0xFF000000 | (R << 19) | ((R >> 2) << 16) | (G << 5) | ((G >> 9) << 8) | (B >> 8) | (B >> 13);
+ #else
+ ((unsigned int*)texture)[n] = 0xFF000000 | (R << 19) | (G << 5) | (B >> 8);
+ #endif
++*/
++/* const unsigned short texel = ((unsigned short*)info->data)[m];
++ const unsigned short B = (texel & 0xF800)>>11;
++ const unsigned short G = texel & 0x07E0;
++ const unsigned short R = (texel & 0x001F)<<11;
++ ((unsigned short*)texture)[n] = R|G|B;
+ m++;
+ n++;
+ }
+- }
++ }*/
++ memcpy(texture, info->data, width*height*2);
+ factor = 2;
+- glformat = GL_RGB;
++// glformat = GL_RGB;
++ glformat = gltexfmt = glpixfmt = GL_RGB;
++ glpackfmt = GL_UNSIGNED_SHORT_5_6_5;
+ break;
+ case GR_TEXFMT_ARGB_1555:
+ for (i=0; idata)[m];
++/* unsigned int texel = (unsigned int)((unsigned short*)info->data)[m];
+ unsigned int A = texel & 0x00008000 ? 0xFF000000 : 0;
+ unsigned int B = texel & 0x00007C00;
+ unsigned int G = texel & 0x000003E0;
+ unsigned int R = texel & 0x0000001F;
+ #if 0
+- /* accurate conversion */
++ // accurate conversion
+ ((unsigned int*)texture)[n] = A | (R << 19) | ((R >> 2) << 16) | (G << 6) | ((G >> 8) << 8) | (B >> 7) | (B >> 12);
+ #else
+ ((unsigned int*)texture)[n] = A | (R << 19) | (G << 6) | (B >> 7);
+ #endif
++*/
++ unsigned short texel = ((unsigned short*)info->data)[m];
++ unsigned short A = (texel & 0x8000)>>15;
++ ((unsigned short*)texture)[n] = A|(texel&0x7fff)<<1;
++/*
++ unsigned short B = (texel & 0x7C00)>>9;
++ unsigned short G = texel & 0x03E0<<1;
++ unsigned short R = (texel & 0x001F)<<11;
++ ((unsigned short*)texture)[n] = A|R|G|B;*/
+ m++;
+ n++;
+ }
+ }
+ factor = 2;
+- glformat = GL_RGBA;
++// glformat = GL_RGBA;
++ glformat = gltexfmt = glpixfmt = GL_RGBA;
++ glpackfmt = GL_UNSIGNED_SHORT_5_5_5_1;
+ break;
+ case GR_TEXFMT_ALPHA_INTENSITY_88:
+- for (i=0; idata, width*height*2);
+ factor = 2;
+ glformat = GL_LUMINANCE_ALPHA;
++ glformat = gltexfmt = glpixfmt = GL_LUMINANCE_ALPHA;
++ glpackfmt = GL_UNSIGNED_BYTE;
+ break;
+ case GR_TEXFMT_ARGB_4444:
+
+@@ -567,23 +622,29 @@
+ {
+ for (j=0; jdata)[m];
++/* unsigned int texel = (unsigned int)((unsigned short*)info->data)[m];
+ unsigned int A = texel & 0x0000F000;
+ unsigned int B = texel & 0x00000F00;
+ unsigned int G = texel & 0x000000F0;
+ unsigned int R = texel & 0x0000000F;
+ #if 0
+- /* accurate conversion */
++ // accurate conversion
+ ((unsigned int*)texture)[n] = (A << 16) | (A << 12) | (R << 20) | (R << 16) | (G << 8) | (G << 4) | (B >> 4) | (B >> 8);
+ #else
+ ((unsigned int*)texture)[n] = (A << 16) | (R << 20) | (G << 8) | (B >> 4);
+ #endif
++*/
++ unsigned short texel = ((unsigned short*)info->data)[m];
++ unsigned int A = (texel & 0xF000)>>12;
++ ((unsigned short*)texture)[n] = A|(texel&0x0fff)<<4;
+ m++;
+ n++;
+ }
+ }
+ factor = 2;
+ glformat = GL_RGBA;
++ glformat = gltexfmt = glpixfmt = GL_RGBA;
++ glpackfmt = GL_UNSIGNED_SHORT_4_4_4_4;
+ break;
+ case GR_TEXFMT_ARGB_8888:
+ for (i=0; i 1.0f)
+ glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, largest_supported_anisotropy);
+
+- glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture);
++//*SEB* glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, texture);
++//printf("new texture, id=%x, size=%ix%i, fmt=%x/%x\n", startAddress+1, width, height, gltexfmt, glpackfmt);
++ glTexImage2D(GL_TEXTURE_2D, 0, gltexfmt, width, height, 0, glpixfmt, glpackfmt, texture);
+ /*
+ switch(info->format)
+ {
diff --git a/source/gles2glide64/projects/android/Android.mk b/source/gles2glide64/projects/android/Android.mk
new file mode 100644
index 0000000..a405191
--- /dev/null
+++ b/source/gles2glide64/projects/android/Android.mk
@@ -0,0 +1,96 @@
+LOCAL_PATH := $(call my-dir)
+
+include $(CLEAR_VARS)
+SRCDIR := ../../src
+
+LOCAL_MODULE := gles2glide64
+LOCAL_SHARED_LIBRARIES := ae-imports SDL2 core
+LOCAL_STATIC_LIBRARIES := png
+LOCAL_ARM_MODE := arm
+
+LOCAL_C_INCLUDES := \
+ $(LOCAL_PATH)/$(SRCDIR)/Glitch64/inc \
+ $(M64P_API_INCLUDES) \
+ $(PNG_INCLUDES) \
+ $(SDL_INCLUDES) \
+ $(AE_BRIDGE_INCLUDES) \
+
+LOCAL_SRC_FILES := \
+ $(SRCDIR)/Glitch64/combiner.cpp \
+ $(SRCDIR)/Glitch64/geometry.cpp \
+ $(SRCDIR)/Glitch64/glitchmain.cpp \
+ $(SRCDIR)/Glitch64/textures.cpp \
+ $(SRCDIR)/Glide64/osal_dynamiclib_unix.c \
+ $(SRCDIR)/Glide64/3dmath.cpp \
+ $(SRCDIR)/Glide64/Combine.cpp \
+ $(SRCDIR)/Glide64/Config.cpp \
+ $(SRCDIR)/Glide64/CRC.cpp \
+ $(SRCDIR)/Glide64/Debugger.cpp \
+ $(SRCDIR)/Glide64/DepthBufferRender.cpp \
+ $(SRCDIR)/Glide64/FBtoScreen.cpp \
+ $(SRCDIR)/Glide64/FrameSkipper.cpp \
+ $(SRCDIR)/Glide64/Ini.cpp \
+ $(SRCDIR)/Glide64/Keys.cpp \
+ $(SRCDIR)/Glide64/Main.cpp \
+ $(SRCDIR)/Glide64/rdp.cpp \
+ $(SRCDIR)/Glide64/TexBuffer.cpp \
+ $(SRCDIR)/Glide64/TexCache.cpp \
+ $(SRCDIR)/Glide64/ticks.c \
+ $(SRCDIR)/Glide64/Util.cpp \
+# $(SRCDIR)/GlideHQ/Ext_TxFilter.cpp \
+# $(SRCDIR)/GlideHQ/TxFilterExport.cpp \
+# $(SRCDIR)/GlideHQ/TxFilter.cpp \
+# $(SRCDIR)/GlideHQ/TxCache.cpp \
+# $(SRCDIR)/GlideHQ/TxTexCache.cpp \
+# $(SRCDIR)/GlideHQ/TxHiResCache.cpp \
+# $(SRCDIR)/GlideHQ/TxQuantize.cpp \
+# $(SRCDIR)/GlideHQ/TxUtil.cpp \
+# $(SRCDIR)/GlideHQ/TextureFilters.cpp \
+# $(SRCDIR)/GlideHQ/TextureFilters_2xsai.cpp \
+# $(SRCDIR)/GlideHQ/TextureFilters_hq2x.cpp \
+# $(SRCDIR)/GlideHQ/TextureFilters_hq4x.cpp \
+# $(SRCDIR)/GlideHQ/TxImage.cpp \
+# $(SRCDIR)/GlideHQ/TxReSample.cpp \
+# $(SRCDIR)/GlideHQ/TxDbg.cpp \
+# $(SRCDIR)/GlideHQ/tc-1.1+/fxt1.c \
+# $(SRCDIR)/GlideHQ/tc-1.1+/dxtn.c \
+# $(SRCDIR)/GlideHQ/tc-1.1+/wrapper.c \
+# $(SRCDIR)/GlideHQ/tc-1.1+/texstore.c \
+
+LOCAL_CFLAGS := \
+ $(COMMON_CFLAGS) \
+ -DANDROID \
+ -DNOSSE \
+ -DNO_ASM \
+ -DPAULSCODE \
+ -fsigned-char \
+
+LOCAL_CPPFLAGS := $(COMMON_CPPFLAGS)
+
+LOCAL_CPP_FEATURES := exceptions
+
+LOCAL_LDFLAGS := -Wl,-version-script,$(LOCAL_PATH)/$(SRCDIR)/video_api_export.ver
+
+LOCAL_LDLIBS := \
+ -ldl \
+ -lGLESv2 \
+ -llog \
+ -lz \
+
+ifeq ($(TARGET_ARCH_ABI), armeabi-v7a)
+ # Use for ARM7a:
+ LOCAL_CFLAGS += -mfpu=vfp
+ LOCAL_CFLAGS += -mfloat-abi=softfp
+
+else ifeq ($(TARGET_ARCH_ABI), armeabi)
+ # Use for pre-ARM7a:
+
+else ifeq ($(TARGET_ARCH_ABI), x86)
+ # TODO: set the proper flags here
+
+else
+ # Any other architectures that Android could be running on?
+
+endif
+
+include $(BUILD_SHARED_LIBRARY)
diff --git a/source/gles2glide64/projects/msvc11/mupen64plus-video-glide64mk2.vcxproj b/source/gles2glide64/projects/msvc11/mupen64plus-video-glide64mk2.vcxproj
new file mode 100644
index 0000000..701a97c
--- /dev/null
+++ b/source/gles2glide64/projects/msvc11/mupen64plus-video-glide64mk2.vcxproj
@@ -0,0 +1,203 @@
+
+
+
+
+ Debug
+ Win32
+
+
+ Release
+ Win32
+
+
+
+ {A4D13408-A794-4199-8FC7-4A9A32505005}
+ n64Glide
+ mupen64plus-video-glide64mk2
+
+
+
+ DynamicLibrary
+ false
+ MultiByte
+ true
+ v110
+
+
+ DynamicLibrary
+ false
+ MultiByte
+ v110
+
+
+
+
+
+
+
+
+
+
+
+
+
+ <_ProjectFileVersion>10.0.40219.1
+ $(SolutionDir)$(Configuration)\
+ $(Configuration)\
+ true
+ $(SolutionDir)$(Configuration)\
+ $(Configuration)\
+ false
+ true
+ F:\Code\Third Party\boost;$(IncludePath)
+ F:\Code\Third Party\boost\stage\lib;$(LibraryPath)
+
+
+
+ _DEBUG;%(PreprocessorDefinitions)
+ true
+ true
+ Win32
+ .\Debug/n64Glide.tlb
+
+
+
+
+ Disabled
+ ..\..\src\Glitch64\inc;..\..\..\mupen64plus-win32-deps\boost-1.53.0\;..\..\..\mupen64plus-core\src\api;..\..\..\mupen64plus-win32-deps\SDL-1.2.14\include;..\..\..\mupen64plus-win32-deps\libpng-1.2.37\include;..\..\..\mupen64plus-win32-deps\zlib-1.2.3\include;%(AdditionalIncludeDirectories)
+ _VARIADIC_MAX=10;_CRT_SECURE_NO_WARNINGS;__MSC__;WIN32;%(PreprocessorDefinitions)
+ Async
+ EnableFastChecks
+ MultiThreadedDebugDLL
+ .\Debug/n64Glide.pch
+ .\Debug/
+ .\Debug/
+ .\Debug/
+ Level3
+ true
+ EditAndContinue
+
+
+ _DEBUG;%(PreprocessorDefinitions)
+ 0x0409
+
+
+ opengl32.lib;glu32.lib;..\..\..\mupen64plus-win32-deps\SDL-1.2.14\lib\SDL.lib;..\..\..\mupen64plus-win32-deps\libpng-1.2.37\lib\libpng.lib;..\..\..\mupen64plus-win32-deps\zlib-1.2.3\lib\zlib.lib;winmm.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;msvcrtd.lib;%(AdditionalDependencies)
+ $(OutDir)$(TargetName)$(TargetExt)
+ true
+ ..\lib;..\..\..\mupen64plus-win32-deps\boost-1.53.0\boost\libs;%(AdditionalLibraryDirectories)
+ false
+ true
+ .\Debug/Glide64.pdb
+ .\Debug/Glide64.lib
+ MachineX86
+
+
+ true
+ .\Debug/n64Glide.bsc
+
+
+
+
+ NDEBUG;%(PreprocessorDefinitions)
+ true
+ true
+ Win32
+ .\Release/n64Glide.tlb
+
+
+
+
+ MaxSpeed
+ OnlyExplicitInline
+ true
+ Speed
+ false
+ ..\..\..\mupen64plus-win32-deps\boost-1.53.0\;..\..\..\mupen64plus-core\src\api;..\..\src\Glide64;..\..\src\Glide64\inc;..\..\src\GlideHQ;..\..\src\GlideHQ\tc-1.1+;..\..\src\Glitch64;..\..\src\Glitch64\inc;..\..\..\mupen64plus-win32-deps\SDL-1.2.14\include;..\..\..\mupen64plus-win32-deps\zlib-1.2.3\include;..\..\..\mupen64plus-win32-deps\libpng-1.2.37\include;%(AdditionalIncludeDirectories)
+ _VARIADIC_MAX=10;_CRT_SECURE_NO_WARNINGS;__MSC__;WIN32;__VISUALC__;%(PreprocessorDefinitions)
+ true
+ Async
+ MultiThreaded
+ true
+ NotSet
+ .\Release/n64Glide.pch
+ .\Release/
+ .\Release/
+ .\Release/
+ Level3
+ true
+
+
+ NDEBUG;%(PreprocessorDefinitions)
+ 0x0409
+
+
+ SDL.lib;zlib.lib;libpng.lib;opengl32.lib;winmm.lib;comctl32.lib;rpcrt4.lib;wsock32.lib;msvcrt.lib;LIBCMT.lib;%(AdditionalDependencies)
+ $(OutDir)$(TargetName)$(TargetExt)
+ true
+ ..\..\..\mupen64plus-win32-deps\boost-1.53.0\boost\libs;..\..\..\mupen64plus-win32-deps\libpng-1.2.37\lib;..\..\..\mupen64plus-win32-deps\zlib-1.2.3\lib;..\..\..\mupen64plus-win32-deps\SDL-1.2.14\lib;%(AdditionalLibraryDirectories)
+ $(TargetDir)$(TargetName).pdb
+
+
+ MachineX86
+ Windows
+ true
+
+
+ true
+ .\Release/n64Glide.bsc
+
+
+ true
+
+
+ Copying shared data and libraries to build directory...
+ copy ..\..\data\* "$(OutDir)"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ .\Release/%(Filename)1.obj
+ $(IntDir)%(Filename)1.xdc
+
+
+
+
+
+
\ No newline at end of file
diff --git a/source/gles2glide64/projects/msvc11/mupen64plus-video-glide64mk2.vcxproj.filters b/source/gles2glide64/projects/msvc11/mupen64plus-video-glide64mk2.vcxproj.filters
new file mode 100644
index 0000000..f1875f0
--- /dev/null
+++ b/source/gles2glide64/projects/msvc11/mupen64plus-video-glide64mk2.vcxproj.filters
@@ -0,0 +1,136 @@
+
+
+
+
+ {44b9ea4e-bb1f-45ef-9b11-c93aace0416c}
+
+
+ {daabfc00-53db-4996-9c67-80f7092cb54f}
+
+
+ {8e81e299-f474-448c-a104-5149bffd92f4}
+
+
+ {d0e07863-9ec2-4409-a91e-bddc436aa16b}
+
+
+ {c6ba9864-aee3-4434-954b-8c5679c2959c}
+
+
+
+
+ Glitch64
+
+
+ Glitch64
+
+
+ Glitch64
+
+
+ GlideHQ
+
+
+ GlideHQ
+
+
+ GlideHQ
+
+
+ GlideHQ
+
+
+ GlideHQ
+
+
+ GlideHQ
+
+
+ GlideHQ
+
+
+ GlideHQ
+
+
+ GlideHQ
+
+
+ GlideHQ
+
+
+ GlideHQ
+
+
+ GlideHQ
+
+
+ GlideHQ
+
+
+ GlideHQ
+
+
+ GlideHQ
+
+
+ GlideHQ\tc-1.1+
+
+
+ GlideHQ\tc-1.1+
+
+
+ GlideHQ\tc-1.1+
+
+
+ GlideHQ\tc-1.1+
+
+
+ Glide64
+
+
+ Glide64
+
+
+ Glide64
+
+
+ Glide64
+
+
+ Glide64
+
+
+ Glide64
+
+
+ Glide64
+
+
+ Glide64
+
+
+ Glide64
+
+
+ Glide64
+
+
+ Glide64
+
+
+ Glide64
+
+
+ Glide64
+
+
+ Glide64
+
+
+ Glide64\Windows
+
+
+ Glitch64
+
+
+
\ No newline at end of file
diff --git a/source/gles2glide64/projects/unix/Makefile b/source/gles2glide64/projects/unix/Makefile
new file mode 100755
index 0000000..f813c02
--- /dev/null
+++ b/source/gles2glide64/projects/unix/Makefile
@@ -0,0 +1,467 @@
+#/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+# * Mupen64plus-video-glide64mk2 - Makefile *
+# * Mupen64Plus homepage: http://code.google.com/p/mupen64plus/ *
+# * Copyright (C) 2010 Jon Ring *
+# * Copyright (C) 2007-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 Glide64mk2 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
+ BOOST_SUFFIX = -mt
+endif
+ifeq ("$(UNAME)","FreeBSD")
+ OS = FREEBSD
+ SO_EXTENSION = so
+ SHARED = -shared
+endif
+ifeq ("$(UNAME)","OpenBSD")
+ OS = FREEBSD
+ SO_EXTENSION = so
+ SHARED = -shared
+ $(warning OS type "$(UNAME)" not officially supported.')
+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
+ BOOST_SUFFIX = -mt
+ CPPFLAGS += -DNO_FILTER_THREAD
+endif
+ifeq ("$(OS)","NONE")
+ $(error OS type "$(UNAME)" not supported. Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
+endif
+
+# detect system architecture
+HOST_CPU ?= $(shell uname -m)
+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 powerpc,$(HOST_CPU))","")
+ CPU := PPC
+ ARCH_DETECTED := 32BITS
+ BIG_ENDIAN := 1
+ PIC ?= 1
+ NO_ASM := 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
+ NO_ASM := 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
+ NO_ASM := 1
+ CFLAGS += -mcpu=cortex-a8 -mfpu=neon -mfloat-abi=softfp -mtune=cortex-a8 -fsigned-char -fno-strict-aliasing -fno-strict-overflow -fsingle-precision-constant
+ CFLAGS += -DNOSSE -DNO_ASM -DANDROID
+ CFLAGS += -DPAULSCODE
+# HIRES := 0
+# CXXFLAGS += -std=c++11
+ $(warning Architecture "$(HOST_CPU)" not officially supported.')
+ endif
+endif
+ifeq ("$(CPU)","NONE")
+ $(error CPU type "$(HOST_CPU)" not supported. Please file bug report at 'http://code.google.com/p/mupen64plus/issues')
+endif
+
+# base CFLAGS, LDLIBS, and LDFLAGS
+OPTFLAGS ?= -Ofast -ffast-math
+WARNFLAGS ?= -Wall
+CFLAGS += $(OPTFLAGS) $(WARNFLAGS) -ffast-math -fno-strict-aliasing -fvisibility=hidden -I../../src -I../../src/Glitch64/inc -DGCC
+CXXFLAGS += -fvisibility-inlines-hidden -std=gnu++0x
+LDFLAGS += $(SHARED)
+BOOST_SUFFIX ?=
+
+ifeq ($(CPU), X86)
+ CFLAGS += -mmmx -msse
+endif
+
+# 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)/video_api_export.ver
+ LDLIBS += -ldl
+endif
+ifeq ($(OS), OSX)
+ # Select the proper SDK
+ # Also, SDKs are stored in a different location since XCode 4.3
+ OSX_SDK ?= $(shell sw_vers -productVersion | cut -f1 -f2 -d .)
+ OSX_XCODEMAJ = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f1 -d .)
+ OSX_XCODEMIN = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f2 -d .)
+ OSX_XCODEGE43 = $(shell echo "`expr $(OSX_XCODEMAJ) \>= 4``expr $(OSX_XCODEMIN) \>= 3`")
+ ifeq ($(OSX_XCODEGE43), 11)
+ OSX_SYSROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
+ else
+ OSX_SYSROOT := /Developer/SDKs
+ endif
+
+ CXXFLAGS += -std=c++11 -stdlib=libc++
+ ifeq ($(CPU), X86)
+ LDFLAGS += -bundle -L/opt/local/lib
+ LDLIBS += -ldl
+ ifeq ($(ARCH_DETECTED), 64BITS)
+ CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk
+ else
+ CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk
+ endif
+ endif
+endif
+ifeq ($(OS), FREEBSD)
+ LDLIBS += -lc
+endif
+
+ifeq ($(origin PKG_CONFIG), undefined)
+ PKG_CONFIG = $(CROSS_COMPILE)pkg-config
+ ifeq ($(shell which $(PKG_CONFIG) 2>/dev/null),)
+ $(error $(PKG_CONFIG) not found)
+ endif
+endif
+
+ifeq ($(OS), OSX) # use system zlib on OSX
+ ZLIB_LDLIBS += -lz
+endif
+
+ifeq ($(origin ZLIB_CFLAGS) $(origin ZLIB_LDLIBS), undefined undefined)
+ ifeq ($(shell $(PKG_CONFIG) --modversion zlib 2>/dev/null),)
+ $(error No zlib development libraries found!)
+ endif
+ ZLIB_CFLAGS += $(shell $(PKG_CONFIG) --cflags zlib)
+ ZLIB_LDLIBS += $(shell $(PKG_CONFIG) --libs zlib)
+endif
+CFLAGS += $(ZLIB_CFLAGS)
+LDLIBS += $(ZLIB_LDLIBS)
+
+ifeq ($(origin LIBPNG_CFLAGS) $(origin LIBPNG_LDLIBS), undefined undefined)
+ ifeq ($(shell $(PKG_CONFIG) --modversion libpng 2>/dev/null),)
+ $(error No libpng development libraries found!)
+ endif
+ LIBPNG_CFLAGS += $(shell $(PKG_CONFIG) --cflags libpng)
+ LIBPNG_LDLIBS += $(shell $(PKG_CONFIG) --libs libpng)
+endif
+CFLAGS += $(LIBPNG_CFLAGS)
+LDLIBS += $(LIBPNG_LDLIBS)
+
+
+# search for OpenGL libraries
+ifeq ($(OS), OSX)
+ GL_LDLIBS = -framework OpenGL
+endif
+ifeq ($(OS), MINGW)
+ GL_LDLIBS = -lopengl32
+endif
+ifeq ($(origin GL_CFLAGS) $(origin GL_LDLIBS), undefined undefined)
+ ifeq ($(shell $(PKG_CONFIG) --modversion gl 2>/dev/null),)
+ $(error No OpenGL development libraries found!)
+ endif
+# GL_CFLAGS += $(shell $(PKG_CONFIG) --cflags gl)
+# GL_LDLIBS += $(shell $(PKG_CONFIG) --libs gl)
+ GL_CFLAGS += -I/mnt/utmp/codeblocks/usr/include/GLES2
+ GL_LDLIBS += -lGLESv2 -lrt
+endif
+CFLAGS += $(GL_CFLAGS)
+LDLIBS += $(GL_LDLIBS)
+
+# test for presence of SDL
+ifeq ($(origin SDL_CFLAGS) $(origin SDL_LDLIBS), undefined undefined)
+ SDL_CONFIG = $(CROSS_COMPILE)sdl-config
+ ifeq ($(shell which $(SDL_CONFIG) 2>/dev/null),)
+ $(error No SDL development libraries found!)
+ endif
+ ifeq ($(OS),OSX)
+ SDL_CFLAGS += $(shell $(SDL_CONFIG) --cflags)
+ # sdl-config on mac screws up when we're trying to build a library and not an executable
+ # SDL 1.3 is supposed to fix that, if it's ever released
+ SDL_LDLIBS += -L/usr/local/lib -lSDL -Wl,-framework,Cocoa
+ else
+ SDL_CFLAGS += $(shell $(SDL_CONFIG) --cflags)
+ SDL_LDLIBS += $(shell $(SDL_CONFIG) --libs)
+ endif
+endif
+CFLAGS += $(SDL_CFLAGS)
+LDLIBS += $(SDL_LDLIBS)
+
+ifneq ($(OS), MINGW)
+ CPPFLAGS += -D__unix__
+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_CXX = @echo ' CXX '$@;
+ Q_LD = @echo ' LD '$@;
+endif
+endif
+
+# set base program pointers and flags
+CC = $(CROSS_COMPILE)gcc
+CXX = $(CROSS_COMPILE)g++
+RM ?= rm -f
+INSTALL ?= install
+MKDIR ?= mkdir -p
+COMPILE.c = $(Q_CC)$(CC) $(CFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
+COMPILE.cc = $(Q_CXX)$(CXX) $(CXXFLAGS) $(CPPFLAGS) $(TARGET_ARCH) -c
+LINK.o = $(Q_LD)$(CXX) $(CXXFLAGS) $(LDFLAGS) $(TARGET_ARCH)
+
+# set special flags for given Makefile parameters
+ifeq ($(DEBUG),1)
+ CFLAGS += -g -gdwarf-2 -pg
+ INSTALL_STRIP_FLAG ?=
+else
+ ifneq ($(OS),OSX)
+ INSTALL_STRIP_FLAG ?= -s
+ endif
+endif
+ifeq ($(NO_ASM), 1)
+ CFLAGS += -DNO_ASM
+endif
+
+# set installation options
+ifeq ($(PREFIX),)
+ PREFIX := /usr/local
+endif
+ifeq ($(SHAREDIR),)
+ SHAREDIR := $(PREFIX)/share/mupen64plus
+endif
+ifeq ($(LIBDIR),)
+ LIBDIR := $(PREFIX)/lib
+endif
+ifeq ($(PLUGINDIR),)
+ PLUGINDIR := $(LIBDIR)/mupen64plus
+endif
+
+SRCDIR = ../../src
+OBJDIR = _obj$(POSTFIX)
+
+# list of source files to compile
+SOURCE = \
+ $(SRCDIR)/Glitch64/combiner.cpp \
+ $(SRCDIR)/Glitch64/geometry.cpp \
+ $(SRCDIR)/Glitch64/glitchmain.cpp \
+ $(SRCDIR)/Glitch64/textures.cpp \
+ $(SRCDIR)/Glide64/3dmath.cpp \
+ $(SRCDIR)/Glide64/Combine.cpp \
+ $(SRCDIR)/Glide64/Config.cpp \
+ $(SRCDIR)/Glide64/CRC.cpp \
+ $(SRCDIR)/Glide64/Debugger.cpp \
+ $(SRCDIR)/Glide64/DepthBufferRender.cpp \
+ $(SRCDIR)/Glide64/FrameSkipper.cpp \
+ $(SRCDIR)/Glide64/FBtoScreen.cpp \
+ $(SRCDIR)/Glide64/Ini.cpp \
+ $(SRCDIR)/Glide64/Keys.cpp \
+ $(SRCDIR)/Glide64/Main.cpp \
+ $(SRCDIR)/Glide64/rdp.cpp \
+ $(SRCDIR)/Glide64/TexBuffer.cpp \
+ $(SRCDIR)/Glide64/TexCache.cpp \
+ $(SRCDIR)/Glide64/ticks.c \
+ $(SRCDIR)/Glide64/Util.cpp
+
+ifneq ($(HIRES), 0)
+SOURCE += \
+ $(SRCDIR)/GlideHQ/Ext_TxFilter.cpp \
+ $(SRCDIR)/GlideHQ/TxFilterExport.cpp \
+ $(SRCDIR)/GlideHQ/TxFilter.cpp \
+ $(SRCDIR)/GlideHQ/TxCache.cpp \
+ $(SRCDIR)/GlideHQ/TxTexCache.cpp \
+ $(SRCDIR)/GlideHQ/TxHiResCache.cpp \
+ $(SRCDIR)/GlideHQ/TxQuantize.cpp \
+ $(SRCDIR)/GlideHQ/TxUtil.cpp \
+ $(SRCDIR)/GlideHQ/TextureFilters.cpp \
+ $(SRCDIR)/GlideHQ/TextureFilters_2xsai.cpp \
+ $(SRCDIR)/GlideHQ/TextureFilters_hq2x.cpp \
+ $(SRCDIR)/GlideHQ/TextureFilters_hq4x.cpp \
+ $(SRCDIR)/GlideHQ/TxImage.cpp \
+ $(SRCDIR)/GlideHQ/TxReSample.cpp \
+ $(SRCDIR)/GlideHQ/TxDbg.cpp \
+ $(SRCDIR)/GlideHQ/tc-1.1+/fxt1.c \
+ $(SRCDIR)/GlideHQ/tc-1.1+/dxtn.c \
+ $(SRCDIR)/GlideHQ/tc-1.1+/wrapper.c \
+ $(SRCDIR)/GlideHQ/tc-1.1+/texstore.c
+
+CPPFLAGS += -DTEXTURE_FILTER # -DDUMP_CACHE
+LDLIBS += -lboost_filesystem$(BOOST_SUFFIX) -lboost_system$(BOOST_SUFFIX)
+endif
+
+ifeq ($(OS),MINGW)
+SOURCE += $(SRCDIR)/Glide64/osal_dynamiclib_win32.c
+else
+SOURCE += $(SRCDIR)/Glide64/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)))
+OBJECTS += $(patsubst $(SRCDIR)/%.cpp, $(OBJDIR)/%.o, $(filter %.cpp, $(SOURCE)))
+OBJDIRS = $(dir $(OBJECTS))
+$(shell $(MKDIR) $(OBJDIRS))
+
+# build targets
+TARGET = mupen64plus-video-glide64mk2$(POSTFIX).$(SO_EXTENSION)
+
+targets:
+ @echo "Mupen64plus-video-glide64mk2 N64 Graphics plugin makefile. "
+ @echo " Targets:"
+ @echo " all == Build Mupen64plus-video-glide64mk2 plugin"
+ @echo " clean == remove object files"
+ @echo " rebuild == clean and re-build all"
+ @echo " install == Install Mupen64Plus-video-glide64mk2 plugin"
+ @echo " uninstall == Uninstall Mupen64Plus-video-glide64mk2 plugin"
+ @echo " Options:"
+ @echo " BITS=32 == build 32-bit binaries on 64-bit machine"
+ @echo " NO_ASM=1 == build without inline assembly code (x86 MMX/SSE)"
+ @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 " HIRES=(1|0) == Enables/Disables support for hires textures and texture filters (default: 1)"
+ @echo " Install Options:"
+ @echo " PREFIX=path == install/uninstall prefix (default: /usr/local)"
+ @echo " SHAREDIR=path == path to install shared data files (default: PREFIX/share/mupen64plus)"
+ @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)"
+ $(INSTALL) -d "$(DESTDIR)$(SHAREDIR)"
+ $(INSTALL) -m 0644 "../../data/Glide64mk2.ini" "$(DESTDIR)$(SHAREDIR)"
+
+uninstall:
+ $(RM) "$(DESTDIR)$(PLUGINDIR)/$(TARGET)"
+ $(RM) "$(DESTDIR)$(SHAREDIR)/Glide64mk2.ini"
+
+clean:
+ $(RM) -r $(OBJDIR) $(TARGET)
+
+rebuild: clean all
+
+# build dependency files
+CFLAGS += -MD
+-include $(OBJECTS:.o=.d)
+
+CXXFLAGS += $(CFLAGS)
+
+# standard build rules
+$(OBJDIR)/%.o: $(SRCDIR)/%.c
+ $(COMPILE.c) -o $@ $<
+
+$(OBJDIR)/%.o: $(SRCDIR)/%.cpp
+ $(COMPILE.cc) -o $@ $<
+
+$(TARGET): $(OBJECTS)
+ $(LINK.o) $^ $(LOADLIBES) $(LDLIBS) -o $@
+
+.PHONY: all clean install uninstall targets
diff --git a/source/gles2glide64/src/Glide64/3dmath.cpp b/source/gles2glide64/src/Glide64/3dmath.cpp
new file mode 100755
index 0000000..c56cbec
--- /dev/null
+++ b/source/gles2glide64/src/Glide64/3dmath.cpp
@@ -0,0 +1,552 @@
+/*
+* Glide64 - Glide video plugin for Nintendo 64 emulators.
+* Copyright (c) 2002 Dave2001
+* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
+*
+* 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
+* 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
+*/
+
+//****************************************************************
+//
+// Glide64 - Glide Plugin for Nintendo 64 emulators
+// Project started on December 29th, 2001
+//
+// Authors:
+// Dave2001, original author, founded the project in 2001, left it in 2002
+// Gugaman, joined the project in 2002, left it in 2002
+// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
+// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
+//
+//****************************************************************
+//
+// To modify Glide64:
+// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
+// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
+//
+//****************************************************************
+
+#include "Gfx_1.3.h"
+extern "C" {
+#ifndef NOSSE
+#include
+#endif
+}
+
+#include
+#include "3dmath.h"
+
+void calc_light (VERTEX *v)
+{
+ float light_intensity = 0.0f;
+ register float color[3] = {rdp.light[rdp.num_lights].r, rdp.light[rdp.num_lights].g, rdp.light[rdp.num_lights].b};
+ for (wxUint32 l=0; lvec);
+
+ if (light_intensity > 0.0f)
+ {
+ color[0] += rdp.light[l].r * light_intensity;
+ color[1] += rdp.light[l].g * light_intensity;
+ color[2] += rdp.light[l].b * light_intensity;
+ }
+ }
+
+ if (color[0] > 1.0f) color[0] = 1.0f;
+ if (color[1] > 1.0f) color[1] = 1.0f;
+ if (color[2] > 1.0f) color[2] = 1.0f;
+
+ v->r = (wxUint8)(color[0]*255.0f);
+ v->g = (wxUint8)(color[1]*255.0f);
+ v->b = (wxUint8)(color[2]*255.0f);
+}
+
+//*
+void calc_linear (VERTEX *v)
+{
+ if (settings.force_calc_sphere)
+ {
+ calc_sphere(v);
+ return;
+ }
+ DECLAREALIGN16VAR(vec[3]);
+
+ TransformVector (v->vec, vec, rdp.model);
+ // TransformVector (v->vec, vec, rdp.combined);
+ NormalizeVector (vec);
+ float x, y;
+ if (!rdp.use_lookat)
+ {
+ x = vec[0];
+ y = vec[1];
+ }
+ else
+ {
+ x = DotProduct (rdp.lookat[0], vec);
+ y = DotProduct (rdp.lookat[1], vec);
+ }
+
+ if (x > 1.0f)
+ x = 1.0f;
+ else if (x < -1.0f)
+ x = -1.0f;
+ if (y > 1.0f)
+ y = 1.0f;
+ else if (y < -1.0f)
+ y = -1.0f;
+
+ if (rdp.cur_cache[0])
+ {
+ // scale >> 6 is size to map to
+ v->ou = (acosf(x)/3.141592654f) * (rdp.tiles[rdp.cur_tile].org_s_scale >> 6);
+ v->ov = (acosf(y)/3.141592654f) * (rdp.tiles[rdp.cur_tile].org_t_scale >> 6);
+ }
+ v->uv_scaled = 1;
+#ifdef EXTREME_LOGGING
+ FRDP ("calc linear u: %f, v: %f\n", v->ou, v->ov);
+#endif
+}
+
+void calc_sphere (VERTEX *v)
+{
+// LRDP("calc_sphere\n");
+ DECLAREALIGN16VAR(vec[3]);
+ int s_scale, t_scale;
+ if (settings.hacks&hack_Chopper)
+ {
+ s_scale = min(rdp.tiles[rdp.cur_tile].org_s_scale >> 6, rdp.tiles[rdp.cur_tile].lr_s);
+ t_scale = min(rdp.tiles[rdp.cur_tile].org_t_scale >> 6, rdp.tiles[rdp.cur_tile].lr_t);
+ }
+ else
+ {
+ s_scale = rdp.tiles[rdp.cur_tile].org_s_scale >> 6;
+ t_scale = rdp.tiles[rdp.cur_tile].org_t_scale >> 6;
+ }
+ TransformVector (v->vec, vec, rdp.model);
+ // TransformVector (v->vec, vec, rdp.combined);
+ NormalizeVector (vec);
+ float x, y;
+ if (!rdp.use_lookat)
+ {
+ x = vec[0];
+ y = vec[1];
+ }
+ else
+ {
+ x = DotProduct (rdp.lookat[0], vec);
+ y = DotProduct (rdp.lookat[1], vec);
+ }
+ v->ou = (x * 0.5f + 0.5f) * s_scale;
+ v->ov = (y * 0.5f + 0.5f) * t_scale;
+ v->uv_scaled = 1;
+#ifdef EXTREME_LOGGING
+ FRDP ("calc sphere u: %f, v: %f\n", v->ou, v->ov);
+#endif
+}
+
+float DotProductC(register float *v1, register float *v2)
+{
+ register float result;
+ result = v1[0]*v2[0] + v1[1]*v2[1] + v1[2]*v2[2];
+ return(result);
+}
+
+void NormalizeVectorC(float *v)
+{
+ register float len;
+ len = sqrtf(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
+ if (len > 0.0f)
+ {
+ v[0] /= len;
+ v[1] /= len;
+ v[2] /= len;
+ }
+}
+
+void TransformVectorC(float *src, float *dst, float mat[4][4])
+{
+ dst[0] = mat[0][0]*src[0] + mat[1][0]*src[1] + mat[2][0]*src[2];
+ dst[1] = mat[0][1]*src[0] + mat[1][1]*src[1] + mat[2][1]*src[2];
+ dst[2] = mat[0][2]*src[0] + mat[1][2]*src[1] + mat[2][2]*src[2];
+}
+
+void InverseTransformVectorC (float *src, float *dst, float mat[4][4])
+{
+ dst[0] = mat[0][0]*src[0] + mat[0][1]*src[1] + mat[0][2]*src[2];
+ dst[1] = mat[1][0]*src[0] + mat[1][1]*src[1] + mat[1][2]*src[2];
+ dst[2] = mat[2][0]*src[0] + mat[2][1]*src[1] + mat[2][2]*src[2];
+}
+
+/*
+void MulMatricesC(float m1[4][4],float m2[4][4],float r[4][4])
+{
+ for (int i=0; i<4; i++)
+ {
+ for (int j=0; j<4; j++)
+ {
+ r[i][j] = m1[i][0] * m2[0][j] +
+ m1[i][1] * m2[1][j] +
+ m1[i][2] * m2[2][j] +
+ m1[i][3] * m2[3][j];
+ }
+ }
+}
+*/
+void MulMatricesC(float m1[4][4],float m2[4][4],float r[4][4])
+{
+ for (int j=0; j<4; j++)
+ {
+ r[0][j] = m1[0][0] * m2[0][j] +
+ m1[0][1] * m2[1][j] +
+ m1[0][2] * m2[2][j] +
+ m1[0][3] * m2[3][j];
+ r[1][j] = m1[1][0] * m2[0][j] +
+ m1[1][1] * m2[1][j] +
+ m1[1][2] * m2[2][j] +
+ m1[1][3] * m2[3][j];
+ r[2][j] = m1[2][0] * m2[0][j] +
+ m1[2][1] * m2[1][j] +
+ m1[2][2] * m2[2][j] +
+ m1[2][3] * m2[3][j];
+ r[3][j] = m1[3][0] * m2[0][j] +
+ m1[3][1] * m2[1][j] +
+ m1[3][2] * m2[2][j] +
+ m1[3][3] * m2[3][j];
+ }
+}
+
+#ifdef __ARM_NEON__
+void MultMatrix_neon( float m0[4][4], float m1[4][4], float dest[4][4])
+{
+ asm volatile (
+ "vld1.32 {d0, d1}, [%1]! \n\t" //q0 = m1
+ "vld1.32 {d2, d3}, [%1]! \n\t" //q1 = m1+4
+ "vld1.32 {d4, d5}, [%1]! \n\t" //q2 = m1+8
+ "vld1.32 {d6, d7}, [%1] \n\t" //q3 = m1+12
+ "vld1.32 {d16, d17}, [%0]! \n\t" //q8 = m0
+ "vld1.32 {d18, d19}, [%0]! \n\t" //q9 = m0+4
+ "vld1.32 {d20, d21}, [%0]! \n\t" //q10 = m0+8
+ "vld1.32 {d22, d23}, [%0] \n\t" //q11 = m0+12
+
+ "vmul.f32 q12, q8, d0[0] \n\t" //q12 = q8 * d0[0]
+ "vmul.f32 q13, q8, d2[0] \n\t" //q13 = q8 * d2[0]
+ "vmul.f32 q14, q8, d4[0] \n\t" //q14 = q8 * d4[0]
+ "vmul.f32 q15, q8, d6[0] \n\t" //q15 = q8 * d6[0]
+ "vmla.f32 q12, q9, d0[1] \n\t" //q12 = q9 * d0[1]
+ "vmla.f32 q13, q9, d2[1] \n\t" //q13 = q9 * d2[1]
+ "vmla.f32 q14, q9, d4[1] \n\t" //q14 = q9 * d4[1]
+ "vmla.f32 q15, q9, d6[1] \n\t" //q15 = q9 * d6[1]
+ "vmla.f32 q12, q10, d1[0] \n\t" //q12 = q10 * d0[0]
+ "vmla.f32 q13, q10, d3[0] \n\t" //q13 = q10 * d2[0]
+ "vmla.f32 q14, q10, d5[0] \n\t" //q14 = q10 * d4[0]
+ "vmla.f32 q15, q10, d7[0] \n\t" //q15 = q10 * d6[0]
+ "vmla.f32 q12, q11, d1[1] \n\t" //q12 = q11 * d0[1]
+ "vmla.f32 q13, q11, d3[1] \n\t" //q13 = q11 * d2[1]
+ "vmla.f32 q14, q11, d5[1] \n\t" //q14 = q11 * d4[1]
+ "vmla.f32 q15, q11, d7[1] \n\t" //q15 = q11 * d6[1]
+
+ "vst1.32 {d24, d25}, [%2]! \n\t" //d = q12
+ "vst1.32 {d26, d27}, [%2]! \n\t" //d+4 = q13
+ "vst1.32 {d28, d29}, [%2]! \n\t" //d+8 = q14
+ "vst1.32 {d30, d31}, [%2] \n\t" //d+12 = q15
+
+ :"+r"(m1), "+r"(m0), "+r"(dest):
+ : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
+ "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23",
+ "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31",
+ "memory"
+ );
+}
+
+void Normalize_neon(float v[3])
+{
+ asm volatile (
+ "vld1.32 {d4}, [%0]! \n\t" //d4={x,y}
+ "flds s10, [%0] \n\t" //d5[0] = z
+ "sub %0, %0, #8 \n\t" //d5[0] = z
+ "vmul.f32 d0, d4, d4 \n\t" //d0= d4*d4
+ "vpadd.f32 d0, d0, d0 \n\t" //d0 = d[0] + d[1]
+ "vmla.f32 d0, d5, d5 \n\t" //d0 = d0 + d5*d5
+
+ "vmov.f32 d1, d0 \n\t" //d1 = d0
+ "vrsqrte.f32 d0, d0 \n\t" //d0 = ~ 1.0 / sqrt(d0)
+ "vmul.f32 d2, d0, d1 \n\t" //d2 = d0 * d1
+ "vrsqrts.f32 d3, d2, d0 \n\t" //d3 = (3 - d0 * d2) / 2
+ "vmul.f32 d0, d0, d3 \n\t" //d0 = d0 * d3
+ "vmul.f32 d2, d0, d1 \n\t" //d2 = d0 * d1
+ "vrsqrts.f32 d3, d2, d0 \n\t" //d3 = (3 - d0 * d3) / 2
+ "vmul.f32 d0, d0, d3 \n\t" //d0 = d0 * d4
+
+ "vmul.f32 q2, q2, d0[0] \n\t" //d0= d2*d4
+ "vst1.32 {d4}, [%0]! \n\t" //d2={x0,y0}, d3={z0, w0}
+ "fsts s10, [%0] \n\t" //d2={x0,y0}, d3={z0, w0}
+
+ :"+r"(v) :
+ : "d0", "d1", "d2", "d3", "d4", "d5", "memory"
+ );
+}
+
+float DotProduct_neon( float v0[3], float v1[3] )
+{
+ float dot;
+ asm volatile (
+ "vld1.32 {d8}, [%1]! \n\t" //d8={x0,y0}
+ "vld1.32 {d10}, [%2]! \n\t" //d10={x1,y1}
+ "flds s18, [%1, #0] \n\t" //d9[0]={z0}
+ "flds s22, [%2, #0] \n\t" //d11[0]={z1}
+ "vmul.f32 d12, d8, d10 \n\t" //d0= d2*d4
+ "vpadd.f32 d12, d12, d12 \n\t" //d0 = d[0] + d[1]
+ "vmla.f32 d12, d9, d11 \n\t" //d0 = d0 + d3*d5
+ "fmrs %0, s24 \n\t" //r0 = s0
+ : "=r"(dot), "+r"(v0), "+r"(v1):
+ : "d8", "d9", "d10", "d11", "d12"
+
+ );
+ return dot;
+}
+
+#endif
+
+// 2008.03.29 H.Morii - added SSE 3DNOW! 3x3 1x3 matrix multiplication
+// and 3DNOW! 4x4 4x4 matrix multiplication
+// 2011-01-03 Balrog - removed because is in NASM format and not 64-bit compatible
+// This will need fixing.
+#ifndef __ARM_NEON__
+MULMATRIX MulMatrices = MulMatricesC;
+TRANSFORMVECTOR TransformVector = TransformVectorC;
+TRANSFORMVECTOR InverseTransformVector = InverseTransformVectorC;
+DOTPRODUCT DotProduct = DotProductC;
+NORMALIZEVECTOR NormalizeVector = NormalizeVectorC;
+#endif
+
+void MulMatricesSSE(float m1[4][4],float m2[4][4],float r[4][4])
+{
+#if defined(__GNUC__) && !defined(NO_ASM) && !defined(NOSSE)
+ /* [row][col]*/
+ typedef float v4sf __attribute__ ((vector_size (16)));
+ v4sf row0 = _mm_loadu_ps(m2[0]);
+ v4sf row1 = _mm_loadu_ps(m2[1]);
+ v4sf row2 = _mm_loadu_ps(m2[2]);
+ v4sf row3 = _mm_loadu_ps(m2[3]);
+
+ for (int i = 0; i < 4; ++i)
+ {
+ v4sf leftrow = _mm_loadu_ps(m1[i]);
+
+ // Fill tmp with four copies of leftrow[0]
+ v4sf tmp = leftrow;
+ tmp = _mm_shuffle_ps (tmp, tmp, 0);
+ // Calculate the four first summands
+ v4sf destrow = tmp * row0;
+
+ // Fill tmp with four copies of leftrow[1]
+ tmp = leftrow;
+ tmp = _mm_shuffle_ps (tmp, tmp, 1 + (1 << 2) + (1 << 4) + (1 << 6));
+ destrow += tmp * row1;
+
+ // Fill tmp with four copies of leftrow[2]
+ tmp = leftrow;
+ tmp = _mm_shuffle_ps (tmp, tmp, 2 + (2 << 2) + (2 << 4) + (2 << 6));
+ destrow += tmp * row2;
+
+ // Fill tmp with four copies of leftrow[3]
+ tmp = leftrow;
+ tmp = _mm_shuffle_ps (tmp, tmp, 3 + (3 << 2) + (3 << 4) + (3 << 6));
+ destrow += tmp * row3;
+
+ __builtin_ia32_storeups(r[i], destrow);
+ }
+ #elif !defined(NO_ASM) && !defined(NOSSE)
+ __asm
+ {
+ mov eax, dword ptr [r]
+ mov ecx, dword ptr [m1]
+ mov edx, dword ptr [m2]
+
+ movaps xmm0,[edx]
+ movaps xmm1,[edx+16]
+ movaps xmm2,[edx+32]
+ movaps xmm3,[edx+48]
+
+// r[0][0],r[0][1],r[0][2],r[0][3]
+
+ movaps xmm4,xmmword ptr[ecx]
+ movaps xmm5,xmm4
+ movaps xmm6,xmm4
+ movaps xmm7,xmm4
+
+ shufps xmm4,xmm4,00000000b
+ shufps xmm5,xmm5,01010101b
+ shufps xmm6,xmm6,10101010b
+ shufps xmm7,xmm7,11111111b
+
+ mulps xmm4,xmm0
+ mulps xmm5,xmm1
+ mulps xmm6,xmm2
+ mulps xmm7,xmm3
+
+ addps xmm4,xmm5
+ addps xmm4,xmm6
+ addps xmm4,xmm7
+
+ movaps xmmword ptr[eax],xmm4
+
+// r[1][0],r[1][1],r[1][2],r[1][3]
+
+ movaps xmm4,xmmword ptr[ecx+16]
+ movaps xmm5,xmm4
+ movaps xmm6,xmm4
+ movaps xmm7,xmm4
+
+ shufps xmm4,xmm4,00000000b
+ shufps xmm5,xmm5,01010101b
+ shufps xmm6,xmm6,10101010b
+ shufps xmm7,xmm7,11111111b
+
+ mulps xmm4,xmm0
+ mulps xmm5,xmm1
+ mulps xmm6,xmm2
+ mulps xmm7,xmm3
+
+ addps xmm4,xmm5
+ addps xmm4,xmm6
+ addps xmm4,xmm7
+
+ movaps xmmword ptr[eax+16],xmm4
+
+
+// r[2][0],r[2][1],r[2][2],r[2][3]
+
+ movaps xmm4,xmmword ptr[ecx+32]
+ movaps xmm5,xmm4
+ movaps xmm6,xmm4
+ movaps xmm7,xmm4
+
+ shufps xmm4,xmm4,00000000b
+ shufps xmm5,xmm5,01010101b
+ shufps xmm6,xmm6,10101010b
+ shufps xmm7,xmm7,11111111b
+
+ mulps xmm4,xmm0
+ mulps xmm5,xmm1
+ mulps xmm6,xmm2
+ mulps xmm7,xmm3
+
+ addps xmm4,xmm5
+ addps xmm4,xmm6
+ addps xmm4,xmm7
+
+ movaps xmmword ptr[eax+32],xmm4
+
+// r[3][0],r[3][1],r[3][2],r[3][3]
+
+ movaps xmm4,xmmword ptr[ecx+48]
+ movaps xmm5,xmm4
+ movaps xmm6,xmm4
+ movaps xmm7,xmm4
+
+ shufps xmm4,xmm4,00000000b
+ shufps xmm5,xmm5,01010101b
+ shufps xmm6,xmm6,10101010b
+ shufps xmm7,xmm7,11111111b
+
+ mulps xmm4,xmm0
+ mulps xmm5,xmm1
+ mulps xmm6,xmm2
+ mulps xmm7,xmm3
+
+ addps xmm4,xmm5
+ addps xmm4,xmm6
+ addps xmm4,xmm7
+
+ movaps xmmword ptr[eax+48],xmm4
+ }
+#endif // _WIN32
+ }
+
+
+
+ void math_init()
+ {
+#ifndef __ARM_NEON__
+#ifndef _DEBUG
+ int IsSSE = FALSE;
+#if defined(__GNUC__) && !defined(NO_ASM) && !defined(NOSSE)
+ int edx, eax;
+ GLIDE64_TRY
+ {
+ #if defined(__x86_64__)
+ asm volatile(" cpuid; "
+ : "=a"(eax), "=d"(edx)
+ : "0"(1)
+ : "rbx", "rcx"
+ );
+ #else
+ asm volatile(" push %%ebx; "
+ " push %%ecx; "
+ " cpuid; "
+ " pop %%ecx; "
+ " pop %%ebx; "
+ : "=a"(eax), "=d"(edx)
+ : "0"(1)
+ :
+ );
+ #endif
+ }
+ GLIDE64_CATCH
+ { return; }
+ // Check for SSE
+ if (edx & (1 << 25))
+ IsSSE = TRUE;
+#elif !defined(NO_ASM) && !defined(NOSSE)
+ DWORD dwEdx;
+ __try
+ {
+ __asm
+ {
+ mov eax,1
+ cpuid
+ mov dwEdx,edx
+ }
+ }
+ __except(EXCEPTION_EXECUTE_HANDLER)
+ {
+ return;
+ }
+
+ if (dwEdx & (1<<25))
+ {
+ if (dwEdx & (1<<24))
+ {
+ __try
+ {
+ __asm xorps xmm0, xmm0
+ IsSSE = TRUE;
+ }
+ __except(EXCEPTION_EXECUTE_HANDLER)
+ {
+ return;
+ }
+ }
+ }
+#endif // _WIN32
+ if (IsSSE)
+ {
+ MulMatrices = MulMatricesSSE;
+ LOG("3DNOW! detected.\n");
+ }
+
+#endif //_DEBUG
+#endif //__ARM_NEON__
+ }
diff --git a/source/gles2glide64/src/Glide64/3dmath.h b/source/gles2glide64/src/Glide64/3dmath.h
new file mode 100755
index 0000000..55e828d
--- /dev/null
+++ b/source/gles2glide64/src/Glide64/3dmath.h
@@ -0,0 +1,70 @@
+/*
+* Glide64 - Glide video plugin for Nintendo 64 emulators.
+* Copyright (c) 2002 Dave2001
+* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
+*
+* 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
+* 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
+*/
+
+//****************************************************************
+//
+// Glide64 - Glide Plugin for Nintendo 64 emulators
+// Project started on December 29th, 2001
+//
+// Authors:
+// Dave2001, original author, founded the project in 2001, left it in 2002
+// Gugaman, joined the project in 2002, left it in 2002
+// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
+// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
+//
+//****************************************************************
+//
+// To modify Glide64:
+// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
+// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
+//
+//****************************************************************
+
+void calc_light (VERTEX *v);
+void calc_linear (VERTEX *v);
+void calc_sphere (VERTEX *v);
+
+void math_init();
+#ifdef __ARM_NEON__
+float DotProductC(register float *v1, register float *v2);
+void NormalizeVectorC(float *v);
+void TransformVectorC(float *src, float *dst, float mat[4][4]);
+void InverseTransformVectorC (float *src, float *dst, float mat[4][4]);
+void MulMatricesC(float m1[4][4],float m2[4][4],float r[4][4]);
+void MultMatrix_neon( float m0[4][4], float m1[4][4], float dest[4][4]);
+void Normalize_neon(float v[3]);
+float DotProduct_neon( float v0[3], float v1[3] );
+
+#define MulMatrices MultMatrix_neon //MulMatricesC
+#define TransformVector TransformVectorC
+#define InverseTransformVector InverseTransformVectorC
+#define DotProduct DotProductC //DotProduct_neon
+#define NormalizeVector Normalize_neon //NormalizeVectorC
+#else
+typedef void (*MULMATRIX)(float m1[4][4],float m2[4][4],float r[4][4]);
+extern MULMATRIX MulMatrices;
+typedef void (*TRANSFORMVECTOR)(float *src,float *dst,float mat[4][4]);
+extern TRANSFORMVECTOR TransformVector;
+extern TRANSFORMVECTOR InverseTransformVector;
+typedef float (*DOTPRODUCT)(register float *v1, register float *v2);
+extern DOTPRODUCT DotProduct;
+typedef void (*NORMALIZEVECTOR)(float *v);
+extern NORMALIZEVECTOR NormalizeVector;
+#endif
diff --git a/source/gles2glide64/src/Glide64/3dmathneon.cpp b/source/gles2glide64/src/Glide64/3dmathneon.cpp
new file mode 100755
index 0000000..9d69a8c
--- /dev/null
+++ b/source/gles2glide64/src/Glide64/3dmathneon.cpp
@@ -0,0 +1,133 @@
+#include "3dmath.h"
+
+static void MultMatrix_neon( float m0[4][4], float m1[4][4], float dest[4][4])
+{
+ asm volatile (
+ "vld1.32 {d0, d1}, [%1]! \n\t" //q0 = m1
+ "vld1.32 {d2, d3}, [%1]! \n\t" //q1 = m1+4
+ "vld1.32 {d4, d5}, [%1]! \n\t" //q2 = m1+8
+ "vld1.32 {d6, d7}, [%1] \n\t" //q3 = m1+12
+ "vld1.32 {d16, d17}, [%0]! \n\t" //q8 = m0
+ "vld1.32 {d18, d19}, [%0]! \n\t" //q9 = m0+4
+ "vld1.32 {d20, d21}, [%0]! \n\t" //q10 = m0+8
+ "vld1.32 {d22, d23}, [%0] \n\t" //q11 = m0+12
+
+ "vmul.f32 q12, q8, d0[0] \n\t" //q12 = q8 * d0[0]
+ "vmul.f32 q13, q8, d2[0] \n\t" //q13 = q8 * d2[0]
+ "vmul.f32 q14, q8, d4[0] \n\t" //q14 = q8 * d4[0]
+ "vmul.f32 q15, q8, d6[0] \n\t" //q15 = q8 * d6[0]
+ "vmla.f32 q12, q9, d0[1] \n\t" //q12 = q9 * d0[1]
+ "vmla.f32 q13, q9, d2[1] \n\t" //q13 = q9 * d2[1]
+ "vmla.f32 q14, q9, d4[1] \n\t" //q14 = q9 * d4[1]
+ "vmla.f32 q15, q9, d6[1] \n\t" //q15 = q9 * d6[1]
+ "vmla.f32 q12, q10, d1[0] \n\t" //q12 = q10 * d0[0]
+ "vmla.f32 q13, q10, d3[0] \n\t" //q13 = q10 * d2[0]
+ "vmla.f32 q14, q10, d5[0] \n\t" //q14 = q10 * d4[0]
+ "vmla.f32 q15, q10, d7[0] \n\t" //q15 = q10 * d6[0]
+ "vmla.f32 q12, q11, d1[1] \n\t" //q12 = q11 * d0[1]
+ "vmla.f32 q13, q11, d3[1] \n\t" //q13 = q11 * d2[1]
+ "vmla.f32 q14, q11, d5[1] \n\t" //q14 = q11 * d4[1]
+ "vmla.f32 q15, q11, d7[1] \n\t" //q15 = q11 * d6[1]
+
+ "vst1.32 {d24, d25}, [%2]! \n\t" //d = q12
+ "vst1.32 {d26, d27}, [%2]! \n\t" //d+4 = q13
+ "vst1.32 {d28, d29}, [%2]! \n\t" //d+8 = q14
+ "vst1.32 {d30, d31}, [%2] \n\t" //d+12 = q15
+
+ :"+r"(m0), "+r"(m1), "+r"(dest):
+ : "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7",
+ "d16", "d17", "d18", "d19", "d20", "d21", "d22", "d23",
+ "d24", "d25", "d26", "d27", "d28", "d29", "d30", "d31",
+ "memory"
+ );
+}
+
+static void TransformVectorNormalize_neon(float vec[3], float mtx[4][4])
+{
+ asm volatile (
+ "vld1.32 {d0}, [%1] \n\t" //Q0 = v
+ "flds s2, [%1, #8] \n\t" //Q0 = v
+ "vld1.32 {d18, d19}, [%0]! \n\t" //Q1 = m
+ "vld1.32 {d20, d21}, [%0]! \n\t" //Q2 = m+4
+ "vld1.32 {d22, d23}, [%0] \n\t" //Q3 = m+8
+
+ "vmul.f32 q2, q9, d0[0] \n\t" //q2 = q9*Q0[0]
+ "vmla.f32 q2, q10, d0[1] \n\t" //Q5 += Q1*Q0[1]
+ "vmla.f32 q2, q11, d1[0] \n\t" //Q5 += Q2*Q0[2]
+
+ "vmul.f32 d0, d4, d4 \n\t" //d0 = d0*d0
+ "vpadd.f32 d0, d0, d0 \n\t" //d0 = d[0] + d[1]
+ "vmla.f32 d0, d5, d5 \n\t" //d0 = d0 + d1*d1
+
+ "vmov.f32 d1, d0 \n\t" //d1 = d0
+ "vrsqrte.f32 d0, d0 \n\t" //d0 = ~ 1.0 / sqrt(d0)
+ "vmul.f32 d2, d0, d1 \n\t" //d2 = d0 * d1
+ "vrsqrts.f32 d3, d2, d0 \n\t" //d3 = (3 - d0 * d2) / 2
+ "vmul.f32 d0, d0, d3 \n\t" //d0 = d0 * d3
+ "vmul.f32 d2, d0, d1 \n\t" //d2 = d0 * d1
+ "vrsqrts.f32 d3, d2, d0 \n\t" //d3 = (3 - d0 * d3) / 2
+ "vmul.f32 d0, d0, d3 \n\t" //d0 = d0 * d4
+
+ "vmul.f32 q2, q2, d0[0] \n\t" //d0= d2*d4
+
+ "vst1.32 {d4}, [%1] \n\t" //Q4 = m+12
+ "fsts s10, [%1, #8] \n\t" //Q4 = m+12
+ : "+r"(mtx): "r"(vec)
+ : "d0","d1","d2","d3","d18","d19","d20","d21","d22", "d23", "memory"
+ );
+}
+
+static void Normalize_neon(float v[3])
+{
+ asm volatile (
+ "vld1.32 {d4}, [%0]! \n\t" //d4={x,y}
+ "flds s10, [%0] \n\t" //d5[0] = z
+ "sub %0, %0, #8 \n\t" //d5[0] = z
+ "vmul.f32 d0, d4, d4 \n\t" //d0= d4*d4
+ "vpadd.f32 d0, d0, d0 \n\t" //d0 = d[0] + d[1]
+ "vmla.f32 d0, d5, d5 \n\t" //d0 = d0 + d5*d5
+
+ "vmov.f32 d1, d0 \n\t" //d1 = d0
+ "vrsqrte.f32 d0, d0 \n\t" //d0 = ~ 1.0 / sqrt(d0)
+ "vmul.f32 d2, d0, d1 \n\t" //d2 = d0 * d1
+ "vrsqrts.f32 d3, d2, d0 \n\t" //d3 = (3 - d0 * d2) / 2
+ "vmul.f32 d0, d0, d3 \n\t" //d0 = d0 * d3
+ "vmul.f32 d2, d0, d1 \n\t" //d2 = d0 * d1
+ "vrsqrts.f32 d3, d2, d0 \n\t" //d3 = (3 - d0 * d3) / 2
+ "vmul.f32 d0, d0, d3 \n\t" //d0 = d0 * d4
+
+ "vmul.f32 q2, q2, d0[0] \n\t" //d0= d2*d4
+ "vst1.32 {d4}, [%0]! \n\t" //d2={x0,y0}, d3={z0, w0}
+ "fsts s10, [%0] \n\t" //d2={x0,y0}, d3={z0, w0}
+
+ :"+r"(v) :
+ : "d0", "d1", "d2", "d3", "d4", "d5", "memory"
+ );
+}
+
+static float DotProduct_neon( float v0[3], float v1[3] )
+{
+ float dot;
+ asm volatile (
+ "vld1.32 {d8}, [%1]! \n\t" //d8={x0,y0}
+ "vld1.32 {d10}, [%2]! \n\t" //d10={x1,y1}
+ "flds s18, [%1, #0] \n\t" //d9[0]={z0}
+ "flds s22, [%2, #0] \n\t" //d11[0]={z1}
+ "vmul.f32 d12, d8, d10 \n\t" //d0= d2*d4
+ "vpadd.f32 d12, d12, d12 \n\t" //d0 = d[0] + d[1]
+ "vmla.f32 d12, d9, d11 \n\t" //d0 = d0 + d3*d5
+ "fmrs %0, s24 \n\t" //r0 = s0
+ : "=r"(dot), "+r"(v0), "+r"(v1):
+ : "d8", "d9", "d10", "d11", "d12"
+
+ );
+ return dot;
+}
+
+void MathInitNeon()
+{
+ MulMatrices = MultMatrix_neon;
+ //TransformVectorNormalize = TransformVectorNormalize_neon;
+ NormalizeVector = Normalize_neon;
+ DotProduct = DotProduct_neon;
+}
diff --git a/source/gles2glide64/src/Glide64/CRC.cpp b/source/gles2glide64/src/Glide64/CRC.cpp
new file mode 100755
index 0000000..aadf78e
--- /dev/null
+++ b/source/gles2glide64/src/Glide64/CRC.cpp
@@ -0,0 +1,144 @@
+/*
+* Glide64 - Glide video plugin for Nintendo 64 emulators.
+* Copyright (c) 2002 Dave2001
+* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
+*
+* 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
+* 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
+*/
+
+//****************************************************************
+//
+// Glide64 - Glide Plugin for Nintendo 64 emulators
+// Project started on December 29th, 2001
+//
+// Authors:
+// Dave2001, original author, founded the project in 2001, left it in 2002
+// Gugaman, joined the project in 2002, left it in 2002
+// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
+// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
+//
+//****************************************************************
+//
+// To modify Glide64:
+// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
+// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
+//
+//****************************************************************
+//
+// CRC32 calculation functions
+//
+// Created by Gonetz, 2004
+//
+//****************************************************************
+//*
+
+#define CRC32_POLYNOMIAL 0x04C11DB7
+
+unsigned int CRCTable[ 256 ];
+
+unsigned int Reflect( unsigned int ref, char ch )
+{
+ unsigned int value = 0;
+
+ // Swap bit 0 for bit 7
+ // bit 1 for bit 6, etc.
+ for (char i = 1; i < (ch + 1); i++)
+ {
+ if(ref & 1)
+ value |= 1 << (ch - i);
+ ref >>= 1;
+ }
+ return value;
+}
+
+void CRC_BuildTable()
+{
+ unsigned int crc;
+
+ for (unsigned i = 0; i <= 255; i++)
+ {
+ crc = Reflect( i, 8 ) << 24;
+ for (unsigned j = 0; j < 8; j++)
+ crc = (crc << 1) ^ (crc & (1 << 31) ? CRC32_POLYNOMIAL : 0);
+
+ CRCTable[i] = Reflect( crc, 32 );
+ }
+}
+//*/
+//*
+unsigned int CRC32( unsigned int crc, void *buffer, unsigned int count )
+{
+ unsigned int orig = crc;
+ unsigned char * p = reinterpret_cast(buffer);
+ while (count--)
+ crc = (crc >> 8) ^ CRCTable[(crc & 0xFF) ^ *p++];
+ return crc ^ orig;
+}
+//*/
+
+/*
+wxUint32 CRC_Calculate( wxUint32 crc, void *buffer, wxUint32 count )
+{
+ wxUint32 Crc32=crc;
+ __asm {
+ mov esi, buffer
+ mov ecx, count
+ mov edx, crc
+ xor eax, eax
+
+loop1:
+ inc esi
+ mov al, dl
+ xor al, byte ptr [esi]
+ shr edx, 8
+ mov ebx, [CRCTable+eax*4]
+ xor edx, ebx
+
+ loop loop1
+
+ xor Crc32, edx
+ }
+ return Crc32;
+}
+*/
+
+/*
+unsigned int CRC_Calculate( unsigned int crc, void *buffer, unsigned int count )
+{
+ unsigned int Crc32=crc;
+ __asm {
+ mov esi, buffer
+ mov edx, count
+ add edx, esi
+ mov ecx, crc
+
+loop1:
+ mov bl, byte ptr [esi]
+ movzx eax, cl
+ inc esi
+ xor al, bl
+ shr ecx, 8
+ mov ebx, [CRCTable+eax*4]
+ xor ecx, ebx
+
+ cmp edx, esi
+ jne loop1
+
+ xor Crc32, ecx
+ }
+ return Crc32;
+}
+//*/
+
diff --git a/source/gles2glide64/src/Glide64/CRC.h b/source/gles2glide64/src/Glide64/CRC.h
new file mode 100644
index 0000000..2bc5177
--- /dev/null
+++ b/source/gles2glide64/src/Glide64/CRC.h
@@ -0,0 +1,48 @@
+/*
+* Glide64 - Glide video plugin for Nintendo 64 emulators.
+* Copyright (c) 2002 Dave2001
+* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
+*
+* 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
+* 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
+*/
+
+//****************************************************************
+//
+// Glide64 - Glide Plugin for Nintendo 64 emulators
+// Project started on December 29th, 2001
+//
+// Authors:
+// Dave2001, original author, founded the project in 2001, left it in 2002
+// Gugaman, joined the project in 2002, left it in 2002
+// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
+// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
+//
+//****************************************************************
+//
+// To modify Glide64:
+// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
+// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
+//
+//****************************************************************
+//
+// CRC32 calculation functions
+//
+// Created by Gonetz, 2004
+//
+//****************************************************************
+
+void CRC_BuildTable();
+
+unsigned int CRC32( unsigned int crc, void *buffer, unsigned int count );
diff --git a/source/gles2glide64/src/Glide64/Combine.cpp b/source/gles2glide64/src/Glide64/Combine.cpp
new file mode 100644
index 0000000..62cffae
--- /dev/null
+++ b/source/gles2glide64/src/Glide64/Combine.cpp
@@ -0,0 +1,16692 @@
+/*
+* Glide64 - Glide video plugin for Nintendo 64 emulators.
+* Copyright (c) 2002 Dave2001
+* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
+*
+* 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
+* 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
+*/
+
+//****************************************************************
+//
+// Glide64 - Glide Plugin for Nintendo 64 emulators
+// Project started on December 29th, 2001
+//
+// Authors:
+// Dave2001, original author, founded the project in 2001, left it in 2002
+// Gugaman, joined the project in 2002, left it in 2002
+// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
+// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
+//
+//****************************************************************
+//
+// To modify Glide64:
+// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
+// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
+//
+//****************************************************************
+
+#include "Gfx_1.3.h"
+#include "Util.h"
+#include "Combine.h"
+
+#define FASTSEARCH // Enable fast combine mode searching algorithm
+
+float percent_org, percent, r, g, b;
+wxUint32 lod_frac;
+
+wxUint32 cc_lookup[257];
+wxUint32 ac_lookup[257];
+COMBINE cmb;
+
+//****************************************************************
+// Macros
+//****************************************************************
+
+#define MOD_0(mode) cmb.mod_0 = mode
+#define MOD_0_COL(color) cmb.modcolor_0 = color
+#define MOD_0_COL1(color) cmb.modcolor1_0 = color
+#define MOD_0_COL2(color) cmb.modcolor2_0 = color
+#define MOD_0_FAC(factor) cmb.modfactor_0 = factor
+#define MOD_1(mode) cmb.mod_1 = mode
+#define MOD_1_COL(color) cmb.modcolor_1 = color
+#define MOD_1_COL1(color) cmb.modcolor1_1 = color
+#define MOD_1_COL2(color) cmb.modcolor2_1 = color
+#define MOD_1_FAC(factor) cmb.modfactor_1 = factor
+
+#define A_BLEND(f1,f2) cmb.abf1=f1,cmb.abf2=f2
+
+// To make a color or alpha combine
+#define CCMB(fnc,fac,loc,oth) \
+ cmb.c_fnc = fnc, \
+ cmb.c_fac = fac, \
+ cmb.c_loc = loc, \
+ cmb.c_oth = oth
+#define ACMB(fnc,fac,loc,oth) \
+ cmb.a_fnc = fnc, \
+ cmb.a_fac = fac, \
+ cmb.a_loc = loc, \
+ cmb.a_oth = oth
+#define CCMBEXT(a,a_mode,b,b_mode,c,c_invert,d,d_invert) \
+ cmb.c_ext_a = a, \
+ cmb.c_ext_a_mode = a_mode, \
+ cmb.c_ext_b = b, \
+ cmb.c_ext_b_mode = b_mode, \
+ cmb.c_ext_c = c, \
+ cmb.c_ext_c_invert = c_invert, \
+ cmb.c_ext_d= d, \
+ cmb.c_ext_d_invert = d_invert, \
+ cmb.cmb_ext_use |= COMBINE_EXT_COLOR
+#define ACMBEXT(a,a_mode,b,b_mode,c,c_invert,d,d_invert) \
+ cmb.a_ext_a = a, \
+ cmb.a_ext_a_mode = a_mode, \
+ cmb.a_ext_b = b, \
+ cmb.a_ext_b_mode = b_mode, \
+ cmb.a_ext_c = c, \
+ cmb.a_ext_c_invert = c_invert, \
+ cmb.a_ext_d= d, \
+ cmb.a_ext_d_invert = d_invert, \
+ cmb.cmb_ext_use |= COMBINE_EXT_ALPHA
+#define T0CCMBEXT(a,a_mode,b,b_mode,c,c_invert,d,d_invert) \
+ cmb.t0c_ext_a = a, \
+ cmb.t0c_ext_a_mode = a_mode, \
+ cmb.t0c_ext_b = b, \
+ cmb.t0c_ext_b_mode = b_mode, \
+ cmb.t0c_ext_c = c, \
+ cmb.t0c_ext_c_invert = c_invert, \
+ cmb.t0c_ext_d= d, \
+ cmb.t0c_ext_d_invert = d_invert, \
+ cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_COLOR
+#define T0ACMBEXT(a,a_mode,b,b_mode,c,c_invert,d,d_invert) \
+ cmb.t0a_ext_a = a, \
+ cmb.t0a_ext_a_mode = a_mode, \
+ cmb.t0a_ext_b = b, \
+ cmb.t0a_ext_b_mode = b_mode, \
+ cmb.t0a_ext_c = c, \
+ cmb.t0a_ext_c_invert = c_invert, \
+ cmb.t0a_ext_d= d, \
+ cmb.t0a_ext_d_invert = d_invert, \
+ cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_ALPHA
+#define T1CCMBEXT(a,a_mode,b,b_mode,c,c_invert,d,d_invert) \
+ cmb.t1c_ext_a = a, \
+ cmb.t1c_ext_a_mode = a_mode, \
+ cmb.t1c_ext_b = b, \
+ cmb.t1c_ext_b_mode = b_mode, \
+ cmb.t1c_ext_c = c, \
+ cmb.t1c_ext_c_invert = c_invert, \
+ cmb.t1c_ext_d= d, \
+ cmb.t1c_ext_d_invert = d_invert, \
+ cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_COLOR
+#define T1ACMBEXT(a,a_mode,b,b_mode,c,c_invert,d,d_invert) \
+ cmb.t1a_ext_a = a, \
+ cmb.t1a_ext_a_mode = a_mode, \
+ cmb.t1a_ext_b = b, \
+ cmb.t1a_ext_b_mode = b_mode, \
+ cmb.t1a_ext_c = c, \
+ cmb.t1a_ext_c_invert = c_invert, \
+ cmb.t1a_ext_d= d, \
+ cmb.t1a_ext_d_invert = d_invert, \
+ cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_ALPHA
+
+// To use textures
+#define USE_T0() \
+ rdp.best_tex = 0; \
+ cmb.tex |= 1, \
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_LOCAL
+#define USE_T1() \
+ if (voodoo.num_tmu > 1) { \
+ rdp.best_tex = 1; \
+ cmb.tex |= 2, \
+ cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER, \
+ cmb.tmu0_fac = GR_COMBINE_FACTOR_ONE; \
+ } \
+ else { \
+ USE_T0(); \
+}
+#define T0_ADD_T1() \
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, \
+ cmb.tmu0_fac = GR_COMBINE_FACTOR_ONE
+#define T0_MUL_T1() \
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER, \
+ cmb.tmu0_fac = GR_COMBINE_FACTOR_LOCAL
+#define T0_MUL_T1_ADD_T0() \
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, \
+ cmb.tmu0_fac = GR_COMBINE_FACTOR_LOCAL
+#define T0A_MUL_T1() \
+ rdp.best_tex = 1; \
+ cmb.tex |= 3, \
+ cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER, \
+ cmb.tmu0_fac = GR_COMBINE_FACTOR_LOCAL_ALPHA
+#define T0_MUL_T1A() \
+ rdp.best_tex = 1; \
+ cmb.tex |= 3, \
+ cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL_ALPHA, \
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER, \
+ cmb.tmu0_fac = GR_COMBINE_FACTOR_LOCAL
+#define T0_INTER_T1_USING_FACTOR(factor) \
+ if (factor == 0xFF) { \
+ USE_T1(); \
+ } \
+ else if (factor == 0x00) { \
+ USE_T0(); \
+}\
+ else {\
+ if (factor <= 0x80) rdp.best_tex = 0; \
+ else rdp.best_tex = 1; \
+ cmb.tex |= 3, \
+ cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_BLEND, \
+ cmb.tmu0_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \
+ percent = (float)factor / 255.0f, \
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent; \
+}
+#define T1_INTER_T0_USING_FACTOR(factor) /* inverse of above */\
+ if (factor == 0xFF) { \
+ USE_T0(); \
+ } \
+ else if (factor == 0x00) { \
+ USE_T1(); \
+}\
+ else {\
+ if (factor <= 0x80) rdp.best_tex = 0; \
+ else rdp.best_tex = 1; \
+ cmb.tex |= 3, \
+ cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_BLEND, \
+ cmb.tmu0_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \
+ percent = (255 - factor) / 255.0f, \
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent; \
+}
+#define T0_INTER_T1_USING_T0() \
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_BLEND, \
+ cmb.tmu0_fac = GR_COMBINE_FACTOR_LOCAL
+#define T1_INTER_T0_USING_T0() \
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_BLEND, \
+ cmb.tmu0_fac = GR_COMBINE_FACTOR_ONE_MINUS_LOCAL
+#define T0_INTER_T1_USING_T1() \
+ if (!cmb.combine_ext) { \
+ T0_INTER_T1_USING_FACTOR(0x7F); \
+ }\
+ else {\
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.t1c_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB, \
+ cmb.t1c_ext_a_mode = GR_FUNC_MODE_ZERO, \
+ cmb.t1c_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB, \
+ cmb.t1c_ext_b_mode = GR_FUNC_MODE_ZERO, \
+ cmb.t1c_ext_c = GR_CMBX_ZERO, \
+ cmb.t1c_ext_c_invert = 0, \
+ cmb.t1c_ext_d= GR_CMBX_B, \
+ cmb.t1c_ext_d_invert = 0, \
+ cmb.t0c_ext_a = GR_CMBX_OTHER_TEXTURE_RGB, \
+ cmb.t0c_ext_a_mode = GR_FUNC_MODE_X, \
+ cmb.t0c_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB, \
+ cmb.t0c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X, \
+ cmb.t0c_ext_c = GR_CMBX_OTHER_TEXTURE_RGB, \
+ cmb.t0c_ext_c_invert = 0, \
+ cmb.t0c_ext_d= GR_CMBX_B, \
+ cmb.t0c_ext_d_invert = 0, \
+ cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_COLOR; \
+}
+#define T0_INTER_T1_USING_T1A() \
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_BLEND, \
+ cmb.tmu0_fac = GR_COMBINE_FACTOR_OTHER_ALPHA
+#define T0_INTER_T1_USING_PRIM() \
+ if (!cmb.combine_ext) { \
+ T0_INTER_T1_USING_FACTOR ((rdp.prim_color&0xFF)); \
+ }\
+ else {\
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.t1c_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB, \
+ cmb.t1c_ext_a_mode = GR_FUNC_MODE_ZERO, \
+ cmb.t1c_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB, \
+ cmb.t1c_ext_b_mode = GR_FUNC_MODE_ZERO, \
+ cmb.t1c_ext_c = GR_CMBX_ZERO, \
+ cmb.t1c_ext_c_invert = 0, \
+ cmb.t1c_ext_d= GR_CMBX_B, \
+ cmb.t1c_ext_d_invert = 0, \
+ cmb.t0c_ext_a = GR_CMBX_OTHER_TEXTURE_RGB, \
+ cmb.t0c_ext_a_mode = GR_FUNC_MODE_X, \
+ cmb.t0c_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB, \
+ cmb.t0c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X, \
+ cmb.t0c_ext_c = GR_CMBX_TMU_CCOLOR, \
+ cmb.t0c_ext_c_invert = 0, \
+ cmb.t0c_ext_d= GR_CMBX_B, \
+ cmb.t0c_ext_d_invert = 0, \
+ cmb.tex_ccolor = rdp.prim_color, \
+ cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_COLOR; \
+}
+#define T1_INTER_T0_USING_PRIM() /* inverse of above */\
+ if (!cmb.combine_ext) { \
+ T1_INTER_T0_USING_FACTOR ((rdp.prim_color&0xFF)); \
+ }\
+ else {\
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.t1c_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB, \
+ cmb.t1c_ext_a_mode = GR_FUNC_MODE_ZERO, \
+ cmb.t1c_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB, \
+ cmb.t1c_ext_b_mode = GR_FUNC_MODE_ZERO, \
+ cmb.t1c_ext_c = GR_CMBX_ZERO, \
+ cmb.t1c_ext_c_invert = 0, \
+ cmb.t1c_ext_d= GR_CMBX_B, \
+ cmb.t1c_ext_d_invert = 0, \
+ cmb.t0c_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB, \
+ cmb.t0c_ext_a_mode = GR_FUNC_MODE_X, \
+ cmb.t0c_ext_b = GR_CMBX_OTHER_TEXTURE_RGB, \
+ cmb.t0c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X, \
+ cmb.t0c_ext_c = GR_CMBX_TMU_CCOLOR, \
+ cmb.t0c_ext_c_invert = 0, \
+ cmb.t0c_ext_d= GR_CMBX_B, \
+ cmb.t0c_ext_d_invert = 0, \
+ cmb.tex_ccolor = rdp.prim_color, \
+ cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_COLOR; \
+}
+#define T0_INTER_T1_USING_ENV() \
+ if (!cmb.combine_ext) { \
+ T0_INTER_T1_USING_FACTOR ((rdp.env_color&0xFF)); \
+ }\
+ else {\
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.t1c_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB, \
+ cmb.t1c_ext_a_mode = GR_FUNC_MODE_ZERO, \
+ cmb.t1c_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB, \
+ cmb.t1c_ext_b_mode = GR_FUNC_MODE_ZERO, \
+ cmb.t1c_ext_c = GR_CMBX_ZERO, \
+ cmb.t1c_ext_c_invert = 0, \
+ cmb.t1c_ext_d= GR_CMBX_B, \
+ cmb.t1c_ext_d_invert = 0, \
+ cmb.t0c_ext_a = GR_CMBX_OTHER_TEXTURE_RGB, \
+ cmb.t0c_ext_a_mode = GR_FUNC_MODE_X, \
+ cmb.t0c_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB, \
+ cmb.t0c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X, \
+ cmb.t0c_ext_c = GR_CMBX_TMU_CCOLOR, \
+ cmb.t0c_ext_c_invert = 0, \
+ cmb.t0c_ext_d= GR_CMBX_B, \
+ cmb.t0c_ext_d_invert = 0, \
+ cmb.tex_ccolor = rdp.env_color, \
+ cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_COLOR; \
+}
+#define T1_INTER_T0_USING_ENV() /* inverse of above */\
+ if (!cmb.combine_ext) { \
+ T1_INTER_T0_USING_FACTOR ((rdp.env_color&0xFF)); \
+ }\
+ else {\
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.t1c_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB, \
+ cmb.t1c_ext_a_mode = GR_FUNC_MODE_ZERO, \
+ cmb.t1c_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB, \
+ cmb.t1c_ext_b_mode = GR_FUNC_MODE_ZERO, \
+ cmb.t1c_ext_c = GR_CMBX_ZERO, \
+ cmb.t1c_ext_c_invert = 0, \
+ cmb.t1c_ext_d= GR_CMBX_B, \
+ cmb.t1c_ext_d_invert = 0, \
+ cmb.t0c_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB, \
+ cmb.t0c_ext_a_mode = GR_FUNC_MODE_X, \
+ cmb.t0c_ext_b = GR_CMBX_OTHER_TEXTURE_RGB, \
+ cmb.t0c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X, \
+ cmb.t0c_ext_c = GR_CMBX_TMU_CCOLOR, \
+ cmb.t0c_ext_c_invert = 0, \
+ cmb.t0c_ext_d= GR_CMBX_B, \
+ cmb.t0c_ext_d_invert = 0, \
+ cmb.tex_ccolor = rdp.env_color, \
+ cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_COLOR; \
+}
+#define T0_INTER_T1_USING_SHADEA() \
+ if (!cmb.combine_ext) { \
+ T0_INTER_T1_USING_FACTOR (0x7F); \
+ }\
+ else {\
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.t1c_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB, \
+ cmb.t1c_ext_a_mode = GR_FUNC_MODE_ZERO, \
+ cmb.t1c_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB, \
+ cmb.t1c_ext_b_mode = GR_FUNC_MODE_ZERO, \
+ cmb.t1c_ext_c = GR_CMBX_ZERO, \
+ cmb.t1c_ext_c_invert = 0, \
+ cmb.t1c_ext_d= GR_CMBX_B, \
+ cmb.t1c_ext_d_invert = 0, \
+ cmb.t0c_ext_a = GR_CMBX_OTHER_TEXTURE_RGB, \
+ cmb.t0c_ext_a_mode = GR_FUNC_MODE_X, \
+ cmb.t0c_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB, \
+ cmb.t0c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X, \
+ cmb.t0c_ext_c = GR_CMBX_ITALPHA, \
+ cmb.t0c_ext_c_invert = 0, \
+ cmb.t0c_ext_d= GR_CMBX_B, \
+ cmb.t0c_ext_d_invert = 0, \
+ cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_COLOR; \
+}
+#define T1_INTER_T0_USING_SHADEA() \
+ if (!cmb.combine_ext) { \
+ T0_INTER_T1_USING_FACTOR (0x7F); \
+ }\
+ else {\
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.t1c_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB, \
+ cmb.t1c_ext_a_mode = GR_FUNC_MODE_ZERO, \
+ cmb.t1c_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB, \
+ cmb.t1c_ext_b_mode = GR_FUNC_MODE_ZERO, \
+ cmb.t1c_ext_c = GR_CMBX_ZERO, \
+ cmb.t1c_ext_c_invert = 0, \
+ cmb.t1c_ext_d= GR_CMBX_B, \
+ cmb.t1c_ext_d_invert = 0, \
+ cmb.t0c_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB, \
+ cmb.t0c_ext_a_mode = GR_FUNC_MODE_X, \
+ cmb.t0c_ext_b = GR_CMBX_OTHER_TEXTURE_RGB, \
+ cmb.t0c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X, \
+ cmb.t0c_ext_c = GR_CMBX_ITALPHA, \
+ cmb.t0c_ext_c_invert = 0, \
+ cmb.t0c_ext_d= GR_CMBX_B, \
+ cmb.t0c_ext_d_invert = 0, \
+ cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_COLOR; \
+}
+#define T1_SUB_T0() \
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL, \
+ cmb.tmu0_fac = GR_COMBINE_FACTOR_ONE
+#define T1_SUB_T0_MUL_T0() \
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL, \
+ cmb.tmu0_fac = GR_COMBINE_FACTOR_LOCAL
+#define T1_MUL_PRIMLOD_ADD_T0() \
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, \
+ cmb.tmu0_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \
+ percent = (float)(lod_frac) / 255.0f, \
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent
+#define T1_MUL_PRIMA_ADD_T0() \
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, \
+ cmb.tmu0_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \
+ percent = (float)(rdp.prim_color&0xFF) / 255.0f, \
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent
+#define T1_MUL_ENVA_ADD_T0() \
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, \
+ cmb.tmu0_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \
+ percent = (float)(rdp.env_color&0xFF) / 255.0f, \
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent
+#define T0_SUB_PRIM_MUL_PRIMLOD_ADD_T1() \
+ T0_ADD_T1 (); \
+ MOD_0 (TMOD_TEX_SUB_COL_MUL_FAC); \
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00); \
+ MOD_0_FAC (lod_frac & 0xFF);
+#define T1_SUB_PRIM_MUL_PRIMLOD_ADD_T0() \
+ if (cmb.combine_ext) \
+{ \
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X, \
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X, \
+ GR_CMBX_DETAIL_FACTOR, 0, \
+ GR_CMBX_ZERO, 0); \
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X, \
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X, \
+ GR_CMBX_ZERO, 1, \
+ GR_CMBX_ZERO, 0); \
+ cmb.tex_ccolor = rdp.prim_color; \
+ cmb.tex |= 3; \
+ percent = (float)(lod_frac) / 255.0f; \
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent; \
+} \
+ else \
+{ \
+ T0_ADD_T1 (); \
+ MOD_1 (TMOD_TEX_SUB_COL_MUL_FAC); \
+ MOD_1_COL (rdp.prim_color & 0xFFFFFF00); \
+ MOD_1_FAC (lod_frac & 0xFF); \
+}
+#define PRIM_INTER_T0_USING_SHADEA() \
+ if (!cmb.combine_ext) { \
+ USE_T0 (); \
+ }\
+ else {\
+ rdp.best_tex = 0; \
+ cmb.tex |= 1, \
+ cmb.t0c_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB, \
+ cmb.t0c_ext_a_mode = GR_FUNC_MODE_X, \
+ cmb.t0c_ext_b = GR_CMBX_TMU_CCOLOR, \
+ cmb.t0c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X, \
+ cmb.t0c_ext_c = GR_CMBX_ITALPHA, \
+ cmb.t0c_ext_c_invert = 0, \
+ cmb.t0c_ext_d= GR_CMBX_B, \
+ cmb.t0c_ext_d_invert = 0, \
+ cmb.tex_ccolor = rdp.prim_color, \
+ cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_COLOR; \
+}
+
+#define A_USE_T0() \
+ cmb.tex |= 1, \
+ cmb.tmu0_a_func = GR_COMBINE_FUNCTION_LOCAL
+#define A_USE_T1() \
+ if (voodoo.num_tmu > 1) { \
+ cmb.tex |= 2, \
+ cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_OTHER, \
+ cmb.tmu0_a_fac = GR_COMBINE_FACTOR_ONE; \
+ } \
+ else { \
+ A_USE_T0(); \
+}
+#define A_T0_ADD_T1() \
+ cmb.tex |= 3, \
+ cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, \
+ cmb.tmu0_a_fac = GR_COMBINE_FACTOR_ONE
+#define A_T1_SUB_T0() \
+ cmb.tex |= 3, \
+ cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL, \
+ cmb.tmu0_a_fac = GR_COMBINE_FACTOR_ONE
+#define A_T0_SUB_T1() \
+ cmb.tex |= 3, \
+ cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_a_func = GR_COMBINE_FUNCTION_BLEND_LOCAL, \
+ cmb.tmu0_a_fac = GR_COMBINE_FACTOR_OTHER_ALPHA
+#define A_T0_MUL_T1() \
+ cmb.tex |= 3, \
+ cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_OTHER, \
+ cmb.tmu0_a_fac = GR_COMBINE_FACTOR_LOCAL
+#define A_T0_INTER_T1_USING_T0A() \
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_a_func = GR_COMBINE_FUNCTION_BLEND, \
+ cmb.tmu0_a_fac = GR_COMBINE_FACTOR_LOCAL_ALPHA
+#define A_T1_INTER_T0_USING_T0A() \
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_a_func = GR_COMBINE_FUNCTION_BLEND, \
+ cmb.tmu0_a_fac = GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA
+#define A_T0_INTER_T1_USING_T1A() \
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_a_func = GR_COMBINE_FUNCTION_BLEND, \
+ cmb.tmu0_a_fac = GR_COMBINE_FACTOR_OTHER_ALPHA
+#define A_T0_INTER_T1_USING_FACTOR(factor) \
+ if (factor == 0xFF) { \
+ A_USE_T1(); \
+ } \
+ else if (factor == 0x00) { \
+ A_USE_T0(); \
+}\
+ else { \
+ cmb.tex |= 3, \
+ cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_a_func = GR_COMBINE_FUNCTION_BLEND, \
+ cmb.tmu0_a_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \
+ percent = (float)factor / 255.0f, \
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent; \
+}
+#define A_T1_INTER_T0_USING_FACTOR(factor) /* inverse of above */\
+ if (factor == 0xFF) { \
+ A_USE_T0(); \
+ } \
+ else if (factor == 0x00) { \
+ A_USE_T1(); \
+}\
+ else { \
+ cmb.tex |= 3, \
+ cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_a_func = GR_COMBINE_FUNCTION_BLEND, \
+ cmb.tmu0_a_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \
+ percent = (255 - factor) / 255.0f, \
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent; \
+}
+#define A_T0_INTER_T1_USING_SHADEA() \
+ if (!cmb.combine_ext) { \
+ A_T0_INTER_T1_USING_FACTOR (0x7F); \
+ }\
+ else {\
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.t1a_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA, \
+ cmb.t1a_ext_a_mode = GR_FUNC_MODE_ZERO, \
+ cmb.t1a_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA, \
+ cmb.t1a_ext_b_mode = GR_FUNC_MODE_ZERO, \
+ cmb.t1a_ext_c = GR_CMBX_ZERO, \
+ cmb.t1a_ext_c_invert = 0, \
+ cmb.t1a_ext_d= GR_CMBX_B, \
+ cmb.t1a_ext_d_invert = 0, \
+ cmb.t0a_ext_a = GR_CMBX_OTHER_TEXTURE_ALPHA, \
+ cmb.t0a_ext_a_mode = GR_FUNC_MODE_X, \
+ cmb.t0a_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA, \
+ cmb.t0a_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X, \
+ cmb.t0a_ext_c = GR_CMBX_ITALPHA, \
+ cmb.t0a_ext_c_invert = 0, \
+ cmb.t0a_ext_d= GR_CMBX_B, \
+ cmb.t0a_ext_d_invert = 0, \
+ cmb.tex_cmb_ext_use |= TEX_COMBINE_EXT_ALPHA; \
+}
+#define A_T1_MUL_PRIMLOD_ADD_T0() \
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, \
+ cmb.tmu0_a_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \
+ percent = (float)(lod_frac) / 255.0f, \
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent
+#define A_T1_MUL_PRIMA_ADD_T0() \
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, \
+ cmb.tmu0_a_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \
+ percent = (float)(rdp.prim_color&0xFF) / 255.0f, \
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent
+#define A_T1_MUL_ENVA_ADD_T0() \
+ rdp.best_tex = 0; \
+ cmb.tex |= 3, \
+ cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL, \
+ cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL, \
+ cmb.tmu0_a_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR, \
+ percent = (float)(rdp.env_color&0xFF) / 255.0f, \
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent
+
+
+// UNIMP - writes to the unimplemented log, if it's enabled
+#ifdef UNIMP_LOG
+#define UNIMPMODE() { \
+ std::ofstream unimp; \
+ unimp.open("unimp.txt", std::ios::app); \
+ unimp << out_buf; \
+ unimp.close(); \
+}
+#else
+#define UNIMPMODE()
+#endif
+
+// Bright red, sets up a bright red combine
+#ifdef BRIGHT_RED
+// Bright red, sets up a bright red combine during the alpha stage
+#define BrightRed() { \
+ CCMB (GR_COMBINE_FUNCTION_LOCAL, \
+ GR_COMBINE_FACTOR_NONE, \
+ GR_COMBINE_LOCAL_CONSTANT, \
+ GR_COMBINE_OTHER_NONE); \
+ ACMB (GR_COMBINE_FUNCTION_LOCAL, \
+ GR_COMBINE_FACTOR_NONE, \
+ GR_COMBINE_LOCAL_CONSTANT, \
+ GR_COMBINE_OTHER_NONE); \
+ cmb.ccolor = 0xFF0000FF; \
+}
+#else
+#define BrightRed()
+#endif
+
+#define CC(color) cmb.ccolor=(color)&0xFFFFFF00
+#define CC_BYTE(byte) { cmb.ccolor=(byte<<8)|(byte<<16)|(byte<<24); }
+#define CC_C1MULC2(color1, color2) { \
+ cmb.ccolor=(wxUint8)( ((color1 & 0xFF000000) >> 24) * (((color2 & 0xFF000000) >> 24) /255.0f) ) << 24 | \
+ (wxUint8)( ((color1 & 0x00FF0000) >> 16) * (((color2 & 0x00FF0000) >> 16) /255.0f) ) << 16 | \
+ (wxUint8)( ((color1 & 0x0000FF00) >> 8) * (((color2 & 0x0000FF00) >> 8) /255.0f) ) << 8 ; \
+}
+#define CC_C1SUBC2(color1, color2) { \
+ cmb.ccolor=(wxUint8)( max(0, (int)((color1 & 0xFF000000) >> 24) - (int)((color2 & 0xFF000000) >> 24)) ) << 24 | \
+ (wxUint8)( max(0, (int)((color1 & 0x00FF0000) >> 16) - (int)((color2 & 0x00FF0000) >> 16)) ) << 16 | \
+ (wxUint8)( max(0, (int)((color1 & 0x0000FF00) >> 8) - (int)((color2 & 0x0000FF00) >> 8)) ) << 8 ; \
+}
+#define CC_COLMULBYTE(color, byte) { \
+ float factor = byte/255.0f; \
+ cmb.ccolor = (wxUint8)( ((color & 0xFF000000) >> 24) * factor ) << 24 | \
+ (wxUint8)( ((color & 0x00FF0000) >> 16) * factor ) << 16 | \
+ (wxUint8)( ((color & 0x0000FF00) >> 8) * factor ) << 8 ; \
+}
+#define CC_PRIM() CC(rdp.prim_color)
+#define CC_ENV() CC(rdp.env_color)
+#define CC_1SUBPRIM() CC((~rdp.prim_color))
+#define CC_1SUBENV() CC((~rdp.env_color))
+#define CC_PRIMA() CC_BYTE((rdp.prim_color&0xFF))
+#define CC_ENVA() CC_BYTE((rdp.env_color&0xFF))
+#define CC_1SUBPRIMA() CC_BYTE(((~rdp.prim_color)&0xFF))
+#define CC_1SUBENVA() CC_BYTE(((~rdp.env_color)&0xFF))
+#define CC_PRIMLOD() CC_BYTE(rdp.prim_lodfrac)
+#define CC_K5() CC_BYTE(rdp.K5)
+#define CC_PRIMMULENV() CC_C1MULC2(rdp.prim_color, rdp.env_color)
+#define CC_PRIMSUBENV() CC_C1SUBC2(rdp.prim_color, rdp.env_color)
+
+#define XSHADE(color, flag) { \
+ rdp.col[0] *= (float)((color & 0xFF000000) >> 24) / 255.0f; \
+ rdp.col[1] *= (float)((color & 0x00FF0000) >> 16) / 255.0f; \
+ rdp.col[2] *= (float)((color & 0x0000FF00) >> 8) / 255.0f; \
+ rdp.cmb_flags |= flag; \
+}
+#define XSHADE1M(color, flag) { \
+ rdp.col[0] *= 1.0f-((float)((color & 0xFF000000) >> 24)/255.0f); \
+ rdp.col[1] *= 1.0f-((float)((color & 0x00FF0000) >> 16)/255.0f); \
+ rdp.col[2] *= 1.0f-((float)((color & 0x0000FF00) >> 8)/255.0f); \
+ rdp.cmb_flags |= flag; \
+}
+#define XSHADEC1MC2(color1, color2, flag) { \
+ rdp.col[0] *= (float)( max(0, (int)((color1 & 0xFF000000) >> 24) - (int)((color2 & 0xFF000000) >> 24)) )/255.0f; \
+ rdp.col[1] *= (float)( max(0, (int)((color1 & 0x00FF0000) >> 16) - (int)((color2 & 0x00FF0000) >> 16)) )/255.0f; \
+ rdp.col[2] *= (float)( max(0, (int)((color1 & 0x0000FF00) >> 8) - (int)((color2 & 0x0000FF00) >> 8)) )/255.0f; \
+ rdp.cmb_flags |= flag; \
+}
+#define XSHADE_BYTE(byte, flag) { \
+ float tmpcol = (float)byte / 255.0f; \
+ rdp.col[0] *= tmpcol; \
+ rdp.col[1] *= tmpcol; \
+ rdp.col[2] *= tmpcol; \
+ rdp.cmb_flags |= flag; \
+}
+#define MULSHADE(color) XSHADE(color, CMB_MULT)
+#define MULSHADE_PRIM() MULSHADE(rdp.prim_color)
+#define MULSHADE_ENV() MULSHADE(rdp.env_color)
+#define MULSHADE_1MPRIM() XSHADE1M(rdp.prim_color, CMB_MULT)
+#define MULSHADE_1MENV() XSHADE1M(rdp.env_color, CMB_MULT)
+#define MULSHADE_PRIMSUBENV() XSHADEC1MC2(rdp.prim_color, rdp.env_color, CMB_MULT)
+#define MULSHADE_ENVSUBPRIM() XSHADEC1MC2(rdp.env_color, rdp.prim_color, CMB_MULT)
+#define MULSHADE_BYTE(byte) XSHADE_BYTE(byte, CMB_MULT)
+#define MULSHADE_PRIMA() MULSHADE_BYTE((rdp.prim_color & 0xFF))
+#define MULSHADE_ENVA() MULSHADE_BYTE((rdp.env_color & 0xFF))
+#define MULSHADE_1MENVA() MULSHADE_BYTE(((~rdp.env_color) & 0xFF))
+#define MULSHADE_PRIMLOD() MULSHADE_BYTE((rdp.prim_lodfrac & 0xFF))
+#define MULSHADE_K5() MULSHADE_BYTE(rdp.K5)
+
+#define SETSHADE(color) XSHADE(color, CMB_SET)
+#define SETSHADE_PRIM() SETSHADE(rdp.prim_color)
+#define SETSHADE_ENV() SETSHADE(rdp.env_color)
+#define SETSHADE_BYTE(byte) XSHADE_BYTE(byte, CMB_SET)
+#define SETSHADE_PRIMA() SETSHADE_BYTE((rdp.prim_color & 0xFF))
+#define SETSHADE_ENVA() SETSHADE_BYTE((rdp.env_color & 0xFF))
+#define SETSHADE_1MPRIMA() SETSHADE_BYTE(((~rdp.prim_color) & 0xFF))
+#define SETSHADE_PRIMLOD() SETSHADE_BYTE((rdp.prim_lodfrac & 0xFF))
+#define SETSHADE_1MPRIMLOD() SETSHADE_BYTE(((~rdp.prim_lodfrac) & 0xFF))
+
+#define SETSHADE_1MPRIM() XSHADE1M(rdp.prim_color, CMB_SET)
+#define SETSHADE_1MENV() XSHADE1M(rdp.env_color, CMB_SET)
+#define SETSHADE_PRIMSUBENV() XSHADEC1MC2(rdp.prim_color, rdp.env_color, CMB_SET)
+#define SETSHADE_ENVSUBPRIM() XSHADEC1MC2(rdp.env_color, rdp.prim_color, CMB_SET)
+#define SETSHADE_SHADE_A() { \
+ rdp.cmb_flags = CMB_SETSHADE_SHADEALPHA; \
+}
+
+#define XSHADEADD(color, flag) { \
+ rdp.coladd[0] *= (float)((color & 0xFF000000) >> 24) / 255.0f; \
+ rdp.coladd[1] *= (float)((color & 0x00FF0000) >> 16) / 255.0f; \
+ rdp.coladd[2] *= (float)((color & 0x0000FF00) >> 8) / 255.0f; \
+ rdp.cmb_flags |= flag; \
+}
+#define XSHADEC1MC2ADD(color1, color2, flag) { \
+ rdp.coladd[0] *= (float)( max(0, (int)((color1 & 0xFF000000) >> 24) - (int)((color2 & 0xFF000000) >> 24)) )/255.0f; \
+ rdp.coladd[1] *= (float)( max(0, (int)((color1 & 0x00FF0000) >> 16) - (int)((color2 & 0x00FF0000) >> 16)) )/255.0f; \
+ rdp.coladd[2] *= (float)( max(0, (int)((color1 & 0x0000FF00) >> 8) - (int)((color2 & 0x0000FF00) >> 8)) )/255.0f; \
+ rdp.cmb_flags |= flag; \
+}
+#define SUBSHADE_PRIM() XSHADEADD(rdp.prim_color, CMB_SUB)
+#define SUBSHADE_ENV() XSHADEADD(rdp.env_color, CMB_SUB)
+#define SUBSHADE_PRIMSUBENV() XSHADEC1MC2ADD(rdp.prim_color, rdp.env_color, CMB_SUB)
+#define ADDSHADE_PRIM() XSHADEADD(rdp.prim_color, CMB_ADD)
+#define ADDSHADE_ENV() XSHADEADD(rdp.env_color, CMB_ADD)
+#define ADDSHADE_PRIMSUBENV() XSHADEC1MC2ADD(rdp.prim_color, rdp.env_color, CMB_ADD)
+#define SUBSHADE_PRIMMULENV() { \
+ rdp.coladd[0] *= (float)( ((rdp.prim_color & 0xFF000000) >> 24) * ((rdp.env_color & 0xFF000000) >> 24) )/255.0f/255.0f; \
+ rdp.coladd[1] *= (float)( ((rdp.prim_color & 0x00FF0000) >> 16) * ((rdp.env_color & 0x00FF0000) >> 16) )/255.0f/255.0f; \
+ rdp.coladd[2] *= (float)( ((rdp.prim_color & 0x0000FF00) >> 8) * ((rdp.env_color & 0x0000FF00) >> 8) )/255.0f/255.0f; \
+ rdp.cmb_flags |= CMB_SUB; \
+}
+
+#define COLSUBSHADE_PRIM() { \
+ rdp.coladd[0] *= (float)((rdp.prim_color & 0xFF000000) >> 24) / 255.0f; \
+ rdp.coladd[1] *= (float)((rdp.prim_color & 0x00FF0000) >> 16) / 255.0f; \
+ rdp.coladd[2] *= (float)((rdp.prim_color & 0x0000FF00) >> 8) / 255.0f; \
+ rdp.cmb_flags |= CMB_COL_SUB_OWN; \
+}
+
+#define INTERSHADE_2(color,factor) { \
+ rdp.col_2[0] = (((color) >> 24) & 0xFF) / 255.0f; \
+ rdp.col_2[1] = (((color) >> 16) & 0xFF) / 255.0f; \
+ rdp.col_2[2] = (((color) >> 8) & 0xFF) / 255.0f; \
+ rdp.shade_factor = (factor) / 255.0f; \
+ rdp.cmb_flags_2 = CMB_INTER; \
+}
+
+#define MULSHADE_SHADEA() rdp.cmb_flags |= CMB_MULT_OWN_ALPHA;
+
+#define CA(color) cmb.ccolor|=(color)&0xFF
+#define CA_PRIM() CA(rdp.prim_color)
+#define CA_ENV() CA(rdp.env_color)
+#define CA_INVPRIM() cmb.ccolor|=0xFF-(rdp.prim_color&0xFF)
+#define CA_INVENV() cmb.ccolor|=0xFF-(rdp.env_color&0xFF)
+#define CA_ENV1MPRIM() cmb.ccolor|= (wxUint32)(((rdp.env_color&0xFF)/255.0f) * (((~(rdp.prim_color&0xFF)) & 0xff)/255.0f) * 255.0f);
+#define CA_PRIMENV() cmb.ccolor |= (wxUint32)(((rdp.env_color&0xFF)/255.0f) * ((rdp.prim_color&0xFF)/255.0f) * 255.0f);
+#define CA_PRIMLOD() cmb.ccolor |= rdp.prim_lodfrac;
+#define CA_PRIM_MUL_PRIMLOD() cmb.ccolor |= (int)(((rdp.prim_color&0xFF) * rdp.prim_lodfrac) / 255.0f);
+#define CA_ENV_MUL_PRIMLOD() cmb.ccolor |= (int)(((rdp.env_color&0xFF) * rdp.prim_lodfrac) / 255.0f);
+
+#define XSHADE_A(color, flag) { \
+ rdp.col[3] *= (float)(color & 0xFF) / 255.0f; \
+ rdp.cmb_flags |= flag; \
+}
+#define XSHADE1M_A(color, flag) { \
+ rdp.col[3] *= 1.0f-((float)(color & 0xFF) / 255.0f); \
+ rdp.cmb_flags |= flag; \
+}
+#define XSHADEC1MC2_A(color1, color2, flag) { \
+ rdp.col[3] *= (float)( max(0, (int)(color1 & 0xFF) - (int)(color2 & 0xFF)) ) / 255.0f; \
+ rdp.cmb_flags |= flag; \
+}
+#define MULSHADE_A_PRIM() XSHADE_A(rdp.prim_color, CMB_A_MULT)
+#define MULSHADE_A_1MPRIM() XSHADE1M_A(rdp.prim_color, CMB_A_MULT)
+#define MULSHADE_A_ENV() XSHADE_A(rdp.env_color, CMB_A_MULT)
+#define MULSHADE_A_PRIMSUBENV() XSHADEC1MC2_A(rdp.prim_color, rdp.env_color, CMB_A_MULT)
+#define MULSHADE_A_ENVSUBPRIM() XSHADEC1MC2_A(rdp.env_color, rdp.prim_color, CMB_A_MULT)
+#define SETSHADE_A(color) XSHADE_A(color, CMB_A_SET)
+#define SETSHADE_A_PRIM() SETSHADE_A(rdp.prim_color)
+#define SETSHADE_A_ENV() SETSHADE_A(rdp.env_color)
+#define SETSHADE_A_PRIMSUBENV() XSHADEC1MC2_A(rdp.prim_color, rdp.env_color, CMB_A_SET)
+#define SETSHADE_A_INVENV() XSHADE1M_A(rdp.env_color, CMB_A_SET)
+
+#define XSHADEADD_A(color, flag) { \
+ rdp.coladd[3] *= (float)(color & 0xFF) / 255.0f; \
+ rdp.cmb_flags |= flag; \
+}
+#define SUBSHADE_A_PRIM() XSHADEADD_A(rdp.prim_color, CMB_A_SUB)
+#define SUBSHADE_A_ENV() XSHADEADD_A(rdp.env_color, CMB_A_SUB)
+#define ADDSHADE_A_PRIM() XSHADEADD_A(rdp.prim_color, CMB_A_ADD)
+#define ADDSHADE_A_ENV() XSHADEADD_A(rdp.env_color, CMB_A_ADD)
+
+//****************************************************************
+// Combine Functions
+//****************************************************************
+
+// These are in a somewhat ordered way, using the A constants below. T0 comes before
+// T1 comes before PRIM, ... except for CMB, which always comes at the end, where
+// the CMB comes first in the name. T0 and T1 are always interleaved, because they use the
+// same function.
+// Keep going in alphabetical order, but do not break the order of variables!
+// ex: A*C + B*C -> T0_MUL_PRIM_ADD_ENV_MUL_PRIM,
+// Although prim comes before env, we have already used prim as C, so it must stay as C
+// and would NOT become T0_MUL_PRIM_ADD_PRIM_MUL_ENV
+//
+// New version ordered by:
+// t0
+// prim
+// env
+// shade
+
+static void cc_one ()
+{
+ CCMB (GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_NONE);
+ // CC (0xFFFFFF00);
+ CC (0xFFFFFF00);
+}
+
+static void cc_zero ()
+{
+ CCMB (GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_NONE);
+ CC (0x00000000);
+}
+
+static void cc_t0 ()
+{
+ if ((rdp.othermode_l & 0x4000) && (rdp.cycle_mode < 2))
+ {
+ wxUint32 blend_mode = (rdp.othermode_l >> 16);
+ if (blend_mode == 0xa500)
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ float fog = (rdp.fog_color&0xFF)/255.0f;
+ wxUint32 R = (wxUint32)(((rdp.blend_color>>24)&0xFF)*fog);
+ wxUint32 G = (wxUint32)(((rdp.blend_color>>16)&0xFF)*fog);
+ wxUint32 B = (wxUint32)(((rdp.blend_color>> 8)&0xFF)*fog);
+ CC((R<<24)|(G<<16)|(B<<8));
+ }
+ else if (blend_mode == 0x55f0) //cmem*afog + cfog*1ma
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC(rdp.fog_color);
+ A_USE_T0 ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ }
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ }
+ USE_T0 ();
+}
+
+static void cc_t0a ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_CONSTANT);
+ USE_T0 ();
+ A_USE_T0 ();
+ CC (0xFFFFFF00);
+}
+
+static void cc_t1 () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ USE_T1 ();
+}
+
+static void cc_t0_mul_t1 ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_MUL_T1 ();
+}
+
+static void cc_t0_mul_t1_add_t0 () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_MUL_T1_ADD_T0 ();
+}
+
+/*
+static void cc_t1_inter__env_inter_t0_using_k5__using_t1a ()
+{
+CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+GR_COMBINE_FACTOR_ONE,
+GR_COMBINE_LOCAL_NONE,
+GR_COMBINE_OTHER_TEXTURE);
+wxUint32 col1 = (rdp.K5<<24) | (rdp.K5<<16) | (rdp.K5<<8);
+MOD_0 (TMOD_COL_INTER_TEX_USING_COL1);
+MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+MOD_0_COL1 (col1 & 0xFFFFFF00);
+rdp.best_tex = 0;
+cmb.tex |= 3;
+cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL;
+cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL;
+cmb.tmu0_func = GR_COMBINE_FUNCTION_BLEND;
+cmb.tmu0_fac = GR_COMBINE_FACTOR_ONE_MINUS_OTHER_ALPHA;
+}
+*/
+
+static void cc_t1_inter_t0_using_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ T1_INTER_T0_USING_ENV ();
+}
+
+static void cc_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_NONE);
+ CC_PRIM ();
+}
+
+static void cc_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_NONE);
+ CC_ENV ();
+}
+
+static void cc_scale ()
+{
+ CCMB (GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_NONE);
+ CC (rdp.SCALE);
+}
+
+static void cc_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_NONE);
+}
+
+static void cc_one_mul_shade ()
+{
+ if ((settings.hacks&hack_Knockout) && (rdp.aTBuffTex[0] || rdp.aTBuffTex[1] || rdp.cur_image)) //hack for boxer shadow
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC (0x20202000);
+ USE_T0 ();
+ }
+ else
+ {
+ cc_shade ();
+ }
+}
+
+static void cc_shadea ()
+{
+ CCMB (GR_COMBINE_FUNCTION_LOCAL_ALPHA,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_NONE);
+}
+
+static void cc_t0_mul_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ USE_T0 ();
+}
+
+static void cc_t0_mul_prima ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIMA ();
+ USE_T0 ();
+}
+
+static void cc_t1_mul_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ if ((rdp.cycle1 & 0xFFFF) == (rdp.cycle2 & 0xFFFF)) // 1 cycle, use t0
+ {
+ USE_T0 ();
+ }
+ else
+ {
+ USE_T1 ();
+ }
+}
+
+static void cc_t0a_mul_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ A_USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc__t1_inter_t0_using_enva__mul_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ T1_INTER_T0_USING_FACTOR (factor);
+}
+
+static void cc__t0_inter_one_using_t1__mul_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ rdp.best_tex = 0;
+ cmb.tex |= 3;
+ cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL;
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
+ cmb.tmu0_fac = GR_COMBINE_FACTOR_ONE_MINUS_LOCAL;
+}
+
+static void cc__t0_inter_one_using_primlod__mul_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ONE_MINUS_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 1;
+ percent = (float)lod_frac / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ }
+ else
+ {
+ MOD_0 (TMOD_TEX_INTER_COLOR_USING_FACTOR);
+ MOD_0_COL (0xFFFFFF00);
+ MOD_0_FAC (lod_frac);
+ USE_T0 ();
+ }
+}
+
+static void cc__t1_inter_one_using_env__mul_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 1,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 2;
+ cmb.tex_ccolor = rdp.env_color;
+ }
+ else
+ {
+ USE_T1 ();
+ }
+}
+
+static void cc__t1_inter_one_using_enva__mul_t0 ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TMU_CALPHA, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 3;
+ cmb.tex_ccolor = 0xFFFFFF00 | (rdp.env_color&0xFF);
+ }
+ else
+ {
+ if ((rdp.env_color&0xFF) == 0xFF)
+ {
+ USE_T0 ();
+ }
+ else
+ {
+ T0_MUL_T1 ();
+ }
+ }
+}
+
+//Added by Gonetz
+static void cc_prim_mul_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ SETSHADE_PRIM ();
+}
+
+static void cc_prim_mul_prima ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ SETSHADE_PRIMA ();
+}
+
+static void cc_t1_mul_prima ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIMA ();
+ USE_T1 ();
+}
+
+static void cc_t1_mul_enva ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENVA ();
+ USE_T1 ();
+}
+
+static void cc_t0_mul_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENV ();
+ USE_T0 ();
+}
+
+static void cc_t1_mul_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENV ();
+ USE_T1 ();
+}
+
+//Added by Gonetz
+static void cc_t0_mul_enva ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENVA ();
+ USE_T0 ();
+}
+
+static void cc_t0_mul_scale ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC (rdp.SCALE);
+ USE_T0 ();
+}
+
+static void cc_t0_mul_enva_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ SETSHADE_PRIM ();
+ CC_ENVA ();
+ USE_T0 ();
+}
+
+static void cc_t0_mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ USE_T0 ();
+}
+
+static void cc_f1_sky ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ MULSHADE_SHADEA ();
+ MULSHADE_ENVSUBPRIM ();
+ ADDSHADE_PRIM();
+ CC(0xFFFFFFFF);
+}
+
+static void cc_t0_mul_shadea ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SETSHADE_SHADE_A ();
+ USE_T0 ();
+}
+
+static void cc_t0_mul_k5 ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_K5 ();
+ USE_T0 ();
+}
+
+static void cc_t1_mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ USE_T1 ();
+}
+
+//Added by Gonetz
+static void cc__t0_add_t1__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_ADD_T1 ();
+}
+
+static void cc__t0_mul_shade__add__t1_mul_shade ()
+{
+ //combiner is used in Spiderman. It seems that t0 is used instead of t1
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_B, 0);
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ USE_T0 ();
+ }
+}
+
+static void cc__t0_mul_prim__inter_env_using_enva ()
+{
+ wxUint32 enva = rdp.env_color&0xFF;
+ if (enva == 0xFF)
+ cc_env ();
+ else if (enva == 0)
+ cc_t0_mul_prim ();
+ else if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CCOLOR, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 1;
+ cmb.tex_ccolor = rdp.prim_color;
+ CCMBEXT(GR_CMBX_ITRGB, GR_FUNC_MODE_X,
+ GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_B, 0);
+ SETSHADE_ENV();
+ CC_ENVA();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SETSHADE_PRIM();
+ INTERSHADE_2 (rdp.env_color & 0xFFFFFF00, rdp.env_color & 0xFF);
+ USE_T0 ();
+ MOD_0 (TMOD_TEX_INTER_COLOR_USING_FACTOR);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ MOD_0_FAC (rdp.env_color & 0xFF);
+ }
+}
+
+
+static void cc__t1_inter_t0_using_t1__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_B, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 3;
+ }
+ else
+ {
+ T0_INTER_T1_USING_FACTOR (0x7F);
+ }
+}
+
+//Added by Gonetz
+static void cc__t1_inter_t0_using_enva__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ T1_INTER_T0_USING_FACTOR (factor);
+}
+
+//Added by Gonetz
+static void cc__t1_inter_t0_using_shadea__mul_shade ()
+{
+ if (!cmb.combine_ext) {
+ cc_t0_mul_shade ();
+ return;
+ }
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ T1_INTER_T0_USING_SHADEA ();
+}
+
+//Added by Gonetz
+static void cc__t0_inter_one_using_prim__mul_shade ()
+{
+ // (1-t0)*prim+t0, (cmb-0)*shade+0
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ONE_MINUS_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 1;
+ cmb.tex_ccolor = rdp.prim_color;
+ }
+ else
+ {
+ USE_T0 ();
+ MOD_0 (TMOD_TEX_INTER_COL_USING_COL1);
+ MOD_0_COL (0xFFFFFF00);
+ MOD_0_COL1 (rdp.prim_color & 0xFFFFFF00);
+ }
+}
+
+static void cc__t0_inter_one_using_primlod__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ONE_MINUS_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 1;
+ percent = (float)lod_frac / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ }
+ else
+ {
+ MOD_0 (TMOD_TEX_INTER_COLOR_USING_FACTOR);
+ MOD_0_COL (0xFFFFFF00);
+ MOD_0_FAC (lod_frac);
+ USE_T0 ();
+ }
+}
+
+//Added by Gonetz
+static void cc__t0_inter_env_using_enva__mul_shade ()
+{
+ // (env-t0)*env_a+t0, (cmb-0)*shade+0
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TMU_CALPHA, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 1;
+ cmb.tex_ccolor = rdp.env_color;
+ }
+ else
+ {
+ USE_T0 ();
+ MOD_0 (TMOD_TEX_INTER_COLOR_USING_FACTOR);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ MOD_0_FAC (rdp.env_color&0xFF);
+ }
+}
+
+//Added by Gonetz
+static void cc__t0_inter_env_using_shadea__mul_shade ()
+{
+ // (env-t0)*shade_a+t0, (cmb-0)*shade+0
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 1;
+ cmb.tex_ccolor = rdp.env_color;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ }
+ else
+ {
+ cc_t0_mul_shade ();
+ }
+}
+
+static void cc__t0_mul_prim_add_env__mul_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CCOLOR, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 1;
+ cmb.tex_ccolor = rdp.prim_color;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ CC_ENV ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MOD_0 (TMOD_TEX_SCALE_COL_ADD_COL);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ MOD_0_COL1 (rdp.env_color & 0xFFFFFF00);
+ USE_T0 ();
+ }
+}
+
+static void cc__t1_sub_t0_mul_primlod_add_prim__mul_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 3;
+ percent = (float)lod_frac / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ CC_PRIM ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+ }
+}
+
+static void cc__t1_sub_prim_mul_t0__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 3;
+ }
+ else
+ {
+ T0_MUL_T1 ();
+ }
+}
+
+static void cc__t1_sub_t0_mul_t0_add_shade__mul_shade () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_ITRGB, 0);
+ cmb.tex |= 3;
+ }
+ else
+ {
+ T1_SUB_T0_MUL_T0 ();
+ }
+}
+
+static void cc__one_sub_shade_mul_t0_add_shade__mul_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ONE_MINUS_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ USE_T0 ();
+ }
+}
+
+static void cc__t0_sub_prim_mul_t1_add_t1__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (rdp.prim_color & 0xFFFFFF00)
+ {
+ MOD_0 (TMOD_TEX_SUB_COL);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ }
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 3;
+ }
+ else
+ {
+ T0_MUL_T1 ();
+ }
+}
+
+static void cc__t1_sub_env_mul_t0_add_t0__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.env_color;
+ cmb.tex |= 3;
+ }
+ else
+ {
+ MOD_1 (TMOD_TEX_SUB_COL);
+ MOD_1_COL (rdp.env_color & 0xFFFFFF00);
+ T0_MUL_T1_ADD_T0 ();
+ }
+}
+
+static void cc__t0_mul_prima_add_prim_mul__shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CALPHA, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 1;
+ }
+ else
+ {
+ MOD_0 (TMOD_TEX_SCALE_FAC_ADD_COL);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ MOD_0_FAC (rdp.prim_color & 0xFF);
+ USE_T0 ();
+ }
+}
+
+static void cc__t0_inter_prim_using_prima__inter_env_using_enva ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TMU_CALPHA, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_ITRGB, GR_FUNC_MODE_X,
+ GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_B, 0);
+ CC_ENVA ();
+ SETSHADE_ENV ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_1SUBENVA ();
+ SETSHADE_ENV ();
+ SETSHADE_ENVA ();
+ MOD_0 (TMOD_TEX_INTER_COLOR_USING_FACTOR);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ MOD_0_FAC (rdp.prim_color & 0xFF);
+ USE_T0 ();
+ }
+}
+
+static void cc_prim_inter_t1_mul_shade_using_texa ()
+{
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 3;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TEXTURE_ALPHA, 0,
+ GR_CMBX_B, 0);
+ }
+ else
+ {
+ cc_t1_mul_shade ();
+ }
+}
+
+static void cc__prim_inter_t0_using_t0a__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 1;
+ }
+ else
+ {
+ MOD_0 (TMOD_COL_INTER_TEX_USING_TEXA);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ USE_T0 ();
+ }
+}
+
+static void cc__prim_inter_t0_using_t0a__inter_env_using_enva ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_ITRGB, GR_FUNC_MODE_X,
+ GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_B, 0);
+ CC_ENVA ();
+ SETSHADE_ENV ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_1SUBENVA ();
+ SETSHADE_ENV ();
+ SETSHADE_ENVA ();
+ MOD_0 (TMOD_COL_INTER_TEX_USING_TEXA);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ USE_T0 ();
+ }
+}
+
+// ** A*B **
+
+static void cc__prim_inter_t0_using_shadea__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ PRIM_INTER_T0_USING_SHADEA ();
+}
+
+static void cc_t0_sub_shade_mul_shadea_add_shade ();
+static void cc__shade_inter_t0_using_shadea__mul_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ }
+ else
+ {
+ cc_t0_sub_shade_mul_shadea_add_shade ();
+ }
+}
+
+static void cc__prim_inter_env_using_enva__mul_shade ()
+{
+ const float ea = ((float)(rdp.env_color&0xFF)) / 255.0f;
+ const float ea_i = 1.0f - ea;
+ wxUint32 pr = (rdp.prim_color >> 24)&0xFF;
+ wxUint32 pg = (rdp.prim_color >> 16)&0xFF;
+ wxUint32 pb = (rdp.prim_color >> 8)&0xFF;
+ wxUint32 er = (rdp.env_color >> 24)&0xFF;
+ wxUint32 eg = (rdp.env_color >> 16)&0xFF;
+ wxUint32 eb = (rdp.env_color >> 8)&0xFF;
+ wxUint32 r = min(255, (wxUint32)(er*ea + pr*ea_i));
+ wxUint32 g = min(255, (wxUint32)(eg*ea + pg*ea_i));
+ wxUint32 b = min(255, (wxUint32)(eb*ea + pb*ea_i));
+ wxUint32 col = (r << 24) | (g << 16) | (b << 8) | 0xFF;
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC (col);
+}
+
+//Added by Gonetz
+static void cc_prim_mul_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ SETSHADE_ENV ();
+}
+
+static void cc_prim_mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+}
+
+static void cc_prim_mul_shadea ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ SETSHADE_SHADE_A ();
+ CC_PRIM ();
+}
+
+static void cc_env_mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+}
+
+static void cc_env_mul_enva ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_OTHER_ALPHA,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ CA_ENV ();
+}
+
+static void cc_scale_mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC (rdp.SCALE);
+}
+
+// ** A+B **
+
+static void cc_t0_add_prim () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ USE_T0 ();
+}
+
+static void cc__t0_mul_t1__add_prim () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ T0_MUL_T1 ();
+}
+
+static void cc_t0_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENV ();
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc__t0_mul_t1__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENV ();
+ T0_MUL_T1 ();
+}
+
+static void cc__t0_mul_t1__add_env_mul__t0_mul_t1__add_env ()
+{
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.env_color;
+ cmb.tex |= 3;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TEXTURE_RGB, 0,
+ GR_CMBX_ZERO, 0);
+ }
+ else
+ cc__t0_mul_t1__add_env();
+}
+
+static void cc_t0_add_shade () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ USE_T0 ();
+}
+
+static void cc__t0_mul_t1__add_shade () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_MUL_T1 ();
+}
+
+static void cc_prim_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+}
+
+static void cc_t0_add_prim_mul_one_sub_t0_add_t0 () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 1,
+ GR_CMBX_B, 0);
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 1;
+ }
+ else
+ {
+ cc_t0_add_prim ();
+ }
+}
+
+static void cc_one_sub_prim_mul_t0_add_prim();
+static void cc__one_sub_prim_mul_t0_add_prim__mul_prima_add__one_sub_prim_mul_t0_add_prim () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CCOLOR, 1,
+ GR_CMBX_B, 0);
+ CCMBEXT(GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ CC_PRIMA();
+ cmb.tex |= 3; //hw frame buffer allocated as tile1, but not used in combiner
+ }
+ else
+ {
+ cc_one_sub_prim_mul_t0_add_prim();
+ // cc_t0 ();
+ }
+}
+
+static void cc_prim_add_shade () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+}
+
+static void cc_env_add_shade () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+}
+
+static void cc_shade_add_shade () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_ITERATED);
+}
+
+// ** A-B **
+static void cc__t0_inter_t1_using_enva__sub_env () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENV ();
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ T0_INTER_T1_USING_FACTOR (factor);
+}
+
+static void cc_t0_sub__shade_mul_center ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE(rdp.CENTER);
+ USE_T0 ();
+}
+
+// ** A-B*C **
+static void cc_env_sub__t0_sub_t1_mul_primlod__mul_prim () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 3;
+ CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ SETSHADE_PRIM ();
+ SETSHADE_PRIMLOD ();
+ CC_ENV ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_PRIM ();
+ CC_ENV ();
+ T1_INTER_T0_USING_FACTOR (lod_frac);
+ }
+}
+
+static void cc_env_sub__t0_mul_scale_add_env__mul_prim ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CCOLOR, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.SCALE;
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_B, 0);
+ SETSHADE_ENV ();
+ CC_PRIM ();
+ }
+ else
+ cc_t0_add_env ();
+}
+
+static void cc_one_sub__one_sub_t0_mul_enva_add_prim__mul_prim () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ONE_MINUS_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 1;
+ percent = (float)(rdp.env_color&0xFF) / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ CCMBEXT(GR_CMBX_ZERO, GR_FUNC_MODE_X,
+ GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_ZERO, 1);
+ CC_PRIM ();
+ }
+ else
+ {
+ cc_one ();
+ }
+}
+
+// ** A+B*C **
+//Aded by Gonetz
+static void cc_t0_add_env_mul_k5 ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ float scale = rdp.K5 / 255.0f;
+ wxUint8 r = (wxUint8)(rdp.env_color >> 24) & 0xFF;
+ r = (wxUint8)(r*scale);
+ wxUint8 g = (wxUint8)(rdp.env_color >> 16) & 0xFF;
+ g = (wxUint8)(g*scale);
+ wxUint8 b = (wxUint8)(rdp.env_color >> 8) & 0xFF;
+ b = (wxUint8)(b*scale);
+ CC((r<<24)|(g<<16)|(b<<8));
+ USE_T0 ();
+}
+
+static void cc_t0_add_shade_mul_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_ENV ();
+ USE_T0 ();
+}
+
+static void cc__t1_mul_t0_add_t0__add_prim_mul_shade () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_PRIM ();
+ rdp.best_tex = 0;
+ cmb.tex |= 3;
+ cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL;
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
+ cmb.tmu0_fac = GR_COMBINE_FACTOR_LOCAL;
+}
+
+static void cc__t0_sub_env_mul_enva__add_prim_mul_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex_ccolor = rdp.env_color;
+ cmb.tex |= 1;
+ percent = (float)(rdp.env_color&0xFF) / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+
+ CCMBEXT(GR_CMBX_ITRGB, GR_FUNC_MODE_X,
+ GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_B, 0);
+ CC_PRIM ();
+ }
+ else {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_PRIM ();
+ MOD_0 (TMOD_TEX_SUB_COL_MUL_FAC);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ MOD_0_FAC (rdp.env_color & 0xFF);
+ USE_T0 ();
+ }
+}
+
+// ** A*B+C **
+//Added by Gonetz
+static void cc_t0_mul_prim_add_t1 ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CCOLOR, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 3;
+ cmb.tex_ccolor = rdp.prim_color;
+ }
+ else
+ {
+ MOD_0 (TMOD_TEX_MUL_COL);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ T0_ADD_T1 ();
+ }
+}
+
+static void cc_shirt ()
+{
+ // (t1-0)*prim+0, (1-t0)*t1+cmb
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (cmb.combine_ext)
+ {
+ /*
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CCOLOR, 0,
+ GR_CMBX_ZERO, 0);
+ //*/
+ //*
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ //*/
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 1,
+ GR_CMBX_B, 0);
+ cmb.tex |= 3;
+ cmb.tex_ccolor = rdp.prim_color;
+ }
+ else
+ {
+ MOD_1 (TMOD_TEX_MUL_COL);
+ MOD_1_COL (rdp.prim_color & 0xFFFFFF00);
+ T0_ADD_T1 ();
+ }
+}
+
+static void cc_t1_mul_prim_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_PRIM ();
+ CC_PRIM ();
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc_t0_mul_prim_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_PRIM ();
+ CC_ENV ();
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc_t1_mul_prim_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_PRIM ();
+ CC_ENV ();
+ USE_T1 ();
+}
+
+static void cc__t0_add_primlod__mul_prim_add_env ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ CC_PRIMLOD ();
+ cmb.tex_ccolor = cmb.ccolor;
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ cmb.tex |= 1;
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIMLOD ();
+ MOD_0 (TMOD_TEX_ADD_COL);
+ MOD_0_COL (cmb.ccolor & 0xFFFFFF00);
+ SETSHADE_PRIM ();
+ CC_ENV ();
+ USE_T0 ();
+ }
+}
+
+//Added by Gonetz
+static void cc_t0_mul_prim_mul_shade_add_prim_mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_PRIM ();
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc__t0_inter_t1_using_primlod__mul_prim_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_PRIM ();
+ CC_ENV ();
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+static void cc__t1_sub_prim_mul_enva_add_t0__mul_prim_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ SETSHADE_ENV ();
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_ZERO, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 3;
+ percent = (float)(rdp.env_color&0xFF) / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ }
+ else
+ {
+ MOD_1 (TMOD_TEX_SUB_COL_MUL_FAC);
+ MOD_1_COL (rdp.prim_color & 0xFFFFFF00);
+ MOD_1_FAC (rdp.env_color & 0xFF);
+ T0_ADD_T1 ();
+ }
+}
+
+//Added by Gonetz
+static void cc__t0_inter_t1_using_primlod__mul_shade_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+//Added by Gonetz
+static void cc__t1_sub_prim_mul_primlod_add_t0__mul_prim_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_PRIM ();
+ CC_ENV ();
+ T1_SUB_PRIM_MUL_PRIMLOD_ADD_T0 ();
+}
+
+//Aded by Gonetz
+static void cc__t0_mul_t1__mul_prim_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ MULSHADE_PRIM ();
+ T0_MUL_T1 ();
+}
+
+//Aded by Gonetz
+static void cc__t0_mul_t1__sub_prim_mul_env_add_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CCOLOR, 0,
+ GR_CMBX_ZERO, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.env_color;
+ cmb.tex |= 3;
+ CCMBEXT(GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_TEXTURE_RGB, 0);
+ CC_PRIMMULENV ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ T0_MUL_T1 ();
+ }
+}
+
+static void cc__t0_sub_prim_mul_t1_add_t1__mul_env_add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ if (rdp.prim_color & 0xFFFFFF00)
+ {
+ MOD_0 (TMOD_TEX_SUB_COL);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ }
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 3;
+ }
+ else
+ {
+ T0_MUL_T1 ();
+ }
+}
+
+static void cc__t0_mul_t1__mul_shade_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ T0_MUL_T1 ();
+}
+
+static void cc__t0_mul_shadea_add_env__mul_shade_add_prim ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.env_color;
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ CC_PRIM ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ MULSHADE_SHADEA ();
+ CC_PRIM ();
+ USE_T0 ();
+ }
+}
+
+static void cc__t0_mul_t1__mul_shade_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ T0_MUL_T1 ();
+}
+
+//Added by Gonetz
+static void cc__t0_add_t1__mul_shade_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ T0_ADD_T1 ();
+}
+
+static void cc__t1_mul_prima_add_t0__mul_shade_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ T1_MUL_PRIMA_ADD_T0 ();
+}
+
+static void cc__t0_inter_t1_using_enva__mul_shade_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ T0_INTER_T1_USING_FACTOR (factor);
+}
+
+static void cc__t0_inter_t1_using_enva__mul_shade_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ T0_INTER_T1_USING_FACTOR (factor);
+}
+
+//Added by Gonetz
+static void cc_t0_mul_primlod_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ SETSHADE_PRIM ();
+ CC_PRIMLOD ();
+ USE_T0 ();
+}
+
+static void cc__t0_mul_primlod__add__prim_mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ MULSHADE_PRIM ();
+ CC_PRIMLOD ();
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc_t0_mul_primlod_add_prim_mul_shade_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ MULSHADE_PRIM ();
+ ADDSHADE_ENV ();
+ CC_PRIMLOD ();
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc_t1_mul_primlod_add_prim_mul_shade_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ MULSHADE_PRIM ();
+ ADDSHADE_ENV ();
+ CC_PRIMLOD ();
+ USE_T1 ();
+}
+
+static void cc__t0_inter_t1_using_primlod__mul_shade_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+static void cc__t1_inter_t0_using_primlod__mul_shade_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ T1_INTER_T0_USING_FACTOR (lod_frac);
+}
+
+//Added by Gonetz
+static void cc__t1_sub_t0_mul_primlod_add_prim__mul_shade_add_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 3;
+ percent = (float)lod_frac / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ITRGB, 0);
+ CC_PRIM ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+ }
+}
+
+//Added by Gonetz
+static void cc__t0_inter_t1_using_half__mul_prim_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_PRIM ();
+ CC_ENV ();
+ T0_INTER_T1_USING_FACTOR (0x7F);
+}
+
+//Added by Gonetz
+static void cc__t0_inter_t1_using_t1__mul_prim_add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ T0_INTER_T1_USING_T1 ();
+}
+
+//Added by Gonetz
+static void cc_one_sub_t1_mul_t0a_add_t0_mul_env_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ MOD_0 (TMOD_TEX_MUL_COL);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ rdp.best_tex = 0;
+ cmb.tex |= 3;
+ cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL;
+ cmb.tmu1_invert = 1;
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
+ cmb.tmu0_fac = GR_COMBINE_FACTOR_LOCAL_ALPHA;
+}
+
+//Added by Gonetz
+static void cc__t0_inter_t1_using_t1__mul_shade_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ T0_INTER_T1_USING_T1 ();
+}
+
+//Added by Gonetz
+static void cc_t0_mul_prim_add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ USE_T0 ();
+}
+
+static void cc_t1_mul_prim_add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ USE_T1 ();
+}
+
+//Added by Gonetz
+static void cc_t0_mul_env_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_ENV ();
+ CC_PRIM ();
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc_t1_mul_env_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_ENV ();
+ CC_PRIM ();
+ USE_T1 ();
+}
+
+static void cc_t0_mul_scale_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE (rdp.SCALE);
+ CC_PRIM ();
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc__t0_mul_t1__mul_env_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_ENV ();
+ CC_PRIM ();
+ T0_MUL_T1 ();
+}
+
+//Added by Gonetz
+static void cc__t0_add__t1_mul_scale__mul_env_sub_center_add_prim ()
+{
+ // (t1-0)*scale+t0, (env-center)*cmb+prim
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_C1SUBC2(rdp.env_color, rdp.CENTER);
+ SETSHADE_PRIM ();
+ MOD_1 (TMOD_TEX_MUL_COL);
+ MOD_1_COL (rdp.SCALE & 0xFFFFFF00);
+ T0_ADD_T1 ();
+}
+
+//Added by Gonetz
+static void cc__t1_sub_t0__mul_env_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_ENV ();
+ CC_PRIM ();
+ T1_SUB_T0 ();
+}
+
+//Added by Gonetz
+static void cc_t0_mul_env_add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ USE_T0 ();
+}
+
+static void cc_t0_mul_shade_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ USE_T0 ();
+}
+
+static void cc__t0_mul_enva_add_t1__mul_shade_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 3;
+ percent = (float)(rdp.env_color&0xFF) / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ }
+ else
+ {
+ T0_ADD_T1 ();
+ }
+}
+
+static void cc_t0_mul_shade_add_prima ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIMA ();
+ USE_T0 ();
+}
+
+static void cc_t1_mul_shade_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ USE_T1 ();
+}
+
+static void cc_t0_mul_shade_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ USE_T0 ();
+}
+
+static void cc__t0_add_prim__mul_shade_add_t0 ()
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ CC_PRIM ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ // MOD_0 (TMOD_TEX_ADD_COL);
+ // MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ }
+ USE_T0 ();
+}
+
+static void cc__t0_add_prim__mul_shade_add_t1 ()
+{
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 3;
+ CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ CC_PRIM ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_PRIM ();
+ T0_ADD_T1 ();
+ }
+}
+
+static void cc__t0_add_primlod__mul_shade_add_env ()
+{
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ CC_PRIMLOD ();
+ cmb.tex_ccolor = cmb.ccolor;
+ CC_ENV ();
+ cmb.tex |= 1;
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ wxUint32 color = (lod_frac<<24) | (lod_frac<<16) | (lod_frac<<8);
+ MOD_0 (TMOD_TEX_ADD_COL);
+ MOD_0_COL (color & 0xFFFFFF00);
+ CC_ENV ();
+ USE_T0 ();
+ }
+}
+
+static void cc__t0_mul_prima_add_prim_mul__shade_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CALPHA, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 1;
+ }
+ else
+ {
+ MOD_0 (TMOD_TEX_SCALE_FAC_ADD_COL);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ MOD_0_FAC (rdp.prim_color & 0xFF);
+ USE_T0 ();
+ }
+}
+
+//Added by Gonetz
+static void cc_t0_mul_shadea_add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ USE_T0 ();
+}
+
+static void cc_prim_mul_prima_add_prim () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ CA_PRIM ();
+ SETSHADE_PRIM ();
+}
+
+static void cc_prim_mul_prima_add_t0 () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SETSHADE_PRIM ();
+ SETSHADE_PRIMA ();
+ USE_T0 ();
+}
+
+static void cc_prim_mul_env_add_t0 () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SETSHADE_PRIM ();
+ SETSHADE_ENV ();
+ USE_T0 ();
+}
+
+static void cc_prim_mul_shade_add_t0 ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_PRIM ();
+ USE_T0 ();
+}
+
+static void cc_prim_mul_shade_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ MULSHADE_PRIM ();
+}
+
+static void cc_env_mul_shade_add_env () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ MULSHADE_ENV ();
+}
+
+// ** A*B+C*D **
+static void cc_t0_mul_prim_add_one_sub_prim_mul_shade () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ MULSHADE_1MPRIM ();
+ USE_T0 ();
+}
+
+static void cc_t0_mul_prim_add_shade_sub_env_mul_prim () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ SUBSHADE_ENV ()
+ MULSHADE_PRIM ();
+ USE_T0 ();
+}
+
+static void cc_t0_mul_prim_add_shade_mul_shadea_mul_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ MULSHADE_PRIM ();
+ MULSHADE_SHADEA ();
+ USE_T0 ();
+}
+
+static void cc__t0_mul_t1__mul_prim_add_prim_mul_shade () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ MULSHADE_PRIM ();
+ CC_PRIM ();
+ T0_MUL_T1 ();
+}
+
+static void cc_t0_mul_env_add_prim_mul_shade () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ MULSHADE_PRIM ();
+ CC_ENV ();
+ USE_T0 ();
+}
+
+static void cc_t0_mul_enva_add_prim_mul_shade () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ MULSHADE_PRIM ();
+ CC_ENVA ();
+ USE_T0 ();
+}
+
+static void cc_t0_mul_shade_add_prim_mul_env () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIMMULENV ();
+ USE_T0 ();
+}
+
+static void cc_prim_mul_env_add_one_sub_prim_mul_shade () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ MULSHADE_1MPRIM ();
+ CC_PRIMMULENV ();
+}
+
+// ** A*B*C **
+
+static void cc_t0_mul_prim_mul_prim () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SETSHADE_PRIM ();
+ SETSHADE_PRIM ();
+ USE_T0 ();
+}
+
+static void cc_t0_mul_prim_mul_prima () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SETSHADE_PRIM ();
+ SETSHADE_PRIMA ();
+ USE_T0 ();
+}
+
+static void cc_t0_mul_enva_mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_ENVA ();
+ USE_T0 ();
+}
+
+static void cc_t0_mul_primlod_mul_prim () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_COLMULBYTE (rdp.prim_color, rdp.prim_lodfrac);
+ USE_T0 ();
+}
+
+static void cc_t0_mul_primlod_mul_shade () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_PRIMLOD ();
+ USE_T0 ();
+}
+
+static void cc__t0_mul_t1__mul_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ T0_MUL_T1 ();
+}
+
+static void cc__t1_mul_t1_add_t0__mul_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_OTHER_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 3;
+ }
+ else
+ {
+ T0_ADD_T1 ();
+ }
+}
+
+static void cc__t0_mul_t1__mul_prima () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIMA ();
+ T0_MUL_T1 ();
+}
+
+static void cc__t0_mul_t1__mul_env () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENV ();
+ T0_MUL_T1 ();
+}
+
+static void cc__t0_mul_t1__mul_enva () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENVA ();
+ T0_MUL_T1 ();
+}
+
+static void cc__t0_mul_t1__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_MUL_T1 ();
+}
+
+static void cc__t0a_mul_t1__mul_prim () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ T0A_MUL_T1 ();
+}
+
+static void cc__t0_mul_t1a__mul_shade () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_MUL_T1A ();
+}
+
+static void cc__t0a_mul_t1__mul_shade () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0A_MUL_T1 ();
+}
+
+static void cc_t0_mul_prim_mul_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SETSHADE_PRIM ();
+ SETSHADE_ENV (); // notice that setshade multiplies
+ USE_T0 ();
+}
+
+static void cc_t0_mul_prim_mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_PRIM ();
+ USE_T0 ();
+}
+
+static void cc_t0_mul_prim_mul_shadea ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SETSHADE_PRIM ();
+ MULSHADE_SHADEA();
+ USE_T0 ();
+}
+
+static void cc_t0_mul_prima_mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_PRIMA ();
+ USE_T0 ();
+}
+
+static void cc_t1_mul__one_sub_prim_mul_shade_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_1MPRIM ();
+ ADDSHADE_PRIM ();
+ USE_T1 ();
+}
+
+static void cc_t0_mul_one_sub_env_mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_1MENV ();
+ USE_T0 ();
+}
+
+static void cc_t1_mul_prim_mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_PRIM ();
+ USE_T1 ();
+}
+
+//Added by Gonetz
+static void cc_t0_mul_1mprim_mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_1MPRIM ();
+ USE_T0 ();
+}
+
+static void cc_t0_mul_env_mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_ENV ();
+ USE_T0 ();
+}
+
+static void cc_t0_mul_scale_mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE (rdp.SCALE);
+ USE_T0 ();
+}
+
+static void cc_t0_mul_shade_mul_shadea ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_SHADEA ();
+ USE_T0 ();
+}
+
+static void cc_prim_mul_env_mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ MULSHADE_PRIM ();
+}
+
+static void cc_prim_mul_one_sub_env_mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_1SUBENV ();
+ MULSHADE_PRIM ();
+}
+
+// ** A*B*C+D **
+static void cc_t0_mul_prim_mul_shade_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ MULSHADE_PRIM ();
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc_t0_mul_prim_mul_shadea_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENV ();
+ SETSHADE_ENV ();
+ MULSHADE_A_PRIM ();
+ USE_T0 ();
+}
+
+// (A*B+C)*D
+static void cc__t0_mul_prim_add_shade__mul_env ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CCOLOR, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 1;
+ cmb.tex_ccolor = rdp.prim_color;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_ZERO, 0);
+ CC_ENV ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_ENV ();
+ MOD_0 (TMOD_TEX_MUL_COL);
+ CC_PRIMMULENV ();
+ MOD_0_COL (cmb.ccolor & 0xFFFFFF00);
+ USE_T0 ();
+ }
+}
+
+static void cc__t0a_mul_prim_add_t0__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MOD_0 (TMOD_COL_MUL_TEXA_ADD_TEX);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ USE_T0 ();
+}
+
+static void cc__t0a_mul_env_add_t0__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MOD_0 (TMOD_COL_MUL_TEXA_ADD_TEX);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ USE_T0 ();
+}
+
+static void cc__prim_mul_shade_add_env__mul_shade () //Aded by Gonetz
+{
+ if (!cmb.combine_ext)
+ {
+ cc_prim_mul_shade_add_env ();
+ return;
+ }
+ T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 1;
+ cmb.tex_ccolor = rdp.prim_color;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ CC_ENV ();
+}
+
+// ** A*B*C+D*E **
+//Added by Gonetz
+static void cc__t0_sub_t1__mul_prim_mul_shade_add_prim_mul_env ()
+{
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 3;
+ }
+ else
+ {
+ USE_T0 ();
+ }
+
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIMMULENV ();
+ MULSHADE_PRIM ();
+}
+
+static void cc__t0_mul_prim_mul_env__add__prim_mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIMMULENV ();
+ MULSHADE_PRIM ();
+ USE_T0 ();
+}
+
+static void cc__t1_mul_prim_mul_env__add__prim_mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIMMULENV ();
+ MULSHADE_PRIM ();
+ USE_T1 ();
+}
+
+//Added by Gonetz
+static void cc_t0_mul_one_sub_prim_mul_shade_add_prim_mul_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIMMULENV ();
+ MULSHADE_1MPRIM ();
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc_t0_mul_one_sub_prim_mul_shadea_add_prim_mul_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIMMULENV ();
+ SETSHADE_1MPRIM ();
+ MULSHADE_SHADEA ();
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc_t0_mul_one_sub_env_mul_shade_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ MULSHADE_1MENV ();
+ USE_T0 ();
+}
+
+static void cc_t0_mul_prima_mul_shade_add_prim_mul_one_sub_prima () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ MULSHADE_PRIMA ();
+ USE_T0 ();
+ wxUint8 fac = 255 - (wxUint8)(rdp.prim_color&0xFF);
+ float col[3];
+ col[0] = (float)((rdp.prim_color & 0xFF000000) >> 24) / 255.0f;
+ col[1] = (float)((rdp.prim_color & 0x00FF0000) >> 16) / 255.0f;
+ col[2] = (float)((rdp.prim_color & 0x0000FF00) >> 8) / 255.0f;
+ CC ( ((wxUint8)(col[0]*fac))<<24 | ((wxUint8)(col[1]*fac))<<16 | ((wxUint8)(col[2]*fac))<<8 | fac );
+}
+
+// ** A*(1-B)+C **
+static void cc_t0_mul_1menv_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ SETSHADE_1MENV ();
+ USE_T0 ();
+}
+
+// ** (A+B)*C **
+static void cc_t0_mul_scale_add_prim__mul_shade () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CCOLOR, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 1;
+ cmb.tex_ccolor = rdp.SCALE;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ CC_PRIM ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MOD_0 (TMOD_TEX_ADD_COL);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ USE_T0 ();
+ }
+}
+
+static void cc__t0_mul_t1_add_prim__mul_shade () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ CC_PRIM ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_PRIM ();
+ }
+ T0_MUL_T1 ();
+}
+
+static void cc_t0_mul__prim_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SETSHADE_PRIM ();
+ ADDSHADE_ENV ();
+ USE_T0 ();
+}
+
+static void cc_t0_mul__prim_mul_primlod_add_env () //Aded by Gonetz
+{
+ // forest behind window, Dobutsu no Mori.
+ // (prim-0)*prim_lod+env, (t1-0)*cmb+0
+ //actually, the game uses t0 instead of t1 here. t1 does not set at all this moment.
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ float prim_lod = rdp.prim_lodfrac / 65025.0f;
+ rdp.col[0] *= ((rdp.prim_color & 0xFF000000) >> 24) * prim_lod;
+ rdp.col[1] *= ((rdp.prim_color & 0x00FF0000) >> 16) * prim_lod;
+ rdp.col[2] *= ((rdp.prim_color & 0x0000FF00) >> 8) * prim_lod;
+ rdp.cmb_flags = CMB_SET;
+ ADDSHADE_ENV ();
+ USE_T0 ();
+}
+
+// ** (A-B)*C **
+static void cc__t0_mul_prim_add_shade__sub_env_mul_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CCOLOR, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ CC_ENV ();
+ }
+ else
+ {
+ cc_t0_mul_prim_mul_shade ();
+ }
+}
+
+static void cc_t0_sub_prim_mul_shadea () //Aded by Gonetz
+{
+ // * not guaranteed to work if another iterated alpha is set
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SETSHADE_PRIM ();
+ USE_T0 ();
+}
+
+static void cc__t0_sub_env_mul_shade__sub_prim_mul_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex_ccolor = rdp.env_color;
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ITRGB, 0);
+ CC_PRIM ();
+ }
+ else
+ {
+ cc_t0_mul_shade ();
+ }
+}
+
+static void cc_t0_sub_prim_mul_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ CC_PRIM ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (rdp.prim_color & 0xFFFFFF00)
+ {
+ MOD_0 (TMOD_TEX_SUB_COL);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ }
+ }
+ USE_T0 ();
+}
+
+static void cc__t0_mul_t1__sub_prim_mul_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ CC_PRIM ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ }
+ T0_MUL_T1 ();
+}
+
+static void cc_t0_sub_env_mul_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ CC_ENV ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (rdp.env_color & 0xFFFFFF00)
+ {
+ MOD_0 (TMOD_TEX_SUB_COL);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ }
+ }
+ USE_T0 ();
+}
+
+static void cc__t0_mul_prima_add_t0__sub_center_mul_scale ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CCOLOR, 0,
+ GR_CMBX_B, 0);
+ wxUint32 prima = rdp.prim_color&0xFF;
+ cmb.tex_ccolor = (prima<<24)|(prima<<16)|(prima<<8)|prima;
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ CC(rdp.CENTER);
+ SETSHADE(rdp.SCALE);
+ }
+ else
+ {
+ cc_t0_mul_prima();
+ }
+}
+
+static void cc__t1_inter_t0_using_primlod__sub_shade_mul_prim ()
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_ZERO, 0);
+ CC_PRIM ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_PRIM ();
+ }
+ T1_INTER_T0_USING_FACTOR (lod_frac);
+}
+
+static void cc__t0_inter_t1_using_enva__sub_shade_mul_prim ()
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_ZERO, 0);
+ CC_PRIM ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_PRIM ();
+ }
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ T0_INTER_T1_USING_FACTOR (factor);
+}
+
+static void cc_t0_sub_shade_mul_shadea () //Aded by Gonetz
+{
+ // * not guaranteed to work if another iterated alpha is set
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ USE_T0 ();
+}
+
+static void cc_one_sub_t0_mul_prim () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_BLEND_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_NONE);
+ CC_PRIM ();
+ USE_T0 ();
+}
+
+static void cc_one_sub_prim_mul_prima () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC (~rdp.prim_color);
+ SETSHADE_PRIMA ();
+}
+
+static void cc_shade_sub_prim_mul_t0 () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ USE_T0 ();
+}
+
+static void cc_shade_sub_prim_mul_env () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SUBSHADE_PRIM ();
+}
+
+static void cc_shade_sub_env_mul_t0 () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ USE_T0 ();
+}
+
+static void cc_shade_sub_prim_mul__t0_inter_t1_using_primlod () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+static void cc_shade_sub_env_mul__t0_inter_t1_using_primlod () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+static void cc_shade_sub_env_mul_prim () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM();
+ SUBSHADE_ENV ();
+}
+
+static void cc_shade_sub__prim_mul_prima () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_C1MULC2 (rdp.prim_color, (rdp.prim_color&0xFF));
+}
+
+static void cc_one_sub__t0_mul_t1__mul_shade () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC (0);
+ T0_MUL_T1 ();
+}
+
+static void cc_one_sub__t0_mul_shadea__mul_shade () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 1;
+
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_ONE_MINUS_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ USE_T0 ();
+ cmb.tmu0_invert = TRUE;
+ }
+}
+
+static void cc_one_sub_env_mul_t0 () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENV ();
+ USE_T0 ();
+}
+
+static void cc_one_sub_env_mul__t0_inter_t1_using_primlod () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENV ();
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+static void cc_one_sub_env_mul_prim () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+}
+
+static void cc_one_sub_env_mul_shade () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+}
+
+// ** (1-A)*B + A*C **
+static void cc_t0_mul_env_add_1mt0_mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ USE_T0 ();
+}
+
+// ** (1-A)*B+C **
+static void cc_one_sub_shade_mul__t1_sub_prim_mul_primlod_add_t0__add_shade () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ T1_SUB_PRIM_MUL_PRIMLOD_ADD_T0 ();
+}
+
+// ** (1-A)*B*C **
+static void cc_one_sub_t0_mul_prim_mul_shade () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_BLEND_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_NONE);
+ MULSHADE_PRIM ();
+ USE_T0 ();
+}
+
+// ** (A-B)*C*D **
+static void cc_prim_sub_env_mul_t0_mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_ITERATED);
+ MULSHADE_PRIMSUBENV ();
+ USE_T0 ();
+}
+
+// ** (A-B)*C+D **
+static void cc_t0_sub_t1_mul_prim_mul_shade_add_t1 () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 3;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ MULSHADE_PRIM ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ T0_ADD_T1 ();
+ }
+}
+
+static void cc_t0_sub_prim_mul_t0a_add_prim () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ USE_T0 ();
+}
+
+static void cc_t0_sub_prim_mul_t1_add_shade () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_OTHER_TEXTURE_RGB, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 3;
+ cmb.tex_ccolor = rdp.prim_color;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_B, 0);
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MOD_0 (TMOD_TEX_SUB_COL);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ T0_MUL_T1 ();
+ }
+}
+
+static void cc_t0_sub_prim_mul_primlod_add_prim () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_B, 0);
+ SETSHADE_PRIM ();
+ CC_PRIMLOD ();
+ }
+ else
+ {
+ // * not guaranteed to work if another iterated alpha is set
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ SETSHADE_PRIM ();
+ SETSHADE_1MPRIMLOD ();
+ CC_PRIMLOD ();
+ }
+ USE_T0 ();
+}
+
+static void cc_t0_sub_prim_mul_prima_add_prim () //Aded by Gonetz
+{
+ // * not guaranteed to work if another iterated alpha is set
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ SETSHADE_PRIM ();
+ SETSHADE_1MPRIMA ();
+ CC_PRIMA ();
+ USE_T0 ();
+}
+
+static void cc_t0_sub_prim_mul_shadea_add_prim () //Aded by Gonetz
+{
+ // * not guaranteed to work if another iterated alpha is set
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SETSHADE_PRIM ();
+ USE_T0 ();
+}
+
+static void cc_t0_sub_prim_mul_env_add_shade () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 1;
+ cmb.tex_ccolor = rdp.prim_color;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_B, 0);
+ CC_ENV ();
+ }
+ else
+ {
+ cc_t0_mul_env_add_shade ();
+ }
+}
+
+static void cc__t0_inter_t1_using_shadea__sub_prim_mul_env_add_shade () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_B, 0);
+ //have to pass shade alpha to combiner
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_ZERO, 0);
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ }
+ CC_ENV ();
+ SUBSHADE_PRIMMULENV ();
+ T0_INTER_T1_USING_SHADEA ();
+}
+
+
+static void cc_t0_sub_prim_mul_env_add_prim () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ SETSHADE_1MENV ();
+ USE_T0 ();
+}
+
+static void cc_t0_sub_prim_mul_enva_add_prim () //Aded by Gonetz41
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_B, 0);
+ SETSHADE_PRIM ();
+ CC_ENVA ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ MOD_0 (TMOD_TEX_SUB_COL_MUL_FAC);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ MOD_0_FAC (rdp.env_color & 0xFF);
+ }
+ USE_T0 ();
+}
+
+static void cc_t0_sub_prim_mul_primlod_add_env () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENV ();
+ MOD_0 (TMOD_TEX_SUB_COL_MUL_FAC);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ MOD_0_FAC (lod_frac & 0xFF);
+ USE_T0 ();
+}
+
+static void cc_t0_sub__prim_mul_env () //Aded by Gonetz
+{
+ if ( (rdp.prim_color & 0xFFFFFF00) == 0xFFFFFF00 && (rdp.env_color & 0xFFFFFF00) == 0xFFFFFF00)
+ {
+ CCMB (GR_COMBINE_FUNCTION_BLEND_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_NONE);
+ CC_PRIM ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SETSHADE_PRIM ();
+ SETSHADE_ENV ();
+ }
+ USE_T0 ();
+}
+
+static void cc__t0_mul_t1__sub_prim_mul__t0t1a__add_prim () //Aded by Gonetz
+{
+ // * not guaranteed to work if another iterated alpha is set
+ CCMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ T0_MUL_T1 ();
+ A_T0_MUL_T1 ();
+}
+
+static void cc__t1_inter_t0_using_enva__sub_prim_mul_prima_add_prim () //Aded by Gonetz
+{
+ // * not guaranteed to work if another iterated alpha is set
+ CCMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ CA_PRIM ();
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ T1_INTER_T0_USING_FACTOR (factor);
+}
+
+static void cc_t0_sub_prim_mul_shade_add_env ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 1;
+ cmb.tex_ccolor = rdp.prim_color;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ CC_ENV ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ MOD_0 (TMOD_TEX_SUB_COL);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ USE_T0 ();
+ }
+}
+
+static void cc_t1_sub_prim_mul_shade_add_env ()
+{
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 2;
+ cmb.tex_ccolor = rdp.prim_color;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ CC_ENV ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ MOD_1 (TMOD_TEX_SUB_COL);
+ MOD_1_COL (rdp.prim_color & 0xFFFFFF00);
+ USE_T1 ();
+ }
+}
+
+static void cc_t1_sub_k4_mul_prima_add_t0 ()
+{
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_DETAIL_FACTOR, 1,
+ GR_CMBX_ZERO, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 3;
+ CC_BYTE (rdp.K4);
+ cmb.tex_ccolor = cmb.ccolor;
+ percent = (float)(rdp.prim_color&0xFF) / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ CCMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_B, 0);
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_ADD_T1 ();
+ }
+}
+
+static void cc__t0_sub_prim_mul_shade_add_env__mul_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 1;
+ cmb.tex_ccolor = rdp.prim_color;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ CC_ENV ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ MOD_0 (TMOD_TEX_SUB_COL);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ USE_T0 ();
+ }
+}
+
+static void cc__t0_sub_prim_mul_shade_add_env__mul_shadea ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 1;
+ cmb.tex_ccolor = rdp.prim_color;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ CC_ENV ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ MULSHADE_SHADEA();
+ CC_ENV ();
+ MOD_0 (TMOD_TEX_SUB_COL);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ USE_T0 ();
+ }
+}
+
+static void cc__t0_mul_shade__sub_env_mul_shadea_add_env () //Aded by Gonetz
+{
+ if (rdp.tiles[rdp.cur_tile].format == 4)
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_OTHER_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ }
+ else if (rdp.tiles[rdp.cur_tile].format == 2)
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ USE_T0 ();
+ }
+ else
+ {
+ cc_t0 ();
+ }
+}
+
+static void cc_t0_sub_env_mul_k5_add_prim () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ MOD_0 (TMOD_TEX_SUB_COL_MUL_FAC);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ MOD_0_FAC (rdp.K5);
+ USE_T0 ();
+}
+
+static void cc_t0_sub_k4_mul_k5_add_t0 () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_B, 0);
+ wxUint32 temp = rdp.prim_lodfrac;
+ rdp.prim_lodfrac = rdp.K4;
+ SETSHADE_PRIMLOD ();
+ rdp.prim_lodfrac = temp;
+ CC_K5 ();
+ USE_T0 ();
+ }
+ else
+ {
+ cc_t0 ();
+ }
+}
+
+static void cc__t0_inter_t1_using_t0__sub_shade_mul_prima_add_shade () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ cmb.tex |= 3;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_B, 0);
+ CC_PRIMA();
+ T0_INTER_T1_USING_T0 ();
+ }
+ else
+ {
+ // * not guaranteed to work if another iterated alpha is set
+ CCMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SETSHADE_A_PRIM ();
+ T1_INTER_T0_USING_T0 (); //strange, but this one looks better
+ }
+}
+
+static void cc_t0_sub__prim_mul_shade__mul_enva_add__prim_mul_shade () //Aded by Gonetz
+{
+ // * not guaranteed to work if another iterated alpha is set
+ CCMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_PRIM ();
+ SETSHADE_A_ENV ();
+ USE_T0 ();
+}
+
+static void cc_t0_sub_env_mul_t0_add_env () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENV ();
+ USE_T0 ();
+ //(t0-env)*t0+env = t0*t0 + (1-t0)*env
+}
+
+static void cc_t0_sub_env_mul_prima_add_env () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 1;
+ percent = (rdp.prim_color&0xFF) / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ }
+ else
+ {
+ MOD_0 (TMOD_COL_INTER_TEX_USING_COL1);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ wxUint32 prima = rdp.prim_color & 0xFF;
+ MOD_0_COL1 ((prima<<24)|(prima|16)|(prima<<8));
+ USE_T0 ();
+ }
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+}
+
+static void cc_t0_sub_env_mul_k5_add_env () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ cmb.ccolor = (rdp.env_color&0xFFFFFF00) | rdp.K5;
+ USE_T0 ();
+}
+
+static void cc_t0_sub_env_mul_prim_add_shade () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ MOD_0 (TMOD_TEX_SUB_COL);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ USE_T0 ();
+}
+
+static void cc_t0_sub_env_mul_shade_add_prim () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 1;
+ cmb.tex_ccolor = rdp.env_color;
+ }
+ else
+ {
+ MOD_0 (TMOD_TEX_SUB_COL);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ USE_T0 ();
+ }
+}
+
+static void cc__t0_sub_t1_mul_enva_add_shade__sub_env_mul_prim ()
+// (t0-t1)*env_a+shade, (cmb-env)*prim+0
+{
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TMU_CCOLOR, 0,
+ GR_CMBX_ITRGB, 0);
+ cmb.tex |= 3;
+ CC_COLMULBYTE(rdp.prim_color, (rdp.env_color&0xFF));
+ cmb.tex_ccolor = cmb.ccolor;
+ CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_TEXTURE_RGB, 0);
+ MULSHADE_PRIM ();
+ CC_PRIMMULENV ();
+ }
+ else
+ {
+ cc_t0_sub_env_mul_prim_add_shade();
+ }
+}
+
+static void cc__t0_inter_t1_using_primlod__sub_env_mul_shade_add_prim () //Aded by Gonetz
+{
+ if (!(rdp.env_color&0xFFFFFF00))
+ {
+ cc__t0_inter_t1_using_primlod__mul_shade_add_prim ();
+ return;
+ }
+ if (!(rdp.prim_color&0xFFFFFF00))
+ {
+ if (!cmb.combine_ext)
+ {
+ cc_t0_sub_env_mul_shade ();
+ return;
+ }
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ CC_ENV ();
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+ return;
+ }
+ cc__t0_inter_t1_using_primlod__mul_shade_add_prim ();
+}
+
+static void cc__t0_sub_env_mul_shade_add_prim__mul_shade () //Aded by Gonetz
+{
+ if (!cmb.combine_ext)
+ {
+ cc_t0_sub_env_mul_shade_add_prim ();
+ return;
+ }
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex_ccolor = rdp.env_color;
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ CC_PRIM ();
+}
+
+static void cc__t0_sub_env_mul_shade_add_prim__mul_shadea () //Aded by Gonetz
+{
+ if (!cmb.combine_ext)
+ {
+ cc_t0_sub_env_mul_shade_add_prim ();
+ return;
+ }
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 1;
+ MOD_0 (TMOD_TEX_SUB_COL);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_ZERO, 0);
+}
+
+static void cc__t0_inter_t1_using_primlod__sub_env_mul_shade_add_env ()
+{
+ // (t1-t0)*primlod+t0, (cmb-env)*shade+env
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ }
+ CC_ENV ();
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+
+static void cc_t0_sub_env_mul_enva_add_prim () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ MOD_0 (TMOD_TEX_SUB_COL_MUL_FAC);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ MOD_0_FAC (rdp.env_color & 0xFF);
+ USE_T0 ();
+}
+
+static void cc_one_sub_t0_mul_prim_add_t0 () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ USE_T0 ();
+ //(1-t)*prim+t == (1-prim)*t+prim
+}
+
+static void cc_one_sub_t1_mul_prim_add_t1 () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ USE_T1 ();
+ //(1-t)*prim+t == (1-prim)*t+prim
+}
+
+static void cc_one_sub_t1_mul_env_add_t1 () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENV ();
+ USE_T1 ();
+ //(1-t)*env+t == (1-env)*t+env
+}
+
+static void cc_one_sub_t0_mul_primlod_add_t0 () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIMLOD ();
+ USE_T0 ();
+ //(1-t)*primlod+t == (1-primlod)*t+primlod
+}
+
+static void cc_one_sub_t0_mul_prima_add_t0 () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ USE_T0 ();
+ //(1-t)*prima+t == (1-prima)*t+prima
+}
+
+static void cc_one_sub__t0_inter_t1_using_enva__mul_prim_add__t0_inter_t1_using_enva () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ T0_INTER_T1_USING_FACTOR (factor);
+ //(1-t)*prim+t == (1-prim)*t+prim
+}
+
+static void cc_one_sub_t0_mul_shade_add_t0 ()
+{
+ CCMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC (0xFFFFFFFF);
+ USE_T0 ();
+}
+
+static void cc_one_sub_prim_mul_t0_add_prim () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ USE_T0 ();
+}
+
+static void cc_one_sub_prim_mul_t0a_add_prim ()
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_ONE_MINUS_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TEXTURE_ALPHA, 0,
+ GR_CMBX_B, 0);
+ CC_PRIM ();
+ } else {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ MOD_0 (TMOD_COL_INTER_COL1_USING_TEXA);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ MOD_0_COL1 (0xFFFFFF00);
+ }
+ USE_T0 ();
+}
+
+static void cc_one_sub_prim_mul__t0_inter_t1_using_primlod__add_prim () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+static void cc__one_sub_prim_mul_shade__mul_t0_add__prim_mul_shade () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_PRIM ();
+ USE_T0 ();
+}
+
+static void cc_one_sub_shade_mul__t0_inter_t1_using_primlod__add_shade () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+static void cc_one_sub_prim_mul_t1_add_prim () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ USE_T1 ();
+}
+
+static void cc_one_sub_prim_mul_env_add_prim () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ SETSHADE_ENV ();
+}
+
+static void cc_t0_sub_prim_mul_shade_add_shade () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ITRGB, 0);
+ CC_PRIM ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (rdp.prim_color & 0xFFFFFF00)
+ {
+ MOD_0 (TMOD_TEX_SUB_COL);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ }
+ }
+ USE_T0 ();
+}
+
+static void cc__t0_mul_t0__sub_prim_mul_shade_add_shade () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ITRGB, 0);
+ CC_PRIM ();
+ }
+ else
+ cc_t0_sub_prim_mul_shade_add_shade();
+}
+
+static void cc__t0_mul_t1__sub_prim_mul_shade_add_shade () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ITRGB, 0);
+ CC_PRIM ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ }
+ T0_MUL_T1 ();
+}
+
+static void cc__t0_mul_t1__sub_env_mul_shade_add_shade () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ITRGB, 0);
+ CC_ENV ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ }
+ T0_MUL_T1 ();
+}
+
+static void cc_one_sub_prim_mul_shade_add_shade () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_1SUBPRIM ();
+}
+
+static void cc_t0_inter_env_using_prima ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ USE_T0 ();
+
+ MOD_0 (TMOD_TEX_INTER_COLOR_USING_FACTOR);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ MOD_0_FAC (rdp.prim_color & 0xFF);
+}
+
+static void cc_t0_inter_env_using_enva ()
+{
+ //(env-t0)*env_a+t0
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TMU_CALPHA, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.env_color;
+ cmb.tex |= 1;
+ }
+ else
+ {
+ USE_T0 ();
+ MOD_0 (TMOD_TEX_INTER_COLOR_USING_FACTOR);
+ MOD_0_COL (rdp.env_color & 0xFFFFFFFF);
+ MOD_0_FAC (rdp.env_color & 0xFF);
+ }
+}
+
+static void cc_t0_inter_noise_using_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ USE_T0 ();
+
+ MOD_0 (TMOD_TEX_INTER_NOISE_USING_COL);
+ MOD_0_COL (rdp.prim_color);
+ rdp.noise = RDP::noise_texture;
+}
+
+static void cc_t0_inter_noise_using_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ USE_T0 ();
+
+ MOD_0 (TMOD_TEX_INTER_NOISE_USING_COL);
+ MOD_0_COL (rdp.env_color);
+ rdp.noise = RDP::noise_texture;
+}
+
+static void cc_t0_sub_env_mul_enva_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENV ();
+ CA_ENV ();
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc_one_sub_prim_mul__t0_mul_t1__add__prim_mul_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_1SUBPRIM ();
+ SETSHADE_PRIM ();
+ SETSHADE_ENV ();
+ T0_MUL_T1 ();
+}
+
+//Added by Gonetz
+static void cc_one_sub_prim_mul__t0_mul_t1__add__prim_mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_1SUBPRIM ();
+ MULSHADE_PRIM ();
+ T0_MUL_T1 ();
+}
+
+//Added by Gonetz
+static void cc_one_sub_prim_mul__t0_inter_t1_using_enva__add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_1SUBPRIM ();
+ SETSHADE_PRIM ();
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ T0_INTER_T1_USING_FACTOR (factor);
+}
+
+static void cc_one_sub_env_mul__t0_inter_t1_using_primlod__add_env () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENV ();
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+static void cc_one_sub_env_mul__t1_sub_prim_mul_primlod_add_t0__add_env () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENV ();
+ T1_SUB_PRIM_MUL_PRIMLOD_ADD_T0 ();
+}
+
+static void cc_one_sub_env_mul_t0_add_prim_mul_env () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_1SUBENV ();
+ SETSHADE_PRIM ();
+ SETSHADE_ENV ();
+ USE_T0 ();
+}
+
+static void cc_one_sub_env_mul_t0_add_env () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENV ();
+ USE_T0 ();
+}
+
+static void cc_one_sub_env_mul_t0_add_shade () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_1SUBENV ();
+ USE_T0 ();
+}
+
+static void cc_one_sub_env_mul_prim_add_env () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+}
+
+static void cc_one_sub_env_mul_prim_add_shade () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_1SUBENV ();
+ CC_C1MULC2 (rdp.prim_color, cmb.ccolor);
+}
+
+static void cc_one_sub_env_mul_shade_add_env () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+}
+
+static void cc_one_sub_env_mul_prim_add__t0_inter_t1_using_env () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SETSHADE_PRIM ();
+ SETSHADE_1MENV ();
+ T0_INTER_T1_USING_ENV ();
+}
+
+static void cc_one_sub_shade_mul_t0_add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ USE_T0 ();
+}
+
+static void cc_one_sub_shade_mul__t0_mul_shadea__add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 1;
+ }
+ else
+ {
+ USE_T0 ();
+ }
+}
+
+static void cc_one_sub_shade_mul_env_add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+}
+
+static void cc_one_sub_shade_mul_shadea_add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC (0xFFFFFFFF);
+}
+
+///*
+static void cc_t0_sub_env_mul_prim_add_env () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ SETSHADE_1MPRIM();
+ SETSHADE_ENV();
+ CC_PRIM ();
+ USE_T0 ();
+ //(t0-env)*prim+env == t0*prim + env*(1-prim)
+}
+//*/
+static void cc__t0_inter_t1_using_t1a__sub_env_mul_enva_add_env () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ cmb.ccolor = rdp.env_color;
+ T0_INTER_T1_USING_T1A ();
+}
+
+static void cc_t0_sub_shade_mul_t0a_add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ USE_T0 ();
+ A_USE_T0 ();
+}
+
+static void cc_t0_sub_shade_mul_prima_add_shade () //Aded by Gonetz
+{
+ // * not guaranteed to work if another iterated alpha is set
+ CCMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SETSHADE_A_PRIM ();
+ USE_T0 ();
+}
+
+static void cc_t0_sub_shade_mul_shadea_add_shade () //Aded by Gonetz
+{
+ // * not guaranteed to work if another iterated alpha is set
+ CCMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ USE_T0 ();
+}
+
+static void cc__t0_mul_t1_add_env__mul_shadea_add_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.env_color;
+ cmb.tex |= 3;
+ }
+ else
+ {
+ T0_MUL_T1 ();
+ }
+ // * not guaranteed to work if another iterated alpha is set
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+}
+
+static void cc_prim_sub_t0_mul_env_add_t0 () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_1SUBENV ();
+ SETSHADE_PRIM ();
+ SETSHADE_ENV ();
+ USE_T0 ();
+ //(prim-t0)*env+t0 == prim*env + t0*(1-env)
+}
+
+static void cc_prim_sub_t0_mul_t1_add_t0 () //Aded by Gonetz
+{
+ if (!cmb.combine_ext)
+ {
+ cc_t0_mul_t1 ();
+ return;
+ }
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_OTHER_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 3;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+}
+
+static void cc_env_sub_t0_mul_prim_add_t0 () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_1SUBPRIM ();
+ SETSHADE_PRIM ();
+ SETSHADE_ENV ();
+ USE_T0 ();
+ //(env-t0)*prim+t0 == prim*env + t0*(1-prim)
+}
+
+static void cc_env_sub_t0_mul_shade_add_t0 () //Aded by Gonetz
+{
+ if (!cmb.combine_ext)
+ {
+ cc_t0_mul_shade ();
+ return;
+ }
+ CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ CC_ENV ();
+ USE_T0 ();
+}
+
+static void cc_prim_sub_env_mul_t0_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ SETSHADE_PRIMSUBENV ();
+ USE_T0 ();
+}
+
+static void cc_prim_sub_env_mul_t0_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ SETSHADE_ENV ();
+ USE_T0 ();
+}
+
+static void cc__prim_sub_env_mul_t0_add_env__add_primlod ()
+{
+ if (!cmb.combine_ext)
+ {
+ cc_prim_sub_env_mul_t0_add_env ();
+ return;
+ }
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.env_color;
+ cmb.tex |= 1;
+ SETSHADE_PRIMSUBENV ();
+ CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_TEXTURE_RGB, 0);
+ CC_PRIMLOD ();
+}
+
+static void cc__prim_sub_env_mul_t0_add_env__add_shadea ()
+{
+ if (!cmb.combine_ext)
+ {
+ cc_prim_sub_env_mul_t0_add_env ();
+ return;
+ }
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.env_color;
+ cmb.tex |= 1;
+ SETSHADE_PRIMSUBENV ();
+ CCMBEXT(GR_CMBX_ITALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_TEXTURE_RGB, 0);
+}
+
+static void cc_prim_sub_env_mul__t0_mul_t1a__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ SETSHADE_ENV ();
+ T0_MUL_T1A ();
+}
+
+static void cc_prim_sub_env_mul__t0_mul_prim__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ SETSHADE_ENV ();
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CCOLOR, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 1;
+ }
+ else
+ {
+ USE_T0 ();
+ }
+}
+
+static void cc_prim_sub_env_mul_t0_mul_shade_add_env ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CCOLOR, 0,
+ GR_CMBX_ZERO, 0);
+ CC_PRIMSUBENV ();
+ cmb.tex_ccolor = cmb.ccolor;
+ cmb.tex |= 1;
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ }
+ else
+ {
+ cc_t0_mul_prim_mul_shade ();
+ }
+}
+
+static void cc_prim_sub_env_mul__t0_sub_t0_mul_prima__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ SETSHADE_ENV ();
+ rdp.best_tex = 0;
+ cmb.tex |= 1;
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_BLEND_LOCAL;
+ cmb.tmu0_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR;
+ percent = (float)(rdp.prim_color&0xFF) / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+}
+
+static void cc_prim_sub_env_mul__one_sub_t0_mul_primlod_add_prim__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ONE_MINUS_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 1;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = (float)lod_frac / 255.0f;
+ }
+ else
+ {
+ USE_T0 ();
+ }
+}
+
+static void cc_prim_sub_env_mul__t0_add_t1a__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ SETSHADE_ENV ();
+ rdp.best_tex = 0;
+ cmb.tex |= 3;
+ cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL_ALPHA;
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
+ cmb.tmu0_fac = GR_COMBINE_FACTOR_ONE;
+}
+
+static void cc_prim_sub_env_mul__t0_sub_prim_mul_enva_add_t0__add_env ()
+{
+ // (t0-prim)*env_a+t0, (prim-env)*cmb+env
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ USE_T0 ();
+
+ MOD_0 (TMOD_TEX_SUB_COL_MUL_FAC_ADD_TEX);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ MOD_0_FAC (rdp.env_color & 0xFF);
+}
+
+static void cc_prim_sub_env_mul__t1_sub_prim_mul_enva_add_t0__add_env ()
+{
+ //(t1-prim)*env_a+t0, (prim-env)*cmb+env
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ if (cmb.combine_ext)
+ {
+ if (rdp.tiles[rdp.cur_tile].format > 2)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ }
+ else
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_ZERO, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ }
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 3;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = (float)(rdp.env_color&0xFF) / 255.0f;
+ }
+ else
+ {
+ MOD_1 (TMOD_TEX_SUB_COL_MUL_FAC);
+ MOD_1_COL (rdp.prim_color & 0xFFFFFF00);
+ MOD_1_FAC (rdp.env_color & 0xFF);
+ T0_ADD_T1 ();
+ }
+}
+
+static void cc_prim_sub_env_mul__t1_sub_prim_mul_prima_add_t0__add_env ()
+{
+ // (t1-prim)*prim_a+t0, (prim-env)*cmb+env
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 3;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = (float)(rdp.prim_color&0xFF) / 255.0f;
+ }
+ else
+ {
+ MOD_1 (TMOD_TEX_SUB_COL_MUL_FAC);
+ MOD_1_COL (rdp.prim_color & 0xFFFFFF00);
+ MOD_1_FAC (rdp.prim_color & 0xFF);
+ T0_ADD_T1 ();
+ }
+}
+
+static void cc__prim_sub_env_mul_t0_add_env__mul_primlod ()
+{
+ CCMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ float factor = (float)rdp.prim_lodfrac / 255.0f;
+ wxUint8 r = (wxUint8)((rdp.prim_color >> 24) & 0xFF);
+ r = (wxUint8)((float)r * factor);
+ wxUint8 g = (wxUint8)((rdp.prim_color >> 16) & 0xFF);
+ g = (wxUint8)((float)g * factor);
+ wxUint8 b = (wxUint8)((rdp.prim_color >> 8) & 0xFF);
+ b = (wxUint8)((float)b * factor);
+ CC ((r<<24) | (g<<16) | (b<<8));
+ SETSHADE_ENV ();
+ MULSHADE_PRIMLOD ();
+ USE_T0 ();
+}
+
+static void cc__prim_sub_env_mul_t0_add_env__mul_k5 ()
+{
+ CCMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ float factor = (float)rdp.K5 / 255.0f;
+ wxUint8 r = (wxUint8)((rdp.prim_color >> 24) & 0xFF);
+ r = (wxUint8)((float)r * factor);
+ wxUint8 g = (wxUint8)((rdp.prim_color >> 16) & 0xFF);
+ g = (wxUint8)((float)g * factor);
+ wxUint8 b = (wxUint8)((rdp.prim_color >> 8) & 0xFF);
+ b = (wxUint8)((float)b * factor);
+ CC ((r<<24) | (g<<16) | (b<<8));
+ SETSHADE_ENV ();
+ MULSHADE_K5 ();
+ USE_T0 ();
+}
+
+static void cc_prim_sub_env_mul_t1_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ SETSHADE_ENV ();
+ if (rdp.cycle_mode == 0 || ((settings.hacks&hack_KI) && (rdp.cycle2 & 0x0FFFFFFF) == 0x01FF1FFF))
+ {
+ USE_T0 ();
+ }
+ else
+ {
+ USE_T1 ();
+ }
+}
+
+static void cc_prim_sub_env_mul_t1_add_env_mul_t0 ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ MOD_1 (TMOD_COL_INTER_COL1_USING_TEX);
+ MOD_1_COL (rdp.env_color & 0xFFFFFF00);
+ MOD_1_COL1 (rdp.prim_color & 0xFFFFFF00);
+ T0_MUL_T1 ();
+}
+
+static void cc_prim_sub_env_mul_t0a_add_t0 ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIMSUBENV ();
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = cmb.ccolor;
+ cmb.tex |= 1;
+ }
+ else
+ {
+ MOD_0 (TMOD_COL_MUL_TEXA_ADD_TEX);
+ MOD_0_COL (cmb.ccolor & 0xFFFFFF00);
+ USE_T0 ();
+ }
+}
+
+//Added by Gonetz
+static void cc_prim_sub_env_mul_t0a_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc_prim_sub_env_mul_t1a_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ USE_T1 ();
+}
+
+//Added by Gonetz
+static void cc_prim_sub_env_mul__t0_mul_t1__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ SETSHADE_ENV ();
+ T0_MUL_T1 ();
+}
+
+//Added by Gonetz
+static void cc_prim_sub_env_mul__t0_add_t1__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ SETSHADE_ENV ();
+ T0_ADD_T1 ();
+}
+
+//Added by Gonetz
+static void cc_prim_sub_env_mul__t0_mul_enva__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SETSHADE_PRIMSUBENV ();
+ SETSHADE_ENVA ();
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc_prim_sub_env_mul__t0_mul_shade__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ MULSHADE_PRIMSUBENV ();
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc_prim_sub_env_mul__prim_inter_t0_using_shadea__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ if (cmb.combine_ext)
+ {
+ SETSHADE_PRIM ();
+ PRIM_INTER_T0_USING_SHADEA ();
+ }
+ else
+ {
+ SETSHADE_PRIMSUBENV ();
+ MULSHADE_SHADEA ();
+ USE_T0 ();
+ }
+}
+
+//Added by Gonetz
+static void cc_prim_sub_env_mul__t0_sub_prim_mul_primlod_add_t0__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ SETSHADE_ENV ();
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 1;
+ percent = (float)(lod_frac) / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ }
+ else
+ {
+ USE_T0 ();
+ MOD_0 (TMOD_TEX_SUB_COL_MUL_FAC_ADD_TEX);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ MOD_0_FAC (lod_frac & 0xFF);
+ }
+}
+
+static void cc_prim_sub_env_mul__t0_sub_prim_mul_primlod_add_shade__add_env ()
+{
+ if (!cmb.combine_ext)
+ {
+ cc_prim_sub_env_mul_t0_add_env ();
+ return;
+ }
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_ITRGB, 0);
+ CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ CC_PRIM ();
+ SETSHADE_ENV ();
+ cmb.tex |= 1;
+ percent = (float)(lod_frac) / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+}
+
+static void cc_prim_sub_env_mul__t0_sub_shade_mul_primlod_add_shade__add_env ()
+{
+ if (!cmb.combine_ext)
+ {
+ cc_prim_sub_env_mul_t0_add_env ();
+ return;
+ }
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_B, 0);
+ CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ CC_PRIM ();
+ SETSHADE_ENV ();
+ cmb.tex |= 1;
+ percent = (float)(lod_frac) / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+}
+
+//Added by Gonetz
+static void cc_lavatex_sub_prim_mul_shade_add_lavatex ()
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ CC_PRIM ();
+ T0_SUB_PRIM_MUL_PRIMLOD_ADD_T1 ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_ADD_T1 ();
+ }
+}
+
+//Added by Gonetz
+static void cc_prim_sub_env_mul__t0_sub_prim_mul_primlod_add_t1__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ SETSHADE_ENV ();
+ T0_SUB_PRIM_MUL_PRIMLOD_ADD_T1 ();
+}
+
+//Added by Gonetz
+static void cc_prim_sub_env_mul__t1_sub_prim_mul_primlod_add_t0__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ SETSHADE_ENV ();
+ T1_SUB_PRIM_MUL_PRIMLOD_ADD_T0 ();
+}
+
+//Added by Gonetz
+static void cc_prim_sub_env_mul__t0_inter_t1_using_t1__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ SETSHADE_ENV ();
+ T0_INTER_T1_USING_T1 ();
+}
+
+//Added by Gonetz
+static void cc_prim_sub_env_mul__t0_inter_t1_using_enva_alpha__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ SETSHADE_ENV ();
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ T0_INTER_T1_USING_FACTOR (factor);
+ A_T0_INTER_T1_USING_FACTOR (factor);
+}
+
+//Added by Gonetz
+static void cc__env_inter_prim_using_t0__sub_shade_mul_t0a_add_shade ()
+{
+ if (!cmb.combine_ext)
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MOD_0 (TMOD_COL_INTER_COL1_USING_TEX);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ MOD_0_COL1 (rdp.prim_color & 0xFFFFFF00);
+ USE_T0 ();
+ A_USE_T0 ();
+ }
+ else
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_B, 0);
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TEXTURE_ALPHA, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.env_color;
+ cmb.tex |= 1;
+ wxUint32 pse = (rdp.prim_color>>24) - (rdp.env_color>>24);
+ percent = (float)(pse) / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ }
+}
+
+//Added by Gonetz
+static void cc_prim_sub_env_mul_shade_add_t0 ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_PRIMSUBENV ();
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc_prim_sub_env_mul_prima_add_t0 ()
+{
+ if (rdp.prim_color != 0x000000ff)
+ {
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_CONSTANT_ALPHA, 0,
+ GR_CMBX_TEXTURE_RGB, 0);
+ CC_PRIM ();
+ SETSHADE_ENV ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SETSHADE_PRIMSUBENV ();
+ SETSHADE_PRIMA ();
+ }
+ }
+ else if ((rdp.prim_color&0xFFFFFF00) - (rdp.env_color&0xFFFFFF00) == 0)
+ {
+ cc_t0 ();
+ return;
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENV ();
+ }
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc_prim_sub_env_mul_shade_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ MULSHADE_PRIMSUBENV ();
+}
+
+static void cc_prim_sub_env_mul_shadea_add_env ()
+{
+ // * not guaranteed to work if another iterated alpha is set
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_OTHER_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+}
+
+//Added by Gonetz
+static void cc_prim_sub_env_mul__t0_inter_t1_using_prima__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
+ T0_INTER_T1_USING_FACTOR (factor);
+}
+
+//Added by Gonetz
+static void cc_prim_sub_env_mul__t1_inter_t0_using_prima__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
+ T1_INTER_T0_USING_FACTOR (factor);
+}
+
+static void cc_prim_sub_env_mul__t0_inter_t1_using_enva__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ T0_INTER_T1_USING_FACTOR (factor);
+}
+
+static void cc_prim_sub_center_mul__t0_inter_t1_using_enva__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_C1SUBC2 (rdp.prim_color, rdp.CENTER);
+ SETSHADE_ENV ();
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ T0_INTER_T1_USING_FACTOR (factor);
+}
+
+static void cc_prim_sub_env_mul__t1_inter_t0_using_enva__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ T1_INTER_T0_USING_FACTOR (factor);
+}
+
+static void cc_prim_sub_env_mul__t0_mul_enva_add_t1__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 3;
+ percent = (float)(rdp.env_color&0xFF) / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ }
+ else
+ {
+ T0_ADD_T1 ();
+ }
+}
+
+static void cc_prim_sub_env_mul__t1_mul_enva_add_t0__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ T1_MUL_ENVA_ADD_T0 ();
+}
+
+//Added by Gonetz
+static void cc_prim_sub_env_mul_primlod_add__t0_inter_t1_using_primlod ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIMSUBENV();
+ CC_COLMULBYTE(cmb.ccolor, rdp.prim_lodfrac);
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+static void cc_prim_sub_env_mul__t0_inter_t1_using_primlod__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+static void cc_prim_sub_env_mul__t1_inter_t0_using_primlod__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ T1_INTER_T0_USING_FACTOR (lod_frac);
+}
+
+static void cc_prim_sub_env_mul__t1_mul_primlod_add_t0__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ T1_MUL_PRIMLOD_ADD_T0 ();
+}
+
+static void cc_prim_sub_env_mul__t1_sub_prim_mul_t0_add_t0__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 3;
+ }
+ else
+ {
+ MOD_1 (TMOD_TEX_SUB_COL);
+ MOD_1_COL (rdp.prim_color & 0xFFFFFF00);
+ T0_MUL_T1_ADD_T0 ();
+ }
+}
+
+//Added by Gonetz
+static void cc__prim_sub_env_mul_prim_add_t0__mul_prim ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 1;
+ SETSHADE_PRIMSUBENV ();
+ SETSHADE_PRIM ();
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_ZERO, 0);
+ CC_PRIM() ;
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SETSHADE_PRIMSUBENV ();
+ SETSHADE_PRIM ();
+ USE_T0 ();
+ }
+}
+
+//Added by Gonetz
+static void cc_prim_sub_env_mul_prim_add_env ()
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_B, 0);
+ SETSHADE_ENV();
+ CC_PRIM ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_PRIMSUBENV ();
+ SETSHADE_PRIM ();
+ CC_ENV ();
+ }
+}
+
+static void cc_prim_sub_env_mul_primlod_add_env ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 1;
+ CC_PRIMLOD ();
+ cmb.tex_ccolor = cmb.ccolor;
+ CCMBEXT(GR_CMBX_ITRGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ SETSHADE_PRIM();
+ CC_ENV ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_PRIMSUBENV ();
+ SETSHADE_PRIMLOD ();
+ CC_ENV ();
+ }
+}
+
+//Added by Gonetz
+static void cc_prim_sub_env_mul_enva_add_t0 ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SETSHADE_PRIMSUBENV ();
+ SETSHADE_ENVA ();
+ USE_T0 ();
+}
+
+static void cc_prim_sub_env_mul_enva_add_env ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 1;
+ CC_ENVA ();
+ cmb.tex_ccolor = cmb.ccolor;
+ CCMBEXT(GR_CMBX_ITRGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ SETSHADE_PRIM();
+ CC_ENV ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_PRIMSUBENV ();
+ SETSHADE_ENVA ();
+ CC_ENV ();
+ }
+}
+
+//Added by Gonetz
+static void cc_prim_sub_shade_mul_t0_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ COLSUBSHADE_PRIM ();
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc_prim_sub_shade_mul__t1_sub_prim_mul_primlod_add_t0__add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ T1_SUB_PRIM_MUL_PRIMLOD_ADD_T0 ();
+}
+
+static void cc_prim_sub_shade_mul_t1a_add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ USE_T1 ();
+}
+
+//Added by Gonetz
+static void cc_prim_sub_shade_mul_t0_add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc_prim_sub_shade_mul_t1_add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ USE_T1 ();
+}
+
+//Added by Gonetz
+static void cc_prim_sub_shade_mul__t0a_mul_t1__add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ T0A_MUL_T1();
+}
+
+//Added by Gonetz
+static void cc_prim_sub_shade_mul__t0_inter_t1_using_enva__add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ T0_INTER_T1_USING_FACTOR (factor);
+}
+
+//Added by Gonetz
+static void cc_prim_sub_shade_mul__t0_inter_t1_using_shadea__add_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ }
+ CC_PRIM ();
+ T0_INTER_T1_USING_SHADEA ();
+}
+
+//Added by Gonetz
+static void cc_prim_sub_shade_mul_prima_add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_OTHER_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ CA_PRIM ();
+}
+
+//Added by Gonetz
+static void cc_prim_sub_shade_mul_env_add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIMMULENV ();
+ MULSHADE_1MENV ();
+}
+
+//Added by Gonetz
+static void cc_prim_sub_shade_mul_shadea_add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+}
+
+static void cc_env_sub_prim_mul_t0_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ USE_T0 ();
+}
+
+static void cc_env_sub_prim_mul_t1_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ USE_T1 ();
+}
+
+static void cc_env_sub_prim_mul_t0a_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ A_USE_T0 ();
+}
+
+static void cc_env_sub_prim_mul_t1a_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ A_USE_T1 ();
+}
+
+static void cc_env_sub_prim_mul__t0_add_t1__add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ T0_ADD_T1 ();
+}
+
+static void cc_env_sub_prim_mul__t0_mul_t1__add_prim () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ T0_MUL_T1 ();
+}
+
+static void cc_env_sub_prim_mul__t0t1a__add_prim () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ A_T0_MUL_T1 ();
+}
+
+static void cc_env_sub_prim_mul__t0_inter_t1_using_t1__add_prim () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ T0_INTER_T1_USING_T1 ();
+}
+
+static void cc_env_sub_prim_mul__t0_inter_t1_using_half__add_prim () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ T0_INTER_T1_USING_FACTOR (0x7F);
+}
+
+static void cc_env_sub_prim_mul__t1_inter_t0_using_t0__add_prim () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ T1_INTER_T0_USING_T0 ();
+}
+
+static void cc_env_sub_shade_mul__t0_mul_t1__add_shade () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ T0_MUL_T1 ();
+}
+
+static void cc_env_sub_prim_mul__t0a_mul_t1a__add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ SETSHADE_ENV ();
+ A_T0_MUL_T1 ();
+}
+
+
+static void cc_env_sub_prim_mul_prima_add_prim () //Aded by Gonetz
+{
+ // * not guaranteed to work if another iterated alpha is set
+ CCMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ CA_PRIM ();
+ SETSHADE_ENV ();
+}
+
+static void cc_env_sub_prim_mul_enva_add_prim () //Aded by Gonetz
+{
+ // * not guaranteed to work if another iterated alpha is set
+ CCMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_OTHER_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ CA_ENV ();
+ SETSHADE_PRIM ();
+}
+
+static void cc__t0_sub_env_mul_shade__sub_prim_mul_shade_add_prim ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex_ccolor = rdp.env_color;
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ CC_PRIM ();
+ }
+ else
+ {
+ cc_t0_mul_shade ();
+ }
+}
+
+static void cc_env_sub_prim_mul_shade_add_prim () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ MULSHADE_ENVSUBPRIM ();
+}
+
+static void cc_env_sub_prim_mul_shadea_add_prim () //Added by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ SETSHADE_ENVSUBPRIM ();
+ MULSHADE_SHADEA ();
+}
+
+static void cc_env_sub_prim_mul__t0_inter_t1_using_prima__add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
+ T0_INTER_T1_USING_FACTOR (factor);
+}
+
+static void cc_env_sub_prim_mul__t0_inter_t1_using_primlod__add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ SETSHADE_PRIM ();
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+static void cc_env_sub_primshade_mul_t0_add_primshade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ MULSHADE_PRIM ();
+ USE_T0 ();
+}
+
+static void cc_env_sub_primshade_mul_t1_add_primshade ()
+{
+ // cc_prim_mul_shade();
+ // return;
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ MULSHADE_PRIM ();
+ USE_T0 ();
+}
+
+static void cc_env_sub_shade_mul_t0_add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ USE_T0 ();
+}
+
+static void cc__env_sub_shade_mul_t0_add_shade__mul_prim ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 1;
+ cmb.tex_ccolor = rdp.prim_color;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_ZERO, 0);
+ CC_PRIM() ;
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ MULSHADE_PRIM ();
+ USE_T0 ();
+ }
+}
+
+static void cc_env_sub_shade_mul_t1_add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ USE_T1 ();
+}
+
+//Added by Gonetz
+static void cc_env_sub_shade_mul__t0_inter_t1_using_shadea__add_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ }
+ CC_ENV ();
+ T0_INTER_T1_USING_SHADEA ();
+}
+
+//Added by Gonetz
+static void cc_env_sub_shade_mul_enva_add_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_OTHER_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ cmb.ccolor = rdp.env_color;
+}
+
+//Added by Gonetz
+static void cc_shade_sub_t0_mul_shadea_add_t0 ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_SHADEA ();
+ USE_T0 ();
+}
+
+
+static void cc__t0_mul_shade_mul_shadea__add__t1_mul_one_sub_shadea ()
+{
+ // (t0-0)*shade+0, (cmb-t0)*shadea+t0
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITALPHA, 1,
+ GR_CMBX_ZERO, 0);
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ MULSHADE_SHADEA ();
+ cmb.tex |= 3;
+ CCMBEXT(GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_TEXTURE_RGB, 0);
+ }
+ else
+ {
+ cc_t0_mul_shade ();
+ }
+}
+
+static void cc_shade_sub_prim_mul__t0_inter_t1_using_primlod__add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+static void cc_shade_sub_prim_mul_t0_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc_shade_sub_prim_mul_t1_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ USE_T1 ();
+}
+
+//Added by Gonetz
+static void cc_shade_sub_env_mul__t0_mul_t1__add__t0_mul_t1 ()
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_ITRGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TEXTURE_RGB, 0,
+ GR_CMBX_TEXTURE_RGB, 0);
+ CC_ENV ();
+ T0_MUL_T1 ();
+ }
+ else
+ {
+ cc_t0_mul_t1 ();
+ }
+}
+
+//Added by Gonetz
+static void cc_shade_sub_env_mul_t0_add_prim ()
+{
+ if (rdp.cur_image && (rdp.cur_image->format != 0))
+ {
+ cc_prim ();
+ return;
+ }
+
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ SUBSHADE_ENV ();
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc_shade_sub_env_mul__t0_inter_t1_using_primlod__add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIM ();
+ SUBSHADE_ENV ();
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+//Added by Gonetz
+static void cc_shade_sub_env_mul__t0_inter_t1_using_primlod__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+//Added by Gonetz
+static void cc_shade_sub_env_mul__t0_mul_t1__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ T0_MUL_T1 ();
+}
+
+//Added by Gonetz
+static void cc_shade_sub_env_mul__t1_sub_prim_mul_primlod_add_t0__add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ SETSHADE_ENV ();
+ T1_SUB_PRIM_MUL_PRIMLOD_ADD_T0 ();
+}
+
+//Added by Gonetz
+static void cc_shade_sub_env_mul_t0_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc_shade_sub_env_mul_t0_mul_prim_add_prim_mul_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_PRIMMULENV ();
+ SUBSHADE_ENV ();
+ MULSHADE_PRIM()
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc_shade_sub_env_mul_t1_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENV ();
+ USE_T1 ();
+}
+
+//Added by Gonetz
+static void cc_shade_sub_env_mul_prim_add_t0 ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SUBSHADE_ENV ();
+ MULSHADE_PRIM ();
+ USE_T0 ();
+}
+
+static void cc__t0_add_prim_mul_shade__mul_shade_add_env ()
+{
+ if (!cmb.combine_ext)
+ {
+ cc_shade_sub_env_mul_prim_add_t0 ();
+ return;
+ }
+ T1CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ CC_ENV ();
+ cmb.tex |= 1;
+}
+
+static void cc__t0_add_prim_mul_shade__mul_shade ()
+{
+ if (!cmb.combine_ext)
+ {
+ cc_shade_sub_env_mul_prim_add_t0 ();
+ return;
+ }
+ T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 1;
+}
+
+//Added by Gonetz
+static void cc_shade_sub_env_mul_prim_add_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SUBSHADE_ENV ();
+ MULSHADE_PRIM ();
+ CC_ENV ();
+}
+
+//Added by Gonetz
+static void cc_shade_sub_env_mul_prima_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SUBSHADE_ENV ();
+ MULSHADE_PRIMA ();
+ CC_PRIM ();
+}
+
+static void cc_shade_sub_env_mul_k5_add_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SUBSHADE_ENV ();
+ wxUint32 temp = rdp.prim_color;
+ rdp.prim_color = rdp.K5;
+ MULSHADE_PRIMA ();
+ rdp.prim_color = temp;
+ CC_PRIM ();
+}
+
+// ** A inter B using C **
+static void cc_t0_inter_t1_using_t1a ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_INTER_T1_USING_T1A ();
+}
+
+static void cc_t0_inter_t1_using_prima ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
+ T0_INTER_T1_USING_FACTOR (factor);
+}
+
+static void cc_t1_inter_t0_using_prima ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
+ T1_INTER_T0_USING_FACTOR (factor);
+}
+
+static void cc_t1_inter_t0_using_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ T1_INTER_T0_USING_PRIM ();
+}
+
+static void cc_t0_inter_t1_using_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_INTER_T1_USING_ENV ();
+}
+
+static void cc_t0_inter_t1_using_enva ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ T0_INTER_T1_USING_FACTOR (factor);
+}
+
+static void cc__t0_inter_t1_using_prim__inter_env_using_enva ()
+{
+ // (t1-t0)*prim+t0, (env-cmb)*env_a+cmb
+ if (!cmb.combine_ext)
+ {
+ cc_t0_inter_t1_using_prima ();
+ return;
+ }
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TMU_CCOLOR, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 3;
+ CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_CONSTANT_ALPHA, 0,
+ GR_CMBX_B, 0);
+ cmb.ccolor = rdp.env_color;
+}
+
+static void cc__t0_inter_t1_using_shade__inter_env_using_enva ()
+{
+ // (t1-t0)*shade+t0, (env-cmb)*env_a+cmb
+ if (!cmb.combine_ext)
+ {
+ cc_t0_inter_t1_using_enva ();
+ return;
+ }
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 3;
+ CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_CONSTANT_ALPHA, 0,
+ GR_CMBX_B, 0);
+ cmb.ccolor = rdp.env_color;
+}
+
+//Added by Gonetz
+static void cc_t0_inter_t1_using_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 3;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_INTER_T1_USING_FACTOR (0x7F);
+ }
+}
+
+//Added by Gonetz
+static void cc_t1_inter_t0_using_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 3;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_INTER_T1_USING_FACTOR (0x7F);
+ }
+}
+
+//Added by Gonetz
+static void cc_t1_inter_t0_using_shadea ()
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ }
+ T1_INTER_T0_USING_SHADEA ();
+}
+
+//Added by Gonetz
+static void cc_t0_inter_t1_using_primlod ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+//Added by Gonetz
+static void cc_t1_inter_t0_using_primlod ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ T1_INTER_T0_USING_FACTOR (lod_frac);
+}
+
+//Added by Gonetz
+static void cc_t1_inter_t0_using_t0 ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ T1_INTER_T0_USING_T0 ();
+}
+
+//Added by Gonetz
+static void cc_t0_inter_t1_using_k5 ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_INTER_T1_USING_FACTOR (rdp.K5);
+}
+
+static void cc_t0_inter_env_using_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ USE_T0 ();
+
+ MOD_0 (TMOD_TEX_INTER_COL_USING_COL1);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ MOD_0_COL1 (rdp.prim_color & 0xFFFFFF00);
+}
+
+//Added by Gonetz
+static void cc_t0_inter_prim_using_primlod ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ USE_T0 ();
+
+ MOD_0 (TMOD_TEX_INTER_COLOR_USING_FACTOR);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ MOD_0_FAC (lod_frac & 0xFF);
+}
+
+static void cc_t0_inter_shade_using_t0a ()
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_ITRGB, GR_FUNC_MODE_X,
+ GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TEXTURE_ALPHA, 0,
+ GR_CMBX_B, 0);
+ USE_T0();
+ A_USE_T0();
+ }
+ else
+ {
+ //(shade-t0)*t0a+t0 = t0*(1-t0a)+shade*t0a
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ rdp.best_tex = 1;
+ cmb.tex = 1;
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_BLEND_LOCAL;
+ cmb.tmu0_fac = GR_COMBINE_FACTOR_LOCAL_ALPHA;
+ }
+}
+
+static void cc_t0_inter_shade_using_primlod ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIMLOD();
+ cmb.ccolor=(~cmb.ccolor)&0xFFFFFF00;
+ MULSHADE_PRIMLOD ();
+ USE_T0 ();
+ //(shade-t0)*primlod+t0 = t0*(1-primlod)+shade*primlod
+}
+
+//Added by Gonetz
+static void cc__env_inter_t0_using_primlod__mul_prim ()
+{
+ //((t0-env)*primlod+env)*prim = t0*prim*primlod+env*prim*(1-primlod);
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ cmb.ccolor = ((((cmb.ccolor & 0xFF000000) >> 24) * (lod_frac & 0xFF))<<24) | ((((cmb.ccolor & 0x00FF0000) >> 16) * (lod_frac & 0xFF))<<16) | ((((cmb.ccolor & 0x0000FF00) >> 8) * (lod_frac & 0xFF))<<8);
+ SETSHADE_PRIM ();
+ SETSHADE_ENV ();
+ SETSHADE_1MPRIMLOD ();
+ USE_T0 ();
+}
+
+//Added by Gonetz
+static void cc__env_inter_t0_using_shadea__mul_shade ()
+{
+ //((t0-env)*shadea+env)*shade
+ if (!cmb.combine_ext)
+ {
+ cc_t0_mul_shade ();
+ return;
+ }
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.env_color;
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+}
+
+//Added by Gonetz
+static void cc_env_inter_prim_using_primlod ()
+{
+ if (rdp.prim_color&0xFFFFFF00)
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_PRIMSUBENV ();
+ SETSHADE_PRIMLOD ();
+ CC_ENV ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ SETSHADE_ENV ();
+ SETSHADE_PRIMLOD ();
+ CC_ENV ();
+ }
+}
+
+static void cc_prim_inter__t0_mul_t1_add_env__using_shadea ()
+{
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.env_color;
+ cmb.tex |= 3;
+ }
+ else
+ {
+ T0_MUL_T1 ();
+ }
+ // * not guaranteed to work if another iterated alpha is set
+ CCMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SETSHADE_PRIM ();
+}
+
+static void cc_env_inter__prim_inter_shade_using_t0__using_shadea ()
+{
+ if (!cmb.combine_ext)
+ {
+ cc_shade_sub_prim_mul_t0_add_prim ();
+ return;
+ }
+ T0CCMBEXT(GR_CMBX_ITRGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_B, 0);
+ CC_ENV ();
+}
+
+static void cc_shade_inter__prim_inter_shade_using_t0__using_shadea ()
+{
+ if (!cmb.combine_ext)
+ {
+ cc_shade_sub_prim_mul_t0_add_prim ();
+ return;
+ }
+ T0CCMBEXT(GR_CMBX_ITRGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_B, 0);
+}
+
+// ** (A-B)*C+D*E **
+static void cc_one_sub_env_mul_prim_add__t0_mul_env () //Aded by Gonetz
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ SETSHADE_1MENV ();
+ SETSHADE_PRIM ();
+ USE_T0 ();
+}
+
+// ** ((A-B)*C+D)*E **
+static void cc_t0_sub_env_mul_prim_mul_shade_add_prim_mul_shade () //Aded by Gonetz
+{
+ //(t0-env)*shade+shade, (cmb-0)*prim+0
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex_ccolor = rdp.env_color;
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_ZERO, 0);
+ CC_PRIM ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (rdp.env_color & 0xFFFFFF00)
+ {
+ MOD_0 (TMOD_TEX_SUB_COL);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ }
+ MULSHADE_PRIM ();
+ USE_T0 ();
+ }
+}
+
+static void cc__t1_sub_prim_mul_t0_add_env__mul_shade () //Aded by Gonetz
+{
+ // (t1-prim)*t0+env, (cmb-0)*shade+0
+ if (cmb.combine_ext)
+ {
+ T1CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 3;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ CC_ENV ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (rdp.prim_color & 0xFFFFFF00)
+ {
+ MOD_1 (TMOD_TEX_SUB_COL);
+ MOD_1_COL (rdp.prim_color & 0xFFFFFF00);
+ }
+ T0_MUL_T1 ();
+ }
+}
+
+// ** (A inter B using C) * D **
+//Added by Gonetz
+static void cc__t0_inter_t1_using_prima__mul_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
+ T0_INTER_T1_USING_FACTOR (factor);
+ CC_PRIM ();
+}
+
+//Added by Gonetz
+static void cc__t1_inter_t0_using_prima__mul_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
+ T1_INTER_T0_USING_FACTOR (factor);
+ CC_PRIM ();
+}
+
+//Added by Gonetz
+static void cc__t0_inter_t1_using_prim__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_INTER_T1_USING_PRIM ();
+}
+
+//Added by Gonetz
+static void cc__t0_inter_t1_using_prima__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
+ T0_INTER_T1_USING_FACTOR (factor);
+}
+
+//Added by Gonetz
+static void cc__t1_inter_t0_using_prima__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
+ T1_INTER_T0_USING_FACTOR (factor);
+}
+
+static void cc__t0_inter_t1_using_env__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_INTER_T1_USING_ENV ();
+}
+
+static void cc__t0_inter_t1_using_enva__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ T0_INTER_T1_USING_FACTOR (factor);
+}
+
+static void cc__t0_inter_t1_using_enva__mul_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ T0_INTER_T1_USING_FACTOR (factor);
+}
+
+//Added by Gonetz
+static void cc__t0_inter_t1_using_enva__mul_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENV ();
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ T0_INTER_T1_USING_FACTOR (factor);
+}
+
+//Added by Gonetz
+static void cc__t0_inter_t1_using_primlod__mul_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+//Added by Gonetz
+static void cc__t0_inter_t1_using_primlod__mul_prima ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIMA ();
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+//Added by Gonetz
+static void cc__t1_mul_primlod_add_t0__mul_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ T1_MUL_PRIMLOD_ADD_T0 ();
+}
+
+//Added by Gonetz
+static void cc__t0_inter_t1_using_primlod__mul_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENV ();
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+//Added by Gonetz
+static void cc__t1_mul_primlod_add_t0__mul_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENV ();
+ T1_MUL_PRIMLOD_ADD_T0 ();
+}
+
+//Added by Gonetz
+static void cc__t1_inter_t0_using_prim__mul_env ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENV ();
+ T1_INTER_T0_USING_PRIM ();
+}
+
+static void cc__one_sub_shade_mul_t0_add_shade__mul_prim ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ONE_MINUS_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_ZERO, 0);
+ CC_PRIM ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ USE_T0 ();
+ }
+}
+
+static void cc__one_sub_shade_mul_t0_add_shade__mul_env ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ONE_MINUS_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
+ GR_CMBX_CONSTANT_COLOR, 0,
+ GR_CMBX_ZERO, 0);
+ CC_ENV ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ USE_T0 ();
+ }
+}
+
+static void cc__t1_inter_t0_using_prim__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ T1_INTER_T0_USING_PRIM ();
+}
+
+static void cc__t0_inter_t1_using_primlod__mul_shade ()
+{
+ //*
+ if (rdp.LOD_en && (rdp.mipmap_level == 0) && !(settings.hacks&hack_Fifa98))
+ {
+ cc_t0_mul_shade ();
+ return;
+ }
+ //*/
+ if (settings.ucode == 7)
+ lod_frac = rdp.prim_lodfrac;
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+static void cc__t1_inter_t0_using_primlod__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ T1_INTER_T0_USING_FACTOR (lod_frac);
+}
+
+static void cc__t0_inter_t1_using_half__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_INTER_T1_USING_FACTOR (0x7F);
+}
+
+static void cc__t0_inter_t1_using_t0__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_INTER_T1_USING_T0();
+}
+
+static void cc__t0_inter_t1_using_t1a__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_INTER_T1_USING_T1A();
+}
+
+static void cc__t0_inter_t1_using_shadea__mul_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ }
+ T0_INTER_T1_USING_SHADEA ();
+}
+
+static void cc__t0_inter_t1_using_k5__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ T0_INTER_T1_USING_FACTOR (rdp.K5);
+}
+
+static void cc__t1_inter_t0_using_k5__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ T1_INTER_T0_USING_FACTOR (rdp.K5);
+}
+
+static void cc_t0_inter_prim_using_prima ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TMU_CALPHA, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 1;
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_1SUBPRIMA ();
+ SETSHADE_PRIM ();
+ SETSHADE_PRIMA ();
+ USE_T0 ();
+ }
+}
+
+static void cc__t0_inter_prim_using_t0a__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MOD_0 (TMOD_TEX_INTER_COL_USING_TEXA);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ USE_T0 ();
+}
+
+static void cc__env_inter_prim_using_t0__mul_prim ()
+{
+ // (prim-env)*t0+env, (cmb-0)*prim+0
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ MOD_0 (TMOD_COL_INTER_COL1_USING_TEX);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ MOD_0_COL1 (rdp.prim_color & 0xFFFFFF00);
+ USE_T0 ();
+}
+
+static void cc__env_inter_prim_using_t0__mul_shade ()
+{
+ // amazing... mace actually uses the blender as part of the combine
+ if ((rdp.othermode_l & 0xFFFF0000) == 0x03820000 ||
+ (rdp.othermode_l & 0xFFFF0000) == 0x00910000)
+ {
+ // blender:
+ // 1ST = CLR_IN * A_IN + CLR_BL * 1MA
+ // OUT = 1ST * 0 + 1ST * 1
+
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MOD_0 (TMOD_COL2_INTER__COL_INTER_COL1_USING_TEX__USING_TEXA);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ MOD_0_COL1 (rdp.prim_color & 0xFFFFFF00);
+ MOD_0_COL2 (rdp.blend_color & 0xFFFFFF00);
+ USE_T0 ();
+ return;
+ }
+ //(prim-env)*t0+env, (shade-0)*cmb+0
+ MOD_0 (TMOD_COL_INTER_COL1_USING_TEX);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ MOD_0_COL1 (rdp.prim_color & 0xFFFFFF00);
+ USE_T0 ();
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+}
+
+static void cc__env_inter_one_using_t0__mul_shade ()
+{
+ //(one-env)*t0+env, (cmb-0)*shade+0
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ONE_MINUS_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.env_color&0xFFFFFF00;
+ cmb.tex |= 1;
+ }
+ else
+ {
+ MOD_0 (TMOD_COL_INTER_COL1_USING_TEX);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ MOD_0_COL1 (0xFFFFFF00);
+ USE_T0 ();
+ }
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+}
+
+static void cc_env_inter_one_using__one_sub_t0_mul_primlod ()
+{
+ if (cmb.combine_ext)
+ {
+ // (noise-t0)*primlod+0, (1-env)*cmb+env
+ T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex_ccolor = rand()&0xFFFFFF00;
+ cmb.tex |= 1;
+ percent = (float)(lod_frac) / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ cmb.tex |= 1;
+ }
+ else
+ {
+ USE_T0 ();
+ }
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_ENV ();
+}
+
+static void cc__env_inter_prim_using_prima__mul_shade ()
+{
+ int primr = (rdp.prim_color>>24)&0xFF;
+ int primg = (rdp.prim_color>>16)&0xFF;
+ int primb = (rdp.prim_color>>8)&0xFF;
+ int prima = rdp.prim_color&0xFF;
+ int envr = (rdp.env_color>>24)&0xFF;
+ int envg = (rdp.env_color>>16)&0xFF;
+ int envb = (rdp.env_color>>8)&0xFF;
+ int r = (((primr-envr)*prima)/256)+envr;
+ int g = (((primg-envg)*prima)/256)+envg;
+ int b = (((primb-envb)*prima)/256)+envb;
+ cmb.ccolor = (r<<24) | (g<<16) | (b<<8);
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+}
+
+static void cc__prim_inter_t0_using_env__mul_shade ()
+{
+ // (t0-prim)*env+prim, (cmb-0)*shade+0
+ if ((rdp.prim_color & 0xFFFFFF00) == 0)
+ {
+ cc_t0_mul_env_mul_shade ();
+ }
+ else if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CCOLOR, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex_ccolor = rdp.env_color & 0xFFFFFF00;
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ wxUint32 onesubenv = ~rdp.env_color;
+ CC_C1MULC2(rdp.prim_color, onesubenv);
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MOD_0 (TMOD_COL_INTER_TEX_USING_COL1);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ MOD_0_COL1 (rdp.env_color & 0xFFFFFF00);
+ USE_T0 ();
+ }
+}
+
+static void cc__one_inter_prim_using_t1__mul_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ if ((settings.hacks&hack_BAR) && rdp.cur_tile == 1)
+ {
+ T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_ZERO, 1);
+ cmb.tex |= 1;
+ }
+ else
+ {
+ T1CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, 0,
+ GR_CMBX_ZERO, 1);
+ T0CCMBEXT(GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_OTHER_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 2;
+ }
+ cmb.tex_ccolor = rdp.prim_color | 0xFF;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ if ((settings.hacks&hack_BAR) && rdp.cur_tile == 1)
+ {
+ MOD_0 (TMOD_COL_INTER_COL1_USING_TEX);
+ MOD_0_COL (0xFFFFFF00);
+ MOD_0_COL1 (rdp.prim_color & 0xFFFFFF00);
+ USE_T0 ();
+ }
+ else
+ {
+ MOD_1 (TMOD_COL_INTER_COL1_USING_TEX);
+ MOD_1_COL (0xFFFFFF00);
+ MOD_1_COL1 (rdp.prim_color & 0xFFFFFF00);
+ USE_T1 ();
+ }
+ }
+}
+
+static void cc_prim_sub__prim_sub_t0_mul_prima__mul_shade ()
+{
+ // (prim-t0)*prim_a+0, (prim-cmb)*shade+0
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TMU_CALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex_ccolor = rdp.prim_color;
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_CONSTANT_COLOR, GR_FUNC_MODE_X,
+ GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ CC_PRIM();
+ }
+ else
+ {
+ if ((rdp.prim_color & 0xFFFFFF00) == 0)
+ {
+ cc_t0_mul_prima_mul_shade ();
+ return;
+ }
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MOD_0 (TMOD_COL_INTER_TEX_USING_COL1);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ wxUint8 prima = (wxUint8)(rdp.prim_color&0xFF);
+ MOD_0_COL1 ((prima<<24)|(prima<<16)|(prima<<8));
+ USE_T0 ();
+ }
+}
+
+static void cc__prim_inter_env_using_t0__mul_shade ()
+{
+ // (env-prim)*t0+prim, (cmb-0)*shade+0
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MOD_0 (TMOD_COL_INTER_COL1_USING_TEX);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ MOD_0_COL1 (rdp.env_color & 0xFFFFFF00);
+ USE_T0 ();
+}
+
+static void cc__prim_inter_one_using_env__mul_shade ()
+{
+ // (one-prim)*env+prim, (cmb-0)*shade+0
+ if ((rdp.prim_color&0xFFFFFF00) == 0)
+ {
+ cc_env_mul_shade ();
+ return;
+ }
+ if ((rdp.env_color&0xFFFFFF00) == 0)
+ {
+ cc_prim_mul_shade ();
+ return;
+ }
+ if ((rdp.prim_color&0xFFFFFF00) == 0xFFFFFF00 || (rdp.env_color&0xFFFFFF00) == 0xFFFFFF00)
+ {
+ cc_shade ();
+ return;
+ }
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_1SUBPRIM ();
+ CC_C1MULC2 (cmb.ccolor, rdp.env_color);
+ cmb.ccolor=(wxUint8)( min(255, (int)((cmb.ccolor & 0xFF000000) >> 24) + (int)((rdp.prim_color & 0xFF000000) >> 24)) ) << 24 |
+ (wxUint8)( min(255, (int)((cmb.ccolor & 0x00FF0000) >> 16) + (int)((rdp.prim_color & 0x00FF0000) >> 16)) ) << 16 |
+ (wxUint8)( min(255, (int)((cmb.ccolor & 0x0000FF00) >> 8) + (int)((rdp.prim_color & 0x0000FF00) >> 8)) ) << 8 ;
+}
+
+static void cc__env_inter_prim_using_t0a__mul_t0 ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ MOD_0 (TMOD_COL_INTER_COL1_USING_TEXA__MUL_TEX);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ MOD_0_COL1 (rdp.prim_color & 0xFFFFFF00);
+ USE_T0 ();
+}
+
+static void cc__env_inter_prim_using_t0a__mul_prim ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CC_PRIM ();
+ MOD_0 (TMOD_COL_INTER_COL1_USING_TEXA);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ MOD_0_COL1 (rdp.prim_color & 0xFFFFFF00);
+ USE_T0 ();
+}
+
+static void cc__env_inter_prim_using__t0_sub_shade_mul_primlod_add_env ()
+{
+ // (t0-shade)*lodf+env, (prim-env)*cmb+env
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = rdp.env_color;
+ percent = (float)lod_frac / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ cmb.tex |= 1;
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_PRIM ();
+ SETSHADE_ENV ();
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_ONE,//TEXTURE_RGB,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);//CONSTANT);
+ MOD_0 (TMOD_COL_INTER_COL1_USING_TEX);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ MOD_0_COL1 (rdp.prim_color & 0xFFFFFF00);
+ USE_T0 ();
+ MULSHADE_PRIMSUBENV ();
+ MULSHADE_PRIMLOD();
+ SUBSHADE_PRIMSUBENV ();
+ }
+}
+
+static void cc__prim_inter_t0_using_t0__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MOD_0 (TMOD_COL_INTER_TEX_USING_TEX);
+ MOD_0_COL (rdp.prim_color & 0xFFFFFF00);
+ USE_T0 ();
+}
+
+static void cc__env_inter_t0_using_t0a__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MOD_0 (TMOD_COL_INTER_TEX_USING_TEXA);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ USE_T0 ();
+}
+
+static void cc__env_inter_t0_using_prima__mul_shade ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MOD_0 (TMOD_COL_INTER_TEX_USING_COL1);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ wxUint32 prima = rdp.prim_color & 0xFF;
+ MOD_0_COL1 ((prima<<24)|(prima|16)|(prima<<8));
+ USE_T0 ();
+}
+
+static void cc_shade_mul_prima ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_ITERATED);
+ MULSHADE_PRIMA ();
+}
+
+static void cc_shade_mul_shadea ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_ITERATED);
+ MULSHADE_SHADEA ();
+}
+
+static void cc__t0_mul_shade__inter_env_using_enva ()
+{
+ // (t0-0)*shade+0, (env-cmb)*env_a+cmb ** INC **
+ wxUint32 enva = rdp.env_color&0xFF;
+ if (enva == 0xFF)
+ cc_env ();
+ else if (enva == 0)
+ cc_t0_mul_shade ();
+ else if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CCOLOR, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ MULSHADE_1MENVA ();
+ CC_COLMULBYTE(rdp.env_color, (rdp.env_color&0xFF));
+ cmb.tex_ccolor = cmb.ccolor;
+ }
+ else
+ {
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ INTERSHADE_2 (rdp.env_color & 0xFFFFFF00, rdp.env_color & 0xFF);
+ USE_T0 ();
+ MOD_0 (TMOD_TEX_INTER_COLOR_USING_FACTOR);
+ MOD_0_COL (rdp.env_color & 0xFFFFFF00);
+ MOD_0_FAC (rdp.env_color & 0xFF);
+ }
+}
+
+static void cc__t0_mul_shade__inter_one_using_enva ()
+{
+ CCMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_RGB,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CC_ENVA ();
+ MULSHADE_1MENVA ();
+ USE_T0 ();
+}
+
+static void cc__t0_mul_shade__inter_one_using_shadea ()
+{
+ if (cmb.combine_ext)
+ {
+ T0CCMBEXT(GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_RGB, GR_FUNC_MODE_X,
+ GR_CMBX_ITRGB, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 1;
+ CCMBEXT(GR_CMBX_ZERO, GR_FUNC_MODE_X,
+ GR_CMBX_TEXTURE_RGB, GR_FUNC_MODE_ONE_MINUS_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_B, 0);
+ }
+ else
+ {
+ cc_t0_mul_shade ();
+ }
+}
+
+static void cc__prim_mul_shade__inter_env_using_enva ()
+{
+ CCMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ MULSHADE_PRIM ();
+ SETSHADE_A_ENV ();
+}
+
+static void cc__prim_mul_shade__inter_env_using__prim_mul_shade_alpha ()
+{
+ CCMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CC_ENV ();
+ MULSHADE_PRIM ();
+ MULSHADE_A_PRIM ();
+}
+
+
+//****************************************************************
+
+static void ac_one ()
+{
+ ACMB (GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_NONE);
+ cmb.ccolor |= 0xFF;
+}
+
+static void ac_t0 ()
+{
+ if ((rdp.othermode_l & 0x4000) && (rdp.cycle_mode < 2))
+ {
+ wxUint32 blend_mode = (rdp.othermode_l >> 16);
+ if (blend_mode == 0x0550)
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA(rdp.fog_color);
+ }
+ else if (blend_mode == 0x55f0) //cmem*afog + cfog*1ma
+ {
+ ACMB (GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_NONE);
+ CA(~rdp.fog_color);
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ }
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ }
+ A_USE_T0 ();
+}
+
+static void ac_zero ()
+{
+ if (cmb.tex > 0)
+ {
+ ac_t0 ();
+ return;
+ }
+ ACMB (GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_NONE);
+ cmb.ccolor &= 0xFFFFFF00;
+}
+
+static void ac_t1 ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ if ((settings.hacks&hack_BAR) && rdp.tiles[rdp.cur_tile].format == 3)
+ A_USE_T0 ();
+ else
+ A_USE_T1 ();
+}
+
+static void ac_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_NONE);
+ CA_PRIM ();
+}
+
+static void ac_primlod ()
+{
+ ACMB (GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_NONE);
+ CA_PRIMLOD ();
+}
+
+static void ac_one_sub_t0 ()
+{
+ ACMB (GR_COMBINE_FUNCTION_BLEND_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_NONE);
+ CA (0xFF);
+ A_USE_T0 ();
+}
+
+static void ac_one_sub_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_NONE);
+ CA_INVPRIM ();
+}
+
+static void ac_env ()
+{
+ ACMB (GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_NONE);
+ CA_ENV ();
+}
+
+static void ac_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_NONE);
+}
+
+// ** A+B **
+static void ac_t0_add_t1 () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_T0_ADD_T1 ();
+}
+
+static void ac__t0_mul_prim__add__t1_mul_primlod () //Aded by Gonetz
+{
+ if (lod_frac == 0)
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ A_USE_T0 ();
+ }
+ else if ((rdp.prim_color&0xFF) == 0)
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIMLOD ();
+ A_USE_T1 ();
+ }
+ else if ((rdp.prim_color&0xFF) == 0xFF)
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_T1_MUL_PRIMLOD_ADD_T0();
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ A_T0_ADD_T1 ();
+ }
+}
+
+static void ac_t0_add_prim () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ A_USE_T0 ();
+}
+
+static void ac_t0_add_env () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_ENV ();
+ A_USE_T0 ();
+}
+
+static void ac_t1_add_env () //Added by Gonetz
+{
+ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+GR_COMBINE_FACTOR_ONE,
+GR_COMBINE_LOCAL_CONSTANT,
+GR_COMBINE_OTHER_TEXTURE);
+CA_ENV ();
+A_USE_T1 ();
+}
+
+static void ac__t0_add_t1__add_prim () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ A_T0_ADD_T1 ();
+}
+
+static void ac_prim_add_shade () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CA_PRIM ();
+}
+
+static void ac_env_add_shade () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CA_ENV ();
+}
+
+// ** A*B **
+static void ac_t0_mul_t0 () //Added by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_USE_T0 ();
+}
+
+static void ac_t0_mul_t1 ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_T0_MUL_T1 ();
+}
+
+static void ac_t0_mul_t1_add_t1 ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 3;
+ }
+ else
+ {
+ A_T0_MUL_T1 ();
+ }
+}
+
+static void ac_t0_mul_t1_add_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ A_T0_MUL_T1 ();
+}
+
+static void ac_t0_mul_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ A_USE_T0 ();
+}
+
+static void ac_t0_mul_prim_mul_primlod ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM_MUL_PRIMLOD ();
+ A_USE_T0 ();
+}
+
+static void ac_t1_mul_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ if (rdp.cycle_mode == 0)
+ A_USE_T0 ();
+ else
+ A_USE_T1 ();
+}
+
+//Added by Gonetz
+static void ac__t1_sub_one_mul_primlod_add_t0__mul_prim ()
+{
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (0xFF) ;
+ percent = (float)lod_frac / 255.0f;
+ }
+ else
+ {
+ cmb.tmu1_a_func = GR_COMBINE_FUNCTION_BLEND_LOCAL;
+ cmb.tmu1_a_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR;
+ percent = (255 - lod_frac) / 255.0f;
+ cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA;
+ cmb.tmu0_a_fac = GR_COMBINE_FACTOR_OTHER_ALPHA;
+ }
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ cmb.tex |= 3;
+}
+
+static void ac__t0_sub_t1_mul_enva_add_t0__mul_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CALPHA, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.env_color&0xFF) ;
+ cmb.tex |= 3;
+ }
+ else
+ {
+ A_T0_MUL_T1 ();
+ }
+}
+
+static void ac__t0_sub_one_mul_enva_add_t0__mul_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ if (cmb.combine_ext)
+ {
+ T0ACMBEXT(GR_CMBX_ITALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CALPHA, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ SETSHADE_A(0xFF);
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.env_color&0xFF) ;
+ cmb.tex |= 1;
+ }
+ else
+ {
+ A_USE_T0 ();
+ }
+}
+
+static void ac__t0_sub_t1_mul_primlod_add_t0__mul_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ cmb.tex |= 3;
+ percent = (float)lod_frac / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ }
+ else
+ {
+ A_T0_INTER_T1_USING_FACTOR (lod_frac);
+ }
+}
+
+static void ac__t1_sub_prim_mul_primlod_add_t0__mul_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ cmb.tex |= 3;
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.prim_color&0xFF);
+ percent = (float)lod_frac / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ }
+ else
+ {
+ A_T0_INTER_T1_USING_FACTOR (lod_frac);
+ }
+}
+
+static void ac__t1_sub_t0_mul_enva_add_t1__mul_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ T0ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CALPHA, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 3;
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.env_color&0xFF);
+ }
+ else
+ {
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ A_T0_INTER_T1_USING_FACTOR (factor);
+ }
+}
+
+static void ac__t1_sub_t0_mul_primlod__mul_env_add_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TMU_CALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (wxUint32)((float)(rdp.env_color&0xFF)*(float)rdp.prim_lodfrac/255.0f);
+ }
+ else
+ {
+ cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL;
+ cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL;
+ cmb.tmu0_a_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR;
+ percent = (rdp.prim_lodfrac * (rdp.env_color&0xFF)) / 65025.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent; \
+ }
+ cmb.tex |= 3;
+}
+
+static void ac__t0_sub_one_mul_enva_add_t1__mul_prim ()
+{
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ T0ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CALPHA, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.env_color&0xFF) ;
+ cmb.tex |= 3;
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ CA_ENV ();
+ SETSHADE_A_PRIM ();
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SETSHADE_A_PRIM ();
+ SETSHADE_A_ENV ();
+ A_T0_MUL_T1 ();
+ }
+}
+
+static void ac__t1_mul_prima_add_t0__mul_env ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_ENV ();
+ A_T1_MUL_PRIMA_ADD_T0 ();
+}
+
+static void ac__t1_mul_enva_add_t0__mul_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ A_T1_MUL_ENVA_ADD_T0 ();
+}
+
+static void ac_t0_mul_primlod ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIMLOD ();
+ A_USE_T0 ();
+}
+
+static void ac_t1_mul_primlod ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIMLOD ();
+ A_USE_T1 ();
+}
+
+//Added by Gonetz
+static void ac__t0_add_t1__mul_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ A_T0_ADD_T1 ();
+}
+
+//Added by Gonetz
+static void ac__t0_add_t1__mul_primlod ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIMLOD ();
+ A_T0_ADD_T1 ();
+}
+
+//Added by Gonetz
+static void ac__t0_mul_t1__mul_primlod ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIMLOD ();
+ A_T0_MUL_T1 ();
+}
+
+static void ac_t0_mul_env ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_ENV ();
+ A_USE_T0 ();
+}
+
+static void ac_t0_mul_env_mul_primlod ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_ENV_MUL_PRIMLOD ();
+ A_USE_T0 ();
+}
+
+static void ac_t1_mul_env () //Added by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_ENV ();
+ // if ((settings.hacks&hack_Powerpuff) && (rdp.last_tile == 0))
+ if (rdp.cycle_mode == 0)
+ A_USE_T0 ();
+ else
+ A_USE_T1 ();
+}
+
+static void ac__t1_sub_one_mul_primlod_add_t0__mul_env ()
+{
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (0xFF) ;
+ percent = (float)lod_frac / 255.0f;
+ }
+ else
+ {
+ cmb.tmu1_a_func = GR_COMBINE_FUNCTION_BLEND_LOCAL;
+ cmb.tmu1_a_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR;
+ percent = (255 - lod_frac) / 255.0f;
+ cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA;
+ cmb.tmu0_a_fac = GR_COMBINE_FACTOR_OTHER_ALPHA;
+ }
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_ENV ();
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ cmb.tex |= 3;
+}
+
+static void ac_t0_mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_USE_T0 ();
+}
+
+static void ac_t1_mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_USE_T1 ();
+}
+
+//Added by Gonetz
+static void ac__t0_add_t1__mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_T0_ADD_T1 ();
+}
+
+static void ac__t0_mul_primlod_add_t0__mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (cmb.combine_ext)
+ {
+ T0ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ cmb.tex |= 1;
+ percent = (float)lod_frac / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ }
+ else
+ {
+ A_USE_T0 ();
+ }
+}
+
+static void ac__t1_mul_prima_add_t0__mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_T1_MUL_PRIMA_ADD_T0 ();
+}
+
+//Added by Gonetz
+static void ac__t0_sub_t1__mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 3;
+ }
+ else
+ {
+ A_T0_SUB_T1 ();
+ }
+}
+
+static void ac__t1_mul_t1_add_t1__mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 2;
+ }
+ else
+ {
+ A_USE_T1 ();
+ }
+}
+
+static void ac__t1_mul_enva_add_t0__mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_T1_MUL_ENVA_ADD_T0 ();
+}
+
+static void ac__t1_sub_one_mul_primlod_add_t0__mul_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (0xFF) ;
+ percent = (float)lod_frac / 255.0f;
+ }
+ else
+ {
+ cmb.tmu1_a_func = GR_COMBINE_FUNCTION_BLEND_LOCAL;
+ cmb.tmu1_a_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR;
+ percent = (255 - lod_frac) / 255.0f;
+ cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA;
+ cmb.tmu0_a_fac = GR_COMBINE_FACTOR_OTHER_ALPHA;
+ }
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ cmb.tex |= 3;
+}
+
+static void ac__t1_sub_shade_mul_primlod_add_t0__mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ cmb.tex |= 3;
+ percent = (float)lod_frac / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ }
+ else
+ {
+ A_T0_INTER_T1_USING_FACTOR (lod_frac);
+ }
+}
+
+//Added by Gonetz
+static void ac_prim_mul_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CA_PRIM ();
+ SETSHADE_A_PRIM ();
+}
+
+//Added by Gonetz
+static void ac_prim_mul_primlod ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CA_PRIMLOD ();
+ SETSHADE_A_PRIM ();
+}
+
+static void ac_prim_mul_env ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CA_ENV ();
+ SETSHADE_A_PRIM ();
+}
+
+static void ac__prim_sub_one_mul_primlod_add_t0__mul_env ()
+{
+ if (cmb.combine_ext)
+ {
+ T0ACMBEXT(GR_CMBX_ITALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ SETSHADE_A_PRIM ();
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (0xFF) ;
+ percent = (float)lod_frac / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ cmb.tex |= 1;
+ }
+ else
+ {
+ A_USE_T0 ();
+ }
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_ENV ();
+}
+
+static void ac_prim_mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CA_PRIM ();
+}
+
+static void ac_env_mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CA_ENV ();
+}
+
+static void ac_primlod_mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CA_PRIMLOD ();
+}
+
+// ** A-B **
+static void ac_prim_sub_t0 ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_USE_T0 ();
+
+ MOD_0 (TMOD_FULL_COLOR_SUB_TEX);
+ MOD_0_COL (rdp.prim_color);
+}
+
+// ** A*B+C **
+static void ac_t0_mul_prim_add_t0 ()
+{
+ if (cmb.combine_ext)
+ {
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_CONSTANT_ALPHA, 0,
+ GR_CMBX_B, 0);
+ CA_PRIM ();
+ A_USE_T0 ();
+ }
+ else
+ ac_t0();
+}
+
+static void ac_t1_mul_prim_add_t0 ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_T1_MUL_PRIMA_ADD_T0 ();
+}
+
+static void ac__t0_inter_t1_using_t1a__mul_prim_add__t0_inter_t1_using_t1a ()
+{
+ if (cmb.combine_ext)
+ {
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_CONSTANT_ALPHA, 0,
+ GR_CMBX_B, 0);
+ CA_PRIM ();
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ }
+ A_T0_INTER_T1_USING_T1A ();
+}
+
+static void ac__t1_inter_t0_using_t0a__mul_prim_add__t1_inter_t0_using_t0a ()
+{
+ if (cmb.combine_ext)
+ {
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_CONSTANT_ALPHA, 0,
+ GR_CMBX_B, 0);
+ CA_PRIM ();
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ }
+ A_T1_INTER_T0_USING_T0A ();
+}
+
+//Added by Gonetz
+static void ac_t0_mul_prim_add_env ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_A_PRIM ();
+ CA_ENV ();
+ A_USE_T0 ();
+}
+
+//Added by Gonetz
+static void ac__t0_add_t1__mul_prim_add_env ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_A_PRIM ();
+ CA_ENV ();
+ A_T0_ADD_T1 ();
+}
+
+//Aded by Gonetz
+static void ac__t0_inter_t1_using_enva__mul_prim_add_env ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_A_PRIM ();
+ CA_ENV ();
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ A_T0_INTER_T1_USING_FACTOR (factor);
+}
+
+//Aded by Gonetz
+static void ac_t0_mul_primlod_add_t0 ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (cmb.combine_ext)
+ {
+ T0ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ cmb.tex |= 1;
+ percent = (float)lod_frac / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ }
+ else
+ {
+ A_USE_T0 ();
+ }
+}
+
+//Aded by Gonetz
+static void ac_t1_mul_primlod_add_t0 ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_T1_MUL_PRIMLOD_ADD_T0 ();
+}
+
+//Aded by Gonetz
+static void ac_t0_mul_primlod_add_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CA_PRIMLOD ();
+ SETSHADE_A_PRIM ();
+ A_USE_T0 ();
+}
+
+static void ac_t0_mul_primlod_add_env ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CA_PRIMLOD ();
+ SETSHADE_A_ENV ();
+ A_USE_T0 ();
+}
+
+//Aded by Gonetz
+static void ac__t0_add_t1__mul_primlod_add_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CA_PRIMLOD ();
+ SETSHADE_A_PRIM ();
+ A_T0_ADD_T1 ();
+}
+
+//Added by Gonetz
+static void ac_t0_mul_env_add_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_A_ENV ();
+ CA_PRIM ();
+ A_USE_T0 ();
+}
+
+//Added by Gonetz
+static void ac_t1_mul_prim_add_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_A_PRIM ();
+ CA_PRIM ();
+ A_USE_T1 ();
+}
+
+//Added by Gonetz
+static void ac_prim_mul_shade_add_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CA_PRIM ();
+}
+
+//Added by Gonetz
+static void ac_t0_mul_shade_add_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CA_PRIM ();
+ A_USE_T0 ();
+}
+
+static void ac_t0_mul_shade_add_env ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CA_ENV ();
+ A_USE_T0 ();
+}
+
+static void ac_one_sub_prim_mul__t0_mul_t1__add__prim_mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CA_INVPRIM ();
+ MULSHADE_A_PRIM ();
+ A_T0_MUL_T1 ();
+}
+
+// ** A*B+C*D **
+static void ac_t0_mul_prim_add_shade_mul_one_minus_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ MULSHADE_A_1MPRIM ();
+ CA_PRIM ();
+ A_USE_T0 ();
+}
+
+// ** (A*B+C)*D **
+static void ac__t0_mul_primlod_add_shade__mul_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ T0ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 1;
+ percent = (float)lod_frac / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_USE_T0 ();
+ }
+}
+
+static void ac__t1_mul_primlod_add_shade__mul_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 2;
+ percent = (float)lod_frac / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_USE_T1 ();
+ }
+}
+
+// ** ((A-B)*C+D)+E **
+static void ac__t0_sub_t1_mul_prim_add_shade__mul_shade ()
+ //(t0-t1)*prim+shade, (cmb-0)*shade+0
+{
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TMU_CALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 3;
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.prim_color&0xFF);
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CA_PRIM ();
+ A_T1_SUB_T0 ();
+ }
+}
+
+static void ac__t1_sub_t0_mul_prim_add_shade__mul_shade ()
+ //(t1-t0)*prim+shade, (cmb-0)*shade+0
+{
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TMU_CALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 3;
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.prim_color&0xFF);
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CA_PRIM ();
+ A_T1_SUB_T0 ();
+ }
+}
+
+// ** A*B*C **
+static void ac__t0_mul_t1__mul_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ if (voodoo.sup_large_tex || rdp.tiles[1].lr_s < 256) //hack for RR64 pause screen
+ {
+ A_T0_MUL_T1 ();
+ }
+ else
+ {
+ A_USE_T0 ();
+ }
+}
+
+static void ac__t0_mul_t1__mul_env ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_ENV ();
+ A_T0_MUL_T1 ();
+}
+
+static void ac__t0_mul_t1__mul_env_mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_A_ENV ();
+ A_T0_MUL_T1 ();
+}
+
+static void ac__t0_mul_t1__mul_prim_mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_A_PRIM ();
+ A_T0_MUL_T1 ();
+}
+
+static void ac__t0_mul_t1__mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_T0_MUL_T1 ();
+}
+
+static void ac__t0_add_prim_mul_shade__mul_shade ()
+{
+ // (shade-0)*prim+t0, (cmb-0)*shade+0
+ if (cmb.combine_ext)
+ {
+ T0ACMBEXT(GR_CMBX_ITALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CALPHA, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 1;
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.prim_color&0xFF);
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_A_PRIM ();
+ A_USE_T0();
+ }
+}
+
+//Added by Gonetz
+static void ac_t0_mul_prim_mul_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SETSHADE_A_PRIM ();
+ SETSHADE_A_PRIM ();
+ A_USE_T0 ();
+}
+
+static void ac_t0_mul_prim_mul_env ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIMENV();
+ A_USE_T0 ();
+}
+
+static void ac_t0_mul_prim_mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_A_PRIM ();
+ A_USE_T0 ();
+}
+
+static void ac_t1_mul_prim_mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_A_PRIM ();
+ A_USE_T1 ();
+}
+
+static void ac_t0_mul_env_mul_shade ()
+{
+ if (rdp.cur_image && (rdp.cur_image->format != 0))
+ {
+ ac_shade ();
+ return;
+ }
+
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_A_ENV ();
+ A_USE_T0 ();
+}
+
+static void ac_t1_mul_env_mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_A_ENV ();
+ A_USE_T1 ();
+}
+
+static void ac_t0_mul_primlod_mul_prim () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ cmb.ccolor |= (wxUint32)(lod_frac * (rdp.prim_color&0xFF) / 255);
+ A_USE_T0 ();
+}
+
+// ** (A+B)*C **
+static void ac_prim_add_env_mul_t0 () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ SETSHADE_A_PRIM ();
+ ADDSHADE_A_ENV ();
+ A_USE_T0 ();
+}
+
+static void ac_t1_add_prim_mul_env () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CA_ENV ();
+ SETSHADE_A_PRIM ();
+ SETSHADE_A_ENV ();
+ A_USE_T1 ();
+ //(t1+prim)*env = t1*env + prim*env
+}
+
+// ** (A-B)*C **
+static void ac_t0_sub_prim_mul_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ T0ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 1;
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.prim_color&0xFF);
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ } else {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_A_PRIM ();
+ A_USE_T0 ();
+ }
+}
+
+static void ac_t0_sub_prim_mul_shade_mul_env ()
+{
+ if (cmb.combine_ext)
+ {
+ T0ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 1;
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.prim_color&0xFF);
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_CONSTANT_ALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ CA_ENV ();
+ } else {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_A_PRIM ();
+ MULSHADE_A_ENV ();
+ A_USE_T0 ();
+ }
+}
+
+static void ac_t0_sub_shade_mul_prim ()
+{
+ if (cmb.combine_ext)
+ {
+ T0ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TMU_CALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 1;
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.prim_color&0xFF);
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ } else {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_A_PRIM ();
+ A_USE_T0 ();
+ }
+}
+
+static void ac__t0_mul_t1__sub_prim_mul_shade () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ CA_PRIM();
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ }
+ A_T0_MUL_T1 ();
+}
+
+static void ac__one_sub_t1_mul_t0_add_shade__sub_prim_mul_shade () //Aded by Gonetz
+{
+ // (1-t1)*t0+shade, (cmb-prim)*shade+0
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_ONE_MINUS_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0,
+ GR_CMBX_B, 0);
+ cmb.tex |= 3;
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ CA_PRIM();
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_T0_MUL_T1 ();
+ }
+}
+
+static void ac__t1_mul_primlod_add_t0__sub_prim_mul_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ CA_PRIM ();
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ }
+ A_T1_MUL_PRIMLOD_ADD_T0 ();
+}
+
+static void ac__t1_mul_primlod_add_t0__sub_env_mul_prim () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ CA_ENV ();
+ SETSHADE_A_PRIM ();
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ }
+ A_T1_MUL_PRIMLOD_ADD_T0 ();
+}
+
+static void ac__t1_mul_prima_add_t0__sub_env_mul_shade () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ CA_ENV ();
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ }
+ A_T1_MUL_PRIMA_ADD_T0 ();
+}
+
+static void ac_one_sub_t0_mul_prim () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_BLEND_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_NONE);
+ CA_PRIM ();
+ A_USE_T0 ();
+}
+
+static void ac_one_sub_t0_mul_shade () //Aded by Gonetz
+{
+ if (rdp.aTBuffTex[0] || rdp.aTBuffTex[1])
+ {
+ ACMB (GR_COMBINE_FUNCTION_BLEND_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_NONE);
+ A_USE_T0 ();
+ }
+ else
+ ac_zero();
+}
+
+static void ac_one_sub_prim_mul_t0 () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ A_USE_T0 ();
+}
+
+static void ac_one_sub_env_mul_t0 () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_ENV ();
+ A_USE_T0 ();
+}
+
+static void ac_one_sub_shade_mul_t0 () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_USE_T0 ();
+}
+
+static void ac_one_sub_shade_mul_env () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CA_ENV ();
+}
+
+static void ac_prim_sub_shade_mul_t0 () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CA_PRIM ();
+ A_USE_T0 ();
+}
+
+static void ac_prim_sub_shade_mul_prim () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ ACMBEXT(GR_CMBX_CONSTANT_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_CONSTANT_ALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ CA_PRIM();
+ }
+ else
+ {
+ if (!(rdp.prim_color & 0xFF))
+ {
+ ac_zero();
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CA_PRIM();
+ }
+ }
+}
+
+static void ac_shade_sub_env_mul_t0 () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CA_ENV ();
+ A_USE_T0 ();
+}
+
+// ** (A-B)*C*D **
+static void ac_one_sub_t0_mul_prim_mul_shade () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_BLEND_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_NONE);
+ MULSHADE_A_PRIM ();
+ A_USE_T0 ();
+}
+
+// ** (A+B)*C*D **
+static void ac_one_plus_env_mul_prim_mul_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ ACMBEXT(GR_CMBX_ZERO, GR_FUNC_MODE_ONE_MINUS_X,
+ GR_CMBX_CONSTANT_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ MULSHADE_A_PRIM ();
+ CA_ENV();
+ }
+ else
+ ac_prim_mul_shade ();
+}
+
+// ** (A-B)*C+A **
+static void ac__t0_mul_t1__sub_env_mul_prim_add__t0_mul_t1 () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_TEXTURE_ALPHA, 0);
+ CA_ENV();
+ SETSHADE_A_PRIM ();
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ }
+ A_T0_MUL_T1 ();
+}
+
+// ** (A-B)*C+D **
+static void ac__t0_sub_prim_mul_shade_add_shade__mul_env () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ T0ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_ITALPHA, 0);
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.prim_color&0xFF) ;
+ cmb.tex |= 1;
+ ACMBEXT(GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_ALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ CA_ENV();
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_A_ENV ();
+ MOD_0 (TMOD_TEX_SUB_COL);
+ MOD_0_COL (rdp.prim_color & 0xFF);
+ A_USE_T0 ();
+ }
+}
+
+static void ac_t0_sub_t1_mul_env_add_env () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_ENV();
+ A_T0_SUB_T1 ();
+}
+
+static void ac_t0_sub_one_mul_enva_add_t1 () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ T0ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CALPHA, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.env_color&0xFF) ;
+ cmb.tex |= 3;
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_ENV();
+ }
+ else
+ {
+ ac__t0_mul_t1__mul_env ();
+ }
+}
+
+static void ac_t1_sub_one_mul_enva_add_t0 () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_B, 0);
+ T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TMU_CALPHA, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.env_color&0xFF) ;
+ SETSHADE_A (0xFF);
+ cmb.tex |= 3;
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_USE_T0 ();
+ }
+}
+
+static void ac_t1_sub_one_mul_primlod_add_t0 () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (0xFF) ;
+ percent = (float)lod_frac / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ cmb.tex |= 3;
+ }
+ else
+ {
+ // A_T0_MUL_T1 ();
+ // A_T1_MUL_PRIMLOD_ADD_T0 ();
+ cmb.tmu1_a_func = GR_COMBINE_FUNCTION_BLEND_LOCAL;
+ cmb.tmu1_a_fac = GR_COMBINE_FACTOR_DETAIL_FACTOR;
+ percent = (255 - lod_frac) / 255.0f;
+ cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA;
+ cmb.tmu0_a_fac = GR_COMBINE_FACTOR_OTHER_ALPHA;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ cmb.tex |= 3;
+ }
+}
+
+static void ac_t1_sub_prim_mul_shade_add_prim () //Aded by Gonetz
+{
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_B, 0);
+ T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.prim_color&0xFF) ;
+ cmb.tex |= 2;
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CA_PRIM ();
+ MOD_1 (TMOD_TEX_SUB_COL);
+ MOD_1_COL (rdp.prim_color & 0xFF);
+ A_USE_T1 ();
+ }
+}
+
+static void ac_t0_sub_env_mul_prim_add_env () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_A_PRIM ();
+ CA_ENV1MPRIM ();
+ A_USE_T0 ();
+ //(t0-env)*prim+env == t0*prim + env*(1-prim)
+}
+
+static void ac_t0_sub_env_mul_shadea_add_env () //Aded by Gonetz
+{
+ if (!cmb.combine_ext)
+ {
+ ac_t0_mul_shade ();
+ return;
+ }
+ T0ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ cmb.tex |= 1;
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_B, 0);
+ CA_ENV ();
+}
+
+static void ac__one_sub_t0_mul_t1_add_t0__mul_prim () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ rdp.best_tex = 0;
+ cmb.tex |= 3;
+ cmb.tmu1_a_func = GR_COMBINE_FUNCTION_LOCAL;
+ cmb.tmu0_a_func = GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL;
+ cmb.tmu0_a_fac = GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA;
+}
+
+static void ac_one_sub_t0_mul_prim_add_t0 () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ SETSHADE_A_PRIM ();
+ CA (0xFF);
+ A_USE_T0 ();
+}
+
+static void ac_one_sub_t0_mul_env_add_t0 () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ SETSHADE_A_ENV ();
+ CA (0xFF);
+ A_USE_T0 ();
+}
+
+static void ac_one_sub_t0_mul_primlod_add_prim () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ SETSHADE_A_PRIM ();
+ CA_PRIMLOD();
+ A_USE_T0 ();
+}
+
+static void ac_prim_sub_t0_mul_env_add_t0 () //Aded by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CA_INVENV ();
+ SETSHADE_A_PRIM ();
+ SETSHADE_A_ENV ();
+ A_USE_T0 ();
+ //(prim-t0)*env+t0 = prim*env + t0*(1-env)
+}
+
+static void ac_prim_sub_env_mul_t0_add_env ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CA_PRIM ();
+ SETSHADE_A_ENV ();
+ A_USE_T0 ();
+}
+
+static void ac_prim_sub_env_mul_t1_add_env ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CA_PRIM ();
+ SETSHADE_A_ENV ();
+ A_USE_T1 ();
+}
+
+static void ac_prim_sub_env_mul_t0_add_one ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CA (0xFF);
+ SETSHADE_A_PRIMSUBENV ();
+ A_USE_T0 ();
+}
+
+//Added by Gonetz
+static void ac_prim_sub_env_mul_shade_add_env ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CA_ENV ();
+ MULSHADE_A_PRIMSUBENV ();
+}
+
+//Added by Gonetz
+static void ac_prim_sub_env_mul_shade_add_env_mul_t1 ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CA_ENV ();
+ MULSHADE_A_PRIMSUBENV ();
+ A_USE_T1 ();
+}
+
+//Added by Gonetz
+static void ac_prim_sub_shade_mul_t0_add_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CA_PRIM ();
+ A_USE_T0 ();
+}
+
+//Added by Gonetz
+static void ac_one_sub_shade_mul_t1_add_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_USE_T1 ();
+}
+
+//Added by Gonetz
+static void ac_one_sub_env_mul_shade_add_env ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CA_ENV ();
+}
+
+//Added by Gonetz
+static void ac_env_sub_prim_mul_t0_add_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CA_ENV ();
+ SETSHADE_A_PRIM ();
+ A_USE_T0 ();
+}
+
+static void ac_one_sub_t1_add_t0_mul_env ()
+{
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ T0ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TMU_CALPHA, 0,
+ GR_CMBX_B, 1);
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.env_color&0xFF);
+ cmb.tex |= 3;
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_ENV ();
+ A_T0_ADD_T1();
+ cmb.tmu1_a_invert = FXTRUE;
+ }
+}
+
+static void ac_env_sub_prim_mul_shade_add_prim () //Added by Gonetz
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CA_PRIM ();
+ MULSHADE_A_ENVSUBPRIM ();
+}
+
+static void ac_env_sub_primshade_mul_t1_add_primshade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CA_ENV ();
+ MULSHADE_A_PRIM ();
+ A_USE_T1 ();
+}
+
+static void ac_one_sub_prim_mul_t0_add_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CA (0xFF);
+ SETSHADE_A_PRIM ();
+ A_USE_T0 ();
+}
+
+static void ac_one_sub_prim_mul_t0_add__prim_mul_env ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_CONSTANT);
+ CA_INVPRIM ();
+ SETSHADE_A_PRIM ();
+ SETSHADE_A_ENV ();
+ A_USE_T0 ();
+}
+
+static void ac_shade_sub_t0_mul_primlod_add_prim ()
+{
+ if (cmb.combine_ext)
+ {
+ T0ACMBEXT(GR_CMBX_ITALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_TMU_CALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (lod_frac&0xFF);
+ cmb.tex |= 1;
+ ACMBEXT(GR_CMBX_CONSTANT_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_TEXTURE_ALPHA, 0);
+ CA_PRIM ();
+ }
+ else
+ ac_t0();
+}
+
+static void ac_shade_sub_env_mul_t0_add_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SUBSHADE_A_ENV ();
+ CA_PRIM ();
+ A_USE_T0 ();
+}
+
+// ** A inter B using C **
+static void ac_t0_inter_t1_using_prima ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
+ A_T0_INTER_T1_USING_FACTOR (factor);
+}
+
+static void ac_t1_inter_t0_using_prima ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
+ A_T1_INTER_T0_USING_FACTOR (factor);
+}
+
+static void ac_t0_inter_t1_using_primlod ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+static void ac_t0_inter_t1_using_enva ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ A_T0_INTER_T1_USING_FACTOR (factor);
+}
+
+static void ac_t1_inter_t0_using_enva ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ A_T1_INTER_T0_USING_FACTOR (factor);
+}
+
+//Added by Gonetz
+static void ac_t0_inter_t1_using_t0a ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_T0_INTER_T1_USING_T0A ();
+}
+
+//Added by Gonetz
+static void ac_t0_inter_t1_using_t1a ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_T0_INTER_T1_USING_T1A ();
+}
+
+//Added by Gonetz
+static void ac_t0_inter_t1_using_shadea ()
+{
+ if (cmb.combine_ext)
+ {
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE);
+ }
+ A_T0_INTER_T1_USING_SHADEA ();
+}
+
+// ** (A inter B using C) * D **
+
+static void ac__t0_inter_t1_using_primlod__mul_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ A_T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+static void ac__t1_mul_primlod_add_t0__mul_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ A_T1_MUL_PRIMLOD_ADD_T0 ();
+}
+
+static void ac__t0_inter_t1_using_primlod__mul_env ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_ENV ();
+ A_T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+static void ac__t1_mul_primlod_add_t0__mul_env ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_ENV ();
+ A_T1_MUL_PRIMLOD_ADD_T0 ();
+}
+
+static void ac__t0_inter_t1_using_primlod__mul_shade ()
+{
+ if (settings.hacks & hack_Makers)
+ {
+ //rolling rock issue - it has zero shade alpha and thus rejected by alpha compare
+ ac_t0_inter_t1_using_primlod();
+ return;
+ }
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+static void ac__t1_mul_primlod_add_t0__mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_T1_MUL_PRIMLOD_ADD_T0 ();
+}
+
+//Added by Gonetz
+static void ac__t0_inter_t1_using_prima__mul_env ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_ENV ();
+ wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
+ A_T0_INTER_T1_USING_FACTOR (factor);
+}
+
+//Added by Gonetz
+static void ac__t1_inter_t0_using_t0a__mul_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ A_T1_INTER_T0_USING_T0A ();
+}
+
+static void ac__t1_inter_t0_using_primlod__mul_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ A_T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+static void ac__t1_inter_t0_using_prima__mul_env ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_ENV ();
+ wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
+ A_T1_INTER_T0_USING_FACTOR (factor);
+}
+
+//Added by Gonetz
+static void ac__t0_inter_t1_using_prima__mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
+ A_T0_INTER_T1_USING_FACTOR (factor);
+}
+
+static void ac__t1_inter_t0_using_prima__mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ wxUint8 factor = (wxUint8)(rdp.prim_color&0xFF);
+ A_T1_INTER_T0_USING_FACTOR (factor);
+}
+
+static void ac__t0_inter_t1_using_enva__mul_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ A_T0_INTER_T1_USING_FACTOR (factor);
+}
+
+static void ac__env_sub_one_mul_t1_add_t0__mul_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ZERO, 1,
+ GR_CMBX_ZERO, 0);
+ SETSHADE_A(0xFF);
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (rdp.env_color&0xFF) ;
+ cmb.tex |= 3;
+ }
+ else
+ {
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ A_T0_INTER_T1_USING_FACTOR (factor);
+ }
+}
+
+static void ac__t0_inter_t1_using_enva__mul_primlod ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIMLOD ();
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ A_T0_INTER_T1_USING_FACTOR (factor);
+}
+
+static void ac__t1_mul_enva_add_t0__sub_prim_mul_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ CA_PRIM ();
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ MULSHADE_A_PRIM ();
+ }
+ A_T1_MUL_ENVA_ADD_T0 ();
+}
+
+//Added by Gonetz
+static void ac__t0_inter_t1_using_t0a__mul_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ A_T0_INTER_T1_USING_T0A ();
+}
+
+//Added by Gonetz
+static void ac__t0_inter_t1_using_t1a__mul_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ A_T0_INTER_T1_USING_T1A ();
+}
+
+static void ac__t0_inter_t1_using_t1a__mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_T0_INTER_T1_USING_T1A ();
+}
+
+//Added by Gonetz
+static void ac__t0_inter_t1_using_shadea__mul_prim ()
+{
+ if (cmb.combine_ext)
+ {
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_CONSTANT_ALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ A_T0_INTER_T1_USING_SHADEA ();
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_T0_INTER_T1_USING_FACTOR (0x7F);
+ }
+ CA_PRIM ();
+}
+
+//Added by Gonetz
+static void ac__t0_inter_t1_using_shadea__mul_env ()
+{
+ if (cmb.combine_ext)
+ {
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_ITALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_CONSTANT_ALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ A_T0_INTER_T1_USING_SHADEA ();
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ A_T0_INTER_T1_USING_FACTOR (0x7F);
+ }
+ CA_ENV ();
+}
+
+static void ac__t0_inter_t1_using_primlod__sub_env_mul_shade_add_shade ()
+{
+ if (cmb.combine_ext)
+ {
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_ALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_ITALPHA, 0,
+ GR_CMBX_ALOCAL, 0);
+ CA_ENV ();
+ A_T0_INTER_T1_USING_FACTOR (lod_frac);
+ }
+ else
+ ac__t0_inter_t1_using_primlod__mul_shade ();
+}
+
+//Added by Gonetz
+static void ac__t0_inter_t1_using_enva__mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ A_T0_INTER_T1_USING_FACTOR (factor);
+}
+
+static void ac__t0_inter_t1_using_primlod__mul_prim_add_env ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CA_ENV ();
+ SETSHADE_A_PRIM ();
+ A_T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+//Added by Gonetz
+static void ac__t0_inter_t1_using_primlod__mul_shade_add_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ CA_PRIM ();
+ A_T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+//Added by Gonetz
+static void ac__t0_inter_t1_using_primlod__mul_env_add__t0_inter_t1_using_primlod ()
+{
+ if (cmb.combine_ext)
+ {
+ ACMBEXT(GR_CMBX_ZERO, GR_FUNC_MODE_ZERO,
+ GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_ALPHA, 0,
+ GR_CMBX_B, 0);
+ CA_ENV ();
+ }
+ else
+ {
+ ACMB (GR_COMBINE_FUNCTION_BLEND,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_A_ENV ();
+ CA (0xFF);
+ }
+ A_T0_INTER_T1_USING_FACTOR (lod_frac);
+}
+
+static void ac__t1_sub_one_mul_enva_add_t0__mul_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (0xFF) ;
+ cmb.tex |= 3;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = (float)(rdp.env_color&0xFF) / 255.0f;
+ }
+ else
+ {
+ // (t1-1)*env+t0, (cmb-0)*prim+0
+ A_T0_MUL_T1 ();
+
+ MOD_1 (TMOD_TEX_SCALE_FAC_ADD_FAC);
+ MOD_1_FAC (rdp.env_color & 0xFF);
+ }
+}
+
+static void ac__one_inter_t0_using_prim__mul_env ()
+{
+ if (cmb.combine_ext)
+ {
+ T0ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_B, 0);
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | (0xFF) ;
+ cmb.tex |= 1;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = (float)(rdp.prim_color&0xFF) / 255.0f;
+ ACMBEXT(GR_CMBX_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_CONSTANT_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_CONSTANT_ALPHA, 0,
+ GR_CMBX_ZERO, 0);
+ CA_ENV ();
+ }
+ else
+ {
+ ac_t0_mul_prim_add_env ();
+ }
+}
+
+static void ac__t1_sub_one_mul_enva_add_t0__mul_shade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_LOCAL,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_TEXTURE);
+ CA_PRIM ();
+ if (cmb.combine_ext)
+ {
+ T1ACMBEXT(GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, GR_FUNC_MODE_ZERO,
+ GR_CMBX_ZERO, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ T0ACMBEXT(GR_CMBX_OTHER_TEXTURE_ALPHA, GR_FUNC_MODE_X,
+ GR_CMBX_TMU_CALPHA, GR_FUNC_MODE_NEGATIVE_X,
+ GR_CMBX_DETAIL_FACTOR, 0,
+ GR_CMBX_LOCAL_TEXTURE_ALPHA, 0);
+ cmb.tex_ccolor = (cmb.tex_ccolor&0xFFFFFF00) | 0xFF ;
+ percent = (rdp.env_color&0xFF) / 255.0f;
+ cmb.dc0_detailmax = cmb.dc1_detailmax = percent;
+ cmb.tex |= 3;
+ }
+ else
+ {
+ wxUint8 factor = (wxUint8)(rdp.env_color&0xFF);
+ A_T0_INTER_T1_USING_FACTOR (factor);
+ }
+}
+
+static void ac_zero_sub_prim_mul_t0_add_prim ()
+{
+ ACMB (GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_ITERATED);
+ SETSHADE_A (0);
+ CA_PRIM ();
+ A_USE_T0 ();
+}
+
+static void ac_one_sub_t0_mul_primshade ()
+{
+ ACMB (GR_COMBINE_FUNCTION_BLEND_LOCAL,
+ GR_COMBINE_FACTOR_TEXTURE_ALPHA,
+ GR_COMBINE_LOCAL_ITERATED,
+ GR_COMBINE_OTHER_NONE);
+ MULSHADE_A_PRIM ();
+ A_USE_T0 ();
+}
+
+//****************************************************************
+// Combine List
+//
+// 3/13/02: I have converted the combine descriptions, now using
+// the correct values for each slot, instead of a one-for-all-
+// slot version. All of the descriptions marked with 'z' have
+// not yet been converted or checked. I have not totally redone
+// the modes, because they should be for the most part correct
+// as they are, even with the wrong descriptions. [Dave2001]
+//****************************************************************
+
+typedef void (*cmb_func)();
+typedef struct {
+ wxUint32 key;
+ cmb_func func;
+} COMBINER;
+
+static COMBINER color_cmb_list[] = {
+ // { #CCSTART }
+ // intro, Aidyn Chronicles. Added by Gonetz
+ // (0-cmb)*env+cmb, (t1-t0)*0+t0
+ {0x05083812, cc_t0},
+ //terminal, Spacestation Silicon Valley. Added by Gonetz
+ // (0-0)*0+cmb, (0-0)*0+prim
+ {0x1fff7fff, cc_prim},
+ //chip in Spacestation Silicon Valley intro. Added by Gonetz
+ // (0-0)*0+cmb, (prim-0)*shade+0
+ {0x1fffe4f3, cc_prim_mul_shade},
+ // car, beetle adventure racing. Added by Gonetz
+ // (t1-t0)*t0+t0, (cmb-shade)*prima+shade **can work incorrect**
+ {0x21128a40, cc__t0_inter_t1_using_t0__sub_shade_mul_prima_add_shade},
+ // Treasure opening, zelda
+ // (t1-prim)*t0+t0, (prim-env)*cmb+env
+ {0x2132a053, cc_prim_sub_env_mul__t1_sub_prim_mul_t0_add_t0__add_env},
+ // yellow carpet, Pokemon Stadium 2
+ // (t1-env)*t0+t0, (cmb-0)*shade+0
+ {0x2152e4f0, cc__t1_sub_env_mul_t0_add_t0__mul_shade},
+ // Water, doubut no mori
+ // (t1-0)*t0+t0, (prim-0)*shade+cmb
+ {0x21f204f3, cc__t1_mul_t0_add_t0__add_prim_mul_shade},
+ // enemy transparent, paper mario. Addd by Gonetz
+ // (t1-t0)*t1+t0, (env-prim)*cmb+prim
+ {0x22126035, cc_env_sub_prim_mul__t0_inter_t1_using_t1__add_prim},
+ // snowhead temple, zelda 2. Addd by Gonetz
+ // (t1-t0)*t1+t0, (cmb-0)*shade+prim
+ {0x221264f0, cc__t0_inter_t1_using_t1__mul_shade_add_prim},
+ // snowhead temple entrance, zelda 2. Addd by Gonetz
+ // (t1-t0)*t1+t0, (cmb-0)*prim+shade
+ {0x221283f0, cc__t0_inter_t1_using_t1__mul_prim_add_shade},
+ // teleportation, Spacestation Silicon Valley. Added by Gonetz
+ // (t1-t0)*t1+t0, (prim-env)*cmb+env
+ {0x2212a053, cc_prim_sub_env_mul__t0_inter_t1_using_t1__add_env},
+ // pokemon fainted, Pokemon Stadium 2
+ // (prim-t0)*t1+t0
+ {0x22132213, cc_prim_sub_t0_mul_t1_add_t0},
+ // attack, Ogre Battle 64
+ // (1-t0)*t1+t0, (cmb-0)*prim+0
+ {0x2216e3f0, cc__t0_inter_one_using_t1__mul_prim},
+ // Some gannon spell, zelda
+ // (t1-0)*t1+t0, (prim-0)*cmb+0
+ {0x22f2e0f3, cc__t1_mul_t1_add_t0__mul_prim},
+ // battle tanks 2 [Ogy]
+ // (1-0)*t1+t0, (env-prim)*cmb+prim
+ {0x22f66035, cc_env_sub_prim_mul__t0_add_t1__add_prim},
+ // GASP Fighters
+ // (1-0)*t1+t0, (shade-0)*cmb+0
+ {0x22f6e0f4, cc__t0_add_t1__mul_shade},
+ // parts of a car, F1 World Grand Prix. Added by Gonetz
+ // (1-0)*t1+t0, (cmb-0)*shade+0
+ {0x22f6e4f0, cc__t0_add_t1__mul_shade},
+ // ???, zelda
+ // (noise-0)*t1+t0, (prim-env)*cmb+env
+ {0x22f7a053, cc_prim_sub_env_mul__t0_add_t1__add_env},
+ // flashing arrow over buoy, wave race. Added by Gonetz
+ // (t1-t0)*prim+t0, (env-cmb)*enva+cmb ** INC **
+ {0x23120c05, cc__t0_inter_t1_using_prim__inter_env_using_enva},
+ // ground, zelda2. Added by Gonetz
+ // (t1-t0)*prim+t0, (cmb-0)*shade+0
+ {0x2312e4f0, cc__t0_inter_t1_using_prim__mul_shade},
+ // wwf rules
+ // (env-t0)*prim+t0
+ {0x23152315, cc_t0_inter_env_using_prim},
+ // Paper Mario
+ // (1-t0)*prim+t0, (1-t0)*t0+cmb ** INC **
+ {0x23160116, cc_t0_add_prim_mul_one_sub_t0_add_t0},
+ // intro, castlevania. Added by Gonetz
+ // (1-t0)*prim+t0
+ {0x23162316, cc_one_sub_t0_mul_prim_add_t0},
+ // Explosions, aerofighter's assault
+ // (1-t0)*prim+t0, (shade-0)*cmb+0
+ {0x2316e0f4, cc_t0_mul_shade},
+ //beetle adventure racing. Added by Gonetz
+ // (1-t0)*prim+t0, (cmb-0)*shade+0 **INC**
+ {0x2316e4f0, cc__t0_inter_one_using_prim__mul_shade},
+ // Unknown player background, smash bros
+ // (noise-t0)*prim+t0 ** INC **
+ // {0x23172317, cc_t0},
+ {0x23172317, cc_t0_inter_noise_using_prim},
+ // paper mario. Added by Gonetz
+ // (noise-prim)*prim+t0 ** INC **
+ {0x23372337, cc_t0_add_prim},
+ // strange mirror in stone temple, zelda 2. Added by Gonetz
+ // (prim-env)*prim+t0, (cmb-0)*prim+0 ** INC **
+ {0x2353e3f0, cc__prim_sub_env_mul_prim_add_t0__mul_prim},
+ // Gilded sword, zelda 2. Added by Gonetz
+ // (shade-env)*prim+t0, (cmb-0)*shade+env ** INC **
+ {0x2354a4f0, cc__t0_add_prim_mul_shade__mul_shade_add_env},
+ // Razor sword, zelda 2. Added by Gonetz
+ // (shade-env)*prim+t0, (cmb-0)*shade+0 ** INC **
+ {0x2354e4f0, cc__t0_add_prim_mul_shade__mul_shade},
+ // menu, Mischief Makers. Added by Gonetz
+ // (0-env)*prim+t0, (cmb-0)*shade+0
+ {0x235f235f, cc_t0_sub__prim_mul_env},
+ // Deadly Arts logo. Added by Gonetz
+ // (t0-0)*prim+t0
+ {0x23f123f1, cc_t0_mul_prim},
+ // pokemon attack, Pokemon Stadium 2. Added by Gonetz
+ // (shade-0)*prim+t0, (cmb-0)*shade+0 ** INC **
+ {0x23f4e4f0, cc_t0_mul_shade},
+ // Mischief Makers logo. Added by Gonetz
+ // (env-0)*prim+t0
+ {0x23f523f5, cc_prim_mul_env_add_t0},
+ // Taken out bomb, zelda
+ // (1-0)*prim+t0
+ {0x23f623f6, cc_t0_add_prim},
+ // waterfall, Dobutsu_no_Mori
+ // (1-0)*prim+t0, (cmb-0)*shade+t0
+ {0x23f624f0, cc__t0_add_prim__mul_shade_add_t0},
+ // waterfall, Dobutsu_no_Mori
+ // (1-0)*prim+t0, (cmb-0)*shade+t1
+ {0x23f644f0, cc__t0_add_prim__mul_shade_add_t1},
+ // Jabu-Jabu's Belly, zelda
+ // (noise-0)*prim+t0
+ {0x23f723f7, cc_t0_add_prim},
+ // carmagedon
+ // (0-0)*prim+t0
+ {0x23ff23ff, cc_t0},
+ // water, diddy kong racing. Added by Gonetz
+ // (t1-t0)*shade+t0, (env-cmb)*env_a+cmb **INC**
+ {0x24120c05, cc__t0_inter_t1_using_shade__inter_env_using_enva},
+ // Advertisement hoarding, Mia Soccer. Added by Gonetz
+ // (t1-t0)*shade+t0, (1-0)*cmb+0
+ {0x2412e0f6, cc_t0_inter_t1_using_shade},
+ // ground, f-zero x
+ // (prim-t0)*shade+t0 ** INC **
+ {0x24132413, cc__one_sub_prim_mul_shade__mul_t0_add__prim_mul_shade},
+ // intro, F1 Racing Championship. Added by Gonetz
+ // (env-t0)*shade+t0 ** INC *
+ {0x24152415, cc_one_sub_t0_mul_shade_add_t0},
+ // Sky, pilotwings
+ // (1-t0)*shade+t0
+ {0x24162416, cc_one_sub_t0_mul_shade_add_t0},
+ // zelda 2 [Ogy]. Added by Gonetz
+ // (prim-env)*shade+t0, (prim-prim)*shade+cmb ** INC ** ?
+ {0x24530433, cc_prim_sub_env_mul_shade_add_t0},
+ // waves, Dr. Mario
+ // (0-center)*shade+t0
+ {0x246f246f, cc_t0_sub__shade_mul_center},
+ // lums, Rayman2. Added by Gonetz
+ // (t0-0)*shade+t0 ** INC **
+ {0x24f124f1, cc_t0}, //this one works better
+ // {0x24f124f1, cc_t0_mul_shade},
+ // Goemon, mystical ninja. Added by Gonetz
+ // (prim-0)*shade+t0
+ {0x24f324f3, cc_prim_mul_shade_add_t0},
+ // Sky, waverace
+ //z (t1-t0)*env+t0 ** INC **
+ {0x25122512, cc_t0_inter_t1_using_env},
+ // Rare logo, Jet Force. Added by Gonetz
+ // (t1-t0)*env+t0, (cmb-0)*prim+0 ** INC **
+ {0x2512e3f0, cc__t0_inter_t1_using_enva__mul_prim},
+ // ridge recer, unimp log. Added by Gonetz
+ // (t1-t0)*env+t0, (cmb-0)*shade+0 ** INC **
+ {0x2512e4f0, cc__t0_inter_t1_using_env__mul_shade},
+ // menu, Mischief Makers. Added by Gonetz
+ //(prim-t0)*env+t0 ** INC **
+ {0x25132513, cc_one_sub_env_mul_t0_add_prim_mul_env},
+ // Battle border, quest64
+ // (1-t0)*env+t0
+ {0x25162516, cc_one_sub_env_mul_t0_add_env},
+ // Paper Mario
+ // (noise-t0)*env+t0
+ {0x25172517, cc_t0_inter_noise_using_env},
+ // the lamp in the bomb shop in town, zelda 2 [Ogy]. Added by Gonetz
+ // (t0-t1)*env+t0, (1-env)*prim+cmb ** INC **
+ {0x25210356, cc_one_sub_env_mul_prim_add__t0_inter_t1_using_env},
+ // Darmani's necklace, zelda 2 [Ogy]. Added by Gonetz
+ // (prim-shade)*env+t0, (cmb-0)*shade+0 ** INC **
+ {0x2543e4f0, cc_t0_mul_shade_add_prim_mul_env},
+ // {0x2543e4f0, cc_t0_mul_shade},
+ // mystical ninja. Added by Gonetz
+ // (1-0)*env+t0
+ {0x25f625f6, cc_t0_add_env},
+ // smoke, Starshot. Added by Gonetz
+ // (1-0)*env+t0, (1-0)*cmb+0
+ {0x25f6e0f6, cc_t0_add_env},
+ // mega shock, Paper Mario. Added by Gonetz
+ // (t1-0)*scale+t0, (env-center)*cmb+prim
+ {0x26f26065, cc__t0_add__t1_mul_scale__mul_env_sub_center_add_prim},
+ // character select, Duck Dodgers. Added by Gonetz
+ // (prim-t0)*t0_alpha+t0, (cmb-0)*shade+0 **INC**
+ {0x2813e4f0, cc__t0_inter_prim_using_t0a__mul_shade},
+ // intro, Duck Dodgers. Added by Gonetz
+ // (shade-t0)*t0_alpha+t0 **INC**
+ {0x28142814, cc_t0_inter_shade_using_t0a},
+ // vermilion gym torches, Pokemon Stadium 2.
+ // (prim-env)*t0_a+t0, (cmb-cmb)*cmb+cmb
+ {0x28530000, cc_prim_sub_env_mul_t0a_add_t0},
+ // F1 World Grand Prix. Added by Gonetz
+ // (prim-0)*t0_a+t0, (cmb-0)*shade+0 ** INC **
+ {0x28f3e4f0, cc__t0a_mul_prim_add_t0__mul_shade},
+ // battle tanks 2 [Ogy]
+ // (env-0)*t0_a+t0, (cmb-0)*shade+0
+ {0x28f5e4f0, cc__t0a_mul_env_add_t0__mul_shade},
+ // blastcorps, unimp log. Added by Gonetz
+ // (t1-t0)*t1_alpha+t0
+ {0x29122912, cc_t0_inter_t1_using_t1a},
+ // paper mario. Added by Gonetz
+ // (t1-t0)*t1_alpha+t0, (cmb-env)*env_a+env
+ {0x2912ac50, cc__t0_inter_t1_using_t1a__sub_env_mul_enva_add_env},
+ // Rally 2000. Added by Gonetz
+ // (t1-t0)*t1_alpha+t0, (cmb-0)*shade+0
+ {0x2912e4f0, cc__t0_inter_t1_using_t1a__mul_shade},
+ // ??? in zelda ending, zelda
+ // (1-0)*t1_alpha+t0, (prim-env)*cmb+env
+ {0x29f6a053, cc_prim_sub_env_mul__t0_add_t1a__add_env},
+ // Sky, zelda
+ //z (t1-t0)*prim_a+t0
+ {0x2a122a12, cc_t0_inter_t1_using_prima},
+ // battle tanks [Ogy]
+ // (t1-t0)*prim_a+t0, (env-prim)*cmb+prim
+ {0x2a126035, cc_env_sub_prim_mul__t0_inter_t1_using_prima__add_prim},
+ // clothes, zelda 2. Added by Gonetz
+ // (t1-t0)*prim_a+t0, (prim-env)*cmb+env
+ {0x2a12a053, cc_prim_sub_env_mul__t0_inter_t1_using_prima__add_env},
+ // N64 BIOS
+ // (t1-t0)*prim_a+t0, (cmb-0)*shade+0
+ {0x2a12e0f4, cc__t0_inter_t1_using_prima__mul_shade},
+ // flame, Doraemon 2. Added by Gonetz
+ // (t1-t0)*prim_a+t0, (cmb-0)*prim+0
+ {0x2a12e3f0, cc__t0_inter_t1_using_prima__mul_prim},
+ // logo, PD. Added by Gonetz
+ // (t1-t0)*prim_a+t0, (cmb-0)*shade+0
+ {0x2a12e4f0, cc__t0_inter_t1_using_prima__mul_shade},
+ // Pikachu
+ // (prim-t0)*prim_a+t0, (env-cmb)*enva+cmb
+ {0x2a130c05, cc__t0_inter_prim_using_prima__inter_env_using_enva},
+ // 1080 snowboarding [Ogy] - 7/03/02 fixed by Dave2001. 15 Mar 2005 fixed by Gonetz.
+ // (prim-t0)*prim_a+t0
+ {0x2a132a13, cc_t0_inter_prim_using_prima},
+ // menu background, Paper Mario
+ // (prim-t0)*prim_a+t0, (prim-t1)*prim_a+t1
+ {0x2a134a23, cc_t0_inter_prim_using_prima},
+ // {0x2a134a23, cc_t0},
+ // Mickey USA
+ // (prim-t0)*prim_a+t0, (cmb-0)*shade+0 ** INC **
+ {0x2a13e4f0, cc_t0_mul_shade},
+ // gunfire, Sin and Punishmen. Added by Gonetz
+ // (env-t0)*prima+t0 **INC**
+ {0x2a152a15, cc_t0_inter_env_using_prima},
+ // Mystical Ninja
+ // (0-t0)*prima+t0, (prim-env)*cmb+env ** INC **
+ {0x2a1fa053, cc_prim_sub_env_mul__t0_sub_t0_mul_prima__add_env},
+ // foresight attack, Pokemon Stadium 2.
+ // (t1-prim)*prim_a+t0, (prim-env)*cmb+env
+ {0x2a32a053, cc_prim_sub_env_mul__t1_sub_prim_mul_prima_add_t0__add_env},
+ // arena, Pokemon Stadium 2. Added by Gonetz
+ // (shade-prim)*prim_a+t0 ** INC **
+ {0x2a342a34, cc_t0_mul_shade},
+ // Torches, Paper Mario
+ // (t1-k4)*prim_a+t0, (t1-k4)*cmb_a+cmb ** INC **
+ {0x2a720772, cc_t1_sub_k4_mul_prima_add_t0},
+ // GASP Fighters. Added by Gonetz
+ // (t0-0)*prim_a+t0, (cmb-center)*scale+0 ** INC **
+ {0x2af1e660, cc__t0_mul_prima_add_t0__sub_center_mul_scale},
+ // F1 World Grand Prix. Added by Gonetz
+ // (t1-0)*prim_a+t0, (cmb-0)*shade+env
+ {0x2af2a4f0, cc__t1_mul_prima_add_t0__mul_shade_add_env},
+ // tidal wave, Paper Mario. Added by Gonetz
+ // (prim-0)*prim_a+t0
+ {0x2af32af3, cc_prim_mul_prima_add_t0},
+ //Spacestation Silicon Valley intro. Added by Gonetz
+ // (t1-t0)*shade_alpha+t0, (prim-shade)*cmb+shade ** INC **
+ {0x2b128043, cc_prim_sub_shade_mul__t0_inter_t1_using_shadea__add_shade},
+ // water, Rocket Robot in Wheels
+ // (t1-t0)*shade_alpha+t0, (env-shade)*cmb+shade ** INC **
+ {0x2b128045, cc_env_sub_shade_mul__t0_inter_t1_using_shadea__add_shade},
+ // arena, Pokemon Stadium 2
+ // (t1-t0)*shade_alpha+t0, (cmb-prim)*env+shade ** INC **
+ {0x2b128530, cc__t0_inter_t1_using_shadea__sub_prim_mul_env_add_shade},
+ // Rocket Robot in Wheels intro
+ // (t1-t0)*shade_a+t0, (shade-0)*cmb+0 ** INC **
+ {0x2b12e0f4, cc__t0_inter_t1_using_shadea__mul_shade},
+ // water, Mickey USA
+ // (t1-t0)*shade_a+t0, (cmb-0)*shade+0 ** INC **
+ {0x2b12e4f0, cc__t0_inter_t1_using_shadea__mul_shade},
+ // Extreme G. Added by Gonetz
+ // (shade-t0)*shade_alpha+t0
+ {0x2b142b14, cc_shade_sub_t0_mul_shadea_add_t0},
+ // Jet Force Gemini. Added by Gonetz
+ // (shade-t0)*shade_alpha+t0, (cmb-0)*prim+0 ** INC **
+ {0x2b14e3f0, cc_t0_mul_prim_add_shade_mul_shadea_mul_prim},
+ // V8-2
+ // (env-t0)*shade_alpha+t0, (cmb-0)*shade+0 ** INC **
+ {0x2b15e4f0, cc__t0_inter_env_using_shadea__mul_shade},
+ // Earthquake pokemon attack, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
+ // (t1-0)*shade_alpha+t0, (prim-env)*cmb+env ** INC **
+ {0x2bf2a053, cc_prim_sub_env_mul__t0_add_t1__add_env},
+ // pads, Pokemon Stadium 2. Added by Gonetz
+ // (0-0)*shade_alpha+t0, (prim-env)*cmba+env
+ {0x2bffa753, cc_prim_sub_env_mul_t0a_add_env},
+ // paper mario. Added by Gonetz
+ // (t1-t0)*env_a+t0, (1-cmb)*prim+cmb
+ {0x2c120306, cc_one_sub__t0_inter_t1_using_enva__mul_prim_add__t0_inter_t1_using_enva},
+ // Amoeba boss, water temple, zelda
+ // (t1-t0)*env_a+t0, (cmb-env)*prim+t0 ** INC **
+ {0x2c122350, cc__t0_inter_t1_using_enva__sub_env},
+ // paper mario. Added by Gonetz
+ // (t1-t0)*env_a+t0
+ {0x2c122c12, cc_t0_inter_t1_using_enva},
+ // paper mario. Added by Gonetz
+ // (t1-t0)*env_a+t0, (1-prim)*cmb+prim
+ {0x2c126036, cc_one_sub_prim_mul__t0_inter_t1_using_enva__add_prim},
+ //Arena, Pokemon Stadium 2
+ // (t1-t0)*env_a+t0, (cmb-0)*shade+prim
+ {0x2c1264f0, cc__t0_inter_t1_using_enva__mul_shade_add_prim},
+ // water, jet force. Added by Gonetz
+ // (t1-t0)*env_a+t0, (prim-shade)*cmb+shade
+ {0x2c128043, cc_prim_sub_shade_mul__t0_inter_t1_using_enva__add_shade},
+ // Faries, zelda
+ //z (t1-t0)*env_a+t0, (prim-env)*cmb+env
+ {0x2c12a053, cc_prim_sub_env_mul__t0_inter_t1_using_enva__add_env},
+ // paper mario. Added by Gonetz
+ // (t1-t0)*env_a+t0, (prim-center)*cmb+env
+ {0x2c12a063, cc_prim_sub_center_mul__t0_inter_t1_using_enva__add_env},
+ // pads, Pokemon Stadium 2. Added by Gonetz
+ // (t1-t0)*env_a+t0, (cmb-prim)*shade+env ** INC **
+ {0x2c12a430, cc__t0_inter_t1_using_enva__mul_shade_add_env},
+ // Scary dead thing boss, zelda
+ // (t1-t0)*env_a+t0, (cmb-t1)*cmb_a+env
+ {0x2c12a720, cc__t0_inter_t1_using_enva__mul_env},
+ // something in a menu, PokemonStadium2, [Raziel64]
+ // (t1-t0)*env_a+t0, (prim-env)*cmb_a+env
+ {0x2c12a753, cc_prim_sub_env_mul__t0_inter_t1_using_enva_alpha__add_env},
+ // Arena, pokemon Stadium
+ // (t1-t0)*env_a+t0, (cmb-shade)*prim+0
+ {0x2c12e340, cc__t0_inter_t1_using_enva__sub_shade_mul_prim},
+ // Water in zora's place, zelda
+ // (t1-t0)*env_a+t0, (cmb-0)*prim+0
+ {0x2c12e3f0, cc__t0_inter_t1_using_enva__mul_prim},
+ // Ground, zelda
+ //z (t1-t0)*env_a+t0, (cmb-k5)*shade+cmb_a
+ {0x2c12e4f0, cc__t0_inter_t1_using_enva__mul_shade},
+ // zelda, uninmp log. Added by Gonetz
+ //(t1-t0)*env_a+t0, (cmb-0)*env+0
+ {0x2c12e5f0, cc__t0_inter_t1_using_enva__mul_env},
+ // Spheres, waverace
+ //z (env-t0)*env_a+t0
+ {0x2c152c15, cc_t0_inter_env_using_enva},//cc_t0},
+ // backgrounds, Mario Golf. Added by Gonetz
+ // (env-t0)*env_a+t0, (shade-0)*cmb+0
+ {0x2c15e0f4, cc__t0_inter_env_using_enva__mul_shade},
+ // ground on Volcano level, DKR, [Raziel64]
+ // (env-t0)*env_a+t0, (cmb-0)*shade+0
+ {0x2c15e4f0, cc__t0_inter_env_using_enva__mul_shade},
+ // Nintendo 'N', zelda
+ //z (t0-prim)*env_a+t0, (prim-env)*cmb+env
+ {0x2c31a053, cc_prim_sub_env_mul__t0_sub_prim_mul_enva_add_t0__add_env},
+ // Nintendo title & saria's song, zelda
+ //z (t1-prim)*env_a+t0, (prim-env)*cmb+env
+ {0x2c32a053, cc_prim_sub_env_mul__t1_sub_prim_mul_enva_add_t0__add_env},
+ // Hover boots flying, zelda
+ // (t1-prim)*env_a+t0, (prim-0)*cmb+env
+ {0x2c32a0f3, cc__t1_sub_prim_mul_enva_add_t0__mul_prim_add_env},
+ // star beam, paper mario
+ // (prim-env)*env_a+t0
+ {0x2c532c53, cc_prim_sub_env_mul_enva_add_t0},
+ // Kotake & koume's hair, zelda
+ // (t1-0)*env_a+t0, (prim-env)*cmb+env
+ {0x2cf2a053, cc_prim_sub_env_mul__t1_mul_enva_add_t0__add_env},
+ //Goldeneye, [Jeremy]. Added by Gonetz
+ // (t0-t0)*lodf+t0, (cmb-0)*prim+0
+ {0x2d11e3f0, cc_t0_mul_prim},
+ // Pilot wings
+ // (t1-t0)*lodf+t0, (one-cmb)*prim+cmb
+ {0x2d120306, cc_one_sub_prim_mul__t0_inter_t1_using_primlod__add_prim},
+ // Pilot wings
+ // (t1-t0)*lodf+t0, (one-cmb)*shade+cmb
+ {0x2d120406, cc_one_sub_shade_mul__t0_inter_t1_using_primlod__add_shade},
+ // Indy Racing 2000. Added by Gonetz
+ // (t1-t0)*lodf+t0, (env-cmb)*prima+cmb ** INC **
+ {0x2d120a05, cc_t0_inter_t1_using_primlod},
+ // (t1-t0)*lodf+t0
+ {0x2d122d12, cc_t0_inter_t1_using_primlod},
+ //broken wall, beetle adventure racing. Added by Gonetz
+ // (t1-t0)*lodf+t0, (shade-prim)*cmb+prim
+ {0x2d126034, cc_shade_sub_prim_mul__t0_inter_t1_using_primlod__add_prim},
+ //Intro, CBFD. Added by Gonetz
+ // (t1-t0)*lodf+t0, (shade-env)*cmb+prim
+ // {0x2d126054, cc_shade_sub_env_mul_t0_add_prim},
+ {0x2d126054, cc_shade_sub_env_mul__t0_inter_t1_using_primlod__add_prim},
+ // bassmasters 2000 [Ogy]
+ // (t1-t0)*lodf+t0, (env-0)*cmb+prim ** INC **
+ {0x2d1260f5, cc_t0_mul_env_add_prim},
+ // sign, CBFD. Added by Gonetz
+ // (t1-t0)*lodf+t0, (cmb-env)*shade+prim ** INC **
+ {0x2d126450, cc__t0_inter_t1_using_primlod__sub_env_mul_shade_add_prim},
+ // {0x2d126450, cc_t0_sub_env_mul_shade_add_prim},
+ // landscape, Cruis'n Exotica. Added by Gonetz
+ // (t1-t0)*lodf+t0, (cmb-0)*shade+prim
+ {0x2d1264f0, cc__t0_inter_t1_using_primlod__mul_shade_add_prim},
+ // blast corps [Ogy]
+ // (t1-t0)*lodf+t0, (0-0)*0+shade
+ {0x2d129fff, cc__t0_inter_t1_using_primlod__mul_shade},
+ // End of level, zelda
+ // (t1-t0)*lodf+t0, (prim-env)*cmb+env
+ {0x2d12a053, cc_prim_sub_env_mul__t0_inter_t1_using_primlod__add_env},
+ // Rocket Robot in Wheels intro
+ // (t1-t0)*lodf+t0, (shade-env)*cmb+env
+ {0x2d12a054, cc_shade_sub_env_mul__t0_inter_t1_using_primlod__add_env},
+ // basket, Fox Sport
+ // (t1-t0)*lodf+t0, (prim-env)*t0+env
+ {0x2d12a153, cc_prim_sub_env_mul__t0_inter_t1_using_primlod__add_env},
+ // paper mario. Added by Gonetz
+ // (t1-t0)*lodf+t0, (cmb-0)*prim+env ** INC **
+ {0x2d12a3f0, cc__t0_inter_t1_using_primlod__mul_prim_add_env},
+ // Tony Hawk Pro Skater
+ // (t1-t0)*lodf+t0, (cmb-0)*shade+env
+ {0x2d12a4f0, cc__t0_inter_t1_using_primlod__mul_shade_add_env},
+ // part of a building, Spiderman. Added by Gonetz
+ // (t1-t0)*lodf+t0, (cmb-env)*cmba+env ** INC **
+ {0x2d12a750, cc_t0_inter_t1_using_primlod},
+ // Mike Piazza's Strike Zone
+ // (t1-t0)*lodf+t0, (shade-prim)*cmb+0
+ {0x2d12e034, cc_shade_sub_prim_mul__t0_inter_t1_using_primlod},
+ // intro, F1 Racing Championship. Added by Gonetz
+ // (t1-t0)*lodf+t0, (shade-env)*cmb+0
+ {0x2d12e054, cc_shade_sub_env_mul__t0_inter_t1_using_primlod},
+ // stands, F1 Racing Championship. Added by Gonetz
+ // (t1-t0)*lodf+t0, (1-env)*cmb+0
+ {0x2d12e056, cc_one_sub_env_mul__t0_inter_t1_using_primlod},
+ // court, Mario Tennis. Added by Gonetz
+ // (t1-t0)*lodf+t0, (prim-0)*cmb+0
+ {0x2d12e0f3, cc__t0_inter_t1_using_primlod__mul_prim},
+ // Rocket Robot in Wheels intro
+ // (t1-t0)*lodf+t0, (shade-0)*cmb+0
+ {0x2d12e0f4, cc__t0_inter_t1_using_primlod__mul_shade},
+ // Pilot wings
+ // (t1-t0)*lodf+t0, (cmb-0)*t0+0 ** INC **
+ {0x2d12e1f0, cc_t0_inter_t1_using_primlod},
+ // cars wheels, SF Rush 2049. Added by Gonetz
+ // (t1-t0)*lodf+t0, (cmb-0)*prim+0
+ {0x2d12e3f0, cc__t0_inter_t1_using_primlod__mul_prim},
+ // Bridge, sf rush
+ // (t1-t0)*lodf+t0, (cmb-0)*shade+0
+ // {0x2d12e4f0, cc_t0_mul_shade},
+ {0x2d12e4f0, cc__t0_inter_t1_using_primlod__mul_shade},
+ // blast corps [Ogy]
+ // (t1-t0)*lodf+t0, (t0-0)*shade+0
+ {0x2d12e4f1, cc_t0_mul_shade},
+ // field, Mike Piazza's Strike Zone
+ // (t1-t0)*lodf+t0, (cmb-prim)*env+0 ** INC **
+ {0x2d12e530, cc__t0_inter_t1_using_primlod__mul_env},
+ // radar, Perfect Dark
+ // (t1-t0)*lodf+t0, (cmb-0)*env+0
+ {0x2d12e5f0, cc__t0_inter_t1_using_primlod__mul_env},
+ // planet, Blast Corps
+ // (t1-t0)*lodf+t0, (cmb-0)*prima+0
+ {0x2d12eaf0, cc__t0_inter_t1_using_primlod__mul_prima},
+ // zelda 2. Added by Gonetz
+ // (t0-t0)*primlod+t0, (prim-env)*cmb+env
+ {0x2e11a053, cc_prim_sub_env_mul_t0_add_env},
+ // zelda 2. Added by Gonetz
+ // (t1-t0)*primlod+t0, (0-0)*shade+cmb
+ {0x2e1204ff, cc_t0_inter_t1_using_primlod},
+ // zelda 2. Added by Gonetz
+ // (t1-t0)*primlod+t0, (env-prim)*primlod+cmb
+ {0x2e120d35, cc_prim_sub_env_mul_primlod_add__t0_inter_t1_using_primlod},
+ // lamppost, Ridge Racer. Added by Gonetz
+ // (t1-t0)*primlod+t0
+ {0x2e122e12, cc_t0_inter_t1_using_primlod},
+ // Hearts, zelda
+ //z (t1-t0)*primlod+t0, (shade-prim)*cmb+prim
+ {0x2e126034, cc_shade_sub_prim_mul__t0_inter_t1_using_primlod__add_prim},
+ // Sunny Day, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
+ // (t1-t0)*primlod+t0, (env-prim)*cmb+prim
+ {0x2e126035, cc_env_sub_prim_mul__t0_inter_t1_using_primlod__add_prim},
+ // snowhead temple, zelda 2. Added by Gonetz
+ // (t1-t0)*primlod+t0, (cmb-env)*shade+prim ** INC **
+ {0x2e126450, cc__t0_inter_t1_using_primlod__mul_shade_add_prim},
+ // snow on a wall, snowhead temple, zelda 2. Added by Gonetz
+ // (t1-t0)*primlod+t0, (cmb-0)*shade+prim
+ {0x2e1264f0, cc__t0_inter_t1_using_primlod__mul_shade_add_prim},
+ // Morning Sun, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
+ // (t1-t0)*primlod+t0, (cmb-0)*0+prim
+ {0x2e127ff0, cc_prim},
+ // arena, Pokemon Stadium 2. Added by Gonetz
+ // (t1-t0)*primlod+t0, (cmb-prim)*shade+shade ** INC **
+ {0x2e128430, cc__t0_inter_t1_using_primlod__mul_shade},
+ // Pokemon Stadium 2. Added by Gonetz
+ // (t1-t0)*primlod+t0, (cmb-env)*cmb+env ** INC **
+ {0x2e12a050, cc_t0_inter_t1_using_primlod},
+ // End of level heart, zelda
+ // (t1-t0)*primlod+t0, (prim-env)*cmb+env
+ {0x2e12a053, cc_prim_sub_env_mul__t0_inter_t1_using_primlod__add_env},
+ // Huge turtle appearance, zelda 2. Added by Gonetz
+ // (t1-t0)*primlod+t0, (1-env)*cmb+env
+ {0x2e12a056, cc_one_sub_env_mul__t0_inter_t1_using_primlod__add_env},
+ // frozen octorok, zelda 2. Added by Gonetz
+ // (t1-t0)*primlod+t0, (prim-env)*t1+env
+ {0x2e12a253, cc_prim_sub_env_mul_t1_add_env},
+ // fall headwaters, zelda 2. Added by Gonetz
+ // (t1-t0)*primlod+t0, (cmb-env)*shade+env ** INC **
+ {0x2e12a450, cc__t0_inter_t1_using_primlod__sub_env_mul_shade_add_env},
+ // Fissure attack, pokemon stadium 2
+ // (t1-t0)*primlod+t0, (prim-env)*cmb_a+env
+ {0x2e12a753, cc_prim_sub_env_mul__t0_inter_t1_using_primlod__add_env},
+ // zelda 2. Added by Gonetz
+ // (t1-t0)*primlod+t0, (cmb-0)*t1+0 ** INC ** ?
+ {0x2e12e2f0, cc_t0_inter_t1_using_primlod},
+ // zelda 2. Added by Gonetz
+ // (t1-t0)*primlod+t0, (cmb-0)*prim+0
+ {0x2e12e3f0, cc__t0_inter_t1_using_primlod__mul_prim},
+ // sky, PGA European Tour
+ // (t1-t0)*primlod+t0, (cmb-env)*shade+0 ** INC **
+ {0x2e12e450, cc__t0_inter_t1_using_primlod__mul_shade},
+ // Kirby's pool, smash bros
+ // (t1-t0)*primlod+t0, (cmb-0)*shade+0
+ {0x2e12e4f0, cc__t0_inter_t1_using_primlod__mul_shade},
+ //Spacestation Silicon Valley intro. Added by Gonetz
+ // (prim-t0)*primlod+t0, (cmb-0)*shade+0 **INC**
+ {0x2e132e13, cc_t0_inter_prim_using_primlod},
+ // explosions, daikatana. Added by Gonetz
+ // (prim-t0)*primlod+t0, (cmb-0)*shade+0 **INC**
+ {0x2e13e4f0, cc_t0_mul_shade},
+ //Mike Piazza's Strike Zone logo. Added by Gonetz
+ // (shade-t0)*primlod+t0
+ {0x2e142e14, cc_t0_inter_shade_using_primlod},
+ // Cartridge color (transfer pak}, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
+ // (1-t0)*primlod+t0
+ {0x2e162e16, cc_one_sub_t0_mul_primlod_add_t0},
+ // pokemon attack, Pokemon Stadium 2. Added by Gonetz
+ // (1-t0)*primlod+t0, (prim-0)*cmb+0
+ {0x2e16e0f3, cc__t0_inter_one_using_primlod__mul_prim},
+ // Spider Web attack, Pokemon Stadium 2.
+ // (1-t0)*primlod+t0, (cmb-0)*prim+0
+ {0x2e16e3f0, cc__t0_inter_one_using_primlod__mul_prim},
+ // pokemon attack, Pokemon Stadium 2. Added by Gonetz
+ // (1-t0)*primlod+t0, (cmb-0)*shade+0
+ {0x2e16e4f0, cc__t0_inter_one_using_primlod__mul_shade},
+ // zelda 2. Added by Gonetz
+ // (t1-t1)*primlod+t0, (prim-env)*cmb+env
+ {0x2e22a053, cc_prim_sub_env_mul_t0_add_env},
+ // Shadow Ball, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
+ // (0-t1)*primlod+t0, (prim-env)*cmb+env ** INC **
+ {0x2e2fa053, cc_prim_sub_env_mul_t0_add_env},
+ // Skulltula coin solid, zelda
+ // (t0-prim)*primlod+t0, (prim-env)*cmb+env
+ {0x2e31a053, cc_prim_sub_env_mul__t0_sub_prim_mul_primlod_add_t0__add_env},
+ // Triforce lines, zelda
+ // (t1-prim)*primlod+t0, (prim-shade)*cmb+shade
+ {0x2e328043, cc_prim_sub_shade_mul__t1_sub_prim_mul_primlod_add_t0__add_shade},
+ // moon when majora defeated, zelda 2. Added by Gonetz
+ // (t1-prim)*primlod+t0, (1-shade)*cmb+shade
+ {0x2e328046, cc_one_sub_shade_mul__t1_sub_prim_mul_primlod_add_t0__add_shade},
+ // Fire, zelda
+ //z (t1-prim)*primlod+t0, (prim-env)*cmb+env ** INC **
+ {0x2e32a053, cc_prim_sub_env_mul__t1_sub_prim_mul_primlod_add_t0__add_env},
+ // zelda 2 [Ogy]. Added by Gonetz
+ // (t1-prim)*primlod+t0, (shade-env)*cmb+env
+ {0x2e32a054, cc_shade_sub_env_mul__t1_sub_prim_mul_primlod_add_t0__add_env},
+ // Scary face, pokemon stadium 2
+ // (t1-prim)*primlod+t0, (1-env)*cmb+env
+ {0x2e32a056, cc_one_sub_env_mul__t1_sub_prim_mul_primlod_add_t0__add_env},
+ // zelda 2. Added by Gonetz
+ // (t1-prim)*primlod+t0, (prim-0)*cmb+env
+ {0x2e32a0f3, cc__t1_sub_prim_mul_primlod_add_t0__mul_prim_add_env},
+ // zelda 2. Added by Gonetz
+ // (t1-0)*primlod+t0, (prim-env)*cmb+env
+ {0x2ef2a053, cc_prim_sub_env_mul__t1_mul_primlod_add_t0__add_env},
+ // zelda 2. Added by Gonetz
+ // (t1-0)*primlod+t0, (cmb-0)*prim+0
+ {0x2ef2e3f0, cc__t1_mul_primlod_add_t0__mul_prim},
+ // zelda 2. Added by Gonetz
+ // (t1-0)*primlod+t0, (cmb-0)*env+0
+ {0x2ef2e5f0, cc__t1_mul_primlod_add_t0__mul_env},
+ // gun, Doom64. Added by Gonetz
+ // (1-0)*primlod+t0, (cmb-0)*prim+env
+ {0x2ef6a3f0, cc__t0_add_primlod__mul_prim_add_env},
+ // walls, Doom64. Added by Gonetz
+ // (1-0)*primlod+t0, (cmb-0)*shade+env
+ {0x2ef6a4f0, cc__t0_add_primlod__mul_shade_add_env},
+ // Pokemon Stadium 2. Added by Gonetz
+ // (noise-0)*primlod+t0, (prim-env)*cmb+env ** INC **
+ {0x2ef7a053, cc_prim_sub_env_mul_t0_add_env},
+ // Tony Hawk's Pro Skater. Added by Gonetz
+ // (t1-t0)*k5+t0
+ {0x2f122f12, cc_t0_inter_t1_using_k5},
+ // F1 World Grand Prix. Added by Gonetz
+ // (t1-t0)*k5+t0, (cmb-0)*shade+0 **INC**
+ {0x2f12e4f0, cc__t0_inter_t1_using_k5__mul_shade},
+ // Turok 3 [scorpiove]. Added by Gonetz
+ // (t0-k4)*k5+t0
+ {0x2f712f71, cc_t0},
+ // THPS 3
+ // (env-0)*k5+t0,
+ {0x2ff52ff5, cc_t0_add_env_mul_k5},
+ // super bowling
+ // (0-0)*k5+t0,
+ {0x2fff0000, cc_t0},
+ // super bowling
+ // (0-0)*k5+t0
+ {0x2fff2fff, cc_t0},
+ // Moonlight attack, pokemon stadium 2
+ // (t1-t0)*0+t0, (prim-env)*cmb+env
+ {0x3f12a053, cc_prim_sub_env_mul_t0_add_env},
+ //C&C shadows
+ //(1-env)*0+t0
+ {0x3f563f56, cc_t0},
+ // RARE logo, blast corps. Added by Gonetz
+ // (t0-0)*0+t0
+ {0x3ff13ff1, cc_t0},
+ // the ground below the scarecrow in the trading post in town, zelda 2 [Ogy]. Added by Gonetz
+ // (t1-0)*0+t0, (cmb-0)*shade+0
+ {0x3ff2e4f0, cc_t0_mul_shade},
+ // intro, background, Dezaemon 3D
+ // (1-0)*0+t0
+ {0x3ff63ff6, cc_t0},
+ // intro of WWF WrestleMania 2000
+ // ((0-0)*0+t0, (env-cmb)*prim+cmb
+ {0x3fff0305, cc_env_sub_t0_mul_prim_add_t0},
+ // pistol fire, Turok
+ // ((0-0)*0+t0, (env-cmb)*shade+cmb
+ {0x3fff0405, cc_env_sub_t0_mul_shade_add_t0},
+ // Tony Hawk's Pro Skater. Added by Gonetz
+ // ((0-0)*0+t0, (t1-0)*shade+cmb ** INC **
+ {0x3fff04f2, cc_t0},
+ // Dr. Mario [Ogy]. Added by Gonetz
+ // ((0-0)*0+t0, (prim-cmb)*env+cmb
+ {0x3fff0503, cc_prim_sub_t0_mul_env_add_t0},
+ // Stained glass, quest64
+ // (0-0)*0+t0, (1-0)*env+cmb
+ {0x3fff05f6, cc_t0_add_env},
+ // Health bar, killer instinct gold
+ // (0-0)*0+t0, (prim-env)*prim_a+cmb
+ {0x3fff0a53, cc_prim_sub_env_mul_prima_add_t0},
+ // Runes, Turok - Dinosaur Hunter. Added by Gonetz
+ // (0-0)*0+t0, (env-cmb)*env_a+cmb
+ {0x3fff0c05, cc_t0_inter_env_using_enva},
+ // intro, Mission Impossible. Added by Gonetz
+ // (k5-k5)*0+t0, (0-0)*scale+t0
+ {0x3fff26ff, cc_t0},
+ // V8-2
+ // (0-0)*0+t0, (t0-k4)*k5+t0
+ {0x3fff2f71, cc_t0_sub_k4_mul_k5_add_t0},
+ // TM, mario
+ //z (k5-k5)*0+t0
+ {0x3fff3fff, cc_t0},
+ // Intro, CBFD. Added by Gonetz
+ // ((0-0)*0+t0, (shade-env)*cmb+prim
+ {0x3fff6054, cc_shade_sub_env_mul_t0_add_prim},
+ // Text, Mia Soccer. Added by Gonetz
+ // ((0-0)*0+t0, (0-0)*0+prim
+ {0x3fff7fff, cc_t0},
+ // paper mario. Added by Gonetz
+ // ((0-0)*0+t0, (prim-env)*cmb+env
+ {0x3fffa053, cc_prim_sub_env_mul_t0_add_env},
+ // Objects in arena, pokemon stadium 2
+ // (0-0)*0+t0, (cmb-prim)*shade+env
+ {0x3fffa430, cc_t0_mul_prim},
+ // intro, F1 Racing Championship. Added by Gonetz
+ // (0-0)*0+t0, (shade-env)*cmb+0
+ {0x3fffe054, cc_shade_sub_env_mul_t0},
+ // stands, F1 Racing Championship. Added by Gonetz
+ // (0-0)*0+t0, (1-env)*cmb+0
+ {0x3fffe056, cc_one_sub_env_mul_t0},
+ // ? (from log)
+ // (0-0)*0+t0, (prim-0)*cmb+0
+ {0x3fffe0f3, cc_t0_mul_prim},
+ // background, GASP Fighters
+ // (0-0)*0+t0, (shade-0)*cmb+0
+ {0x3fffe0f4, cc_t0_mul_shade},
+ // zelda 2 [Ogy]. Added by Gonetz
+ // (0-0)*0+t0, (env-0)*cmb+0
+ {0x3fffe0f5, cc_t0_mul_env},
+ // logo, v-rally 99
+ // (0-0)*0+t0, (prim-0)*t0+0
+ {0x3fffe1f3, cc_t0_mul_prim},
+ // target hit, zelda 2. Added by Gonetz
+ // (0-0)*0+t0, (cmb-0)*prim+0
+ {0x3fffe3f0, cc_t0_mul_prim},
+ // Ms. Pac-Man intro background. Added by Gonetz
+ // (0-0)*0+t0, (cmb-0)*shade+0
+ {0x3fffe4f0, cc_t0_mul_shade},
+ // Wonder Project J2 logo. Added by Gonetz
+ // (0-0)*0+t0, (t0-0)*shade+0
+ {0x3fffe4f1, cc_t0_mul_shade},
+ // tire trace, Monster truck madness. Added by Gonetz
+ // (0-0)*0+t0, (cmb-0)*env+0
+ {0x3fffe5f0, cc_t0_mul_env},
+ // Gauntlet Legends intro. Added by Gonetz
+ // (0-0)*0+t0, (cmb-0)*ecale+0
+ {0x3fffe6f0, cc_t0},
+ // tire trace, beetle adventure racing. Added by Gonetz
+ // (t1-t0)*t0+t1, (cmb-t0)*shade+t1 **INC**
+ {0x41124410, cc__t0_inter_t1_using_t0__mul_shade},
+ // Paper Mario. Added by Gonetz
+ // (t0-t1)*t0+t1 **INC**
+ {0x41214121, cc_t1_inter_t0_using_t0},
+ // Powered Star Beam, Paper Mario. Added by Gonetz
+ // (t0-t1)*t0+t1, (env-prim)*cmb+prim **INC**
+ {0x41216035, cc_env_sub_prim_mul__t1_inter_t0_using_t0__add_prim},
+ // wetrix raiseland [Raziel64]. Added by Gonetz
+ // (prim-t1)*t0+t1, (env-t0)*cmb+cmb **INC**
+ {0x41230015, cc_env_sub_prim_mul__t0_mul_t1__add_prim},
+ // SCARS. Added by Gonetz
+ // (t1-t0)*t0+t1, (cmb-t0)*shade+t1 **INC**
+ {0x41250b03, cc__t0_inter_t1_using_half__mul_shade},
+ //beetle adventure racing. Added by Gonetz
+ //(t0-t1)*t1+t1, (cmb-0)*shade+0 **INC**
+ {0x4221e4f0, cc__t1_inter_t0_using_t1__mul_shade},
+ // cianwood gym walls, pokemon stadium 2
+ //(t0-prim)*t1+t1, (cmb-0)*env+shade
+ {0x423185f0, cc__t0_sub_prim_mul_t1_add_t1__mul_env_add_shade},
+ // cianwood gym walls, pokemon stadium 2
+ //(t0-prim)*t1+t1, (cmb-0)*shade+0
+ {0x4231e4f0, cc__t0_sub_prim_mul_t1_add_t1__mul_shade},
+ // paper mario. Added by Gonetz
+ // (t0-t0)*prim+t1, (t1-cmb)*cmb+env **INC** weird
+ {0x4311a002, cc_env},
+ // background, Wetrix level 1, [Raziel64]. Added by Gonetz
+ // (t0-t1)*prim+t1
+ {0x43214321, cc_t1_inter_t0_using_prim},
+ // Mario Party3 Tidal Toss
+ // (t0-t1)*prim+t1, (cmb-0)*shade+0 **INC**
+ {0x4321e4f0, cc__t1_inter_t0_using_prim__mul_shade},
+ // grass, ISS 2k. Added by Gonetz
+ // (t0-t1)*prim+t1, (cmb-0)*env+0 **INC**
+ {0x4321e5f0, cc__t1_inter_t0_using_prim__mul_env},
+ // intro, Paper Mario
+ // (t0-0)*prim+t1
+ {0x43f143f1, cc_t0_mul_prim_add_t1},
+ // F1 World Grand Prix. Added by Gonetz
+ // (t0-0)*prim+t1, (cmb-0)*shade+env **INC**
+ {0x43f1a4f0, cc__t0_add_t1__mul_shade_add_env},
+ // field, ISS64. Added by Gonetz
+ // (t0-t1)*shade+t1, (cmb-t1)*prim+t1 ** INC **
+ {0x44214320, cc_t0_sub_t1_mul_prim_mul_shade_add_t1},
+ // {0x44214320, cc__t0_add_t1__mul_prim},
+ // field, Top gear hyper-bike
+ // (t0-t1)*shade+t1
+ {0x44214421, cc_t1_inter_t0_using_shade},
+ // water, goemon great adventure
+ // (t0-t1)*env+t1 ** INC **
+ {0x45214521, cc_t1_inter_t0_using_env},
+ // characters, Ogre Battle. Added by Gonetz
+ // (1-t1)*env+t1, (1-cmb)*prim+cmb ** INC **
+ {0x45260306, cc_one_sub_t1_mul_prim_add_t1},
+ // characters, Ogre Battle. Added by Gonetz
+ // (1-t1)*env+t1
+ {0x45264526, cc_one_sub_t1_mul_env_add_t1},
+ // characters, Ogre Battle. Added by Gonetz
+ // (1-t1)*env+t1, (cmb-0)*prim+0 ** INC **
+ {0x4526e3f0, cc__t1_inter_one_using_env__mul_prim},
+ // explosion, body harvest. Added by Gonetz
+ // (t0-t1)*scale+t1, (env-prim)*cmb+prim ** INC **
+ {0x46216035, cc_env_sub_prim_mul__t0_inter_t1_using_half__add_prim},
+ // Water, AeroGauge. Added by Gonetz
+ // (t0-t1)*prima+t1, (0-0)*0+cmb
+ {0x4a214a21, cc_t1_inter_t0_using_prima},
+ // flame, castlevania 2. Added by Gonetz
+ // (t0-t1)*prima+t1, (prim-env)*cmb+env
+ {0x4a21a053, cc_prim_sub_env_mul__t1_inter_t0_using_prima__add_env},
+ // shadows, Mario Tennis. Added by Gonetz
+ // (t0-t1)*prima+t1, (prim-0)*cmb+0
+ {0x4a21e0f3, cc__t1_inter_t0_using_prima__mul_prim},
+ // menu, Mario Golf. Added by Gonetz
+ // (t0-t1)*prima+t1, (shade-0)*cmb+0
+ {0x4a21e0f4, cc__t1_inter_t0_using_prima__mul_shade},
+ // intro, castlevania 2. Added by Gonetz
+ // (t0-t1)*prima+t1, (cmb-0)*prim+0
+ {0x4a21e3f0, cc__t1_inter_t0_using_prima__mul_prim},
+ // water on map, Ogre Battle64. Added by Gonetz
+ // (t0-t1)*prima+t1, (cmb-0)*shade+0
+ {0x4a21e4f0, cc__t1_inter_t0_using_prima__mul_shade},
+ // Ice, Paper Mario
+ // (t0-t1)*shade_a+t1
+ {0x4b214b21, cc_t1_inter_t0_using_shadea},
+ // Grass, Beetle Adventure Racing
+ // (t0-t1)*shade_a+t1, (cmb-0)*shade+0
+ {0x4b21e4f0, cc__t1_inter_t0_using_shadea__mul_shade},
+ // Ground at kotake & koume, zelda
+ // (t1-t0)*env_a+t0, (prim-env)*cmb+env
+ {0x4c12a053, cc_prim_sub_env_mul__t0_inter_t1_using_enva__add_env},
+ // Tony Hawk's Pro Skater. Added by Gonetz
+ // (t0-t1)*env_a+t1, (cmb-0)*shade+cmb ** INC **
+ {0x4c2104f0, cc__t1_inter_t0_using_enva__mul_shade},
+ // bikes, xg2. Added by Gonetz
+ // (t0-t1)*env_a+t1, (cmb-prim)*prima+prim
+ {0x4c216a30, cc__t1_inter_t0_using_enva__sub_prim_mul_prima_add_prim},
+ // Yoshi Story
+ // (t0-t1)*env_a+t1, (prim-env)*cmb+env
+ {0x4c21a053, cc_prim_sub_env_mul__t1_inter_t0_using_enva__add_env},
+ // arena, Pokemon Stadium 1. Added by Gonetz
+ // (t0-t1)*env_a+t1, (cmb-0)*prim+0
+ {0x4c21e3f0, cc__t1_inter_t0_using_enva__mul_prim},
+ // "end of chapter" text, paper mario. Added by Gonetz
+ // (1-t1)*env_a+t1, (cmb-0)*t1+0
+ {0x4c26e2f0, cc__t1_inter_one_using_enva__mul_t0},
+ // Zelda opening door, zelda
+ // (t0-prim)*env_a+t1, (prim-env)*t0+env
+ {0x4c31a053, cc_prim_sub_env_mul_t0_add_env},
+ // arena, Pokemon Stadium 2
+ // (t0-0)*env_a+t1, (cmb-0)*shade+prim
+ {0x4cf164f0, cc__t0_mul_enva_add_t1__mul_shade_add_prim},
+ // Kotake & koume magic poof, zelda
+ // (t0-0)*env_a+t1, (prim-env)*cmb+env
+ {0x4cf1a053, cc_prim_sub_env_mul__t0_mul_enva_add_t1__add_env},
+ // ground in stone temple, zelda 2. Added by Gonetz
+ // (t1-t0)*primlod+t1, (cmb-0)*prim+0
+ {0x4e12e3f0, cc__t0_inter_t1_using_primlod__mul_prim},
+ // pokemon attack, Pokemon Stadium 2. Added by Gonetz
+ // (noise-t0)*primlod+t1, (prim-env)*cmb+env ** INC **
+ {0x4e17a053, cc_prim_sub_env_mul__t0_inter_t1_using_primlod__add_env},
+ // menu, pokemon stadium 1, [Raziel64]
+ // (t0-t1)*lodf+t1, (prim-env)*cmb+env
+ {0x4e214e21, cc_t1_inter_t0_using_primlod},
+ // Pokemon backgrounds, pokemon stadium 2
+ // (t0-t1)*primlod+t1, (cmb-0)*shade+prim
+ {0x4e2164f0, cc__t1_inter_t0_using_primlod__mul_shade_add_prim},
+ // Pokemon backgrounds, pokemon stadium 2
+ // (t0-t1)*lodf+t1, (prim-env)*cmb+env
+ {0x4e21a053, cc_prim_sub_env_mul__t1_inter_t0_using_primlod__add_env},
+ // zelda 2 [Ogy]. Added by Gonetz
+ // (t0-t1)*primlod+t1, (t1-cmb)*prim+env ** INC **
+ {0x4e21a302, cc_env_sub__t0_sub_t1_mul_primlod__mul_prim},
+ // Magnitude, pokemon stadium 2
+ // (t0-t1)*primlod+t1, (prim-env)*cmb_a+env
+ {0x4e21a753, cc_prim_sub_env_mul__t1_inter_t0_using_primlod__add_env},
+ // Arena, pokemon stadium 2
+ // (t0-t1)*primlod+t1, (cmb-shade)*prim+0
+ {0x4e21e340, cc__t1_inter_t0_using_primlod__sub_shade_mul_prim},
+ // zelda 2 [Ogy]. Added by Gonetz
+ // (t0-t1)*primlod+t1, (cmb-0)*shade+0
+ {0x4e21e4f0, cc__t1_inter_t0_using_primlod__mul_shade},
+ // lava in snowhead temple, zelda 2. Added by Gonetz
+ // (t0-prim)*primlod+t1, (cmb-prim)*shade+cmb ** INC **
+ {0x4e310430, cc_lavatex_sub_prim_mul_shade_add_lavatex},
+ // Skulltula coin, zelda
+ // (t0-prim)*primlod+t1, (prim-env)*cmb+env
+ {0x4e31a053, cc_prim_sub_env_mul__t0_sub_prim_mul_primlod_add_t1__add_env},
+ // Pokemon background, pokemon stadium 2
+ // (noise-shade)*primlod+t1, (prim-env)*cmb+env
+ {0x4e47a053, cc_prim_sub_env_mul_t1_add_env},
+ // Reflect, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
+ // (t0-0)*primlod+t1, (prim-env)*cmb+env
+ {0x4ef1a053, cc_prim_sub_env_mul__t0_add_t1__add_env},
+ //beetle adventure racing. Added by Gonetz
+ //(t0-t1)*k5+t1, (cmb-0)*shade+0
+ {0x4f21e4f0, cc__t1_inter_t0_using_k5__mul_shade},
+ // Spiderman. Added by Gonetz
+ //(t0-t1)*k5+t1, (cmb-0)*env+0
+ {0x4f21e5f0, cc_t1_mul_env},
+ // N64 logo, Ogre Battle. Added by Gonetz
+ //(0-0)*0+t1
+ {0x5fff5fff, cc_t1},
+ // reversing light, Monster truck madness. Added by Gonetz
+ //(0-0)*0+t0, (0-0)*0+prim
+ {0x5fff7fff, cc_prim},
+ // battle tanks [Ogy]
+ // (0-0)*0+t1, (env-shade)*cmb+shade
+ {0x5fff8045, cc_env_sub_shade_mul_t1_add_shade},
+ // minigame, pokemon stadium 1. Added by Gonetz
+ // (0-0)*0+t1, (prim-env)*cmb+env
+ {0x5fffa053, cc_prim_sub_env_mul_t1_add_env},
+ // F1 World Grand Prix. Added by Gonetz
+ // (t0-prim)*t0+prim, (cmb-0)*shade
+ {0x6131e4f0, cc__prim_inter_t0_using_t0__mul_shade},
+ // aerofighter's assault [Ogy]
+ // (shade-prim)*t0+prim
+ {0x61346134, cc_shade_sub_prim_mul_t0_add_prim},
+ // pilot wings
+ // (shade-prim)*t0+prim, (cmb-shade)*shadea+shade
+ {0x61348b40, cc_shade_inter__prim_inter_shade_using_t0__using_shadea},
+ // club blow, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
+ // (shade-prim)*t0+prim, (cmb-env)*cmb_a+env ** INC **
+ {0x6134a750, cc_shade_sub_prim_mul_t0_add_prim},
+ // sky, Killer Instinct
+ // (shade-prim)*t0+prim, (cmb-env)*shade_a+env ** INC **
+ {0x6134ab50, cc_env_inter__prim_inter_shade_using_t0__using_shadea},
+ // lava, beetle adventure racing
+ // (shade-prim)*t0+prim, (cmb-0)*t1+0 ** INC **
+ {0x6134e2f0, cc_shade_sub_prim_mul_t0_add_prim},
+ // Monster truck madness intro. Added by Gonetz
+ // (env-prim)*t0+prim, (cmb-0)*scale+cmb ** INC **
+ {0x613506f0, cc_env_sub_prim_mul_t0_add_prim},
+ // pokemon attack, Pokemon stadium 1
+ // (env-prim)*t0+prim, (cmb-0)*0+cmb
+ {0x61351ff0, cc_env_sub_prim_mul_t0_add_prim},
+ // Paper Mario, fortune teller spheres
+ // (env-prim)*t0+prim, (cmb-0)*t1+t0 ** INC **
+ {0x613522f0, cc_t0_mul_t1_add_t0},
+ // Later hearts, zelda
+ // (env-prim)*t0+prim
+ {0x61356135, cc_env_sub_prim_mul_t0_add_prim},
+ // Mission Impossible. Added by Gonetz
+ // (env-prim)*t0+prim, (shade-0)*cmb+0 ** INC **
+ {0x6135e0f4, cc__prim_inter_env_using_t0__mul_shade},
+ // crashing other vehicle, Monster truck madness [Raziel64]. Added by Gonetz
+ // (env-prim)*t0+prim, (cmb-0)*t0+0 ** INC **
+ {0x6135e1f0, cc_env_sub_prim_mul_t0_add_prim},
+ // Tony Hawk's Pro Skater. Added by Gonetz
+ // (env-prim)*t0+prim, (cmb-0)*t1+0 ** INC **
+ {0x6135e2f0, cc_env_sub_prim_mul_t0_add_prim},
+ // aerofighter's assault [Ogy]
+ // (env-prim)*t0+prim, (cmb-0)*shade+0 ** INC **
+ {0x6135e4f0, cc__prim_inter_env_using_t0__mul_shade},
+ // "time out", paper mario. Added by Gonetz
+ // (1-prim)*t0+prim, (1-cmb)*enva+cmb ** INC **
+ {0x61360c06, cc_one_sub_prim_mul_t0_add_prim},
+ // intro, paper mario. Added by Gonetz
+ // (1-prim)*t0+prim, (cmb-0)*prima+t0 ** INC **
+ {0x61362af0, cc__one_sub_prim_mul_t0_add_prim__mul_prima_add__one_sub_prim_mul_t0_add_prim},
+ // paper mario. Added by Gonetz
+ // (1-prim)*t0+prim
+ {0x61366136, cc_one_sub_prim_mul_t0_add_prim},
+ // arena, Pokemon Stadium 2. Added by Gonetz
+ // (1-prim)*t0+prim, (cmb-env)*shade+shade ** INC **
+ {0x61368450, cc_t0_mul_shade},
+ // F1 World Grand Prix. Added by Gonetz
+ // (1-prim)*t0+prim, (cmb-0)*shade+0 ** INC **
+ {0x6136e4f0, cc_t0_mul_shade},
+ // Xena. Added by Gonetz
+ // (0-prim)*t0+prim
+ {0x613f613f, cc_one_sub_t0_mul_prim},
+ // Kirby64 end [Raziel64]. Added by Gonetz
+ // (prim-env)*t0+prim
+ {0x61536153, cc_prim_sub_env_mul_t0_add_prim},
+ // Xena. Added by Gonetz
+ // (shade-env)*t0+prim
+ {0x61546154, cc_shade_sub_env_mul_t0_add_prim},
+ // Karts, mario kart
+ //z (one-env)*t0+prim
+ {0x61566156, cc_t0_mul_1menv_add_prim},
+ // Famista64. Added by Gonetz
+ //(t0-0)*t0+prim
+ {0x61f161f1, cc_t0_mul_prim},
+ // Pokemon Stadium 2. Added by Gonetz
+ //(shade-0)*t0+prim
+ {0x61f461f4, cc_t0_mul_shade_add_prim},
+ // Doom. Added by Gonetz
+ //(1-0)*t0+prim
+ {0x61f661f6, cc_t0_add_prim},
+ // tire trace, beetle adventure racing. Added by Gonetz
+ // (shade-prim)*t1+prim, (cmb-0)*t1+0 **INC**
+ {0x6234e2f0, cc_shade_sub_prim_mul_t1_add_prim},
+ // Text, turok
+ // (env-prim)*t1+prim
+ {0x62356235, cc_env_sub_prim_mul_t1_add_prim},
+ // Pokemon Stadium 2, [gokuss4]. Added by Gonetz
+ // (env-prim)*t1+prim, (cmb-0)*t1+0
+ // Hack alert!
+ {0x6235e2f0, cc_t1},
+ // bike trace, xg2 intro. Added by Gonetz
+ // (1-prim)*t1+prim
+ {0x62366236, cc_one_sub_prim_mul_t1_add_prim},
+ // aerofighter's assault [Ogy]
+ // (1-prim)*t1+prim, (cmb-0)*0+env
+ {0x6236bff0, cc_one_sub_prim_mul_t1_add_prim},
+ // Tennis court, mario tennis
+ // (t0-0)*t1+prim
+ {0x62f162f1, cc__t0_mul_t1__add_prim},
+ // Arena, Pokemon Stadium 2
+ // (t0-0)*t1+prim, (cmb-0)*shade+0
+ {0x62f1e4f0, cc__t0_mul_t1_add_prim__mul_shade},
+ // Rush2. Added by Gonetz
+ // (prim-prim)*prim+prim
+ {0x63336333, cc_prim},
+ //Bowser in final battle, Paper Mario. Added by Gonetz
+ // (t1-0)*prim+prim
+ {0x63f263f2, cc_t1_mul_prim_add_prim},
+ // wetrix, icelayer, [Raziel64]. Added by Gonetz
+ // (t0-prim)*shade+prim ** INC **
+ {0x64316431, cc_t0_mul_shade},
+ // KI. Added by Gonetz
+ // (env-prim)*shade+prim
+ {0x64356435, cc_env_sub_prim_mul_shade_add_prim},
+ // xg2. Added by Gonetz
+ // (1-prim)*shade+prim, (t0-0)*cmb+0 ** INC **
+ {0x6436e0f1, cc_t1_mul__one_sub_prim_mul_shade_add_prim},
+ // Intro, CBFD. Added by Gonetz
+ // (t0-env)*shade+prim
+ {0x64516451, cc_t0_sub_env_mul_shade_add_prim},
+ // sword in final battle, zelda 2. Added by Gonetz
+ // (t0-env)*shade+prim, (cmb-0)*shade+0 ** INC **
+ {0x6451e4f0, cc__t0_sub_env_mul_shade_add_prim__mul_shade},
+ // attack, Pokemon Stadium 2.
+ // (t0-env)*shade+prim, (cmb-0)*shade_a+0 ** INC **
+ {0x6451ebf0, cc__t0_sub_env_mul_shade_add_prim__mul_shadea},
+ // Road Rush. Added by Gonetz
+ // (t0-0)*shade+prim
+ {0x64f164f1, cc_t0_mul_shade_add_prim},
+ // paper mario. Added by Gonetz
+ // (1-0)*shade+prim
+ {0x64f664f6, cc_prim_add_shade},
+ // Character select, smash bros
+ // (t0-prim)*env+prim
+ {0x65316531, cc_t0_sub_prim_mul_env_add_prim},
+ // Clear screen intro, banjo kazooie
+ // (t0-prim)*env+prim, (cmb-0)*shade+0
+ // {0x6531e4f0, cc_t0_mul_env_mul_shade},
+ {0x6531e4f0, cc__prim_inter_t0_using_env__mul_shade},
+ // Dragonfly feet, banjo kazooie
+ // (1-prim)*env+prim, (cmb-0)*shade+0
+ {0x6536e4f0, cc__prim_inter_one_using_env__mul_shade},
+ // Lava piranha atack, Paper Mario
+ // (t1-k4)*env+prim ** INC **
+ {0x65726572, cc_t1_mul_env_add_prim},
+ // zelda 2 [Ogy]. Added by Gonetz
+ // (t0-0)*env+prim, (1-t1)*t0a+cmb ** INC **
+ {0x65f10826, cc_one_sub_t1_mul_t0a_add_t0_mul_env_add_prim},
+ // clocks while warping through time, zelda 2
+ // (t0-0)*env+prim, (cmb-0)*0+cmb
+ {0x65f11ff0, cc_t0_mul_env_add_prim},
+ // Helicopter, Nuclear Strike. Added by Gonetz
+ // (t0-0)*env+prim
+ {0x65f165f1, cc_t0_mul_env_add_prim},
+ // Mystical Ninja
+ // (1-0)*env+prim
+ {0x65f665f6, cc_prim_add_env},
+ // duke nukem: zero hour [Ogy]
+ // (noise-0)*env+prim ** INC **
+ {0x65f765f7, cc_prim_add_env},
+ // "terminator", CBFD
+ // (0-0)*env+prim
+ {0x65ff65ff, cc_prim},
+ // Cliffs, Taz express. Added by Gonetz
+ // (t0-0)*scale+prim
+ {0x66f166f1, cc_t0_mul_scale_add_prim},
+ // Taz express. Added by Gonetz
+ // (t0-0)*scale+prim, (cmb-0)*shade+0
+ {0x66f1e4f0, cc_t0_mul_scale_add_prim__mul_shade},
+ // NFL Quarterback Club 98 Menu [CpUMasteR]
+ // (prim-0)*scale+prim
+ {0x66f366f3, cc_prim},
+ // Pikachu
+ // (t0-prim)*t0_a+prim, (env-cmb)*enva+cmb
+ {0x68310c05, cc__prim_inter_t0_using_t0a__inter_env_using_enva},
+ // Character, dual heroes
+ // (t0-prim)*t0_a+prim
+ {0x68316831, cc_t0_sub_prim_mul_t0a_add_prim},
+ // Indy Racing 2000. Added by Gonetz
+ // (t0-prim)*t0_a+prim, (cmb-0)*shade+0 ** INC **
+ {0x6831e4f0, cc__prim_inter_t0_using_t0a__mul_shade},
+ // text, Sin and Punishmen. Added by Gonetz
+ // (env-prim)*t0_a+prim ** INC **
+ {0x68356835, cc_env_sub_prim_mul_t0a_add_prim},
+ // arena, Pokemon Stadium 2
+ // (1-prim)*t0_a+prim
+ {0x68366836, cc_one_sub_prim_mul_t0a_add_prim},
+ // menu, PD. Added by Gonetz
+ // (env-prim)*t1_a+prim
+ {0x69356935, cc_env_sub_prim_mul_t1a_add_prim},
+ // {0x69356935, cc_t1},
+ //xg2. Added by Gonetz
+ // (t0-prim)*prima+prim
+ {0x6a316a31, cc_t0_sub_prim_mul_prima_add_prim},
+ // menu, battle phoenix 64. Added by Gonetz
+ // (env-prim)*prima+prim
+ {0x6a356a35, cc_env_sub_prim_mul_prima_add_prim},
+ // ground, KI. Added by Gonetz
+ // (shade-env)*prima+prim
+ {0x6a546a54, cc_shade_sub_env_mul_prima_add_prim},
+ // F1 World Grand Prix. Added by Gonetz
+ // (t0-0)*prima+prim, (shade-0)*cmb+env **INC**
+ {0x6af1a0f4, cc__t0_mul_prima_add_prim_mul__shade_add_env},
+ //broken wall, beetle adventure racing. Added by Gonetz
+ // (t0-0)*prima+prim, (cmb-0)*shade+0 **INC**
+ {0x6af1e4f0, cc__t0_mul_prima_add_prim_mul__shade},
+ // Genie, diddy kong racing
+ // (t0-prim)*shade_alpha+prim, (env-cmb)*shade+cmb
+ // {0x6b310405, cc_env_sub__prim_inter_t0_using_shadea__mul_shade_add_env},
+ {0x6b310405, cc_t0_mul_shadea},
+ // Extreme G. Added by Gonetz
+ // (t0-prim)*shade_alpha+prim ** INC **
+ {0x6b316b31, cc_t0_sub_prim_mul_shadea_add_prim},
+ // water block, Paper Mario. Added by Gonetz
+ // (t0-prim)*shade_alpha+prim, (prim-env)*cmb+env ** INC **
+ {0x6b31a053, cc_prim_sub_env_mul__prim_inter_t0_using_shadea__add_env},
+ // water, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
+ // (t0-prim)*shade_alpha+prim, (cmb-0)*shade+0 ** INC **
+ {0x6b31e4f0, cc__prim_inter_t0_using_shadea__mul_shade},
+ // F1 World Grand Prix sky. Added by Gonetz
+ // (env-prim)*shade_alpha+prim, (shade-cmb)*cmb_a+cmb ** INC **
+ {0x6b350704, cc_f1_sky},
+ // lullaby, Paper Mario. Added by Gonetz
+ // (env-prim)*shade_alpha+prim
+ {0x6b356b35, cc_env_sub_prim_mul_shadea_add_prim},
+ // Some gannon spell, zelda
+ // (noise-t0)*env_a+prim, (0-prim)*cmb+1 ** INC **
+ {0x6c17c03f, cc_one_sub__one_sub_t0_mul_enva_add_prim__mul_prim},
+ //Goldeneye, [Jeremy]. Added by Gonetz
+ // (t0-prim)*env_a+prim
+ {0x6c316c31, cc_t0_sub_prim_mul_enva_add_prim},
+ // button, Sin and Punishmen. Added by Gonetz
+ // (env-prim)*env_a+prim
+ {0x6c356c35, cc_env_sub_prim_mul_enva_add_prim},
+ // frame buffer effect, Glover2
+ // (env-prim)*env_a+prim, (cmb-0)*shade+0
+ {0x6c35e4f0, cc__prim_inter_env_using_enva__mul_shade},
+ // fallen stars at star summit, Paper Mario. Added by Gonetz
+ // (t0-env)*env_a+prim, (1-0)*primlod+cmb
+ {0x6c510ef6, cc_t0_sub_env_mul_enva_add_prim},
+ // focus, Paper Mario. Added by Gonetz
+ // (t0-env)*env_a+prim, (cmb-shade)*shadea+shade ** INC **
+ {0x6c518b40, cc_t0_sub_shade_mul_shadea_add_shade},
+ // Ring, pokemon stadium 2
+ // (t0-0)*env_a+prim, (1-0)*cmb+0
+ {0x6cf1e0f6, cc_t0_mul_enva_add_prim},
+ // Jet Force
+ // (noise-0)*env_a+prim
+ {0x6cf76cf7, cc_prim},
+ // snowhead temple, zelda 2. Added by Gonetz
+ // (t1-t0)*primlod+prim, (cmb-0)*shade+shade
+ {0x6e1284f0, cc__t1_sub_t0_mul_primlod_add_prim__mul_shade_add_shade},
+ // zelda 2. Added by Gonetz
+ // (t1-t0)*primlod+prim, (cmb-0)*shade+0 ** INC **
+ {0x6e12e4f0, cc__t1_sub_t0_mul_primlod_add_prim__mul_shade},
+ // mini games quiz monitor backround, Pokemon Stadium 2
+ // (noise-t0)*primlod+prim, (prim-env)*cmb+env ** INC **
+ {0x6e17a053, cc_prim_sub_env_mul__one_sub_t0_mul_primlod_add_prim__add_env},
+ // Morning Sun attack, pokemon stadium 2
+ // (t0-prim)*primlod+prim, (prim-env)*0+cmb
+ {0x6e311f53, cc_t0_sub_prim_mul_primlod_add_prim},
+ // sky, daikatana. Added by Gonetz
+ // (t0-prim)*primlod+prim, (cmb-0)*shade+0
+ {0x6e31e4f0, cc_t0_mul_shade},
+ // ball's track, NFL Blitz. Added by Gonetz
+ // (t0-0)*primlod+prim
+ {0x6ef16ef1, cc_t0_mul_primlod_add_prim},
+ // Earthquake pokemon attack, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
+ // (t0-0)*primlod+prim, (cmb-env)*cmb_a+env ** INC **
+ {0x6ef1a750, cc_t0_mul_primlod_add_prim},
+ // mini games quiz monitor backround, Pokemon Stadium 2
+ // (noise-0)*primlod+prim, (env-cmb)*cmb_a+cmb ** INC **
+ // use cmb_a which is ac_t0_mul_t1
+ {0x6ef70705, cc_env_sub_prim_mul__t0a_mul_t1a__add_prim},
+ // rope, CBFD
+ // (t0-env)*k5+prim
+ {0x6f516f51, cc_t0_sub_env_mul_k5_add_prim},
+ // super bowling
+ // (0-0)*k5+prim
+ {0x6fff6fff, cc_prim},
+ // intro, Aidyn Chronicles. Added by Gonetz
+ // (0-0)*0+prim, (0-0)*0+prim
+ {0x79fb7788, cc_prim},
+ // Encore attack, Pokemon Stadium 2
+ // (t0-0)*0+prim, (cmb-0)*shade+0
+ {0x7ff1e4f0, cc_prim_mul_shade},
+ // Menu, megaman
+ // (1-0)*0+prim
+ {0x7ff67ff6, cc_prim},
+ // sky, PGA European Tour
+ // (0-0)*0+prim, (env-0)*t0+cmb
+ {0x7fff01f5, cc_t1_mul_env_add_prim},
+ // WWF No Mercy?
+ // ((0-0)*0+prim, (env-cmb)*shade+cmb
+ {0x7fff0405, cc_env_sub_prim_mul_shade_add_prim},
+ // sky, Spiderman. Added by Gonetz
+ // (0-0)*0+prim, (t1-0)*shade+cmb
+ {0x7fff04f2, cc_t1_mul_shade_add_prim},
+ // ball's shadow, ISS 2k. Added by Gonetz
+ // (0-0)*0+prim, (1-cmb)*env+cmb
+ {0x7fff0506, cc_one_sub_prim_mul_env_add_prim},
+ // Necklace, quest64
+ // (0-0)*0+prim, (1-0)*env+cmb
+ {0x7fff05f6, cc_prim_add_env},
+ // Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
+ // (0-0)*0+prim, (1-cmb)*cmba+cmb ** INC **
+ {0x7fff0706, cc_prim},
+ // Dobutsu no Mori. Added by Gonetz
+ //(k5-k5)*0+prim, (cmb-0)*0+cmb
+ {0x7fff1ff0, cc_prim},
+ // Intro background, starfox
+ //z (k5-k5)*0+prim
+ {0x7fff7fff, cc_prim},
+ // train smoke, Dobutsu No Mori. Added by Gonetz
+ //(0-0)*0+prim, (shade-0)*cmb+0
+ {0x7fffe0f4, cc_prim_mul_shade},
+ // Donald Duck intro. Added by Gonetz
+ //(0-0)*0+prim, (cmb-0)*prim+0
+ {0x7fffe3f0, cc_prim_mul_prim},
+ // Ms. Pac-Man intro. Added by Gonetz
+ //(0-0)*0+prim, (cmb-0)*shade+0
+ {0x7fffe4f0, cc_prim_mul_shade},
+ // zelda 2. Added by Gonetz
+ //(t1-t0)*t0+shade, (cmb-0)*shade+0
+ {0x8112e4f0, cc__t1_sub_t0_mul_t0_add_shade__mul_shade},
+ // branches, Beetle Adventure Racing
+ //(t0-shade)*t0+shade, (t0-cmb)*prim+cmb **INC**
+ {0x81410301, cc_t0_mul_prim},
+ // Namco logo, Famista 64
+ //(prim-shade)*t0+shade, (env-cmb)*t0+cmb **INC**
+ {0x81430105, cc_prim_sub_shade_mul_t0_add_shade},
+ // pikachu, hey you pikachu
+ //(prim-shade)*t0+shade, (env-cmb)*enva+cmb **INC**
+ {0x81430c05, cc_prim_sub_shade_mul_t0_add_shade},
+ // Mario's head, mario //Added by Gonetz
+ //(prim-shade)*t0+shade
+ {0x81438143, cc_prim_sub_shade_mul_t0_add_shade},
+ // Iguana background, turok
+ // (env-shade)*t0+shade
+ {0x81458145, cc_env_sub_shade_mul_t0_add_shade},
+ //attack, Pokemon Stadium 2
+ // (env-shade)*t0+shade, (cmb-0)*prim+0
+ {0x8145e3f0, cc__env_sub_shade_mul_t0_add_shade__mul_prim},
+ // Bubbles in Jabu-Jabu's belly, zelda
+ // (1-shade)*t0+shade
+ {0x81468146, cc_one_sub_shade_mul_t0_add_shade},
+ // saffron city, Pokemon Stadium 2
+ // (1-shade)*t0+shade, (cmb-0)*prim+0
+ {0x8146e3f0, cc__one_sub_shade_mul_t0_add_shade__mul_prim},
+ // duck dodgers intro. Added by Gonetz
+ // (1-shade)*t0+shade, (cmb-0)*shade+0
+ {0x8146e4f0, cc__one_sub_shade_mul_t0_add_shade__mul_shade},
+ // saffron city, Pokemon Stadium 2
+ // (1-shade)*t0+shade, (cmb-0)*prima+0
+ {0x8146eaf0, cc__one_sub_shade_mul_t0_add_shade__mul_env},
+ // intro, Madden Footbal
+ // (1-env)*t0+shade
+ {0x81568156, cc_one_sub_env_mul_t0_add_shade},
+ // sky in doom. Added by Gonetz
+ // (prim-0)*t0+shade, (cmb-0)*primlod+env **INC**
+ {0x81f3aef0, cc_t0_mul_prim_add_shade},
+ // commercial? in IIS98. Added by Gonetz
+ // (1-0)*t0+shade
+ {0x81f681f6, cc_t0_add_shade},
+ //attack, Pokemon Stadium 2
+ //(t0-prim)*t1+shade
+ {0x82318231, cc_t0_sub_prim_mul_t1_add_shade},
+ //beetle adventure racing. Added by Gonetz
+ //(prim-shade)*t1+shade, (cmb-0)*t1+0 **INC**
+ {0x8243e2f0, cc_prim_sub_shade_mul_t1_add_shade},
+ //Arena, Pokemon Stadium 2
+ //(t0-0)*t1+shade
+ {0x82f182f1, cc__t0_mul_t1__add_shade},
+ //Arena, Pokemon Stadium 2
+ //(t0-0)*t1+shade, (cmb-0)*prim+0
+ {0x82f1e3f0, cc__t0_mul_t1__mul_prim_add_prim_mul_shade},
+ // Scorpion fire breath, MK4 [Jeremy]. Added by Gonetz
+ // (t0-shade)*prim+shade
+ {0x83418341, cc_t0_mul_prim_add_one_sub_prim_mul_shade},
+ // Menu background, wwf no mercy
+ // (env-shade)*prim+shade
+ {0x83458345, cc_prim_mul_env_add_one_sub_prim_mul_shade},
+ // Pokemon selection window background, pokemon stadium 2
+ // (noise-shade)*prim+shade
+ {0x83478347, cc_shade},
+ // crown of king of ikana, zelda 2. Added by Gonetz
+ // (t0-env)*prim+shade
+ {0x83518351, cc_t0_sub_env_mul_prim_add_shade},
+ // crown of king of ikana, zelda 2. Added by Gonetz
+ // (t0-env)*prim+shade, (cmb-0)*cmb+0 ** INC **
+ {0x8351e0f0, cc_t0_sub_env_mul_prim_add_shade},
+ // salesman's shirt in the bomb shop in town, zelda 2 [Ogy]. Added by Gonetz
+ // (t0-env)*prim+shade, (cmb-0)*shade+0 ** INC **
+ {0x8351e4f0, cc_t0_mul_prim_mul_shade},
+ // intro, Madden Footbal
+ // (1-env)*prim+shade
+ {0x83568356, cc_one_sub_env_mul_prim_add_shade},
+ // Buss hunter 64. Added by Gonetz
+ // (t0-0)*prim+shade
+ {0x83f183f1, cc_t0_mul_prim_add_shade},
+ // huge water lilies, zelda 2 [Ogy]. Added by Gonetz
+ // (t0-0)*prim+shade, (cmb-env)*shade+0 ** INC **
+ {0x83f1e450, cc__t0_mul_prim_add_shade__sub_env_mul_shade},
+ // cynnabar gym fire shield, pokemon stadium 2
+ // (t0-0)*prim+shade, (cmb-0)*env+0 ** INC **
+ {0x83f1e5f0, cc__t0_mul_prim_add_shade__mul_env},
+ // Objects in arena, pokemon stadium 2
+ // (t1-0)*prim+shade, (cmb-0)*prim_a+0 - not going to bother with prim_a since it is FF
+ {0x83f2eaf0, cc_t1_mul_prim_add_shade},
+ // Pokemon Stadium 2. Added by Gonetz
+ // (t0-prim)*shade+shade ** INC **
+ {0x84318431, cc_t0_mul_shade},
+ // big N, Pokemon Stadium 2. Added by Gonetz
+ // (1-prim)*shade+shade ** INC **
+ {0x84368436, cc_one_sub_prim_mul_shade_add_shade},
+ //Arena, Pokemon Stadium 2
+ //(t0-env)*shade+shade
+ {0x84518451, cc_t0_sub_prim_mul_shade_add_shade},
+ //Arena, Pokemon Stadium 2
+ //(t0-env)*shade+shade, (cmb-0)*prim+0
+ {0x8451e3f0, cc_t0_sub_env_mul_prim_mul_shade_add_prim_mul_shade},
+ // arena, PokemonStadium2, [Raziel64]
+ // (t0-0)*shade+shade, (cmb-0)*prim+0
+ {0x84f1e3f0, cc_t0_mul_prim_mul_shade_add_prim_mul_shade},
+ // Spiderman. Added by Gonetz
+ // (1-0)*shade+shade
+ {0x84f684f6, cc_shade_add_shade},
+ // the "gekko" ( a monster in a room above the 3rd room of woodfall temple }, zelda 2 [Ogy]. Added by Gonetz
+ // (t0-prim)*env+shade ** INC **
+ {0x85318531, cc_t0_sub_prim_mul_env_add_shade},
+ // flower, zelda 2. Added by Gonetz
+ // (t0-prim)*env+shade, (cmb-0)*shade+0 ** INC **
+ {0x8531e4f0, cc_t0_sub_prim_mul_env_add_shade},
+ // Robotron 64, [scorpiove]
+ // (env-shade)*env+shade ** INC **
+ {0x85458545, cc_one_sub_env_mul_shade_add_env},
+ // Enemy dying, quest64
+ // (1-shade)*env+shade **changed by Gonetz
+ {0x85468546, cc_one_sub_shade_mul_env_add_shade},
+ // Arena, Pokemon Stadium
+ // (t0-0)*env+shade, (cmb-0)*prim+0
+ {0x85f1e3f0, cc__t0_mul_prim_mul_env__add__prim_mul_shade},
+ // Clouds, Pokemon Stadium
+ // (t1-0)*env+shade, (cmb-0)*prim+0
+ {0x85f2e3f0, cc__t1_mul_prim_mul_env__add__prim_mul_shade},
+ // Sky, Beetle Adventure Racing ** INC **
+ //(t0-shade)*t0_a+shade, (env-cmb)*enva+cmb
+ {0x88410c05, cc_t0_sub_shade_mul_t0a_add_shade},
+ // Mario's eyes, mario
+ //z (t0-shade)*t0_a+shade
+ {0x88418841, cc_t0_sub_shade_mul_t0a_add_shade},
+ //beetle adventure racing. Added by Gonetz
+ // (prim-shade)*t0_a+shade, (t1-0)*cmb+0 **INC**
+ {0x8843e0f2, cc_prim_sub_shade_mul__t0a_mul_t1__add_shade},
+ // blast corps [Ogy]
+ // (prim-shade)*t1_a+shade
+ {0x89438943, cc_prim_sub_shade_mul_t1a_add_shade},
+ //broken wall, beetle adventure racing. Added by Gonetz
+ // (t0-shade)*prima+shade, (1-0)*0+cmb
+ {0x8a411ff6, cc_t0_sub_shade_mul_prima_add_shade},
+ // menu, battle phoenix 64. Added by Gonetz
+ // (t0-shade)*prima+shade
+ {0x8a418a41, cc_t0_add_shade},
+ // intro, castlevania 2. Added by Gonetz
+ // (prim-shade)*prim_a+shade
+ {0x8a438a43, cc_prim_sub_shade_mul_prima_add_shade},
+ // Pilot wings
+ // (t0-shade)*shade_a+shade, (cmb-0)*shade+0
+ {0x8b41e4f0, cc__shade_inter_t0_using_shadea__mul_shade},
+ // ?
+ // (1-shade)*shade_a+shade
+ {0x8b468b46, cc_one_sub_shade_mul_shadea_add_shade},
+ // Pilot wings, sky in congratulations
+ // (t0-0)*shade_a+shade,
+ {0x8bf18bf1, cc_t0_mul_shadea_add_shade},
+ // arena, Pokemon Stadium. Added by Gonetz
+ // (t0-t1)*env_a+shade, (cmb-env)*prim+0 ** INC **
+ {0x8c21e350, cc__t0_sub_t1_mul_enva_add_shade__sub_env_mul_prim},
+ //diddy kong racing background fill. Added by Gonetz ** Modified by Dave2001
+ // (env-shade)*env_a+shade, (cmb-0)*prim+0
+ {0x8c458c45, cc_shade}, // note: previous combiner used other_alpha; doesn't work
+ //diddy kong racing. Added by Gonetz
+ // (env-shade)*env_a+shade, (cmb-0)*prim+0 ** INC **
+ {0x8c45e3f0, cc_prim_mul_shade},
+ // sky, Pokemon Stadium, [Raziel64]
+ // (t0-0)*env_a+shade, (cmb-env)*prim+0 ** INC **
+ {0x8cf1e350, cc_t0_mul_prim_add_shade_sub_env_mul_prim},
+ // zelda 2 [Ogy]. Added by Gonetz
+ // (t0-prim)*primlod+shade, (prim-env)*cmb+env ** INC **
+ {0x8e31a053, cc_prim_sub_env_mul__t0_sub_prim_mul_primlod_add_shade__add_env},
+ // fallen leaves, Dobutsu no Mori. Added by Gonetz
+ // (t0-shade)*primlod+shade, (prim-env)*cmb+env ** INC **
+ {0x8e41a053, cc_prim_sub_env_mul__t0_sub_shade_mul_primlod_add_shade__add_env},
+ // the icicle above the part just before the entrance to the mountain village, zelda 2 [Ogy]. Added by Gonetz
+ // (t0-prim)*0+shade, (prim-env)*cmb+env ** INC ** ?
+ {0x9f31a053, cc_prim_sub_env_mul_shade_add_env},
+ // background on level 3-1, kirby 64 [Raziel64]. Added by Gonetz
+ // (0-env)*0+shade
+ {0x9f5f9f5f, cc_shade},
+ // Spotlight, smash bros
+ // (1-0)*0+shade
+ {0x9ff69ff6, cc_shade},
+ // water, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
+ // (0-0)*0+shade, (cmb-cmb)*cmb+cmb
+ {0x9fff0000, cc_shade},
+ // menu, Dr.Mario. Added by Gonetz
+ // (0-0)*0+shade, (prim-cmb)*env+cmb
+ {0x9fff0503, cc_prim_sub_shade_mul_env_add_shade},
+ // pikachu, hey you pikachu. Added by Gonetz
+ // (0-0)*0+shade, (env-cmb)*enva+cmb
+ {0x9fff0c05, cc_env_sub_shade_mul_enva_add_shade},
+ // mega shock, paper mario
+ //(0-0)*0+shade, (env-prim)*cmb+prim
+ {0x9fff6035, cc_env_sub_prim_mul_shade_add_prim},
+ // Super Mario 64 logo background
+ //z (k5-k5)*0+shade
+ {0x9fff9fff, cc_shade},
+ // Zelda 2 final movie. Added by Gonetz
+ // (0-0)*0+shade, (prim-0)*cmb+0
+ {0x9fffe0f3, cc_prim_mul_shade},
+ // tree shadow, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
+ // (0-0)*0+shade, (env-0)*cmb+0
+ {0x9fffe0f5, cc_env_mul_shade},
+ // N64 logo, Aidyn Chronicles. Added by Gonetz
+ // (0-0)*0+shade, (cmb-0)*prim+0
+ {0x9fffe3f0, cc_prim_mul_shade},
+ // Hand, smash bros
+ // (0-0)*0+shade, (cmb-0)*env+0
+ {0x9fffe5f0, cc_env_mul_shade},
+ // Lave piranha atack, Paper Mario
+ // (t1-t0)*t0+env, (cmb-t1)*t0+prim ** INC **
+ {0xa1126120, cc__t0_mul_t1__mul_env_add_prim},
+ //Arena, Pokemon Stadium 2
+ // (t1-prim)*t0+env, (cmb-0)*shade+0
+ {0xa132e4f0, cc__t1_sub_prim_mul_t0_add_env__mul_shade},
+ // Kirby64 end [Raziel64]. Added by Gonetz
+ // (prim-shade)*t0+env
+ {0xa143a143, cc_prim_sub_shade_mul_t0_add_env},
+ // Superman [scorpiove]. Added by Gonetz
+ // (t0-env)*t0+env
+ {0xa151a151, cc_t0_sub_env_mul_t0_add_env},
+ // powder keg, zelda 2. Added by Gonetz
+ // (prim-env)*t0+env, (0-0)*shade_a+cmb
+ {0xa1530bff, cc__prim_sub_env_mul_t0_add_env__add_shadea},
+ // pokemon attack, Pokemon Stadium 2. Added by Gonetz
+ // (prim-env)*t0+env, (0-0)*prim_lod+cmb
+ {0xa1530ef6, cc__prim_sub_env_mul_t0_add_env__add_primlod},
+ //attack, Pokemon Stadium 2
+ // (prim-env)*t0+env, (0-0)*prim_lod+cmb
+ {0xa1530eff, cc_prim_sub_env_mul_t0_add_env},
+ // Kotake & koume defeated, going into sky, zelda
+ // (prim-env)*t0+env, (prim-env)*0+cmb
+ {0xa1531f53, cc_prim_sub_env_mul_t0_add_env},
+ // water, Dobutsu no Mori. Added by Gonetz
+ // (prim-env)*t0+env, (cmb-0)*shade+t0
+ {0xa15324f0, cc_t0_add_shade_mul_env},
+ //sky, beetle adventure racing. Added by Gonetz
+ // (prim-env)*t0+env, (cmb-shade)*t1+shade **INC** can't be done in one step
+ {0xa1538240, cc__env_inter_prim_using_t0__sub_shade_mul_t0a_add_shade},
+ //couple's mask, zelda2. Added by Gonetz
+ // (prim-env)*t0+env, (prim-cmb)*shade+shade **INC** can't be done in one step
+ {0xa1538403, cc_t0_mul_shade},
+ // stadium, Pokemon Stadium 2. Added by Gonetz
+ // (prim-env)*t0+env, (cmb-0)*shade+shade **INC** can't be done in one step
+ {0xa15384f0, cc_t0_mul_shade},
+ //clothes on girl in inn, zelda2. Added by Gonetz
+ // (prim-env)*t0+env, (cmb-prim)*env+shade **INC** can't be done in one step
+ {0xa1538530, cc_t0_mul_env_add_shade},
+ // Getting light arrows for the first time, zelda
+ // (prim-env)*t0+env, (prim-env)*cmb+env ** INC **
+ {0xa153a053, cc_prim_sub_env_mul_t0_add_env},
+ // Fire, starfox
+ // (prim-env)*t0+env
+ {0xa153a153, cc_prim_sub_env_mul_t0_add_env},
+ // a spell, Fushigi no Dungeon: Fuurai no Shiren 2
+ // (prim-env)*t0+env, (cmb-env)*enva+env
+ {0xa153ac50, cc_prim_sub_env_mul__t0_mul_enva__add_env},
+ // wizrobe's attack, zelda 2. Added by Gonetz.
+ // (prim-env)*t0+env, (cmb-0)*cmb+0
+ {0xa153e0f0, cc_prim_sub_env_mul_t0_add_env},
+ // dress, zelda 2. Added by Gonetz.
+ // also for Great Farie's hair - changed to use texture mod by Dave2001.
+ // (prim-env)*t0+env, (shade-0)*cmb+0
+ {0xa153e0f4, cc__env_inter_prim_using_t0__mul_shade},
+ // Start menu, paper mario
+ // (prim-env)*t0+env, (cmb-0)*t0+0
+ {0xa153e1f0, cc_prim_sub_env_mul_t0_add_env},
+ // {0xa153e0f4, cc_prim_sub_env_mul_t0_add_env},
+ // Jellyfish tentacles in Jabu-Jabu's belly, zelda
+ // (prim-env)*t0+env, (cmb-0)*prim+0
+ {0xa153e3f0, cc__env_inter_prim_using_t0__mul_prim},
+ // Dust, zelda
+ //z (prim-env)*t0+env, (cmb-0)*shade+0 ** INC **
+ {0xa153e4f0, cc__env_inter_prim_using_t0__mul_shade},
+ //{0xa153e4f0, cc_prim_sub_env_mul_t0_add_env},
+ // roof, Kirby 64. Added by Gonetz
+ // (prim-env)*t0+env, (cmb-0)*env+0 ** INC **
+ {0xa153e5f0, cc_prim_sub_env_mul_t0_add_env},
+ // hall of fame, Pokemon Stadium
+ // (prim-env)*t0+env, (cmb-0)*primlod+0
+ {0xa153eef0, cc__prim_sub_env_mul_t0_add_env__mul_primlod},
+ // Something weird in intro, monster truck madness
+ // (prim-env)*t0+env, (cmb-0)*k5+0
+ {0xa153eff0, cc__prim_sub_env_mul_t0_add_env__mul_k5},
+ // clothes, kirby 64. Added by Gonetz
+ // (shade-env)*t0+env
+ {0xa154a154, cc_shade_sub_env_mul_t0_add_env},
+ // field, Derby Stallion
+ // (shade-env)*t0+env, (cmb-0)*prim+0 ** INC **
+ {0xa154e3f0, cc_shade_sub_env_mul_t0_mul_prim_add_prim_mul_env},
+ // background, level 3-5, kirby 64, [Raziel64]
+ // (shade-env)*t0+env, (cmb-0)*shade+0 ** INC **
+ {0xa154e4f0, cc_shade_sub_env_mul_t0_add_env},
+ // pokemon attack, Pokemon Stadium 2. Added by Gonetz
+ // (one-env)*t0+env
+ {0xa156a156, cc_one_sub_env_mul_t0_add_env},
+ // Arena, Pokemon Stadium 2.
+ // (one-env)*t0+env, (cmb-0)*shade+0
+ {0xa156e4f0, cc__env_inter_one_using_t0__mul_shade},
+ //Arena, Pokemon Stadium 2
+ // (t1-0)*t0+env, (cmb-0)*cmb+0 ** INC **
+ {0xa1f2e0f0, cc__t0_mul_t1__add_env_mul__t0_mul_t1__add_env},
+ // quake 2 intro
+ // (prim-0)*t0+env, (prim-0)*primlod+cmb ** INC **
+ {0xa1f30ef3, cc_t0_mul_prim_add_env},
+ // Kotake or koume's hair, zelda
+ // (prim-0)*t0+env
+ {0xa1f3a1f3, cc_t0_mul_prim_add_env},
+ // track, ridge racer. Added by Gonetz
+ // (t0-env)*t1+env, (cmb-0)*shade+0 ** INC **
+ {0xa251e4f0, cc__t0_mul_t1__mul_shade},
+ // lava, beetle adventure racing
+ // (t0-env)*t1+env, (cmb-0)*enva+0 ** INC **
+ {0xa251ecf0, cc__t0_mul_t1__mul_enva},
+ // Ded Moroz, Paper Mario
+ // (prim-env)*t1+env, (1-cmb)*t1+cmb ** INC **
+ {0xa2530206, cc_prim_sub_env_mul_t1_add_env},
+ // text, monster truck madness
+ // (prim-env)*t1+env
+ {0xa253a253, cc_prim_sub_env_mul_t1_add_env},
+ // car position, Top Gear Rally. Added by Gonetz
+ // (prim-env)*t1+env, (cmb-t0)*t1+0 ** INC **
+ {0xa253e210, cc_prim_sub_env_mul_t1_add_env_mul_t0},
+ // text, Top Gear Rally. Added by Gonetz
+ // (prim-env)*t1+env, (cmb-0)*t1+0 ** INC **
+ {0xa253e2f0, cc_prim_sub_env_mul_t1_add_env_mul_t0},
+ // {0xa253e2f0, cc_prim_sub_env_mul_t1_add_env},
+ // a pole in the cut-scene that appears after you receive odolwa's mask, zelda 2 [Ogy]. Added by Gonetz
+ // (prim-env)*t1+env, (cmb-0)*shade+0 ** INC **
+ {0xa253e4f0, cc_t1_mul_prim_mul_shade},
+ // Quake 2 intro. Added by Gonetz
+ // (t0-0)*t1+env, (t0-0)*primlod+cmb ** INC **
+ {0xa2f10ef1, cc__t0_mul_t1__add_env},
+ // silver cave, pokemon stadium 2
+ // (t0-0)*t1+env, (cmb-prim)*shadea+prim
+ {0xa2f16b30, cc_prim_inter__t0_mul_t1_add_env__using_shadea},
+ // silver cave, pokemon stadium 2
+ // (t0-0)*t1+env, (cmb-0)*shadea+shade
+ {0xa2f18bf0, cc__t0_mul_t1_add_env__mul_shadea_add_shade},
+ // Quake64. Added by Gonetz
+ // (t0-0)*t1+env
+ {0xa2f1a2f1, cc__t0_mul_t1__add_env},
+ // Quake II. Added by Gonetz ** INC **
+ // (t0-0)*t1+env, (cmb-0)*prim+env
+ {0xa2f1a3f0, cc__t0_mul_t1__mul_prim_add_env},
+ // Dr Mario [Ogy]. Added by Gonetz
+ // (t0-env)*prim+env
+ // {0xa351a351, cc_t0_mul_prim_add_env},
+ {0xa351a351, cc_t0_sub_env_mul_prim_add_env},
+ // menu, Dr.Mario. Added by Gonetz
+ // (prim-env)*prim+env
+ {0xa353a353, cc_prim_sub_env_mul_prim_add_env},
+ // Razor sword, zelda 2. Added by Gonetz
+ // (shade-env)*prim+env, (cmb-0)*shade+0 ** INC **
+ {0xa354e4f0, cc_shade_sub_env_mul_prim_add_env},
+ // bomberman 64-2 intro. Added by Gonetz
+ // (1-env)*prim+env
+ {0xa356a356, cc_one_sub_env_mul_prim_add_env},
+ // thing that escapes from the well, zelda
+ // (noise-env)*prim+env
+ {0xa357a357, cc_prim_add_env},
+ // Bongo Bongo, zelda
+ // (noise-env)*prim+env, (cmb-0)*shade+0
+ {0xa357e4f0, cc_env_mul_shade},
+ // paper mario. Added by Gonetz
+ // (t0-0)*prim+env
+ {0xa3f1a3f1, cc_t0_mul_prim_add_env},
+ // paper mario. Added by Gonetz
+ // (t0-0)*prim+env, (t0-env)*prim+0
+ {0xa3f1e351, cc_t0_mul_prim_add_env},
+ // paper mario. Added by Gonetz
+ // (t0-0)*prim+env, (t0-0)*prim+0
+ {0xa3f1e3f1, cc_t0_mul_prim},
+ // mahogany town statue, Pokemon Stadium 2
+ // (t0-0)*prim+env, (cmb-0)*shade+0
+ {0xa3f1e4f0, cc__t0_mul_prim_add_env__mul_shade},
+ // squirt, paper mario. Added by Gonetz
+ // (t1-0)*prim+env, (1-cmb)*t1+cmb
+ {0xa3f20206, cc_t1_mul_prim_add_env},
+ // paper mario. Added by Gonetz
+ // (shade-0)*prim+env
+ {0xa3f4a3f4, cc_prim_mul_shade_add_env},
+ // Sharpen attack, pokemon stadium 2
+ // (shade-0)*prim+env, (cmb-0)*shade+0
+ {0xa3f4e4f0, cc__prim_mul_shade_add_env__mul_shade},
+ // Doraemon 2. Added by Gonetz
+ // (1-0)*prim+env
+ {0xa3f6a3f6, cc_prim_add_env},
+ // Pokemon Stadium 2, [Jeremy]. Added by Gonetz
+ // (noise-0)*prim+env ** INC ** ?
+ {0xa3f7a3f7, cc_prim_add_env},
+ // monsters, Pokemon Stadium. Added by Gonetz
+ // (t0-t1)*shade+env, (cmb-0)*prim+0 ** INC **
+ {0xa421e3f0, cc__t0_sub_t1__mul_prim_mul_shade_add_prim_mul_env},
+ // background, pokemon stadium 2
+ // (t0-prim)*shade+env
+ {0xa431a431, cc_t0_sub_prim_mul_shade_add_env},
+ // Arena, pokemon stadium 2
+ // (t0-prim)*shade+env, (cmb-0)*shade+0
+ {0xa431e4f0, cc__t0_sub_prim_mul_shade_add_env__mul_shade},
+ // Trophy, pokemon stadium 2
+ // (t0-prim)*shade+env, (cmb-0)*shade_a+0
+ {0xa431ebf0, cc__t0_sub_prim_mul_shade_add_env__mul_shadea},
+ // Buildings, pokemon stadium 2
+ // (t1-prim)*shade+env
+ {0xa432a432, cc_t1_sub_prim_mul_shade_add_env},
+ // bomberman 64 [Ogy]
+ // (t0-env)*shade+env
+ {0xa451a451, cc_t0_mul_shade_add_env},
+ // kirby drill, kirby 64. Added by Gonetz
+ // (prim-env)*shade+env
+ {0xa453a453, cc_prim_sub_env_mul_shade_add_env},
+ // ball, ISS98 intro. Added by Gonetz
+ // (t0-0)*shade+env
+ {0xa4f1a4f1, cc_t0_mul_shade_add_env},
+ // waterfall, Dobutsu_no_Mori
+ // (prim-0)*shade+env, (t0-0)*primlod+cmb
+ {0xa4f30ef1, cc_t0_mul_primlod_add_prim_mul_shade_add_env},
+ // waterfall, Dobutsu_no_Mori
+ // (prim-0)*shade+env, (t1-0)*primlod+cmb
+ {0xa4f30ef2, cc_t1_mul_primlod_add_prim_mul_shade_add_env},
+ // score, ISS98 intro. Added by Gonetz
+ // (prim-0)*shade+env
+ {0xa4f3a4f3, cc_prim_mul_shade_add_env},
+ // magic fist, Rayman2. Added by Gonetz
+ // (env-0)*shade+env
+ {0xa4f5a4f5, cc_env_mul_shade_add_env},
+ // gunfire, Quake64. Added by Gonetz
+ // (1-0)*shade+env
+ {0xa4f6a4f6, cc_env_add_shade},
+ // flame, Paper Mario. Added by Gonetz
+ // (t0-center)*scale+env, (0-prim)*cmb+env
+ {0xa661a03f, cc_env_sub__t0_mul_scale_add_env__mul_prim},
+ // N64 BIOS
+ // (t0-env)*t0_a+env, cmb*shade
+ {0xa851e0f4, cc__env_inter_t0_using_t0a__mul_shade},
+ // pink car, f-zero x
+ // (t0-env)*t0_a+env, cmb*shade
+ {0xa851e4f0, cc__env_inter_t0_using_t0a__mul_shade},
+ // PokemonStadium1, [Raziel64]
+ // (prim-env)*t0_a+env, (cmb-cmb)*cmb+cmb
+ {0xa8530000, cc_prim_sub_env_mul_t0a_add_env},
+ // N64 logo, Ogre Battle
+ // (prim-env)*t0_a+env
+ {0xa853a853, cc_prim_sub_env_mul_t0a_add_env},
+ // Mud Slap, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
+ // (prim-env)*t0_a+env, (cmb-0)*cmb+0
+ {0xa853e0f0, cc_prim_sub_env_mul_t0a_add_env},
+ // Tree background, mace
+ // (prim-env)*t0_a+env, (cmb-0)*t0+0
+ {0xa853e1f0, cc__env_inter_prim_using_t0a__mul_t0},
+ //attack, Pokemon Stadium 2
+ // (prim-env)*t0_a+env, (cmb-0)*prim+0
+ {0xa853e3f0, cc__env_inter_prim_using_t0a__mul_prim},
+ // logo, Deadly Arts. Added by Gonetz
+ // (prim-env)*t1_a+env
+ {0xa953a953, cc_prim_sub_env_mul_t1a_add_env},
+ // MarioGolf text "Birdie Put"
+ // (t0-env)*prim_a+env
+ {0xaa51aa51, cc_t0_sub_env_mul_prima_add_env},
+ // N64 BIOS
+ // (t0-env)*prim_a+env, (shade-0)*cmb+0
+ {0xaa51e0f4, cc__env_inter_t0_using_prima__mul_shade},
+ // N64 BIOS
+ // (prim-env)*prima+env, (shade-0)*cmb+0
+ {0xaa53e0f4, cc__env_inter_prim_using_prima__mul_shade},
+ // Girl, PD intro. Added by Gonetz
+ // (t0-env)*shade_alpha+env, (cmb-0)*shade+0 ** INC **
+ {0xab51e4f0, cc__env_inter_t0_using_shadea__mul_shade},
+ // Some gannon spell, zelda
+ // (prim-env)*shade_alpha+env
+ {0xab53ab53, cc_prim_sub_env_mul_shadea_add_env},
+ //Arena, Pokemon Stadium 2
+ // (t0-0)*shade_alpha+env, (cmb-0)*shade+prim
+ {0xabf164f0, cc__t0_mul_shadea_add_env__mul_shade_add_prim},
+ // Boxes, Taz express. Added by Gonetz
+ // (t0-env)*env_a+env
+ {0xac51ac51, cc_t0_sub_env_mul_enva_add_env},
+ // paper mario. Added by Gonetz
+ // (t0-env)*env_a+env, (cmb-0)*shade+0 **INC**
+ {0xac51e4f0, cc_t0_mul_env_mul_shade},
+ // goal, Monster Truck Madness 64
+ // (noise-0)*env_a+env, (cmb-0)*t1+0 **INC**
+ {0xacf7e2f0, cc_t1_mul_env},
+ // sword on forge, zelda 2. Added by Gonetz
+ // (t1-t1)*lodf+env, (t1-t0)*cmb+prim
+ {0xae226012, cc__t1_sub_t0__mul_env_add_prim},
+ // menu background, Pokemon Stadium 2, [Raziel64]
+ // (t0-prim)*lodf+env
+ {0xae31ae31, cc_t0_sub_prim_mul_primlod_add_env},
+ // odd mushroom, zelda oot. Added by Gonetz
+ // (t0-shade)*lodf+env, (prim-env)*cmb+env ** INC **
+ {0xae41a053, cc__env_inter_prim_using__t0_sub_shade_mul_primlod_add_env},
+ // {0xae41a053, cc_prim_sub_env_mul__t0_mul_shade__add_env},
+ // Morning Sun, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
+ // (t0-env)*lodf+env, (cmb-0)*prim+0
+ {0xae51e3f0, cc__env_inter_t0_using_primlod__mul_prim},
+ //Spacestation Silicon Valley intro. Added by Gonetz
+ // (prim-env)*lodf+env
+ {0xae53ae53, cc_env_inter_prim_using_primlod},
+ // Doom, intro. Added by Gonetz
+ // (t0-0)*lodf+env, (t0-0)*lodf+env
+ {0xaef1aef1, cc_t0_add_env},
+ // Dobutsu no Mori. Added by Gonetz
+ // (prim-0)*lodf+env
+ {0xaef3aef3, cc_prim_add_env},
+ // forest behind window, Dobutsu no Mori. Added by Gonetz
+ // (prim-0)*prim_lod+env, (t1-0)*cmb+0
+ {0xaef3e0f2, cc_t0_mul__prim_mul_primlod_add_env },
+ // tony hawks 2 menu
+ // (t0-rnv)*k5+env, (cmb-t1)*t1_a+t1 ** INC ** (correct combiner does not work because of black t1)
+ {0xaf514920, cc_t0_sub_env_mul_k5_add_env},
+ // intro, Mission Impossible. Added by Gonetz
+ // (k5-k5)*0+env, (0-0)*scale+env
+ {0xbfffa6ff, cc_env},
+ // Something blocking the screen, waverace
+ //z (k5-k5)*0+env
+ {0xbfffbfff, cc_env},
+ // Derby Stallion . Added by Gonetz
+ // (0-0)*0+env, (cmb-0)*prim+0
+ {0xbfffe3f0, cc_prim_mul_env},
+ // zelda 2 [Ogy]. Added by Gonetz
+ // (k5-k5)*0+env, ((cmb-0)*shade+0
+ {0xbfffe4f0, cc_env_mul_shade},
+ // flame, paper mario. Added by Gonetz
+ // (t0-t1)*t0+1, (0-prim)*cmb+env **INC** weird
+ {0xc121a03f, cc__t0_inter_t1_using_half__mul_prim_add_env},
+ // tube near big monster on level 5, Kirby64 [Raziel64]
+ // (prim-env)*t0+1, (cmb-0)*shade+0 ** INC **
+ {0xc153e4f0, cc_prim_sub_env_mul_t0_mul_shade},
+ // paper mario. Added by Gonetz
+ // (0-env)*t0+1, (prim-cmb)*t0+prim **INC**
+ {0xc15f6103, cc_env_sub_prim_mul_t0_add_prim},
+ // HAL, smash bros
+ // (0-0)*0+1
+ {0xdfffdfff, cc_one},
+ // arena, Pokemon Stadium 1, [Raziel64]
+ // (0-0)*0+1, (cmb-0)*prim+0
+ {0xdfffe3f0, cc_prim},
+ // skis, Spacestation Silicon Valley. Added by Gonetz
+ // (shade-0)*cmb+0, (t1-t0)*primlod+t0
+ {0xe0f42d12, cc_t0_inter_t1_using_primlod},
+ // paper mario. Added by Gonetz
+ // (1-t1)*t0+0, (env-prim)*cmb+prim ** INC **
+ {0xe1266035, cc_env_sub_prim_mul__t0_mul_t1__add_prim},
+ // ground, zelda 2. Added by Gonetz.
+ // (t1-prim)*t0+0, (cmb-0)*shade+0
+ {0xe132e4f0, cc__t1_sub_prim_mul_t0__mul_shade},
+ // carmagedon
+ // (shade-prim)*t0+0
+ {0xe134e134, cc_shade_sub_prim_mul_t0},
+ // skeleton, castlevania 2. Added by Gonetz
+ // (1-prim)*t0+0, (cmb-0)*shade+0
+ {0xe136e4f0, cc_t0_mul_1mprim_mul_shade},
+ // Starshot logo. Added by Gonetz
+ // (shade-env)*t0+0, (1-0)*cmb+cmb
+ {0xe15400f6, cc_shade_sub_env_mul_t0},
+ // Kirby morfing, smash bros. Added by Gonetz
+ // (shade-env)*t0+0
+ {0xe154e154, cc_shade_sub_env_mul_t0},
+ // menu, PGA euro tour. Added by Gonetz
+ // (1-env)*t0+0
+ {0xe156e156, cc_one_sub_env_mul_t0},
+ // paper mario. Added by Gonetz
+ // (t0-0)*t0+0, (1-cmb)*prim+cmb
+ {0xe1f10306, cc_one_sub_t0_mul_prim_add_t0},
+ // F1 World Grand Prix. Added by Gonetz
+ // (t0-0)*t0+0, (shade-prim)*cmb+prim
+ {0xe1f16034, cc_shade_sub_prim_mul_t0_add_prim},
+ // paper mario. Added by Gonetz
+ // (t0-0)*t0+0, (env-prim)*cmb+prim
+ {0xe1f16035, cc_env_sub_prim_mul_t0_add_prim},
+ // sparkles, F1 World Grand Prix. Added by Gonetz
+ // (t0-0)*t0+0, (1-prim)*cmb+prim
+ {0xe1f16036, cc_one_sub_prim_mul_t0_add_prim},
+ // rocket team basket, Pokemon Stadium 2
+ // (t0-0)*t0+0, (cmb-prim)*shade+shade
+ {0xe1f18430, cc__t0_mul_t0__sub_prim_mul_shade_add_shade},
+ // Tony Hawk's Pro Skater. Added by Gonetz
+ // (t0-0)*t0+0, (cmb-0)*t0+0
+ {0xe1f1e1f0, cc_t0},
+ // something in upper left corner, mario tennis
+ // (t0-0)*t0+0
+ {0xe1f1e1f1, cc_t0},
+ // zelda 2. Added by Gonetz
+ // (t0-0)*t0+0, (cmb-0)*prim+0
+ {0xe1f1e3f0, cc_t0_mul_prim},
+ // zelda 2 final movie. Added by Gonetz
+ // (t0-0)*t0+0, (cmb-0)*shade+0
+ {0xe1f1e4f0, cc_t0_mul_shade},
+ // paper mario. Added by Gonetz
+ // (t0-t1)*t0+1, (env-cmb)*prima+cmb ** INC **
+ {0xe1f20a05, cc_t1_mul_prima},
+ // terrain, SCARS. Added by Gonetz
+ // (t1-0)*t0+0, (env-prim)*cmb+prim
+ {0xe1f26035, cc_env_sub_prim_mul__t0_mul_t1__add_prim},
+ // Trees, Zelda 2
+ // (t1-0)*t0+0, (cmb-0)*shade+prim
+ {0xe1f264f0, cc__t0_mul_t1__mul_shade_add_prim},
+ // terrain, SCARS. Added by Gonetz
+ // (t1-0)*t0+0, (env-shade)*cmb+shade
+ {0xe1f28045, cc_env_sub_shade_mul__t0_mul_t1__add_shade},
+ // arena, Pokemon Stadium 2. Added by Gonetz
+ // (t1-0)*t0+0, (cmb-prim)*shade+shade ** INC **
+ {0xe1f28430, cc__t0_mul_t1__sub_prim_mul_shade_add_shade},
+ // arena, Pokemon Stadium 2
+ // (t1-0)*t0+0, (cmb-env)*shade+shade
+ {0xe1f28450, cc__t0_mul_t1__sub_env_mul_shade_add_shade},
+ // Zelda 2, [Ogy]. Added by Gonetz
+ // (t1-0)*t0+0, (cmb-prim)*env+shade ** INC **
+ {0xe1f28530, cc__t0_mul_t1__sub_prim_mul_env_add_shade},
+ // pokemon attack, Pokemon Stadium 2. Added by Gonetz
+ // (t1-0)*t0+0, (prim-env)*cmb+env
+ {0xe1f2a053, cc_prim_sub_env_mul__t0_mul_t1__add_env},
+ // paper mario. Added by Gonetz
+ // (t1-0)*t0+0, (cmb-0)*prim+env
+ {0xe1f2a3f0, cc__t0_mul_t1__mul_prim_add_env},
+ // Sand, pokemon stadium 2
+ // (t1-0)*t0+0, (cmb-prim)*shade+env ** INC **
+ {0xe1f2a430, cc__t0_mul_t1__mul_shade},
+ // grass, Mission Impossible. Added by Gonetz
+ // (t1-0)*t0+0, (shade-0)*cmb+0
+ {0xe1f2e0f4, cc__t0_mul_t1__mul_shade},
+ // flag, Monako Grand Prix
+ // (t1-0)*t0+0
+ {0xe1f2e1f2, cc_t0_mul_t1},
+ // lighthouse's beam, zelda 2. Added by Gonetz
+ // (t1-0)*t0+0, (cmb-0)*prim+0
+ {0xe1f2e3f0, cc__t0_mul_t1__mul_prim},
+ // Bottom of wings, pilotwings
+ // (t1-0)*t0+0, (cmb-0)*shade+0
+ {0xe1f2e4f0, cc__t0_mul_t1__mul_shade},
+ // zelda 2. Added by Gonetz
+ // (t1-0)*t0+0, (cmb-0)*prima+0
+ {0xe1f2eaf0, cc__t0_mul_t1__mul_prima},
+ // lava, Roadsters. Added by Gonetz
+ // (prim-0)*t0+0, (1-prim)*t0+cmb
+ {0xe1f30136, cc_t0},
+ // sky, Pokemon Stadium 2. Added by Gonetz
+ // (prim-0)*t0+0, (cmb-0)*shadea+env
+ {0xe1f3abf0, cc_t0_mul_prim_mul_shadea_add_env},
+ // cars, Indy Racing 2000. Added by Gonetz
+ // (prim-0)*t0+0, (shade-0)*cmb+0
+ {0xe1f3e0f4, cc_t0_mul_prim_mul_shade},
+ // Sign shadows, zelda
+ //z (prim-k5)*t0+cmb_a
+ {0xe1f3e1f3, cc_t0_mul_prim},
+ // Table, mace
+ // (prim-0)*t0+0, (cmb-0)*shade+0
+ {0xe1f3e4f0, cc_t0_mul_prim_mul_shade},
+ // Gauntlet Legends intro
+ // (prim-0)*t0+0, (cmb-0)*prima+0
+ {0xe1f3eaf0, cc_t0_mul_prim_mul_prima},
+ // walls, beetle adventure racing. Added by Gonetz
+ // (shade-0)*t0+0, (prim-0)*t0+cmb
+ {0xe1f401f3, cc_t0_mul_shade},
+ // cars, ridge racer. Added by Gonetz
+ // (shade-0)*t0+0, (prim-cmb)*cmb_a+cmb **INC**
+ {0xe1f40703, cc_t0_mul_shade},
+ // water block, Paper Mario. Added by Gonetz
+ // (shade-0)*t0+0, (prim-env)*cmb+env
+ {0xe1f4a053, cc_prim_sub_env_mul__t0_mul_shade__add_env},
+ // a lot in TWINE. Added by Gonetz
+ // (shade-0)*t0+0, (cmb-0)*prim+env
+ {0xe1f4a3f0, cc_t0_mul_prim_mul_shade_add_env},
+ // Xena. Added by Gonetz
+ // (shade-0)*t0+0, (env-0)*cmb+0
+ {0xe1f4e0f5, cc_t0_mul_env_mul_shade},
+ // Starshot logo. Added by Gonetz
+ // (shade-0)*t0+0, (1-0)*cmb+0
+ {0xe1f4e0f6, cc_t0_mul_shade},
+ // Duck Dodgers intro. Added by Gonetz
+ // (shade-0)*t0+0
+ {0xe1f4e1f4, cc_t0_mul_shade},
+ // shadow, Mission Impossible. Added by Gonetz
+ // (shade-0)*t0+0, (cmb-0)*prim+0
+ {0xe1f4e3f0, cc_t0_mul_prim_mul_shade},
+ // Tony Hawk's Pro Skater 3. Added by Gonetz
+ // (env-0)*t0+0, (t1-0)*shade+cmb ** INC **
+ {0xe1f504f2, cc__t0_add_t1__mul_shade},
+ // text, tonic trouble. Added by Gonetz
+ // (env-0)*t0+0
+ {0xe1f5e1f5, cc_t0_mul_env},
+ // powder keg, zelda 2. Added by Gonetz
+ // (env-0)*t0+0, (cmb-0)*shade+0
+ {0xe1f5e4f0, cc_t0_mul_env_mul_shade},
+ // Buss rush
+ // (1-0)*t0+0, (0-cmb)*0+cmb
+ {0xe1f61f0f, cc_t0},
+ // water, Starshot. Added by Gonetz
+ // (1-0)*t0+0, (1-0)*cmb+0
+ {0xe1f6e0f6, cc_t0},
+ // bomberman 64 [Ogy]
+ // (1-0)*t0+0
+ {0xe1f6e1f6, cc_t0},
+ // Mermaid attack, Mystical Ninja
+ // (noise-0)*t0+0
+ {0xe1f7e1f7, cc_t0},
+ // paper mario. Added by Gonetz * changed because of odd palette copy
+ // (t0-0)*t1+0, (shade-env)*cmb+cmb **INC** ?
+ {0xe2f10054, cc_shade_sub_env_mul__t0_mul_t1__add__t0_mul_t1},
+ // Duck Dodgers Starring Daffy Duck text background
+ // (t0-0)*t1+0, (shade-cmb)*prim+cmb
+ {0xe2f10304, cc_one_sub_prim_mul__t0_mul_t1__add__prim_mul_shade},
+ // water, PGA European Tour
+ // (t0-0)*t1+0, (env-cmb)*prim+cmb
+ {0xe2f10305, cc_one_sub_prim_mul__t0_mul_t1__add__prim_mul_env},
+ // Grass, mario golf
+ // (t0-0)*t1+0, (cmb-t0)*cmb_a+t0
+ {0xe2f12710, cc_t0_mul_t1},
+ // xg2, Added by Gonetz
+ // (t0-0)*t1+0, (env-prim)*cmb+prim
+ {0xe2f16035, cc_env_sub_prim_mul__t0_mul_t1__add_prim},
+ // poo, CBFD, Added by Gonetz
+ // (t0-0)*t1+0, (cmb-env)*shade+prim ** INC **
+ {0xe2f16450, cc__t0_mul_t1__mul_shade_add_prim},
+ // the champion stage, Pokemon Stadium 2
+ // (t0-0)*t1+0, (cmb-0)*shade+prim
+ {0xe2f164f0, cc__t0_mul_t1__mul_shade_add_prim},
+ // sky, xg2, Added by Gonetz
+ // (t0-0)*t1+0, (cmb-prim)*cmb_a+prim
+ {0xe2f16730, cc__t0_mul_t1__sub_prim_mul__t0t1a__add_prim },
+ // Sin and Punishment, [scorpiove], Added by Gonetz
+ // (t0-0)*t1+0, (env-prim)*cmb_a+prim
+ {0xe2f16735, cc_env_sub_prim_mul__t0t1a__add_prim},
+ // cianwood gym walls, pokemon stadium 2
+ // (t0-0)*t1+0, (cmb-prim)*shade+shade
+ {0xe2f18430, cc__t0_mul_t1__sub_prim_mul_shade_add_shade},
+ // light, Ridge Racer. Added by Gonetz
+ // (t0-0)*t1+0, (prim-env)*cmb+env
+ {0xe2f1a053, cc_prim_sub_env_mul__t0_mul_t1__add_env},
+ // Waterfall, duck dodgers. Added by Gonetz
+ // (t0-0)*t1+0, (shade-env)*cmb+env
+ {0xe2f1a054, cc_shade_sub_env_mul__t0_mul_t1__add_env},
+ // Arena, Pokemon Stadium 2 ** INC **
+ // (t0-0)*t1+0, (cmb-prim)*shade+env
+ {0xe2f1a430, cc__t0_mul_t1__mul_shade_add_env},
+ // bikes, xg2
+ // (t0-0)*t1+0, (shade-0)*cmb+0
+ {0xe2f1e0f4, cc__t0_mul_t1__mul_shade},
+ // Sky background, xg2
+ // (t0-0)*t1+0
+ {0xe2f1e2f1, cc_t0_mul_t1},
+ // statistics, Banjo 2. Added by Gonetz
+ // (t0-0)*t1+0, (cmb-0)*prim+0
+ {0xe2f1e3f0, cc__t0_mul_t1__mul_prim},
+ // the champion stage, Pokemon Stadium 2
+ // (t0-0)*t1+0, (cmb-prim)*shade+0
+ {0xe2f1e430, cc__t0_mul_t1__sub_prim_mul_shade},
+ // Water, pilotwings
+ // (t0-0)*t1+0, (cmb-0)*shade+0
+ {0xe2f1e4f0, cc__t0_mul_t1__mul_shade},
+ //beetle adventure racing. A dded by Gonetz
+ // (t0-0)*t1+0, (cmb-0)*env+0
+ {0xe2f1e5f0, cc__t0_mul_t1__mul_env},
+ //fall headwaters, zelda 2. Added by Gonetz
+ // (t1-0)*t1+0, (cmb-0)*shade+0
+ {0xe2f2e4f0, cc_t1_mul_shade},
+ //text, Paper Mario
+ // (prim-0)*t1+0
+ {0xe2f3e2f3, cc_t1_mul_prim},
+ //terrain, Beetle Adventure Racing. Added by Gonetz
+ // (shade-0)*t1+0
+ {0xe2f4e2f4, cc_t1_mul_shade},
+ // Transfer pack, Pokemon Stadium 2
+ // (noise-0)*t1+0, (prim-env)*cmb+env
+ {0xe2f7a053, cc_prim_sub_env_mul_t1_add_env},
+ // lens of truth, zelda 2 [Ogy]. Added by Gonetz
+ // (1-t0)*prim+0
+ {0xe316e316, cc_one_sub_t0_mul_prim},
+ //C&C pointer
+ //(shade-env)*prim+0
+ {0xe354e354, cc_shade_sub_env_mul_prim},
+ //C&C shadows
+ //(1-env)*prim+0
+ {0xe356e356, cc_one_sub_env_mul_prim},
+ // Magnitude, pokemon stadium 2
+ // (t0-0)*prim+0, (t0-0)*env+cmb
+ {0xe3f105f1, cc_t0_mul__prim_add_env},
+ // night vision, jet force gemini
+ // (t0-0)*prim+0, (noise-0)*env+cmb
+ {0xe3f105f7, cc_t0_mul_prim_add_env},
+ // Smoke, diddy kong racing
+ // (t0-0)*prim+0, (env-cmb)*env_alpha+cmb
+ {0xe3f10c05, cc__t0_mul_prim__inter_env_using_enva},
+ // battle menu, Paper Mario. Added by Gonetz
+ // (t0-0)*prim+0, (t0-env)*env_alpha+cmb ** INC **
+ {0xe3f10c51, cc_t0_mul_prim},
+ // stalactites, Beetle adventure Racing. Added by Gonetz
+ // (t0-0)*prim+0, (cmb-shade)*t1_alpha+shade ** INC **
+ {0xe3f18940, cc_t0_mul_prim_add_shade },
+ // ? in Jabu-Jabu's belly, submitted by gokuss4
+ // {0xe4f1a053, (t0-0)*prim+0, (prim-env)*cmb+env
+ {0xe3f1a053, cc_prim_sub_env_mul__t0_mul_prim__add_env},
+ // kirby drill, kirby 64. Added by Gonetz
+ // (t0-0)*prim+0, (cmb-env)*shade+env **INC**
+ {0xe3f1a450, cc_t0_mul_prim_mul_shade_add_env},
+ // ? sign, zelda 2. Added by Gonetz
+ // (t0-0)*prim+0, (cmb-0)*cmb+0 ** INC **
+ {0xe3f1e0f0, cc_t0_mul_prim},
+ // vehicle, Star Wars Ep.1 Racer, [Raziel64]. Added by Gonetz
+ // (t0-0)*prim+0, (shade-0)*cmb+0
+ {0xe3f1e0f4, cc_t0_mul_prim_mul_shade},
+ // mini game, Pokemon Stadium 2
+ // (t0-0)*prim+0, (1-0)*cmb+0
+ {0xe3f1e0f6, cc_t0_mul_prim},
+ // magic stuff, buck bumble. Added by Gonetz
+ // (t0-0)*prim+0, (cmb-0)*prim+0
+ {0xe3f1e3f0, cc_t0_mul_prim_mul_prim},
+ // The mario face, mario
+ //z (t0-k5)*prim+cmb_a
+ {0xe3f1e3f1, cc_t0_mul_prim},
+ // Butterflies at Jabu-Jabu's lake, zelda
+ // (t0-0)*prim+0, (cmb-0)*shade+0
+ {0xe3f1e4f0, cc_t0_mul_prim_mul_shade},
+ // Sports shirt, Mia Soccer. Added by Gonetz
+ // (t1-0)*prim+0, (1-t0)*t1+cmb **INC**
+ // {0xe3f20216, cc_t0_mul_prim_add_t1},
+ {0xe3f20216, cc_shirt},
+ // Sprites, Ogre Battle. Added by Gonetz
+ // (t1-0)*prim+0
+ {0xe3f2e3f2, cc_t1_mul_prim},
+ // F1 World Grand Prix. Added by Gonetz
+ // (t1-0)*prim+0, (cmb-0)*shade+0
+ {0xe3f2e4f0, cc_t1_mul_prim_mul_shade},
+ // intro background, bio freaks. Added by Gonetz
+ // (prim-0)*prim+0
+ {0xe3f3e3f3, cc_prim_mul_prim},
+ // player, Ohzumou2
+ // (shade-0)*prim+0, (env-cmb)*t0+cmb
+ {0xe3f40105, cc_env_sub_primshade_mul_t0_add_primshade},
+ // floor in pyramides, beetle adventure racing.
+ // (shade-0)*prim+0, (t1-0)*cmb+0
+ {0xe3f4e0f2, cc_t1_mul_prim_mul_shade},
+ // Slingshot string, zelda
+ // (shade-0)*prim+0
+ {0xe3f4e3f4, cc_prim_mul_shade},
+ // ?
+ // (shade-0)*prim+0, (cmb-0)*shade+0 ** INC **
+ {0xe3f4e4f0, cc_prim_mul_shade},
+ // ???, zelda
+ // (env-0)*prim+0, (0-0)*0+cmb
+ {0xe3f5e3f5, cc_prim_mul_env},
+ // Option selection, zelda
+ //z (1-0)*prim+0
+ {0xe3f6e3f6, cc_prim},
+ // ranco monster, zelda 2. Added by Gonetz
+ // (noise-0)*prim+0, (cmb-0)*prim_a+prim
+ {0xe3f76af0, cc_prim_mul_prima_add_prim},
+ // F-1_World_Grand_Prix_II, olivieryuyu
+ // (noise-0)*prim+0, (0-cmb)*prim_a+shade
+ {0xe3f78a0f, cc_shade_sub__prim_mul_prima},
+ // zelda 2 [Ogy]. Added by Gonetz
+ // (noise-0)*prim+0
+ {0xe3f7e3f7, cc_prim},
+ // Road rush. Added by Gonetz
+ // (0-0)*prim+0 ** INC ** ?
+ {0xe3ffe3ff, cc_prim},
+ // Letter to Kafei's mom, zelda 2. Added by Gonetz
+ // (0-0)*prim+0, (cmb-0)*shade+0
+ {0xe3ffe4f0, cc_prim_mul_shade},
+ // Jabu-Jabu's Belly, zelda. Added by Gonetz
+ // (1-t0)*shade+0, (cmb-0)*prim+0
+ {0xe416e3f0, cc_one_sub_t0_mul_prim_mul_shade},
+ // Arena, Pokemon Stadium 2
+ // (t0-prim)*shade+0
+ {0xe431e431, cc_t0_sub_prim_mul_shade},
+ // silver cave, pokemon stadium 2
+ // (t0-env)*shade+0, (cmb-prim)*shade+prim
+ {0xe4516430, cc__t0_sub_env_mul_shade__sub_prim_mul_shade_add_prim},
+ // bomb mask, zelda 2. Added by Gonetz
+ // (t0-env)*shade+0, (cmb-prim)*shade+shade ** INC **
+ {0xe4518430, cc__t0_sub_env_mul_shade__sub_prim_mul_shade},
+ // terrain, Top Gear Rally 2. Added by Gonetz
+ // (t0-env)*shade+0
+ {0xe451e451, cc_t0_sub_env_mul_shade},
+ // closes, Nightmire Creatures
+ // (1-env)*shade+0
+ {0xe456e456, cc_one_sub_env_mul_shade},
+ // water, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
+ // (t0-0)*shade+0, (cmb-cmb)*cmb+cmb
+ {0xe4f10000, cc_t0_mul_shade},
+ // Monster truck madness intro. Added by Gonetz
+ // (t0-0)*shade+0, (1-0)*cmb+cmb ** INC **
+ {0xe4f100f6, cc_t0_mul_shade},
+ // terrain, SCARS. Added by Gonetz
+ // (t0-0)*shade+0, (prim-cmb)*t0+cmb ** INC **
+ {0xe4f10103, cc_t0_mul_shade},
+ // Boomerang circle, zelda
+ // (t0-0)*shade+0, (1-cmb)*t0+cmb
+ {0xe4f10106, cc_t0_mul_shade},
+ // THPS3.
+ // (t0-0)*shade+0, (1-0)*t0+cmb
+ {0xe4f101f6, cc_t0_mul_shade},
+ // ???, WWF No Mercy [CpuMaster]
+ // (t0-0)*shade+0, (env-cmb)*prim+cmb
+ {0xe4f10305, cc_t0_mul_one_sub_prim_mul_shade_add_prim_mul_env},
+ // magic bubble, zelda2. Added by Gonetz
+ // (t0-0)*shade+0, (t1-0)*shade+cmb
+ {0xe4f104f2, cc__t0_mul_shade__add__t1_mul_shade},
+ // bike select, xg2. Added by Gonetz
+ // (t0-0)*shade+0, (1-cmb)*env+cmb ** INC **
+ {0xe4f10506, cc_t0_mul_shade},
+ // a bugs life [Ogy]
+ // (t0-0)*shade+0, (cmb-0)*env+cmb
+ // {0xe4f105f0, cc_t0_mul_env_mul_shade},
+ {0xe4f105f0, cc_t0_mul_shade},
+ // Wall, quest64
+ // (t0-0)*shade+0, (1-0)*env+cmb
+ {0xe4f105f6, cc_t0_mul_shade_add_env},
+ //lava, beetle adventure racing. Added by Gonetz
+ // (t0-0)*shade+0, (prim-cmb)*cmb_a+cmb **INC**
+ {0xe4f10703, cc_t0_mul_shade},
+ // course map, Ridge Racer. Added by Gonetz
+ // (t0-0)*shade+0, (prim-cmb)*prima+cmb **INC**
+ {0xe4f10a03, cc_t0_mul_shade},
+ // arena, custom robo. Added by Gonetz
+ // (t0-0)*shade+0, (noise-cmb)*prima+cmb **INC**
+ {0xe4f10a07, cc_t0_mul_shade},
+ // arena, custom robo 2. Added by Gonetz
+ // (t0-0)*shade+0, (0-cmb)*prima+cmb **INC**
+ {0xe4f10a0f, cc_t0_mul_shade},
+ //floor in a cave, Paper mario. Added by Gonetz
+ // (t0-0)*shade+0, (cmb-prim)*prima+cmb **INC**
+ {0xe4f10a30, cc_t0_mul_shade},
+ //beetle adventure racing. Added by Gonetz
+ // (t0-0)*shade+0, (t1-prim)*prima+cmb **INC**
+ {0xe4f10a32, cc_t0_mul_shade},
+ // Monster truck madness intro. Added by Gonetz
+ // (t0-0)*shade+0, (shade-cmb)*shade_a+cmb ** INC **
+ {0xe4f10b04, cc_t0_mul_shade},
+ // xg2 intro. Added by Gonetz
+ // (t0-0)*shade+0, (1-cmb)*shade_a+cmb ** INC **
+ {0xe4f10b06, cc__t0_mul_shade__inter_one_using_shadea},
+ // Link's bomb, smash bros
+ // (t0-0)*shade+0, (env-cmb)*env_a+cmb ** INC **
+ {0xe4f10c05, cc__t0_mul_shade__inter_env_using_enva},
+ // language selection, Extreme-G XG2 (E)
+ // (t0-0)*shade+0, (1-cmb)*env_a+cmb
+ {0xe4f10c06, cc__t0_mul_shade__inter_one_using_enva},
+ // A Bugs Life, [Raziel64]
+ // (t0-0)*shade+0, (cmb-0)*k5+cmb
+ {0xe4f10ff0, cc_t0_mul_shade},
+ // Bass Rush
+ // (t0-0)*shade+0, (cmb-0)*0+cmb
+ {0xe4f11f0f, cc_t0_mul_shade},
+ // car, Top Gear Rally. Added by Gonetz
+ // (t0-0)*shade+0, (cmb-t0)*t0a+t0 **INC**
+ {0xe4f12810, cc_t0_mul_shade},
+ // logo, SCARS. Added by Gonetz
+ // (t0-0)*shade+0, (cmb-t0)*shadea+t0 **INC**
+ {0xe4f12b10, cc__t0_mul_shade_mul_shadea__add__t1_mul_one_sub_shadea},
+ // ? sign, Spiderman. Added by Gonetz
+ // (t0-0)*shade+0, (0-0)*0+t1
+ {0xe4f15fff, cc_t0_mul_shade},
+ // Major League Baseball Featuring Ken Griffey Jr.
+ // (t0-0)*shade+0, (1-0)*cmb+prim ** INC **
+ {0xe4f160f6, cc_t0_mul_shade_add_prim},
+ // plants, CBFD. Added by Gonetz
+ // (t0-0)*shade+0, (cmb-env)*shade+prim ** INC **
+ {0xe4f16450, cc_t0_sub_env_mul_shade_add_prim},
+ // Kirby64. Added by Gonetz
+ // (t0-0)*shade+0, (cmb-prim)*prima+prim
+ {0xe4f16a30, cc_t0_mul_prima_mul_shade_add_prim_mul_one_sub_prima},
+ // building shadow, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
+ // (t0-0)*shade+0, (0-0)*0+prim
+ {0xe4f17fff, cc_prim},
+ // tire trace, beetle adventure racing. Added by Gonetz
+ // (t0-0)*shade+0, (env-cmb)*t1+shade **INC**
+ {0xe4f18205, cc_env_sub_shade_mul_t0_add_shade},
+ // Gold Skulltula, zelda
+ // (t0-0)*shade+0, (prim-env)*cmb+env
+ {0xe4f1a053, cc_prim_sub_env_mul_t0_mul_shade_add_env},
+ // {0xe4f1a053, cc_t0_mul_prim_mul_shade},
+ // fighters, GASP Fighters
+ // (t0-0)*shade+0, (1-env)*cmb+env
+ {0xe4f1a056, cc_t0_mul_one_sub_env_mul_shade_add_env},
+ // Brian, quest64
+ // (t0-0)*shade+0, (cmb-0)*prim+env
+ {0xe4f1a3f0, cc_t0_mul_prim_mul_shade_add_env},
+ // Objects in arena, pokemon stadium 2
+ // (t0-0)*shade+0
+ // (cmb-prim)*shade+env
+ {0xe4f1a430, cc_t0_mul_shade},
+ // Monster truck madness intro. Added by Gonetz
+ // (t0-0)*shade+0, (cmb-env)*shadea+env **INC**
+ // {0xe4f1ab50, cc_t0_mul_shade_add_env},
+ {0xe4f1ab50, cc__t0_mul_shade__sub_env_mul_shadea_add_env},
+ // Taz express. Added by Gonetz
+ // (t0-0)*shade+0, (cmb-env)*enva+env **INC**
+ {0xe4f1ac50, cc_t0_mul_shade_add_env},
+ // sky in doom. Added by Gonetz
+ // (t0-0)*shade+0, (cmb-0)*primlod+env **INC**
+ {0xe4f1aef0, cc_t0_mul_shade_add_env},
+ // fighters, GASP Fighters
+ // (t0-0)*shade+0, (1-env)*cmb+0
+ {0xe4f1e056, cc_t0_mul_one_sub_env_mul_shade},
+ // walls, beetle adventure racing. Added by Gonetz
+ // (t0-0)*shade+0, (t0-0)*cmb+0 **INC**
+ {0xe4f1e0f1, cc_t0_mul_shade},
+ // Link's face, zelda
+ //z (t0-k5)*shade+cmb_a, (prim-k5)*cmb+cmb_a
+ {0xe4f1e0f3, cc_t0_mul_prim_mul_shade},
+ // Link's suit, zelda
+ //z (t0-k5)*shade+cmb_a, (env-k5)*cmb+cmb_a
+ {0xe4f1e0f5, cc_t0_mul_env_mul_shade},
+ // Window, starfox
+ //z (t0-k5)*shade+cmb_a, (cmb-k5)*prim+cmb_a
+ {0xe4f1e3f0, cc_t0_mul_prim_mul_shade},
+ // crystal, Doraemon 2
+ //(t0-0)*shade+0, (t0-0)*prim+0
+ {0xe4f1e3f1, cc_t0_mul_prim},
+ // Characters, mace
+ // (t0-0)*shade+0, (cmb-0)*shade+0
+ {0xe4f1e4f0, cc_t0_mul_shade},
+ // Super Mario 64 logo
+ //z (t0-k5)*shade+cmb_a
+ {0xe4f1e4f1, cc_t0_mul_shade},
+ // Kokiri's hat, zelda
+ // (t0-0)*shade+0, (cmb-0)*env+0
+ {0xe4f1e5f0, cc_t0_mul_env_mul_shade},
+ // Gauntlet Legends intro
+ // (t0-0)*shade+0, (cmb-0)*scale+0
+ {0xe4f1e6f0, cc_t0_mul_scale_mul_shade},
+ // Something on a tree, Paper Mario. Added by Gonetz
+ // (t0-0)*shade+0, (cmb-0)*prima+0
+ {0xe4f1eaf0, cc_t0_mul_prima_mul_shade},
+ // Course map, Ridge Racer. Added by Gonetz
+ // (t0-0)*shade+0, (cmb-0)*shadea+0
+ {0xe4f1ebf0, cc_t0_mul_shade_mul_shadea},
+ // Dodongo skull's eyes, zelda
+ // (t0-0)*shade+0, (cmb-0)*env_alpha+0
+ {0xe4f1ecf0, cc_t0_mul_enva_mul_shade},
+ // lava, beetle adventure racing. Added by Gonetz
+ // (t1-0)*shade+0, (cmb-prim)*cmb_a+prim **INC**
+ {0xe4f26730, cc_prim_inter_t1_mul_shade_using_texa},
+ // headlight, beetle adventure racing. Added by Gonetz
+ // (t1-0)*shade+0, (env-cmb)*t0+shade **INC**
+ {0xe4f28105, cc_one_sub__t0_mul_t1__mul_shade},
+ // bubble, Banjo-Kazooie. Added by Gonetz
+ // (t1-0)*shade+0
+ {0xe4f2e4f2, cc_t1_mul_shade},
+ // water, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
+ // (prim-0)*shade+0, (cmb-cmb)*cmb+cmb
+ {0xe4f30000, cc_prim_mul_shade},
+ // lamp shadow, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
+ // (prim-0)*shade+0, (cmb-cmb)*t0+cmb
+ {0xe4f30100, cc_prim_mul_shade},
+ // Yoshi, mario golf
+ // (prim-0)*shade+0, (env-cmb)*t0+cmb
+ {0xe4f30105, cc_env_sub_primshade_mul_t0_add_primshade},
+ //Spacestation Silicon Valley intro. Added by Gonetz
+ // (prim-0)*shade+0, (env-cmb)*t1+cmb
+ {0xe4f30205, cc_env_sub_primshade_mul_t1_add_primshade},
+ // Tip of brian's hair, quest64
+ // (prim-0)*shade+0, (1-0)*env+cmb
+ {0xe4f305f6, cc_prim_mul_shade_add_env},
+ // V8-2 menu
+ // (prim-0)*shade+0, (env-cmb)*cmb_a+cmb
+ {0xe4f30705, cc__prim_mul_shade__inter_env_using__prim_mul_shade_alpha},
+ // Background circle, xg2
+ // (prim-0)*shade+0, (1-cmb)*shade_a+cmb
+ {0xe4f30b06, cc_prim_mul_shade},
+ // circle, waverace. Added by Gonetz
+ // (prim-0)*shade+0, (t0-cmb)*enva+cmb
+ {0xe4f30c01, cc_t0_sub__prim_mul_shade__mul_enva_add__prim_mul_shade},
+ // enemy hit, Glover2
+ // (prim-0)*shade+0, (env-cmb)*enva+cmb
+ {0xe4f30c05, cc__prim_mul_shade__inter_env_using_enva},
+ // player, super bowling
+ // (prim-0)*shade+0, (0-0)*k5+cmb
+ {0xe4f30fff, cc_prim_mul_shade},
+ //Lure, bass rush
+ // (prim-0)*shade+0, (0-cmb)*0+cmb
+ {0xe4f31f0f, cc_prim_mul_shade},
+ // walls, beetle adventure racing. Added by Gonetz
+ // (prim-0)*shade+0, (cmb-shade)*t1+shade **INC**
+ {0xe4f38240, cc__one_inter_prim_using_t1__mul_shade},
+ // GASP fighters
+ //(prim-0)*shade+0, (1-env)*cmb+0
+ {0xe4f3e056, cc_prim_mul_one_sub_env_mul_shade},
+ // Flag, mario kart
+ //z (prim-k5)*shade+cmb_a
+ {0xe4f3e4f3, cc_prim_mul_shade},
+ // Characters, smash bros
+ // (prim-0)*shade+0, (cmb-0)*env+0
+ {0xe4f3e5f0, cc_prim_mul_env_mul_shade},
+ // N64 logo, ridge race. Added by Gonetz
+ // (shade-0)*shade+0, (prim-cmb)*prima+cmb **INC**
+ {0xe4f40a03, cc_shade},
+ // fighter, shield mode, bio freaks. Added by Gonetz
+ // (shade-0)*shade+0
+ {0xe4f4e4f4, cc_shade},
+ // truck crush, Monster truck madness. Added by Gonetz
+ // (env-0)*shade+0, (env-0)*shade+cmb
+ {0xe4f504f5, cc_env_mul_shade},
+ // Course map, Ridge Racer. Added by Gonetz
+ // (env-0)*shade+0
+ {0xe4f5e4f5, cc_env_mul_shade},
+ // lava, beetle adventure racing
+ // (1-0)*shade+0, (prim-cmb)*cmb_a+cmb
+ {0xe4f60703, cc_prim_sub_shade_mul_shadea_add_shade},
+ // the wings in the song of soaring cut-scene, zelda2 [Ogy]. Added by Gonetz
+ // (1-0)*shade+0, (prim-0)*cmb+0
+ {0xe4f6e0f3, cc_prim_mul_shade},
+ // parts of vehicle, Star Wars Ep.I Racer. Added by Gonetz
+ // (1-0)*shade+0, (cmb-0)*prim+0
+ {0xe4f6e3f0, cc_prim_mul_shade},
+ // Snowflakes???, mario kart. Boxer shadow (fb effect}, Knockout Kings 2000
+ // (1-0)*shade+0, (1-0)*shade+0
+ {0xe4f6e4f6, cc_one_mul_shade},
+ // ???
+ // (noise-0)*shade+0
+ {0xe4f7e4f7, cc_shade},
+ // quest64 [Ogy]
+ // (prim-t0)*env+0, (0-0)*0+prim
+ {0xe5137fff, cc_prim},
+ // field, Mike Piazza's Strike Zone
+ // (t0-prim)*env+0 ** INC **
+ {0xe531e531, cc_t0_mul_env},
+ // Mike Piazza's Strike Zone
+ // (shade-prim)*env+0
+ {0xe534e534, cc_shade_sub_prim_mul_env},
+ // rope, CBFD. Added by Gonetz
+ // (t0-0)*env+0, (1-env)*prim+cmb
+ {0xe5f10356, cc_one_sub_env_mul_prim_add__t0_mul_env},
+ // Bell, Pokemon Stadium 2. Added by Gonetz
+ // (t0-0)*env+0, (shade-0)*prim+cmb
+ {0xe5f103f4, cc_t0_mul_env_add_prim_mul_shade},
+ // aerofighter's assault [Ogy]
+ // (t0-0)*env+0, (1-t0)*shade+cmb
+ {0xe5f10416, cc_t0_mul_env_add_1mt0_mul_shade},
+ // foto, Armorines - Project S.W.A.R.M. Added by Gonetz
+ // (t0-0)*env+0, (noise-0)*scale+cmb
+ {0xe5f106f7, cc_t0_mul_env},
+ // Extreme G2, score. Added by Gonetz
+ // (t0-0)*env+0, (1-cmb)*enva+cmb ** INC **
+ {0xe5f10c06, cc_t0_mul_env},
+ // many objects in Tonic Trouble
+ // (t0-0)*env+0, (shade-0)*cmb+0
+ {0xe5f1e0f4, cc_t0_mul_env_mul_shade},
+ // Flying skull's eyes, zelda
+ // (t0-0)*env+0, (cmb-0)*prim+0
+ {0xe5f1e3f0, cc_t0_mul_prim_mul_env},
+ // Rock spell, quest64
+ // (t0-0)*env+0, (cmb-0)*shade+0
+ {0xe5f1e4f0, cc_t0_mul_env_mul_shade},
+ // Text, mario
+ //z (t0-k5)*env+cmb_a
+ {0xe5f1e5f1, cc_t0_mul_env},
+ // kirby 64. Added by Gonetz
+ // (prim-0)*env+0, (cmb-0)*shade+0
+ {0xe5f3e4f0, cc_prim_mul_env_mul_shade},
+ // wings, kirby 64. Added by Gonetz
+ // (prim-0)*env+0
+ {0xe5f3e5f3, cc_prim_mul_env},
+ // Text, xg2
+ // (shade-0)*env+0, (1-cmb)*env_a+cmb
+ {0xe5f40c06, cc_env_mul_shade},
+ // Text box, mario
+ //z (shade-k5)*env+cmb_a
+ {0xe5f4e5f4, cc_env_mul_shade},
+ // bomberman 64 [Ogy]
+ // (1-0)*env+0
+ {0xe5f6e5f6, cc_env},
+ // Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
+ // (1-t0)*scale+0
+ {0xe616e616, cc_zero},
+ // Gauntlet Legends intro. Added by Gonetz
+ // (t0-0)*scale+0, (cmb-0)*shade+0
+ {0xe6f1e4f0, cc_t0_mul_scale_mul_shade},
+ // shadows, Taz express. Added by Gonetz
+ // (t0-0)*scale+0
+ {0xe6f1e6f1, cc_t0_mul_scale},
+ // shadows, Knockout Kings 2000. Added by Gonetz
+ // (shade-0)*scale+0
+ {0xe6f4e6f4, cc_scale_mul_shade},
+ // bomberman 64 2 [Ogy]. Added by Gonetz
+ // (1-0)*scale+0
+ {0xe6f6e6f6, cc_scale},
+ // walls, beetle adventure racing. Added by Gonetz
+ // (t1-0)*t0_a+0, (1-t1)*cmb+t1 **INC**
+ {0xe8f24026, cc_t1},
+ // house on rancho, zelda2. Added by Gonetz
+ // (t1-0)*t0_a+0, (cmb-0)*prim+0
+ {0xe8f2e3f0, cc__t0a_mul_t1__mul_prim},
+ // zelda2 [Ogy]. Added by Gonetz
+ // (t1-0)*t0_a+0, (cmb-0)*shade+0
+ {0xe8f2e4f0, cc__t0a_mul_t1__mul_shade},
+ // mini quiz, Pokemon Stadium 2
+ // (prim-0)*t0_a+0, (cmb-t1)*primlod+t1 ** INC **
+ {0xe8f34e20, cc_t0},
+ // Major League Baseball Featuring Ken Griffey Jr.
+ // (prim-0)*t0_a+0
+ {0xe8f3e8f3, cc_t0a_mul_prim},
+ // Top Gear Hyper-Bike
+ // (1-0)*t0_a+0
+ {0xe8f6e8f6, cc_t0a},
+ // waterfall, Dobutsu_no_Mori
+ // (t0-0)*t1_a+0, (prim-env)*cmb+env
+ {0xe9f1a053, cc_prim_sub_env_mul__t0_mul_t1a__add_env},
+ // logo, Deadly Arts. Added by Gonetz
+ // (t0-0)*t1_a+0, (cmb-0)*shade+0
+ {0xe9f1e4f0, cc__t0_mul_t1a__mul_shade},
+ // car, Roadsters. Added by Gonetz
+ // (prim-t0)*prim_a+0, (prim-cmb)*shade+0 ** INC **
+ {0xea13e403, cc_prim_sub__prim_sub_t0_mul_prima__mul_shade},
+ // arena, Pokemon Stadium 2. Added by Gonetz
+ // (1-t0)*prim_a+0, (0-prim)*cmb+prim ** INC **
+ {0xea16603f, cc_t0_mul_prim},
+ // V8-2
+ // (1-prim)*prim_a+0
+ {0xea36ea36, cc_one_sub_prim_mul_prima},
+ // match start, Mario Tennis. Added by Gonetz
+ // (t0-0)*prim_a+0, (1-t0)*cmb+t0 ** INC **
+ {0xeaf12016, cc_one_sub_t0_mul_prima_add_t0},
+ // blast corps [Ogy]
+ // (t0-0)*prim_a+0
+ {0xeaf1eaf1, cc_t0_mul_prima},
+ // final battle, CBFD. Added by Gonetz
+ // (prim-0)*prim_a+0
+ {0xeaf3eaf3, cc_prim_mul_prima},
+ // flower's stalk, Paper Mario. Added by Gonetz
+ // (shade-0)*prim_a+0
+ {0xeaf4eaf4, cc_shade_mul_prima},
+ // blast corps [Ogy]
+ // (noise-0)*prim_a+0, (t1-0)*shade+cmb ** INC **
+ {0xeaf704f2, cc_t0_mul_shade_add_prima},
+ // F1 World Grand Prix. Added by Gonetz
+ // (noise-0)*prim_a+0, (t1-0)*env_a+cmb ** INC **
+ {0xeaf70cf2, cc_t1_mul_enva},
+ // shadows, killer instinct gold
+ // (0-0)*prim_a+0
+ {0xeaffeaff, cc_zero},
+ // background, killer instinct gold
+ // (t0-prim)*shade_a+0
+ {0xeb31eb31, cc_t0_sub_prim_mul_shadea},
+ // ground, C&C
+ // (t0-shade)*shade_a+0
+ {0xeb41eb41, cc_t0_sub_shade_mul_shadea},
+ // Wreslters, WWF No Mercy, [CpUMasteR]
+ // (t0-0)*shade_alpha+0, (env-cmb)*prim+cmb
+ {0xebf10305, cc_t0_mul_one_sub_prim_mul_shadea_add_prim_mul_env},
+ // map, Pilot wings. Added by Gonetz
+ // (t0-0)*shade_alpha+0, (1-cmb)*shade+cmb
+ {0xebf10406, cc_one_sub_shade_mul__t0_mul_shadea__add_shade},
+ // Indy Racing 2000. Added by Gonetz
+ // (t0-0)*shade_alpha+0, (1-0)*shade+cmb
+ {0xebf104f6, cc_t0_mul_shadea_add_shade},
+ // logo, WCW-nWo Revenge
+ // (t0-0)*shade_alpha+0, (cmb-0)*prim+0
+ {0xebf1e3f0, cc_t0_mul_prim_mul_shadea},
+ // sky, pilot wings
+ // (t0-0)*shade_alpha+0, (1-cmb)*shade+0
+ {0xebf1e406, cc_one_sub__t0_mul_shadea__mul_shade},
+ // Wrestlers in Game, WWF No mercy [CpUMasteR]
+ // (t0-0)*shade_alpha+0
+ {0xebf1ebf1, cc_t0_mul_shadea},
+ // flag, top gear overdrive
+ // (prim-0)*shade_alpha+0
+ {0xebf3ebf3, cc_prim_mul_shadea},
+ // Ropes, WWF games
+ // (shade-0)*shade_alpha+0, (env-cmb)*prim+cmb
+ {0xebf40305, cc_shade_mul_shadea},
+ // Ropes, WWF games
+ // (shade-0)*shade_alpha+0
+ {0xebf4ebf4, cc_shade_mul_shadea},
+ // arena, custom robo 2
+ // (noise-0)*shade_alpha+0
+ {0xebf7ebf7, cc_shadea},
+ // Baton Pass attack, Pokemon Stadium 2
+ // (t0-env)*enva+0, (shade-0)*prim+cmb
+ {0xec5103f4, cc__t0_sub_env_mul_enva__add_prim_mul_shade},
+ // Bell, Pokemon Stadium 2. Added by Gonetz
+ // (t0-0)*enva+0, (shade-0)*prim+cmb
+ {0xecf103f4, cc_t0_mul_enva_add_prim_mul_shade},
+ // blastcorps, unimp log. Added by Gonetz
+ // (t0-0)*enva+0
+ {0xecf1ecf1, cc_t0_mul_enva},
+ // car, Top Gear Rally. Added by Gonetz
+ // (env-0)*enva+0
+ {0xecf5ecf5, cc_env_mul_enva},
+ // Sand attack, pokemon Stadium (J)
+ // (noise-0)*enva+0, (prim-env)*cmb+env
+ {0xecf7a053, cc_prim_sub_env_mul_enva_add_env},
+ // Walls of well through lens of truth, zelda
+ // (prim-t0)*primlod+0 ** INC **
+ {0xee13ee13, cc_t0}, // JUST t0 b/c the other combiner handles the subtraction
+ // Pokemon attack, Pokemon Stadium 2
+ // (noise-t0)*primlod+0, (1-env)*cmb+env ** INC **
+ {0xee17a056, cc_env_inter_one_using__one_sub_t0_mul_primlod},
+ // barrage attack, Pokemon Stadium 2
+ // (t0-0)*primlod+0, (prim-0)*shade+cmb
+ {0xeef104f3, cc__t0_mul_primlod__add__prim_mul_shade},
+ // something on a flor in stone temple, zelda 2. Added by Gonetz
+ // (t0-0)*primlod+0, (cmb-0)*prim+0
+ {0xeef1e3f0, cc_t0_mul_primlod_mul_prim},
+ // entrance to oceanside spider house, zelda 2. Added by Gonetz
+ // (t0-0)*primlod+0, (cmb-0)*shade+0
+ {0xeef1e4f0, cc_t0_mul_primlod_mul_shade},
+ // Haze/(all powder status changers}, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
+ // (noise-0)*primlod+0, (prim-env)*cmb+env ** INC **
+ {0xeef7a053, cc_prim_sub_env_mul_primlod_add_env},
+ // pokemon attack, Pokemon Stadium 2. Added by Gonetz
+ // (noise-0)*primlod+0, (prim-cmb)*cmb+0 ** INC **
+ {0xeef7e003, cc_zero},
+ // Night trees, Monster truck madness. Added by Gonetz
+ // (t0-0)*k5+0
+ {0xeff1eff1, cc_t0_mul_k5},
+ // submitted by gokuss4
+ // (0-0)*0+0, (0-0)*0+prim
+ {0xfffd5fe6, cc_prim},
+ // intro, Bettle Adventure Racing, [Raziel64]
+ // (0-0)*0+0, (0-0)*0+t0
+ {0xffff3fff, cc_t0},
+ // Conker's face, CBFD
+ // (0-0)*0+0, (shade-env)*k5+prim
+ {0xffff6f54, cc_shade_sub_env_mul_k5_add_prim},
+ // Boost, Beetle Adventure Racing. Added by Gonetz
+ // (0-0)*0+0, (0-0)*0+prim
+ {0xffff7fff, cc_prim},
+ // headlight, beetle adventure racing. Added by Gonetz
+ // (0-0)*0+0, (0-0)*0+shade
+ {0xffff9fff, cc_shade},
+ // intro, Bettle Adventure Racing, [Raziel64]
+ // (0-0)*0+0, (shade-env)*t1+env
+ {0xffffa254, cc_shade_sub_env_mul_t1_add_env},
+ // Fly Swooping in, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
+ // (0-0)*0+0, (1-env)*cmb_a+env
+ {0xffffa756, cc_env},
+ // Waterfall, Donkey Kong 64
+ // (0-0)*0+0, (t0-0)*t1+0
+ {0xffffe1f2, cc_t0_mul_t1},
+ // Screen clear, banjo kazooie
+ // (0-0)*0+0
+ {0xffffffff, cc_zero},
+ // { #CCEND }
+};
+
+static COMBINER alpha_cmb_list[] = {
+ // { #ACSTART }
+ //Tony Hawk's Pro Skater. Added by Gonetz
+ // (0-0)*0+0
+ {0x01ff01ff, ac_zero},
+ //terminal, Spacestation Silicon Valley. Added by Gonetz
+ // (0-0)*0+0, (0-0)*0+prim
+ {0x01ff07ff, ac_prim},
+ // kirby drill, kirby 64. Added by Gonetz
+ // (0-0)*0+cmb, (0-0)*0+1
+ {0x01ff0dff, ac_one},
+ //chip in Spacestation Silicon Valley intro. Added by Gonetz
+ // (0-0)*0+cmb, (prim-0)*shade+0
+ {0x01ff0f3b, ac_prim_mul_shade},
+ //Goldeneye, [Jeremy]. Added by Gonetz
+ // (t0-t0)*lodf+t0, (cmb-0)*prim+0
+ {0x02090ef8, ac_t0_mul_prim},
+ // Indy Racing 2000. Added by Gonetz
+ // (t1-t0)*lodf+t0, (env-cmb)*prim+cmb ** INC **
+ {0x020a00c5, ac_t0_inter_t1_using_primlod},
+ // water, Spacestation Silicon Valley. Added by Gonetz
+ // (t1-t0)*lodf+t0, (0-shade)*0+cmb
+ {0x020a01e7, ac_t0_inter_t1_using_primlod},
+ // Bridge, sf rush
+ //z (t1-t0)*lodf+t0
+ {0x020a020a, ac_t0_inter_t1_using_primlod},
+ // explosion, body harvest. Added by Gonetz
+ //(t1-t0)*lodf+t0, (0-0)*0+t0
+ {0x020a03ff, ac_t0},
+ // cars, PD intro. Added by Gonetz
+ // (t1-t0)*lodf+t0, (cmb-0)*shade+prim
+ {0x020a0738, ac__t0_inter_t1_using_primlod__mul_shade_add_prim},
+ // Rocket Robot in Wheels intro
+ //(t1-t0)*lodf+t0, (0-0)*0+prim
+ {0x020a07ff, ac_prim},
+ // Iguana background ground, turok
+ // (t1-t0)*lodf+t0, (0-0)*0+shade
+ {0x020a09ff, ac_shade},
+ // Ground, monster truck madness
+ // (t1-t0)*lodf+t0, (0-0)*0+env
+ {0x020a0bff, ac_env},
+ // Taz express. Added by Gonetz
+ // (t1-t0)*lodf+t0, (0-0)*0+1
+ {0x020a0dff, ac_one},
+ // Mike Piazza's Strike Zone
+ // (t1-t0)*lodf+t0, (cmb-0)*t0+0
+ {0x020a0e78, ac_t0_inter_t1_using_primlod},
+ // N64 logo, tetrisphere. Added by Gonetz
+ // (t1-t0)*lodf+t0, (cmb-0)*prim+0
+ {0x020a0ef8, ac__t0_inter_t1_using_primlod__mul_prim},
+ // Ground, mace
+ // (t1-t0)*lodf+t0, (cmb-0)*shade+0
+ // {0x020a0f38, ac_t0_mul_shade},
+ {0x020a0f38, ac__t0_inter_t1_using_primlod__mul_shade},
+ // blast corps [Ogy]
+ // (t1-t0)*lodf+t0, (cmb-0)*env+0
+ {0x020a0f78, ac__t0_inter_t1_using_primlod__mul_env},
+ // blast corps [Ogy]
+ // (t1-t0)*lodf+t0, (t0-0)*env+0
+ {0x020a0f79, ac_t0_mul_env},
+ // blast corps. Added by Gonetz
+ // (t1-t0)*lodf+t0, (shade-0)*env+0
+ {0x020a0f7c, ac_env_mul_shade},
+ // field, Mike Piazza's Strike Zone
+ // (t1-t0)*lodf+t0, (0-0)*0+0
+ {0x020a0fff, ac_t0_inter_t1_using_primlod},
+ // blast corps, unimp log. Added by Gonetz
+ // (t1-t0)*t0+t0
+ {0x024a024a, ac_t0_inter_t1_using_t0a},
+ // zelda 2 [Ogy]. Added by Gonetz
+ // (t1-t0)*t0+t0, (cmb-0)*prim+0 **INC**
+ {0x024a0ef8, ac__t0_inter_t1_using_t0a__mul_prim},
+ // text in a menu, Twisted_Edge_Extreme_Snowboarding [Razeil64]. Added by Gonetz
+ // (prim-t0)*t0+t0 **INC**
+ {0x024b024b, ac_t0},
+ // enemy's shot, battle tanks 2
+ // (env-prim)*t0+t0 **INC**
+ {0x025d025d, ac_t0},
+ //Bowser in final battle, Paper Mario. Added by Gonetz
+ // (t1-env)*t0+t0, (cmb-env)*prim+0 ** INC **
+ {0x026a0ee8, ac__t0_mul_t1__mul_prim},
+ // paper mario. Added by Gonetz
+ // (t1-env)*t0+t0, (cmb-0)*prim+0 ** INC **
+ {0x026a0ef8, ac__t0_mul_t1__mul_prim},
+ // V8-2
+ // (prim-0)*t0+t0
+ {0x027b027b, ac_t0_mul_prim_add_t0},
+ // THPS3. Added by Gonetz
+ // (0-0)*t0+t0
+ {0x027f027f, ac_t0},
+ // zelda 2. Added by Gonetz
+ // (0-0)*t0+t0, (cmb-0)*prim+0
+ {0x027f0ef8, ac_t0_mul_prim},
+ // Spider Web attack, Pokemon Stadium 2.
+ // (t1-t0)*t1+t0, (cmb-0)*prim+cmb
+ {0x028a00f8, ac__t0_inter_t1_using_t1a__mul_prim_add__t0_inter_t1_using_t1a},
+ // teleportation, Spacestation Silicon Valley. Added by Gonetz
+ // (t1-t0)*t1+t0
+ {0x028a028a, ac_t0_inter_t1_using_t1a},
+ // mega shock, paper mario. Added by Gonetz
+ // (t1-t0)*t1+t0, (cmb-0)*prim+0
+ {0x028a0ef8, ac__t0_inter_t1_using_t1a__mul_prim},
+ // mini game, Pokemon Stadium 2
+ // (t1-t0)*t1+t0, (cmb-0)*shade+0
+ {0x028a0f38, ac__t0_inter_t1_using_t1a__mul_shade},
+ // Magnitude, pokemon stadium 2
+ // (shade-t0)*t1+t0, (cmb-0)*shade+env
+ {0x028c0b38, ac__t0_mul_t1__mul_shade},
+ // paper mario. Added by Gonetz
+ // (1-t0)*t1+t0, (t1-0)*prim+0 ** INC **
+ {0x028e0efa, ac__one_sub_t0_mul_t1_add_t0__mul_prim},
+ // {0x028e0efa, ac_t1_mul_prim},
+ // Spider Web attack, Pokemon Stadium 2.
+ // (1-t0)*t1+t0, (cmb-0)*shade+0 ** INC **
+ {0x028e0f38, ac__one_sub_t0_mul_t1_add_t0__mul_prim},
+ // paper mario. Added by Gonetz
+ // (t1-env)*t1+t0, (cmb-0)*shade+0
+ {0x02aa0f38, ac__t0_inter_t1_using_enva__mul_shade},
+ // Scary dead boss thing, zelda
+ // (env-1)*t1+t0, (cmb-0)*prim+0 * MAY need t1_inter_t0 instead...
+ {0x02b50ef8, ac__env_sub_one_mul_t1_add_t0__mul_prim},
+ // first screen, castlevania. Added by Gonetz
+ // (env-0)*t1+t0 **INC**
+ {0x02bd02bd, ac_t0},
+ // enemy's shot, battle tanks 2 [Flash]
+ // (1-0)*t1+t0, (0-0)*0+env
+ {0x02be0bff, ac_env},
+ // battle tanks 2 [Ogy]
+ // (1-0)*t1+t0, (0-0)*0+1
+ {0x02be0dff, ac_one},
+ // menu screen, Rayman2. Added by Gonetz
+ // (1-0)*t1+t0, (cmb-0)*shade+0
+ {0x02be0f38, ac__t0_add_t1__mul_shade},
+ // Sky, zelda
+ //z (t1-t0)*prim+t0
+ {0x02ca02ca, ac_t0_inter_t1_using_prima},
+ // F1 World Grand Prix. Added by Gonetz
+ // (t1-t0)*prim+t0, (0-0)*0+1
+ {0x02ca0dff, ac_t0_inter_t1_using_prima},
+ // logo, PD. Added by Gonetz
+ // (t1-t0)*prim+t0, (cmb-0)*shade+0
+ {0x02ca0f38, ac__t0_inter_t1_using_prima__mul_shade},
+ // battle tanks [Ogy]
+ // (t1-t0)*prim+t0, (cmb-0)*env+0
+ {0x02ca0f78, ac__t0_inter_t1_using_prima__mul_env},
+ // logo, Deadly Arts. Added by Gonetz
+ // (env-t0)*prim+t0
+ {0x02cd02cd, ac_one_sub_prim_mul_t0_add__prim_mul_env},
+ // intro, castlevania 2. Added by Gonetz
+ // (1-t0)*prim+t0
+ {0x02ce02ce, ac_one_sub_t0_mul_prim_add_t0},
+ // intro, diddy kong racing. Added by Gonetz
+ // (1-t0)*prim+t0, (cmb-0)*shade+0 **INC**
+ {0x02ce0f38, ac_t0_mul_shade},
+ // submitted by Scorpiove, mario party 1
+ // (0-t0)*prim+t0
+ {0x02cf02cf, ac_one_sub_prim_mul_t0},
+ // Pokemon attack, pokemon Stadium (J)
+ // (t1-t1)*prim+t0, (prim-0)*lod_f+env **INC**
+ {0x02d20a3b, ac_env},
+ // Ground, pokemon stadium 2
+ // (t0-0)*prim+t0
+ {0x02f902f9, ac_t0_mul_prim},
+ // GASP Fighters
+ // (t1-0)*prim+t0, ** INC **
+ {0x02fa02fa, ac_t1_mul_prim_add_t0},
+ // foresight attack, Pokemon Stadium 2
+ // (t1-0)*prim+t0, (cmb-env)*shade+0
+ {0x02fa0f28, ac__t1_mul_prima_add_t0__sub_env_mul_shade},
+ // Earthquake pokemon attack, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
+ // (t1-0)*prim+t0, (cmb-0)*shade+0
+ {0x02fa0f38, ac__t1_mul_prima_add_t0__mul_shade},
+ // Paper Mario, fortune teller
+ // (t1-0)*prim+t0, (cmb-0)*env+0
+ {0x02fa0f78, ac__t1_mul_prima_add_t0__mul_env},
+ // Hydro Pump Attack, Pokemon Stadium.
+ // (shade-0)*prim+t0, (cmb-0)*shade+0
+ {0x02fc0f38, ac__t0_add_prim_mul_shade__mul_shade},
+ // map, Ogre Battle 64. Added by Gonetz
+ // (1-0)*prim+t0
+ {0x02fe02fe, ac_t0_add_prim},
+ // borders, Tony Hawk's Pro Skater 2. Added by Gonetz
+ // (t1-t0)*shade+t0 ** INC **
+ {0x030a030a, ac_t0_inter_t1_using_shadea},
+ // Mickey USA
+ // (t1-t0)*shade+t0, (cmb-0)*prim+0 ** INC **
+ {0x030a0ef8, ac__t0_inter_t1_using_shadea__mul_prim},
+ // Rocket Robot in Wheels intro
+ // (t1-t0)*shade+t0, (cmb-0)*env+0 ** INC **
+ {0x030a0f78, ac__t0_inter_t1_using_shadea__mul_env},
+ // water, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
+ // (1-t0)*shade+t0, (cmb-0)*shade+0 ** INC **
+ {0x030e0f38, ac_t0_mul_shade},
+ // sky, f-zero x
+ // (0-t0)*shade+t0
+ {0x030f030f, ac_one_sub_shade_mul_t0},
+ // Deku tree from kokiri villiage, zelda
+ //z (t1-t0)*env+t0, (t1-0)*primlod+cmb
+ {0x034a01ba, ac_t0_inter_t1_using_enva},
+ // Hearts, zelda
+ //z (t1-t0)*env+t0
+ {0x034a034a, ac_t0_inter_t1_using_enva},
+ // Faries, zelda
+ //z (t1-t0)*env+t0, (cmb-0)*prim+0
+ {0x034a0ef8, ac__t0_inter_t1_using_enva__mul_prim},
+ // zelda, waterfall. Added by Gonetz
+ //z (t1-t0)*env+t0, (cmb-0)*shade+0
+ {0x034a0f38, ac__t0_inter_t1_using_enva__mul_shade},
+ // pokemon stadium 1. Added by Gonetz
+ //(t1-t0)*env+t0, (cmb-0)*primlod+0
+ {0x034a0fb8, ac__t0_inter_t1_using_enva__mul_primlod},
+ // fruits, Yoshi Story. Added by Gonetz
+ //(prim-t0)*env+t0
+ {0x034b034b, ac_prim_sub_t0_mul_env_add_t0},
+ // window, Rayman2. Added by Gonetz
+ //(1-t0)*env+t0
+ {0x034e034e, ac_one_sub_t0_mul_env_add_t0},
+ // menu, PokemonStadium1, [Raziel64]
+ //(1-t0)*env+t0, (cmb-0)*shade+0 ** INC **
+ {0x034e0f38, ac_t0_mul_shade},
+ // Ganon's sword swinging, zelda
+ // (t0-t1)*env+t0, (cmb-0)*prim+0 ** INC **
+ {0x03510ef8, ac__t0_sub_t1_mul_enva_add_t0__mul_prim},
+ // Lave piranha atack, Paper Mario
+ // (t1-prim)*env+t0, (0-cmb)*t1+0 ** INC **
+ {0x035a0e87, ac_t0_mul_t1},
+ // Reflected fire at kotake & koume's, zelda
+ // (t0-1)*env+t0, (cmb-0)*prim+0 ** INC **
+ {0x03710ef8, ac__t0_sub_one_mul_enva_add_t0__mul_prim},
+ // thing that escapes from the well, zelda
+ // (t1-1)*env+t0 ** INC **
+ {0x03720372, ac_t1_sub_one_mul_enva_add_t0},
+ // Sword charge, zelda
+ // (t1-1)*env+t0, (cmb-0)*prim+0
+ {0x03720ef8, ac__t1_sub_one_mul_enva_add_t0__mul_prim},
+ // Gannon hitting the ground, zelda
+ // (t1-1)*env+t0, (cmb-0)*shade+0 ** INC **
+ {0x03720f38, ac__t1_sub_one_mul_enva_add_t0__mul_shade},
+ // Tony Hawk's Pro Skater 3. Added by Gonetz
+ // (t0-0)*env+t0
+ {0x03790379, ac_t0_mul_env},
+ // paper mario. Added by Gonetz
+ // (t0-0)*env+t0, (cmb-0)*prim+0
+ {0x03790ef8, ac_t0_mul_prim},
+ // pads, Pokemon Stadium 2. Added by Gonetz
+ // (t1-0)*env+t0, (cmb-0)*prim+env ** INC **
+ {0x037a0af8, ac__t0_inter_t1_using_enva__mul_prim_add_env},
+ // attack, Pokemon Stadium 2
+ // (t1-0)*env+t0, (cmb-t0)*prim+0 ** INC **
+ {0x037a0ec8, ac__t1_mul_enva_add_t0__mul_prim},
+ // Ice arrow gfx, zelda
+ // (t1-0)*env+t0, (cmb-0)*prim+0
+ {0x037a0ef8, ac__t1_mul_enva_add_t0__mul_prim},
+ // Scary face move, pokemon stadium 2
+ // (t1-0)*env+t0, (cmb-prim)*shade+0
+ {0x037a0f18, ac__t1_mul_enva_add_t0__sub_prim_mul_shade},
+ // Saria's song, zelda
+ // (t1-0)*env+t0, (cmb-0)*shade+0
+ {0x037a0f38, ac__t1_mul_enva_add_t0__mul_shade},
+ // eye drops bottle, zelda
+ // (t0-t0)*prim_lodfrac+t0
+ {0x03890389, ac_t0},
+ // lighthouse's beam, zelda 2. Added by Gonetz
+ // (t0-t0)*prim_lodfrac+t0, (cmb-0)*prim+0
+ {0x03890ef8, ac_t0_mul_prim},
+ // zelda 2. Added by Gonetz
+ // (t1-t0)*primlod+t0, (cmb-0)*env+cmb ** INC **
+ {0x038a0178, ac__t0_inter_t1_using_primlod__mul_env_add__t0_inter_t1_using_primlod},
+ // Enter name letter background, zelda
+ //z (t1-t0)*primlod+t0
+ {0x038a038a, ac_t0_inter_t1_using_primlod},
+ // Sunny Day, Pokemon Stadium 2
+ // (t1-t0)*primlod+t0, (cmb-0)*0+prim
+ {0x038a07f8, ac_prim},
+ //attack, Pokemon Stadium 2
+ // (t1-t0)*primlod+t0, (cmb-env)*shade+shade ** INC **
+ {0x038a0928, ac__t0_inter_t1_using_primlod__sub_env_mul_shade_add_shade},
+ // blastcorps, unimp log. Added by Gonetz
+ // (t1-t0)*primlod+t0, (0-0)*0+shade **INC**?
+ {0x038a09ff, ac_t0_inter_t1_using_primlod},
+ // pokemon attack, pokemon monsters (J)
+ // (t1-t0)*primlod+t0, (cmb-0)*prim+env
+ {0x038a0af8, ac__t0_inter_t1_using_primlod__mul_prim_add_env},
+ // sky, PGA European Tour
+ // (t1-t0)*primlod+t0, (0-0)*0+1
+ {0x038a0dff, ac_one},
+ // Ice surrounding enemy, zelda
+ // (t1-t0)*primlod+t0, (env-0)*lodf+0
+ {0x038a0e3d, ac__t0_inter_t1_using_primlod__mul_env},
+ // the bridge out side the mountain smithy shop, zelda 2 [Ogy]. Added by Gonetz
+ // (t1-t0)*primlod+t0, (cmb-0)*t0+0
+ {0x038a0e78, ac_t0_inter_t1_using_primlod},
+ // zelda 2, [Ogy]. Added by Gonetz
+ // (t1-t0)*primlod+t0, (cmb-0)*t1+0
+ {0x038a0eb8, ac_t0_inter_t1_using_primlod},
+ // Kirby's pool, smash bros
+ // (t1-t0)*primlod+t0, (cmb-0)*prim+0
+ {0x038a0ef8, ac__t0_inter_t1_using_primlod__mul_prim},
+ // Samus stage fire, smash bros
+ // (t1-t0)*primlod+t0, (cmb-0)*shade+0
+ {0x038a0f38, ac__t0_inter_t1_using_primlod__mul_shade},
+ // something about ice, zelda
+ // (t1-t0)*primlod+t0, (cmb-0)*env+0
+ {0x038a0f78, ac__t0_inter_t1_using_primlod__mul_env},
+ // Blast Corps. Added by Gonetz
+ // (t1-t0)*primlod+t0, (shade-0)*env+0
+ {0x038a0f7c, ac_env_mul_shade},
+ // goals, J. League Tactics Soccer. Added by Gonetz
+ // (prim-t0)*primlod+t0 ** INC **
+ {0x038b038b, ac_t0},
+ // zelda 2, [Ogy]. Added by Gonetz
+ // (t0-t1)*primlod+t0, (cmb-0)*prim+0
+ {0x03910ef8, ac__t0_sub_t1_mul_primlod_add_t0__mul_prim},
+ // a plane in the entrance to the mountain village zelda 2, [Ogy]. Added by Gonetz
+ // (t1-t1)*primlod+t0, (cmb-0)*prim+0 ** INC **?
+ {0x03920ef8, ac_t0_mul_prim},
+ // zelda 2. Added by Gonetz
+ // (t1-prim)*primlod+t0, (cmb-0)*prim+0 ** INC **
+ {0x039a0ef8, ac__t1_sub_prim_mul_primlod_add_t0__mul_prim},
+ // zelda 2. Added by Gonetz
+ // (t1-shade)*primlod+t0, (cmb-0)*shade+0 ** INC **
+ {0x03a20f38, ac__t1_sub_shade_mul_primlod_add_t0__mul_shade},
+ // saffron city, Pokemon Stadium 2
+ // (t1-1)*primlod+t0, (cmb-0)*0+cmb
+ {0x03b201f8, ac_t1_sub_one_mul_primlod_add_t0},
+ // Candle flame in ganon's castle, zelda
+ // (t1-1)*primlod+t0
+ {0x03b203b2, ac_t1_sub_one_mul_primlod_add_t0},
+ // Fire, zelda
+ //z (t1-1)*primlod+t0, (cmb-0)*prim+0 ** INC **
+ {0x03b20ef8, ac__t1_sub_one_mul_primlod_add_t0__mul_prim},
+ // explosion, zelda 2. Added by Gonetz
+ // (t1-1)*primlod+t0, (t0-0)*prim+0 ** INC **
+ {0x03b20ef9, ac_t0_mul_prim},
+ // Din's fire, zelda
+ // (t1-1)*prim_lodfrac+t0, (cmb-0)*shade+0 ** INC **
+ {0x03b20f38, ac__t1_sub_one_mul_primlod_add_t0__mul_shade},
+ // Fire cloud, zelda
+ // (t1-1)*prim_lodfrac+t0, (cmb-0)*env+0 ** INC **
+ {0x03b20f78, ac__t1_sub_one_mul_primlod_add_t0__mul_env},
+ // zelda 2 [Ogy]. Added by Gonetz
+ // (prim-1)*prim_lodfrac+t0, (cmb-0)*env+0 ** INC **
+ {0x03b30f78, ac__prim_sub_one_mul_primlod_add_t0__mul_env},
+ // fairy's spirit, zelda oot
+ // (t0-0)*primlod+t0
+ {0x03b903b9, ac_t0_mul_primlod_add_t0},
+ // Scary face, pokemon stadium 2
+ // (t0-0)*primlod+t0, (cmb-0)*prim+0
+ {0x03b90ef8, ac_t0_mul_prim},
+ // Magnitude attack, Pokemon Stadium 2
+ // (t0-0)*primlod+t0, (cmb-0)*shade+0
+ {0x03b90f38, ac__t0_mul_primlod_add_t0__mul_shade},
+ // Leftovers Recovery, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
+ // (t1-0)*prim_lodfrac+t0, (cmb-env)*prim+0 ** INC **
+ {0x03ba0ee8, ac__t1_mul_primlod_add_t0__sub_env_mul_prim},
+ // zelda 2 [Ogy]. Added by Gonetz
+ // (t1-0)*prim_lodfrac+t0, (cmb-0)*prim+0
+ {0x03ba0ef8, ac__t1_mul_primlod_add_t0__mul_prim},
+ // Mega punch attack, Pokemon Stadium 2
+ // (t1-0)*prim_lodfrac+t0, (cmb-prim)*shade+0
+ {0x03ba0f18, ac__t1_mul_primlod_add_t0__sub_prim_mul_shade},
+ // zelda 2 [Ogy]. Added by Gonetz
+ // (t1-0)*prim_lodfrac+t0, (cmb-0)*shade+0
+ {0x03ba0f38, ac__t1_mul_primlod_add_t0__mul_shade},
+ // chuchu monsters, zelda 2 [Ogy]. Added by Gonetz
+ // (t1-0)*prim_lodfrac+t0, (cmb-0)*env+0
+ {0x03ba0f78, ac__t1_mul_primlod_add_t0__mul_env},
+ // Scary face, pokemon stadium 2
+ // (env-0)*primlod+t0, (cmb-0)*prim+0
+ {0x03bd0ef8, ac_t0_mul_prim},
+ // ground, zelda 2. Added by Gonetz
+ // (t1-t0)*0+t0, (cmb-0)*0+cmb
+ {0x03ca01f8, ac_t0},
+ // zelda 2. Added by Gonetz
+ // (t1-t0)*0+t0, (cmb-0)*prim+0
+ {0x03ca0ef8, ac_t0_mul_prim},
+ // smoke in a night, zelda 2. Added by Gonetz
+ // (t1-t0)*0+t0, (cmb-0)*shade+0
+ {0x03ca0f38, ac_t0_mul_shade},
+ //the ice plane out side the mountain smithy shop, zelda 2 [Ogy]. Added by Gonetz
+ //(t1-1)*0+t0, (cmb-0)*env+0
+ {0x03f20f78, ac_t0_mul_env},
+ //something on level 5, Kirby64 [Raziel64]
+ //(t0-0)*0+t0
+ {0x03f903f9, ac_t0},
+ //spider house, zelda 2 [Ogy]. Added by Gonetz
+ //(t0-0)*0+t0, (cmb-0)*prim+0
+ {0x03f90ef8, ac_t0_mul_prim},
+ //Darmani's fire spin, zelda 2 [Ogy]. Added by Gonetz
+ //(t1-0)*0+t0, (cmb-0)*prim+0
+ {0x03fa0ef8, ac_t0_mul_prim},
+ // headlight, beetle adventure racing. Added by Gonetz
+ //(1-0)*0+t0
+ {0x03fe03fe, ac_t0},
+ // player, super bowling
+ // (0-0)*0+t0,
+ {0x03ff0000, ac_t0},
+ // Ghost's lantern, zelda
+ // (0-0)*0+t0, (t1-0)*prim_lod+cmb
+ {0x03ff01ba, ac_t1_mul_primlod_add_t0},
+ // Hand cursor, mario
+ //z (0-0)*0+t0
+ {0x03ff03ff, ac_t0},
+ // Taz express. Added by Gonetz
+ // (0-0)*0+t0, (0-0)*0+t1
+ {0x03ff05ff, ac_t0},
+ // powder keg, zelda2. Added by Gonetz
+ // (0-0)*0+t0, (0-0)*0+prim
+ {0x03ff07ff, ac_t0},
+ // water, Spacestation Silicon Valley. Added by Gonetz
+ // (0-0)*0+t0, (0-0)*0+shade
+ {0x03ff09ff, ac_t0},
+ // Characters, Ogre Battle. Added by Gonetz.
+ // (0-0)*0+t0, (cmb-0)*prim+env
+ {0x03ff0af8, ac_t0_mul_prim_add_env},
+ // Monster truck madness intro. Added by Gonetz
+ // (0-0)*0+t0, (0-0)*0+env
+ {0x03ff0bff, ac_t0},
+ // Battlezone
+ // (0-0)*0+t0, (0-0)*0+1
+ {0x03ff0dff, ac_t0},
+ // Zoras, zelda
+ // (0-0)*0+t0, (env-0)*lodf+0
+ {0x03ff0e3d, ac_env},
+ // logo, v-rally 99
+ // (0-0)*0+t0, (prim-0)*t0+0
+ {0x03ff0e7b, ac_t0_mul_prim},
+ // intro, WWF-War Zone
+ // (0-0)*0+t0, (env-0)*t0+0
+ {0x03ff0e7d, ac_t0_mul_env},
+ // Window, starfox
+ //z (0-0)*0+t0, (cmb-0)*prim+0
+ {0x03ff0ef8, ac_t0_mul_prim},
+ //beetle adventure racing. Added by Gonetz
+ // (0-0)*0+t0, (cmb-0)*shade+0
+ {0x03ff0f38, ac_t0_mul_shade},
+ // Wonder Project J2 logo. Added by Gonetz
+ // (0-0)*0+t0, (t0-0)*shade+0
+ {0x03ff0f39, ac_t0_mul_shade},
+ // Saria's suit, zelda
+ // (0-0)*0+t0, (cmb-0)*env+0
+ {0x03ff0f78, ac_t0_mul_env},
+ // Pokemon Stadium 2, [Jeremy]. Added by Gonetz
+ // (0-0)*0+t0, (cmb-0)*primlod+0
+ {0x03ff0fb8, ac_t0_mul_primlod},
+ // Tony Hawk's Pro Skater. Added by Gonetz
+ // (0-0)*0+t0, (0-0)*0+0
+ {0x03ff0fff, ac_zero},
+ // Spider Web attack, Pokemon Stadium 2.
+ // (t0-t1)*t0+t1, (cmb-0)*prim+cmb **INC**
+ {0x045100f8, ac__t1_inter_t0_using_t0a__mul_prim_add__t1_inter_t0_using_t0a},
+ // Powered Star Beam, Paper Mario. Added by Gonetz
+ // (t0-t1)*t0+t1, (cmb-0)*prim+0 **INC**
+ {0x04510ef8, ac__t1_inter_t0_using_t0a__mul_prim},
+ // Deadly Arts logo. Added by Gonetz
+ // (1-0)*t0+t1, (1-0)*prim+cmb
+ {0x047e00fe, ac__t0_add_t1__add_prim},
+ // Spiderman. Added by Gonetz
+ // (1-0)*t0+t1
+ {0x047e047e, ac_t0_add_t1},
+ // water, Dobutsu no Mori. Added by Gonetz
+ // (1-0)*t0+t1, (cmb-0)*primlod+prim
+ {0x047e07b8, ac__t0_add_t1__mul_primlod_add_prim},
+ // paper mario. Added by Gonetz
+ // (1-t0)*t1+t1, (cmb-0)*t1+0 **INC**
+ {0x048e0eb8, ac_t0_mul_t1},
+ // Pokemon Stadium 2. Added by Gonetz
+ // (t0-prim)*t1+t1, (cmb-0)*shade+0 **INC**
+ {0x04990f38, ac_t1_mul_shade},
+ // waterfall, Dobutsu no Mori. Added by Gonetz
+ // (t0-0)*t1+t1
+ {0x04b904b9, ac_t0_mul_t1_add_t1},
+ // light, Dobutsu no Mori. Added by Gonetz
+ // (t0-0)*t1+t1, (cmb-0)*primlod+0 ** INC **
+ {0x04b90fb8, ac__t0_add_t1__mul_primlod},
+ // lava, beetle adventure racing
+ // (t1-0)*t1+t1, (cmb-0)*shade+0 ** INC **
+ {0x04ba0f38, ac__t1_mul_t1_add_t1__mul_shade},
+ // wheels, F1 World Grand Prix. Added by Gonetz
+ // (t0-t1)*prim+t1
+ {0x04d104d1, ac_t1_inter_t0_using_prima},
+ // intro, castlevania 2. Added by Gonetz
+ // (t0-t1)*prim+t1, (cmb-0)*shade+0
+ {0x04d10f38, ac__t1_inter_t0_using_prima__mul_shade},
+ // flame, castlevania 2. Added by Gonetz
+ // (t0-t1)*prim+t1, (cmb-0)*env+0
+ {0x04d10f78, ac__t1_inter_t0_using_prima__mul_env},
+ // walls, beetle adventure racing. Added by Gonetz
+ // (t0-0)*prim+t1 **INC**
+ {0x04f904f9, ac_t0_mul_prim},
+ // Reflect pokemon attack, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
+ // (t0-0)*prim+t1, (cmb-0)*prim+env **INC**
+ {0x04f90af8, ac__t0_add_t1__mul_prim_add_env},
+ // Psychic pokemon attack, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
+ // (t0-0)*prim+t1, (cmb-0)*shade+0 **INC**
+ {0x04f90f38, ac__t0_add_t1__mul_shade},
+ // Rayman2. Added by Gonetz
+ // (0-0)*shade+t1, (cmb-0)*env+0
+ {0x053f0f78, ac_t1_mul_env},
+ // Ground at kotake & koume, zelda
+ // (t1-t0)*env+t1, (cmb-0)*prim+0 ** INC **
+ {0x054a0ef8, ac__t1_sub_t0_mul_enva_add_t1__mul_prim},
+ // Tony Hawk's Pro Skater. Added by Gonetz
+ // (t0-t1)*env+t1
+ {0x05510551, ac_t1_inter_t0_using_enva},
+ // Shiek's disappearance, zelda
+ // (t0-1)*env+t1
+ {0x05710571, ac_t0_sub_one_mul_enva_add_t1},
+ // Kotake or koume's magic poof, zelda
+ // (t0-1)*env+t1, (cmb-0)*prim+0 ** INC **
+ {0x05710ef8, ac__t0_sub_one_mul_enva_add_t1__mul_prim},
+ // Gauntlet Legends intro
+ // (t0-0)*env+t1, (cmb-0)*prim+0 ** INC **
+ {0x05790ef8, ac__t0_add_t1__mul_prim},
+ // Zelda opening door, zelda
+ // (t0-0)*env+t1, (cmb-0)*shade+0
+ {0x05790f38, ac_t1_mul_shade},
+ // paper mario. Added by Gonetz
+ // (t1-0)*env+t1, (cmb-0)*prim+0 ** INC **
+ {0x057a0ef8, ac_t1_mul_prim},
+ // pokemon attack, Pokemon Stadium 2. Added by Gonetz
+ // (t0-t1)*prim_lod+t1, (cmb-0)*prim+0
+ {0x05910ef8, ac__t1_inter_t0_using_primlod__mul_prim},
+ // Skulltula coin, zelda
+ // (t0-1)*primlod+t1 ** INC **
+ {0x05b105b1, ac_t0_mul_t1},
+ // Bell, Pokemon Stadium 2. Added by Gonetz
+ // (t0-0)*primlod+t1, (cmb-env)*prim ** INC **
+ {0x05b90ee8, ac__t0_add_t1__mul_prim},
+ // intro, Aidyn Chronicles. Added by Gonetz
+ // (0-cmb)*0+t1, (t1-1)*0+cmb
+ {0x05c701f2, ac_t1},
+ // zelda 2 [Ogy]. Added by Gonetz
+ // (t1-t0)*0+t1, (cmb-0)*prim+0
+ {0x05ca0ef8, ac_t1_mul_prim},
+ // beaver's river, zelda 2. Added by Gonetz
+ // (t1-0)*0+t1, (cmb-0)*prim+0
+ {0x05fa0ef8, ac_t1_mul_prim},
+ // Arena, pokemon stadium 2
+ // (0-0)*0+t1, (0-0)*t0+cmb
+ {0x05ff007f, ac_t1},
+ // Ogre Battle, unimp log. Added by Gonetz
+ // (0-0)*0+t1, (0-0)*0+cmb
+ {0x05ff05ff, ac_t1},
+ // lullaby, Paper Mario. Added by Gonetz
+ // (0-0)*0+t1, (cmb-0)*prim+0
+ {0x05ff0ef8, ac_t1_mul_prim},
+ // aerofighter's assault [Ogy]
+ // (0-0)*0+t1, (cmb-0)*shade+0
+ {0x05ff0f38, ac_t1_mul_shade},
+ // magic fist, Rayman2. Added by Gonetz
+ // (0-0)*0+t1, (cmb-0)*env+0
+ {0x05ff0f78, ac_t1_mul_env},
+ // Pokemon selection background, Pokemon stadium 2
+ // (env-prim)*t0+prim
+ {0x065d065d, ac_env_sub_prim_mul_t0_add_prim},
+ // text background, Ganbare Goemon - Mononoke Sugoroku
+ // (1-prim)*t0+prim
+ {0x065e065e, ac_one_sub_prim_mul_t0_add_prim},
+ // shadows, star wars: ep1 racer
+ // (0-prim)*t0+prim
+ {0x065f065f, ac_zero_sub_prim_mul_t0_add_prim},
+ // lava, beetle adventure racing
+ // (0-1)*t0+prim, (cmb-0)*prim+0 ** INC **
+ {0x06770ef8, ac_t0_mul_prim},
+ // menu, Ganbare Goemon - Mononoke Sugoroku
+ // (t0-0)*t0+prim
+ {0x06790679, ac_t0_add_prim},
+ // Water, pokemon stadium 2
+ // (t1-0)*t0+prim
+ {0x067a067a, ac_t0_mul_t1_add_prim},
+ // Smackdown Mall Menu, WWF No Mercy
+ // (shade-0)*t0+prim
+ {0x067c067c, ac_t0_mul_shade_add_prim},
+ // flag, Top Gear Rally 2. Added by Gonetz
+ // (env-0)*t0+prim
+ {0x067d067d, ac_t0_mul_env_add_prim},
+ // Mario Tennis. Added by Gonetz
+ // (1-0)*t0+prim
+ {0x067e067e, ac_t0_add_prim},
+ // sky, PGA European Tour
+ // (t0-0)*t1+prim
+ {0x06b906b9, ac_t0_mul_t1_add_prim},
+ // lava, beetle adventure racing
+ // (t0-0)*t1+prim, (0-0)*0+1 **INC**?
+ {0x06b90dff, ac_one},
+ // Pokemon Stadium 2, [Jeremy]. Added by Gonetz
+ // (prim-0)*t1+prim
+ {0x06bb06bb, ac_t1_mul_prim_add_prim},
+ // pokemon psyattack, Pokemon Stadium 2. Added by Gonetz
+ // (1-0)*t1+prim, (cmb-0)*env+0
+ {0x06be0f78, ac_t1_add_prim_mul_env},
+ // Rush2 2. Added by Gonetz
+ // (prim-prim)*prim+prim
+ {0x06db06db, ac_prim},
+ //Spacestation Silicon Valley intro. Added by Gonetz
+ // (t1-prim)*shade+prim
+ // {0x071a071a, ac_t1_mul_shade},
+ {0x071a071a, ac_t1_sub_prim_mul_shade_add_prim},
+ //KI logos. Added by Gonetz
+ // (env-prim)*shade+prim
+ {0x071d071d, ac_env_sub_prim_mul_shade_add_prim},
+ // Deadly Arts, arena. Added by Gonetz
+ // (1-0)*shade+prim
+ {0x073e073e, ac_prim_add_shade},
+ // Phantom Gannon's portal, zelda
+ // (t1-t0)*env+prim, (cmb-0)*shade+0 ** INC **
+ {0x074a0f38, ac__t0_mul_t1__mul_prim_mul_shade},
+ // Road rush. Added by Gonetz
+ // (t0-0)*env+prim
+ {0x07790779, ac_t0_mul_env_add_prim},
+ // arena, Pokemon Stadium 2
+ // (shade-t0)*primlod+prim, (cmb-t0)*shade ** INC **
+ {0x078c0f08, ac_shade_sub_t0_mul_primlod_add_prim},
+ // telescope, zelda 2. Added by Gonetz
+ // (1-t0)*primlod+prim
+ {0x078e078e, ac_one_sub_t0_mul_primlod_add_prim},
+ // zelda 2 [Ogy]. Added by Gonetz
+ // (t0-t1)*primlod+prim, (cmb-0)*t0+0
+ {0x07910e78, ac_t0_inter_t1_using_primlod},
+ // Dobutsu no Mori. Added by Gonetz
+ // (t0-0)*primlod+prim
+ {0x07b907b9, ac_t0_mul_primlod_add_prim},
+ // Lock-On attack, Pokemon Stadium 2
+ // (t1-t0)*0+prim, (cmb-0)*0+cmb
+ {0x07ca01f8, ac_prim},
+ // water, DK64
+ // (0-0)*0+0, (0-t1)*0+prim
+ {0x07d707d7, ac_prim},
+ // Menu, megaman
+ // (1-0)*0+prim
+ {0x07fe07fe, ac_prim},
+ // super bowling
+ //(0-0)*0+prim,
+ {0x07ff0000, ac_prim},
+ // menu, Ganbare Goemon - Mononoke Sugoroku
+ // (0-0)*0+prim, (0-0)*0+t0
+ {0x07ff03ff, ac_t0},
+ // Intro background, starfox
+ //z (0-0)*0+prim
+ {0x07ff07ff, ac_prim},
+ // velva boss, JFG
+ //(0-0)*0+prim, (0-0)*0+env
+ {0x07ff0bff, ac_env},
+ // gem, castlevania 2. Added by Gonetz
+ // (0-0)*0+prim, (cmb-0)*t0+0
+ {0x07ff0e78, ac_t0_mul_prim},
+ // text, Tony Hawk's Pro Skater. Added by Gonetz
+ // (0-0)*0+prim, (cmb-0)*t1+0
+ {0x07ff0eb8, ac_t1_mul_prim}, //weird, but implementing this makes text unreadable
+ // zelda 2. Added by Gonetz
+ // (0-0)*0+prim, (cmb-0)*prim+0
+ {0x07ff0ef8, ac_prim_mul_prim},
+ // explosion, Blast Corps. Added by Gonetz
+ // (0-0)*0+prim, (t0-0)*prim+0
+ {0x07ff0ef9, ac_t0_mul_prim},
+ // zelda 2, [Ogy]. Added by Gonetz
+ // (0-0)*0+prim, (cmb-0)*shade+0
+ {0x07ff0f38, ac_prim_mul_shade},
+ // Fox's ears and arms, smash bros
+ // (0-0)*0+prim, (cmb-0)*env+0
+ {0x07ff0f78, ac_prim_mul_env},
+ // monsters, Pokemon Stadium. Added by Gonetz
+ // (0-0)*0+prim, (cmb-0)*primlod+0
+ {0x07ff0fb8, ac_prim_mul_primlod},
+ // Hydro Pump Attack, Pokemon Stadium.
+ // (1-t1)*t0+shade, (cmb-prim)*shade+0
+ {0x08560f18, ac__one_sub_t1_mul_t0_add_shade__sub_prim_mul_shade},
+ // focus, Paper Mario. Added by Gonetz
+ //(t0-shade)*t0+shade, (cmb-0)*prim+0 * INC **
+ {0x08610ef8, ac_t0_mul_prim},
+ // Mario's head, mario //Added by Gonetz
+ //(prim-shade)*t0+shade
+ {0x08630863, ac_prim_sub_shade_mul_t0_add_shade},
+ // Fissure attack, pokemon stadium 2
+ //(t1-t0)*prim+shade, (cmb-0)*shade+0
+ {0x08ca0f38, ac__t1_sub_t0_mul_prim_add_shade__mul_shade},
+ // Earthquake pokemon attack, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
+ //(t0-t1)*prim+shade, (cmb-0)*shade+0 ** INC **
+ {0x08d10f38, ac__t0_sub_t1_mul_prim_add_shade__mul_shade},
+ // ?
+ //(t0-shade)*prim+shade
+ {0x08e108e1, ac_t0_mul_prim_add_shade_mul_one_minus_prim},
+ // Paper Mario
+ // (t0-prim)*shade+shade, (cmb-0)*env+0
+ {0x09190f78, ac__t0_sub_prim_mul_shade_add_shade__mul_env},
+ // pads, Pokemon Stadium 2. Added by Gonetz
+ // (0-t0)*env+shade, (cmb-0)*prim+0 ** INC **
+ {0x094f0ef8, ac_one_sub_t0_mul_prim_mul_shade},
+ // sun rays, Pokemon Stadium 2.
+ // (shade-0)*env+shade, (cmb-0)*prim+0
+ {0x097c0ef8, ac_one_plus_env_mul_prim_mul_shade},
+ // attack, Pokemon Stadium 2.
+ // (t0-0)*primlod+shade, (cmb-0)*shade+0
+ {0x09b90f38, ac__t0_mul_primlod_add_shade__mul_shade},
+ // Huge turtle appearance, zelda 2. Added by Gonetz
+ // (t1-0)*primlod+shade, (cmb-0)*shade+0 ** INC **
+ {0x09ba0f38, ac__t1_mul_primlod_add_shade__mul_shade},
+ // roof, Kirby 64. Added by Gonetz
+ // (t0-0)*0+shade
+ {0x09f909f9, ac_shade},
+ // water, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
+ // (0-0)*0+shade, (cmb-cmb)*lodf+cmb
+ {0x09ff0000, ac_shade},
+ // water temple, zelda 2. Added by Gonetz
+ // (0-0)*0+shade, (cmb-0)*prim+cmb
+ {0x09ff00f8, ac_prim_mul_shade_add_shade},
+ // damaged car, SCARS. Added by Gonetz
+ // (0-0)*0+shade, (t0-t1)*primlod+prim ** INC **
+ {0x09ff0791, ac_t0_mul_primlod_add_prim},
+ // Hyrule castle gate, zelda
+ //z (0-0)*0+shade, (0-0)*0+prim
+ {0x09ff07ff, ac_prim},
+ // Super Mario 64 logo
+ //z (0-0)*0+shade
+ {0x09ff09ff, ac_shade},
+ // terrain, SCARS. Added by Gonetz
+ // (0-0)*0+shade, (0-0)*0+1
+ {0x09ff0dff, ac_one},
+ // terrain, SCARS. Added by Gonetz
+ // (0-0)*0+shade, (t0-0)*t1+0
+ {0x09ff0eb9, ac_t0_mul_t1},
+ // N64 logo, Aidyn Chronicles. Added by Gonetz
+ // (0-0)*0+shade, (cmb-0)*prim+0
+ {0x09ff0ef8, ac_prim_mul_shade},
+ // birds?, custom robo. Added by Gonetz
+ // (0-0)*0+shade, (cmb-0)*shade+0
+ {0x09ff0f38, ac_shade},
+ // sky, Glover, [Raziel64]. Added by Gonetz
+ // (0-0)*0+shade, (t0-0)*shade+0
+ {0x09ff0f39, ac_t0_mul_shade},
+ // Hand, smash bros
+ // (0-0)*0+shade, (cmb-0)*env+0
+ {0x09ff0f78, ac_env_mul_shade},
+ // Conker's helicopter tail, CBFD
+ // (0-0)*0+shade, (shade-0)*env+0
+ {0x09ff0f7c, ac_env_mul_shade},
+ // menu, PokemonStadium1, [Raziel64]
+ // (0-0)*0+shade, (cmb-0)*primlod+0
+ {0x09ff0fb8, ac_primlod_mul_shade},
+ // Link's sword slashing, smash bros
+ // (prim-env)*t0+env
+ {0x0a6b0a6b, ac_prim_sub_env_mul_t0_add_env},
+ // Reflected beam at kotake & koume's, zelda
+ // (prim-env)*t0+env, (cmb-0)*prim+0 ** INC **
+ {0x0a6b0ef8, ac_t0_mul_prim},
+ // teleporter, Spacestation Silicon Valley. Added by Gonetz
+ // (prim-env)*t0+env, (cmb-0)*shade+0 ** INC **
+ {0x0a6b0f38, ac_t0_mul_shade},
+ // Ridge Racer, unimp log. Added by Gonetz
+ // (prim-env)*t0+env, (cmb-0)*primlod+0
+ {0x0a6b0fb8, ac_prim_sub_env_mul_t0_add_env},
+ // Kotake or koume's hair, zelda
+ // (prim-0)*t0+env
+ {0x0a7b0a7b, ac_t0_mul_prim_add_env},
+ // menu, doubut no mori
+ // (1-0)*t0+env
+ {0x0a7e0a7e, ac_t0_add_env},
+ // Grass, mario golf
+ // (env-shade)*t1+env, (0-0)*0+1
+ {0x0aa50dff, ac_one},
+ // Ridge Racer, cars select. Added by Gonetz
+ // (prim-env)*t1+env
+ {0x0aab0aab, ac_prim_sub_env_mul_t1_add_env},
+ // text, monster truck madness
+ // (prim-env)*t1+env, (cmb-0)*t1+0
+ {0x0aab0eb8, ac_t1_mul_env},
+ // zelda 2 [Ogy]. Added by Gonetz
+ // (1-0)*t1+env, (0-0)*0+cmb
+ //{0x0abe0abe, ac_one},
+ {0x0abe0abe, ac_t1_add_env},
+ // arena, Pokemon Stadium 2. Added by Gonetz
+ // (1-t0)*prim+env, (cmb-0)*shade+0
+ {0x0ace0f38, ac_one_sub_t0_mul_prim_mul_shade},
+ // intro, Bomberman 64 - 2. Added by Gonetz
+ // (t0-env)*prim+env
+ {0x0ae90ae9, ac_t0_sub_env_mul_prim_add_env},
+ // N64 logo, Ogre Battle. Added by Gonetz
+ // (t0-0)*prim+env
+ {0x0af90af9, ac_t0_mul_prim_add_env},
+ // girls, PD intro. Added by Gonetz
+ // (t0-env)*shade+env ** INC **
+ {0x0b290b29, ac_t0_sub_env_mul_shadea_add_env},
+ // Text, Mia Soccer. Added by Gonetz
+ // (t0-env)*shade+env, (cmb-0)*lod_fraction+0 ** INC **
+ {0x0b290e38, ac_t0_sub_env_mul_shadea_add_env},
+ // shadows, Mario Tennis. Added by Gonetz
+ // (prim-env)*shade+env, (0-cmb)*t1+cmb ** INC **
+ {0x0b2b0087, ac_prim_sub_env_mul_shade_add_env_mul_t1},
+ // lamppost?, Ridge Racer. Added by Gonetz
+ // (prim-env)*shade+env, (0-0)*0+cmb
+ {0x0b2b0b2b, ac_prim_sub_env_mul_shade_add_env},
+ // ground, zelda2. Added by Gonetz
+ // (1-env)*shade+env, (t1-0)*prim+0
+ {0x0b2e0efa, ac_t1_mul_prim},
+ // GASP Fighters
+ // (t0-0)*shade+env
+ {0x0b390b39, ac_t0_mul_shade_add_env},
+ // destroying stuff, golden eye
+ // (1-0)*shade+env
+ {0x0b3e0b3e, ac_env_add_shade},
+ // Torches, Paper Mario. Added by Gonetz
+ // (t0-t1)*env+env, (0-0)*0+1
+ {0x0b510dff, ac_t0_sub_t1_mul_env_add_env},
+ // Mini Racers
+ // (t0-0)*primlod+env
+ {0x0bb90bb9, ac_t0_mul_primlod_add_env},
+ // International Track and Field 2000. Added by Gonetz
+ // (t0-0)*0+env
+ {0x0bf90bf9, ac_env},
+ // TM, mario
+ //z (0-0)*0+env
+ {0x0bff0bff, ac_env},
+ // rancho monster, zelda2. Added by Gonetz
+ // (0-0)*0+env, (cmb-0)*t1+0
+ {0x0bff0eb8, ac_t1_mul_env},
+ // Rocket Robot in Wheels intro
+ // (0-0)*0+env, (cmb-0)*prim+0
+ {0x0bff0ef8, ac_prim_mul_env},
+ // Background, Pokemon Snap
+ // (prim-env)*t0+1
+ {0x0c6b0c6b, ac_prim_sub_env_mul_t0_add_one},
+ // Mario Golf
+ // (0-1)*t0+1
+ {0x0c770c77, ac_one_sub_t0},
+ // flame, paper mario. Added by Gonetz
+ // (1-t0)*t1+1, (cmb-t1)*t1+t1
+ {0x0c8e0490, ac_t0_mul_t1},
+ // hall of fame, Pokemon Stadium
+ // (t0-1)*prim+1, (cmb-0)*env+0
+ {0x0cf10f78, ac__one_inter_t0_using_prim__mul_env},
+ // Ring boundary, dual heroes
+ // (0-1)*prim+1
+ {0x0cf70cf7, ac_one_sub_prim},
+ // Kirby64, level 6, [Raziel64]
+ // (0-0)*prim+1
+ {0x0cff0cff, ac_one},
+ // Mystical Ninja
+ // (0-1)*env+1
+ {0x0d770d77, ac_one},
+ // Deku shield in shop, zelda
+ // (1-1)*primlod+1
+ {0x0db60db6, ac_one},
+ // water near gorons willage. Added by Gonetz
+ // (t1-t0)*0+1, (cmb-0)*prim+0
+ {0x0dca0ef8, ac_prim},
+ // background, kirby 64. Added by Gonetz
+ // (t0-0)*0+1
+ {0x0df90df9, ac_one},
+ // kirby 64. Added by Gonetz
+ // (1-0)*0+1
+ {0x0dfe0dfe, ac_one},
+ // background on level 2-1, kirby 64 [Raziel64]. Added by Gonetz
+ // (1-0)*0+1, (0-0)*0+1
+ {0x0dfe0dff, ac_one},
+ // duck dodgers intro. Added by Gonetz
+ // (0-0)*0+1, (cmb-cmb)*primlod+cmb
+ {0x0dff0000, ac_one},
+ // duck dodgers intro. Added by Gonetz
+ // (0-0)*0+1, (0-0)*0+t1 **INC**?
+ {0x0dff05ff, ac_t1},
+ // ?
+ // (0-0)*0+1, (0-0)*0+prim
+ {0x0dff07ff, ac_prim},
+ // arena, custom robo. Added by Gonetz
+ // (0-0)*0+1, (0-0)*0+shade
+ {0x0dff09ff, ac_shade},
+ // field, Mario Golf
+ // (0-0)*0+1, (1-env)*shade+env
+ {0x0dff0b2e, ac_one_sub_env_mul_shade_add_env},
+ // battle tanks 2 [Ogy]
+ // (0-0)*0+1, (0-0)*0+env
+ {0x0dff0bff, ac_env},
+ // helmet, F1 World Grand Prix. Added by Gonetz
+ // (0-0)*0+1, (0-1)*0+1
+ {0x0dff0df7, ac_one},
+ // secret in level 3-4, Kirby64, [Raziel64]
+ // (0-0)*0+1, (cmb-0)*0+1
+ {0x0dff0df8, ac_one},
+ // Menu options, starfox
+ // (0-0)*0+1
+ {0x0dff0dff, ac_one},
+ // Water, zelda
+ //z (0-0)*0+primlod, (cmb-0)*prim+0
+ {0x0dff0ef8, ac_prim},
+ // Desert ground, zelda
+ // (0-0)*0+1, (cmb-0)*shade+0
+ {0x0dff0f38, ac_shade},
+ // Characters, smash bros
+ // (0-0)*0+1, (cmb-0)*env+0
+ {0x0dff0f78, ac_env},
+ // end of level 3-4, Kirby64, [Raziel64]
+ // (0-0)*0+1, (cmb-0)*0+0
+ {0x0dff0ff8, ac_zero},
+ // Kirby64
+ // (0-0)*0+1, (0-0)*0+0
+ {0x0dff0fff, ac_zero},
+ // floor, Spiderman [Raziel64]. Added by Gonetz
+ // (env-t1)*t0+0 ** INC **
+ {0x0e550e55, ac_t0_mul_env},
+ // skeleton, castlevania 2. Added by Gonetz
+ // (1-prim)*t0+0
+ {0x0e5e0e5e, ac_one_sub_prim_mul_t0},
+ // player select, Forsaken [Raziel64]. Added by Gonetz
+ // (prim-shade)*t0+0
+ {0x0e630e63, ac_prim_sub_shade_mul_t0},
+ // castlevania 2 [Ogy]. Added by Gonetz
+ // (1-shade)*t0+0
+ {0x0e660e66, ac_one_sub_shade_mul_t0},
+ // GoldenEye: Helicopter rotors
+ // (shade-env)*t0+0, (1-0)*prim+cmb
+ {0x0e6c00fe, ac_shade_sub_env_mul_t0_add_prim},
+ // background, level3-4, Kirby64, [Raziel64]
+ // (shade-env)*t0+0
+ {0x0e6c0e6c, ac_shade_sub_env_mul_t0},
+ // Goemon, mystical ninja. Added by Gonetz
+ // (1-env)*t0+0
+ {0x0e6e0e6e, ac_one_sub_env_mul_t0},
+ // fist attack, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
+ // (t0-0)*t0+0, (t1-cmb)*prim+cmb
+ {0x0e7900c2, ac_t0_inter_t1_using_prima},
+ // Clay Fighter [Ogy]. Added by Gonetz
+ // (t0-0)*t0+0
+ {0x0e790e79, ac_t0_mul_t0},
+ // Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
+ // (t0-0)*t0+0, (prim-0)*t1+0
+ {0x0e790ebb, ac_t1_mul_prim},
+ // zelda 2 [Ogy]. Added by Gonetz
+ // (t0-0)*t0+0, (cmb-0)*prim+0
+ {0x0e790ef8, ac_t0_mul_prim},
+ // zelda 2. Added by Gonetz
+ // (t0-0)*t0+0, (cmb-0)*shade+0
+ {0x0e790f38, ac_t0_mul_shade},
+ // zelda 2. Added by Gonetz
+ // (t0-0)*t0+0, (cmb-0)*env+0
+ {0x0e790f78, ac_t0_mul_env},
+ // the ice plane just before the entrance to gorons village (where tingle is}, zelda 2 [Ogy]. Added by Gonetz
+ // (t1-0)*t0+0, (cmb-0)*0+cmb
+ {0x0e7a01f8, ac_t0_mul_t1},
+ // paper mario. Added by Gonetz
+ // (t1-0)*t0+0, (cmb-env)*prim+env ** INC **
+ {0x0e7a0ae8, ac_t1_mul_prim},
+ // mini games quiz monitor backround, Pokemon Stadium 2
+ // (t1-0)*t0+0, (0-0)*0+1
+ {0x0e7a0dff, ac_one},
+ // Tony Hawk's Pro Skater. Added by Gonetz
+ // (t1-0)*t0+0, (cmb-0)*t0+0
+ {0x0e7a0e78, ac_t0_mul_t1},
+ // bike trace, xg2. Added by Gonetz
+ // (t1-0)*t0+0
+ {0x0e7a0e7a, ac_t0_mul_t1},
+ // Kotake & koume defeated, zelda
+ // (t1-0)*t0+0, (cmb-0)*prim+0
+ {0x0e7a0ef8, ac__t0_mul_t1__mul_prim},
+ // Magnitude, pokemon stadium 2
+ // (t1-0)*t0+0, (cmb-env)*shade+0
+ {0x0e7a0f28, ac__t0_mul_t1__mul_env_mul_shade},
+ // Bongo Bongo, zelda
+ // (t1-0)*t0+0, (cmb-0)*shade+0
+ {0x0e7a0f38, ac__t0_mul_t1__mul_shade},
+ // Dobutsu_no_Mori, waterfall
+ // (t1-0)*t0+0, (cmb-0)*prim_lod+0
+ {0x0e7a0fb8, ac__t0_mul_t1__mul_primlod},
+ // Back of doors, megaman
+ // (prim-0)*t0+0, (cmb-0)*lodfrac+0
+ {0x0e7b0e38, ac_t0_mul_prim},
+ // Karts, mario kart
+ //z (prim-0)*t0+0
+ {0x0e7b0e7b, ac_t0_mul_prim},
+ // paper mario. Added by Gonetz
+ // (prim-0)*t0+0, (t0-0)*prim+0
+ {0x0e7b0ef9, ac_t0_mul_prim},
+ // Table, mace
+ // (prim-0)*t0+0, (cmb-0)*shade+0
+ {0x0e7b0f38, ac_t0_mul_prim_mul_shade},
+ // lamp shadow, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
+ // (shade-0)*t0+0, (cmb-cmb)*lodf+cmb
+ {0x0e7c0000, ac_t0_mul_shade},
+ // Game logo, Aerofighters Assault [Raziel64]
+ //(shade-0)*t0+0, (0-0)*0+1
+ {0x0e7c0dff, ac_one},
+ // Higher sky, waverace
+ //z (shade-0)*t0+0
+ {0x0e7c0e7c, ac_t0_mul_shade},
+ // duck dodgers, intro. Added by Gonetz
+ // (shade-0)*t0+0, (cmb-0)*prim+0
+ {0x0e7c0ef8, ac_t0_mul_prim_mul_shade},
+ // waterwheel in water temple, zelda 2. Added by Gonetz
+ // (shade-0)*t0+0, (cmb-0)*env+0
+ {0x0e7c0f78, ac_t0_mul_env_mul_shade},
+ // Blowing up mine at bowser's, mario
+ // (env-0)*t0+0
+ {0x0e7d0e7d, ac_t0_mul_env},
+ // castlevania 2, intro. Added by Gonetz
+ // (1-0)*t0+0
+ {0x0e7e0e7e, ac_t0},
+ // moon, castlevania 2. Added by Gonetz
+ // (1-0)*t0+0, (cmb-0)*prim+0
+ {0x0e7e0ef8, ac_t0_mul_prim},
+ //beetle adventure racing. Added by Gonetz
+ // (1-0)*t0+0, (cmb-0)*shade+0
+ {0x0e7e0f38, ac_t0_mul_shade},
+ // lava, beetle adventure racing
+ // (t0-prim)*t1+0, (0-0)*0+shade ** INC **
+ {0x0e9909ff, ac_shade},
+ // Rain Dance, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
+ // (t0-env)*t1+0, (cmb-0)*0+prim ** INC **
+ {0x0ea90ef8, ac__t0_mul_t1__mul_prim},
+ // Duck Dodgers Starring Daffy Duck text background
+ // (t0-0)*t1+0, (shade-cmb)*prim+cmb
+ {0x0eb900c4, ac_one_sub_prim_mul__t0_mul_t1__add__prim_mul_shade},
+ // torches, pokemon stadium 2
+ // (t0-0)*t1+0, (cmb-env)*prim+cmb
+ {0x0eb900e8, ac__t0_mul_t1__sub_env_mul_prim_add__t0_mul_t1},
+ // airboarder 64 [Ogy]
+ // (t0-0)*t1+0, (0-0)*0+prim
+ {0x0eb907ff, ac_prim},
+ // explosion, body harvest. Added by Gonetz
+ // (t0-0)*t1+0, (0-0)*0+shade
+ {0x0eb909ff, ac_shade},
+ // Text off top, banjo kazooie
+ // (t0-0)*t1+0
+ {0x0eb90eb9, ac_t0_mul_t1},
+ // smoke, daikatana. Added by Gonetz
+ // (t0-0)*t1+0, (cmb-0)*prim+0
+ {0x0eb90ef8, ac__t0_mul_t1__mul_prim},
+ // Arena, Pokemon Stadium 2.
+ // (t0-0)*t1+0, (cmb-prim)*shade+0
+ {0x0eb90f18, ac__t0_mul_t1__sub_prim_mul_shade},
+ // Water, pilotwings
+ // (t0-0)*t1+0, (cmb-0)*shade+0
+ {0x0eb90f38, ac__t0_mul_t1__mul_shade},
+ // Tony Hawk's Pro Skater. Added by Gonetz
+ // (t0-0)*t1+0, (cmb-0)*env+0
+ {0x0eb90f78, ac__t0_mul_t1__mul_env},
+ // light from window, Dobutsu no Mori. Added by Gonetz
+ // (t0-0)*t1+0, (cmb-0)*primlod+0
+ {0x0eb90fb8, ac__t0_mul_t1__mul_primlod},
+ // chandelier in spider house, zelda 2. Added by Gonetz
+ // (t1-0)*t1+0, (cmb-0)*prim+0
+ {0x0eba0ef8, ac_t1_mul_prim},
+ // cars, ridge racer. Added by Gonetz
+ // (prim-0)*t1+0, (0-0)*0+1
+ {0x0ebb0dff, ac_t1_mul_prim},
+ // aerofighter's assault [Ogy]
+ // (prim-0)*t1+0
+ {0x0ebb0ebb, ac_t1_mul_prim},
+ // tire trace, beetle adventure racing. Added by Gonetz
+ // (shade-0)*t1+0
+ {0x0ebc0ebc, ac_t1_mul_shade},
+ // smoke, Starshot. Added by Gonetz
+ // (env-0)*t1+0
+ {0x0ebd0ebd, ac_t1_mul_env},
+ // lots of things, goldeneye
+ // (1-0)*t1+0, (0-0)*0+shade
+ {0x0ebe09ff, ac_shade},
+ // zelda 2 [Ogy]. Added by Gonetz
+ // (1-0)*t1+0, (cmb-0)*prim+0
+ {0x0ebe0ef8, ac_t1_mul_prim},
+ // walls, perfect dark. Added by Gonetz
+ // (1-0)*t1+0, (cmb-0)*shade+0
+ {0x0ebe0f38, ac_t1_mul_shade},
+ // sand, perfect dark. Added by Gonetz
+ // (1-0)*t1+0, (cmb-0)*env+0
+ {0x0ebe0f78, ac_t1_mul_env},
+ // light, Ridge Racer. Added by Gonetz
+ // (1-t0)*prim+0
+ {0x0ece0ece, ac_one_sub_t0_mul_prim},
+ // exaust, star wars ep1 racer
+ // (1-t0)*prim+0, (cmb-0)*shade+0
+ {0x0ece0f38, ac_one_sub_t0_mul_primshade},
+ // iguana, Forsaken, [Raziel64]. Added by Gonetz
+ // (t0-shade)*prim+0
+ {0x0ee10ee1, ac_t0_sub_shade_mul_prim},
+ // stands, NASCAR 2000
+ // (prim-shade)*prim+0
+ {0x0ee30ee3, ac_prim_sub_shade_mul_prim},
+ // arena, Pokemon Stadium 2. Added by Gonetz
+ // (t0-env)*prim+0 ** INC **
+ {0x0ee90ee9, ac_t0_mul_prim},
+ // lure, bass rush
+ // (t0-0)*prim+0, (cmb-cmb)*lodf+cmb
+ {0x0ef90000, ac_t0_mul_prim},
+ // explosion, body harvest. Added by Gonetz
+ // (t0-0)*prim+0, (t0-0)*env+cmb
+ {0x0ef90179, ac_prim_add_env_mul_t0},
+ // frog's eyes, zelda
+ // (t0-0)*prim+0, (1-1)*prim_lod+cmb
+ {0x0ef901b6, ac_t0_mul_prim},
+ // Monster truck madness intro. Added by Gonetz
+ // (t0-0)*prim+0, (cmb-0)*prim_lod+cmb ** INC **
+ {0x0ef901b8, ac_t0_mul_prim},
+ // Road, zelda
+ //z (t0-0)*prim+0, (t1-0)*primlod+cmb
+ {0x0ef901ba, ac__t0_mul_prim__add__t1_mul_primlod},
+ // Track, wipeout. Addded by Gonetz
+ // (t0-0)*prim+0, (0-0)*0+prim
+ {0x0ef907ff, ac_t0_mul_prim},
+ // magic stuff, buck bumble. Added by Gonetz
+ // (t0-0)*prim+0, (cmb-0)*prim+0
+ {0x0ef90ef8, ac_t0_mul_prim_mul_prim},
+ // The mario face, mario
+ //z (t0-0)*prim+0
+ {0x0ef90ef9, ac_t0_mul_prim},
+ // paper mario. Added by Gonetz
+ // (t0-0)*prim+0, (cmb-0)*shade+0
+ {0x0ef90f38, ac_t0_mul_prim_mul_shade},
+ // Pikachu's mouth, smash bros
+ // (t0-0)*prim+0, (cmb-0)*env+0
+ {0x0ef90f78, ac_t0_mul_prim_mul_env},
+ // bomb mask, zelda 2. Added by Gonetz
+ // (t0-0)*prim+0, (1-0)*env+0
+ {0x0ef90f7e, ac_t0_mul_prim},
+ // Charmander's tail, pokemon stadium 2
+ // (t0-0)*prim+0, (cmb-0)*primlod+0
+ {0x0ef90fb8, ac_t0_mul_prim_mul_primlod},
+ // stalactites, Beetle adventure Racing. Added by Gonetz
+ // (t1-0)*prim+0, (1-cmb)*shade+cmb
+ {0x0efa0106, ac_one_sub_shade_mul_t1_add_shade},
+ // Sprites, Ogre Battle. Added by Gonetz
+ // (t1-0)*prim+0, (0-0)*0+cmb
+ {0x0efa0efa, ac_t1_mul_prim},
+ // Something about kotake & koume's combined attack, zelda
+ // (t1-0)*prim+0, (cmb-0)*shade+0
+ {0x0efa0f38, ac_t1_mul_prim_mul_shade},
+ // intro background, bio freaks. Added by Gonetz
+ // (prim-0)*prim+0
+ {0x0efb0efb, ac_prim_mul_prim},
+ // sky, xg2. Added by Gonetz
+ // (shade-0)*prim+0, (0-0)*0+1
+ {0x0efc0dff, ac_one},
+ // Zelda, unimp log. Added by Gonetz
+ // (shade-0)*prim+0
+ {0x0efc0efc, ac_prim_mul_shade},
+ // ?
+ // (shade-0)*prim+0, (cmb-0)*shade+0 ** INC **
+ {0x0efc0f38, ac_prim_mul_shade},
+ // Baby mario's hat shadow, mario golf
+ // (env-0)*prim+0
+ {0x0efd0efd, ac_prim_mul_env},
+ // Menu, doom
+ // (1-0)*prim+0
+ {0x0efe0efe, ac_prim},
+ // Peris Song attack, Pokemin Stadium 2
+ // (1-0)*prim+0, (cmb-0)*shade+0
+ {0x0efe0f38, ac_prim_mul_shade},
+ // Conker's shadow, CBFD. Added by Gonetz
+ // (1-t0)*shade+0
+ {0x0f0e0f0e, ac_one_sub_t0_mul_shade},
+ // Rock smash, pokemon stadium 2
+ // (1-t0)*shade+0
+ {0x0f0f0ee8, ac_one_sub_t0_mul_shade},
+ //waterfall, Paper Mario
+ // (t0-t1)*shade+0
+ {0x0f110f11, ac__t0_sub_t1__mul_shade},
+ // mahogany town statue, Pokemon Stadium 2
+ // (t0-prim)*shade+0
+ {0x0f190f19, ac_t0_sub_prim_mul_shade},
+ // silver cave, pokemon stadium 2
+ // (t0-prim)*shade+0, (cmb-0)*env+0
+ {0x0f190f78, ac_t0_sub_prim_mul_shade_mul_env},
+ // Boomerang circle, zelda
+ // (t0-0)*shade+0, (1-cmb)*t0+cmb
+ {0x0f390046, ac_t0_mul_shade},
+ // THPS3
+ // (t0-0)*shade+0, (1-0)*t0+cmb
+ {0x0f39007e, ac_t0_mul_shade},
+ // ???
+ // (t0-0)*shade+0, (env-0)*t1+cmb
+ {0x0f3900bd, ac_t0_mul_shade},
+ // Forest temple doorway, zelda
+ // (t0-0)*shade+0, (t1-0)*primlod+cmb
+ {0x0f3901ba, ac_t0_mul_shade},
+ // skis, Spacestation Silicon Valley. Added by Gonetz
+ // (t0-0)*shade+0, (0-0)*0+t0
+ {0x0f3903ff, ac_t0},
+ // paper mario. Added by Gonetz
+ // (t0-0)*shade+0, (cmb-t0)*prim+0
+ {0x0f390ec8, ac_t0_mul_prim_mul_shade},
+ // House windows, zelda intro
+ //z (t0-0)*shade+0, (cmb-0)*prim+0
+ {0x0f390ef8, ac_t0_mul_prim_mul_shade},
+ // Characters, mace
+ // (t0-0)*shade+0, (cmb-0)*shade+0
+ {0x0f390f38, ac_t0_mul_shade},
+ // Shadows, mario
+ //z (t0-0)*shade+0
+ {0x0f390f39, ac_t0_mul_shade},
+ // Clear screen intro, banjo kazooie
+ // (t0-0)*shade+0, (cmb-0)*env+0
+ {0x0f390f78, ac_t0_mul_env_mul_shade},
+ // ridge racer, unimp log. Added by Gonetz
+ // (t0-0)*shade+0, (cmb-0)*primlod+0 **INC**?
+ {0x0f390fb8, ac_t0_mul_shade},
+ // Reflecting combined attack at kotake & koume's, zelda
+ // (t1-0)*shade+0, (cmb-0)*prim+0
+ {0x0f3a0ef8, ac_t1_mul_prim_mul_shade},
+ // aerofighter's assault [Ogy]
+ // (t1-0)*shade+0
+ {0x0f3a0f3a, ac_t1_mul_shade},
+ //beetle adventure racing. Added by Gonetz
+ //(t1-0)*shade+0, (cmb-0)*env+0
+ {0x0f3a0f78, ac_t1_mul_env_mul_shade},
+ // building shadow, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
+ // (prim-0)*shade+0, (cmb-cmb)*lodf+cmb
+ {0x0f3b0000, ac_prim_mul_shade},
+ //chip in Spacestation Silicon Valley intro. Added by Gonetz
+ // (prim-0)*shade+0, (env-cmb)*t1+cmb
+ {0x0f3b0085, ac_env_sub_primshade_mul_t1_add_primshade},
+ // N64 logo, tetrisphere. Added by Gonetz
+ // (prim-0)*shade+0, (prim-0)*shade+0
+ {0x0f3b0f3b, ac_prim_mul_shade},
+ // rays, Fushigi no Dungeon - Furai no Shiren 2. Added by Gonetz
+ // (shade-0)*shade+0, (cmb-0)*prim+0
+ {0x0f3c0ef8, ac_prim_mul_shade},
+ // light, dracula resurrection, castlevania 2. Added by Gonetz
+ // (env-0)*shade+0
+ {0x0f3d0f3d, ac_env_mul_shade},
+ // zelda 2 [Ogy]. Added by Gonetz
+ // (1-0)*shade+0
+ {0x0f3e0f3e, ac_shade},
+ // surf pokemon attack, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
+ // (1-t0)*env+0, (1-cmb)*shade+0 ** INC **
+ {0x0f4e0f06, ac_t0_mul_shade},
+ // GE, boxes
+ // (1-shade)*env+0, (cmb-0)*shade+0 ** INC **
+ {0x0f660f38, ac_one_sub_shade_mul_env},
+ //beetle adventure racing. Added by Gonetz
+ //(t0-0)*env+0, (1-t0)*prim+cmb
+ //{0x0f7900ce, ac_t0_mul_env}, //this one looks better
+ //{0x0f7900ce, ac_env_sub_prim_mul_t0_add_prim},
+ {0x0f7900ce, ac_one_sub_t1_add_t0_mul_env},
+ //Zelda, logo ? Added by Gonetz
+ //(t0-0)*env+0, (t1-0)*primlod+0 **INC** changed to mul_env for gannon's organ disappearing [Dave2001]
+ {0x0f7901ba, ac__t0_inter_t1_using_primlod__mul_env},
+ // V8-2 menu
+ // (t0-0)*env+0, (0-0)*0+prim
+ {0x0f7907ff, ac_prim},
+ // Skeleton guy's eyes, zelda
+ // (t0-0)*env+0, (cmb-0)*prim+0
+ {0x0f790ef8, ac_t0_mul_prim_mul_env},
+ // Dust from rock spell, quest64
+ // (t0-0)*env+0, (cmb-0)*shade+0
+ {0x0f790f38, ac_t0_mul_env_mul_shade},
+ // eyes of poe, zelda
+ // (t0-0)*env+0, (cmb-0)*env+0
+ {0x0f790f78, ac_t0_mul_env},
+ // Text, mario
+ //z (t0-0)*env+0
+ {0x0f790f79, ac_t0_mul_env},
+ // Shadows, pokemon stadeom 2
+ // (t0-0)*env+0, (cmb-0)*primlod+0
+ {0x0f790fb8, ac_t0_mul_env_mul_primlod},
+ //gauge, PGA
+ // (t1-0)*env+0, (cmb-0)*t1+0 ** INC **
+ {0x0f7a0eb8, ac_t1_mul_env},
+ //text and shadows, Rayman2. Added by Gonetz
+ // (t1-0)*env+0, (cmb-0)*shade+0
+ {0x0f7a0f38, ac_t1_mul_env_mul_shade},
+ // shadows, tom and jerry. Added by Gonetz
+ // (t1-0)*env+0
+ {0x0f7a0f7a, ac_t1_mul_env},
+ // Bomberman64-2 intro. Added by Gonetz
+ // (prim-0)*env+0
+ {0x0f7b0f7b, ac_prim_mul_env},
+ // Text box, mario
+ //z (shade-0)*env+0
+ {0x0f7c0f7c, ac_env_mul_shade},
+ // Ogre battle 64
+ // (env-0)*env+0
+ {0x0f7d0f7d, ac_env},
+ //Goldeneye, [Jeremy]. Added by Gonetz
+ // (1-0)*env+0, (cmb-0)*shade+0
+ {0x0f7e0f38, ac_env_mul_shade},
+ // Status items, megaman
+ // (1-0)*env+0
+ {0x0f7e0f7e, ac_env},
+ // gun fire, Beast_Wars_Transmetal [Raziel64]
+ // (0-0)*env+0
+ {0x0f7f0f7f, ac_zero},
+ // Pokemon attack, Pokemon stadium (J). Added by Gonetz
+ // (t1-t0)*primlod+0, (cmb-0)*env+prim ** INC **
+ {0x0f8a0778, ac__t1_sub_t0_mul_primlod__mul_env_add_prim},
+ // Shadow Ball, Pokemon Stadium 2 [gokuss4]. Added by Gonetz
+ // (t1-t0)*primlod+0, (t1-cmb)*prim+0 ** INC **
+ {0x0f8a0ec2, ac_t0_mul_prim},
+ // Walls of well through lens of truth, zelda
+ // (prim-t0)*primlod+0
+ {0x0f8b0f8b, ac_prim_sub_t0},
+ // N64 logo, ridge racer. Added by Gonetz
+ // (1-prim)*primlod+0 **INC**
+ {0x0f9e0f9e, ac_zero},
+ // Vines that covers a door in the third room of woodfall temple, zelda 2 [Ogy]. Added by Gonetz
+ // (t0-0)*primlod+0, (cmb-0)*prim+0
+ {0x0fb90ef8, ac_t0_mul_primlod_mul_prim},
+ // zelda 2. Added by Gonetz
+ // (t0-0)*primlod+0
+ {0x0fb90fb9, ac_t0_mul_primlod},
+ // NFL Blitz logo. Added by Gonetz
+ // (t1-0)*primlod+0
+ {0x0fba0fba, ac_t1_mul_primlod}, //causes issues
+ // fallen stars at star summit, Paper Mario. Added by Gonetz
+ // (shade-0)*primlod+0
+ {0x0fbc0fbc, ac_primlod_mul_shade},
+ // expansion pack, Jeremy McGrath Supercross 2000. Added by Gonetz
+ // (1-0)*primlod+0
+ {0x0fbe0fbe, ac_primlod},
+ // intro, Aidyn Chronicles. Added by Gonetz
+ // (0-0)*primlod+0, (prim-env)*t0+prim **INC**
+ {0x0fbf066b, ac_t0_mul_prim},
+ // sky, Rayman2. Added by Gonetz
+ // (0-shade)*0+0
+ {0x0fe70fe7, ac_zero},
+ // flame, PokemonStadium1 [Raziel64]
+ // (t0-0)*0+0
+ {0x0ff90ff9, ac_zero},
+ //BAR
+ // (0-0)*0+0, (0-0)*0+TEXEL1
+ {0x0fff05ff, ac_t0},
+ // Screen clear, banjo kazooie
+ // (0-0)*0+0
+ {0x0fff0fff, ac_zero},
+ // { #ACEND }
+};
+
+// CountCombine - count the # of entries in the combine lists
+void CountCombine ()
+{
+ int size = sizeof(color_cmb_list) / sizeof(COMBINER);
+ int i=0, index=0, a, b;
+ do {
+ a = color_cmb_list[index].key >> 24;
+ for (; i<=a; i++)
+ cc_lookup[i] = index;
+
+ while (index < size)
+ {
+ b = color_cmb_list[index].key >> 24;
+ if (b != a) break;
+ index ++;
+ }
+ } while (index < size);
+ for (; i<257; i++) cc_lookup[i] = index;
+
+ size = sizeof(alpha_cmb_list) / sizeof(COMBINER);
+ i=0, index=0;
+ do {
+ a = (alpha_cmb_list[index].key >> 20) & 0xFF;
+ for (; i<=a; i++)
+ ac_lookup[i] = index;
+
+ while (index < size)
+ {
+ b = (alpha_cmb_list[index].key >> 20) & 0xFF;
+ if (b != a) break;
+ index ++;
+ }
+ } while (index < size);
+ for (; i<257; i++) ac_lookup[i] = index;
+
+ //color_cmb_list_count = sizeof(color_cmb_list) >> 3; // #bytes/4/2
+ //alpha_cmb_list_count = sizeof(alpha_cmb_list) >> 3;
+}
+
+//****************************************************************
+// Main Combine
+//****************************************************************
+
+void Combine ()
+{
+ FRDP (" | |- color combine: %08lx, #1: (%s-%s)*%s+%s, #2: (%s-%s)*%s+%s\n",
+ ((rdp.cycle1 & 0xFFFF) << 16) | (rdp.cycle2 & 0xFFFF),
+ Mode0[rdp.cycle1&0xF], Mode1[(rdp.cycle1>>4)&0xF], Mode2[(rdp.cycle1>>8)&0x1F], Mode3[(rdp.cycle1>>13)&7],
+ Mode0[rdp.cycle2&0xF], Mode1[(rdp.cycle2>>4)&0xF], Mode2[(rdp.cycle2>>8)&0x1F], Mode3[(rdp.cycle2>>13)&7]);
+ FRDP (" | |- alpha combine: %08lx, #1: (%s-%s)*%s+%s, #2: (%s-%s)*%s+%s\n",
+ (rdp.cycle1 & 0x0FFF0000) | ((rdp.cycle2 & 0x0FFF0000) >> 16),
+ Alpha0[(rdp.cycle1>>16)&7], Alpha1[(rdp.cycle1>>19)&7], Alpha2[(rdp.cycle1>>22)&7], Alpha3[(rdp.cycle1>>25)&7],
+ Alpha0[(rdp.cycle2>>16)&7], Alpha1[(rdp.cycle2>>19)&7], Alpha2[(rdp.cycle2>>22)&7], Alpha3[(rdp.cycle2>>25)&7]);
+ if (!rdp.LOD_en || rdp.cur_tile == rdp.mipmap_level)
+ lod_frac = rdp.prim_lodfrac;
+ else if (settings.lodmode == 0)
+ lod_frac = 0;
+ else
+ lod_frac = 10;
+
+ rdp.noise = RDP::noise_none;
+
+ wxUint32 found = TRUE;
+
+ rdp.col[0] = rdp.col[1] = rdp.col[2] = rdp.col[3] =
+ rdp.coladd[0] = rdp.coladd[1] = rdp.coladd[2] = rdp.coladd[3] = 1.0f;
+ rdp.cmb_flags = rdp.cmb_flags_2 = 0;
+
+ rdp.uncombined = 0;
+
+ cmb.tex = 0;
+ cmb.tmu0_func = cmb.tmu1_func = cmb.tmu0_a_func = cmb.tmu1_a_func = GR_COMBINE_FUNCTION_ZERO;
+ cmb.tmu0_fac = cmb.tmu1_fac = cmb.tmu0_a_fac = cmb.tmu1_a_fac = GR_COMBINE_FACTOR_NONE;
+ cmb.tmu0_invert = cmb.tmu0_a_invert = cmb.tmu1_invert = cmb.tmu1_a_invert = FXFALSE;
+
+ cmb.dc0_detailmax = cmb.dc1_detailmax = 0;
+
+ cmb.mod_0 = cmb.mod_1 = 0; // remove all modifications
+ cmb.modcolor_0 = cmb.modcolor1_0 = cmb.modcolor2_0 = cmb.modcolor_1 = cmb.modcolor1_1 = cmb.modcolor2_1
+ = cmb.modfactor_0 = cmb.modfactor_1 = 0;
+
+ cmb.ccolor = cmb.tex_ccolor = 0;
+ if (cmb.cmb_ext_use || cmb.tex_cmb_ext_use)
+ {
+ //have to draw something to allow use of standard combine functions
+ if (fullscreen)
+ {
+ VERTEX v;
+ memset(&v,0,sizeof(v));
+ grDrawPoint(&v);
+ }
+ cmb.cmb_ext_use = 0;
+ cmb.tex_cmb_ext_use = 0;
+ }
+
+ wxUint32 cmb_mode_c = (rdp.cycle1 << 16) | (rdp.cycle2 & 0xFFFF);
+ wxUint32 cmb_mode_a = (rdp.cycle1 & 0x0FFF0000) | ((rdp.cycle2 >> 16) & 0x00000FFF);
+
+ cmb.abf1 = GR_BLEND_SRC_ALPHA;
+ cmb.abf2 = GR_BLEND_ONE_MINUS_SRC_ALPHA;
+
+#ifdef FASTSEARCH
+ // Fast, ordered search
+ int current=0x7FFFFFFF, last;
+ wxUint32 actual_combine, current_combine, color_combine, alpha_combine;
+ int left, right;
+
+ actual_combine = current_combine = cmb_mode_c;
+ color_combine = actual_combine;
+ if ((rdp.cycle2 & 0xFFFF) == 0x1FFF)
+ actual_combine = (rdp.cycle1 << 16) | (rdp.cycle1 & 0xFFFF);
+
+ left = cc_lookup[actual_combine>>24];
+ right = cc_lookup[(actual_combine>>24)+1];
+
+ while (1)
+ {
+ last = current;
+ current = left + ((right-left) >> 1);
+ if (current == last)
+ break; // can't be found!
+
+ current_combine = color_cmb_list[current].key;
+ if (current_combine < actual_combine)
+ left = current;
+ else if (current_combine > actual_combine)
+ right = current;
+ else
+ break; // found it!
+ }
+
+ // Check if we didn't find it
+ if (actual_combine != current_combine)
+ {
+ rdp.uncombined |= 1;
+#ifdef UNIMP_LOG
+ if (settings.log_unk)
+ {
+ sprintf (out_buf, "COLOR combine not found: %08x, #1: (%s-%s)*%s+%s, #2: (%s-%s)*%s+%s\n",
+ actual_combine,
+ Mode0[rdp.cycle1&0xF], Mode1[(rdp.cycle1>>4)&0xF], Mode2[(rdp.cycle1>>8)&0x1F], Mode3[(rdp.cycle1>>13)&7],
+ Mode0[rdp.cycle2&0xF], Mode1[(rdp.cycle2>>4)&0xF], Mode2[(rdp.cycle2>>8)&0x1F], Mode3[(rdp.cycle2>>13)&7]);
+ UNIMPMODE();
+ }
+#endif
+ found = FALSE;
+ //tex |= 3;
+
+ // use t0 as default
+ cc_t0 ();
+ }
+ else
+ color_cmb_list[current].func();
+
+ LRDP(" | |- Color done\n");
+
+ // Now again for alpha
+ current = 0x7FFFFFFF;
+ actual_combine = cmb_mode_a;
+ alpha_combine = actual_combine;
+ if ((rdp.cycle2 & 0x0FFF0000) == 0x01FF0000)
+ actual_combine = (rdp.cycle1 & 0x0FFF0000) | ((rdp.cycle1 >> 16) & 0x00000FFF);
+ if ((rdp.cycle1 & 0x0FFF0000) == 0x0FFF0000)
+ actual_combine = (rdp.cycle2 & 0x0FFF0000) | ((rdp.cycle2 >> 16) & 0x00000FFF);
+
+ left = ac_lookup[(actual_combine>>20)&0xFF];
+ right = ac_lookup[((actual_combine>>20)&0xFF)+1];
+
+ while (1)
+ {
+ last = current;
+ current = left + ((right-left) >> 1);
+ if (current == last)
+ break; // can't be found!
+
+ current_combine = alpha_cmb_list[current].key;
+ if (current_combine < actual_combine)
+ left = current;
+ else if (current_combine > actual_combine)
+ right = current;
+ else
+ break; // found it!
+ }
+
+ // Check if we didn't find it
+ if (actual_combine != current_combine || !found)
+ {
+ if (actual_combine != current_combine)
+ {
+ rdp.uncombined |= 2;
+#ifdef UNIMP_LOG
+ if (settings.log_unk)
+ {
+ sprintf (out_buf, "ALPHA combine not found: %08x, #1: (%s-%s)*%s+%s, #2: (%s-%s)*%s+%s\n",
+ actual_combine,
+ Alpha0[(rdp.cycle1>>16)&7], Alpha1[(rdp.cycle1>>19)&7], Alpha2[(rdp.cycle1>>22)&7], Alpha3[(rdp.cycle1>>25)&7],
+ Alpha0[(rdp.cycle2>>16)&7], Alpha1[(rdp.cycle2>>19)&7], Alpha2[(rdp.cycle2>>22)&7], Alpha3[(rdp.cycle2>>25)&7]);
+ UNIMPMODE();
+ }
+#endif
+ }
+ if (settings.unk_as_red)
+ {
+ BrightRed ();
+ }
+ else
+ {
+ // use full alpha as default
+ ac_t0 ();
+ }
+ //tex |= 3;
+ }
+ else
+ alpha_cmb_list[current].func();
+
+
+ if (color_combine == 0x69351fff) //text, PD, need to change texture alpha
+ {
+ A_USE_T1();
+ }
+ else if ((color_combine == 0x3fff1fff) && (alpha_combine == 0x03ff03ff) && (rdp.last_tile > rdp.cur_tile))//Dr. Mario
+ {
+ cc_t0();
+ ac_t1();
+ }
+ else if (color_combine == 0x613522f0 && (settings.hacks&hack_PMario)) //Paper Mario fortune teller spheres
+ {
+ ac_t0();
+ }
+
+ LRDP(" | |- Alpha done\n");
+#endif // FASTSEARCH
+
+ CombineBlender ();
+ //*
+ // Update textures?
+ // if (tex == 2 && rdp.texrecting && (cmb.tmu1_func != GR_COMBINE_FUNCTION_ZERO) && (rdp.last_tile_size == 0))
+ if (cmb.tex == 2 && rdp.texrecting && (rdp.cur_tile == rdp.last_tile_size))
+ {
+ cmb.tex = 0;
+ USE_T0();
+ A_USE_T0();
+ }
+ //*/
+ rdp.tex = cmb.tex;
+
+ if (fullscreen)
+ {
+ TBUFF_COLOR_IMAGE * aTBuff[2] = {0, 0};
+ if (rdp.aTBuffTex[0])
+ aTBuff[rdp.aTBuffTex[0]->tile] = rdp.aTBuffTex[0];
+ if (rdp.aTBuffTex[1])
+ aTBuff[rdp.aTBuffTex[1]->tile] = rdp.aTBuffTex[1];
+ if (cmb.tex && (aTBuff[0] || aTBuff[1]))
+ {
+ if (aTBuff[0] && (settings.frame_buffer&fb_read_alpha))
+ {
+ if ((settings.hacks&hack_PMario) && aTBuff[0]->width == rdp.ci_width)
+ ;
+ else
+ {
+ grChromakeyValue(0);
+ grChromakeyMode(GR_CHROMAKEY_ENABLE);
+ }
+ }
+ else
+ grChromakeyMode(GR_CHROMAKEY_DISABLE);
+
+ if (aTBuff[0] && aTBuff[0]->info.format == GR_TEXFMT_ALPHA_INTENSITY_88)
+ {
+ if (cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_COLOR)
+ {
+ if (cmb.t0c_ext_a == GR_CMBX_LOCAL_TEXTURE_RGB)
+ cmb.t0c_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ if (cmb.t0c_ext_b == GR_CMBX_LOCAL_TEXTURE_RGB)
+ cmb.t0c_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ if (cmb.t0c_ext_c == GR_CMBX_LOCAL_TEXTURE_RGB)
+ cmb.t0c_ext_c = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ }
+ else
+ cmb.tmu0_func = GR_COMBINE_FUNCTION_LOCAL_ALPHA;
+ }
+
+ if (aTBuff[1] && aTBuff[1]->info.format == GR_TEXFMT_ALPHA_INTENSITY_88)
+ {
+ if (cmb.tex_cmb_ext_use & TEX_COMBINE_EXT_COLOR)
+ {
+ if (cmb.t1c_ext_a == GR_CMBX_LOCAL_TEXTURE_RGB)
+ cmb.t1c_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ if (cmb.t1c_ext_b == GR_CMBX_LOCAL_TEXTURE_RGB)
+ cmb.t1c_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ if (cmb.t1c_ext_c == GR_CMBX_LOCAL_TEXTURE_RGB)
+ cmb.t1c_ext_c = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ }
+ else
+ cmb.tmu1_func = GR_COMBINE_FUNCTION_LOCAL_ALPHA;
+ }
+ }
+ else
+ grChromakeyMode(GR_CHROMAKEY_DISABLE);
+ }
+ cmb.shade_mod_hash = (rdp.cmb_flags + rdp.cmb_flags_2) * (rdp.prim_color + rdp.env_color + rdp.K5);
+
+ LRDP(" | + Combine end\n");
+}
+
+void CombineBlender ()
+{
+ wxUint32 blendmode = rdp.othermode_l >> 16;
+ // Check force-blending
+ if ((rdp.othermode_l & 0x4000) && (rdp.cycle_mode < 2))
+ {
+ switch (blendmode)
+ {
+ // Mace objects
+ case 0x0382:
+ case 0x0091:
+ // 1080 sky
+ case 0x0c08:
+ // Mario kart player select
+ // clr_in * 0 + clr_in * 1
+ // - or just clr_in, no matter what alpha
+ case 0x0f0a:
+ //DK64 blue prints
+ case 0x0302:
+ //Sin and Punishment
+ case 0xcb02:
+ // Battlezone
+ // clr_in * a + clr_in * (1-a)
+ case 0xc800:
+ case 0x00c0:
+ //ISS64
+ case 0xc302:
+ A_BLEND (GR_BLEND_ONE, GR_BLEND_ZERO);
+ break;
+
+ //Space Invaders
+ case 0x0448:
+ case 0x055a:
+ A_BLEND (GR_BLEND_ONE, GR_BLEND_ONE);
+ break;
+
+ // LOT in Zelda: MM
+ case 0xaf50:
+ case 0x0f5a: //clr_in * 0 + clr_mem * 1
+ A_BLEND (GR_BLEND_ZERO, GR_BLEND_ONE);
+ break;
+
+ case 0x5f50: //clr_mem * 0 + clr_mem * (1-a)
+ A_BLEND (GR_BLEND_ZERO, GR_BLEND_ONE_MINUS_SRC_ALPHA);
+ break;
+
+ /*
+ case 0xc410: // Perfect Dark Mauler
+ {
+ MOD_0 (TMOD_TEX_INTER_COLOR_USING_FACTOR);
+ MOD_0_COL (rdp.fog_color & 0xFFFFFF00);
+ MOD_0_FAC (rdp.fog_color & 0xFF);
+ INTERSHADE_2 (rdp.fog_color & 0xFFFFFF00, rdp.fog_color & 0xFF);
+
+ float percent = (rdp.fog_color & 0xFF) / 255.0f;
+ cmb.ccolor =
+ ((wxUint32)(((cmb.ccolor >> 24) & 0xFF) * (1.0f-percent) + ((rdp.fog_color>>24) & 0xFF) * percent) << 24) |
+ ((wxUint32)(((cmb.ccolor >> 16) & 0xFF) * (1.0f-percent) + ((rdp.fog_color>>16) & 0xFF) * percent) << 16) |
+ ((wxUint32)(((cmb.ccolor >> 8) & 0xFF) * (1.0f-percent) + ((rdp.fog_color>>8) & 0xFF) * percent) << 8) |
+ (cmb.ccolor & 0xFF);
+
+ rdp.col[0] = rdp.col[0] * (1.0f-percent) + ((rdp.fog_color>>24) & 0xFF) / 255.0f * percent;
+ rdp.col[1] = rdp.col[1] * (1.0f-percent) + ((rdp.fog_color>>16) & 0xFF) / 255.0f * percent;
+ rdp.col[2] = rdp.col[2] * (1.0f-percent) + ((rdp.fog_color>>8) & 0xFF) / 255.0f * percent;
+ A_BLEND (GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA);
+ }
+ break;
+ */
+ case 0xf550: //clr_fog * a_fog + clr_mem * (1-a)
+ A_BLEND (GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA);
+ {
+ wxUint32 prim = rdp.prim_color;
+ rdp.prim_color = rdp.fog_color;
+ cc_prim();
+ ac_prim();
+ rdp.prim_color = prim;
+ }
+ break;
+
+ case 0x0150: //spiderman
+ case 0x0d18: //clr_in * a_fog + clr_mem * (1-a)
+ A_BLEND (GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA);
+ if (rdp.cycle_mode == 1 && rdp.cycle2 != 0x01ff1fff)
+ {
+ wxUint32 prim = rdp.prim_color;
+ rdp.prim_color = rdp.fog_color;
+ ac_prim();
+ rdp.prim_color = prim;
+ }
+ break;
+
+ case 0xc912: //40 winks, clr_in * a_fog + clr_mem * 1
+ {
+ wxUint32 prim = rdp.prim_color;
+ rdp.prim_color = rdp.fog_color;
+ ac_prim();
+ rdp.prim_color = prim;
+ }
+ A_BLEND (GR_BLEND_SRC_ALPHA, GR_BLEND_ONE);
+ break;
+
+ default:
+ A_BLEND (GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA);
+ }
+ }
+ /*
+ else if (blendmode == 0xc411) // Super Smash Bros, faked fog for flashing characters
+ {
+ MOD_0 (TMOD_TEX_INTER_COLOR_USING_FACTOR);
+ MOD_0_COL (rdp.fog_color & 0xFFFFFF00);
+ MOD_0_FAC (rdp.fog_color & 0xFF);
+ INTERSHADE_2 (rdp.fog_color & 0xFFFFFF00, rdp.fog_color & 0xFF);
+
+ float percent = (rdp.fog_color & 0xFF) / 255.0f;
+ cmb.ccolor =
+ ((wxUint32)(((cmb.ccolor >> 24) & 0xFF) * (1.0f-percent) + ((rdp.fog_color>>24) & 0xFF) * percent) << 24) |
+ ((wxUint32)(((cmb.ccolor >> 16) & 0xFF) * (1.0f-percent) + ((rdp.fog_color>>16) & 0xFF) * percent) << 16) |
+ ((wxUint32)(((cmb.ccolor >> 8) & 0xFF) * (1.0f-percent) + ((rdp.fog_color>>8) & 0xFF) * percent) << 8) |
+ (cmb.ccolor & 0xFF);
+
+ rdp.col[0] = rdp.col[0] * (1.0f-percent) + ((rdp.fog_color>>24) & 0xFF) / 255.0f * percent;
+ rdp.col[1] = rdp.col[1] * (1.0f-percent) + ((rdp.fog_color>>16) & 0xFF) / 255.0f * percent;
+ rdp.col[2] = rdp.col[2] * (1.0f-percent) + ((rdp.fog_color>>8) & 0xFF) / 255.0f * percent;
+ A_BLEND (GR_BLEND_ONE, GR_BLEND_ZERO);
+ }
+ */
+ else if (blendmode == 0x0040) // Mia Soccer Lights
+ A_BLEND (GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA);
+ else if ((settings.hacks&hack_Pilotwings) && (rdp.othermode_l & 0x80)) //CLR_ON_CVG without FORCE_BL
+ A_BLEND (GR_BLEND_ZERO, GR_BLEND_ONE);
+ else
+ A_BLEND (GR_BLEND_ONE, GR_BLEND_ZERO);
+
+ // ALPHA_CVG_SEL means full alpha
+ // The reason it wasn't working before was because I wasn't handling rdp:setothermode
+ // if (rdp.othermode_l & 0x2000)
+ if ((rdp.othermode_l & 0x2000) && ((rdp.othermode_l & 0x7000) != 0x7000))
+ {
+ if ((settings.hacks&hack_PMario) && (blendmode == 0x5055))
+ {
+ A_BLEND (GR_BLEND_ZERO, GR_BLEND_ONE);
+ }
+ else if (blendmode == 0x4055) // Mario Golf
+ {
+ A_BLEND (GR_BLEND_ZERO, GR_BLEND_ONE);
+ }
+ else
+ {
+ A_BLEND (GR_BLEND_ONE, GR_BLEND_ZERO);
+ }
+ }
+
+ //hack
+ //*
+ if (settings.hacks&hack_ISS64)
+ {
+ if (rdp.othermode_l == 0xff5a6379)
+ {
+ A_BLEND (GR_BLEND_ZERO, GR_BLEND_SRC_ALPHA);
+ }
+ else if (rdp.othermode_l == 0x00504dd9) //players shadows. CVG_DST_WRAP
+ {
+ A_BLEND (GR_BLEND_ZERO, GR_BLEND_ONE);
+ }
+ }
+ else if (settings.hacks&hack_TGR)
+ {
+ if (rdp.othermode_l == 0x0f0a0235)
+ {
+ A_BLEND (GR_BLEND_SRC_ALPHA, GR_BLEND_ONE_MINUS_SRC_ALPHA);
+ }
+ }
+ //*/
+}
+
+void InitCombine ()
+{
+ LOG ("InitCombine() ");
+ memset(&cmb, 0, sizeof(cmb));
+ const char *extensions = grGetString (GR_EXTENSION);
+ if (const char * extstr = strstr(extensions, "COMBINE")) {
+ if (!strncmp(extstr, "COMBINE", 7)) {
+ LOG ("extensions ");
+ char strColorCombineExt[] = "grColorCombineExt";
+ cmb.grColorCombineExt = (GRCOLORCOMBINEEXT) grGetProcAddress(strColorCombineExt);
+ char strAlphaCombineExt[] = "grAlphaCombineExt";
+ cmb.grAlphaCombineExt = (GRCOLORCOMBINEEXT) grGetProcAddress(strAlphaCombineExt);
+ char strTexColorCombineExt[] = "grTexColorCombineExt";
+ cmb.grTexColorCombineExt = (GRTEXCOLORCOMBINEEXT) grGetProcAddress(strTexColorCombineExt);
+ char strTexAlphaCombineExt[] = "grTexAlphaCombineExt";
+ cmb.grTexAlphaCombineExt = (GRTEXCOLORCOMBINEEXT) grGetProcAddress(strTexAlphaCombineExt);
+ char strConstantColorValueExt[] = "grConstantColorValueExt";
+ cmb.grConstantColorValueExt = (GRCONSTANTCOLORVALUEEXT) grGetProcAddress(strConstantColorValueExt);
+ if (cmb.grColorCombineExt && cmb.grAlphaCombineExt &&
+ cmb.grTexColorCombineExt && cmb.grTexAlphaCombineExt)
+ {
+ cmb.combine_ext = TRUE;
+ LOG ("initialized.");
+ }
+ else
+ {
+ cmb.combine_ext = FALSE;
+ }
+ }
+ }
+ cmb.dc0_lodbias = cmb.dc1_lodbias = 31;
+ cmb.dc0_detailscale = cmb.dc1_detailscale = 7;
+ cmb.lodbias0 = cmb.lodbias1 = 1.0f;
+ LOG ("\n");
+}
+
+void ColorCombinerToExtension ()
+{
+ wxUint32 ext_local, ext_local_a, ext_other, ext_other_a;
+ switch (cmb.c_loc)
+ {
+ case GR_COMBINE_LOCAL_ITERATED:
+ ext_local = GR_CMBX_ITRGB;
+ ext_local_a = GR_CMBX_ITALPHA;
+ break;
+ case GR_COMBINE_LOCAL_CONSTANT:
+ ext_local = GR_CMBX_CONSTANT_COLOR;
+ ext_local_a = GR_CMBX_CONSTANT_ALPHA;
+ break;
+ default:
+ ext_local = GR_CMBX_ZERO;
+ ext_local_a = GR_CMBX_ZERO;
+ };
+ switch (cmb.c_oth)
+ {
+ case GR_COMBINE_OTHER_ITERATED:
+ ext_other = GR_CMBX_ITRGB;
+ ext_other_a = GR_CMBX_ITALPHA;
+ break;
+ case GR_COMBINE_OTHER_TEXTURE:
+ ext_other = GR_CMBX_TEXTURE_RGB;
+ ext_other_a = GR_CMBX_TEXTURE_ALPHA;
+ break;
+ case GR_COMBINE_OTHER_CONSTANT:
+ ext_other = GR_CMBX_CONSTANT_COLOR;
+ ext_other_a = GR_CMBX_CONSTANT_ALPHA;
+ break;
+ default:
+ ext_other = GR_CMBX_ZERO;
+ ext_other_a = GR_CMBX_ZERO;
+ };
+ switch (cmb.c_fac)
+ {
+ case GR_COMBINE_FACTOR_ZERO:
+ cmb.c_ext_c = GR_CMBX_ZERO;
+ cmb.c_ext_c_invert = 0;
+ break;
+ case GR_COMBINE_FACTOR_ONE:
+ cmb.c_ext_c = GR_CMBX_ZERO;
+ cmb.c_ext_c_invert = 1;
+ break;
+ case GR_COMBINE_FACTOR_LOCAL:
+ cmb.c_ext_c = ext_local;
+ cmb.c_ext_c_invert = 0;
+ break;
+ case GR_COMBINE_FACTOR_LOCAL_ALPHA:
+ cmb.c_ext_c = ext_local_a;
+ cmb.c_ext_c_invert = 0;
+ break;
+ case GR_COMBINE_FACTOR_OTHER_ALPHA:
+ cmb.c_ext_c = ext_other_a;
+ cmb.c_ext_c_invert = 0;
+ break;
+ case GR_COMBINE_FACTOR_TEXTURE_RGB:
+ cmb.c_ext_c = GR_CMBX_TEXTURE_RGB;
+ cmb.c_ext_c_invert = 0;
+ break;
+ case GR_COMBINE_FACTOR_TEXTURE_ALPHA:
+ cmb.c_ext_c = GR_CMBX_TEXTURE_ALPHA;
+ cmb.c_ext_c_invert = 0;
+ break;
+ case GR_COMBINE_FACTOR_ONE_MINUS_LOCAL:
+ cmb.c_ext_c = ext_local;
+ cmb.c_ext_c_invert = 1;
+ break;
+ case GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA:
+ cmb.c_ext_c = ext_local_a;
+ cmb.c_ext_c_invert = 1;
+ break;
+ case GR_COMBINE_FACTOR_ONE_MINUS_OTHER_ALPHA:
+ cmb.c_ext_c = ext_other_a;
+ cmb.c_ext_c_invert = 1;
+ break;
+ case GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA:
+ cmb.c_ext_c = GR_CMBX_TEXTURE_ALPHA;
+ cmb.c_ext_c_invert = 1;
+ break;
+ default:
+ cmb.c_ext_c = GR_CMBX_ZERO;
+ cmb.c_ext_c_invert = 0;
+ }
+
+ switch (cmb.c_fnc)
+ {
+ case GR_COMBINE_FUNCTION_ZERO:
+ cmb.c_ext_a = GR_CMBX_ZERO;
+ cmb.c_ext_a_mode = GR_FUNC_MODE_X;
+ cmb.c_ext_b = GR_CMBX_ZERO;
+ cmb.c_ext_b_mode = GR_FUNC_MODE_X;
+ cmb.c_ext_c = GR_CMBX_ZERO;
+ cmb.c_ext_c_invert = 0;
+ cmb.c_ext_d = GR_CMBX_ZERO;
+ cmb.c_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_LOCAL:
+ cmb.c_ext_a = ext_local;
+ cmb.c_ext_a_mode = GR_FUNC_MODE_X;
+ cmb.c_ext_b = GR_CMBX_ZERO;
+ cmb.c_ext_b_mode = GR_FUNC_MODE_X;
+ cmb.c_ext_c = GR_CMBX_ZERO;
+ cmb.c_ext_c_invert = 1;
+ cmb.c_ext_d = GR_CMBX_ZERO;
+ cmb.c_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_LOCAL_ALPHA:
+ cmb.c_ext_a = ext_local_a;
+ cmb.c_ext_a_mode = GR_FUNC_MODE_X;
+ cmb.c_ext_b = GR_CMBX_ZERO;
+ cmb.c_ext_b_mode = GR_FUNC_MODE_X;
+ cmb.c_ext_c = GR_CMBX_ZERO;
+ cmb.c_ext_c_invert = 1;
+ cmb.c_ext_d = GR_CMBX_ZERO;
+ cmb.c_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_OTHER:
+ cmb.c_ext_a = ext_other;
+ cmb.c_ext_a_mode = GR_FUNC_MODE_X;
+ cmb.c_ext_b = GR_CMBX_ZERO;
+ cmb.c_ext_b_mode = GR_FUNC_MODE_ZERO;
+ cmb.c_ext_d = GR_CMBX_ZERO;
+ cmb.c_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL:
+ cmb.c_ext_a = ext_other;
+ cmb.c_ext_a_mode = GR_FUNC_MODE_X;
+ cmb.c_ext_b = ext_local;
+ cmb.c_ext_b_mode = GR_FUNC_MODE_ZERO;
+ cmb.c_ext_d = GR_CMBX_B;
+ cmb.c_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA:
+ cmb.c_ext_a = ext_other;
+ cmb.c_ext_a_mode = GR_FUNC_MODE_X;
+ cmb.c_ext_b = ext_local_a;
+ cmb.c_ext_b_mode = GR_FUNC_MODE_ZERO;
+ cmb.c_ext_d = GR_CMBX_B;
+ cmb.c_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL:
+ cmb.c_ext_a = ext_other;
+ cmb.c_ext_a_mode = GR_FUNC_MODE_X;
+ cmb.c_ext_b = ext_local;
+ cmb.c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
+ cmb.c_ext_d = GR_CMBX_ZERO;
+ cmb.c_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL:
+ cmb.c_ext_a = ext_other;
+ cmb.c_ext_a_mode = GR_FUNC_MODE_X;
+ cmb.c_ext_b = ext_local;
+ cmb.c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
+ cmb.c_ext_d = GR_CMBX_B;
+ cmb.c_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA:
+ cmb.c_ext_a = ext_other;
+ cmb.c_ext_a_mode = GR_FUNC_MODE_X;
+ cmb.c_ext_b = ext_local;
+ cmb.c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
+ cmb.c_ext_d = GR_CMBX_ALOCAL;
+ cmb.c_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
+ cmb.c_ext_a = GR_CMBX_ZERO;
+ cmb.c_ext_a_mode = GR_FUNC_MODE_ZERO;
+ cmb.c_ext_b = ext_local;
+ cmb.c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
+ cmb.c_ext_d = GR_CMBX_B;
+ cmb.c_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
+ default:
+ cmb.c_ext_a = GR_CMBX_ZERO;
+ cmb.c_ext_a_mode = GR_FUNC_MODE_ZERO;
+ cmb.c_ext_b = ext_local;
+ cmb.c_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
+ cmb.c_ext_d = GR_CMBX_ALOCAL;
+ cmb.c_ext_d_invert = 0;
+ break;
+ }
+}
+
+void AlphaCombinerToExtension ()
+{
+ wxUint32 ext_local, ext_other;
+ switch (cmb.a_loc)
+ {
+ case GR_COMBINE_LOCAL_ITERATED:
+ ext_local = GR_CMBX_ITALPHA;
+ break;
+ case GR_COMBINE_LOCAL_CONSTANT:
+ ext_local = GR_CMBX_CONSTANT_ALPHA;
+ break;
+ default:
+ ext_local = GR_CMBX_ZERO;
+ };
+ switch (cmb.a_oth)
+ {
+ case GR_COMBINE_OTHER_ITERATED:
+ ext_other = GR_CMBX_ITALPHA;
+ break;
+ case GR_COMBINE_OTHER_TEXTURE:
+ ext_other = GR_CMBX_TEXTURE_ALPHA;
+ break;
+ case GR_COMBINE_OTHER_CONSTANT:
+ ext_other = GR_CMBX_CONSTANT_ALPHA;
+ break;
+ default:
+ ext_other = GR_CMBX_ZERO;
+ };
+ switch (cmb.a_fac)
+ {
+ case GR_COMBINE_FACTOR_ZERO:
+ cmb.a_ext_c = GR_CMBX_ZERO;
+ cmb.a_ext_c_invert = 0;
+ break;
+ case GR_COMBINE_FACTOR_ONE:
+ cmb.a_ext_c = GR_CMBX_ZERO;
+ cmb.a_ext_c_invert = 1;
+ break;
+ case GR_COMBINE_FACTOR_LOCAL:
+ case GR_COMBINE_FACTOR_LOCAL_ALPHA:
+ cmb.a_ext_c = ext_local;
+ cmb.a_ext_c_invert = 0;
+ break;
+ case GR_COMBINE_FACTOR_OTHER_ALPHA:
+ cmb.a_ext_c = ext_other;
+ cmb.a_ext_c_invert = 0;
+ break;
+ case GR_COMBINE_FACTOR_TEXTURE_ALPHA:
+ cmb.a_ext_c = GR_CMBX_TEXTURE_ALPHA;
+ cmb.a_ext_c_invert = 0;
+ break;
+ case GR_COMBINE_FACTOR_ONE_MINUS_LOCAL:
+ case GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA:
+ cmb.a_ext_c = ext_local;
+ cmb.a_ext_c_invert = 1;
+ break;
+ case GR_COMBINE_FACTOR_ONE_MINUS_OTHER_ALPHA:
+ cmb.a_ext_c = ext_other;
+ cmb.a_ext_c_invert = 1;
+ break;
+ case GR_COMBINE_FACTOR_ONE_MINUS_TEXTURE_ALPHA:
+ cmb.a_ext_c = GR_CMBX_TEXTURE_ALPHA;
+ cmb.a_ext_c_invert = 1;
+ break;
+ default:
+ cmb.a_ext_c = GR_CMBX_ZERO;
+ cmb.a_ext_c_invert = 0;
+ }
+
+ switch (cmb.a_fnc)
+ {
+ case GR_COMBINE_FUNCTION_ZERO:
+ cmb.a_ext_a = GR_CMBX_ZERO;
+ cmb.a_ext_a_mode = GR_FUNC_MODE_X;
+ cmb.a_ext_b = GR_CMBX_ZERO;
+ cmb.a_ext_b_mode = GR_FUNC_MODE_X;
+ cmb.a_ext_c = GR_CMBX_ZERO;
+ cmb.a_ext_c_invert = 0;
+ cmb.a_ext_d = GR_CMBX_ZERO;
+ cmb.a_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_LOCAL:
+ case GR_COMBINE_FUNCTION_LOCAL_ALPHA:
+ cmb.a_ext_a = GR_CMBX_ZERO;
+ cmb.a_ext_a_mode = GR_FUNC_MODE_ZERO;
+ cmb.a_ext_b = ext_local;
+ cmb.a_ext_b_mode = GR_FUNC_MODE_X;
+ cmb.a_ext_c = GR_CMBX_ZERO;
+ cmb.a_ext_c_invert = 1;
+ cmb.a_ext_d = GR_CMBX_ZERO;
+ cmb.a_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_OTHER:
+ cmb.a_ext_a = ext_other;
+ cmb.a_ext_a_mode = GR_FUNC_MODE_X;
+ cmb.a_ext_b = GR_CMBX_ZERO;
+ cmb.a_ext_b_mode = GR_FUNC_MODE_ZERO;
+ cmb.a_ext_d = GR_CMBX_ZERO;
+ cmb.a_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL:
+ case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA:
+ cmb.a_ext_a = ext_other;
+ cmb.a_ext_a_mode = GR_FUNC_MODE_X;
+ cmb.a_ext_b = ext_local;
+ cmb.a_ext_b_mode = GR_FUNC_MODE_ZERO;
+ cmb.a_ext_d = GR_CMBX_B;
+ cmb.a_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL:
+ cmb.a_ext_a = ext_other;
+ cmb.a_ext_a_mode = GR_FUNC_MODE_X;
+ cmb.a_ext_b = ext_local;
+ cmb.a_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
+ cmb.a_ext_d = GR_CMBX_ZERO;
+ cmb.a_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL:
+ case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA:
+ cmb.a_ext_a = ext_other;
+ cmb.a_ext_a_mode = GR_FUNC_MODE_X;
+ cmb.a_ext_b = ext_local;
+ cmb.a_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
+ cmb.a_ext_d = GR_CMBX_B;
+ cmb.a_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
+ case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
+ cmb.a_ext_a = GR_CMBX_ZERO;
+ cmb.a_ext_a_mode = GR_FUNC_MODE_ZERO;
+ cmb.a_ext_b = ext_local;
+ cmb.a_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
+ cmb.a_ext_d = GR_CMBX_B;
+ cmb.a_ext_d_invert = 0;
+ break;
+ }
+}
+
+void TexColorCombinerToExtension (GrChipID_t tmu)
+{
+ wxUint32 tc_ext_a, tc_ext_a_mode, tc_ext_b, tc_ext_b_mode, tc_ext_c, tc_ext_d;
+ int tc_ext_c_invert, tc_ext_d_invert;
+ wxUint32 tmu_func, tmu_fac;
+
+ if (tmu == GR_TMU0)
+ {
+ tmu_func = cmb.tmu0_func;
+ tmu_fac = cmb.tmu0_fac;
+ }
+ else
+ {
+ tmu_func = cmb.tmu1_func;
+ tmu_fac = cmb.tmu1_fac;
+ }
+
+ switch (tmu_fac)
+ {
+ case GR_COMBINE_FACTOR_ZERO:
+ tc_ext_c = GR_CMBX_ZERO;
+ tc_ext_c_invert = 0;
+ break;
+ case GR_COMBINE_FACTOR_LOCAL:
+ tc_ext_c = GR_CMBX_LOCAL_TEXTURE_RGB;
+ tc_ext_c_invert = 0;
+ break;
+ case GR_COMBINE_FACTOR_LOCAL_ALPHA:
+ tc_ext_c = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ tc_ext_c_invert = 0;
+ break;
+ case GR_COMBINE_FACTOR_OTHER_ALPHA:
+ tc_ext_c = GR_CMBX_OTHER_TEXTURE_ALPHA;
+ tc_ext_c_invert = 0;
+ break;
+ case GR_COMBINE_FACTOR_DETAIL_FACTOR:
+ tc_ext_c = GR_CMBX_DETAIL_FACTOR;
+ tc_ext_c_invert = 0;
+ break;
+ case GR_COMBINE_FACTOR_ONE:
+ tc_ext_c = GR_CMBX_ZERO;
+ tc_ext_c_invert = 1;
+ break;
+ case GR_COMBINE_FACTOR_ONE_MINUS_LOCAL:
+ tc_ext_c = GR_CMBX_LOCAL_TEXTURE_RGB;
+ tc_ext_c_invert = 1;
+ break;
+ case GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA:
+ tc_ext_c = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ tc_ext_c_invert = 1;
+ break;
+ case GR_COMBINE_FACTOR_ONE_MINUS_OTHER_ALPHA:
+ tc_ext_c = GR_CMBX_OTHER_TEXTURE_ALPHA;
+ tc_ext_c_invert = 1;
+ break;
+ case GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR:
+ tc_ext_c = GR_CMBX_DETAIL_FACTOR;
+ tc_ext_c_invert = 1;
+ break;
+ default:
+ tc_ext_c = GR_CMBX_ZERO;
+ tc_ext_c_invert = 0;
+ break;
+ }
+
+ switch (tmu_func)
+ {
+ case GR_COMBINE_FUNCTION_ZERO:
+ tc_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB;
+ tc_ext_a_mode = GR_FUNC_MODE_ZERO;
+ tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
+ tc_ext_b_mode = GR_FUNC_MODE_ZERO;
+ tc_ext_c = GR_CMBX_ZERO;
+ tc_ext_c_invert = 0;
+ tc_ext_d = GR_CMBX_ZERO;
+ tc_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_LOCAL:
+ tc_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB;
+ tc_ext_a_mode = GR_FUNC_MODE_X;
+ tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
+ tc_ext_b_mode = GR_FUNC_MODE_ZERO;
+ tc_ext_c = GR_CMBX_ZERO;
+ tc_ext_c_invert = 1;
+ tc_ext_d = GR_CMBX_ZERO;
+ tc_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_LOCAL_ALPHA:
+ tc_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ tc_ext_a_mode = GR_FUNC_MODE_X;
+ tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
+ tc_ext_b_mode = GR_FUNC_MODE_ZERO;
+ tc_ext_c = GR_CMBX_ZERO;
+ tc_ext_c_invert = 1;
+ tc_ext_d = GR_CMBX_ZERO;
+ tc_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_OTHER:
+ tc_ext_a = GR_CMBX_OTHER_TEXTURE_RGB;
+ tc_ext_a_mode = GR_FUNC_MODE_X;
+ tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
+ tc_ext_b_mode = GR_FUNC_MODE_ZERO;
+ tc_ext_d = GR_CMBX_ZERO;
+ tc_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL:
+ tc_ext_a = GR_CMBX_OTHER_TEXTURE_RGB;
+ tc_ext_a_mode = GR_FUNC_MODE_X;
+ tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
+ tc_ext_b_mode = GR_FUNC_MODE_ZERO;
+ tc_ext_d = GR_CMBX_B;
+ tc_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA:
+ tc_ext_a = GR_CMBX_OTHER_TEXTURE_RGB;
+ tc_ext_a_mode = GR_FUNC_MODE_X;
+ tc_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ tc_ext_b_mode = GR_FUNC_MODE_ZERO;
+ tc_ext_d = GR_CMBX_B;
+ tc_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL:
+ tc_ext_a = GR_CMBX_OTHER_TEXTURE_RGB;
+ tc_ext_a_mode = GR_FUNC_MODE_X;
+ tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
+ tc_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
+ tc_ext_d = GR_CMBX_ZERO;
+ tc_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL:
+ tc_ext_a = GR_CMBX_OTHER_TEXTURE_RGB;
+ tc_ext_a_mode = GR_FUNC_MODE_X;
+ tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
+ tc_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
+ tc_ext_d = GR_CMBX_B;
+ tc_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA:
+ tc_ext_a = GR_CMBX_OTHER_TEXTURE_RGB;
+ tc_ext_a_mode = GR_FUNC_MODE_X;
+ tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
+ tc_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
+ tc_ext_d = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ tc_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
+ tc_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB;
+ tc_ext_a_mode = GR_FUNC_MODE_ZERO;
+ tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
+ tc_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
+ tc_ext_d = GR_CMBX_B;
+ tc_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
+ tc_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB;
+ tc_ext_a_mode = GR_FUNC_MODE_ZERO;
+ tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
+ tc_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
+ tc_ext_d = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ tc_ext_d_invert = 0;
+ break;
+ default:
+ tc_ext_a = GR_CMBX_LOCAL_TEXTURE_RGB;
+ tc_ext_a_mode = GR_FUNC_MODE_ZERO;
+ tc_ext_b = GR_CMBX_LOCAL_TEXTURE_RGB;
+ tc_ext_b_mode = GR_FUNC_MODE_ZERO;
+ tc_ext_c = GR_CMBX_ZERO;
+ tc_ext_c_invert = 0;
+ tc_ext_d = GR_CMBX_ZERO;
+ tc_ext_d_invert = 0;
+ break;
+ }
+
+ if (tmu == GR_TMU0)
+ {
+ cmb.t0c_ext_a = tc_ext_a;
+ cmb.t0c_ext_a_mode = tc_ext_a_mode;
+ cmb.t0c_ext_b = tc_ext_b;
+ cmb.t0c_ext_b_mode = tc_ext_b_mode;
+ cmb.t0c_ext_c = tc_ext_c;
+ cmb.t0c_ext_c_invert = tc_ext_c_invert;
+ cmb.t0c_ext_d = tc_ext_d;
+ cmb.t0c_ext_d_invert = tc_ext_d_invert;
+ }
+ else
+ {
+ cmb.t1c_ext_a = tc_ext_a;
+ cmb.t1c_ext_a_mode = tc_ext_a_mode;
+ cmb.t1c_ext_b = tc_ext_b;
+ cmb.t1c_ext_b_mode = tc_ext_b_mode;
+ cmb.t1c_ext_c = tc_ext_c;
+ cmb.t1c_ext_c_invert = tc_ext_c_invert;
+ cmb.t1c_ext_d = tc_ext_d;
+ cmb.t1c_ext_d_invert = tc_ext_d_invert;
+ }
+}
+
+void TexAlphaCombinerToExtension (GrChipID_t tmu)
+{
+ wxUint32 ta_ext_a, ta_ext_a_mode, ta_ext_b, ta_ext_b_mode, ta_ext_c, ta_ext_d;
+ int ta_ext_c_invert, ta_ext_d_invert;
+ wxUint32 tmu_a_func, tmu_a_fac;
+
+ if (tmu == GR_TMU0)
+ {
+ tmu_a_func = cmb.tmu0_a_func;
+ tmu_a_fac = cmb.tmu0_a_fac;
+ }
+ else
+ {
+ tmu_a_func = cmb.tmu1_a_func;
+ tmu_a_fac = cmb.tmu1_a_fac;
+ }
+
+ switch (tmu_a_fac)
+ {
+ case GR_COMBINE_FACTOR_ZERO:
+ ta_ext_c = GR_CMBX_ZERO;
+ ta_ext_c_invert = 0;
+ break;
+ case GR_COMBINE_FACTOR_LOCAL:
+ case GR_COMBINE_FACTOR_LOCAL_ALPHA:
+ ta_ext_c = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ ta_ext_c_invert = 0;
+ break;
+ case GR_COMBINE_FACTOR_OTHER_ALPHA:
+ ta_ext_c = GR_CMBX_OTHER_TEXTURE_ALPHA;
+ ta_ext_c_invert = 0;
+ break;
+ case GR_COMBINE_FACTOR_DETAIL_FACTOR:
+ ta_ext_c = GR_CMBX_DETAIL_FACTOR;
+ ta_ext_c_invert = 0;
+ break;
+ case GR_COMBINE_FACTOR_ONE:
+ ta_ext_c = GR_CMBX_ZERO;
+ ta_ext_c_invert = 1;
+ break;
+ case GR_COMBINE_FACTOR_ONE_MINUS_LOCAL:
+ case GR_COMBINE_FACTOR_ONE_MINUS_LOCAL_ALPHA:
+ ta_ext_c = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ ta_ext_c_invert = 1;
+ break;
+ case GR_COMBINE_FACTOR_ONE_MINUS_OTHER_ALPHA:
+ ta_ext_c = GR_CMBX_OTHER_TEXTURE_ALPHA;
+ ta_ext_c_invert = 1;
+ break;
+ case GR_COMBINE_FACTOR_ONE_MINUS_DETAIL_FACTOR:
+ ta_ext_c = GR_CMBX_DETAIL_FACTOR;
+ ta_ext_c_invert = 1;
+ break;
+ default:
+ ta_ext_c = GR_CMBX_ZERO;
+ ta_ext_c_invert = 0;
+ break;
+ }
+
+ switch (tmu_a_func)
+ {
+ case GR_COMBINE_FUNCTION_ZERO:
+ ta_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ ta_ext_a_mode = GR_FUNC_MODE_ZERO;
+ ta_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ ta_ext_b_mode = GR_FUNC_MODE_ZERO;
+ ta_ext_c = GR_CMBX_ZERO;
+ ta_ext_c_invert = 0;
+ ta_ext_d = GR_CMBX_ZERO;
+ ta_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_LOCAL:
+ case GR_COMBINE_FUNCTION_LOCAL_ALPHA:
+ ta_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ ta_ext_a_mode = GR_FUNC_MODE_X;
+ ta_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ ta_ext_b_mode = GR_FUNC_MODE_ZERO;
+ ta_ext_c = GR_CMBX_ZERO;
+ ta_ext_c_invert = 1;
+ ta_ext_d = GR_CMBX_ZERO;
+ ta_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_OTHER:
+ ta_ext_a = GR_CMBX_OTHER_TEXTURE_ALPHA;
+ ta_ext_a_mode = GR_FUNC_MODE_X;
+ ta_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ ta_ext_b_mode = GR_FUNC_MODE_ZERO;
+ ta_ext_d = GR_CMBX_ZERO;
+ ta_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL:
+ case GR_COMBINE_FUNCTION_SCALE_OTHER_ADD_LOCAL_ALPHA:
+ ta_ext_a = GR_CMBX_OTHER_TEXTURE_ALPHA;
+ ta_ext_a_mode = GR_FUNC_MODE_X;
+ ta_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ ta_ext_b_mode = GR_FUNC_MODE_ZERO;
+ ta_ext_d = GR_CMBX_B;
+ ta_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL:
+ ta_ext_a = GR_CMBX_OTHER_TEXTURE_ALPHA;
+ ta_ext_a_mode = GR_FUNC_MODE_X;
+ ta_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ ta_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
+ ta_ext_d = GR_CMBX_ZERO;
+ ta_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL:
+ case GR_COMBINE_FUNCTION_SCALE_OTHER_MINUS_LOCAL_ADD_LOCAL_ALPHA:
+ ta_ext_a = GR_CMBX_OTHER_TEXTURE_ALPHA;
+ ta_ext_a_mode = GR_FUNC_MODE_X;
+ ta_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ ta_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
+ ta_ext_d = GR_CMBX_B;
+ ta_ext_d_invert = 0;
+ break;
+ case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL:
+ case GR_COMBINE_FUNCTION_SCALE_MINUS_LOCAL_ADD_LOCAL_ALPHA:
+ ta_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ ta_ext_a_mode = GR_FUNC_MODE_ZERO;
+ ta_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ ta_ext_b_mode = GR_FUNC_MODE_NEGATIVE_X;
+ ta_ext_d = GR_CMBX_B;
+ ta_ext_d_invert = 0;
+ break;
+ default:
+ ta_ext_a = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ ta_ext_a_mode = GR_FUNC_MODE_ZERO;
+ ta_ext_b = GR_CMBX_LOCAL_TEXTURE_ALPHA;
+ ta_ext_b_mode = GR_FUNC_MODE_ZERO;
+ ta_ext_c = GR_CMBX_ZERO;
+ ta_ext_c_invert = 0;
+ ta_ext_d = GR_CMBX_ZERO;
+ ta_ext_d_invert = 0;
+ break;
+ }
+
+ if (tmu == GR_TMU0)
+ {
+ cmb.t0a_ext_a = ta_ext_a;
+ cmb.t0a_ext_a_mode = ta_ext_a_mode;
+ cmb.t0a_ext_b = ta_ext_b;
+ cmb.t0a_ext_b_mode = ta_ext_b_mode;
+ cmb.t0a_ext_c = ta_ext_c;
+ cmb.t0a_ext_c_invert = ta_ext_c_invert;
+ cmb.t0a_ext_d = ta_ext_d;
+ cmb.t0a_ext_d_invert = ta_ext_d_invert;
+ }
+ else
+ {
+ cmb.t1a_ext_a = ta_ext_a;
+ cmb.t1a_ext_a_mode = ta_ext_a_mode;
+ cmb.t1a_ext_b = ta_ext_b;
+ cmb.t1a_ext_b_mode = ta_ext_b_mode;
+ cmb.t1a_ext_c = ta_ext_c;
+ cmb.t1a_ext_c_invert = ta_ext_c_invert;
+ cmb.t1a_ext_d = ta_ext_d;
+ cmb.t1a_ext_d_invert = ta_ext_d_invert;
+ }
+}
diff --git a/source/gles2glide64/src/Glide64/Combine.h b/source/gles2glide64/src/Glide64/Combine.h
new file mode 100644
index 0000000..49f6774
--- /dev/null
+++ b/source/gles2glide64/src/Glide64/Combine.h
@@ -0,0 +1,120 @@
+/*
+* Glide64 - Glide video plugin for Nintendo 64 emulators.
+* Copyright (c) 2002 Dave2001
+* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
+*
+* 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
+* 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
+*/
+
+//****************************************************************
+//
+// Glide64 - Glide Plugin for Nintendo 64 emulators
+// Project started on December 29th, 2001
+//
+// Authors:
+// Dave2001, original author, founded the project in 2001, left it in 2002
+// Gugaman, joined the project in 2002, left it in 2002
+// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
+// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
+//
+//****************************************************************
+//
+// To modify Glide64:
+// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
+// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
+//
+//****************************************************************
+#ifndef COMBINE_H
+#define COMBINE_H
+
+// texture MOD types
+#define TMOD_TEX_INTER_COLOR_USING_FACTOR 1
+#define TMOD_TEX_INTER_COL_USING_COL1 2
+#define TMOD_FULL_COLOR_SUB_TEX 3
+#define TMOD_COL_INTER_COL1_USING_TEX 4
+#define TMOD_COL_INTER_COL1_USING_TEXA 5
+#define TMOD_COL_INTER_COL1_USING_TEXA__MUL_TEX 6
+#define TMOD_COL_INTER_TEX_USING_TEXA 7
+#define TMOD_COL2_INTER__COL_INTER_COL1_USING_TEX__USING_TEXA 8
+#define TMOD_TEX_SCALE_FAC_ADD_FAC 9
+#define TMOD_TEX_SUB_COL_MUL_FAC_ADD_TEX 10
+#define TMOD_TEX_SCALE_COL_ADD_COL 11
+#define TMOD_TEX_ADD_COL 12
+#define TMOD_TEX_SUB_COL 13
+#define TMOD_TEX_SUB_COL_MUL_FAC 14
+#define TMOD_COL_INTER_TEX_USING_COL1 15
+#define TMOD_COL_MUL_TEXA_ADD_TEX 16
+#define TMOD_COL_INTER_TEX_USING_TEX 17
+#define TMOD_TEX_INTER_NOISE_USING_COL 18
+#define TMOD_TEX_INTER_COL_USING_TEXA 19
+#define TMOD_TEX_MUL_COL 20
+#define TMOD_TEX_SCALE_FAC_ADD_COL 21
+
+#define COMBINE_EXT_COLOR 1
+#define COMBINE_EXT_ALPHA 2
+#define TEX_COMBINE_EXT_COLOR 1
+#define TEX_COMBINE_EXT_ALPHA 2
+
+typedef struct
+{
+ wxUint32 ccolor; // constant color to set at the end, color and alpha
+ wxUint32 c_fnc, c_fac, c_loc, c_oth; // grColorCombine flags
+ wxUint32 a_fnc, a_fac, a_loc, a_oth; // grAlphaCombine flags
+ wxUint32 tex, tmu0_func, tmu0_fac, tmu0_invert, tmu1_func, tmu1_fac, tmu1_invert;
+ wxUint32 tmu0_a_func, tmu0_a_fac, tmu0_a_invert, tmu1_a_func, tmu1_a_fac, tmu1_a_invert;
+ int dc0_lodbias, dc1_lodbias;
+ wxUint8 dc0_detailscale, dc1_detailscale;
+ float dc0_detailmax, dc1_detailmax;
+ float lodbias0, lodbias1;
+ wxUint32 abf1, abf2;
+ wxUint32 mod_0, modcolor_0, modcolor1_0, modcolor2_0, modfactor_0;
+ wxUint32 mod_1, modcolor_1, modcolor1_1, modcolor2_1, modfactor_1;
+ //combine extensions
+ wxUint32 c_ext_a, c_ext_a_mode, c_ext_b, c_ext_b_mode, c_ext_c, c_ext_d;
+ int c_ext_c_invert, c_ext_d_invert;
+ wxUint32 a_ext_a, a_ext_a_mode, a_ext_b, a_ext_b_mode, a_ext_c, a_ext_d;
+ int a_ext_c_invert, a_ext_d_invert;
+ wxUint32 t0c_ext_a, t0c_ext_a_mode, t0c_ext_b, t0c_ext_b_mode, t0c_ext_c, t0c_ext_d;
+ int t0c_ext_c_invert, t0c_ext_d_invert;
+ wxUint32 t0a_ext_a, t0a_ext_a_mode, t0a_ext_b, t0a_ext_b_mode, t0a_ext_c, t0a_ext_d;
+ int t0a_ext_c_invert, t0a_ext_d_invert;
+ wxUint32 t1c_ext_a, t1c_ext_a_mode, t1c_ext_b, t1c_ext_b_mode, t1c_ext_c, t1c_ext_d;
+ int t1c_ext_c_invert, t1c_ext_d_invert;
+ wxUint32 t1a_ext_a, t1a_ext_a_mode, t1a_ext_b, t1a_ext_b_mode, t1a_ext_c, t1a_ext_d;
+ int t1a_ext_c_invert, t1a_ext_d_invert;
+ GRCOLORCOMBINEEXT grColorCombineExt;
+ GRCOLORCOMBINEEXT grAlphaCombineExt;
+ GRTEXCOLORCOMBINEEXT grTexColorCombineExt;
+ GRTEXCOLORCOMBINEEXT grTexAlphaCombineExt;
+ GRCONSTANTCOLORVALUEEXT grConstantColorValueExt;
+ wxUint32 tex_ccolor;
+ int combine_ext;
+ wxUint8 cmb_ext_use;
+ wxUint8 tex_cmb_ext_use;
+ wxUint32 shade_mod_hash;
+} COMBINE;
+
+extern COMBINE cmb;
+
+void Combine ();
+void CombineBlender ();
+void CountCombine ();
+void InitCombine ();
+void ColorCombinerToExtension ();
+void AlphaCombinerToExtension ();
+void TexColorCombinerToExtension (GrChipID_t tmu);
+void TexAlphaCombinerToExtension (GrChipID_t tmu);
+
+#endif //COMBINE _H
diff --git a/source/gles2glide64/src/Glide64/Config.cpp b/source/gles2glide64/src/Glide64/Config.cpp
new file mode 100755
index 0000000..a133070
--- /dev/null
+++ b/source/gles2glide64/src/Glide64/Config.cpp
@@ -0,0 +1,178 @@
+/*
+* Glide64 - Glide video plugin for Nintendo 64 emulators.
+* Copyright (c) 2010 Jon Ring
+* Copyright (c) 2002 Dave2001
+*
+* 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
+* 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
+* Licence along with this program; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+* Boston, MA 02110-1301, USA
+*/
+#include "Gfx_1.3.h"
+#include "Config.h"
+#include "m64p.h"
+#include "rdp.h"
+
+#ifndef OLDAPI
+
+static m64p_handle video_general_section;
+static m64p_handle video_glide64_section;
+
+
+BOOL Config_Open()
+{
+ if (ConfigOpenSection("Video-General", &video_general_section) != M64ERR_SUCCESS ||
+ ConfigOpenSection("Video-Glide64mk2", &video_glide64_section) != M64ERR_SUCCESS)
+ {
+ ERRLOG("Could not open configuration");
+ return FALSE;
+ }
+ ConfigSetDefaultBool(video_general_section, "Fullscreen", false, "Use fullscreen mode if True, or windowed mode if False");
+ ConfigSetDefaultInt(video_general_section, "ScreenWidth", 640, "Width of output window or fullscreen width");
+ ConfigSetDefaultInt(video_general_section, "ScreenHeight", 480, "Height of output window or fullscreen height");
+
+ return TRUE;
+}
+
+int Config_ReadScreenInt(const char *itemname)
+{
+ return ConfigGetParamInt(video_general_section, itemname);
+}
+
+PackedScreenResolution Config_ReadScreenSettings()
+{
+ PackedScreenResolution packedResolution;
+
+ packedResolution.width = ConfigGetParamInt(video_general_section, "ScreenWidth");
+ packedResolution.height = ConfigGetParamInt(video_general_section, "ScreenHeight");
+ packedResolution.fullscreen = ConfigGetParamBool(video_general_section, "Fullscreen");
+
+ return packedResolution;
+}
+
+BOOL Config_ReadInt(const char *itemname, const char *desc, int def_value, int create, int isBoolean)
+{
+ VLOG("Getting value %s", itemname);
+ if (isBoolean)
+ {
+ ConfigSetDefaultBool(video_glide64_section, itemname, def_value, desc);
+ return ConfigGetParamBool(video_glide64_section, itemname);
+ }
+ else
+ {
+ ConfigSetDefaultInt(video_glide64_section, itemname, def_value, desc);
+ return ConfigGetParamInt(video_glide64_section, itemname);
+ }
+
+}
+#else
+
+// Resolutions, MUST be in the correct order (SST1VID.H)
+wxUint32 resolutions[0x18][2] = {
+ { 320, 200 },
+ { 320, 240 },
+ { 400, 256 },
+ { 512, 384 },
+ { 640, 200 },
+ { 640, 350 },
+ { 640, 400 },
+ { 640, 480 },
+ { 800, 600 },
+ { 960, 720 },
+ { 800, 480 },
+ { 512, 256 },
+ { 1024, 768 },
+ { 1280, 1024 },
+ { 1600, 1200 },
+ { 400, 300 },
+
+ // 0x10
+ { 1152, 864 },
+ { 1280, 960 },
+ { 1600, 1024 },
+ { 1792, 1344 },
+ { 1856, 1392 },
+ { 1920, 1440 },
+ { 2048, 1536 },
+ { 2048, 2048 }
+};
+
+
+BOOL Config_Open()
+{
+ INI_Open();
+ if(INI_FindSection("SETTINGS",FALSE) == FALSE) {
+ INI_Close();
+ ERRLOG("Could not open configuration");
+ return FALSE;
+ }
+ return TRUE;
+}
+
+int Config_ReadScreenInt(const char *itemname) {
+ int res_data = Config_ReadInt("resolution", NULL, 7, FALSE, FALSE);
+ if(!strcmp("ScreenWidth", itemname))
+ return resolutions[res_data][0];
+ else if(!strcmp("ScreenHeight", itemname))
+ return resolutions[res_data][1];
+ else return FALSE;
+}
+
+BOOL Config_ReadInt(const char *itemname, const char *desc, int def_value, int create, int isBoolean) {
+ VLOG("Getting value %s", itemname);
+ int z = INI_ReadInt(itemname, def_value, FALSE);
+ if(isBoolean) z=(z && 1);
+ return z;
+}
+
+#endif
+
+#ifdef TEXTURE_FILTER
+wxUint32 texfltr[] = {
+ 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"
+};
+
+wxUint32 texenht[] = {
+ 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"
+};
+
+wxUint32 texcmpr[] = {
+ //NO_COMPRESSION, //"None"
+ // NCC_COMPRESSION, //"NCC"
+ S3TC_COMPRESSION, //"S3TC"
+ FXT1_COMPRESSION, //"FXT1"
+};
+
+wxUint32 texhirs[] = {
+ NO_HIRESTEXTURES, //"Do not use"
+ RICE_HIRESTEXTURES, //"Rice format"
+ // GHQ_HIRESTEXTURES, //"GlideHQ format"
+ // JABO_HIRESTEXTURES, //"Jabo format"
+};
+#endif
+
+
diff --git a/source/gles2glide64/src/Glide64/Config.h b/source/gles2glide64/src/Glide64/Config.h
new file mode 100755
index 0000000..eec3efd
--- /dev/null
+++ b/source/gles2glide64/src/Glide64/Config.h
@@ -0,0 +1,35 @@
+/*
+* Glide64 - Glide video plugin for Nintendo 64 emulators.
+* Copyright (c) 2010 Jon Ring
+* Copyright (c) 2002 Dave2001
+*
+* 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
+* 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
+* Licence along with this program; if not, write to the Free
+* Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+* Boston, MA 02110-1301, USA
+*/
+
+#ifndef CONFIG_H
+#define CONFIG_H
+
+#include "winlnxdefs.h"
+#include "m64p.h"
+
+BOOL Config_Open();
+int Config_ReadScreenInt(const char *itemname);
+PackedScreenResolution Config_ReadScreenSettings();
+BOOL Config_ReadInt(const char *itemname, const char *desc, int def_value, int create=TRUE, BOOL isBoolean=TRUE);
+
+
+#endif /* CONFIG_H */
+
diff --git a/source/gles2glide64/src/Glide64/Debugger.cpp b/source/gles2glide64/src/Glide64/Debugger.cpp
new file mode 100644
index 0000000..79e5286
--- /dev/null
+++ b/source/gles2glide64/src/Glide64/Debugger.cpp
@@ -0,0 +1,1020 @@
+/*
+* Glide64 - Glide video plugin for Nintendo 64 emulators.
+* Copyright (c) 2002 Dave2001
+* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
+*
+* 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
+* 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
+*/
+
+//****************************************************************
+//
+// Glide64 - Glide Plugin for Nintendo 64 emulators
+// Project started on December 29th, 2001
+//
+// Authors:
+// Dave2001, original author, founded the project in 2001, left it in 2002
+// Gugaman, joined the project in 2002, left it in 2002
+// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
+// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
+//
+//****************************************************************
+//
+// To modify Glide64:
+// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
+// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
+//
+//****************************************************************
+
+#include "Gfx_1.3.h"
+#include "Util.h"
+#include "Debugger.h"
+
+GLIDE64_DEBUGGER _debugger;
+
+#define SX(x) ((x)*rdp.scale_1024)
+#define SY(x) ((x)*rdp.scale_768)
+
+#ifdef COLORED_DEBUGGER
+#define COL_CATEGORY() grConstantColorValue(0xD288F400)
+#define COL_UCC() grConstantColorValue(0xFF000000)
+#define COL_CC() grConstantColorValue(0x88C3F400)
+#define COL_UAC() grConstantColorValue(0xFF808000)
+#define COL_AC() grConstantColorValue(0x3CEE5E00)
+#define COL_TEXT() grConstantColorValue(0xFFFFFF00)
+#define COL_SEL(x) grConstantColorValue((x)?0x00FF00FF:0x800000FF)
+#else
+#define COL_CATEGORY()
+#define COL_UCC()
+#define COL_CC()
+#define COL_UAC()
+#define COL_AC()
+#define COL_TEXT()
+#define COL_SEL(x)
+#endif
+
+#define COL_GRID 0xFFFFFF80
+
+int grid = 0;
+static const char *tri_type[4] = { "TRIANGLE", "TEXRECT", "FILLRECT", "BACKGROUND" };
+
+//Platform-specific stuff
+#ifndef WIN32
+typedef struct dbgPOINT {
+ int x;
+ int y;
+} POINT;
+#endif
+void DbgCursorPos(POINT * pt)
+{
+#ifdef __WINDOWS__
+ GetCursorPos (pt);
+#else //!todo find a way to get cursor position on Unix
+ pt->x = pt->y = 0;
+#endif
+}
+
+//
+// debug_init - initialize the debugger
+//
+
+void debug_init ()
+{
+ _debugger.capture = 0;
+ _debugger.selected = SELECTED_TRI;
+ _debugger.screen = NULL;
+ _debugger.tri_list = NULL;
+ _debugger.tri_last = NULL;
+ _debugger.tri_sel = NULL;
+ _debugger.tmu = 0;
+
+ _debugger.tex_scroll = 0;
+ _debugger.tex_sel = 0;
+
+ _debugger.draw_mode = 0;
+}
+
+//
+// debug_cacheviewer - views the debugger's cache
+//
+
+void debug_cacheviewer ()
+{
+ grCullMode (GR_CULL_DISABLE);
+
+ int i;
+ for (i=0; i<2; i++)
+ {
+ grTexFilterMode (i,
+ (settings.filter_cache)?GR_TEXTUREFILTER_BILINEAR:GR_TEXTUREFILTER_POINT_SAMPLED,
+ (settings.filter_cache)?GR_TEXTUREFILTER_BILINEAR:GR_TEXTUREFILTER_POINT_SAMPLED);
+ grTexClampMode (i,
+ GR_TEXTURECLAMP_CLAMP,
+ GR_TEXTURECLAMP_CLAMP);
+ }
+
+ switch (_debugger.draw_mode)
+ {
+ case 0:
+ grColorCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
+ grAlphaCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
+ break;
+ case 1:
+ grColorCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
+ grAlphaCombine (GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_NONE,
+ FXFALSE);
+ grConstantColorValue (0xFFFFFFFF);
+ break;
+ case 2:
+ grColorCombine (GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_NONE,
+ FXFALSE);
+ grAlphaCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
+ grConstantColorValue (0xFFFFFFFF);
+ }
+
+ if (_debugger.tmu == 1)
+ {
+ grTexCombine (GR_TMU1,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ FXFALSE,
+ FXFALSE);
+
+ grTexCombine (GR_TMU0,
+ GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ FXFALSE,
+ FXFALSE);
+ }
+ else
+ {
+ grTexCombine (GR_TMU0,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ FXFALSE,
+ FXFALSE);
+ }
+
+ grAlphaBlendFunction (GR_BLEND_SRC_ALPHA,
+ GR_BLEND_ONE_MINUS_SRC_ALPHA,
+ GR_BLEND_ONE,
+ GR_BLEND_ZERO);
+
+ // Draw texture memory
+ for (i=0; i<4; i++)
+ {
+ for (wxUint32 x=0; x<16; x++)
+ {
+ wxUint32 y = i+_debugger.tex_scroll;
+ if (x+y*16 >= (wxUint32)rdp.n_cached[_debugger.tmu]) break;
+ CACHE_LUT * cache = voodoo.tex_UMA?rdp.cache[0]:rdp.cache[_debugger.tmu];
+
+ VERTEX v[4] = {
+ { SX(x*64.0f), SY(512+64.0f*i), 1, 1, 0, 0, 0, 0, {0, 0, 0, 0} },
+ { SX(x*64.0f+64.0f*cache[x+y*16].scale_x), SY(512+64.0f*i), 1, 1, 255*cache[x+y*16].scale_x, 0, 0, 0, {0, 0, 0, 0} },
+ { SX(x*64.0f), SY(512+64.0f*i+64.0f*cache[x+y*16].scale_y), 1, 1, 0, 255*cache[x+y*16].scale_y, 0, 0, {0, 0, 0, 0} },
+ { SX(x*64.0f+64.0f*cache[x+y*16].scale_x), SY(512+64.0f*i+64.0f*cache[x+y*16].scale_y), 1, 1, 255*cache[x+y*16].scale_x, 255*cache[x+y*16].scale_y, 0, 0, {0, 0, 0, 0} }
+ };
+ for
+ (int i=0; i<4; i++)
+ {
+ v[i].u1 = v[i].u0;
+ v[i].v1 = v[i].v0;
+ }
+
+ ConvertCoordsConvert (v, 4);
+
+ grTexSource(_debugger.tmu,
+ voodoo.tex_min_addr[_debugger.tmu] + cache[x+y*16].tmem_addr,
+ GR_MIPMAPLEVELMASK_BOTH,
+ &cache[x+y*16].t_info);
+
+ grDrawTriangle (&v[2], &v[1], &v[0]);
+ grDrawTriangle (&v[2], &v[3], &v[1]);
+ }
+ }
+
+}
+
+//
+// debug_capture - does a frame capture event (for debugging)
+//
+
+void debug_capture ()
+{
+ wxUint32 i,j;
+
+ if (_debugger.tri_list == NULL) goto END;
+ _debugger.tri_sel = _debugger.tri_list;
+ _debugger.selected = SELECTED_TRI;
+
+ // Connect the list
+ _debugger.tri_last->pNext = _debugger.tri_list;
+
+ while (!CheckKeyPressed(G64_VK_INSERT, 0x0001)) //INSERT
+ {
+ // Check for clicks
+ if (CheckKeyPressed(G64_VK_LBUTTON, 0x0001)) //LBUTTON
+ {
+ POINT pt;
+ DbgCursorPos(&pt);
+
+ //int diff = settings.scr_res_y-settings.res_y;
+
+ if (pt.y <= (int)settings.res_y)
+ {
+ int x = pt.x;
+ int y = pt.y;//settings.res_y - (pt.y - diff);
+
+ TRI_INFO *start;
+ TRI_INFO *tri;
+ if (_debugger.tri_sel == NULL) tri = _debugger.tri_list, start = _debugger.tri_list;
+ else tri = _debugger.tri_sel->pNext, start = _debugger.tri_sel;
+
+ // Select a triangle (start from the currently selected one)
+ do {
+ if (tri->v[0].x == tri->v[1].x &&
+ tri->v[0].y == tri->v[1].y)
+ {
+ tri = tri->pNext;
+ continue;
+ }
+
+ for (i=0; inv; i++)
+ {
+ j=i+1;
+ if (j==tri->nv) j=0;
+
+ if ((y-tri->v[i].y)*(tri->v[j].x-tri->v[i].x) -
+ (x-tri->v[i].x)*(tri->v[j].y-tri->v[i].y) < 0)
+ break; // It's outside
+ }
+
+ if (i==tri->nv) // all lines passed
+ {
+ _debugger.tri_sel = tri;
+ break;
+ }
+
+ for (i=0; inv; i++)
+ {
+ j=i+1;
+ if (j==tri->nv) j=0;
+
+ if ((y-tri->v[i].y)*(tri->v[j].x-tri->v[i].x) -
+ (x-tri->v[i].x)*(tri->v[j].y-tri->v[i].y) > 0)
+ break; // It's outside
+ }
+
+ if (i==tri->nv) // all lines passed
+ {
+ _debugger.tri_sel = tri;
+ break;
+ }
+
+ tri = tri->pNext;
+ } while (tri != start);
+ }
+ else
+ {
+ // on a texture
+ _debugger.tex_sel = (((wxUint32)((pt.y-SY(512))/SY(64))+_debugger.tex_scroll)*16) +
+ (wxUint32)(pt.x/SX(64));
+ }
+ }
+
+ debug_keys ();
+
+ grBufferClear (0, 0, 0xFFFF);
+
+ // Copy the screen capture back to the screen:
+ grLfbWriteRegion(GR_BUFFER_BACKBUFFER,
+ (wxUint32)rdp.offset_x,
+ (wxUint32)rdp.offset_y,
+ GR_LFB_SRC_FMT_565,
+ settings.res_x,
+ settings.res_y,
+ FXFALSE,
+ settings.res_x<<1,
+ _debugger.screen);
+
+ // Do the cacheviewer
+ debug_cacheviewer ();
+
+ // **
+ // 3/16/02: Moved texture viewer out of loop, remade it. Now it's simpler, and
+ // supports TMU1. [Dave2001]
+ // Original by Gugaman
+
+ CACHE_LUT * cache = voodoo.tex_UMA?rdp.cache[0]:rdp.cache[_debugger.tmu];
+ if (_debugger.page == PAGE_TEX_INFO)
+ {
+ grTexSource(_debugger.tmu,
+ voodoo.tex_min_addr[_debugger.tmu] + cache[_debugger.tex_sel].tmem_addr,
+ GR_MIPMAPLEVELMASK_BOTH,
+ &cache[_debugger.tex_sel].t_info);
+
+#ifdef SHOW_FULL_TEXVIEWER
+ float scx = 1.0f;
+ float scy = 1.0f;
+#else
+ float scx = cache[_debugger.tex_sel].scale_x;
+ float scy = cache[_debugger.tex_sel].scale_y;
+#endif
+ VERTEX v[4] = {
+ { SX(704.0f), SY(221.0f), 1, 1, 0, 0, 0, 0, {0, 0, 0, 0} },
+ { SX(704.0f+256.0f*scx), SY(221.0f), 1, 1, 255*scx, 0, 255*scx, 0, {0, 0, 0, 0} },
+ { SX(704.0f), SY(221.0f+256.0f*scy), 1, 1, 0, 255*scy, 0, 255*scy, {0, 0, 0, 0} },
+ { SX(704.0f+256.0f*scx), SY(221.0f+256.0f*scy), 1, 1, 255*scx, 255*scy, 255*scx, 255*scy, {0, 0, 0, 0} }
+ };
+ ConvertCoordsConvert (v, 4);
+ VERTEX *varr[4] = { &v[0], &v[1], &v[2], &v[3] };
+ grDrawVertexArray (GR_TRIANGLE_STRIP, 4, varr);
+ }
+
+ // **
+
+ grTexFilterMode (GR_TMU0,
+ GR_TEXTUREFILTER_BILINEAR,
+ GR_TEXTUREFILTER_BILINEAR);
+
+ grColorCombine (GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_NONE,
+ FXFALSE);
+
+ grAlphaCombine (GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_NONE,
+ FXFALSE);
+
+ grConstantColorValue (0x0000FFFF);
+
+ VERTEX *v[8];
+ if (_debugger.tri_sel)
+ {
+ // Draw the outline around the selected triangle
+ for (i=0; i<_debugger.tri_sel->nv; i++)
+ {
+ j=i+1;
+ if (j>=_debugger.tri_sel->nv) j=0;
+
+ grDrawLine (&_debugger.tri_sel->v[i], &_debugger.tri_sel->v[j]);
+
+ v[i] = &_debugger.tri_sel->v[i];
+ }
+ }
+
+ // and the selected texture
+ wxUint32 t_y = ((_debugger.tex_sel & 0xFFFFFFF0) >> 4) - _debugger.tex_scroll;
+ wxUint32 t_x = _debugger.tex_sel & 0xF;
+ VERTEX vt[4] = {
+ { SX(t_x*64.0f), SY(512+64.0f*t_y), 1, 1 },
+ { SX(t_x*64.0f+64.0f), SY(512+64.0f*t_y), 1, 1 },
+ { SX(t_x*64.0f), SY(512+64.0f*t_y+64.0f), 1, 1 },
+ { SX(t_x*64.0f+64.0f), SY(512+64.0f*t_y+64.0f), 1, 1 } };
+ if (t_y < 4)
+ {
+ grDrawLine (&vt[0], &vt[1]);
+ grDrawLine (&vt[1], &vt[3]);
+ grDrawLine (&vt[3], &vt[2]);
+ grDrawLine (&vt[2], &vt[0]);
+ }
+
+ grConstantColorValue (0xFF000020);
+
+ if (t_y < 4)
+ {
+ grDrawTriangle (&vt[2], &vt[1], &vt[0]);
+ grDrawTriangle (&vt[2], &vt[3], &vt[1]);
+ }
+
+ if (_debugger.tri_sel)
+ grDrawVertexArray (GR_TRIANGLE_FAN, _debugger.tri_sel->nv, &v);
+
+ // Draw the outline of the cacheviewer
+ if (_debugger.page == PAGE_TEX_INFO)
+ {
+ float scx = cache[_debugger.tex_sel].scale_x;
+ float scy = cache[_debugger.tex_sel].scale_y;
+
+ // And the grid
+ if (grid)
+ {
+ grConstantColorValue (COL_GRID);
+
+ float scale_y = (256.0f * scy) / (float)cache[_debugger.tex_sel].height;
+ for (int y=0; y<=(int)cache[_debugger.tex_sel].height; y++)
+ {
+ float y_val = SY(221.0f+y*scale_y);
+ VERTEX vh[2] = {
+ { SX(704.0f), y_val, 1, 1 },
+ { SX(704.0f+255.0f*scx), y_val, 1, 1 } };
+ grDrawLine (&vh[0], &vh[1]);
+ }
+
+ float scale_x = (256.0f * scx) / (float)cache[_debugger.tex_sel].width;
+ for (int x=0; x<=(int)cache[_debugger.tex_sel].width; x++)
+ {
+ float x_val = SX(704.0f+x*scale_x);
+ VERTEX vv[2] = {
+ { x_val, SX(221.0f), 1, 1 },
+ { x_val, SX(221.0f+256.0f*scy), 1, 1 } };
+ grDrawLine (&vv[0], &vv[1]);
+ }
+ }
+ }
+
+ grTexCombine (GR_TMU0,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ FXFALSE,
+ FXFALSE);
+
+ grColorCombine (GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_NONE,
+ FXFALSE);
+
+ grAlphaCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
+
+ grConstantColorValue (0xFFFFFF00);
+
+ // Output the information about the selected triangle
+ grTexSource(GR_TMU0, // Text
+ voodoo.tex_min_addr[_debugger.tmu]+ offset_font,
+ GR_MIPMAPLEVELMASK_BOTH,
+ &fontTex);
+
+ static const char *cycle_mode_s[4] = { "1 cycle (0)", "2 cycle (1)", "copy (2)", "fill (3)" };
+
+#define OUTPUT(fmt,other) output(642,(float)i,1,fmt,other); i-=16;
+#define OUTPUT1(fmt,other,other1) output(642,(float)i,1,fmt,other,other1); i-=16;
+#define OUTPUT_(fmt,cc) COL_SEL(cc); x=642; output(x,(float)i,1,fmt,0); x+=8*(strlen(fmt)+1)
+#define _OUTPUT(fmt,cc) COL_SEL(cc); output(x,(float)i,1,fmt,0); x+=8*(strlen(fmt)+1)
+ i = 740;
+ float x;
+ if (_debugger.page == PAGE_GENERAL && _debugger.tri_sel)
+ {
+ COL_CATEGORY();
+ OUTPUT ("GENERAL (page 1):",0);
+ COL_TEXT();
+ OUTPUT ("tri #%d", _debugger.tri_sel->tri_n);
+ OUTPUT ("type: %s", tri_type[_debugger.tri_sel->type]);
+ OUTPUT ("geom: 0x%08lx", _debugger.tri_sel->geom_mode);
+ OUTPUT ("othermode_h: 0x%08lx", _debugger.tri_sel->othermode_h);
+ OUTPUT ("othermode_l: 0x%08lx", _debugger.tri_sel->othermode_l);
+ OUTPUT ("flags: 0x%08lx", _debugger.tri_sel->flags);
+ OUTPUT ("",0);
+ COL_CATEGORY();
+ OUTPUT ("COMBINE:",0);
+ COL_TEXT();
+ OUTPUT ("cycle_mode: %s", cycle_mode_s[_debugger.tri_sel->cycle_mode]);
+ OUTPUT ("cycle1: 0x%08lx", _debugger.tri_sel->cycle1);
+ OUTPUT ("cycle2: 0x%08lx", _debugger.tri_sel->cycle2);
+ if (_debugger.tri_sel->uncombined & 1)
+ COL_UCC();
+ else
+ COL_CC();
+ OUTPUT ("a0: %s", Mode0[(_debugger.tri_sel->cycle1)&0x0000000F]);
+ OUTPUT ("b0: %s", Mode1[(_debugger.tri_sel->cycle1>>4)&0x0000000F]);
+ OUTPUT ("c0: %s", Mode2[(_debugger.tri_sel->cycle1>>8)&0x0000001F]);
+ OUTPUT ("d0: %s", Mode3[(_debugger.tri_sel->cycle1>>13)&0x00000007]);
+ if (_debugger.tri_sel->uncombined & 2)
+ COL_UAC();
+ else
+ COL_AC();
+ OUTPUT ("Aa0: %s", Alpha0[(_debugger.tri_sel->cycle1>>16)&0x00000007]);
+ OUTPUT ("Ab0: %s", Alpha1[(_debugger.tri_sel->cycle1>>19)&0x00000007]);
+ OUTPUT ("Ac0: %s", Alpha2[(_debugger.tri_sel->cycle1>>22)&0x00000007]);
+ OUTPUT ("Ad0: %s", Alpha3[(_debugger.tri_sel->cycle1>>25)&0x00000007]);
+ if (_debugger.tri_sel->uncombined & 1)
+ COL_UCC();
+ else
+ COL_CC();
+ OUTPUT ("a1: %s", Mode0[(_debugger.tri_sel->cycle2)&0x0000000F]);
+ OUTPUT ("b1: %s", Mode1[(_debugger.tri_sel->cycle2>>4)&0x0000000F]);
+ OUTPUT ("c1: %s", Mode2[(_debugger.tri_sel->cycle2>>8)&0x0000001F]);
+ OUTPUT ("d1: %s", Mode3[(_debugger.tri_sel->cycle2>>13)&0x00000007]);
+ if (_debugger.tri_sel->uncombined & 2)
+ COL_UAC();
+ else
+ COL_AC();
+ OUTPUT ("Aa1: %s", Alpha0[(_debugger.tri_sel->cycle2>>16)&0x00000007]);
+ OUTPUT ("Ab1: %s", Alpha1[(_debugger.tri_sel->cycle2>>19)&0x00000007]);
+ OUTPUT ("Ac1: %s", Alpha2[(_debugger.tri_sel->cycle2>>22)&0x00000007]);
+ OUTPUT ("Ad1: %s", Alpha3[(_debugger.tri_sel->cycle2>>25)&0x00000007]);
+ }
+ if ((_debugger.page == PAGE_TEX1 || _debugger.page == PAGE_TEX2) && _debugger.tri_sel)
+ {
+ COL_CATEGORY ();
+ OUTPUT1 ("TEXTURE %d (page %d):", _debugger.page-PAGE_TEX1, 2+_debugger.page-PAGE_TEX1);
+ COL_TEXT();
+ int tmu = _debugger.page - PAGE_TEX1;
+ OUTPUT1 ("cur cache: %d,%d", _debugger.tri_sel->t[tmu].cur_cache[tmu]&0x0F, _debugger.tri_sel->t[tmu].cur_cache[tmu]>>4);
+ OUTPUT ("tex_size: %d", _debugger.tri_sel->t[tmu].size);
+ OUTPUT ("tex_format: %d", _debugger.tri_sel->t[tmu].format);
+ OUTPUT ("width: %d", _debugger.tri_sel->t[tmu].width);
+ OUTPUT ("height: %d", _debugger.tri_sel->t[tmu].height);
+ OUTPUT ("palette: %d", _debugger.tri_sel->t[tmu].palette);
+ OUTPUT ("clamp_s: %d", _debugger.tri_sel->t[tmu].clamp_s);
+ OUTPUT ("clamp_t: %d", _debugger.tri_sel->t[tmu].clamp_t);
+ OUTPUT ("mirror_s: %d", _debugger.tri_sel->t[tmu].mirror_s);
+ OUTPUT ("mirror_t: %d", _debugger.tri_sel->t[tmu].mirror_t);
+ OUTPUT ("mask_s: %d", _debugger.tri_sel->t[tmu].mask_s);
+ OUTPUT ("mask_t: %d", _debugger.tri_sel->t[tmu].mask_t);
+ OUTPUT ("shift_s: %d", _debugger.tri_sel->t[tmu].shift_s);
+ OUTPUT ("shift_t: %d", _debugger.tri_sel->t[tmu].shift_t);
+ OUTPUT ("ul_s: %d", _debugger.tri_sel->t[tmu].ul_s);
+ OUTPUT ("ul_t: %d", _debugger.tri_sel->t[tmu].ul_t);
+ OUTPUT ("lr_s: %d", _debugger.tri_sel->t[tmu].lr_s);
+ OUTPUT ("lr_t: %d", _debugger.tri_sel->t[tmu].lr_t);
+ OUTPUT ("t_ul_s: %d", _debugger.tri_sel->t[tmu].t_ul_s);
+ OUTPUT ("t_ul_t: %d", _debugger.tri_sel->t[tmu].t_ul_t);
+ OUTPUT ("t_lr_s: %d", _debugger.tri_sel->t[tmu].t_lr_s);
+ OUTPUT ("t_lr_t: %d", _debugger.tri_sel->t[tmu].t_lr_t);
+ OUTPUT ("scale_s: %f", _debugger.tri_sel->t[tmu].scale_s);
+ OUTPUT ("scale_t: %f", _debugger.tri_sel->t[tmu].scale_t);
+ OUTPUT ("s_mode: %s", str_cm[((_debugger.tri_sel->t[tmu].clamp_s << 1) | _debugger.tri_sel->t[tmu].mirror_s)&3]);
+ OUTPUT ("t_mode: %s", str_cm[((_debugger.tri_sel->t[tmu].clamp_t << 1) | _debugger.tri_sel->t[tmu].mirror_t)&3]);
+ }
+ if (_debugger.page == PAGE_COLORS && _debugger.tri_sel)
+ {
+ COL_CATEGORY();
+ OUTPUT ("COLORS (page 4)", 0);
+ COL_TEXT();
+ OUTPUT ("fill: %08lx", _debugger.tri_sel->fill_color);
+ OUTPUT ("prim: %08lx", _debugger.tri_sel->prim_color);
+ OUTPUT ("blend: %08lx", _debugger.tri_sel->blend_color);
+ OUTPUT ("env: %08lx", _debugger.tri_sel->env_color);
+ OUTPUT ("fog: %08lx", _debugger.tri_sel->fog_color);
+ OUTPUT ("prim_lodmin: %d", _debugger.tri_sel->prim_lodmin);
+ OUTPUT ("prim_lodfrac: %d", _debugger.tri_sel->prim_lodfrac);
+ }
+ if (_debugger.page == PAGE_FBL && _debugger.tri_sel)
+ {
+ COL_CATEGORY();
+ OUTPUT ("BLENDER", 0);
+ COL_TEXT();
+ OUTPUT ("fbl_a0: %s", FBLa[(_debugger.tri_sel->othermode_l>>30)&0x3]);
+ OUTPUT ("fbl_b0: %s", FBLb[(_debugger.tri_sel->othermode_l>>26)&0x3]);
+ OUTPUT ("fbl_c0: %s", FBLc[(_debugger.tri_sel->othermode_l>>22)&0x3]);
+ OUTPUT ("fbl_d0: %s", FBLd[(_debugger.tri_sel->othermode_l>>18)&0x3]);
+ OUTPUT ("fbl_a1: %s", FBLa[(_debugger.tri_sel->othermode_l>>28)&0x3]);
+ OUTPUT ("fbl_b1: %s", FBLb[(_debugger.tri_sel->othermode_l>>24)&0x3]);
+ OUTPUT ("fbl_c1: %s", FBLc[(_debugger.tri_sel->othermode_l>>20)&0x3]);
+ OUTPUT ("fbl_d1: %s", FBLd[(_debugger.tri_sel->othermode_l>>16)&0x3]);
+ OUTPUT ("", 0);
+ OUTPUT ("fbl: %08lx", _debugger.tri_sel->othermode_l&0xFFFF0000);
+ OUTPUT ("fbl #1: %08lx", _debugger.tri_sel->othermode_l&0xCCCC0000);
+ OUTPUT ("fbl #2: %08lx", _debugger.tri_sel->othermode_l&0x33330000);
+ }
+ if (_debugger.page == PAGE_OTHERMODE_L && _debugger.tri_sel)
+ {
+ wxUint32 othermode_l = _debugger.tri_sel->othermode_l;
+ COL_CATEGORY ();
+ OUTPUT ("OTHERMODE_L: %08lx", othermode_l);
+ OUTPUT_ ("AC_NONE", (othermode_l & 3) == 0);
+ _OUTPUT ("AC_THRESHOLD", (othermode_l & 3) == 1);
+ _OUTPUT ("AC_DITHER", (othermode_l & 3) == 3);
+ i -= 16;
+ OUTPUT_ ("ZS_PIXEL", !(othermode_l & 4));
+ _OUTPUT ("ZS_PRIM", (othermode_l & 4));
+ i -= 32;
+ COL_CATEGORY ();
+ OUTPUT ("RENDERMODE: %08lx", othermode_l);
+ OUTPUT_ ("AA_EN", othermode_l & 0x08);
+ i -= 16;
+ OUTPUT_ ("Z_CMP", othermode_l & 0x10);
+ i -= 16;
+ OUTPUT_ ("Z_UPD", othermode_l & 0x20);
+ i -= 16;
+ OUTPUT_ ("IM_RD", othermode_l & 0x40);
+ i -= 16;
+ OUTPUT_ ("CLR_ON_CVG", othermode_l & 0x80);
+ i -= 16;
+ OUTPUT_ ("CVG_DST_CLAMP", (othermode_l & 0x300) == 0x000);
+ _OUTPUT ("CVG_DST_WRAP", (othermode_l & 0x300) == 0x100);
+ _OUTPUT (".._FULL", (othermode_l & 0x300) == 0x200);
+ _OUTPUT (".._SAVE", (othermode_l & 0x300) == 0x300);
+ i -= 16;
+ OUTPUT_ ("ZM_OPA", (othermode_l & 0xC00) == 0x000);
+ _OUTPUT ("ZM_INTER", (othermode_l & 0xC00) == 0x400);
+ _OUTPUT ("ZM_XLU", (othermode_l & 0xC00) == 0x800);
+ _OUTPUT ("ZM_DEC", (othermode_l & 0xC00) == 0xC00);
+ i -= 16;
+ OUTPUT_ ("CVG_X_ALPHA", othermode_l & 0x1000);
+ i -= 16;
+ OUTPUT_ ("ALPHA_CVG_SEL", othermode_l & 0x2000);
+ i -= 16;
+ OUTPUT_ ("FORCE_BL", othermode_l & 0x4000);
+ }
+ if (_debugger.page == PAGE_OTHERMODE_H && _debugger.tri_sel)
+ {
+ wxUint32 othermode_h = _debugger.tri_sel->othermode_h;
+ COL_CATEGORY ();
+ OUTPUT ("OTHERMODE_H: %08lx", othermode_h);
+ OUTPUT_ ("CK_NONE", (othermode_h & 0x100) == 0);
+ _OUTPUT ("CK_KEY", (othermode_h & 0x100) == 1);
+ i -= 16;
+ OUTPUT_ ("TC_CONV", (othermode_h & 0xE00) == 0x200);
+ _OUTPUT ("TC_FILTCONV", (othermode_h & 0xE00) == 0xA00);
+ _OUTPUT ("TC_FILT", (othermode_h & 0xE00) == 0xC00);
+ i -= 16;
+ OUTPUT_ ("TF_POINT", (othermode_h & 0x3000) == 0x0000);
+ _OUTPUT ("TF_AVERAGE", (othermode_h & 0x3000) == 0x3000);
+ _OUTPUT ("TF_BILERP", (othermode_h & 0x3000) == 0x2000);
+ i -= 16;
+ OUTPUT_ ("TT_NONE", (othermode_h & 0xC000) == 0x0000);
+ _OUTPUT ("TT_RGBA16", (othermode_h & 0xC000) == 0x8000);
+ _OUTPUT ("TT_IA16", (othermode_h & 0xC000) == 0xC000);
+ i -= 16;
+ OUTPUT_ ("TL_TILE", (othermode_h & 0x10000) == 0x00000);
+ _OUTPUT ("TL_LOD", (othermode_h & 0x10000) == 0x10000);
+ i -= 16;
+ OUTPUT_ ("TD_CLAMP", (othermode_h & 0x60000) == 0x00000);
+ _OUTPUT ("TD_SHARPEN", (othermode_h & 0x60000) == 0x20000);
+ _OUTPUT ("TD_DETAIL", (othermode_h & 0x60000) == 0x40000);
+ i -= 16;
+ OUTPUT_ ("TP_NONE", (othermode_h & 0x80000) == 0x00000);
+ _OUTPUT ("TP_PERSP", (othermode_h & 0x80000) == 0x80000);
+ i -= 16;
+ OUTPUT_ ("1CYCLE", (othermode_h & 0x300000) == 0x000000);
+ _OUTPUT ("2CYCLE", (othermode_h & 0x300000) == 0x100000);
+ _OUTPUT ("COPY", (othermode_h & 0x300000) == 0x200000);
+ _OUTPUT ("FILL", (othermode_h & 0x300000) == 0x300000);
+ i -= 16;
+ OUTPUT_ ("PM_1PRIM", (othermode_h & 0x400000) == 0x000000);
+ _OUTPUT ("PM_NPRIM", (othermode_h & 0x400000) == 0x400000);
+ }
+ if (_debugger.page == PAGE_TEXELS && _debugger.tri_sel)
+ {
+ // change these to output whatever you need, ou for triangles, or u0 for texrects
+ COL_TEXT();
+ OUTPUT ("n: %d", _debugger.tri_sel->nv);
+ OUTPUT ("",0);
+ for (j=0; j<_debugger.tri_sel->nv; j++)
+ {
+ OUTPUT1 ("v[%d].s0: %f", j, _debugger.tri_sel->v[j].ou);
+ OUTPUT1 ("v[%d].t0: %f", j, _debugger.tri_sel->v[j].ov);
+ }
+ OUTPUT ("",0);
+ for (j=0; j<_debugger.tri_sel->nv; j++)
+ {
+ OUTPUT1 ("v[%d].s1: %f", j, _debugger.tri_sel->v[j].u0);
+ OUTPUT1 ("v[%d].t1: %f", j, _debugger.tri_sel->v[j].v0);
+ }
+ }
+ if (_debugger.page == PAGE_COORDS && _debugger.tri_sel)
+ {
+ COL_TEXT();
+ OUTPUT ("n: %d", _debugger.tri_sel->nv);
+ for (j=0; j<_debugger.tri_sel->nv; j++)
+ {
+ OUTPUT1 ("v[%d].x: %f", j, _debugger.tri_sel->v[j].x);
+ OUTPUT1 ("v[%d].y: %f", j, _debugger.tri_sel->v[j].y);
+ OUTPUT1 ("v[%d].z: %f", j, _debugger.tri_sel->v[j].z);
+ OUTPUT1 ("v[%d].w: %f", j, _debugger.tri_sel->v[j].w);
+ OUTPUT1 ("v[%d].f: %f", j, 1.0f/_debugger.tri_sel->v[j].f);
+ OUTPUT1 ("v[%d].r: %d", j, _debugger.tri_sel->v[j].r);
+ OUTPUT1 ("v[%d].g: %d", j, _debugger.tri_sel->v[j].g);
+ OUTPUT1 ("v[%d].b: %d", j, _debugger.tri_sel->v[j].b);
+ OUTPUT1 ("v[%d].a: %d", j, _debugger.tri_sel->v[j].a);
+ }
+ }
+ if (_debugger.page == PAGE_TEX_INFO && _debugger.tex_sel < (wxUint32)rdp.n_cached[_debugger.tmu])
+ {
+ COL_CATEGORY();
+ OUTPUT ("CACHE (page 0)", 0);
+ COL_TEXT();
+ //OUTPUT ("t_mem: %08lx", rdp.cache[0][_debugger.tex_sel].t_mem);
+ //OUTPUT ("crc: %08lx", rdp.cache[0][_debugger.tex_sel].crc);
+ OUTPUT ("addr: %08lx", cache[_debugger.tex_sel].addr);
+ OUTPUT ("scale_x: %f", cache[_debugger.tex_sel].scale_x);
+ OUTPUT ("scale_y: %f", cache[_debugger.tex_sel].scale_y);
+ OUTPUT ("tmem_addr: %08lx", cache[_debugger.tex_sel].tmem_addr);
+ OUTPUT ("palette: %08lx", cache[_debugger.tex_sel].palette);
+ OUTPUT ("set_by: %08lx", cache[_debugger.tex_sel].set_by);
+ OUTPUT ("texrecting: %d", cache[_debugger.tex_sel].texrecting);
+
+ OUTPUT ("mod: %08lx", cache[_debugger.tex_sel].mod);
+ OUTPUT ("mod_col: %08lx", cache[_debugger.tex_sel].mod_color);
+ OUTPUT ("mod_col1: %08lx", cache[_debugger.tex_sel].mod_color1);
+ i=740;
+ output(800,(float)i,1,"width: %d", cache[_debugger.tex_sel].width);
+ i-=16;
+ output(800,(float)i,1,"height: %d", cache[_debugger.tex_sel].height);
+ i-=16;
+ output(800,(float)i,1,"format: %d", cache[_debugger.tex_sel].format);
+ i-=16;
+ output(800,(float)i,1,"size: %d", cache[_debugger.tex_sel].size);
+ i-=16;
+ output(800,(float)i,1,"crc: %08lx", cache[_debugger.tex_sel].crc);
+ i-=16;
+#ifdef TEXTURE_FILTER
+ output(800,(float)i,1,"RiceCrc: %08lx", (wxUint32)(rdp.cache[_debugger.tmu][_debugger.tex_sel].ricecrc&0xFFFFFFFF));
+ i-=16;
+ output(800,(float)i,1,"RicePalCrc: %08lx", (wxUint32)(rdp.cache[_debugger.tmu][_debugger.tex_sel].ricecrc>>32));
+ i-=16;
+#endif
+ output(800,(float)i,1,"flags: %08lx", cache[_debugger.tex_sel].flags);
+ i-=16;
+ output(800,(float)i,1,"line: %d", cache[_debugger.tex_sel].line);
+ i-=16;
+ output(800,(float)i,1,"mod_factor: %08lx", cache[_debugger.tex_sel].mod_factor);
+ i-=32;
+
+ output(800,(float)i,1,"lod: %s", str_lod[cache[_debugger.tex_sel].lod]);
+ i-=16;
+ output(800,(float)i,1,"aspect: %s", str_aspect[cache[_debugger.tex_sel].aspect + 3]);
+
+// debug_texture(_debugger.tmu, cache[_debugger.tex_sel].addr, _debugger.tex_sel);
+ }
+
+ // Draw the vertex numbers
+ if (_debugger.tri_sel)
+ {
+ for (i=0; i<_debugger.tri_sel->nv; i++)
+ {
+ grConstantColorValue (0x000000FF);
+ output (_debugger.tri_sel->v[i].x+1, settings.scr_res_y-_debugger.tri_sel->v[i].y+1, 1,
+ "%d", i);
+ grConstantColorValue (0xFFFFFFFF);
+ output (_debugger.tri_sel->v[i].x, settings.scr_res_y-_debugger.tri_sel->v[i].y, 1,
+ "%d", i);
+ }
+ }
+
+ // Draw the cursor
+ debug_mouse ();
+
+ grBufferSwap (1);
+ }
+
+END:
+ // Release all data
+ delete [] _debugger.screen;
+ TRI_INFO *tri;
+ for (tri=_debugger.tri_list; tri != _debugger.tri_last;)
+ {
+ TRI_INFO *tmp = tri;
+ tri = tri->pNext;
+ delete [] tmp->v;
+ delete tmp;
+ }
+ delete [] tri->v;
+ delete tri;
+
+ // Reset all values
+ _debugger.capture = 0;
+ _debugger.selected = SELECTED_TRI;
+ _debugger.screen = NULL;
+ _debugger.tri_list = NULL;
+ _debugger.tri_last = NULL;
+ _debugger.tri_sel = NULL;
+ _debugger.tex_sel = 0;
+}
+
+//
+// debug_mouse - draws the debugger mouse
+//
+
+void debug_mouse ()
+{
+ grColorCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
+
+ grAlphaCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
+
+ // Draw the cursor
+ POINT pt;
+ DbgCursorPos(&pt);
+ float cx = (float)pt.x;
+ float cy = (float)pt.y;
+
+ VERTEX v[4] = {
+ { cx, cy, 1, 1, 0, 0, 0, 0, {0, 0, 0, 0} },
+ { cx+32, cy, 1, 1, 255, 0, 0, 0, {0, 0, 0, 0} },
+ { cx, cy+32, 1, 1, 0, 255, 0, 0, {0, 0, 0, 0} },
+ { cx+32, cy+32, 1, 1, 255, 255, 0, 0, {0, 0, 0, 0} }
+ };
+
+ ConvertCoordsKeep (v, 4);
+
+ grTexSource(GR_TMU0,
+ voodoo.tex_min_addr[GR_TMU0] + offset_cursor,
+ GR_MIPMAPLEVELMASK_BOTH,
+ &cursorTex);
+
+ if (voodoo.num_tmu >= 3)
+ grTexCombine (GR_TMU2,
+ GR_COMBINE_FUNCTION_NONE,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_NONE,
+ GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE);
+ if (voodoo.num_tmu >= 2)
+ grTexCombine (GR_TMU1,
+ GR_COMBINE_FUNCTION_NONE,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_NONE,
+ GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE);
+ grTexCombine (GR_TMU0,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE, FXFALSE, FXFALSE);
+
+ grDrawTriangle (&v[0], &v[1], &v[2]);
+ grDrawTriangle (&v[1], &v[3], &v[2]);
+}
+
+//
+// debug_keys - receives debugger key input
+//
+
+void debug_keys ()
+{
+ if (CheckKeyPressed(G64_VK_RIGHT, 0x0001) && _debugger.tri_sel)
+ {
+ TRI_INFO *start = _debugger.tri_sel;
+
+ while (_debugger.tri_sel->pNext != start)
+ _debugger.tri_sel = _debugger.tri_sel->pNext;
+ }
+
+ if (CheckKeyPressed(G64_VK_LEFT, 0x0001) && _debugger.tri_sel)
+ _debugger.tri_sel = _debugger.tri_sel->pNext;
+
+ // Check for page changes
+ if (CheckKeyPressed(G64_VK_1, 0x0001))
+ _debugger.page = PAGE_GENERAL;
+ if (CheckKeyPressed(G64_VK_2, 0x0001))
+ _debugger.page = PAGE_TEX1;
+ if (CheckKeyPressed(G64_VK_3, 0x0001))
+ _debugger.page = PAGE_TEX2;
+ if (CheckKeyPressed(G64_VK_4, 0x0001))
+ _debugger.page = PAGE_COLORS;
+ if (CheckKeyPressed(G64_VK_5, 0x0001))
+ _debugger.page = PAGE_FBL;
+ if (CheckKeyPressed(G64_VK_6, 0x0001))
+ _debugger.page = PAGE_OTHERMODE_L;
+ if (CheckKeyPressed(G64_VK_7, 0x0001))
+ _debugger.page = PAGE_OTHERMODE_H;
+ if (CheckKeyPressed(G64_VK_8, 0x0001))
+ _debugger.page = PAGE_TEXELS;
+ if (CheckKeyPressed(G64_VK_9, 0x0001))
+ _debugger.page = PAGE_COORDS;
+ if (CheckKeyPressed(G64_VK_0, 0x0001))
+ _debugger.page = PAGE_TEX_INFO;
+ if (CheckKeyPressed(G64_VK_Q, 0x0001))
+ _debugger.tmu = 0;
+ if (CheckKeyPressed(G64_VK_W, 0x0001))
+ _debugger.tmu = 1;
+
+ if (CheckKeyPressed(G64_VK_G, 0x0001))
+ grid = !grid;
+
+ // Go to texture
+ if (CheckKeyPressed(G64_VK_SPACE, 0x0001))
+ {
+ int tile = -1;
+ if (_debugger.page == PAGE_TEX2)
+ tile = 1;
+ else
+ tile = 0;
+ if (tile != -1)
+ {
+ _debugger.tmu = _debugger.tri_sel->t[tile].tmu;
+ _debugger.tex_sel = _debugger.tri_sel->t[tile].cur_cache[_debugger.tmu];
+ _debugger.tex_scroll = (_debugger.tri_sel->t[tile].cur_cache[_debugger.tmu] >> 4) - 1;
+ }
+ }
+
+ // Go to triangle
+ CACHE_LUT * cache = voodoo.tex_UMA?rdp.cache[0]:rdp.cache[_debugger.tmu];
+ if (CheckKeyPressed(G64_VK_CONTROL, 0x0001))
+ {
+ int count = rdp.debug_n - cache[_debugger.tex_sel].uses - 1;
+ if (cache[_debugger.tex_sel].last_used == frame_count)
+ {
+ TRI_INFO *t = _debugger.tri_list;
+ while (count && t) {
+ t = t->pNext;
+ count --;
+ }
+ _debugger.tri_sel = t;
+ }
+ else
+ _debugger.tri_sel = NULL;
+ }
+
+ if (CheckKeyPressed(G64_VK_A, 0x0001))
+ _debugger.draw_mode = 0; // texture & texture alpha
+ if (CheckKeyPressed(G64_VK_S, 0x0001))
+ _debugger.draw_mode = 1; // texture
+ if (CheckKeyPressed(G64_VK_D, 0x0001))
+ _debugger.draw_mode = 2; // texture alpha
+
+ // Check for texture scrolling
+ if (CheckKeyPressed(G64_VK_DOWN, 0x0001))
+ _debugger.tex_scroll ++;
+ if (CheckKeyPressed(G64_VK_UP, 0x0001))
+ _debugger.tex_scroll --;
+}
+
+//
+// output - output debugger text
+//
+
+void output (float x, float y, int scale, const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap,fmt);
+ vsprintf(out_buf, fmt, ap);
+ va_end(ap);
+
+ wxUint8 c,r;
+ for (wxUint32 i=0; i> 5) * 16;//<< 4;
+ VERTEX v[4] = { { SX(x), SY(768-y), 1, 1, (float)c, r+16.0f, 0, 0, {0, 0, 0, 0} },
+ { SX(x+8), SY(768-y), 1, 1, c+8.0f, r+16.0f, 0, 0, {0, 0, 0, 0} },
+ { SX(x), SY(768-y-16), 1, 1, (float)c, (float)r, 0, 0, {0, 0, 0, 0} },
+ { SX(x+8), SY(768-y-16), 1, 1, c+8.0f, (float)r, 0, 0, {0, 0, 0, 0} }
+ };
+ if (!scale)
+ {
+ v[0].x = x;
+ v[0].y = y;
+ v[1].x = x+8;
+ v[1].y = y;
+ v[2].x = x;
+ v[2].y = y-16;
+ v[3].x = x+8;
+ v[3].y = y-16;
+ }
+
+ ConvertCoordsKeep (v, 4);
+
+ grDrawTriangle (&v[0], &v[1], &v[2]);
+ grDrawTriangle (&v[1], &v[3], &v[2]);
+
+ x+=8;
+ }
+}
diff --git a/source/gles2glide64/src/Glide64/Debugger.h b/source/gles2glide64/src/Glide64/Debugger.h
new file mode 100644
index 0000000..131c302
--- /dev/null
+++ b/source/gles2glide64/src/Glide64/Debugger.h
@@ -0,0 +1,137 @@
+/*
+* Glide64 - Glide video plugin for Nintendo 64 emulators.
+* Copyright (c) 2002 Dave2001
+* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
+*
+* 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
+* 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
+*/
+
+//****************************************************************
+//
+// Glide64 - Glide Plugin for Nintendo 64 emulators
+// Project started on December 29th, 2001
+//
+// Authors:
+// Dave2001, original author, founded the project in 2001, left it in 2002
+// Gugaman, joined the project in 2002, left it in 2002
+// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
+// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
+//
+//****************************************************************
+//
+// To modify Glide64:
+// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
+// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
+//
+//****************************************************************
+
+#define SELECTED_NONE 0x00000000
+#define SELECTED_TRI 0x00000001
+#define SELECTED_TEX 0x00000002
+
+typedef struct TEX_INFO_t
+{
+ wxUint32 cur_cache[2]; // Current cache #
+ wxUint8 format;
+ wxUint8 size;
+ wxUint32 width, height;
+ wxUint16 line, wid;
+ wxUint8 palette;
+ wxUint8 clamp_s, clamp_t;
+ wxUint8 mirror_s, mirror_t;
+ wxUint8 mask_s, mask_t;
+ wxUint8 shift_s, shift_t;
+ wxUint16 ul_s, ul_t, lr_s, lr_t;
+ wxUint16 t_ul_s, t_ul_t, t_lr_s, t_lr_t;
+ float scale_s, scale_t;
+ int tmu;
+} TEX_INFO;
+
+typedef struct TRI_INFO_t
+{
+ wxUint32 nv; // Number of vertices
+ VERTEX *v; // Vertices (2d screen coords) of the triangle, used to outline
+ wxUint32 cycle1, cycle2, cycle_mode; // Combine mode at the time of rendering
+ wxUint8 uncombined; // which is uncombined: 0x01=color 0x02=alpha 0x03=both
+ wxUint32 geom_mode; // geometry mode flags
+ wxUint32 othermode_h; // setothermode_h flags
+ wxUint32 othermode_l; // setothermode_l flags
+ wxUint32 tri_n; // Triangle number
+ wxUint32 flags;
+
+ int type; // 0-normal, 1-texrect, 2-fillrect
+
+ // texture info
+ TEX_INFO t[2];
+
+ // colors
+ wxUint32 fog_color;
+ wxUint32 fill_color;
+ wxUint32 prim_color;
+ wxUint32 blend_color;
+ wxUint32 env_color;
+ wxUint32 prim_lodmin, prim_lodfrac;
+
+ TRI_INFO_t *pNext;
+} TRI_INFO;
+
+typedef struct DEBUGGER_t
+{
+ int capture; // Capture moment for debugging?
+
+ wxUint32 selected; // Selected object (see flags above)
+ TRI_INFO *tri_sel;
+
+ wxUint32 tex_scroll; // texture scrolling
+ wxUint32 tex_sel;
+
+ // CAPTURE INFORMATION
+ wxUint8 *screen; // Screen capture
+ TRI_INFO *tri_list; // Triangle information list
+ TRI_INFO *tri_last; // Last in the list (first in)
+
+ wxUint32 tmu; // tmu #
+
+ wxUint32 draw_mode;
+
+ // Page number
+ int page;
+
+} GLIDE64_DEBUGGER;
+
+#define PAGE_GENERAL 0
+#define PAGE_TEX1 1
+#define PAGE_TEX2 2
+#define PAGE_COLORS 3
+#define PAGE_FBL 4
+#define PAGE_OTHERMODE_L 5
+#define PAGE_OTHERMODE_H 6
+#define PAGE_TEXELS 7
+#define PAGE_COORDS 8
+#define PAGE_TEX_INFO 9
+
+#define TRI_TRIANGLE 0
+#define TRI_TEXRECT 1
+#define TRI_FILLRECT 2
+#define TRI_BACKGROUND 3
+
+extern GLIDE64_DEBUGGER _debugger;
+
+void debug_init ();
+void debug_capture ();
+void debug_cacheviewer ();
+void debug_mouse ();
+void debug_keys ();
+void output (float x, float y, int scale, const char *fmt, ...);
diff --git a/source/gles2glide64/src/Glide64/DepthBufferRender.cpp b/source/gles2glide64/src/Glide64/DepthBufferRender.cpp
new file mode 100755
index 0000000..fb357d8
--- /dev/null
+++ b/source/gles2glide64/src/Glide64/DepthBufferRender.cpp
@@ -0,0 +1,387 @@
+/*
+* Glide64 - Glide video plugin for Nintendo 64 emulators.
+* Copyright (c) 2002 Dave2001
+* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
+*
+* 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
+* 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
+*/
+
+//****************************************************************
+//
+// Glide64 - Glide Plugin for Nintendo 64 emulators
+// Project started on December 29th, 2001
+//
+// Authors:
+// Dave2001, original author, founded the project in 2001, left it in 2002
+// Gugaman, joined the project in 2002, left it in 2002
+// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
+// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
+//
+//****************************************************************
+//
+// To modify Glide64:
+// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
+// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
+//
+//****************************************************************
+//
+// 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
+//
+//****************************************************************
+
+#include "Gfx_1.3.h"
+#include "rdp.h"
+#include "DepthBufferRender.h"
+
+wxUint16 * zLUT = 0;
+
+void ZLUT_init()
+{
+ if (zLUT)
+ return;
+ zLUT = new wxUint16[0x40000];
+ for(int i=0; i<0x40000; i++)
+ {
+ wxUint32 exponent = 0;
+ wxUint32 testbit = 1 << 17;
+ while((i & testbit) && (exponent < 7))
+ {
+ exponent++;
+ testbit = 1 << (17 - exponent);
+ }
+
+ wxUint32 mantissa = (i >> (6 - (6 < exponent ? 6 : exponent))) & 0x7ff;
+ zLUT[i] = (wxUint16)(((exponent << 11) | mantissa) << 2);
+ }
+}
+
+void ZLUT_release()
+{
+ delete[] zLUT;
+ zLUT = 0;
+}
+
+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
+
+#ifdef HAVE_GLES
+// using float should be faster than int in fact, especialy if using NEON
+static float right_height, left_height;
+static float right_x, right_dxdy, left_x, left_dxdy;
+static float left_z, left_dzdy;
+
+__inline float iceil(int x)
+{
+ return cellf((float)x*(1.0f/65536.0f));
+}
+__inline float i2float(int x)
+{
+ return (float)x*(1.0f/65536.0f);
+}
+__inline int float2i(float x)
+{
+ return x*65536.0f;
+}
+
+#else
+
+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 (((long long)x) * ((long long)y)) >> 16;
+}
+
+__inline int imul14(int x, int y) // (x * y) >> 14
+{
+ return (((long long)x) * ((long long)y)) >> 14;
+}
+__inline int idiv16(int x, int y) // (x << 16) / y
+{
+ //x = (((long long)x) << 16) / ((long long)y);
+ /*
+ eax = x;
+ ebx = y;
+ edx = x;
+ (x << 16) | ()
+ */
+#if !defined(__GNUC__) && !defined(NO_ASM)
+ __asm {
+ mov eax, x
+ mov ebx, y
+ mov edx,eax
+ sar edx,16
+ shl eax,16
+ idiv ebx
+ mov x, eax
+ }
+#elif !defined(NO_ASM)
+ int reminder;
+ asm ("idivl %[divisor]"
+ : "=a" (x), "=d" (reminder)
+ : [divisor] "g" (y), "d" (x >> 16), "a" (x << 16));
+#else
+ x = (((long long)x) << 16) / ((long long)y);
+#endif
+ return x;
+}
+
+__inline int iceil(int x)
+{
+ x += 0xffff;
+ return (x >> 16);
+}
+#endif
+
+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 = iceil(v2->y) - iceil(v1->y);
+ if(right_height <= 0) return;
+
+ // Guard against possible div overflows
+
+ #ifdef HAVE_GLES
+ right_dxdy = i2float(v2->x - v1->x)/i2float(v2->y - v1->y);
+ #else
+ if(right_height > 1) {
+ // OK, no worries, we have a section that is at least
+ // one pixel high. Calculate slope as usual.
+
+ int height = v2->y - v1->y;
+ right_dxdy = idiv16(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) / (v2->y - v1->y);
+ right_dxdy = imul14(v2->x - v1->x, inv_height);
+ }
+ #endif
+
+ // Prestep initial values
+
+ #ifdef HAVE_GLES
+ float prestep = iceil(v1->y) - i2float(v1->y);
+ right_x = i2float(v1->x) + prestep*right_dxdy;
+ #else
+ int prestep = (iceil(v1->y) << 16) - v1->y;
+ right_x = v1->x + imul16(prestep, right_dxdy);
+ #endif
+}
+
+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 = iceil(v2->y) - iceil(v1->y);
+ if(left_height <= 0) return;
+
+ // Guard against possible div overflows
+
+ #ifdef HAVE_GLES
+ float invheight = 1.0f/i2float(v2->y - v1->y)
+ left_dxdy = i2float(v2->x - v1->x)*invheight;
+ left_dzdy = i2float(v2->z - v1->z)*invheight;
+ #else
+ if(left_height > 1) {
+ // OK, no worries, we have a section that is at least
+ // one pixel high. Calculate slope as usual.
+
+ int height = v2->y - v1->y;
+ left_dxdy = idiv16(v2->x - v1->x, height);
+ left_dzdy = idiv16(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) / (v2->y - v1->y);
+ left_dxdy = imul14(v2->x - v1->x, inv_height);
+ left_dzdy = imul14(v2->z - v1->z, inv_height);
+ }
+ #endif
+
+ // Prestep initial values
+
+ #ifdef HAVE_GLES
+ float prestep = iceil(v1->y) - i2float(v1->y);
+ left_x = i2float(v1->x) + prestep*left_dxdy;
+ left_z = i2float(v1->z) + prestep*left_dzdy;
+ #else
+ int prestep = (iceil(v1->y) << 16) - v1->y;
+ left_x = v1->x + imul16(prestep, left_dxdy);
+ left_z = v1->z + imul16(prestep, left_dzdy);
+ #endif
+}
+
+
+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; ny < 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);
+
+ wxUint16 * destptr = (wxUint16*)(gfx.RDRAM+rdp.zimg);
+ int y1 = iceil(min_y);
+ if (y1 >= (int)rdp.scissor_o.lr_y) return;
+ int shift;
+
+ for(;;)
+ {
+ int x1 = iceil(left_x);
+ if (x1 < (int)rdp.scissor_o.ul_x)
+ x1 = rdp.scissor_o.ul_x;
+ int width = iceil(right_x) - x1;
+ if (x1+width >= (int)rdp.scissor_o.lr_x)
+ width = rdp.scissor_o.lr_x - x1 - 1;
+
+ if(width > 0 && y1 >= (int)rdp.scissor_o.ul_y) {
+
+
+ // Prestep initial z
+
+ #ifdef HAVE_GLES
+ float z = left_z + (x1 - left_x)*dzdx;
+ #else
+ int prestep = (x1 << 16) - left_x;
+ int z = left_z + imul16(prestep, dzdx);
+ #endif
+
+ shift = x1 + y1*rdp.zi_width;
+ //draw to depth buffer
+ int trueZ;
+ int idx;
+ wxUint16 encodedZ;
+ for (int x = 0; x < width; x++)
+ {
+ #ifdef HAVE_GLES
+ trueZ = (int)(z*8.0f);
+ #else
+ trueZ = z/8192;
+ #endif
+ if (trueZ < 0) trueZ = 0;
+ else if (trueZ > 0x3FFFF) trueZ = 0x3FFFF;
+ encodedZ = zLUT[trueZ];
+ idx = (shift+x)^1;
+ if(encodedZ < destptr[idx])
+ destptr[idx] = encodedZ;
+ z += dzdx;
+ }
+ }
+
+ //destptr += rdp.zi_width;
+ y1++;
+ if (y1 >= (int)rdp.scissor_o.lr_y) 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 += left_dxdy;
+ left_z += left_dzdy;
+ }
+ }
+}
diff --git a/source/gles2glide64/src/Glide64/DepthBufferRender.h b/source/gles2glide64/src/Glide64/DepthBufferRender.h
new file mode 100644
index 0000000..3f0eb84
--- /dev/null
+++ b/source/gles2glide64/src/Glide64/DepthBufferRender.h
@@ -0,0 +1,60 @@
+/*
+* Glide64 - Glide video plugin for Nintendo 64 emulators.
+* Copyright (c) 2002 Dave2001
+* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
+*
+* 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
+* 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
+*/
+
+//****************************************************************
+//
+// Glide64 - Glide Plugin for Nintendo 64 emulators
+// Project started on December 29th, 2001
+//
+// Authors:
+// Dave2001, original author, founded the project in 2001, left it in 2002
+// Gugaman, joined the project in 2002, left it in 2002
+// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
+// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
+//
+//****************************************************************
+//
+// To modify Glide64:
+// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
+// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
+//
+//****************************************************************
+//
+// 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
+};
+
+extern wxUint16 * zLUT;
+void ZLUT_init();
+void ZLUT_release();
+
+void Rasterize(vertexi * vtx, int vertices, int dzdx);
+
+#endif //DEPTH_BUFFER_RENDER_H
diff --git a/source/gles2glide64/src/Glide64/FBtoScreen.cpp b/source/gles2glide64/src/Glide64/FBtoScreen.cpp
new file mode 100755
index 0000000..46c06fa
--- /dev/null
+++ b/source/gles2glide64/src/Glide64/FBtoScreen.cpp
@@ -0,0 +1,665 @@
+/*
+* Glide64 - Glide video plugin for Nintendo 64 emulators.
+* Copyright (c) 2002 Dave2001
+* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
+*
+* 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
+* 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
+*/
+
+//****************************************************************
+//
+// Glide64 - Glide Plugin for Nintendo 64 emulators
+// Project started on December 29th, 2001
+//
+// Authors:
+// Dave2001, original author, founded the project in 2001, left it in 2002
+// Gugaman, joined the project in 2002, left it in 2002
+// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
+// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
+//
+//****************************************************************
+//
+// To modify Glide64:
+// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
+// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
+//
+//****************************************************************
+//
+// Draw N64 frame buffer to screen.
+// Created by Gonetz, 2007
+//
+//****************************************************************
+
+
+#include "Gfx_1.3.h"
+#include "FBtoScreen.h"
+#include "TexCache.h"
+
+static int SetupFBtoScreenCombiner(wxUint32 texture_size, wxUint32 opaque)
+{
+ int tmu;
+ if (voodoo.tmem_ptr[GR_TMU0]+texture_size < voodoo.tex_max_addr[0])
+ {
+ tmu = GR_TMU0;
+ grTexCombine( GR_TMU1,
+ GR_COMBINE_FUNCTION_NONE,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_NONE,
+ GR_COMBINE_FACTOR_NONE,
+ FXFALSE,
+ FXFALSE );
+ grTexCombine( GR_TMU0,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ FXFALSE,
+ FXFALSE );
+ }
+ else
+ {
+ if (voodoo.tmem_ptr[GR_TMU1]+texture_size >= voodoo.tex_max_addr[1])
+ ClearCache ();
+ tmu = GR_TMU1;
+ grTexCombine( GR_TMU1,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ FXFALSE,
+ FXFALSE );
+ grTexCombine( GR_TMU0,
+ GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ FXFALSE,
+ FXFALSE );
+ }
+ int filter = (rdp.filter_mode!=2)?GR_TEXTUREFILTER_POINT_SAMPLED:GR_TEXTUREFILTER_BILINEAR;
+ grTexFilterMode (tmu, filter, filter);
+ grTexClampMode (tmu,
+ GR_TEXTURECLAMP_CLAMP,
+ GR_TEXTURECLAMP_CLAMP);
+// grConstantColorValue (0xFFFFFFFF);
+ grColorCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE,
+// GR_COMBINE_OTHER_CONSTANT,
+ FXFALSE);
+ grAlphaCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
+ if (opaque)
+ {
+ grAlphaTestFunction (GR_CMP_ALWAYS);
+ grAlphaBlendFunction( GR_BLEND_ONE,
+ GR_BLEND_ZERO,
+ GR_BLEND_ONE,
+ GR_BLEND_ZERO);
+ }
+ else
+ {
+ grAlphaBlendFunction( GR_BLEND_SRC_ALPHA,
+ GR_BLEND_ONE_MINUS_SRC_ALPHA,
+ GR_BLEND_ONE,
+ GR_BLEND_ZERO);
+ }
+ grDepthBufferFunction (GR_CMP_ALWAYS);
+ grCullMode(GR_CULL_DISABLE);
+ grDepthMask (FXFALSE);
+ rdp.update |= UPDATE_COMBINE | UPDATE_ZBUF_ENABLED | UPDATE_CULL_MODE;
+ return tmu;
+}
+
+static void DrawRE2Video(FB_TO_SCREEN_INFO & fb_info, float scale)
+{
+ float scale_y = (float)fb_info.width/rdp.vi_height;
+ float height = settings.scr_res_x/scale_y;
+ float ul_x = 0.5f;
+ float ul_y = (settings.scr_res_y - height)/2.0f;
+ float lr_y = settings.scr_res_y - ul_y - 1.0f;
+ float lr_x = settings.scr_res_x - 1.0f;
+ float lr_u = (fb_info.width - 1)*scale;
+ float lr_v = (fb_info.height - 1)*scale;
+ VERTEX v[4] = {
+ { ul_x, ul_y, 1, 1, 0.5f, 0.5f, 0.5f, 0.5f, {0.5f, 0.5f, 0.5f, 0.5f} },
+ { lr_x, ul_y, 1, 1, lr_u, 0.5f, lr_u, 0.5f, {lr_u, 0.5f, lr_u, 0.5f} },
+ { ul_x, lr_y, 1, 1, 0.5f, lr_v, 0.5f, lr_v, {0.5f, lr_v, 0.5f, lr_v} },
+ { lr_x, lr_y, 1, 1, lr_u, lr_v, lr_u, lr_v, {lr_u, lr_v, lr_u, lr_v} }
+ };
+ grDrawTriangle (&v[0], &v[2], &v[1]);
+ grDrawTriangle (&v[2], &v[3], &v[1]);
+}
+
+static void DrawRE2Video256(FB_TO_SCREEN_INFO & fb_info)
+{
+ FRDP("DrawRE2Video256. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx\n", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
+ wxUint32 * src = (wxUint32*)(gfx.RDRAM+fb_info.addr);
+ GrTexInfo t_info;
+ t_info.smallLodLog2 = GR_LOD_LOG2_256;
+ t_info.largeLodLog2 = GR_LOD_LOG2_256;
+ t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
+ wxUint16 * tex = (wxUint16*)texture_buffer;
+ wxUint16 * dst = tex;
+ wxUint32 col;
+ wxUint8 r, g, b;
+ fb_info.height = min(256, fb_info.height);
+ for (wxUint32 h = 0; h < fb_info.height; h++)
+ {
+ for (wxUint32 w = 0; w < 256; w++)
+ {
+ col = *(src++);
+ r = (wxUint8)((col >> (24+3))&0x1F);
+ g = (wxUint8)((col >> (16+2))&0x3F);
+ b = (wxUint8)((col >> (8+3))&0x1F);
+/* r = (wxUint8)((col >> 24)&0xFF);
+ r = (wxUint8)((float)r / 255.0f * 31.0f);
+ g = (wxUint8)((col >> 16)&0xFF);
+ g = (wxUint8)((float)g / 255.0f * 63.0f);
+ b = (wxUint8)((col >> 8)&0xFF);
+ b = (wxUint8)((float)b / 255.0f * 31.0f);*/ //*SEB*
+ *(dst++) = (r << 11) | (g << 5) | b;
+ }
+ src += (fb_info.width - 256);
+ }
+ t_info.format = GR_TEXFMT_RGB_565;
+ t_info.data = tex;
+ int tmu = SetupFBtoScreenCombiner(grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info), fb_info.opaque);
+ grTexDownloadMipMap (tmu,
+ voodoo.tex_min_addr[tmu]+voodoo.tmem_ptr[tmu],
+ GR_MIPMAPLEVELMASK_BOTH,
+ &t_info);
+ grTexSource (tmu,
+ voodoo.tex_min_addr[tmu]+voodoo.tmem_ptr[tmu],
+ GR_MIPMAPLEVELMASK_BOTH,
+ &t_info);
+ DrawRE2Video(fb_info, 1.0f);
+}
+
+static void DrawFrameBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
+{
+ if (settings.hacks&hack_RE2)
+ {
+ DrawRE2Video256(fb_info);
+ return;
+ }
+ FRDP("DrawFrameBufferToScreen256. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx\n", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
+ wxUint32 width = fb_info.lr_x - fb_info.ul_x + 1;
+ wxUint32 height = fb_info.lr_y - fb_info.ul_y + 1;
+ GrTexInfo t_info;
+ wxUint8 * image = gfx.RDRAM+fb_info.addr;
+ wxUint32 width256 = ((width-1) >> 8) + 1;
+ wxUint32 height256 = ((height-1) >> 8) + 1;
+ t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_256;
+ t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
+ t_info.format = GR_TEXFMT_ARGB_1555;
+ wxUint16 * tex = (wxUint16*)texture_buffer;
+ t_info.data = tex;
+ wxUint32 tex_size = grTexTextureMemRequired (GR_MIPMAPLEVELMASK_BOTH, &t_info);
+ int tmu = SetupFBtoScreenCombiner(tex_size*width256*height256, fb_info.opaque);
+ wxUint16 * src = (wxUint16*)image;
+ src += fb_info.ul_x + fb_info.ul_y * fb_info.width;
+ wxUint32 * src32 = (wxUint32*)image;
+ src32 += fb_info.ul_x + fb_info.ul_y * fb_info.width;
+ wxUint32 w_tail = width%256;
+ wxUint32 h_tail = height%256;
+ wxUint16 c;
+ wxUint32 c32;
+ wxUint32 idx;
+ wxUint32 bound = BMASK+1-fb_info.addr;
+ bound = fb_info.size == 2 ? bound >> 1 : bound >> 2;
+ wxUint8 r, g, b, a;
+ wxUint32 cur_width, cur_height, cur_tail;
+ wxUint32 tex_adr = voodoo.tex_min_addr[tmu]+voodoo.tmem_ptr[tmu];
+ if ((voodoo.tmem_ptr[tmu] < TEXMEM_2MB_EDGE) && (voodoo.tmem_ptr[tmu]+tex_size*width256*height256 > TEXMEM_2MB_EDGE))
+ {
+ tex_adr = TEXMEM_2MB_EDGE;
+ }
+ for (wxUint32 h = 0; h < height256; h++)
+ {
+ for (wxUint32 w = 0; w < width256; w++)
+ {
+ cur_width = (256*(w+1) < width) ? 256 : w_tail;
+ cur_height = (256*(h+1) < height) ? 256 : h_tail;
+ cur_tail = 256 - cur_width;
+ wxUint16 * dst = tex;
+ if (fb_info.size == 2)
+ {
+ for (wxUint32 y=0; y < cur_height; y++)
+ {
+ for (wxUint32 x=0; x < cur_width; x++)
+ {
+ idx = (x+256*w+(y+256*h)*fb_info.width)^1;
+ if (idx >= bound)
+ break;
+ c = src[idx];
+ *(dst++) = (c >> 1) | ((c&1)<<15);
+ }
+ dst += cur_tail;
+ }
+ }
+ else
+ {
+ for (wxUint32 y=0; y < cur_height; y++)
+ {
+ for (wxUint32 x=0; x < cur_width; x++)
+ {
+ idx = (x+256*w+(y+256*h)*fb_info.width);
+ if (idx >= bound)
+ break;
+ c32 = src32[idx];
+ r = (wxUint8)((c32 >> (24+3))&0x1F);
+ g = (wxUint8)((c32 >> (16+2))&0x3F);
+ b = (wxUint8)((c32 >> (8+3))&0x1F);
+/* r = (wxUint8)((c32 >> 24)&0xFF);
+ r = (wxUint8)((float)r / 255.0f * 31.0f);
+ g = (wxUint8)((c32 >> 16)&0xFF);
+ g = (wxUint8)((float)g / 255.0f * 63.0f);
+ b = (wxUint8)((c32 >> 8)&0xFF);
+ b = (wxUint8)((float)b / 255.0f * 31.0f);*/ //*SEB*
+ a = (c32&0xFF) ? 1 : 0;
+ *(dst++) = (a<<15) | (r << 10) | (g << 5) | b;
+ }
+ dst += cur_tail;
+ }
+ }
+ grTexDownloadMipMap (tmu, tex_adr, GR_MIPMAPLEVELMASK_BOTH, &t_info);
+ grTexSource (tmu, tex_adr, GR_MIPMAPLEVELMASK_BOTH, &t_info);
+ tex_adr += tex_size;
+ float ul_x = (float)(fb_info.ul_x + 256*w);
+ float ul_y = (float)(fb_info.ul_y + 256*h);
+ float lr_x = (ul_x + (float)(cur_width)) * rdp.scale_x;
+ float lr_y = (ul_y + (float)(cur_height)) * rdp.scale_y;
+ ul_x *= rdp.scale_x;
+ ul_y *= rdp.scale_y;
+ ul_x += rdp.offset_x;
+ ul_y += rdp.offset_y;
+ lr_x += rdp.offset_x;
+ lr_y += rdp.offset_y;
+
+ float lr_u = (float)(cur_width-1);
+ float lr_v = (float)(cur_height-1);
+ // Make the vertices
+ VERTEX v[4] = {
+ { ul_x, ul_y, 1, 1, 0.5f, 0.5f, 0.5f, 0.5f, {0.5f, 0.5f, 0.5f, 0.5f} },
+ { lr_x, ul_y, 1, 1, lr_u, 0.5f, lr_u, 0.5f, {lr_u, 0.5f, lr_u, 0.5f} },
+ { ul_x, lr_y, 1, 1, 0.5f, lr_v, 0.5f, lr_v, {0.5f, lr_v, 0.5f, lr_v} },
+ { lr_x, lr_y, 1, 1, lr_u, lr_v, lr_u, lr_v, {lr_u, lr_v, lr_u, lr_v} }
+ };
+ grDrawTriangle (&v[0], &v[2], &v[1]);
+ grDrawTriangle (&v[2], &v[3], &v[1]);
+ }
+ }
+}
+
+bool DrawFrameBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
+{
+ if (fb_info.width < 200 || fb_info.size < 2)
+ return false;
+ wxUint32 width = fb_info.lr_x - fb_info.ul_x + 1;
+ wxUint32 height = fb_info.lr_y - fb_info.ul_y + 1;
+ wxUint32 max_size = min(voodoo.max_tex_size, 512);
+ if (width > (wxUint32)max_size || height > (wxUint32)max_size)
+ {
+ DrawFrameBufferToScreen256(fb_info);
+ return true;
+ }
+ FRDP("DrawFrameBufferToScreen. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx\n", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
+ GrTexInfo t_info;
+ wxUint8 * image = gfx.RDRAM+fb_info.addr;
+ wxUint32 texwidth;
+ float scale;
+ if (width <= 256)
+ {
+ texwidth = 256;
+ scale = 1.0f;
+ t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_256;
+ }
+ else
+ {
+ texwidth = 512;
+ scale = 0.5f;
+ t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_512;
+ }
+
+ if (height <= (texwidth>>1))
+ {
+ t_info.aspectRatioLog2 = GR_ASPECT_LOG2_2x1;
+ }
+ else
+ {
+ t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
+ }
+
+ if (fb_info.size == 2)
+ {
+ wxUint16 * tex = (wxUint16*)texture_buffer;
+ wxUint16 * dst = tex;
+ wxUint16 * src = (wxUint16*)image;
+ src += fb_info.ul_x + fb_info.ul_y * fb_info.width;
+ wxUint16 c;
+ wxUint32 idx;
+ const wxUint32 bound = (BMASK+1-fb_info.addr) >> 1;
+ bool empty = true;
+ for (wxUint32 y=0; y < height; y++)
+ {
+ for (wxUint32 x=0; x < width; x++)
+ {
+ idx = (x+y*fb_info.width)^1;
+ if (idx >= bound)
+ break;
+ c = src[idx];
+ if (c) empty = false;
+ *(dst++) = (c >> 1) | ((c&1)<<15);
+ }
+ dst += texwidth-width;
+ }
+ if (empty)
+ return false;
+ t_info.format = GR_TEXFMT_ARGB_1555;
+ t_info.data = tex;
+ }
+ else
+ {
+ wxUint32 * tex = (wxUint32*)texture_buffer;
+ wxUint32 * dst = tex;
+ wxUint32 * src = (wxUint32*)image;
+ src += fb_info.ul_x + fb_info.ul_y * fb_info.width;
+ wxUint32 col;
+ wxUint32 idx;
+ const wxUint32 bound = (BMASK+1-fb_info.addr) >> 2;
+ for (wxUint32 y=0; y < height; y++)
+ {
+ for (wxUint32 x=0; x < width; x++)
+ {
+ idx = x+y*fb_info.width;
+ if (idx >= bound)
+ break;
+ col = src[idx];
+ *(dst++) = (col >> 8) | 0xFF000000;
+ }
+ dst += texwidth-width;
+ }
+ t_info.format = GR_TEXFMT_ARGB_8888;
+ t_info.data = tex;
+ }
+
+ int tmu = SetupFBtoScreenCombiner(grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info), fb_info.opaque);
+ grTexDownloadMipMap (tmu,
+ voodoo.tex_min_addr[tmu]+voodoo.tmem_ptr[tmu],
+ GR_MIPMAPLEVELMASK_BOTH,
+ &t_info);
+ grTexSource (tmu,
+ voodoo.tex_min_addr[tmu]+voodoo.tmem_ptr[tmu],
+ GR_MIPMAPLEVELMASK_BOTH,
+ &t_info);
+ if (settings.hacks&hack_RE2)
+ {
+ DrawRE2Video(fb_info, scale);
+ }
+ else
+ {
+ float ul_x = fb_info.ul_x * rdp.scale_x + rdp.offset_x;
+ float ul_y = fb_info.ul_y * rdp.scale_y + rdp.offset_y;
+ float lr_x = fb_info.lr_x * rdp.scale_x + rdp.offset_x;
+ float lr_y = fb_info.lr_y * rdp.scale_y + rdp.offset_y;
+ float lr_u = (width-1)*scale;
+ float lr_v = (height-1)*scale;
+ // Make the vertices
+ VERTEX v[4] = {
+ { ul_x, ul_y, 1, 1, 0.5f, 0.5f, 0.5f, 0.5f, {0.5f, 0.5f, 0.5f, 0.5f} },
+ { lr_x, ul_y, 1, 1, lr_u, 0.5f, lr_u, 0.5f, {lr_u, 0.5f, lr_u, 0.5f} },
+ { ul_x, lr_y, 1, 1, 0.5f, lr_v, 0.5f, lr_v, {0.5f, lr_v, 0.5f, lr_v} },
+ { lr_x, lr_y, 1, 1, lr_u, lr_v, lr_u, lr_v, {lr_u, lr_v, lr_u, lr_v} }
+ };
+ grDrawTriangle (&v[0], &v[2], &v[1]);
+ grDrawTriangle (&v[2], &v[3], &v[1]);
+ }
+ return true;
+}
+
+static void DrawDepthBufferToScreen256(FB_TO_SCREEN_INFO & fb_info)
+{
+ FRDP("DrawDepthBufferToScreen256. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx\n", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
+ wxUint32 width = fb_info.lr_x - fb_info.ul_x + 1;
+ wxUint32 height = fb_info.lr_y - fb_info.ul_y + 1;
+ GrTexInfo t_info;
+ wxUint8 * image = gfx.RDRAM+fb_info.addr;
+ wxUint32 width256 = ((width-1) >> 8) + 1;
+ wxUint32 height256 = ((height-1) >> 8) + 1;
+ t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_256;
+ t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
+ t_info.format = GR_TEXFMT_ALPHA_INTENSITY_88;
+ wxUint16 * tex = (wxUint16*)texture_buffer;
+ t_info.data = tex;
+ wxUint32 tex_size = grTexTextureMemRequired (GR_MIPMAPLEVELMASK_BOTH, &t_info);
+ int tmu = SetupFBtoScreenCombiner(tex_size*width256*height256, fb_info.opaque);
+ grConstantColorValue (rdp.fog_color);
+ grColorCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_CONSTANT,
+ FXFALSE);
+ wxUint16 * src = (wxUint16*)image;
+ src += fb_info.ul_x + fb_info.ul_y * fb_info.width;
+ wxUint32 w_tail = width%256;
+ wxUint32 h_tail = height%256;
+ wxUint32 cur_width, cur_height, cur_tail;
+ wxUint32 tex_adr = voodoo.tex_min_addr[tmu]+voodoo.tmem_ptr[tmu];
+ if ((voodoo.tmem_ptr[tmu] < TEXMEM_2MB_EDGE) && (voodoo.tmem_ptr[tmu]+tex_size*width256*height256 > TEXMEM_2MB_EDGE))
+ {
+ tex_adr = TEXMEM_2MB_EDGE;
+ }
+ for (wxUint32 h = 0; h < height256; h++)
+ {
+ for (wxUint32 w = 0; w < width256; w++)
+ {
+ cur_width = (256*(w+1) < width) ? 256 : w_tail;
+ cur_height = (256*(h+1) < height) ? 256 : h_tail;
+ cur_tail = 256 - cur_width;
+ wxUint16 * dst = tex;
+ for (wxUint32 y=0; y < cur_height; y++)
+ {
+ for (wxUint32 x=0; x < cur_width; x++)
+ {
+ *(dst++) = rdp.pal_8[src[(x+256*w+(y+256*h)*fb_info.width)^1]>>8];
+ }
+ dst += cur_tail;
+ }
+ grTexDownloadMipMap (tmu, tex_adr, GR_MIPMAPLEVELMASK_BOTH, &t_info);
+ grTexSource (tmu, tex_adr, GR_MIPMAPLEVELMASK_BOTH, &t_info);
+ tex_adr += tex_size;
+ float ul_x = (float)(fb_info.ul_x + 256*w);
+ float ul_y = (float)(fb_info.ul_y + 256*h);
+ float lr_x = (ul_x + (float)(cur_width)) * rdp.scale_x + rdp.offset_x;
+ float lr_y = (ul_y + (float)(cur_height)) * rdp.scale_y + rdp.offset_y;
+ ul_x = ul_x * rdp.scale_x + rdp.offset_x;
+ ul_y = ul_y * rdp.scale_y + rdp.offset_y;
+ float lr_u = (float)(cur_width-1);
+ float lr_v = (float)(cur_height-1);
+ // Make the vertices
+ VERTEX v[4] = {
+ { ul_x, ul_y, 1, 1, 0.5f, 0.5f, 0.5f, 0.5f, {0.5f, 0.5f, 0.5f, 0.5f} },
+ { lr_x, ul_y, 1, 1, lr_u, 0.5f, lr_u, 0.5f, {lr_u, 0.5f, lr_u, 0.5f} },
+ { ul_x, lr_y, 1, 1, 0.5f, lr_v, 0.5f, lr_v, {0.5f, lr_v, 0.5f, lr_v} },
+ { lr_x, lr_y, 1, 1, lr_u, lr_v, lr_u, lr_v, {lr_u, lr_v, lr_u, lr_v} }
+ };
+ grDrawTriangle (&v[0], &v[2], &v[1]);
+ grDrawTriangle (&v[2], &v[3], &v[1]);
+ }
+ }
+}
+
+static void DrawHiresDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
+{
+ FRDP("DrawHiresDepthBufferToScreen. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx\n", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
+ GrTexInfo t_info;
+ float scale = 0.25f;
+ GrLOD_t LOD = GR_LOD_LOG2_1024;
+ if (settings.scr_res_x > 1024)
+ {
+ scale = 0.125f;
+ LOD = GR_LOD_LOG2_2048;
+ }
+ t_info.format = GR_TEXFMT_ALPHA_INTENSITY_88;
+ t_info.smallLodLog2 = t_info.largeLodLog2 = LOD;
+ t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
+ grConstantColorValue (rdp.fog_color);
+ grColorCombine (GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_LOCAL_CONSTANT,
+ GR_COMBINE_OTHER_NONE,
+ FXFALSE);
+ grAlphaCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_TEXTURE,
+ FXFALSE);
+ grAlphaBlendFunction( GR_BLEND_SRC_ALPHA,
+ GR_BLEND_ONE_MINUS_SRC_ALPHA,
+ GR_BLEND_ONE,
+ GR_BLEND_ZERO);
+ grDepthBufferFunction (GR_CMP_ALWAYS);
+ grDepthMask (FXFALSE);
+ grCullMode (GR_CULL_DISABLE);
+ grTexCombine( GR_TMU1,
+ GR_COMBINE_FUNCTION_NONE,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_NONE,
+ GR_COMBINE_FACTOR_NONE,
+ FXFALSE,
+ FXFALSE );
+ grTexCombine( GR_TMU0,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ GR_COMBINE_FUNCTION_LOCAL,
+ GR_COMBINE_FACTOR_NONE,
+ FXFALSE,
+ FXFALSE);
+// grAuxBufferExt( GR_BUFFER_AUXBUFFER );
+ grTexSource( rdp.texbufs[0].tmu, rdp.texbufs[0].begin, GR_MIPMAPLEVELMASK_BOTH, &(t_info) );
+ float ul_x = (float)rdp.scissor.ul_x;
+ float ul_y = (float)rdp.scissor.ul_y;
+ float lr_x = (float)rdp.scissor.lr_x;
+ float lr_y = (float)rdp.scissor.lr_y;
+ float ul_u = (float)rdp.scissor.ul_x * scale;
+ float ul_v = (float)rdp.scissor.ul_y * scale;
+ float lr_u = (float)rdp.scissor.lr_x * scale;
+ float lr_v = (float)rdp.scissor.lr_y * scale;
+ // Make the vertices
+ VERTEX v[4] = {
+ { ul_x, ul_y, 1, 1, ul_u, ul_v, ul_u, ul_v, {ul_u, ul_v, ul_u, ul_v} },
+ { lr_x, ul_y, 1, 1, lr_u, ul_v, lr_u, ul_v, {lr_u, ul_v, lr_u, ul_v} },
+ { ul_x, lr_y, 1, 1, ul_u, lr_v, ul_u, lr_v, {ul_u, lr_v, ul_u, lr_v} },
+ { lr_x, lr_y, 1, 1, lr_u, lr_v, lr_u, lr_v, {lr_u, lr_v, lr_u, lr_v} }
+ };
+ grDrawTriangle (&v[0], &v[2], &v[1]);
+ grDrawTriangle (&v[2], &v[3], &v[1]);
+// grAuxBufferExt( GR_BUFFER_TEXTUREAUXBUFFER_EXT );
+ rdp.update |= UPDATE_COMBINE | UPDATE_ZBUF_ENABLED | UPDATE_CULL_MODE;
+}
+
+void DrawDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info)
+{
+ wxUint32 width = fb_info.lr_x - fb_info.ul_x + 1;
+ wxUint32 height = fb_info.lr_y - fb_info.ul_y + 1;
+ if (width > (wxUint32)voodoo.max_tex_size || height > (wxUint32)voodoo.max_tex_size || width > 512)
+ {
+ DrawDepthBufferToScreen256(fb_info);
+ return;
+ }
+ if (fb_hwfbe_enabled && !evoodoo)
+ {
+ DrawHiresDepthBufferToScreen(fb_info);
+ return;
+ }
+ FRDP("DrawDepthBufferToScreen. ul_x=%d, ul_y=%d, lr_x=%d, lr_y=%d, size=%d, addr=%08lx\n", fb_info.ul_x, fb_info.ul_y, fb_info.lr_x, fb_info.lr_y, fb_info.size, fb_info.addr);
+ GrTexInfo t_info;
+ wxUint8 * image = gfx.RDRAM+fb_info.addr;
+ wxUint32 texwidth;
+ float scale;
+ if (width <= 256)
+ {
+ texwidth = 256;
+ scale = 1.0f;
+ t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_256;
+ }
+ else
+ {
+ texwidth = 512;
+ scale = 0.5f;
+ t_info.smallLodLog2 = t_info.largeLodLog2 = GR_LOD_LOG2_512;
+ }
+
+ if (height <= (texwidth>>1))
+ {
+ t_info.aspectRatioLog2 = GR_ASPECT_LOG2_2x1;
+ }
+ else
+ {
+ t_info.aspectRatioLog2 = GR_ASPECT_LOG2_1x1;
+ }
+
+ wxUint16 * tex = (wxUint16*)texture_buffer;
+ wxUint16 * dst = tex;
+ wxUint16 * src = (wxUint16*)image;
+ src += fb_info.ul_x + fb_info.ul_y * fb_info.width;
+ for (wxUint32 y=0; y < height; y++)
+ {
+ for (wxUint32 x=0; x < width; x++)
+ {
+ *(dst++) = rdp.pal_8[src[(x+y*fb_info.width)^1]>>8];
+ }
+ dst += texwidth-width;
+ }
+ t_info.format = GR_TEXFMT_ALPHA_INTENSITY_88;
+ t_info.data = tex;
+
+ int tmu = SetupFBtoScreenCombiner(grTexTextureMemRequired(GR_MIPMAPLEVELMASK_BOTH, &t_info), fb_info.opaque);
+ grConstantColorValue (rdp.fog_color);
+ grColorCombine (GR_COMBINE_FUNCTION_SCALE_OTHER,
+ GR_COMBINE_FACTOR_ONE,
+ GR_COMBINE_LOCAL_NONE,
+ GR_COMBINE_OTHER_CONSTANT,
+ FXFALSE);
+ grTexDownloadMipMap (tmu,
+ voodoo.tex_min_addr[tmu]+voodoo.tmem_ptr[tmu],
+ GR_MIPMAPLEVELMASK_BOTH,
+ &t_info);
+ grTexSource (tmu,
+ voodoo.tex_min_addr[tmu]+voodoo.tmem_ptr[tmu],
+ GR_MIPMAPLEVELMASK_BOTH,
+ &t_info);
+ float ul_x = fb_info.ul_x * rdp.scale_x + rdp.offset_x;
+ float ul_y = fb_info.ul_y * rdp.scale_y + rdp.offset_y;
+ float lr_x = fb_info.lr_x * rdp.scale_x + rdp.offset_x;
+ float lr_y = fb_info.lr_y * rdp.scale_y + rdp.offset_y;
+ float lr_u = (width-1)*scale;
+ float lr_v = (height-1)*scale;
+ float zero = scale*0.5f;
+ // Make the vertices
+ VERTEX v[4] = {
+ { ul_x, ul_y, 1, 1, zero, zero, zero, zero, {zero, zero, zero, zero} },
+ { lr_x, ul_y, 1, 1, lr_u, zero, lr_u, zero, {lr_u, zero, lr_u, zero} },
+ { ul_x, lr_y, 1, 1, zero, lr_v, zero, lr_v, {zero, lr_v, zero, lr_v} },
+ { lr_x, lr_y, 1, 1, lr_u, lr_v, lr_u, lr_v, {lr_u, lr_v, lr_u, lr_v} }
+ };
+ grDrawTriangle (&v[0], &v[2], &v[1]);
+ grDrawTriangle (&v[2], &v[3], &v[1]);
+}
diff --git a/source/gles2glide64/src/Glide64/FBtoScreen.h b/source/gles2glide64/src/Glide64/FBtoScreen.h
new file mode 100644
index 0000000..e4180b4
--- /dev/null
+++ b/source/gles2glide64/src/Glide64/FBtoScreen.h
@@ -0,0 +1,63 @@
+/*
+* Glide64 - Glide video plugin for Nintendo 64 emulators.
+* Copyright (c) 2002 Dave2001
+* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
+*
+* 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
+* 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
+*/
+
+//****************************************************************
+//
+// Glide64 - Glide Plugin for Nintendo 64 emulators
+// Project started on December 29th, 2001
+//
+// Authors:
+// Dave2001, original author, founded the project in 2001, left it in 2002
+// Gugaman, joined the project in 2002, left it in 2002
+// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
+// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
+//
+//****************************************************************
+//
+// To modify Glide64:
+// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
+// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
+//
+//****************************************************************
+//
+// Render N64 frame buffer to screen
+// Created by Gonetz, 2007
+//
+//****************************************************************
+#ifndef FBtoSCREEN_H
+#define FBtoSCREEN_H
+
+typedef struct
+{
+ wxUint32 addr; //color image address
+ wxUint32 size;
+ wxUint32 width;
+ wxUint32 height;
+ wxUint32 ul_x;
+ wxUint32 ul_y;
+ wxUint32 lr_x;
+ wxUint32 lr_y;
+ wxUint32 opaque;
+} FB_TO_SCREEN_INFO;
+
+bool DrawFrameBufferToScreen(FB_TO_SCREEN_INFO & fb_info);
+void DrawDepthBufferToScreen(FB_TO_SCREEN_INFO & fb_info);
+
+#endif // #ifndef FBtoSCREEN_H
diff --git a/source/gles2glide64/src/Glide64/FrameSkipper.cpp b/source/gles2glide64/src/Glide64/FrameSkipper.cpp
new file mode 100755
index 0000000..7bd81e9
--- /dev/null
+++ b/source/gles2glide64/src/Glide64/FrameSkipper.cpp
@@ -0,0 +1,142 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2011 yongzh (freeman.yong@gmail.com) *
+ * *
+ * 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 "FrameSkipper.h"
+#include "ticks.h"
+#include
+
+FrameSkipper::FrameSkipper()
+ : skipType(AUTO), maxSkips(2), targetFPS(60)
+{
+}
+
+void FrameSkipper::start()
+{
+ initialTicks = 0;
+ virtualCount = 0;
+ skipCounter = 0;
+ oldSkip = 0;
+}
+#if 0
+bool FrameSkipper::hasSkipped()
+{
+ oldSkip = skipCounter;
+
+ if (skipType == MANUAL) {
+ if (++skipCounter > maxSkips)
+ skipCounter = 0;
+//printf("frameskipper(Manual): oldSkip=%i, skipCounter=%i, countVI=%i\n", oldSkip, skipCounter, countVI);
+ countVI = 0;
+ return (oldSkip>0);
+ }
+
+ unsigned int elapsed = ticksGetTicks()/* - initialTicks*/;
+ int realCount = (elapsed-initialTicks - 4) * targetFPS; // 4ms tolerance
+ if ((realCount > countVI*1000) && (skipCounter < maxSkips) && (countVI<10)) {
+ skipCounter++;
+//printf("Skip frame elapsed=%u realCount=%u countVI=%u skipCounter=%i\n", elapsed-initialTicks, realCount, countVI, skipCounter);
+ } else {
+//printf(" Ok frame elapsed=%u realCount=%u countVI=%u skipCounter=%i\n", elapsed-initialTicks, realCount, countVI, skipCounter);
+ skipCounter = 0;
+ initialTicks=elapsed;
+ virtualCount=0;
+ countVI=0;
+ }
+//printf("frameskipper(Auto): oldSkip=%i, skipCounter=%i, countVI=%i, realCount=%u\n", oldSkip, skipCounter, countVI, realCount);
+ return (oldSkip>0);
+}
+#else
+void FrameSkipper::newFrame()
+{
+ oldSkip = skipCounter;
+
+ if (skipType == MANUAL) {
+ if (++skipCounter > maxSkips)
+ skipCounter = 0;
+//printf("frameskipper(Manual): oldSkip=%i, skipCounter=%i, countVI=%i\n", oldSkip, skipCounter, countVI);
+ countVI = 0;
+ return;
+ }
+
+ unsigned int elapsed = ticksGetTicks()/* - initialTicks*/;
+ int realCount = (elapsed-initialTicks - 4) * targetFPS; // 4ms tolerance
+ if ((realCount > countVI*1000) && (skipCounter < maxSkips) && (countVI<10)) {
+ skipCounter++;
+//printf("Skip frame elapsed=%u realCount=%u countVI=%u skipCounter=%i\n", elapsed-initialTicks, realCount, countVI, skipCounter);
+ } else {
+//printf(" Ok frame elapsed=%u realCount=%u countVI=%u skipCounter=%i\n", elapsed-initialTicks, realCount, countVI, skipCounter);
+ skipCounter = 0;
+ initialTicks=elapsed;
+ virtualCount=0;
+ countVI=0;
+ }
+//printf("frameskipper(Auto): oldSkip=%i, skipCounter=%i, countVI=%i, realCount=%u\n", oldSkip, skipCounter, countVI, realCount);
+ return;
+}
+#endif
+
+void FrameSkipper::update()
+{
+#if 1
+ if (initialTicks == 0) {
+ initialTicks = ticksGetTicks();
+ }
+ countVI++;
+
+ if (countVI>20) {
+ skipCounter=0; // failsafe...
+ }
+#else
+ // for the first frame
+ if (initialTicks == 0) {
+ initialTicks = ticksGetTicks();
+ return;
+ }
+
+ oldSkip=skipCounter;
+
+ if (skipType == MANUAL) {
+ if (++skipCounter > maxSkips)
+ skipCounter = 0;
+ return;
+ }
+
+ unsigned int elapsed = ticksGetTicks()/* - initialTicks*/;
+ unsigned int realCount = (elapsed-initialTicks) * targetFPS;
+
+ virtualCount+=1000;
+// if (realCount >= virtualCount) {
+ if (realCount > virtualCount+100 &&
+ /*skipType == AUTO &&*/ skipCounter < maxSkips) {
+ skipCounter++;
+//printf("Skip frame elapsed=%u initialTicks=%u realCount=%u virtualCound=%u skipCounter=%i\n", elapsed, initialTicks, realCount, virtualCount, skipCounter);
+ } else {
+// virtualCount = realCount;
+// if (skipType == AUTO)
+ skipCounter = 0;
+ initialTicks=elapsed;
+ virtualCount=0;
+ }
+/* } else {
+ skipCounter = 0;
+ initialTicks=elapsed;
+ virtualCount=0;
+ }*/
+#endif
+}
diff --git a/source/gles2glide64/src/Glide64/FrameSkipper.h b/source/gles2glide64/src/Glide64/FrameSkipper.h
new file mode 100755
index 0000000..2ae0dab
--- /dev/null
+++ b/source/gles2glide64/src/Glide64/FrameSkipper.h
@@ -0,0 +1,64 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright (C) 2011 yongzh (freeman.yong@gmail.com) *
+ * *
+ * 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 FRAME_SKIPPER_H
+#define FRAME_SKIPPER_H
+
+class FrameSkipper {
+public:
+ enum { AUTO, MANUAL };
+
+ FrameSkipper();
+
+ void setSkips(int type, int max) {
+ skipType = type;
+ maxSkips = max;
+ }
+
+ void setTargetFPS(int fps) {
+ targetFPS = fps;
+ }
+ bool willSkipNext() {
+ return (skipCounter > 0);
+ }
+
+#if 0
+ bool hasSkipped();
+#else
+ bool hasSkipped() {
+ return (oldSkip > 0);
+ }
+ void newFrame();
+#endif
+ void start();
+ void update();
+
+private:
+ int skipType;
+ int oldSkip;
+ int maxSkips;
+ int targetFPS;
+ int skipCounter;
+ int countVI;
+ unsigned int initialTicks;
+ unsigned int virtualCount;
+};
+
+#endif
+
diff --git a/source/gles2glide64/src/Glide64/Gfx_1.3.h b/source/gles2glide64/src/Glide64/Gfx_1.3.h
new file mode 100755
index 0000000..a0216dd
--- /dev/null
+++ b/source/gles2glide64/src/Glide64/Gfx_1.3.h
@@ -0,0 +1,682 @@
+/*
+* Glide64 - Glide video plugin for Nintendo 64 emulators.
+* Copyright (c) 2002 Dave2001
+* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
+*
+* 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
+* 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
+*/
+
+//****************************************************************
+//
+// Glide64 - Glide Plugin for Nintendo 64 emulators
+// Project started on December 29th, 2001
+//
+// Authors:
+// Dave2001, original author, founded the project in 2001, left it in 2002
+// Gugaman, joined the project in 2002, left it in 2002
+// Sergey 'Gonetz' Lipski, joined the project in 2002, main author since fall of 2002
+// Hiroshi 'KoolSmoky' Morii, joined the project in 2007
+//
+//****************************************************************
+//
+// To modify Glide64:
+// * Write your name and (optional)email, commented by your work, so I know who did it, and so that you can find which parts you modified when it comes time to send it to me.
+// * Do NOT send me the whole project or file that you modified. Take out your modified code sections, and tell me where to put them. If people sent the whole thing, I would have many different versions, but no idea how to combine them all.
+//
+//****************************************************************
+
+/**********************************************************************************
+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
+
+**********************************************************************************/
+
+// THIS FILE IS A PRECOMPILED HEADER TO DECREASE BUILD TIME. INCLUDE ALL STANDARD
+// .H FILES HERE
+
+#ifndef _GFX_H_INCLUDED__
+#define _GFX_H_INCLUDED__
+
+#include "winlnxdefs.h"
+#include "m64p.h"
+
+#include
+#include
+#include
+#include
+#include // offsetof
+#include
+#include
+#include
+#include "GlideExtensions.h"
+#include "rdp.h"
+#include "Keys.h"
+
+#include
+#include
+
+#if defined __VISUALC__
+#define GLIDE64_TRY __try
+#define GLIDE64_CATCH __except (EXCEPTION_EXECUTE_HANDLER)
+#else
+#define GLIDE64_TRY try
+#define GLIDE64_CATCH catch (...)
+#endif
+
+#ifndef WIN32
+typedef int HWND;
+#endif
+
+
+#if defined(__cplusplus)
+extern "C" {
+#endif
+
+#define _ENDUSER_RELEASE_
+
+//********
+// Logging
+
+// ********************************
+// ** TAKE OUT BEFORE RELEASE!!! **
+//#define LOGGING // log of spec functions called
+//#define LOG_KEY // says "Key!!!" in the log when space bar is pressed
+//#define EXT_LOGGING
+//#define PERFORMANCE
+
+//#define LOG_UCODE
+
+//#define ALTTAB_FIX
+
+//#define EXTREME_LOGGING // lots of logging
+ // note that some of these things are inserted/removed
+ // from within the code & may not be changed by this define.
+
+//#define TLUT_LOGGING // log every entry of the TLUT?
+// ********************************
+
+#define FPS // fps counter able? (not enabled necessarily)
+
+//#define LOGNOTKEY // Log if not pressing:
+//#define LOGKEY 0x11 // this key (CONTROL)
+
+//#define LOG_COMMANDS // log the whole 64-bit command as (0x........, 0x........)
+
+#define CATCH_EXCEPTIONS // catch exceptions so it doesn't freeze and will report
+ // "The gfx plugin has caused an exception" instead.
+
+//#define FLUSH // flush the file buffer. slower logging, but makes sure
+ // the command is logged before continuing (in case of
+ // crash or exception, the log will not be cut short)
+#ifndef _ENDUSER_RELEASE_
+#define RDP_LOGGING // Allow logging (will not log unless checked, but allows the option)
+ // Logging functions will not be compiled if this is not present.
+//#define RDP_ERROR_LOG
+#endif
+
+#define FPS_FRAMES 10 // Number of frames in which to make an FPS count
+
+//#define SHOW_FULL_TEXVIEWER // shows the entire contents of the texture in the cache viewer,
+ // usually used to debug clamping issues.
+
+
+// Usually enabled
+//#define LARGE_TEXTURE_HANDLING // allow large-textured objects to be split?
+
+#ifdef ALTTAB_FIX
+extern HHOOK hhkLowLevelKybd;
+extern LRESULT CALLBACK LowLevelKeyboardProc(int nCode,
+ WPARAM wParam, LPARAM lParam);
+#endif
+
+// Simulations
+//#define SIMULATE_VOODOO1
+//#define SIMULATE_BANSHEE
+//********
+
+#ifdef EXT_LOGGING
+extern std::ofstream extlog;
+#define EXT(x) extlog.open("ext.txt",std::ios::app); extlog << x; extlog.close();
+#else
+#define EXT(x)
+#endif
+
+#ifndef _ENDUSER_RELEASE_
+#define UNIMP_LOG // Keep enabled, option in dialog
+#define BRIGHT_RED // Keep enabled, option in dialog
+#endif
+
+#define COLORED_DEBUGGER // ;) pretty colors
+
+#ifdef FPS
+extern LARGE_INTEGER fps_last;
+extern LARGE_INTEGER fps_next;
+extern float fps;
+extern wxUint32 fps_count;
+#endif
+
+// rdram mask at 0x400000 bytes (bah, not right for majora's mask)
+//#define BMASK 0x7FFFFF
+extern unsigned long BMASK;
+#define WMASK 0x3FFFFF
+#define DMASK 0x1FFFFF
+
+extern wxUint32 update_screen_count;
+extern wxUint32 resolutions[0x18][2];
+
+int CheckKeyPressed(int key, int mask);
+
+#ifdef PERFORMANCE
+extern int64 perf_cur;
+extern int64 perf_next;
+#endif
+
+//#ifdef LOGGING
+//extern std::ofstream loga;
+//#define LOG(X) loga.open("log.txt",std::ios::app); loga << (...); loga.flush(); loga.close();
+
+//#else
+ #ifndef OLD_API
+ #define LOG(...) WriteLog(M64MSG_INFO, __VA_ARGS__)
+ #define VLOG(...) WriteLog(M64MSG_VERBOSE, __VA_ARGS__)
+ #define WARNLOG(...) WriteLog(M64MSG_WARNING, __VA_ARGS__)
+ #define ERRLOG(...) WriteLog(M64MSG_ERROR, __VA_ARGS__)
+#else
+ #define LOG(...) printf(__VA_ARGS__)
+ #define VLOG(...)
+ #define WARNLOG(...) printf(__VA_ARGS__)
+ #define ERRLOG(X, ...) str.Printf(_T(X), __VA_ARGS__); wxMessageBox(str, _T("Error"), wxOK | wxICON_EXCLAMATION, GFXWindow)
+ #define ERRLOG(X) str.Printf(_T(X)); wxMessageBox(str, _T("Error"), wxOK | wxICON_EXCLAMATION, GFXWindow)
+#endif
+
+
+#ifdef RDP_LOGGING
+extern int log_open;
+extern std::ofstream rdp_log;
+#define OPEN_RDP_LOG() EXT("OPEN_RDP_LOG ()\n"); if (settings.logging && !log_open) { rdp_log.open ("rdp.txt"); log_open=TRUE; }
+#define CLOSE_RDP_LOG() EXT("CLOSE_RDP_LOG ()\n"); if (settings.logging && log_open) { rdp_log.close (); log_open=FALSE; }
+
+#ifdef LOGNOTKEY
+#define LRDP(x) EXT("RDP (...)\n"); if (settings.logging && log_open) { if (!CheckKeyPressed(LOGKEY,0x8000)) { rdp_log << x; rdp_log.flush(); } }
+#else
+#define LRDP(x) EXT("RDP (...)\n"); if (settings.logging && log_open) { rdp_log << x; rdp_log.flush(); }
+#endif
+
+#else
+#define OPEN_RDP_LOG()
+#define CLOSE_RDP_LOG()
+#define LRDP(x)
+#endif
+
+
+#ifdef RDP_ERROR_LOG
+extern int elog_open;
+extern std::ofstream rdp_err;
+#define OPEN_RDP_E_LOG() EXT("OPEN_RDP_E_LOG ()\n"); if (settings.elogging && !elog_open) { rdp_err.open ("rdp_e.txt"); elog_open=TRUE; }
+#define CLOSE_RDP_E_LOG() EXT("CLOSE_RDP_LOG ()\n"); if (settings.elogging && elog_open) { rdp_err.close (); elog_open=FALSE; }
+#define RDP_E(x) if (settings.elogging) { FRDP_E (x); }
+#else
+#define OPEN_RDP_E_LOG()
+#define CLOSE_RDP_E_LOG()
+#define RDP_E(x)
+#endif
+
+__inline void FRDP (const char *fmt, ...)
+{
+#ifdef RDP_LOGGING
+ if (!settings.logging || !log_open) return;
+
+#ifdef LOGNOTKEY
+ if (CheckKeyPressed(LOGKEY,0x8000)) return;
+#endif
+
+ va_list ap;
+ va_start(ap, fmt);
+ vsprintf(out_buf, fmt, ap);
+ LRDP (out_buf);
+ va_end(ap);
+#endif
+}
+__inline void FRDP_E (const char *fmt, ...)
+{
+#ifdef RDP_ERROR_LOG
+ if (!settings.elogging || !elog_open) return;
+
+#ifdef LOGNOTKEY
+ if (CheckKeyPressed(LOGKEY,0x8000)) return;
+#endif
+
+ sprintf (out_buf, "%08lx: (%08lx, %08lx) ", rdp.pc[rdp.pc_i]-8, rdp.cmd0, rdp.cmd1);
+ rdp_err << out_buf;
+
+ va_list ap2;
+ va_start(ap2, fmt);
+ vsprintf(out_buf, fmt, ap2);
+ rdp_err << out_buf;
+ rdp_err.flush();
+ va_end(ap2);
+#endif
+}
+
+extern int fullscreen;
+extern int romopen;
+extern int to_fullscreen;
+extern int debugging;
+
+extern int evoodoo;
+extern int ev_fullscreen;
+
+extern SDL_sem *mutexProcessDList;
+extern int exception;
+
+// extern wxMutex *mutexProcessDList;
+
+int InitGfx (int);
+void ReleaseGfx ();
+
+// The highest 8 bits are the segment # (1-16), and the lower 24 bits are the offset to
+// add to it.
+__inline wxUint32 segoffset (wxUint32 so)
+{
+ return (rdp.segment[(so>>24)&0x0f] + (so&BMASK))&BMASK;
+}
+
+/* Plugin types */
+#define PLUGIN_TYPE_GFX 2
+
+// this is already defined in API
+/*
+#ifdef __WINDOWS__
+#define EXPORT __declspec(dllexport)
+#define CALL _cdecl
+#else
+#define EXPORT extern
+#define CALL
+#endif
+*/
+/***** Structures *****/
+typedef struct {
+ wxUint16 Version; /* Set to 0x0103 */
+ wxUint16 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 */
+ int NormalMemory; /* a normal wxUint8 array */
+ int MemoryBswaped; /* a normal wxUint8 array where the memory has been pre
+ bswap on a dword (32 bits) boundry */
+} PLUGIN_INFO;
+
+/*
+typedef struct {
+//
+} GFX_INFO;
+*/
+extern GFX_INFO gfx;
+// extern wxWindow * GFXWindow;
+extern bool no_dlist;
+
+typedef GrContext_t (FX_CALL *GRWINOPENEXT)( FxU32 hWnd,
+ GrScreenResolution_t resolution,
+ GrScreenRefresh_t refresh,
+ GrColorFormat_t format,
+ GrOriginLocation_t origin,
+ GrPixelFormat_t pixelformat,
+ int nColBuffers,
+ int nAuxBuffers) ;
+
+typedef void (FX_CALL *GRTEXBUFFEREXT)( GrChipID_t tmu,
+ FxU32 startAddress,
+ GrLOD_t lodmin,
+ GrLOD_t lodmax,
+ GrAspectRatio_t aspect,
+ GrTextureFormat_t fmt,
+ FxU32 evenOdd) ;
+
+typedef void (FX_CALL *GRAUXBUFFEREXT)( GrBuffer_t buffer ) ;
+
+typedef void (FX_CALL *GRCOLORCOMBINEEXT) (GrCCUColor_t a,
+ GrCombineMode_t a_mode,
+ GrCCUColor_t b,
+ GrCombineMode_t b_mode,
+ GrCCUColor_t c,
+ FxBool c_invert,
+ GrCCUColor_t d,
+ FxBool d_invert,
+ FxU32 shift,
+ FxBool invert) ;
+
+typedef void (FX_CALL *GRTEXCOLORCOMBINEEXT) (GrChipID_t tmu,
+ GrTCCUColor_t a,
+ GrCombineMode_t a_mode,
+ GrTCCUColor_t b,
+ GrCombineMode_t b_mode,
+ GrTCCUColor_t c,
+ FxBool c_invert,
+ GrTCCUColor_t d,
+ FxBool d_invert,
+ FxU32 shift,
+ FxBool invert);
+
+typedef void (FX_CALL *GRCONSTANTCOLORVALUEEXT)
+ (GrChipID_t tmu,
+ GrColor_t value);
+
+typedef void (FX_CALL *GRSTIPPLE)( FxI32 mode) ;
+
+typedef void (FX_CALL *GRCONFIGWRAPPEREXT)(FxI32, FxI32, FxBool, FxBool);
+
+typedef GrScreenResolution_t (FX_CALL *GRWRAPPERFULLSCREENRESOLUTIONEXT)(wxUint32*, wxUint32*);
+
+typedef char ** (FX_CALL *GRQUERYRESOLUTIONSEXT)(FxI32*);
+
+typedef int (*GETTEXADDR)(int tmu, int texsize);
+
+extern GRTEXBUFFEREXT grTextureBufferExt;
+extern GRTEXBUFFEREXT grTextureAuxBufferExt;
+extern GRAUXBUFFEREXT grAuxBufferExt;
+extern GRSTIPPLE grStippleModeExt;
+extern GRSTIPPLE grStipplePatternExt;
+extern GETTEXADDR GetTexAddr;
+
+#ifndef GR_STIPPLE_DISABLE
+#define GR_STIPPLE_DISABLE 0x0
+#define GR_STIPPLE_PATTERN 0x1
+#define GR_STIPPLE_ROTATE 0x2
+#endif
+
+void ReadSettings ();
+void ReadSpecialSettings (const char * name);
+void WriteSettings (bool saveEmulationSettings = false);
+
+#if 0
+//TODO: remove
+/******************************************************************
+ 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, int *width, int *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 int 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 = wxUint8, 2 = wxUint16, 4 = wxUint32
+ output: none
+*******************************************************************/
+EXPORT void CALL FBWrite(wxUint32, wxUint32);
+
+typedef struct
+{
+ wxUint32 addr;
+ wxUint32 val;
+ wxUint32 size; // 1 = wxUint8, 2 = wxUint16, 4=wxUint32
+} 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, wxUint32 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 = wxUint8, 2 = wxUint16, 4 = wxUint32
+ output: none
+*******************************************************************/
+EXPORT void CALL FBRead(wxUint32 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);
+
+/******************************************************************
+ NOTE: THIS HAS BEEN ADDED FOR MUPEN64PLUS AND IS NOT PART OF THE
+ ORIGINAL SPEC
+ Function: SetConfigDir
+ Purpose: To pass the location where config files should be read/
+ written to.
+ input: path to config directory
+ output: none
+*******************************************************************/
+EXPORT void CALL SetConfigDir(char *configDir);
+#endif
+
+#if defined(__cplusplus)
+}
+#endif
+#endif //_GFX_H_INCLUDED__
diff --git a/source/gles2glide64/src/Glide64/GlideExtensions.h b/source/gles2glide64/src/Glide64/GlideExtensions.h
new file mode 100644
index 0000000..52e026e
--- /dev/null
+++ b/source/gles2glide64/src/Glide64/GlideExtensions.h
@@ -0,0 +1,65 @@
+/*
+* Glide64 - Glide video plugin for Nintendo 64 emulators.
+* Copyright (c) 2002 Dave2001
+* Copyright (c) 2003-2009 Sergey 'Gonetz' Lipski
+*
+* 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
+* 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
+*/
+
+#define GR_BUFFER_TEXTUREBUFFER_EXT 0x6
+#define GR_BUFFER_TEXTUREAUXBUFFER_EXT 0x7
+
+typedef FxU32 GrPixelFormat_t;
+#define GR_PIXFMT_RGB_565 0x03
+#define GR_PIXFMT_ARGB_1555 0x0004
+#define GR_PIXFMT_ARGB_8888 0x0005
+
+typedef FxU32 GrCCUColor_t;
+typedef FxU32 GrACUColor_t;
+typedef FxU32 GrTCCUColor_t;
+typedef FxU32 GrTACUColor_t;
+#define GR_CMBX_ZERO 0x00
+#define GR_CMBX_TEXTURE_ALPHA 0x01
+#define GR_CMBX_ALOCAL 0x02
+#define GR_CMBX_AOTHER 0x03
+#define GR_CMBX_B 0x04
+#define GR_CMBX_CONSTANT_ALPHA 0x05
+#define GR_CMBX_CONSTANT_COLOR 0x06
+#define GR_CMBX_DETAIL_FACTOR 0x07
+#define GR_CMBX_ITALPHA 0x08
+#define GR_CMBX_ITRGB 0x09
+#define GR_CMBX_LOCAL_TEXTURE_ALPHA 0x0a
+#define GR_CMBX_LOCAL_TEXTURE_RGB 0x0b
+#define GR_CMBX_LOD_FRAC 0x0c
+#define GR_CMBX_OTHER_TEXTURE_ALPHA 0x0d
+#define GR_CMBX_OTHER_TEXTURE_RGB 0x0e
+#define GR_CMBX_TEXTURE_RGB 0x0f
+#define GR_CMBX_TMU_CALPHA 0x10
+#define GR_CMBX_TMU_CCOLOR 0x11
+
+typedef FxU32 GrCombineMode_t;
+#define GR_FUNC_MODE_ZERO 0x00
+#define GR_FUNC_MODE_X 0x01
+#define GR_FUNC_MODE_ONE_MINUS_X 0x02
+#define GR_FUNC_MODE_NEGATIVE_X 0x03
+#define GR_FUNC_MODE_X_MINUS_HALF 0x04
+
+#define GR_TEXFMT_ARGB_8888 0x12
+
+#define GR_LOD_LOG2_2048 0xb
+#define GR_LOD_LOG2_1024 0xa
+#define GR_LOD_LOG2_512 0x9
+
+#define GR_TEXTURE_UMA_EXT 0x06
diff --git a/source/gles2glide64/src/Glide64/Help/Glide64 Known Issues.html b/source/gles2glide64/src/Glide64/Help/Glide64 Known Issues.html
new file mode 100644
index 0000000..b6d0f52
--- /dev/null
+++ b/source/gles2glide64/src/Glide64/Help/Glide64 Known Issues.html
@@ -0,0 +1,1399 @@
+
+
+
+
+
+
+
+
+
+
+
+Glide64 Known Issues
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Current
+ Version: 9.07 (year: 2009,
+ month: 07)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Known
+ issues
+
+
+
+
+
+
+
+
Game
+
Description
+
Correct with
+
+
+
+
following plugin:
+
+
+
+
+
+
64 de
+ Hakken!! Tamagotchi Minna de Tamagotchi World
+
Missing or wrong textures
+ everywhere
+
Ziggy LLE
+
+
+
All-Star
+ Baseball '99
+
Missing gfx in menu
+
Rice, Jabo
+
+
+
Bio
+ Freaks
+
Missing transition effects
+ during intro
+
None
+
+
+
Blast
+ Corps
+
missing 2d
+ gfx in menu and game; missing noise effects
+
Jabo software
+
+
+
Command
+ & Conquer
+
Briefing menu error. Intro
+ texture errors.
+
(Intro only )Ziggy LLE
+
+
+
Derby
+ Stallion 64
+
textures problem during demo
+
Rice
+
+
+
Donkey
+ kong 64
+
Wide screen doesn t work
+
+
+
+
Excitebike
+ 64
+
sky textures sliced in
+ multiplayer
+
to check
+
+
+
Extreme-G
+
Wrong title: the blue square
+ must not appear (coverage?)
+
NONE
+
+
+
FX-Zero:
+
Wrong or missing (fb ?) effects
+ in menu
+
Jabo Software
+
+
+
Gauntlet
+ Legends 64
+
Missing status bar, flickering
+ (fb+core issue ?)
+
NONE
+
+
+
Gex 3,
+ Deep Cover Gecko
+
Bad water
+
NONE
+
+
+
Glover
+
strange blue line in sky
+ sometimes
+
Ziggy LLE
+
+
+
Harvest
+ Moon 64 (Bokujo Monogatari 2)
+
Problem with shadows
+
Ziggy LLE
+
+
+
Hey
+ You, Pikachu
+
Missing gfx
+
Rice
+
+
+
Jet
+ force gemini
+
Coronas behave slighly
+ incorrectly
+
Wonder++
+
+
+
Kuiki-Uhabi-Suigo
+
Missing jigsaw (microcode issue
+ ? )
+
Ziggy LLE
+
+
+
Mahjong
+ Master
+
Pictures of the character are
+ wrong. Menu doesn't show the japanese letters
+
Rice/SP8
+
+
+
Major
+ League Baseball Featuring Ken Griffey Jr
+
Wrong textures in game
+
Jabo soft/Rice
+
+
+
Mario
+ Tennis
+
Gfx errors
+
to check
+
+
+
Mia
+ Hamm Soccer/Michael Owens WLS/Telefoot/RTL World League Soccer
+
Missing title; wrong transition
+ effect
+
None
+
+
+
Midway's
+ Greatest Arcade Hits Volume 1
+
gfx errors in lot of mini games
+
to check
+
+
+
Mission
+ Impossible
+
missing dithering color alpha
+ effect in menu
+
NONE
+
+
+
Monster
+ Truck Madness 64
+
Letters have some very small gfx
+ issue
+
to check
+
+
+
Nascar
+ 2000
+
Split screen in multiplayer
+ doesn't work correctly.
+
Jabo Software
+
+
+
Nushi
+ Zuri 64 - Shiokaze ni Notte
+
Missing gfx in game (blender ?)
+
Direct64, LLE
+
+
+
Operation
+ WinBack
+
A gray square sometimes appear
+ on the screen; missing sky
+
Ziggy LLE
+
+
+
OgreBattle
+ 64
+
the shadows in menu are wrong
+
NONE
+
+
+
Parlor!
+ Pro 64 Pachinko Jikki Simulation Game
+
small texture issue in game
+
Rice
+
+
+
PGA
+ European Tour
+
colors seems wrong / jauge doesn
+ t work
+
Jabo
+
+
+
Pikachu
+ Genki Dech
+
Missing and stretched textures
+
Rice
+
+
+
Pilotwings
+
Wrong shadows (coverage?)
+
None
+
+
+
Space
+ Silicon Valley
+
Missing on TV dithering color
+ alpha (noise)
+
NONE
+
+
+
Starfox
+ 64
+
Missing dithering color alpha
+ (noise) at logo
+
NONE
+
+
+
Super
+ Bowling 64
+
In game, the two part of the
+ screen is mixed
+
Rice (hack)
+
+
+
Super
+ Robot Spirit
+
In menu, just before beginning a
+ new game there is a problem in this screen: it's seems that there is only
+ half of the screen for the flames ( checked on real system)
+
Rice
+
+
+
Super
+ Speed Race 64
+
Sliced textures in menu
+
Rice
+
+
+
Top
+ Gear Hyper-Bike
+
wrong texture, problem of
+ framebuffer effect
+
NONE
+
+
+
Top
+ Gear Overdrive
+
Resolution change causes gfx
+ glitches in menu
+
NONE
+
+
+
Turok 2
+
Flashlight doesn't work
+
Ziggy LLE
+
+
+
Twine
+
title screen during demo is
+ wrong; shadow at entrance of 1st level should be displayed
+
Jabo
+
+
+
Twisted
+ Edge Extreme Snowboarding
+
wrong background in game
+
to check
+
+
+
Vigilante
+ 8
+
No menus, missing textures and
+ many gfx errors
+
Jabo software
+
+
+
Vigilante
+ 8 - 2nd Offense
+
No menus, depth problem, missing
+ textures and many gfx errors
+
Jabo software
+
+
+
Wipeout
+ 64
+
wrong sky in some particular
+ places, ok with jabo
+
Jabo
+
+
+
Yoshi's
+ Story
+
cut textures
+
Jabo
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Framebuffer
+ issues
+
+
+
+
+
+
+
+
NOTE:
+ HWFBE or fb notification with Mupen is correct solution in terms of speed and
+ quality. Only when REFB is needed or when the fb effect
+
+
+
+
is
+ not emulated that it is considered as an issue.
+
+
+
+
+
+
+
+
Game
+
Description
+
+
+
+
+
+
+
+
+
+
+
Akumajou
+ Dracula Makushiroku: Real Action Adventure
+
REFB needed to get motion blur
+ in intro and correct gfx in menu
+
Jabo
+
+
+
All-Star
+ Baseball 2000, 2001
+
Monitors requires REFB.
+
NONE
+
+
+
Bakushou
+ Jinsei 64 - Mezase
+
Needs REFB to be playable (or
+ background will be missing) (Mupen doesn t handle fb effect
+ correctly=disabled)
+
NONE
+
+
+
Beetle
+ Adventure Racing
+
Unemulated fb effects in menu
+ (scrolling effect); shadows on cars needs REFB
+
Ziggy LLE
+
+
+
Blast
+ Corps
+
wrong depth with shadows with
+ HWFBE
+
to check
+
+
+
Bottom
+ of the 9th
+
needs REFB for correct intro;
+ With HWFBE only one of the 2 of the player heads are displayed in game
+
NONE
+
+
+
Castlevania
+ - Legacy of Darkness
+
REFB needed to get motion blur
+ in intro and correct gfx in menu
+
Jabo
+
+
+
Dobutsu
+ no Mori (Animal Forest)
+
The character menu is uncorrect
+ due to an unhandeld fb effect
+
Direct64
+
+
+
Donkey
+ Kong 64
+
The zipper screen issue is a
+ framebuffer effects (needs REFB) (Mupen doesn t support this game)
+
NONE
+
+
+
Extreme-G
+
Missing transfer effects in
+ after select the car
+
Direct64
+
+
+
iss98/2000/Jikkyou
+ World Cup France '98/J. League Perfect Striker
+
Missing fb effect when a goal is
+ scored
+
GLN64 0.41
+
+
+
The New
+ tetris
+
Missing fb effect in menu
+ (partially working with HWBFE)
+
Direct64
+
+
+
Micromachines
+ 64
+
Missing shadows for some
+ elements of the environment
+
Jabo software
+
+
+
Ogre
+ Battle 64 - Person of Lordly Caliber
+
Screen transition effects
+ requires REFB.
+
to check
+
+
+
Tonic
+ Trouble
+
texts for the screen just before
+ going in game needs REFB (side effect of cpu gfx effect ?)
+
NONE
+
+
+
WWF
+ WrestleMania 2000 /Virtual Pro Wrestling 2
+
REFB is needed to get motion
+ blur in intro
+
Ziggy LLE
+
+
+
Yoshi's
+ Story
+
Transition "page" level needs REFB
+
to check
+
+
+
+
+
+
+
Pending
+ investigation
+
+
+
+
+
+
+
+
Game
+
Description
+
+
+
+
+
+
+
+
+
+
+
F1 Pole
+ position 64
+
Wrong use of dithering alpha for
+ texts ?
+
+
+
+
+
+
+
+
Non-working
+ games
+
+
+
+
+
+
+
+
Game
+
Description
+
+
+
+
+
+
+
+
+
+
+
Indiana
+ Jones and the Infernal Machine
+
Unimplemented microcode
+
Jabo/ Ziggy LLE
+
+
+
Last
+ Legion U
+
Unimplemented microcode
+
Jabo/ Ziggy LLE
+
+
+
Star
+ Wars - Rogue Squadron
+
Unimplemented microcode
+
Jabo/ Ziggy LLE
+
+
+
Star
+ Wars Episode I - Battle for Naboo
+
Unimplemented microcode
+
Jabo/ Ziggy LLE
+
+
+
Toukon
+ Road - Brave Spirits
+
Unimplemented microcode
+
Jabo/ Ziggy LLE
+
+
+
Toukon
+ Roads - The Next Generation
+
Unimplemented microcode
+
Jabo/ Ziggy LLE
+
+
+
+
+
+
+
Emu
+ issues
+
+
+
+
+
+
+
+
Game
+
Description
+
+
+
+
+
+
+
+
+
+
+
Ai
+ Shougi 3
+
Textures are completely
+ distorted (use 1964!)
+
+
+
+
Banjo
+ Tooie
+
Random crashes
+
+
+
+
Dobutsu
+ no Mori
+
NES games crash emulation
+
+
+
+
Hoshi
+ no Kirby 64
+
Minor gfx errors with the status
+ bar (use Mupen!)
+
+
+
+
Kirby
+ 64 - The Crystal Shards
+
Minor gfx errors with the status
+ bar (use Mupen!)
+
+
+
+
Mario
+ No Photopie
+
Special card issues
+
+
+
+
NBA
+ Courtside 2 - Featuring Kobe Bryant
+
CPU gfx effect issue >> Missing intro. (TIP: set "Frame Buffer R/W: Yes"
+ with 1964 : got some gfx but broken)
+
+
+
+
Yakouchuu
+ II - Satsujun Kouru:
+
CPU gfx effect issue >> Missing movies
+
+
+
+
+
+
+
+
Wrapper
+ issues
+
+
+
+
+
+
+
+
Game
+
Description
+
+
+
+
+
+
+
+
+
+
+
Depth
+ issue when using HWFBE, mostly with fbo:International Track and Field Summer
+ Games, NFL98 TV screen (?), others
+
+
+
+
+
+
+
+
+
Unknown
+ issues
+
+
+
+
+
+
+
+
Game
+
Description
+
+
+
+
+
+
+
+
+
+
+
Stunt
+ Racer 64
+
Microcode issue and core issues
+
+
+
+
World
+ Driver Championship
+
Microcode issue and core issues
+
+
+
+
+
+
+
+
+
+
Credits :)
+ Current list's maintainer: Olivieryuyu
Neither I, nor anyone who is working with me, will take ANY
+responsibility for your actions or if this program causes harm to anything,
+including you and your computer, in any way, physically or
+mentally.
Glide64 is a graphics plugin for Nintendo 64 emulators. It can run
+natively on 3dfx cards, or via a OpenGL-based wrapper for modern video
+cards. The project started on 29 December 2001 by David 'Dave2001'
+Forrester (USA). Gugaman (Brazil) and Sergey
+'Gonetz' Lipski (that is me) joined him at February 2002. We worked
+together until the autumn of 2002. Then, Dave2001 and Gugaman left the project.
+Since that time I'm the only developer of the plugin. However, I'm not the only
+one, who works on this project. The Glide64 project includes two additional
+libraries beside the plugin itself. The first one is the library known as the
+'Glitch64' wrapper, previously known as "Hacktarux's glide wrapper", named after
+its original author, Hacktarux (France). It then was heavily
+modified & improved by Vincent 'ziggy'
+Penne (France) and Brad 'mudlord'
+Miller (Australia). The second library is a texture enhancement
+module named 'GlideHQ', created by Hiroshi 'KoolSmoky' Morii
+(Japan). Beside that, lots of people from around the world helped me to test the
+plugin and gave me valuable advices on how to improve it. The main tester of
+this version is Olivieryuyu (France); and additional
+testing, advices and friendly support was provided by Wes 'Legend'
+McDaniel (USA).
Open archive and copy everything from the 'Plugin' folder into the
+ folder where all your N64 plugins are stored (this is usually the
+ 'Plugin' folder in your emulator's folder, e.g.
+ Project64\Plugin).
+
+
If you donât have a Voodoo card, make sure you copy the glide3x.dll file from the
+ 'Wrapper' folder into your emulator's folder.
+
To setup Glide64:
+
+
+
Launch your emulator.
+
+
Select Glide64 as your graphics plugin.
+
+
Select 'Configure graphics plugin'
+
+
In Glide64 configuration dialog, on the 'Common
+ settings' tab, in the "Rendering" section, select your desired windowed
+ and full screen resolution.
+
Glide64 is now ready to use. If you're a novice in N64 emulation,
+you may skip the rest of this document, start your favorite games and enjoy! If
+you are an experienced emu fan, or a curious person, read further for
+explanation for other options and various tips and tricks.
'Windowed or 3dfx card resolution' - This option selects the fullscreen resolution for 3dfx cards and windowed resolution for other cards. Note: for 3dfx cards the plugin must be in fullscreen mode to see anything.
'Vertical sync' - This option will enable the vertical sync, which will prevent tearing. Note: this option will ONLY have effect if vsync is set to "Software Controlled".
3.1.2 OpenGL settings
'Anisotropic filtering' - This filter sharpens and brings out the details of textures that recede into the distance. When activated, it will use the max anisotropy your video card supports. However, this will override native way of texture filtering and may cause visual artifacts in some games.
'Autodetect VRAM Size' - If checked, plugin will try to autodetect VRAM size. But if this appears wrong, please uncheck and set it to correct value. Currently VRAM autodetection is implemented only for Windows.
'Use Frame buffer objects' - Changes the way frame buffer effects are rendered - with or without usage of the OpenGL Frame Buffer Objects (FBO) extension. The choice depends on game and your video card. FBO off is good for NVIDIA cards, while for ATI cards, it's usually best that FBOs are turned on. Also, some FB effects work only with one of the methods, no matter which card you have. On the whole, with FBO off, compatibility/accuracy is a bit better (which is the case for Resident Evil 2). However, with FBO on with some systems, it can actually be a bit faster in cases.
3.2 On screen display
These settings are located in 'Common settings' tab - in the 'On screen display' section. You may select them with no worries - these settings do not impact the emulation.
Select any or all options in the 'Speed' option group to see how fast the game is running. 'FPS counter' will show you the actual frames per second (FPS) for the current game. This number depends on the running game. The 'VI/s counter' will show you the number of visual interrupts per second received by the plugin. This number must be 50 for PAL games and 60 for NTSC games. '% speed' will show you, how fast your game is emulated; 100% means that the currently emulated game runs at perfect speed. 'FPS transparent' option makes the background of the counter(s) transparent.
Select 'Clock enabled' in the 'Time' group to see the current time. Select 'Clock is 24-hour' to see the time in 24-hour format. Time information will be displayed in the lower right corner of the screen.
3.3 Other
All other common settings are grouped in the 'Other' section.
'Show advanced emulation options' - Enable 'Emulation settings' tab. Read more in 'Emulation settings' section.
'Screenshot format' - Format, in which screen shots will be saved. Currently you may choose 'BMP', 'PNG' or 'JPEG'.
'Glide card #' - This option is only for users with multiple 3dfx cards installed in one machine. This selects the glide card number to use. If you only have one glide card installed in your system, set this option to #1. Otherwise, select the number that corresponds to the glide card you want to use.
Warning: The plugin already has optimal settings for all
+games. Changing these settings is dangerous: it can cause glitches and
+instability. Access to emulation settings is disabled by default.
+
To enable 'Emulation settings' tab, check 'Show advanced emulation
+options' on the 'Common settings tab' and close the configuration
+dialog. Open configuration dialog again and the 'Emulation
+settings' tab will now be available.
Important: 'Emulation settings' tab operates in 2 different ways depending on whether or not a game is running.
+
+
+
When no game is running, you may change "default" emulation
+ settings. The plugin uses these settings when a game does not
+ have corresponding custom settings. Again, it is strongly recommended to not touch anything here.
+
+
When a game IS running, this tab shows emulation settings the
+ game is using. Any changes will be applied immediately after you close the configuration dialog. You will be asked - save the changes in the ini file or use them in the current session only. If you choose 'Yes', your changes will be saved in the custom section of the ini file and will be used permanently. Otherwise, new setting will be used until the game stops or new save state loaded.
+
4.1 General options
+
'Filtering mode' - you may set 'Force bilinear',
+'Automatic' or 'Force point-sampled' mode. You also may easily
+switch between filtering modes during game play by pressing the backspace
+button.
+
'Buffer swapping modes' - It's hard to explain the
+difference between these modes. Just select any available option. If a game suffers from flickering, select another buffer swapping mode and see if that fixes the problem.
'LOD calculation'.
+The N64 uses a very special way to implement mip-mapping, which is not available on PC hardware. Glide64 implements a rough approximation of N64
+mip-mapping, which can be enabled by setting 'LOD calculation' option
+to 'fast' or 'precise'. The result is not always good
+though.
'Aspect ratio' - Most N64 games use 4:3 aspect ratio, but some support widescreen too. You may select appropriate aspect here and set widescreen mode in game settings. In 'Stretch' mode the output will be stretched to the entire screen, other modes may add black boarders if necessary.
+
'Fog' - Sets fog emulation on/off.
+
'Buffer clear on every frame' - Forces the frame buffer to be cleared every frame drawn. Usually frame buffer clear is controlled by the game. However, in some cases it is not well emulated, and some garbage may be left on the screen. In such cases, this option must be set on.
+
+
4.2. Frame buffer emulation
+
N64 games often use auxiliary frame buffers to implement special
+game effects like motion blur or for optimization purposes. The console can
+allocate as many auxiliary frame buffers as needed and then use them as usual
+textures. PC video cards usually use only one buffer per frame, thus emulation
+of frame buffer effects is always a hard problem. Glide64 implements lot of
+methods of frame buffer emulation, to support as many effects as possible. Most
+games will work fine with pre-defined settings, but some effects require
+additional options to be set. Known cases are described in the Compatibility List and in the Specific Game Settings. You may set the following
+options:
+
'Enable frame buffer emulation' - When this option is on, the plugin will try to detect frame buffer effects usage and emulate them. This option is off by default, but for all games, which use frame buffer effects, it will be automatically turned on.
'Motion blur' - Enables motion blur emulation. Motion blur
+works slow without hardware frame buffer emulation, so it is made optional. This
+option usually must be on, because most of cards support hardware frame buffer
+emulation. You may also switch it on/off during game play by pressing ALT-B.
+
'Read every frame' - In some cases, Glide64 cannot
+detect frame buffer usage by the game. In this case the only way to emulate
+frame buffer effects, is to read every rendered frame from video memory and put
+it into the emulated RDRAM. Reading from video memory is usually slow, so this
+method of frame buffer emulation is optional. You may also switch it on/off
+during game play by pressing ALT-V.
+
'Get frame buffer info' - This is another way to emulate
+frame buffer effects, which the plugin cannot detect. This option allows the
+plugin to get notification about frame buffer usage from the emulator and thus
+emulate frame buffer effects without slowdown. Currently it works only with
+Mupen64 (and even Mupen is not 100% reliable with this). Do not enable this option with 1964, otherwise the emulator will
+crash.
+
'Render N64 frame buffer as texture'. The N64
+architecture allows the CPU to write directly into the frame buffer. Sometimes
+N64 games uses this ability, which may lead to graphics lost during emulation,
+since graphics plugin does not know, that some graphics are already written in
+the N64 frame buffer by the CPU. Some examples of this are: falling pills in
+Dr.Mario and rain in Jet Force Gemini. When this option is enabled, content of
+each N64 frame buffer is rendered as a texture over the current rendered frame.
+This prevents graphics loss, but may cause slowdowns and various glitches in
+some games.
+
'Detect CPU write to N64 frame buffer'- This option works
+as the previous options, but the plugin is trying to detect, when a game uses
+CPU writes to the N64 frame buffer. The N64 frame buffer is rendered only when
+CPU writes is detected. Use this option for those games, in which you see still
+image or no image at all for some time with no reason.
Sometimes N64 games use values in the depth buffer to decide, when
+to render some particular object or not. This is often used for coronas, which
+must be rendered only if they are not covered by other objects in the 3D scene.
+To emulate it properly, the N64 depth buffer must be filled with correct values.
+Glide64 uses software rendering to fill the N64 depth buffer. It is enabled by
+default. If you experience performance issues, set the 'Software depth
+buffer rendering' option off.
The usual method of frame buffer emulation, which theoretically
+should always work, is to render auxiliary frame buffers into the main video
+buffer and then read it from video memory into main memory, and put into the
+structure representing N64 memory (RDRAM). This approach has 2 main
+disadvantages:
+
1) auxiliary frame buffers may be visible when they should
+n't be.
+
2) reading from video memory is a very slow operation, thus many
+frame buffer effects will be slow.
+
Also, image taken from video memory must be scaled down to N64
+native resolution (usually 320x240), thus quality lost is inevitable. To avoid
+these problems, Glide64 uses the Glide3x extension, which allows it to create
+auxiliary frame buffers right into video memory, like the N64 does. This allows
+the plugin to run frame buffer effects without speed hits or quality loss.
+Hardware frame buffer emulation (HWFBE) greatly improves many games, but it has
+some restrictions:
+
1) HWFBE is in fact a hack - auxiliary frame buffers are not put
+into N64 memory. When a game uses a texture located in RDRAM corresponding to an
+auxiliary frame buffer, the plugin uses the texture located in video memory
+instead. The game may use this area in RDRAM for different textures later, but
+the plugin will use it's auxiliary buffer anyway, which leads to serious
+glitches. I have tried to reduce the probability of this situation, but it is
+still possible. If you encounter it, switch to windowed mode, and then back to
+full screen again.
+
2) The Glide extension used for HWFBE is fully supported by Voodoo
+4/5 only. Banshee and Voodoo3 cards also support it, but only for small
+auxiliary frame buffers (e.g. shadows). Other Voodoo cards do not support it at
+all!
+
3) HWFBE may not work for Voodoo4/5 if the anti-aliasing option is
+set to "fastest performance". Use any other option there.
+
4) Anti-aliasing is not applicable to auxiliary frame buffers.
+
5) The wrapper support HWFBE almost fully, but it has its peculiarities. Two ways of hardware frame buffer emulation are implemented in the wrapper - with, and without usage of the OpenGL Frame Buffer Objects (FBO) extension. The method with FBO's works fast on any card, which supports FBO's, but it may cause depth issues, since framebuffer objects use their own depth buffer. The method without FBO's works on almost any card, has no problems with depth buffer usage, but it may work slowly on ATI cards. To switch between these methods set the 'Use frame buffer objects' option on/off.
Texture enhancement is done via GlideHQ - a real-time texture enhancer library with hi-resolution texture pack support. GlideHQ is an independent DLL, which dynamically loaded by Glide64, when it is needed. GlideHQ itself has no user interface; all its settings are placed on the 'Texture enhancement' tab. This tab is disabled by default. To enable it, check 'Show texture enhancement options' on the 'Common settings' tab and close the configuration dialog. Open configuration dialog again and switch to 'Texture enhancement' tab.
6.1. Texture enhancement
GlideHQ uses variety of methods to enhance the original N64 textures.
'Filter' - Apply a filter to either smooth or sharpen textures. There are 4 different smoothing filters and 2 different sharpening filters. The higher the number, the stronger the effect, i.e. 'Smoothing filter 4' will have a much more noticeable effect than 'Smoothing filter 1'. Be aware that performance may have an impact depending on the game and/or the PC.
'Enhancement' - 7 different filters are selectable here, each one with a distinctive look. Be aware of possible performance impacts. Important: 'Store' mode - saves textures in cache "as is". It can improve performance in games, which load many textures. Disable 'Ignore backgrounds' option for better result.
'Texture cache' - Enhanced and filtered textures are cached for later use. This helps boost performance if there are subsequent requests for the same texture, which is the case for most games. Normally, 128MB should be more than enough but there is a sweet spot for each game. 32MB will be enough for Super Mario, but Conker's BFD streams a lot of textures so setting 256MB or more will boost performance.
'Compress texture cache' - Memory will be compressed so that more textures can be held in the texture cache. The compression ratio varies with each texture, but 1/5 of the original size would be a modest approximation. They will be decompressed on-the-fly, before being downloaded to the gfx hardware. This option will still help save memory space even when using texture compressions such as FXT1 and S3TC.
'Apply texture compression' - Textures will be compressed using selected texture compression method. The overall compression ratio is about 1/6 for FXT1 and 1/4 for S3TC. In addition to saving space on the texture cache, the space occupied on the GFX hardware's texture RAM, by the enhanced textures, will be greatly reduced. This minimizes texture RAM usage, decreasing the number of texture swaps to the GFX hardware leading to performance gains. However, due to the nature of lossy compression of FXT1 and S3TC, using this option can sometimes lead to quality degradtion of small size textures and color banding of gradient colored textures.
'Ignore backgrounds' - It is used to skip enhancement for wide narrow textures, usually used for backgrounds. This may save texture memory greatly and increase performance.
6.2 Hi-resolution textures
GlideHQ supports hi-resolution texture packs, and texture dumping/editing.
'Format' - Chose which method is to be used for loading Hi-res texture packs. Only Rice's format is available currently. Leave on 'None' if you will not be needing to load hi-res packs.
'Alternative CRC calculation' - This option enables emulation of a palette CRC calculation bug in RiceVideo. If some textures are not loaded, try to set this option on/off. This option is disabled in texture dumping mode.
'Texture dumping/editing mode' - In this mode, you have that ability to dump textures on screen to the appropriate folder. You can also reload textures while the game is running to see how they look instantly - big time saver! Hotkeys: "R" reloads hires textures from texture pack - "D" toggles texture dumps on/off.
'Use alpha channel fully' - When this option is off, 16bit rgba textures will be loaded using RiceVideo style - with 1bit for alpha channel. When it is on, GlideHQ will check, how alpha channel is used by the hires texture, and select most appropriate format for it. This gives texture designers freedom to play with alpha, as they need, regardless of format of original N64 texture. For older and badly designed texture packs it may cause unwanted black borders.
'Compress texture cache' - When game started, plugin loads all its hi-resolution textures into PC memory. Since hi-resolution textures are usually large, the whole pack can take hundreds megabytes of memory. Cache compression allows to save memory space greatly. Textures will be decompressed on-the-fly, before being downloaded to the gfx hardware. This option will still help save memory space even when using texture compression.
'Apply texture compression' - Textures will be compressed using selected texture compression method. The overall compression ratio is about 1/6 for FXT1 and 1/4 for S3TC. In addition to saving space on the texture cache, the space occupied on the GFX hardware's texture RAM, by the enhanced textures, will be greatly reduced. This minimizes texture RAM usage, decreasing the number of texture swaps to the GFX hardware leading to performance gains. However, due to the nature of lossy compression of FXT1 and S3TC, using this option can sometimes lead to quality degradtion of small size textures and color banding of gradient colored textures.
'Force 16bpp textures' - The color of the textures will be reduced to 16bpp. This is another space saver and performance enhancer. This halves the space used on the texture cache and the GFX hardware's texture RAM. Color reduction is done so that the original quality is preserved as much as possible. Depending on the texture, this usually is hardly noticeable. Sometimes though, it can be: skies are a good example.
'Tile textures' - When on, wide texture will be split on several tiles to fit in one 256-width texture. This tiled texture takes much less video memory space and thus overall performance will increase. However, corresponding polygons must be split too, and this is not polished yet- various issues are possible, including black lines and polygons distortions.
6.3 Common
'Texture compression method' - Select the method for texture compression. 3dfx cards support both FXT1 and S3TC, other cards can use S3TC only.
'Save texture cache to hard disk' - For enhanced textures cache: this will save all previously loaded and enhanced textures to the hard drive. So upon next game launch, all the textures will be instantly loaded, resulting in smoother performance for all your games. For high-resolution textures cache: After creation, loading hi-res texture will take only a few seconds upon game launch, as opposed to the 5 - 60 seconds a pack can take to load without this cache file. The only downside here is upon any changes to the pack, the cache file will need to be manually deleted. Saved cache files go into a folder called "Cache" within the "Plugins" folder.
"BACKSPACE" - Cycle between texture filtering modes. Currently selected mode will be shown in the status line on the bottom of the screen for a short time.
"Alt"+"V" - Toggles read every frame on/off. Current status of this option will be shown in the status line on the bottom of the screen for a short time.
"Alt"+"B" - Toggles motion blur on/off. Current status of this option will be shown in the status line on the bottom of the screen for a short time.
GlideHQ uses the following hotkeys:
"D" - toggles texture dumps on/off.
"R" - reloads hires textures from the texture pack.
Fog. The fog in this game is
+implemented in a very specific way. When rendering of the current
+frame is finished, the depth buffer, filled during rendering of this frame, is
+used as a texture and blended with the color buffer. As the result, the frame
+becomes fogged, and the fog is thicker where depth values are higher. Glide64
+implements two ways to emulate this effect, software and hardware ones.
+
+
Software emulation
+uses software depth buffer rendering. It works on all cards, but has two
+disadvantages:
+
- Alpha testing is not used during
+software depth buffer rendering. As the result, the pixels, which would normally
+be rejected by alpha testing, are stored in the depth buffer. This causes
+artifacts in the produced fog.
+
- The software
+depth buffer has original (that is low) N64 resolution output. When it is used
+as a texture, blended with the high-resolution frame buffer, aliasing is
+visible.
+
Hardware emulation
+produces perfect fog, but currently it works only on 3dfx Voodoo 4/5's. These
+cards use the same depth buffer format, as the N64, and they can allocate the
+depth buffer right in the texture memory, so it can be easily used as a texture,
+as on N64 hardware. In both cases, the
+'Software depth buffer rendering' option must be on.
On car reflection. Your car (the car
+you drive) should reflect the environment in this game. That is, various
+objects, which you roll by, should be reflected on your car. This is implemented
+via the usage of frame buffer content. Emulation of this effect implies frame
+buffer emulation. Unfortunately, this can't be done in hardware, because the
+texture, which is used as a reflection, is not a part of the frame buffer - it
+is the result of frame buffer post processing, made on the N64 CPU. Thus, the
+only way to emulate this effect is to use the 'Read every frame'
+option. If your hardware allows you to use this option without slowdown, you are
+lucky.
This game uses
+pre-rendered depth buffers, which are stored in the game's ROM, and are loaded
+into the depth buffer memory area each frame before rendering is started. This
+is hard to emulate, and especially hard to emulate efficiently. The following
+options must be set:
+The game is well
+emulated with default settings. However, there are two special effects in this
+game, which require special settings: the black-and-white "It's war" cut-scene,
+and the Uga-Buga pixilated effect. To see these effects, set the following
+options: 'Read every frame' - on 'Render N64 frame buffer as texture' - on The game is not
+playable with these settings, so use them only to see these particular effects.
+
Note for ATI users: you must set 'Use Framebuffer Objects'
+option on, otherwise the game will work very
+slow.
+
+Lens of
+Truth may not work, if 'Use Framebuffer Objects' option set off
+. Also, when Lens of Truth is used, some
+objects outside of the lens can be cut. This is not a bug - depth buffer copy
+must be emulated to fully emulate Lens of Truth. It is currently supported
+only by 3dfx Voodoo 4/5 cards.
+
+Frame buffer
+emulation must be disabled in multiplayer mode to avoid flickering. Most of the
+special effects used will not work without frame buffer emulation, but it's
+not that important for multiplayer.
+
\ No newline at end of file
diff --git a/source/gles2glide64/src/Glide64/Help/Glide64 compatibility list.html b/source/gles2glide64/src/Glide64/Help/Glide64 compatibility list.html
new file mode 100644
index 0000000..c06ffe6
--- /dev/null
+++ b/source/gles2glide64/src/Glide64/Help/Glide64 compatibility list.html
@@ -0,0 +1,6153 @@
+
+
+
+
+
+
+
+
+
+.::Glide64 compatibility list::.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Compatibility List
+
+
+
for
+ Glide64 1.0
+
+
+
+
+
+
Game
+ Name:
+
RSP Microcode
+
Playability Level
+
Relative speed
+
Comments
+
+
+
007 - The World is Not Enough
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
1080 Snowboarding
+
F3DEX1.XX
+
5
+
Normal
+
Compatible. Use "Read every frame" option to see correct TV
+ monitors (slow)
+
+
+
40
+ Winks
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
64 Oozumou
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
64 Oozumou 2
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
64 Trump Collection - Alice no Wakuwaku
+ Trump World
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
64 de Hakken!! Tamagotchi Minna de Tamagotchi World
+
F3DTEX/A
+
3
+
Slow
+
Major gfx errors
+
+
+
AI Shogi 3
+
F3DEX1.XX
+
5
+
Fast
+
Compatible. Use 1964
+
+
+
Aerofighter's Assault
+
RSP SW 2.0X
+
5
+
Normal
+
Compatible
+
+
+
AeroGauge
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Aidyn Chronicles - The First Mage
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Airboarder 64
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Akumajou
+ Dracula Makushiroku - Real Action Adventure
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use "Read every frame" option to see correct menu
+ (slow)
+
+
+
Akumajou Dracula Makushiroku-Legend of
+ Cornell
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Enable hi-res mode for correct menus
+
+
+
All Star Tennis '99
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
All-Star Baseball 99
+
F3DEX1.XX
+
5
+
Normal
+
Compatible. Use "Get frame buffer info" option with Mupen or
+ use "Read every frame" option to see correct TV monitors (slow).
+ Minor gfx errors
+
+
+
All-Star Baseball 2000
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use Nemu 0.8. Use "Read every frame" option to see
+ correct TV monitors (slow)
+
+
+
All-Star Baseball 2001
+
F3DEX1.XX
+
5
+
Normal
+
Compatible. Use Nemu 0.8. Use "Read every frame" option to see
+ correct TV monitors (slow)
+
+
+
Armorines - Project S.W.A.R.M.
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Army Men - Air Combat
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Army Men - Sarge's Heroes
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Army Men - Sarge's Heroes 2
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Asteroids Hyper 64
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Automobili Lamborghini
+
F3DEX1.XX
+
5
+
Normal
+
Compatible. Minor gfx errors
+
+
+
Baku
+ Bomberman
+
F3DEX1.XX
+
5
+
Normal
+
Compatible. Use "Get frame buffer info" option with Mupen or
+ use "Read every frame" option to see intro correctly (slow)
+
+
+
Baku
+ Bomberman 2
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Bakuretsu Muteki Bangaioh
+
F3DEX1.XX
+
5
+
Slow
+
Compatible
+
+
+
Bakushou Jinsei 64 - Mezase! (Game of
+ Life)
+
RSP SW 2.0X
+
5
+
Slow
+
Compatible. Use "Read every frame" option to have correct gfx
+ in game
+
+
+
Banjo to
+ Kazooie no Dai Bouken
+
F3DEX1.XX
+
5
+
Normal
+
Compatible. Use "Read every frame" option (slow) or "Get
+ frame buffer info" option with Mupen to see puzzle effect
+
+
+
Banjo to Kazooie no Dai Bouken 2
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Banjo-Kazooie
+
F3DEX1.XX
+
5
+
Normal
+
Compatible. Use "Read every frame" option (slow) or "Get
+ frame buffer info" option to see puzzle effect with
+ Mupen
+
+
+
Banjo-Tooie
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Bass Hunter 64
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Bass Rush - ECOGEAR PowerWorm
+ Championship
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Bass Tsuri No.1 - Shigesato Itoi's Bass
+ Fishing
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Bassmasters 2000
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Batman Beyond - Return of the Joker
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
BattleTanx
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
BattleTanx - Global Assault
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Battlezone - Rise of the Black Dogs
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Beetle Adventure Racing
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Big Mountain 2000
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Bio F.R.E.A.K.S.
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Bio Hazard 2
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Blast Corps
+
RSP SW 2.0X
+
5
+
Normal
+
Compatible. Use PJ64. Minor gfx errors
+
+
+
Blast Dozer
+
RSP SW 2.0X
+
5
+
Normal
+
Compatible. Use PJ64. Minor gfx errors
+
+
+
Blues Brothers 2000
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Body Harvest
+
F3DEX1.XX
+
5
+
Normal
+
Compatible. Use "Read every frame" option (slow) or "Get
+ frame buffer info" with Mupen to have correct menu
+
+
+
Bokujo Monogatari 2
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Bomberman 64
+
F3DEX1.XX
+
5
+
Normal
+
Compatible. Use "Get frame buffer info" option with Mupen or
+ use "Read every frame" option to see intro correctly (slow)
+
+
+
Bomberman64 - The Second Attack
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Bomberman Hero
+
F3DEX1.XX
+
5
+
Fast
+
Compatible.
+
+
+
Bottom of the 9th
+
F3DEX2.XX
+
5
+
Fast
+
Compatible. Use "Read every frame" option (slow) to see
+ correct intro
+
+
+
Brunswick
+ Circuit Pro Bowling
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Buck Bumble
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Bug's Life, A
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Bust-A-Move '99
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Bust-A-Move 2 - Arcade Edition
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Bust-A-Move 3 DX
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
California
+ Speed
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Carmageddon 64
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Castlevania
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use "Read every frame" option to see correct menu
+ (slow)
+
+
+
Castlevania - Legacy of Darkness
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Enable hi-res mode for correct menus
+
+
+
Centre Court Tennis
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Chameleon Twist
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Chameleon Twist 2
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Charlie Blast's Territory
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Chopper Attack
+
RSP SW 2.0X
+
5
+
Fast
+
Compatible
+
+
+
Choro Q 64
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Choro Q 64 II
+
F3DEX2.XX
+
5
+
Fast
+
Compatible. Use "Read every frame" option (slow) or "Get
+ frame buffer info" option with Mupen to see correct menu
+
+
+
Chou Kuukan Night Pro Yakyuu King
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Chou Kuukan Night Pro Yakyuu King 2
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Chou Snobow Kids
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
City-Tour GP - Zennihon GT Senshuken
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Clay Fighter - Sculptor's Cut
+
F3DEX1.XX
+
5
+
Slow
+
Compatible
+
+
+
Clay Fighter 63 1-3
+
F3DEX1.XX
+
5
+
Slow
+
Compatible
+
+
+
Command & Conquer
+
F3DEX2.XX
+
3
+
Fast
+
Not playable
+
+
+
Conker's Bad Fur Day
+
F3DEXGB2.08
+
5
+
Normal
+
Compatible. Use "Read every frame" option (slow) to get black
+ and white effect during “It’s war” cut scene and Buga
+ pixellisation effect
+
+
+
Cruis'n Exotica
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Cruis'n USA
+
RSP SW 2.0X
+
5
+
Fast
+
Compatible
+
+
+
Cruis'n World
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Custom Robo
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Custom Robo V2
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
CyberTiger
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Dance Dance Revolution - Disney Dancing
+ Museum
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Dark Rift
+
TURBO3D
+
5
+
Normal
+
Compatible
+
+
+
Deadly Arts
+
F3DEX1.XX
+
5
+
Slow
+
Compatible
+
+
+
Défi au Tetris Magique
+
S2DEX.XX
+
5
+
Normal
+
Compatible
+
+
+
Densha de GO! 64
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use 1964
+
+
+
Derby
+ Stallion
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use Nemu 0.8
+
+
+
Destruction Derby 64
+
F3DEX1.XX
+
5
+
Slow
+
Compatible
+
+
+
Dezaemon 3D
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Diddy Kong Racing
+
RSP SW DKR
+
5
+
Fast
+
Compatible
+
+
+
Disney's Donald Duck - Goin' Quackers
+
F3DEX1.XX
+
5
+
Normal
+
Compatible. Use "Read every frame" option to see correct
+ transition effects in menu
+
+
+
Disney's Tarzan
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use PJ64
+
+
+
Donald Duck - Quack Attack
+
F3DEX1.XX
+
5
+
Normal
+
Compatible. Use "Read every frame" option to see correct
+ transition effect in menu
+
+
+
Donkey Kong 64
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use PJ64
+
+
+
Doom 64
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Doraemon - Mittsu no Seireiseki
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Doraemon 2 - Hikari no Shinden
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Doraemon 3 - Nobi Dai no Machi SOS!
+
F3DEX1.XX
+
5
+
Fast
+
Compatible. Use 1964
+
+
+
Doubutsu no Mori
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Dr. Mario 64
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Dual Heroes
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Duck Dodgers Starring Daffy Duck
+
F3DEX2.XX
+
5
+
Slow
+
Compatible
+
+
+
Duke Nukem - ZER0 H0UR
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Duke Nukem 64
+
RSPSW 2.0X
+
5
+
Normal
+
Compatible. Minor gfx errors
+
+
+
ECW Hardcore Revolution
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Earthworm Jim 3D
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Eikou no Saint Andrew
+
RSP SW 2.0X
+
2
+
Normal
+
Compatible, Use "Read every frame" option (slow) or "Get
+ frame buffer info" with Mupen to have correct background in game
+
+
+
Elmo's Letter Adventure
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Elmo's Number Journey
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Eltale Monsters
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Excitebike 64
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Extreme-G
+
F3DEX1.XX
+
5
+
Normal
+
Compatible. Minor gfx errors
+
+
+
Extreme-G XG2
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
F-1 Pole Position 64
+
F3DEX1.XX
+
5
+
Fast
+
Compatible. Use "Read every frame" option (slow) or "Get
+ frame buffer info" with Mupen to have correct menu
+
+
+
F-1 World Grand Prix
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
F-1 World Grand Prix II
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
F-Zero X
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
F1 Racing Championship
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use Mupen
+
+
+
FIFA - Road to World Cup 98
+
RSP SW 2.0X
+
5
+
Slow
+
Compatible
+
+
+
FIFA 99
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
FIFA Soccer 64
+
RSP SW 2.0X
+
5
+
Normal
+
Compatible. Use 1964
+
+
+
Famista 64
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use "Read every frame" option (slow) or "Get
+ frame buffer info" with Mupen to have ground in game
+
+
+
Fighter Destiny 2
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Fighter's Destiny
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Fighting Cup
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Fighting Force 64
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Fire Electric Pen
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Flying Dragon
+
F3DEX1.XX
+
5
+
Normal
+
Compatible. Minor gfx errors
+
+
+
Forsaken 64
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Frogger
+ 2 (Alpha)
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
FoxSportsCollege Hoops ‘99
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Fushigi no Dungeon - Fuurai no Shiren 2
+
F3DEX2.XX
+
5
+
Normal
+
Compatible.
+ Use "Read every frame" option (slow) or "Get frame buffer
+ info" with Mupen to have backgrounds in menus
+
+
+
G.A.S.P! Fighter's NEXTream
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use (J) version or use Mupen
+
+
+
GT 64 - Championship Edition
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Ganbare Goemon - Derudero Douchuu Obake Tenkomori
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Ganbare Goemon - Mononoke Sugoroku
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Ganbare Goemon - Neo Momoyama Bakufu no
+ Odori
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Ganbare Nippon Olympics 2000
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Gauntlet Legends
+
F3DEX2.XX
+
2
+
Normal
+
Missing gfx. Flickerings. Use PJ64
+
+
+
Getter Love !! Cho Renai Party Game
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Gex 3 - Deep Cover Gecko
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Gex 64 - Enter the Gecko
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Glover
+
F3DEX1.XX
+
5
+
Normal
+
Compatible (For (E) version use Mupen)
+
+
+
Goemon's Great Adventure
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Golden Nugget 64
+
RSP SW 2.0X
+
5
+
Fast
+
Compatible. Use 1964 or Mupen
+
+
+
GoldenEye 007
+
RSP SW 2.0G
+
5
+
Slow
+
Compatible
+
+
+
HVS Adventure Racing
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use PJ64 Audio Fix Edition
+
+
+
Hamster Monogatari 64
+
S2DEX.XX
+
5
+
Normal
+
Compatible
+
+
+
Hanafuda 64 - Tenshi no Yakusoku
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use 1964
+
+
+
Harukanaru Augusta Masters 98
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Harvest Moon 64
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Heiwa Pachinko World 64
+
F3DEX2.XX
+
3
+
Normal
+
Gfx errors
+
+
+
Hercules - The Legendary Journeys
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Minor gfx errors
+
+
+
Hexen
+
F3DEX1.XX
+
5
+
Normal
+
Compatible. Use "Read every frame" option (slow) to see texts
+ at objectives screen
+
+
+
Hey You, Pikachu!
+
F3DEX2.XX
+
3
+
Normal
+
Gfx errors (needs voice pak)
+
+
+
Hiryuu no Ken Twin
+
F3DEX1.XX
+
5
+
Normal
+
Compatible. Minor gfx errors
+
+
+
Holy Magic Century
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Hoshi no Kirby 64
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use Mupen for correct status bar
+
+
+
Hot Wheels Turbo Racing
+
F3DEX2.XX
+
5
+
Slow
+
Compatible
+
+
+
Human Grand Prix - New Generation
+
F3DEX1.XX
+
5
+
Normal
+
Compatible. Use "Read every frame" option (slow) or "Get
+ frame buffer info" with Mupen to have correct menu
+
+
+
Hybrid Heaven
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Hydro Thunder
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use PJ64
+
+
+
Ide Yosuke no Mahjong Juku
+
F3DEX1.XX
+
5
+
Normal
+
Compatible. Use Nemu 0.8 (disable audio HLE)
+
+
+
Iggy's Reckin' Balls
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Iggy-kun no Bura Bura Poyon
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
In-Fisherman Bass Hunter 64
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Indiana
+ Jones and the Infernal Machine
+
?
+
0
+
?
+
Unsupported. Microcode not implemented
+
+
+
Indy Racing 2000
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
International Superstar Soccer '98
+
F3DEX1.XX
+
5
+
Normal
+
Compatible.
+ Use “Read every frame” option to see correct effects after
+ scoring a goal
+
+
+
International Superstar Soccer 2000
+
F3DEX2.XX
+
5
+
Normal
+
Compatible.
+ Use “Read every frame” option to see correct effects after
+ scoring a goal
+
+
+
International Superstar Soccer 64
+
F3DEX1.XX
+
5
+
Normal
+
Compatible. Minor gfx errors
+
+
+
International Track & Field
+ 2000
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
International Track & Field Summer
+ Games
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
J. League Dynamite Soccer 64
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
J. League Eleven Beat 1997
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
J. League Live 64
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
J. League Tactics Soccer
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Jangou Simulation Mahjong Do 64
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Jeopardy!
+
RSP SW 2.0X
+
5
+
Normal
+
Compatible
+
+
+
Jeremy McGrath Supercross 2000
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Jet Force Gemini
+
RSP SW RARE4
+
5
+
Normal
+
Compatible
+
+
+
Jikkyou G1 Stable
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Jikkyou J. League 1999 - Perfect Striker
+ 2
+
F3DEX2.XX
+
5
+
Normal
+
Compatible.
+ Use “Read every frame” option to see correct effects after
+ scoring a goal
+
+
+
Jikkyou J. League Perfect Striker
+
RSP SW 2.0X
+
5
+
Normal
+
Compatible.
+ Use “Read every frame” option to see correct effects after
+ scoring a goal
+
+
+
Jikkyou Powerful Pro Yakyuu - Basic Han
+ 2001
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Jikkyou Powerful Pro Yakyuu 2000
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Jikkyou Powerful Pro Yakyuu 4
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Jikkyou Powerful Pro Yakyuu 5
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Jikkyou Powerful Pro Yakyuu 6
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Jikkyou World Cup France '98
+
RSP SW 2.0X
+
5
+
Normal
+
Compatible.
+ Use “Read every frame” option to see correct effects after
+ scoring a goal
+
+
+
Jikkyou World Soccer 3
+
RSP SW 2.0X
+
5
+
Normal
+
Compatible
+
+
+
Jinsei Game 64
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
John Romero's Daikatana
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Kakutou Denshou - F-Cup Maniax
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Ken Griffey Jr.'s Slugfest
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Killer Instinct Gold
+
RSP SW 2.0X
+
5
+
Fast
+
Compatible
+
+
+
King Hill 64 - Extreme Snowboarding
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Minor gfx errors.
+
+
+
Kiratto Kaiketsu! 64 Tanteidan
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Kirby 64 - The Crystal Shards
+
F3DEX2.XX
+
5
+
Fast
+
Compatible. Use Mupen for correct status bar
+
+
+
Knife Edge - Nose Gunner
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Knockout Kings 2000
+
F3DEX2.XX
+
5
+
Fast
+
Compatible. Use 1964. Minor gfx errors
+
+
+
Kobe
+ Bryant NBA Courtside
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Kuiki-Uhabi-Suigo
+
RSP SW 2.0X
+
2
+
Normal
+
Gfx errors
+
+
+
LEGO Racers
+
F3DEX2.XX
+
5
+
Depends
+
Compatible
+
+
+
Last Legion UX
+
?
+
0
+
?
+
Unsupported. Microcode
+ not implemented
+
+
+
Legend of Zelda, The - Ocarina of Time
+
F3DEX 2.06H
+
5
+
*Mostly* Fast
+
Compatible
+
+
+
Legend of Zelda 2, The - Majora's Mask
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Legend of Zelda, The - Ocarina of Time -
+ Master Quest
+
F3DEX 2.06H
+
5
+
*Mostly* Fast
+
Compatible
+
+
+
Les Razmoket - La Chasse aux Trésors
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Let's Smash Tennis
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Lode Runner 3-D
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Looney Tunes - Duck Dodgers
+
F3DEX2.XX
+
5
+
Slow
+
Compatible
+
+
+
Lylat Wars
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
MRC - Multi Racing Championship
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Mace - The Dark Age
+
F3DEX1.XX
+
5
+
Normal
+
Compatible.
+
+
+
Madden Football 64
+
F3DEX1.XX
+
5
+
Slow
+
Compatible
+
+
+
Madden NFL 2000
+
F3DEX1.XX
+
5
+
Slow
+
Compatible
+
+
+
Madden NFL 2001
+
F3DEX1.XX
+
5
+
Slow
+
Compatible
+
+
+
Madden NFL 2002
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Madden NFL 99
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Magical Tetris Challenge
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Mahjong 64
+
RSP SW 2.0X
+
5
+
Normal
+
Compatible
+
+
+
Mahjong Hourouki Classic
+
RSP SW 2.0X
+
5
+
Normal
+
Compatible
+
+
+
Mahjong Master
+
RSP SW 2.0X
+
5
+
Normal
+
Compatible. Minors gfx errors
+
+
+
Major League Baseball Featuring Ken
+ Griffey Jr.
+
F3DEX1.XX
+
3
+
Normal
+
Gfx errors
+
+
+
Mario Golf
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Mario
+ Kart 64
+
F3DEX1.XX
+
5
+
Fast
+
Compatible. Use “Read every frame” option (slow) or use
+ "Get frame buffer info" with Mupen to see correct billboards
+
+
+
Mario Party
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Mario Party 2
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Mario Party 3
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Mario Story
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Mario
+ Tennis
+
F3DEX2.XX
+
4
+
Unstable
+
Various gfx errors.
+
+
+
Mario No Photopie
+
?
+
0
+
?
+
Unsupported
+
+
+
Mega Man 64
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Mia Hamm Soccer
+
ZSortp 0.33
+
5
+
Fast
+
Compatible. Minors gfx errors
+
+
+
Michael Owens WLS 2000
+
ZSortp 0.33
+
5
+
Fast
+
Compatible. Minors gfx errors
+
+
+
Mickey no Racing Challenge USA
+
RSP SW RARE4
+
5
+
Fast
+
Compatible
+
+
+
Mickey's Speedway USA
+
RSP SW RARE4
+
5
+
Fast
+
Compatible
+
+
+
Micro Machines 64 Turbo
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Midway's Greatest Arcade Hits Volume 1
+
RSP SW 2.0X
+
3
+
Normal
+
Only few games are fully playable
+
+
+
Mike Piazza's Strike Zone
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Milo's Astro Lanes
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Mischief Makers
+
RSP SW 2.0X
+
5
+
Normal
+
Compatible
+
+
+
Mission
+ Impossible
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Monaco
+ Grand Prix
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use Mupen64
+
+
+
Monaco
+ Grand Prix - Racing Simulation 2
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use 1964
+
+
+
Monopoly
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Monster Truck Madness 64
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Morita Shougi 64
+
RSP SW 2.0X
+
5
+
Normal
+
Compatible
+
+
+
Mortal Kombat 4
+
F3DEX1.XX
+
5
+
Scene dependent
+
Compatible
+
+
+
Mortal Kombat Mythologies - Sub-Zero
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Mortal Kombat Trilogy
+
RSP SW 0.2X
+
5
+
Fast
+
Compatible
+
+
+
Ms. Pac-Man - Maze Madness
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Mystical Ninja 2 - Starring
+ Goemon
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Mystical Ninja - Starring Goemon
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
NASCAR 99
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
NASCAR 2000
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
NBA Courtside 2 - Featuring Kobe Bryant
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
NBA Hangtime
+
RSP SW 2.0X
+
5
+
Slow
+
Compatible
+
+
+
NBA In the Zone '98
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
NBA In the Zone '99
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
NBA In the Zone 2
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
NBA In the Zone 2000
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
NBA Jam 2000
+
F3DEX2.XX
+
5
+
Slow
+
Compatible
+
+
+
NBA Jam 99
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
NBA Live 2000
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
NBA Live 99
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
NBA Showtime - NBA on NBC
+
F3DEX2.XX
+
5
+
Slow
+
Compatible. Use PJ64
+
+
+
NFL Blitz
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
NFL Blitz - Special Edition
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
NFL Blitz 2000
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
NFL Blitz 2001
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
NFL Quarterback Club 2000
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use Nemu 0.8
+
+
+
NFL Quarterback Club 2001
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use Nemu 0.8
+
+
+
NFL Quarterback Club 98
+
F3DEX1.XX
+
5
+
Normal
+
Compatible. Use Mupen
+
+
+
NFL Quarterback Club 99
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use Nemu 0.8
+
+
+
NHL 99
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
NHL Blades of Steel '99
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
NHL Breakaway 98
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
NHL Breakaway 99
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
NHL Pro 99
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Nagano
+ Winter Olympics '98
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Namco
+ Museum 64
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Neon Genesis Evangelion
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
New Tetris, The
+
F3DEX2.XX
+
5
+
Normal
+
Compatible.
+ Use
+ Mupen
+
+
+
Nightmare Creatures
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use PJ64
+
+
+
Nintama Rantarou Gallery 64
+
S2DEX.XX
+
5
+
Slow
+
Compatible
+
+
+
Nintendo All-Star! Dairantou Smash
+ Brothers
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Nuclear Strike 64
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Nushi Zuri 64
+
F3DEX1.XX
+
5
+
Normal
+
Compatible. Use “Read every frame” option (slow) or use
+ "Get frame buffer info" with Mupen to have backgrounds in game
+
+
+
Nushi Zuri 64 - Shiokaze ni Notte
+
F3DEX2.XX
+
2
+
Normal
+
Missing gfx in game
+
+
+
O.D.T
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Off Road Challenge
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Ogre Battle 64 - Person of Lordly Caliber
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use PJ64 or 1964 0.8.5 (Win9X users must use 1964 0.8.5 or
+ Nemu 0.8, to get backgrounds). Use "Read every frame" option to see
+ screen transition effects (slow)
+
+
+
Olympic Hockey Nagano '98
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Onegai Monster
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Operation WinBack
+
F3DEX2.XX
+
5
+
Fast
+
Compatible, but a gray square sometimes appear on the screen. Missing
+ sky
+
+
+
PD Ultraman Battle Collection 64
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
PGA European Tour
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Minor gfx errors
+
+
+
Pachinko 365 Nichi
+
RSP SW 2.0X
+
2
+
Normal
+
Compatible
+
+
+
Paper Mario
+
F3DEX2.XX
+
5
+
Fast
+
Compatible. Minor gfx errors
+
+
+
Paperboy
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Parlor! Pro 64 Pachinko Jikki Simulation
+ Game
+
S2DEX.XX
+
5
+
Normal
+
Compatible
+
+
+
Penny Racers
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Perfect Dark
+
RSP SW PD
+
5
+
Slow
+
Compatible. Use "Read every frame" (slow) or "Get frame
+ buffer info" with Mupen to get correct pause menu in game
+
+
+
Pikachu Genki Dechu
+
F3DEX2.XX
+
3
+
Normal
+
Gfx errors (needs voice pak)
+
+
+
Pilot Wings
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Pocket
+ Monsters Snap
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use "Read every frame" option when selecting shots
+ for professor Oak
+
+
+
Pokemon Puzzle League
+
S2DEX.XX
+
5
+
Normal
+
Compatible
+
+
+
Pokemon Snap
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use "Read every frame" option when selecting shots
+ for professor Oak
+
+
+
Pokemon Stadium
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Pokemon Stadium 2
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Polaris SnoCross
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Power League Baseball 64
+
F3DEX2.XX
+
4
+
Normal
+
Compatible
+
+
+
Power Rangers - Lightspeed Rescue
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Powerpuff Girls, The - Chemical
+ X-traction
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Premier Manager 64
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Pro Mahjong Kiwame 64
+
RSP SW 2.0X
+
5
+
Normal
+
Compatible
+
+
+
Pro Majhong Tsuwamono 64
+
S2DEX.XX
+
5
+
Slow
+
Compatible
+
+
+
Puyo Puyo 4 - Puyo Puyo Party
+
S2DEX.XX
+
5
+
Normal
+
Compatible
+
+
+
Puyo Puyo Sun 64
+
RSP SW 2.0X
+
5
+
Normal
+
Compatible
+
+
+
Puzzle Bobble 64
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Quake 64
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Quake II
+
F3DEX1.XX
+
5
+
Normal
+
Compatible, Use "Read every frame" (slow) or "Get frame
+ buffer info" with Mupen to get correct pause menu in game
+
+
+
Quest 64
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
RR64 - Ridge Racer 64
+
F3DEX2.XX
+
5
+
Fast
+
Compatible. Pause menu doesn't work correctly with Voodoo 1-3
+
+
+
RTL World League Soccer 2000
+
ZSortp 0.33
+
5
+
Fast
+
Compatible. Minor gfx errors
+
+
+
Racing Simulation 2
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use 1964. Minor gfx errors
+
+
+
Rakuga Kids
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Rally '99
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Rally Challenge 2000
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Rampage - World Tour
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Rampage 2 - Universal Tour
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Rat Attack
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Rayman 2 - The Great Escape
+
F3DEX1.XX
+
5
+
Normal
+
Compatible. Use "Read every frame" option to see correct
+ transition effects in game
+
+
+
Razor Freestyle Scooter
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Re-Volt
+
F3DEX2.XX
+
5
+
Fast
+
Compatible. Use PJ64
+
+
+
Ready 2 Rumble Boxing
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Ready 2 Rumble Boxing Round 2
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Resident Evil 2
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Road Rash 64
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Roadsters
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Robotech
+ - Crystal Dreams (Beta)
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Robot Ponkottsu 64 - Caramel of the 7
+ Seas
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Robotron 64
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Rocket - Robot on Wheels
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Rockman Dash
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Rugrats - Scavenger Hunt
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Rugrats - Treasure Hunt
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Rugrats in Paris - The Movie
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Rush 2 - Extreme Racing USA
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
S.C.A.R.S.
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
SD Hiryuu no Ken Densetsu
+
F3DEX1.XX
+
5
+
Normal
+
Compatible. Minor gfx errors
+
+
+
San Francisco Rush - Extreme Racing
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
San Francisco Rush 2049
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Scooby-Doo - Classic Creep Capers
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Sky in game doesn't work correctly with Voodoo 1-3
+
+
+
Shadow Man
+
F3DEX2.XX
+
5
+
Normal
+
Compatible. Use "Read every frame" option (slow) or "Get
+ frame buffer info" with Mupen to have correct pause menu in game
+
+
+
Shadowgate 64 - Trials of the Four Towers
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Sim City 2000
+
S2DEX.XX
+
5
+
Normal
+
Compatible
+
+
+
Snow Speeders
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Snowboard Kids
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Snowboard Kids 2
+
F3DEX2.XX
+
5
+
Normal
+
Compatible
+
+
+
Sonic Wings Assault
+
RSP SW 2.0X
+
5
+
Slow
+
Compatible
+
+
+
South
+ Park
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
SouthPark - Chef's Luv Shack
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
South
+ Park Rally
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Space Dynamites
+
TURBO3D
+
5
+
Normal
+
Compatible
+
+
+
Space
+ Invaders
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Space Station Silicon Valley
+
F3DEX1.XX
+
5
+
Normal
+
Compatible
+
+
+
Spider-Man
+
F3DEX2.XX
+
5
+
Fast
+
Compatible
+
+
+
Star Fox 64
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Star Soldier - Vanishing Earth
+
F3DEX1.XX
+
5
+
Fast
+
Compatible
+
+
+
Star Twins
+
RSP SW RARE4
+
5
+
Normal
+
Compatible. Use "Get frame buffer info" option with Mupen or
+ use “Read every frame” option (slow) to see correct TV