Here's 0.9... again :D

This commit is contained in:
yabause 2009-01-04 00:38:23 +00:00
parent 39083243ed
commit d034a48b12
301 changed files with 10795 additions and 11413 deletions

View File

@ -1,11 +1,3 @@
0.9+
Graphics:
bug: Fix some errors in rendering 512 tall BG [zeromus,CrazyMax] (still not fully resolved)
bug: 3d compositing integrated into GPU engine (more precision and speed in cases where no compositing needed) [luigi__]
bug: Add optional fragment shading pipeline (more precision) [luigi__]
bug: fix texture mapping across texture banks [zeromus]
enh: dont memcmp for texcache validity when the texture banks arent unmapping [zeromus]
0.8 -> 0.9
There have been so many changes that this list can hardly be considered complete.
For this release, we have formatted the list into a high level overview of big changes and bad bugs relative to the previous release. Hopefully what you're interested in.
@ -47,7 +39,6 @@ Graphics:
. Move entire GE to core emu.
. Move OpenGL renderer to emu core for optional use by platforms, removing ogl_collector. Now every platform shares the same 3d code.
. Reorganize 3d code to defer rendering to after 3d vblank. Eliminates tearing, and texturing artifacts. [zeromus]
. Add optional fragment shading pipeline (more precision) [luigi__]
. Move lighting model to software instead of using opengl's fixed function model [zeromus]
. Render shadow volumes; toon shading and highlight table [zeromus, luigi__]
. Added texture caching! big speed up. [CrazyMax]
@ -64,7 +55,6 @@ Graphics:
bug: Add 3d layer h-scrolling [zeromus]
bug: Added transparency and fixed material alpha support and alpha testing on the 3D core [shash]
bug: Rewrite VRAM mapping control and rendering (more accurate) [CrazyMax,luigi__]
bug: convert colors to opengl better to prevent alpha=31 polys from being ever so slightly transparent [zeromus]
enh: Add MMU->GPU signal for when vram mappings change to function as a texture cache invalidate signal [zeromus]
enh: Make matrix 4x4 multiply routines use W-coordinate; carry w coord through pipeline [zeromus]

View File

View File

View File

@ -1,7 +1,7 @@
dnl --- Package name is first argument to AC_INIT
dnl --- Release version is second argument to AC_INIT
AC_INIT(desmume, [0.8])
AC_INIT(desmume, [0.9])
dnl -- find target architecture for some os specific libraries
AC_CANONICAL_TARGET
@ -55,19 +55,6 @@ dnl - Check for the OpenGL includes
AC_CHECK_HEADERS([GL/gl.h])
AC_CHECK_HEADERS([GL/glu.h])
dnl - if --enable-osmesa is used, check for it
AC_ARG_ENABLE(osmesa,
[AC_HELP_STRING(--enable-osmesa, use off-screen mesa)],
[
if test "x$enableval" = "xyes" ; then
AC_CHECK_LIB(OSMesa, main,[
useosmesa=yes
AC_DEFINE(HAVE_LIBOSMESA)
LIBS="-lOSMesa $LIBS"
])
fi
])
dnl - Check for GTK and/or libglade
GLIB_VER=2.8
GTK_VER=2.6
@ -92,14 +79,12 @@ AC_PROVIDE_IFELSE([PKG_PROG_PKG_CONFIG], [
AC_SUBST(GTK_CFLAGS)
AC_SUBST(GTK_LIBS)
if test ! "x$useosmesa" = "xyes" ; then
PKG_CHECK_MODULES(GTKGLEXT,
"gtkglext-1.0",
HAVE_GTKGLEXT=yes,
HAVE_GTKGLEXT=no)
AC_SUBST(GTKGLEXT_CFLAGS)
AC_SUBST(GTKGLEXT_LIBS)
fi
PKG_CHECK_MODULES(GTHREAD,
"gthread-2.0",
@ -143,9 +128,6 @@ if test "x$HAVE_SDL" = "xyes"; then
UI_DIR="gtk $UI_DIR"
fi
dnl - the glade port has a weird relation to gtkglext and doesn't
dnl - works yet with osmesa, feel free to fix it :)
if test ! "x$useosmesa" = "xyes" ; then
if test "x$HAVE_LIBGLADE" = "xyes"; then
AC_PROVIDE_IFELSE([IT_PROG_INTLTOOL],[
# libglade requires SDL too
@ -165,13 +147,12 @@ if test "x$HAVE_SDL" = "xyes"; then
echo "WARNING: intltool and/or gettext are not available therefore the gtk-glade interface won't be installed. The gtk-glade UI requires intltool and gettext."
])
fi
fi
fi
dnl Set compiler library flags per target.
case $target in
*linux* | *bsd*)
LIBS="$LIBS -lGLU"
LIBS="$LIBS -lGL -lGLU"
;;
*mingw*)
LIBS="$LIBS -ldxguid -ldxerr8 -ldsound -lopengl32 -lws2_32 -mwindows"

View File

@ -1,53 +0,0 @@
/*
Copyright (C) 2009 Guillaume Duhamel
This file is part of DeSmuME
DeSmuME 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.
DeSmuME 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 DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_LIBOSMESA
#include <GL/osmesa.h>
#include "../OGLRender.h"
#include <stdlib.h>
#include <stdio.h>
static bool osmesa_beginOpenGL(void) {
return 1;
}
static void osmesa_endOpenGL(void) {
}
static bool osmesa_init(void) {
return true;
}
int init_osmesa_3Demu(void) {
void * buffer;
OSMesaContext ctx;
ctx = OSMesaCreateContext(OSMESA_RGBA, NULL);
buffer = malloc(256 * 192 * 4);
OSMesaMakeCurrent(ctx, buffer, GL_UNSIGNED_BYTE, 256, 192);
oglrender_init = osmesa_init;
oglrender_beginOpenGL = osmesa_beginOpenGL;
oglrender_endOpenGL = osmesa_endOpenGL;
return 1;
}
#endif

View File

@ -1,23 +0,0 @@
/*
Copyright (C) 2009 Guillaume Duhamel
This file is part of DeSmuME
DeSmuME 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.
DeSmuME 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 DeSmuME; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifdef HAVE_LIBOSMESA
int init_osmesa_3Demu( void);
#endif

View File

@ -1,979 +0,0 @@
<?xml version="1.0" encoding="shift_jis"?>
<VisualStudioProject
ProjectType="Intel C++ Project"
Version="10.1"
Name="DeSmuME_Intel"
ProjectGUID="{01332293-C619-4B8F-AF74-CA839EE24731}"
VCNestedProjectGUID="{9F5F72A1-D3A5-4918-B460-E076B16D10A9}"
VCNestedProjectCRC32="40992972"
VCNestedProjectFileName="DeSmuME_Intel.vcproj">
<Platforms>
<Platform
Name="Win32"/>
<Platform
Name="x64"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32">
<Tool
Name="GeneralTool"
OutputDirectory="$(SolutionDir)\__bins"
IntermediateDirectory="$(SolutionDir)\.VS2008\$(ConfigurationName)\$(PlatformName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"/>
<Tool
Name="PreBuildEventTool"/>
<Tool
Name="CustomTool"/>
<Tool
Name="MASM"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="MidlCmplrTool"/>
<Tool
Name="CppCmplrTool"
Optimization="0"
InlineFunctionExpansion="0"
EnableIntrinsicFunctions="false"
FavorSizeOrSpeed="0"
EnableFiberSafeOptimizations="false"
WholeProgramOptimization="false"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;DEBUG\&quot;;WIN32;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX"
ExceptionHandling="1"
BufferSecurityCheck="false"
EnableEnhancedInstructionSet="0"
DebugInformationFormat="4"
CallingConvention="1"
CompileAs="0"/>
<Tool
Name="VCManagedResourceCompilerTool"/>
<Tool
Name="ResCmplrTool"/>
<Tool
Name="PreLinkEventTool"/>
<Tool
Name="LinkerTool"
AdditionalDependencies="vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib shlwapi.lib"
OutputFile="$(OutDir)\$(ProjectName)_debug.exe"
AdditionalLibraryDirectories=".\zlib123;.\zziplib"
GenerateDebugInformation="true"
GenerateMapFile="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"/>
<Tool
Name="VCALinkTool"/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="DeSmuME_x86.manifest"/>
<Tool
Name="VCXDCMakeTool"/>
<Tool
Name="BscMakeTool"/>
<Tool
Name="VCFxCopTool"/>
<Tool
Name="VCAppVerifierTool"/>
<Tool
Name="PostBuildEventTool"/>
</Configuration>
<Configuration
Name="Debug|x64">
<Tool
Name="GeneralTool"
OutputDirectory="$(SolutionDir)\__bins"
IntermediateDirectory="$(SolutionDir)\.VS2008\$(ConfigurationName)\$(PlatformName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"/>
<Tool
Name="PreBuildEventTool"/>
<Tool
Name="CustomTool"/>
<Tool
Name="MASM"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="MidlCmplrTool"
TargetEnvironment="3"/>
<Tool
Name="CppCmplrTool"
Optimization="0"
InlineFunctionExpansion="0"
EnableIntrinsicFunctions="false"
FavorSizeOrSpeed="0"
EnableFiberSafeOptimizations="false"
WholeProgramOptimization="false"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;DEBUG\&quot;;WIN32;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX"
ExceptionHandling="1"
BufferSecurityCheck="false"
EnableEnhancedInstructionSet="0"
DebugInformationFormat="3"
CallingConvention="1"
CompileAs="0"/>
<Tool
Name="VCManagedResourceCompilerTool"/>
<Tool
Name="ResCmplrTool"/>
<Tool
Name="PreLinkEventTool"/>
<Tool
Name="LinkerTool"
AdditionalDependencies="vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx.x64\dxguid.lib shell32.lib comdlg32.lib directx.x64\dxerr9.lib directx.x64\dsound.lib directx.x64\dinput8.lib directx.x64\ddraw.lib shlwapi.lib"
OutputFile="$(OutDir)\$(ProjectName)_x64_debug.exe"
AdditionalLibraryDirectories=".\zlib123;.\zziplib"
GenerateDebugInformation="true"
GenerateMapFile="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"/>
<Tool
Name="VCALinkTool"/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="DeSmuME_x86.manifest"/>
<Tool
Name="VCXDCMakeTool"/>
<Tool
Name="BscMakeTool"/>
<Tool
Name="VCFxCopTool"/>
<Tool
Name="VCAppVerifierTool"/>
<Tool
Name="PostBuildEventTool"/>
</Configuration>
<Configuration
Name="Release (SSE2)|Win32">
<Tool
Name="GeneralTool"
OutputDirectory="$(SolutionDir)\__bins"
IntermediateDirectory="$(SolutionDir)\.VS2008\$(ConfigurationName)\$(PlatformName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
WholeProgramOptimization="1"/>
<Tool
Name="PreBuildEventTool"/>
<Tool
Name="CustomTool"/>
<Tool
Name="MASM"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="MidlCmplrTool"/>
<Tool
Name="CppCmplrTool"
Optimization="1000"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;SSE2\&quot;;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX"
StringPooling="true"
ExceptionHandling="1"
StructMemberAlignment="0"
BufferSecurityCheck="false"
EnableEnhancedInstructionSet="2"
FloatingPointModel="2"
WarningLevel="1"
DebugInformationFormat="3"
CallingConvention="1"
CompileAs="0"
GlobalOptimizations="1"
OptimizeForWindowsApplication="1"
UseProcExt="5"
Parallelization="1"/>
<Tool
Name="VCManagedResourceCompilerTool"/>
<Tool
Name="ResCmplrTool"/>
<Tool
Name="PreLinkEventTool"/>
<Tool
Name="LinkerTool"
AdditionalDependencies="vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib shlwapi.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x32.lib zziplib-2008-x32.lib shlwapi.lib"
OutputFile="$(OutDir)\$(ProjectName)_sse2.exe"
AdditionalLibraryDirectories=".\zlib123;.\zziplib"
GenerateDebugInformation="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
Profile="false"/>
<Tool
Name="VCALinkTool"/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="DeSmuME_x86.manifest"/>
<Tool
Name="VCXDCMakeTool"/>
<Tool
Name="BscMakeTool"/>
<Tool
Name="VCFxCopTool"/>
<Tool
Name="VCAppVerifierTool"/>
<Tool
Name="PostBuildEventTool"/>
</Configuration>
<Configuration
Name="Release (SSE2)|x64">
<Tool
Name="GeneralTool"
OutputDirectory="$(SolutionDir)\__bins"
IntermediateDirectory="$(SolutionDir)\.VS2008\$(ConfigurationName)\$(PlatformName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
WholeProgramOptimization="1"/>
<Tool
Name="PreBuildEventTool"/>
<Tool
Name="CustomTool"/>
<Tool
Name="MASM"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="MidlCmplrTool"
TargetEnvironment="3"/>
<Tool
Name="CppCmplrTool"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;SSE2\&quot;;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;SSE2;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX"
StringPooling="true"
ExceptionHandling="1"
BufferSecurityCheck="false"
EnableEnhancedInstructionSet="0"
FloatingPointModel="2"
WarningLevel="1"
DebugInformationFormat="3"
CallingConvention="1"
CompileAs="0"/>
<Tool
Name="VCManagedResourceCompilerTool"/>
<Tool
Name="ResCmplrTool"/>
<Tool
Name="PreLinkEventTool"/>
<Tool
Name="LinkerTool"
AdditionalDependencies="vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx.x64\dxguid.lib shell32.lib comdlg32.lib shlwapi.lib directx.x64\dxerr9.lib directx.x64\dsound.lib directx.x64\dinput8.lib directx.x64\ddraw.lib zlib-2008-x64.lib zziplib-2008-x64.lib shlwapi.lib"
OutputFile="$(OutDir)\$(ProjectName)_x64_sse2.exe"
AdditionalLibraryDirectories=".\zlib123;.\zziplib"
GenerateDebugInformation="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
Profile="false"/>
<Tool
Name="VCALinkTool"/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="DeSmuME_x86.manifest"/>
<Tool
Name="VCXDCMakeTool"/>
<Tool
Name="BscMakeTool"/>
<Tool
Name="VCFxCopTool"/>
<Tool
Name="VCAppVerifierTool"/>
<Tool
Name="PostBuildEventTool"/>
</Configuration>
<Configuration
Name="Release|Win32">
<Tool
Name="GeneralTool"
OutputDirectory="$(SolutionDir)\__bins"
IntermediateDirectory="$(SolutionDir)\.VS2008\$(ConfigurationName)\$(PlatformName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
WholeProgramOptimization="1"/>
<Tool
Name="PreBuildEventTool"/>
<Tool
Name="CustomTool"/>
<Tool
Name="MASM"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="MidlCmplrTool"/>
<Tool
Name="CppCmplrTool"
Optimization="1000"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;\&quot;;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX"
StringPooling="true"
ExceptionHandling="1"
BufferSecurityCheck="false"
EnableEnhancedInstructionSet="0"
FloatingPointModel="2"
WarningLevel="1"
DebugInformationFormat="3"
CallingConvention="1"
CompileAs="0"
GlobalOptimizations="1"
OptimizeForWindowsApplication="1"
UseProcExt="3"
Parallelization="1"/>
<Tool
Name="VCManagedResourceCompilerTool"/>
<Tool
Name="ResCmplrTool"/>
<Tool
Name="PreLinkEventTool"/>
<Tool
Name="LinkerTool"
AdditionalDependencies="vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx\dxguid.lib shell32.lib comdlg32.lib directx\dxerr8.lib directx\dsound.lib directx\dinput8.lib directx\ddraw.lib zlib-2008-x32.lib zziplib-2008-x32.lib shlwapi.lib"
OutputFile="$(OutDir)\$(ProjectName).exe"
AdditionalLibraryDirectories=".\zlib123;.\zziplib"
GenerateDebugInformation="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
Profile="true"/>
<Tool
Name="VCALinkTool"/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="DeSmuME_x86.manifest"/>
<Tool
Name="VCXDCMakeTool"/>
<Tool
Name="BscMakeTool"/>
<Tool
Name="VCFxCopTool"/>
<Tool
Name="VCAppVerifierTool"/>
<Tool
Name="PostBuildEventTool"/>
</Configuration>
<Configuration
Name="Release|x64">
<Tool
Name="GeneralTool"
OutputDirectory="$(SolutionDir)\__bins"
IntermediateDirectory="$(SolutionDir)\.VS2008\$(ConfigurationName)\$(PlatformName)"
ConfigurationType="1"
InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
WholeProgramOptimization="1"/>
<Tool
Name="PreBuildEventTool"/>
<Tool
Name="CustomTool"/>
<Tool
Name="MASM"/>
<Tool
Name="VCXMLDataGeneratorTool"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="MidlCmplrTool"
TargetEnvironment="3"/>
<Tool
Name="CppCmplrTool"
Optimization="2"
InlineFunctionExpansion="2"
EnableIntrinsicFunctions="true"
FavorSizeOrSpeed="1"
OmitFramePointers="true"
EnableFiberSafeOptimizations="true"
WholeProgramOptimization="true"
AdditionalIncludeDirectories=".;..;.\zlib123;.\zziplib"
PreprocessorDefinitions="_CRT_SECURE_NO_DEPRECATE;VERSION=\&quot;\&quot;;WIN32;HAVE_LIBZ;HAVE_LIBZZIP;BETA_VERSION;SPU_INTERPOLATE;NOMINMAX"
StringPooling="true"
ExceptionHandling="1"
BufferSecurityCheck="false"
EnableEnhancedInstructionSet="0"
FloatingPointModel="2"
WarningLevel="1"
DebugInformationFormat="3"
CallingConvention="1"
CompileAs="0"/>
<Tool
Name="VCManagedResourceCompilerTool"/>
<Tool
Name="ResCmplrTool"/>
<Tool
Name="PreLinkEventTool"/>
<Tool
Name="LinkerTool"
AdditionalDependencies="vfw32.lib winmm.lib comctl32.lib opengl32.lib glu32.lib ws2_32.lib user32.lib gdi32.lib directx.x64\dxguid.lib shell32.lib comdlg32.lib directx.x64\dxerr9.lib directx.x64\dsound.lib directx.x64\dinput8.lib directx.x64\ddraw.lib zlib-2008-x64.lib zziplib-2008-x64.lib shlwapi.lib"
OutputFile="$(OutDir)\$(ProjectName)_x64.exe"
AdditionalLibraryDirectories=".\zlib123;.\zziplib"
GenerateDebugInformation="true"
RandomizedBaseAddress="1"
DataExecutionPrevention="0"
TargetMachine="17"
Profile="true"/>
<Tool
Name="VCALinkTool"/>
<Tool
Name="VCManifestTool"
AdditionalManifestFiles="DeSmuME_x86.manifest"/>
<Tool
Name="VCXDCMakeTool"/>
<Tool
Name="BscMakeTool"/>
<Tool
Name="VCFxCopTool"/>
<Tool
Name="VCAppVerifierTool"/>
<Tool
Name="PostBuildEventTool"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<Filter
Name="core">
<File
RelativePath="..\arm_instructions.cpp">
</File>
<File
RelativePath="..\armcpu.cpp">
</File>
<File
RelativePath="..\bios.cpp">
</File>
<File
RelativePath="..\cflash.cpp">
</File>
<File
RelativePath="..\common.cpp">
</File>
<File
RelativePath="..\cp15.cpp">
</File>
<File
RelativePath="..\debug.cpp">
</File>
<File
RelativePath="..\Disassembler.cpp">
</File>
<File
RelativePath="..\FIFO.cpp">
</File>
<File
RelativePath="..\gfx3d.cpp">
</File>
<File
RelativePath="..\GPU.cpp">
</File>
<File
RelativePath="..\GPU_OSD.cpp">
</File>
<File
RelativePath="..\matrix.cpp">
</File>
<File
RelativePath="..\mc.cpp">
</File>
<File
RelativePath="..\MMU.cpp">
</File>
<File
RelativePath="..\NDSSystem.cpp">
</File>
<File
RelativePath="..\OGLRender.cpp">
</File>
<File
RelativePath="..\readwrite.cpp">
</File>
<File
RelativePath="..\render3D.cpp">
</File>
<File
RelativePath="..\ROMReader.cpp">
</File>
<File
RelativePath="..\rtc.cpp">
</File>
<File
RelativePath="..\saves.cpp">
</File>
<File
RelativePath="..\softrender.cpp">
</File>
<File
RelativePath="..\SPU.cpp">
</File>
<File
RelativePath="..\thumb_instructions.cpp">
</File>
<File
RelativePath="..\wifi.cpp">
</File>
<Filter
Name="utils">
<File
RelativePath="..\utils\ConvertUTF.c">
</File>
<File
RelativePath="..\utils\ConvertUTF.h">
</File>
<File
RelativePath="..\utils\guid.cpp">
</File>
<File
RelativePath="..\utils\guid.h">
</File>
<File
RelativePath="..\utils\md5.cpp">
</File>
<File
RelativePath="..\utils\md5.h">
</File>
<File
RelativePath="..\utils\valuearray.h">
</File>
<File
RelativePath="..\utils\xstring.cpp">
</File>
<File
RelativePath="..\utils\xstring.h">
</File>
<Filter
Name="decrypt">
<File
RelativePath="..\utils\decrypt\crc.cpp">
</File>
<File
RelativePath="..\utils\decrypt\crc.h">
</File>
<File
RelativePath="..\utils\decrypt\decrypt.cpp">
</File>
<File
RelativePath="..\utils\decrypt\decrypt.h">
</File>
<File
RelativePath="..\utils\decrypt\header.cpp">
</File>
<File
RelativePath="..\utils\decrypt\header.h">
</File>
</Filter>
</Filter>
<Filter
Name="asm">
<File
RelativePath="..\matrix_sse2-x64.asm">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="GeneralTool"
ExcludedFromBuild="true"/>
<Tool
Name="CustomTool"
Description="Assembling x64..."
CommandLine="ml64 /nologo /c /Zi /Fo&quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#xA;"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64">
<Tool
Name="GeneralTool"
ExcludedFromBuild="true"/>
<Tool
Name="CustomTool"
Description="Assembling x64..."
CommandLine="ml64 /nologo /c /Zi /Fo&quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#xA;"/>
</FileConfiguration>
<FileConfiguration
Name="Release (SSE2)|Win32">
<Tool
Name="GeneralTool"
ExcludedFromBuild="true"/>
<Tool
Name="CustomTool"
Description="Assembling x64..."
CommandLine="ml64 /nologo /c /Zi /Fo&quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#xA;"
Outputs="$(IntDir)\$(InputName).obj"/>
</FileConfiguration>
<FileConfiguration
Name="Release (SSE2)|x64">
<Tool
Name="CustomTool"
Description="Assembling x64..."
CommandLine="ml64 /nologo /c /Zi /Fo&quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#xA;"
Outputs="$(IntDir)\$(InputName).obj"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="GeneralTool"
ExcludedFromBuild="true"/>
<Tool
Name="CustomTool"
Description="Assembling x64..."
CommandLine="ml64 /nologo /c /Zi /Fo&quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#xA;"
Outputs="$(IntDir)\$(InputName).obj"/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64">
<Tool
Name="GeneralTool"
ExcludedFromBuild="true"/>
<Tool
Name="CustomTool"
Description="Assembling x64..."
CommandLine="ml64 /nologo /c /Zi /Fo&quot;$(IntDir)\$(InputName).obj&quot; &quot;$(InputPath)&quot;&#xA;"
Outputs="$(IntDir)\$(InputName).obj"/>
</FileConfiguration>
</File>
<File
RelativePath="..\matrix_sse2-x86.asm">
<FileConfiguration
Name="Debug|Win32">
<Tool
Name="GeneralTool"
ExcludedFromBuild="true"/>
<Tool
Name="MASM"/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64">
<Tool
Name="GeneralTool"
ExcludedFromBuild="true"/>
<Tool
Name="MASM"/>
</FileConfiguration>
<FileConfiguration
Name="Release (SSE2)|x64">
<Tool
Name="GeneralTool"
ExcludedFromBuild="true"/>
<Tool
Name="MASM"/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32">
<Tool
Name="GeneralTool"
ExcludedFromBuild="true"/>
<Tool
Name="MASM"/>
</FileConfiguration>
<FileConfiguration
Name="Release|x64">
<Tool
Name="GeneralTool"
ExcludedFromBuild="true"/>
<Tool
Name="MASM"/>
</FileConfiguration>
</File>
</Filter>
</Filter>
<Filter
Name="windows">
<File
RelativePath=".\AboutBox.cpp">
</File>
<File
RelativePath=".\aviout.cpp">
</File>
<File
RelativePath=".\colorctrl.cpp">
</File>
<File
RelativePath=".\console.cpp">
</File>
<File
RelativePath=".\CWindow.cpp">
</File>
<File
RelativePath=".\disView.cpp">
</File>
<File
RelativePath=".\FirmConfig.cpp">
</File>
<File
RelativePath=".\ginfo.cpp">
</File>
<File
RelativePath=".\inputdx.cpp">
</File>
<File
RelativePath=".\IORegView.cpp">
</File>
<File
RelativePath=".\lightView.cpp">
</File>
<File
RelativePath=".\main.cpp">
</File>
<File
RelativePath=".\mapView.cpp">
</File>
<File
RelativePath=".\matrixView.cpp">
</File>
<File
RelativePath=".\memView.cpp">
</File>
<File
RelativePath=".\oamView.cpp">
</File>
<File
RelativePath=".\ogl.cpp">
</File>
<File
RelativePath=".\palView.cpp">
</File>
<File
RelativePath=".\snddx.cpp">
</File>
<File
RelativePath=".\throttle.cpp">
</File>
<File
RelativePath=".\tileView.cpp">
</File>
</Filter>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}">
<File
RelativePath="..\font_eng.inc">
</File>
<File
RelativePath="..\instruction_tabdef.inc">
</File>
<File
RelativePath="..\shaders.h">
</File>
<File
RelativePath="..\thumb_tabdef.inc">
</File>
<Filter
Name="windows">
<File
RelativePath=".\AboutBox.h">
</File>
<File
RelativePath=".\colorctrl.h">
</File>
<File
RelativePath=".\console.h">
</File>
<File
RelativePath=".\CWindow.h">
</File>
<File
RelativePath=".\disView.h">
</File>
<File
RelativePath=".\FirmConfig.h">
</File>
<File
RelativePath=".\ginfo.h">
</File>
<File
RelativePath=".\inputdx.h">
</File>
<File
RelativePath=".\IORegView.h">
</File>
<File
RelativePath=".\lightView.h">
</File>
<File
RelativePath=".\mapView.h">
</File>
<File
RelativePath=".\matrixView.h">
</File>
<File
RelativePath=".\memView.h">
</File>
<File
RelativePath=".\oamView.h">
</File>
<File
RelativePath=".\palView.h">
</File>
<File
RelativePath=".\resource.h">
</File>
<File
RelativePath=".\snddx.h">
</File>
<File
RelativePath=".\throttle.h">
</File>
<File
RelativePath=".\tileView.h">
</File>
</Filter>
<Filter
Name="core">
<File
RelativePath="..\ARM9.h">
</File>
<File
RelativePath="..\arm_instructions.h">
</File>
<File
RelativePath="..\armcpu.h">
</File>
<File
RelativePath="..\bios.h">
</File>
<File
RelativePath="..\bits.h">
</File>
<File
RelativePath="..\cflash.h">
</File>
<File
RelativePath="..\common.h">
</File>
<File
RelativePath="..\cp15.h">
</File>
<File
RelativePath="..\debug.h">
</File>
<File
RelativePath="..\Disassembler.h">
</File>
<File
RelativePath="..\dscard.h">
</File>
<File
RelativePath="..\fat.h">
</File>
<File
RelativePath="..\FIFO.h">
</File>
<File
RelativePath="..\fs-windows.cpp">
</File>
<File
RelativePath="..\fs.h">
</File>
<File
RelativePath="..\gdbstub.h">
</File>
<File
RelativePath="..\gfx3d.h">
</File>
<File
RelativePath="..\gl_vertex.h">
</File>
<File
RelativePath="..\GPU.h">
</File>
<File
RelativePath="..\GPU_osd.h">
</File>
<File
RelativePath="..\matrix.h">
</File>
<File
RelativePath="..\mc.h">
</File>
<File
RelativePath="..\mem.h">
</File>
<File
RelativePath="..\memorystream.h">
</File>
<File
RelativePath="..\MMU.h">
</File>
<File
RelativePath="..\NDSSystem.h">
</File>
<File
RelativePath="..\OGLRender.h">
</File>
<File
RelativePath="..\readwrite.h">
</File>
<File
RelativePath="..\registers.h">
</File>
<File
RelativePath="..\render3D.h">
</File>
<File
RelativePath="..\ROMReader.h">
</File>
<File
RelativePath="..\rtc.h">
</File>
<File
RelativePath="..\saves.h">
</File>
<File
RelativePath="..\softrender.h">
</File>
<File
RelativePath="..\softrender_config.h">
</File>
<File
RelativePath="..\SPU.h">
</File>
<File
RelativePath="..\thumb_instructions.h">
</File>
<File
RelativePath="..\types.h">
</File>
<File
RelativePath="..\wifi.h">
</File>
</Filter>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}">
<File
RelativePath=".\DeSmuME.ico">
</File>
<File
RelativePath=".\resources.rc">
</File>
</Filter>
</Files>
</VisualStudioProject>

View File

@ -1,44 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 10.00
# Visual Studio 2008
Project("{EAF909A5-FA59-4C3D-9431-0FCC20D5BCF9}") = "DeSmuME_Intel", "DeSmuME_Intel.icproj", "{01332293-C619-4B8F-AF74-CA839EE24731}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release (SSE2)|Win32 = Release (SSE2)|Win32
Release (SSE2)|x64 = Release (SSE2)|x64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{01332293-C619-4B8F-AF74-CA839EE24731}.Debug|Win32.ActiveCfg = Debug|Win32
{01332293-C619-4B8F-AF74-CA839EE24731}.Debug|Win32.Build.0 = Debug|Win32
{01332293-C619-4B8F-AF74-CA839EE24731}.Debug|x64.ActiveCfg = Debug|x64
{01332293-C619-4B8F-AF74-CA839EE24731}.Debug|x64.Build.0 = Debug|x64
{01332293-C619-4B8F-AF74-CA839EE24731}.Release (SSE2)|Win32.ActiveCfg = Release (SSE2)|Win32
{01332293-C619-4B8F-AF74-CA839EE24731}.Release (SSE2)|Win32.Build.0 = Release (SSE2)|Win32
{01332293-C619-4B8F-AF74-CA839EE24731}.Release (SSE2)|x64.ActiveCfg = Release (SSE2)|x64
{01332293-C619-4B8F-AF74-CA839EE24731}.Release (SSE2)|x64.Build.0 = Release (SSE2)|x64
{01332293-C619-4B8F-AF74-CA839EE24731}.Release|Win32.ActiveCfg = Release|Win32
{01332293-C619-4B8F-AF74-CA839EE24731}.Release|Win32.Build.0 = Release|Win32
{01332293-C619-4B8F-AF74-CA839EE24731}.Release|x64.ActiveCfg = Release|x64
{01332293-C619-4B8F-AF74-CA839EE24731}.Release|x64.Build.0 = Release|x64
{9F5F72A1-D3A5-4918-B460-E076B16D10A9}.Release|x64.Build.0 = Release|x64
{9F5F72A1-D3A5-4918-B460-E076B16D10A9}.Release|x64.ActiveCfg = Release|x64
{9F5F72A1-D3A5-4918-B460-E076B16D10A9}.Release|Win32.Build.0 = Release|Win32
{9F5F72A1-D3A5-4918-B460-E076B16D10A9}.Release|Win32.ActiveCfg = Release|Win32
{9F5F72A1-D3A5-4918-B460-E076B16D10A9}.Release (SSE2)|x64.Build.0 = Release (SSE2)|x64
{9F5F72A1-D3A5-4918-B460-E076B16D10A9}.Release (SSE2)|x64.ActiveCfg = Release (SSE2)|x64
{9F5F72A1-D3A5-4918-B460-E076B16D10A9}.Release (SSE2)|Win32.Build.0 = Release (SSE2)|Win32
{9F5F72A1-D3A5-4918-B460-E076B16D10A9}.Release (SSE2)|Win32.ActiveCfg = Release (SSE2)|Win32
{9F5F72A1-D3A5-4918-B460-E076B16D10A9}.Debug|x64.Build.0 = Debug|x64
{9F5F72A1-D3A5-4918-B460-E076B16D10A9}.Debug|x64.ActiveCfg = Debug|x64
{9F5F72A1-D3A5-4918-B460-E076B16D10A9}.Debug|Win32.Build.0 = Debug|Win32
{9F5F72A1-D3A5-4918-B460-E076B16D10A9}.Debug|Win32.ActiveCfg = Debug|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@ -139,51 +139,31 @@ NULL
};
//static BOOL setFinalColorDirect (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
static BOOL setFinalBGColorSpecialNone (GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
static BOOL setFinalBGColorSpecialBlend (GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
static BOOL setFinalBGColorSpecialIncrease (GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
static BOOL setFinalBGColorSpecialDecrease (GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
static BOOL setFinalColorSpecialNone (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
static BOOL setFinalColorSpecialBlend (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
static BOOL setFinalColorSpecialIncrease (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
static BOOL setFinalColorSpecialDecrease (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
//static BOOL setFinalColorDirectWnd (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
static BOOL setFinalBGColorSpecialNoneWnd (GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
static BOOL setFinalBGColorSpecialBlendWnd (GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
static BOOL setFinalBGColorSpecialIncreaseWnd (GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
static BOOL setFinalBGColorSpecialDecreaseWnd (GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
static BOOL setFinal3DColorSpecialNone (GPU *gpu, u32 passing, u8 *dst, u16 color, u8 alpha, u16 x, u16 y);
static BOOL setFinal3DColorSpecialBlend (GPU *gpu, u32 passing, u8 *dst, u16 color, u8 alpha, u16 x, u16 y);
static BOOL setFinal3DColorSpecialIncrease (GPU *gpu, u32 passing, u8 *dst, u16 color, u8 alpha, u16 x, u16 y);
static BOOL setFinal3DColorSpecialDecrease (GPU *gpu, u32 passing, u8 *dst, u16 color, u8 alpha, u16 x, u16 y);
static BOOL setFinal3DColorSpecialNoneWnd (GPU *gpu, u32 passing, u8 *dst, u16 color, u8 alpha, u16 x, u16 y);
static BOOL setFinal3DColorSpecialBlendWnd (GPU *gpu, u32 passing, u8 *dst, u16 color, u8 alpha, u16 x, u16 y);
static BOOL setFinal3DColorSpecialIncreaseWnd (GPU *gpu, u32 passing, u8 *dst, u16 color, u8 alpha, u16 x, u16 y);
static BOOL setFinal3DColorSpecialDecreaseWnd (GPU *gpu, u32 passing, u8 *dst, u16 color, u8 alpha, u16 x, u16 y);
static BOOL setFinalColorSpecialNoneWnd (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
static BOOL setFinalColorSpecialBlendWnd (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
static BOOL setFinalColorSpecialIncreaseWnd (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
static BOOL setFinalColorSpecialDecreaseWnd (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
typedef BOOL (*FinalBGColFunct)(GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
typedef BOOL (*Final3DColFunct)(GPU *gpu, u32 passing, u8 *dst, u16 color, u8 alpha, u16 x, u16 y);
typedef BOOL (*FinalColFunct)(const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
FinalBGColFunct pixelBlittersBG[8] = { //setFinalColorDirect,
setFinalBGColorSpecialNone,
setFinalBGColorSpecialBlend,
setFinalBGColorSpecialIncrease,
setFinalBGColorSpecialDecrease,
FinalColFunct pixelBlitters[8] = { //setFinalColorDirect,
setFinalColorSpecialNone,
setFinalColorSpecialBlend,
setFinalColorSpecialIncrease,
setFinalColorSpecialDecrease,
//setFinalColorDirectWnd,
setFinalBGColorSpecialNoneWnd,
setFinalBGColorSpecialBlendWnd,
setFinalBGColorSpecialIncreaseWnd,
setFinalBGColorSpecialDecreaseWnd};
Final3DColFunct pixelBlitters3D[8] = {
setFinal3DColorSpecialNone,
setFinal3DColorSpecialBlend,
setFinal3DColorSpecialIncrease,
setFinal3DColorSpecialDecrease,
setFinal3DColorSpecialNoneWnd,
setFinal3DColorSpecialBlendWnd,
setFinal3DColorSpecialIncreaseWnd,
setFinal3DColorSpecialDecreaseWnd};
setFinalColorSpecialNoneWnd,
setFinalColorSpecialBlendWnd,
setFinalColorSpecialIncreaseWnd,
setFinalColorSpecialDecreaseWnd};
u16 fadeInColors[17][0x8000];
u16 fadeOutColors[17][0x8000];
@ -192,73 +172,49 @@ u16 fadeOutColors[17][0x8000];
// INITIALIZATION
/*****************************************************************************/
static void GPU_InitFadeColors()
{
/*
NOTE: gbatek (in the reference above) seems to expect 6bit values
per component, but as desmume works with 5bit per component,
we use 31 as top, instead of 63. Testing it on a few games,
using 63 seems to give severe color wraping, and 31 works
nicely, so for now we'll just that, until proven wrong.
i have seen pics of pokemon ranger getting white with 31, with 63 it is nice.
it could be pb of alpha or blending or...
MightyMax> created a test NDS to check how the brightness values work,
and 31 seems to be correct. FactorEx is a override for max brighten/darken
See: http://mightymax.org/gfx_test_brightness.nds
The Pokemon Problem could be a problem with 8/32 bit writes not recognized yet,
i'll add that so you can check back.
*/
for(int i = 0; i <= 16; i++)
{
for(int j = 0x8000; j < 0x10000; j++)
{
COLOR cur;
cur.val = j;
cur.bits.red = (cur.bits.red + ((31 - cur.bits.red) * i / 16));
cur.bits.green = (cur.bits.green + ((31 - cur.bits.green) * i / 16));
cur.bits.blue = (cur.bits.blue + ((31 - cur.bits.blue) * i / 16));
fadeInColors[i][j & 0x7FFF] = cur.val;
cur.val = j;
cur.bits.red = (cur.bits.red - (cur.bits.red * i / 16));
cur.bits.green = (cur.bits.green - (cur.bits.green * i / 16));
cur.bits.blue = (cur.bits.blue - (cur.bits.blue * i / 16));
fadeOutColors[i][j & 0x7FFF] = cur.val;
}
}
}
GPU * GPU_Init(u8 l)
{
GPU * g;
int i, j;
if ((g = (GPU *) malloc(sizeof(GPU))) == NULL)
return NULL;
GPU * g;
GPU_Reset(g, l);
GPU_InitFadeColors();
if ((g = (GPU *) malloc(sizeof(GPU))) == NULL)
return NULL;
g->setFinalColorBck = setFinalBGColorSpecialNone;
g->setFinalColorSpr = setFinalBGColorSpecialNone;
g->setFinalColor3D = setFinal3DColorSpecialNone;
GPU_Reset(g, l);
return g;
for(i = 0; i <= 16; i++)
{
for(j = 0x8000; j < 0x10000; j++)
{
COLOR cur;
cur.val = j;
cur.bits.red = (cur.bits.red + ((31 - cur.bits.red) * i / 16));
cur.bits.green = (cur.bits.green + ((31 - cur.bits.green) * i / 16));
cur.bits.blue = (cur.bits.blue + ((31 - cur.bits.blue) * i / 16));
fadeInColors[i][j & 0x7FFF] = cur.val;
cur.val = j;
cur.bits.red = (cur.bits.red - (cur.bits.red * i / 16));
cur.bits.green = (cur.bits.green - (cur.bits.green * i / 16));
cur.bits.blue = (cur.bits.blue - (cur.bits.blue * i / 16));
fadeOutColors[i][j & 0x7FFF] = cur.val;
}
}
g->setFinalColorBck = setFinalColorSpecialNone;
g->setFinalColorSpr = setFinalColorSpecialNone;
return g;
}
void GPU_Reset(GPU *g, u8 l)
{
memset(g, 0, sizeof(GPU));
g->setFinalColorBck = setFinalBGColorSpecialNone;
g->setFinalColorSpr = setFinalBGColorSpecialNone;
g->setFinalColor3D = setFinal3DColorSpecialNone;
g->setFinalColorBck = setFinalColorSpecialNone;
g->setFinalColorSpr = setFinalColorSpecialNone;
g->core = l;
g->BGSize[0][0] = g->BGSize[1][0] = g->BGSize[2][0] = g->BGSize[3][0] = 256;
g->BGSize[0][1] = g->BGSize[1][1] = g->BGSize[2][1] = g->BGSize[3][1] = 256;
@ -363,9 +319,8 @@ void SetupFinalPixelBlitter (GPU *gpu)
u8 windowUsed = (gpu->WIN0_ENABLED | gpu->WIN1_ENABLED | gpu->WINOBJ_ENABLED);
u8 blendMode = (gpu->BLDCNT >> 6)&3;
gpu->setFinalColorSpr = pixelBlittersBG[windowUsed*4 + blendMode];
gpu->setFinalColorBck = pixelBlittersBG[windowUsed*4 + blendMode];
gpu->setFinalColor3D = pixelBlitters3D[windowUsed*4 + blendMode];
gpu->setFinalColorSpr = pixelBlitters[windowUsed*4 + blendMode];
gpu->setFinalColorBck = pixelBlitters[windowUsed*4 + blendMode];
}
/* Sets up LCD control variables for Display Engines A and B for quick reading */
@ -580,10 +535,10 @@ static INLINE void renderline_checkWindows(const GPU *gpu, u8 bgnum, u16 x, u16
}
/*****************************************************************************/
// PIXEL RENDERING - BGS
// PIXEL RENDERING
/*****************************************************************************/
static BOOL setFinalBGColorSpecialNone (GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y)
static BOOL setFinalColorSpecialNone (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y)
{
//sprwin test hack - use this code
//BOOL windowDraw = TRUE, windowEffect = TRUE;
@ -592,11 +547,10 @@ static BOOL setFinalBGColorSpecialNone (GPU *gpu, u32 passing, u8 bgnum, u8 *dst
//return 1;
T2WriteWord(dst, passing, color);
gpu->bgPixels[x] = bgnum;
return 1;
}
static BOOL setFinalBGColorSpecialBlend (GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y)
static BOOL setFinalColorSpecialBlend (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y)
{
if ((gpu->BLDCNT >> bgnum)&1 && gpu->BLDALPHA_EVA)
{
@ -627,18 +581,16 @@ static BOOL setFinalBGColorSpecialBlend (GPU *gpu, u32 passing, u8 bgnum, u8 *ds
color = (sourceR & 0x1F) | ((sourceG & 0x1F) << 5) | ((sourceB & 0x1F) << 10) | 0x8000 ;
T2WriteWord(dst, passing, color);
gpu->bgPixels[x] = bgnum;
}
else
{
T2WriteWord(dst, passing, color);
gpu->bgPixels[x] = bgnum;
}
return 1;
}
static BOOL setFinalBGColorSpecialIncrease (GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y)
static BOOL setFinalColorSpecialIncrease (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y)
{
if ((gpu->BLDCNT >> bgnum)&1) // the bg to draw has a special color effect
{
@ -658,18 +610,16 @@ static BOOL setFinalBGColorSpecialIncrease (GPU *gpu, u32 passing, u8 bgnum, u8
}
T2WriteWord(dst, passing, color) ;
gpu->bgPixels[x] = bgnum;
}
else
{
T2WriteWord(dst, passing, color);
gpu->bgPixels[x] = bgnum;
}
return 1;
}
static BOOL setFinalBGColorSpecialDecrease (GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y)
static BOOL setFinalColorSpecialDecrease (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y)
{
if ((gpu->BLDCNT >> bgnum)&1) // the bg to draw has a special color effect
{
@ -688,18 +638,16 @@ static BOOL setFinalBGColorSpecialDecrease (GPU *gpu, u32 passing, u8 bgnum, u8
color = (fadeOutColors[gpu->BLDY_EVY][color&0x7FFF] | 0x8000);
}
T2WriteWord(dst, passing, color) ;
gpu->bgPixels[x] = bgnum;
}
else
{
T2WriteWord(dst, passing, color);
gpu->bgPixels[x] = bgnum;
}
return 1;
}
static BOOL setFinalBGColorSpecialNoneWnd (GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y)
static BOOL setFinalColorSpecialNoneWnd (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y)
{
BOOL windowDraw = TRUE, windowEffect = TRUE;
@ -708,21 +656,17 @@ static BOOL setFinalBGColorSpecialNoneWnd (GPU *gpu, u32 passing, u8 bgnum, u8 *
if (((gpu->BLDCNT >> bgnum)&1) && windowEffect) // the bg to draw has a special color effect
{
T2WriteWord(dst, passing, color);
gpu->bgPixels[x] = bgnum;
}
else
{
if ((windowEffect && (gpu->BLDCNT & (0x100 << bgnum))) || windowDraw)
{
T2WriteWord(dst, passing, color);
gpu->bgPixels[x] = bgnum;
}
}
return windowDraw;
}
static BOOL setFinalBGColorSpecialBlendWnd (GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y)
static BOOL setFinalColorSpecialBlendWnd (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y)
{
BOOL windowDraw = TRUE, windowEffect = TRUE;
@ -758,21 +702,17 @@ static BOOL setFinalBGColorSpecialBlendWnd (GPU *gpu, u32 passing, u8 bgnum, u8
color = (sourceR & 0x1F) | ((sourceG & 0x1F) << 5) | ((sourceB & 0x1F) << 10) | 0x8000 ;
T2WriteWord(dst, passing, color);
gpu->bgPixels[x] = bgnum;
}
else
{
if ((windowEffect && (gpu->BLDCNT & (0x100 << bgnum))) || windowDraw)
{
T2WriteWord(dst, passing, color);
gpu->bgPixels[x] = bgnum;
}
}
return windowDraw;
}
static BOOL setFinalBGColorSpecialIncreaseWnd (GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y)
static BOOL setFinalColorSpecialIncreaseWnd (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y)
{
BOOL windowDraw = TRUE, windowEffect = TRUE;
@ -796,21 +736,17 @@ static BOOL setFinalBGColorSpecialIncreaseWnd (GPU *gpu, u32 passing, u8 bgnum,
}
T2WriteWord(dst, passing, color) ;
gpu->bgPixels[x] = bgnum;
}
else
{
if ((windowEffect && (gpu->BLDCNT & (0x100 << bgnum))) || windowDraw)
{
T2WriteWord(dst, passing, color);
gpu->bgPixels[x] = bgnum;
}
}
return windowDraw;
}
static BOOL setFinalBGColorSpecialDecreaseWnd (GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y)
static BOOL setFinalColorSpecialDecreaseWnd (const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y)
{
BOOL windowDraw = TRUE, windowEffect = TRUE;
@ -833,241 +769,11 @@ static BOOL setFinalBGColorSpecialDecreaseWnd (GPU *gpu, u32 passing, u8 bgnum,
color = (fadeOutColors[gpu->BLDY_EVY][color&0x7FFF] | 0x8000);
}
T2WriteWord(dst, passing, color) ;
gpu->bgPixels[x] = bgnum;
}
else
{
if ((windowEffect && (gpu->BLDCNT & (0x100 << bgnum))) || windowDraw)
{
T2WriteWord(dst, passing, color);
gpu->bgPixels[x] = bgnum;
}
}
return windowDraw;
}
/*****************************************************************************/
// PIXEL RENDERING - 3D
/*****************************************************************************/
static BOOL setFinal3DColorSpecialNone(GPU *gpu, u32 passing, u8 *dst, u16 color, u8 alpha, u16 x, u16 y)
{
T2WriteWord(dst, passing, (color | 0x8000));
return 1;
}
static BOOL setFinal3DColorSpecialBlend(GPU *gpu, u32 passing, u8 *dst, u16 color, u8 alpha, u16 x, u16 y)
{
/* We can blend if the 3D layer is selected as 1st target, */
/* but also if the 3D layer has the highest prio. */
if((gpu->BLDCNT & 0x1) || (gpu->dispx_st->dispx_BGxCNT[0].bits.Priority == 0))
{
int bg_under = gpu->bgPixels[x];
u16 final = color;
/* If the layer we are drawing on is selected as 2nd source, we can blend */
if(gpu->BLDCNT & (1 << (8 + bg_under)))
{
/* Test for easy cases like alpha = min or max */
if(alpha == 16)
{
final = color;
}
else if(alpha == 0)
{
final = T2ReadWord(dst, passing);
}
else
{
COLOR c1, c2, cfinal;
c1.val = color;
c2.val = T2ReadWord(dst, passing);
cfinal.bits.red = ((c1.bits.red * alpha / 16) + (c2.bits.red * (16 - alpha) / 16));
cfinal.bits.green = ((c1.bits.green * alpha / 16) + (c2.bits.green * (16 - alpha) / 16));
cfinal.bits.blue = ((c1.bits.blue * alpha / 16) + (c2.bits.blue * (16 - alpha) / 16));
final = cfinal.val;
}
}
T2WriteWord(dst, passing, (final | 0x8000));
gpu->bgPixels[x] = 0;
}
else
{
T2WriteWord(dst, passing, (color | 0x8000));
gpu->bgPixels[x] = 0;
}
return 1;
}
static BOOL setFinal3DColorSpecialIncrease(GPU *gpu, u32 passing, u8 *dst, u16 color, u8 alpha, u16 x, u16 y)
{
if(gpu->BLDCNT & 0x1)
{
if (gpu->BLDY_EVY != 0x0)
{
color = fadeInColors[gpu->BLDY_EVY][color&0x7FFF];
}
T2WriteWord(dst, passing, (color | 0x8000));
gpu->bgPixels[x] = 0;
}
else
{
T2WriteWord(dst, passing, (color | 0x8000));
gpu->bgPixels[x] = 0;
}
return 1;
}
static BOOL setFinal3DColorSpecialDecrease(GPU *gpu, u32 passing, u8 *dst, u16 color, u8 alpha, u16 x, u16 y)
{
if(gpu->BLDCNT & 0x1)
{
if (gpu->BLDY_EVY != 0x0)
{
color = fadeOutColors[gpu->BLDY_EVY][color&0x7FFF];
}
T2WriteWord(dst, passing, (color | 0x8000));
gpu->bgPixels[x] = 0;
}
else
{
T2WriteWord(dst, passing, (color | 0x8000));
gpu->bgPixels[x] = 0;
}
return 1;
}
static BOOL setFinal3DColorSpecialNoneWnd(GPU *gpu, u32 passing, u8 *dst, u16 color, u8 alpha, u16 x, u16 y)
{
BOOL windowDraw = TRUE, windowEffect = TRUE;
renderline_checkWindows(gpu, 0, x, y, &windowDraw, &windowEffect);
if(windowDraw)
{
T2WriteWord(dst, passing, (color | 0x8000));
gpu->bgPixels[x] = 0;
}
return windowDraw;
}
static BOOL setFinal3DColorSpecialBlendWnd(GPU *gpu, u32 passing, u8 *dst, u16 color, u8 alpha, u16 x, u16 y)
{
BOOL windowDraw = TRUE, windowEffect = TRUE;
renderline_checkWindows(gpu, 0, x, y, &windowDraw, &windowEffect);
if(windowDraw)
{
/* We can blend if the 3D layer is selected as 1st target, */
/* but also if the 3D layer has the highest prio. */
if(((gpu->BLDCNT & 0x1) && windowEffect) || (gpu->dispx_st->dispx_BGxCNT[0].bits.Priority == 0))
{
int bg_under = gpu->bgPixels[x];
u16 final = color;
/* If the layer we are drawing on is selected as 2nd source, we can blend */
if(gpu->BLDCNT & (1 << (8 + bg_under)))
{
/* Test for easy cases like alpha = min or max */
if(alpha == 16)
{
final = color;
}
else if(alpha == 0)
{
final = T2ReadWord(dst, passing);
}
else
{
COLOR c1, c2, cfinal;
c1.val = color;
c2.val = T2ReadWord(dst, passing);
cfinal.bits.red = ((c1.bits.red * alpha / 16) + (c2.bits.red * (16 - alpha) / 16));
cfinal.bits.green = ((c1.bits.green * alpha / 16) + (c2.bits.green * (16 - alpha) / 16));
cfinal.bits.blue = ((c1.bits.blue * alpha / 16) + (c2.bits.blue * (16 - alpha) / 16));
final = cfinal.val;
}
}
T2WriteWord(dst, passing, (final | 0x8000));
gpu->bgPixels[x] = 0;
}
else
{
T2WriteWord(dst, passing, (color | 0x8000));
gpu->bgPixels[x] = 0;
}
}
return windowDraw;
}
static BOOL setFinal3DColorSpecialIncreaseWnd(GPU *gpu, u32 passing, u8 *dst, u16 color, u8 alpha, u16 x, u16 y)
{
BOOL windowDraw = TRUE, windowEffect = TRUE;
renderline_checkWindows(gpu, 0, x, y, &windowDraw, &windowEffect);
if(windowDraw)
{
if((gpu->BLDCNT & 0x1) && windowEffect)
{
if (gpu->BLDY_EVY != 0x0)
{
color = fadeInColors[gpu->BLDY_EVY][color&0x7FFF];
}
T2WriteWord(dst, passing, (color | 0x8000));
gpu->bgPixels[x] = 0;
}
else
{
T2WriteWord(dst, passing, (color | 0x8000));
gpu->bgPixels[x] = 0;
}
}
return windowDraw;
}
static BOOL setFinal3DColorSpecialDecreaseWnd(GPU *gpu, u32 passing, u8 *dst, u16 color, u8 alpha, u16 x, u16 y)
{
BOOL windowDraw = TRUE, windowEffect = TRUE;
renderline_checkWindows(gpu, 0, x, y, &windowDraw, &windowEffect);
if(windowDraw)
{
if((gpu->BLDCNT & 0x1) && windowEffect)
{
if (gpu->BLDY_EVY != 0x0)
{
color = fadeOutColors[gpu->BLDY_EVY][color&0x7FFF];
}
T2WriteWord(dst, passing, (color | 0x8000));
gpu->bgPixels[x] = 0;
}
else
{
T2WriteWord(dst, passing, (color | 0x8000));
gpu->bgPixels[x] = 0;
}
}
return windowDraw;
@ -1077,7 +783,7 @@ static BOOL setFinal3DColorSpecialDecreaseWnd(GPU *gpu, u32 passing, u8 *dst, u1
// BACKGROUND RENDERING -TEXT-
/*****************************************************************************/
// render a text background to the combined pixelbuffer
INLINE void renderline_textBG(GPU * gpu, u8 num, u8 * dst, u32 Y, u16 XBG, u16 YBG, u16 LG)
INLINE void renderline_textBG(const GPU * gpu, u8 num, u8 * dst, u32 Y, u16 XBG, u16 YBG, u16 LG)
{
struct _BGxCNT * bgCnt = &(gpu->dispx_st)->dispx_BGxCNT[num].bits;
struct _DISPCNT * dispCnt = &(gpu->dispx_st)->dispx_DISPCNT.bits;
@ -1100,18 +806,12 @@ INLINE void renderline_textBG(GPU * gpu, u8 num, u8 * dst, u32 Y, u16 XBG, u16 Y
TILEENTRY tileentry;
//zero 30-dec-2008 - if you mask by 31 here, you lose the ability to correctly map the bottom half of 512-tall BG.
//the masking to keep it to a reasonable value was already done when tmp was calculated
// this is broke some games
//map = (u8 *)MMU_RenderMapToLCD(gpu->BG_map_ram[num] + (tmp) * 64);
u32 tmp_map = gpu->BG_map_ram[num] + (tmp&31) * 64;
if(tmp>31)
tmp_map+= ADDRESS_STEP_512B << bgCnt->ScreenSize ;
map = (u8 *)MMU_RenderMapToLCD(tmp_map);
if(!map) return; // no map
map = (u8 *)MMU_RenderMapToLCD(gpu->BG_map_ram[num] + (tmp&31) * 64);
if (!map) return;
if(tmp>31)
map+= ADDRESS_STEP_512B << bgCnt->ScreenSize ;
tile = (u8*) MMU_RenderMapToLCD(gpu->BG_tile_ram[num]);
if(!tile) return; // no tiles
@ -1257,7 +957,6 @@ INLINE void renderline_textBG(GPU * gpu, u8 num, u8 * dst, u32 Y, u16 XBG, u16 Y
}
yoff = ((YBG&7)<<3);
xfin = 8 - (xoff&7);
for(x = 0; x < LG; xfin = std::min<u16>(x+8, LG))
{
@ -1489,7 +1188,7 @@ void lineExtRot(GPU * gpu, u8 num, u16 l, u8 * DST)
256);
}
void textBG(GPU * gpu, u8 num, u8 * DST)
void textBG(const GPU * gpu, u8 num, u8 * DST)
{
u32 i;
for(i = 0; i < gpu->BGSize[num][1]; ++i)
@ -2416,10 +2115,52 @@ void GPU_set_DISPCAPCNT(u32 val)
gpu->dispCapCnt.capSrc, gpu->dispCapCnt.dst - ARM9Mem.ARM9_LCD, gpu->dispCapCnt.src - ARM9Mem.ARM9_LCD,
gpu->dispCapCnt.srcA, gpu->dispCapCnt.srcB);*/
}
// trade off for speed is 1MB
u16 bright_more_colors[16][0x8000];
u16 bright_less_colors[16][0x8000];
BOOL bright_init=FALSE;
// comment this if want to use formulas instead
// #define BRIGHT_TABLES
#ifdef BRIGHT_TABLES
static void calc_bright_colors() {
int base = 31 ;
int factor;
u16 red, green, blue;
COLOR color_more, color_less, color_ref;
static void GPU_ligne_layer(NDS_Screen * screen, u16 l)
#define FORMULA_MORE(x) x + ((base-x)*factor)/16
#define FORMULA_LESS(x) x - (x*factor)/16
if (bright_init) return;
for (factor=0; factor<16; factor++)
for (red =0; red <32; red++) {
color_ref.bits.red = red;
color_more.bits.red = FORMULA_MORE(red);
color_less.bits.red = FORMULA_LESS(red);
for (green=0; green<32; green++) {
color_ref.bits.green = green;
color_more.bits.green = FORMULA_MORE(green);
color_less.bits.green = FORMULA_LESS(green);
for (blue =0; blue <32; blue++) {
color_ref.bits.blue = blue;
color_more.bits.blue = FORMULA_MORE(blue);
color_less.bits.blue = FORMULA_LESS(blue);
bright_more_colors[factor][color_ref.bitx.bgr] = color_more.val;
bright_less_colors[factor][color_ref.bitx.bgr] = color_less.val;
}
}
}
bright_init=TRUE;
#undef FORMULA_MORE
#undef FORMULA_LESS
}
#endif
static INLINE void GPU_ligne_layer(NDS_Screen * screen, u16 l)
{
GPU * gpu = screen->gpu;
struct _DISPCNT * dispCnt = &(gpu->dispx_st)->dispx_DISPCNT.bits;
@ -2451,9 +2192,6 @@ static void GPU_ligne_layer(NDS_Screen * screen, u16 l)
for(int i = 0; i< 256; ++i) T2WriteWord(dst, i << 1, c);
/* reset them to backdrop */
memset(gpu->bgPixels, 5, 256);
if (!gpu->LayersEnable[0] && !gpu->LayersEnable[1] &&
!gpu->LayersEnable[2] && !gpu->LayersEnable[3] &&
!gpu->LayersEnable[4]) return;
@ -2507,11 +2245,6 @@ static void GPU_ligne_layer(NDS_Screen * screen, u16 l)
{
if (i16 == 0 && dispCnt->BG0_3D)
{
u16 line3Dcolor[256];
u8 line3Dalpha[256];
memset(line3Dcolor, 0, sizeof(line3Dcolor));
memset(line3Dalpha, 0, sizeof(line3Dalpha));
//determine the 3d range to grab
BGxOFS * bgofs = &gpu->dispx_st->dispx_BGxOFS[i16];
s16 hofs = (s16)T1ReadWord((u8 *)&bgofs->BGxHOFS, 0);
@ -2520,13 +2253,7 @@ static void GPU_ligne_layer(NDS_Screen * screen, u16 l)
else if(hofs<0) { start = -hofs; end=255; ofs=0; }
else { start = 0; end=255-hofs; ofs=hofs; }
//gpu3D->NDS_3D_GetLine (l, start, end, (u16*)dst+ofs);
gpu3D->NDS_3D_GetLine(l, start, end, line3Dcolor + ofs, line3Dalpha + ofs);
for(int k = start; k <= end; k++)
if(line3Dcolor[k] & 0x8000)
gpu->setFinalColor3D(gpu, (k << 1), dst, line3Dcolor[k], line3Dalpha[k], k, l);
gpu3D->NDS_3D_GetLine (l, start, end, (u16*)dst+ofs);
continue;
}
}
@ -2547,9 +2274,10 @@ static void GPU_ligne_layer(NDS_Screen * screen, u16 l)
}
// TODO: capture emulated not fully
static void GPU_ligne_DispCapture(u16 l)
static INLINE void GPU_ligne_DispCapture(u16 l)
{
GPU * gpu = MainScreen.gpu;
struct _DISPCNT * dispCnt = &(gpu->dispx_st)->dispx_DISPCNT.bits;
if (l == 0)
{
@ -2685,11 +2413,15 @@ static void GPU_ligne_DispCapture(u16 l)
static INLINE void GPU_ligne_MasterBrightness(NDS_Screen * screen, u16 l)
{
GPU * gpu = screen->gpu;
u8 * dst = GPU_screen + (screen->offset + l) * 512;
u16 i16;
if (!gpu->MasterBrightFactor) return;
#ifndef HAVE_LIBGDKGLEXT_X11_1_0
// damdoum :
// brightness done with opengl
// test are ok (gfx_test_brightness)
// now, if we are going to support 3D, this becomes dead code
// because it is obvious we'll use openGL / mesa3D
#ifdef BRIGHT_TABLES
calc_bright_colors();
@ -2709,11 +2441,36 @@ static INLINE void GPU_ligne_MasterBrightness(NDS_Screen * screen, u16 l)
// Bright up
case 1:
{
// when we wont do anything, we dont need to loop
#if 0
COLOR dstColor;
unsigned int masterBrightFactor = gpu->MasterBrightFactor;
u16 * colors = bright_more_colors[masterBrightFactor];
#endif
/* when we wont do anything, we dont need to loop */
if (!(gpu->MasterBrightFactor)) break ;
for(i16 = 0; i16 < 256; ++i16)
{
#if 0
#ifndef BRIGHT_TABLES
u8 base ;
u8 r,g,b; // get components, 5bit each
dstColor.val = *((u16 *) (dst + (i16 << 1)));
r = dstColor.bits.red;
g = dstColor.bits.green;
b = dstColor.bits.blue;
// Bright up and clamp to 5bit <-- automatic
base = 31 ;
dstColor.bits.red = r + ((base-r)*masterBrightFactor)/16;
dstColor.bits.green = g + ((base-g)*masterBrightFactor)/16;
dstColor.bits.blue = b + ((base-b)*masterBrightFactor)/16;
#else
dstColor.val = T1ReadWord(dst, i16 << 1);
dstColor.bitx.bgr = colors[dstColor.bitx.bgr];
#endif
*((u16 *) (dst + (i16 << 1))) = dstColor.val;
#endif
((u16*)dst)[i16] = fadeInColors[gpu->MasterBrightFactor][((u16*)dst)[i16]&0x7FFF];
}
break;
@ -2722,11 +2479,51 @@ static INLINE void GPU_ligne_MasterBrightness(NDS_Screen * screen, u16 l)
// Bright down
case 2:
{
// when we wont do anything, we dont need to loop
/*
NOTE: gbatek (in the reference above) seems to expect 6bit values
per component, but as desmume works with 5bit per component,
we use 31 as top, instead of 63. Testing it on a few games,
using 63 seems to give severe color wraping, and 31 works
nicely, so for now we'll just that, until proven wrong.
i have seen pics of pokemon ranger getting white with 31, with 63 it is nice.
it could be pb of alpha or blending or...
MightyMax> created a test NDS to check how the brightness values work,
and 31 seems to be correct. FactorEx is a override for max brighten/darken
See: http://mightymax.org/gfx_test_brightness.nds
The Pokemon Problem could be a problem with 8/32 bit writes not recognized yet,
i'll add that so you can check back.
*/
#if 0
COLOR dstColor;
unsigned int masterBrightFactor = gpu->MasterBrightFactor;
u16 * colors = bright_less_colors[masterBrightFactor];
#endif
/* when we wont do anything, we dont need to loop */
if (!gpu->MasterBrightFactor) break;
for(i16 = 0; i16 < 256; ++i16)
{
#if 0
#ifndef BRIGHT_TABLES
u8 r,g,b;
dstColor.val = *((u16 *) (dst + (i16 << 1)));
r = dstColor.bits.red;
g = dstColor.bits.green;
b = dstColor.bits.blue;
// Bright up and clamp to 5bit <- automatic
dstColor.bits.red = r - (r*masterBrightFactor)/16;
dstColor.bits.green = g - (g*masterBrightFactor)/16;
dstColor.bits.blue = b - (b*masterBrightFactor)/16;
#else
dstColor.val = T1ReadWord(dst, i16 << 1);
dstColor.bitx.bgr = colors[dstColor.bitx.bgr];
#endif
*((u16 *) (dst + (i16 << 1))) = dstColor.val;
#endif
((u16*)dst)[i16] = fadeOutColors[gpu->MasterBrightFactor][((u16*)dst)[i16]&0x7FFF];
}
break;
@ -2736,7 +2533,7 @@ static INLINE void GPU_ligne_MasterBrightness(NDS_Screen * screen, u16 l)
case 3:
break;
}
#endif
}
void GPU_ligne(NDS_Screen * screen, u16 l)

View File

@ -661,11 +661,8 @@ struct _GPU
u8 MasterBrightMode;
u32 MasterBrightFactor;
u8 bgPixels[256];
BOOL (*setFinalColorSpr)(GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
BOOL (*setFinalColorBck)(GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
BOOL (*setFinalColor3D) (GPU *gpu, u32 passing, u8 *dst, u16 color, u8 alpha, u16 x, u16 y);
BOOL (*setFinalColorSpr)(const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
BOOL (*setFinalColorBck)(const GPU *gpu, u32 passing, u8 bgnum, u8 *dst, u16 color, u16 x, u16 y);
void (*spriteRender) (GPU * gpu, u16 l, u8 * dst, u8 * prioTab);
};
/*
@ -695,7 +692,7 @@ GPU * GPU_Init(u8 l);
void GPU_Reset(GPU *g, u8 l);
void GPU_DeInit(GPU *);
void textBG(GPU * gpu, u8 num, u8 * DST); //Draw text based background
void textBG(const GPU * gpu, u8 num, u8 * DST); //Draw text based background
void rotBG(GPU * gpu, u8 num, u8 * DST);
void extRotBG(GPU * gpu, u8 num, u8 * DST);
void sprite1D(GPU * gpu, u16 l, u8 * dst, u8 * prioTab);

View File

@ -479,10 +479,10 @@ void MMU_clearMem()
ARM9Mem.ExtPal[0][i] = ARM9Mem.ARM9_LCD;
ARM9Mem.ExtPal[1][i] = ARM9Mem.ARM9_LCD;
}
ARM9Mem.ObjExtPal[0][0] = ARM9Mem.ARM9_LCD;
ARM9Mem.ObjExtPal[0][1] = ARM9Mem.ARM9_LCD;
ARM9Mem.ObjExtPal[1][0] = ARM9Mem.ARM9_LCD;
ARM9Mem.ObjExtPal[0][2] = ARM9Mem.ARM9_LCD;
ARM9Mem.ObjExtPal[1][1] = ARM9Mem.ARM9_LCD;
ARM9Mem.ObjExtPal[1][2] = ARM9Mem.ARM9_LCD;
ARM9Mem.texPalSlot[0] = ARM9Mem.ARM9_LCD;
ARM9Mem.texPalSlot[1] = ARM9Mem.ARM9_LCD;
@ -648,14 +648,12 @@ static inline void MMU_VRAMmapControl(u8 block, u8 VRAMBankCnt)
ARM9Mem.texPalSlot[1] = LCD_addr+0x2000;
ARM9Mem.texPalSlot[2] = LCD_addr+0x4000;
ARM9Mem.texPalSlot[3] = LCD_addr+0x6000;
gpu3D->NDS_3D_VramReconfigureSignal();
break;
case 5: // F
case 6: // G
{
u8 tmp_slot = ((VRAMBankCnt >> 3) & 0x01) + (((VRAMBankCnt >> 4) & 0x01)*4);
ARM9Mem.texPalSlot[tmp_slot] = LCD_addr;
gpu3D->NDS_3D_VramReconfigureSignal();
}
break;
case 9: // I Engine B, OBJ
@ -763,13 +761,18 @@ char txt[80];
static void execsqrt() {
u32 ret;
u16 cnt = T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x2B0);
if (cnt&1) {
u64 v = T1ReadQuad(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x2B8);
ret = isqrt(v);
} else {
switch(cnt&1)
{
case 0: {
u32 v = T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x2B8);
ret = isqrt(v);
break;
}
case 1: {
u64 v = T1ReadQuad(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x2B8);
ret = isqrt(v);
break;
}
}
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x2B4, 0);
T1WriteLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x2B0, cnt | 0x8000);
@ -784,22 +787,20 @@ static void execdiv() {
u16 cnt = T1ReadWord(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x280);
s64 num,den;
s64 res,mod;
switch(cnt&3)
{
case 0:
num = (s64) (s32) T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x290);
den = (s64) (s32) T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x298);
MMU.divCycles = (nds.cycles + 36);
break;
case 1:
break;
case 3: //gbatek says this is same as mode 1
case 1:
num = (s64) T1ReadQuad(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x290);
den = (s64) (s32) T1ReadLong(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x298);
MMU.divCycles = (nds.cycles + 68);
break;
break;
case 2:
default:
num = (s64) T1ReadQuad(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x290);
den = (s64) T1ReadQuad(MMU.MMU_MEM[ARMCPU_ARM9][0x40], 0x298);
MMU.divCycles = (nds.cycles + 68);
@ -1933,16 +1934,16 @@ static void FASTCALL _MMU_ARM9_write16(u32 adr, u16 val)
case REG_VRAMCNTE:
MMU_VRAMmapControl(adr-REG_VRAMCNTA, val & 0xFF);
MMU_VRAMmapControl(adr-REG_VRAMCNTA+1, val >> 8);
break;
return;
case REG_VRAMCNTG:
MMU_VRAMmapControl(adr-REG_VRAMCNTA, val & 0xFF);
/* Update WRAMSTAT at the ARM7 side */
T1WriteByte(MMU.MMU_MEM[ARMCPU_ARM7][0x40], 0x241, val >> 8);
break;
return;
case REG_VRAMCNTH:
MMU_VRAMmapControl(adr-REG_VRAMCNTA, val & 0xFF);
MMU_VRAMmapControl(adr-REG_VRAMCNTA+1, val >> 8);
break;
return;
case REG_IME:
{
@ -2230,67 +2231,35 @@ static void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
if((adr>>24)==4)
{
// MightyMax: no need to do several ifs, when only one can happen
// switch/case instead
// both comparison >=,< per if can be replaced by one bit comparison since
// they are 2^4 aligned and 2^4n wide
// this looks ugly but should reduce load on register writes, they are done as
// lookups by the compiler
switch (adr >> 4)
if( (adr >= 0x04000330) && (adr < 0x04000340) ) //edge color table
{
case 0x400033: //edge color table
((u32 *)(MMU.MMU_MEM[ARMCPU_ARM9][0x40]))[(adr & 0xFFF) >> 2] = val;
return;
case 0x400036: //fog table
case 0x400037:
((u32 *)(MMU.MMU_MEM[ARMCPU_ARM9][0x40]))[(adr & 0xFFF) >> 2] = val;
return;
case 0x400038:
case 0x400039:
case 0x40003A:
case 0x40003B: //toon table
((u32 *)(MMU.MMU_MEM[ARMCPU_ARM9][0x40]))[(adr & 0xFFF) >> 2] = val;
gfx3d_UpdateToonTable(&((MMU.MMU_MEM[ARMCPU_ARM9][0x40]))[(0x380)]);
return;
case 0x400040:
case 0x400041:
case 0x400042:
case 0x400043: // FIFO Commands
gfx3d_sendCommandToFIFO(val);
return;
case 0x400044:
case 0x400045:
case 0x400046:
case 0x400047:
case 0x400048:
case 0x400049:
case 0x40004A:
case 0x40004B:
case 0x40004C:
case 0x40004D:
case 0x40004E:
case 0x40004F:
case 0x400050:
case 0x400051:
case 0x400052:
case 0x400053:
case 0x400054:
case 0x400055:
case 0x400056:
case 0x400057:
case 0x400058:
case 0x400059:
case 0x40005A:
case 0x40005B:
case 0x40005C:
case 0x40005D:
case 0x40005E:
case 0x40005F: // Individual Commands
gfx3d_sendCommand(adr, val);
return;
default:
break;
((u32 *)(MMU.MMU_MEM[ARMCPU_ARM9][0x40]))[(adr & 0xFFF) >> 2] = val;
return;
}
if( (adr >= 0x04000360) && (adr < 0x04000380) ) //fog table
{
((u32 *)(MMU.MMU_MEM[ARMCPU_ARM9][0x40]))[(adr & 0xFFF) >> 2] = val;
return;
}
if( (adr >= 0x04000380) && (adr <= 0x40003BC) ) //toon table
{
((u32 *)(MMU.MMU_MEM[ARMCPU_ARM9][0x40]))[(adr & 0xFFF) >> 2] = val;
gfx3d_UpdateToonTable(&((MMU.MMU_MEM[ARMCPU_ARM9][0x40]))[(0x380)]);
return;
}
if ( (adr >= 0x04000400) && (adr < 0x04000440) )
{
gfx3d_sendCommandToFIFO(val);
return;
}
if ( (adr >= 0x04000440) && (adr < 0x04000600) )
{
gfx3d_sendCommand(adr, val);
return;
}
switch(adr)
@ -2411,11 +2380,11 @@ static void FASTCALL _MMU_ARM9_write32(u32 adr, u32 val)
MMU_VRAMmapControl(adr-REG_VRAMCNTA+2, (val >> 16) & 0xFF);
/* Update WRAMSTAT at the ARM7 side */
T1WriteByte(MMU.MMU_MEM[ARMCPU_ARM7][0x40], 0x241, (val >> 24) & 0xFF);
break;
return;
case REG_VRAMCNTH:
MMU_VRAMmapControl(adr-REG_VRAMCNTA, val & 0xFF);
MMU_VRAMmapControl(adr-REG_VRAMCNTA+1, (val >> 8) & 0xFF);
break;
return;
case REG_IME :
{

View File

@ -1167,7 +1167,7 @@ u32 NDS_exec(s32 nb)
if(MMU.DMAStartTime[1][3] == 1)
MMU_doDMA(1, 3);
}
else if(nds.VCount==215) {
else if(nds.VCount==214) {
gfx3d_VBlankEndSignal();
}
else if(nds.VCount==263)

View File

@ -74,7 +74,7 @@ static void ENDGL() {
#endif
static ALIGN(16) unsigned char GPU_screen3D [256*256*4];
//static ALIGN(16) unsigned char GPU_screenStencil[256*256];
static ALIGN(16) unsigned char GPU_screenStencil[256*256];
static const unsigned short map3d_cull[4] = {GL_FRONT_AND_BACK, GL_FRONT, GL_BACK, 0};
static const int texEnv[4] = { GL_MODULATE, GL_DECAL, GL_MODULATE, GL_MODULATE };
@ -217,12 +217,12 @@ static void _xglDisable(GLenum cap) {
//================================================= Textures
#define MAX_TEXTURE 500
#ifdef SSE2
struct ALIGN(16) TextureCache
#else
struct ALIGN(8) TextureCache
#endif
struct TextureCache
{
TextureCache()
: suspectedInvalid(true)
{}
GLenum id;
unsigned int frm;
unsigned int mode;
@ -233,14 +233,16 @@ struct ALIGN(8) TextureCache
int coord;
float invSizeX;
float invSizeY;
#ifdef SSE2
ALIGN(16) unsigned char texture[128*1024]; // 128Kb texture slot
#else
unsigned char texture[128*1024]; // 128Kb texture slot
u8 palette[256*2];
u16 palSize;
#endif
//set if this texture is suspected be invalid due to a vram reconfigure
bool suspectedInvalid;
};
} ;
TextureCache texcache[MAX_TEXTURE+1];
u32 texcache_count;
@ -307,10 +309,6 @@ static void createShaders()
{
hasShaders = true;
#ifdef HAVE_LIBOSMESA
NOSHADERS(1);
#endif
if (glCreateShader == NULL || //use ==NULL instead of !func to avoid always true warnings for some systems
glShaderSource == NULL ||
glCompileShader == NULL ||
@ -368,13 +366,9 @@ static void OGLReset()
texcache_start=0;
texcache_stop=MAX_TEXTURE<<1;
for(i=0;i<MAX_TEXTURE+1;i++)
texcache[i].suspectedInvalid = true;
//clear the framebuffers
// memset(GPU_screenStencil,0,sizeof(GPU_screenStencil));
memset(GPU_screenStencil,0,sizeof(GPU_screenStencil));
memset(GPU_screen3D,0,sizeof(GPU_screen3D));
}
static char OGLInit(void)
@ -423,11 +417,7 @@ static char OGLInit(void)
INITOGLEXT(PFNGLGETPROGRAMIVPROC,glGetProgramiv)
INITOGLEXT(PFNGLGETPROGRAMINFOLOGPROC,glGetProgramInfoLog)
INITOGLEXT(PFNGLVALIDATEPROGRAMPROC,glValidateProgram)
#ifdef HAVE_LIBOSMESA
glBlendFuncSeparateEXT = NULL;
#else
INITOGLEXT(PFNGLBLENDFUNCSEPARATEEXTPROC,glBlendFuncSeparateEXT)
#endif
INITOGLEXT(PFNGLGETUNIFORMLOCATIONPROC,glGetUniformLocation)
INITOGLEXT(PFNGLUNIFORM1IPROC,glUniform1i)
#endif
@ -436,7 +426,9 @@ static char OGLInit(void)
#endif
/* Create the shaders */
createShaders();
//as a hack for 0.9 release, we're disabling shaders.
hasShaders = false;
//createShaders();
/* Assign the texture units : 0 for main textures, 1 for toon table */
/* Also init the locations for some variables in the shaders */
@ -508,7 +500,7 @@ static void OGLClose()
ENDGL();
}
//zero 9/7/08 - changed *adr= to adr= while changing from c++. was that a bug?
#define CHECKSLOT txt_slot_current_size--;\
if (txt_slot_current_size<=0)\
{\
@ -582,31 +574,6 @@ static void setTexture(unsigned int format, unsigned int texpal)
txt_slot_current=(format>>14)&0x03;
adr=(unsigned char *)(ARM9Mem.textureSlotAddr[txt_slot_current]+((format&0x3FFF)<<3));
switch (textureMode)
{
case 1: //a3i5
pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4));
break;
case 2: //i2
pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<3));
break;
case 3: //i4
pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4));
break;
case 4: //i8
pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4));
break;
case 5: //4x4
pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4));
break;
case 6: //a5i3
pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4));
break;
case 7: //16bpp
pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4));
break;
}
i=texcache_start;
@ -615,28 +582,23 @@ static void setTexture(unsigned int format, unsigned int texpal)
{
if (texcache_stop==i) break;
if (texcache[i].frm==0) break;
if ( (texcache[i].frm == format) && (texcache[i].pal == texpal) )
if ((texcache[i].frm==format)&&(texcache[i].pal==texpal))
{
if ((texcache[i].mode == 5) ||
(texcache[i].mode == 7) ||
!memcmp(texcache[i].palette, pal, texcache[i].palSize) )
//TODO - we need to compare the palette also.
//TODO - this doesnt correctly span bank boundaries. in fact, it seems quite dangerous.
if (!texcache[i].suspectedInvalid || !memcmp(adr,texcache[i].texture,std::min((size_t)imageSize,sizeof(texcache[i].texture))))
{
//TODO - this doesnt correctly span bank boundaries. in fact, it seems quite dangerous.
if (!texcache[i].suspectedInvalid || !memcmp(adr, texcache[i].texture, std::min((size_t)imageSize,sizeof(texcache[i].texture))) )
texcache[i].suspectedInvalid = false;
texcache_count=i;
if(lastTexture == -1 || (int)i != lastTexture)
{
texcache[i].suspectedInvalid = false;
texcache_count=i;
if(lastTexture == -1 || (int)i != lastTexture)
{
lastTexture = i;
glBindTexture(GL_TEXTURE_2D,texcache[i].id);
glMatrixMode (GL_TEXTURE);
glLoadIdentity ();
glScaled (texcache[i].invSizeX, texcache[i].invSizeY, 1.0f);
}
return;
lastTexture = i;
glBindTexture(GL_TEXTURE_2D,texcache[i].id);
glMatrixMode (GL_TEXTURE);
glLoadIdentity ();
glScaled (texcache[i].invSizeX, texcache[i].invSizeY, 1.0f);
}
return;
}
}
i++;
@ -665,14 +627,7 @@ static void setTexture(unsigned int format, unsigned int texpal)
texcache[i].coord=(format>>30);
texcache[i].invSizeX=1.0f/((float)(sizeX*(1<<4)));
texcache[i].invSizeY=1.0f/((float)(sizeY*(1<<4)));
memcpy(texcache[i].texture,adr,std::min((size_t)imageSize,sizeof(texcache[i].texture)));
texcache[i].palSize = 0;
if ( (textureMode != 5) || (textureMode != 7) )
{
texcache[i].palSize = 256*2;
memcpy(texcache[i].palette, pal, texcache[i].palSize);
}
memcpy (texcache[i].texture,adr,std::min((size_t)imageSize,sizeof(texcache[i].texture)));
texcache[i].numcolors=palSize[texcache[i].mode];
texcache[i].frm=format;
@ -688,231 +643,229 @@ static void setTexture(unsigned int format, unsigned int texpal)
palZeroTransparent = (1-((format>>29)&1))*255; // shash: CONVERT THIS TO A TABLE :)
txt_slot_size=(txt_slot_current_size=0x020000-((format & 0x3FFF)<<3));
switch (texcache[i].mode)
{
case 1: //a3i5
switch (texcache[i].mode)
{
for(x = 0; x < imageSize; x++, dst += 4)
case 1: //a3i5
{
u16 c = pal[*adr&31];
u8 alpha = *adr>>5;
*dwdst++ = RGB15TO32(c,material_3bit_to_8bit[alpha]);
adr++;
CHECKSLOT;
}
break;
}
case 2: //i2
{
for(x = 0; x < imageSize>>2; ++x)
{
unsigned short c = pal[(*adr)&0x3];
dst[0] = ((c & 0x1F)<<3);
dst[1] = ((c & 0x3E0)>>2);
dst[2] = ((c & 0x7C00)>>7);
dst[3] = ((*adr&3) == 0) ? palZeroTransparent : 255;//(c>>15)*255;
dst += 4;
c = pal[((*adr)>>2)&0x3];
dst[0] = ((c & 0x1F)<<3);
dst[1] = ((c & 0x3E0)>>2);
dst[2] = ((c & 0x7C00)>>7);
dst[3] = (((*adr>>2)&3) == 0) ? palZeroTransparent : 255;//(c>>15)*255;
dst += 4;
c = pal[((*adr)>>4)&0x3];
dst[0] = ((c & 0x1F)<<3);
dst[1] = ((c & 0x3E0)>>2);
dst[2] = ((c & 0x7C00)>>7);
dst[3] = (((*adr>>4)&3) == 0) ? palZeroTransparent : 255;//(c>>15)*255;
dst += 4;
c = pal[(*adr)>>6];
dst[0] = ((c & 0x1F)<<3);
dst[1] = ((c & 0x3E0)>>2);
dst[2] = ((c & 0x7C00)>>7);
dst[3] = (((*adr>>6)&3) == 0) ? palZeroTransparent : 255;//(c>>15)*255;
dst += 4;
adr++;
CHECKSLOT;
}
break;
}
case 3: //i4
{
for(x = 0; x < (imageSize>>1); x++)
pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4));
for(x = 0; x < imageSize; x++, dst += 4)
{
unsigned short c = pal[*adr&0xF];
dst[0] = ((c & 0x1F)<<3);
dst[1] = ((c & 0x3E0)>>2);
dst[2] = ((c & 0x7C00)>>7);
dst[3] = (((*adr)&0xF) == 0) ? palZeroTransparent : 255;//(c>>15)*255;
dst += 4;
c = pal[((*adr)>>4)];
dst[0] = ((c & 0x1F)<<3);
dst[1] = ((c & 0x3E0)>>2);
dst[2] = ((c & 0x7C00)>>7);
dst[3] = (((*adr>>4)&0xF) == 0) ? palZeroTransparent : 255;//(c>>15)*255;
dst += 4;
adr++;
u16 c = pal[adr[x]&31];
u8 alpha = adr[x]>>5;
*dwdst++ = RGB15TO32(c,material_3bit_to_8bit[alpha]);
CHECKSLOT;
}
break;
}
case 4: //i8
case 2: //i2
{
for(x = 0; x < imageSize; ++x)
pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<3));
for(x = 0; x < imageSize>>2; ++x)
{
u16 c = pal[*adr];
*dwdst++ = RGB15TO32(c,(*adr == 0) ? palZeroTransparent : 255);
adr++;
unsigned short c = pal[(adr[x])&0x3];
dst[0] = ((c & 0x1F)<<3);
dst[1] = ((c & 0x3E0)>>2);
dst[2] = ((c & 0x7C00)>>7);
dst[3] = ((adr[x]&3) == 0) ? palZeroTransparent : 255;//(c>>15)*255;
dst += 4;
c = pal[((adr[x])>>2)&0x3];
dst[0] = ((c & 0x1F)<<3);
dst[1] = ((c & 0x3E0)>>2);
dst[2] = ((c & 0x7C00)>>7);
dst[3] = (((adr[x]>>2)&3) == 0) ? palZeroTransparent : 255;//(c>>15)*255;
dst += 4;
c = pal[((adr[x])>>4)&0x3];
dst[0] = ((c & 0x1F)<<3);
dst[1] = ((c & 0x3E0)>>2);
dst[2] = ((c & 0x7C00)>>7);
dst[3] = (((adr[x]>>4)&3) == 0) ? palZeroTransparent : 255;//(c>>15)*255;
dst += 4;
c = pal[(adr[x])>>6];
dst[0] = ((c & 0x1F)<<3);
dst[1] = ((c & 0x3E0)>>2);
dst[2] = ((c & 0x7C00)>>7);
dst[3] = (((adr[x]>>6)&3) == 0) ? palZeroTransparent : 255;//(c>>15)*255;
dst += 4;
CHECKSLOT;
}
break;
}
break;
case 5: //4x4
{
unsigned short * slot1;
unsigned int * map = (unsigned int *)adr;
unsigned int d = 0;
if ( (texcache[i].frm & 0xc000) == 0x8000)
// texel are in slot 2
slot1=(unsigned short*)&ARM9Mem.textureSlotAddr[1][((texcache[i].frm&0x3FFF)<<2)+0x010000];
else
slot1=(unsigned short*)&ARM9Mem.textureSlotAddr[1][(texcache[i].frm&0x3FFF)<<2];
case 3: //i4
{
pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4));
for(x = 0; x < (imageSize>>1); x++)
{
unsigned short c = pal[adr[x]&0xF];
dst[0] = ((c & 0x1F)<<3);
dst[1] = ((c & 0x3E0)>>2);
dst[2] = ((c & 0x7C00)>>7);
dst[3] = (((adr[x])&0xF) == 0) ? palZeroTransparent : 255;//(c>>15)*255;
dst += 4;
bool dead = false;
u16 yTmpSize = (texcache[i].sizeY>>2);
u16 xTmpSize = (texcache[i].sizeX>>2);
for (y = 0; y < yTmpSize; y ++)
c = pal[((adr[x])>>4)];
dst[0] = ((c & 0x1F)<<3);
dst[1] = ((c & 0x3E0)>>2);
dst[2] = ((c & 0x7C00)>>7);
dst[3] = (((adr[x]>>4)&0xF) == 0) ? palZeroTransparent : 255;//(c>>15)*255;
dst += 4;
CHECKSLOT;
}
break;
}
case 4: //i8
{
pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4));
for(x = 0; x < imageSize; ++x)
{
u16 c = pal[adr[x]];
*dwdst++ = RGB15TO32(c,(adr[x] == 0) ? palZeroTransparent : 255);
CHECKSLOT;
}
}
break;
case 5: //4x4
{
u32 tmpPos[4]={(y<<2)*texcache[i].sizeX,((y<<2)+1)*texcache[i].sizeX,
((y<<2)+2)*texcache[i].sizeX,((y<<2)+3)*texcache[i].sizeX};
for (x = 0; x < xTmpSize; x ++, d++)
{
u32 currBlock = map[d], sy;
u16 pal1 = slot1[d];
u16 pal1offset = (pal1 & 0x3FFF)<<1;
u8 mode = pal1>>14;
u32 tmp_col[4];
pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4));
unsigned short * slot1;
unsigned int * map = (unsigned int *)adr;
unsigned int d = 0;
if ( (texcache[i].frm & 0xc000) == 0x8000)
// texel are in slot 2
slot1=(unsigned short*)&ARM9Mem.textureSlotAddr[1][((texcache[i].frm&0x3FFF)<<2)+0x010000];
else
slot1=(unsigned short*)&ARM9Mem.textureSlotAddr[1][(texcache[i].frm&0x3FFF)<<2];
tmp_col[0]=RGB16TO32(pal[pal1offset],255);
tmp_col[1]=RGB16TO32(pal[pal1offset+1],255);
bool dead = false;
switch (mode)
{
case 0:
tmp_col[2]=RGB16TO32(pal[pal1offset+2],255);
tmp_col[3]=RGB16TO32(0x7FFF,0);
break;
case 1:
tmp_col[2]=(((tmp_col[0]&0xFF)+(tmp_col[1]&0xff))>>1)|
(((tmp_col[0]&(0xFF<<8))+(tmp_col[1]&(0xFF<<8)))>>1)|
(((tmp_col[0]&(0xFF<<16))+(tmp_col[1]&(0xFF<<16)))>>1)|
(0xff<<24);
tmp_col[3]=RGB16TO32(0x7FFF,0);
break;
case 2:
tmp_col[2]=RGB16TO32(pal[pal1offset+2],255);
tmp_col[3]=RGB16TO32(pal[pal1offset+3],255);
break;
case 3:
for (y = 0; y < (texcache[i].sizeY>>2); y ++)
{
u32 tmpPos[4]={(y<<2)*texcache[i].sizeX,((y<<2)+1)*texcache[i].sizeX,
((y<<2)+2)*texcache[i].sizeX,((y<<2)+3)*texcache[i].sizeX};
for (x = 0; x < (texcache[i].sizeX>>2); x ++, d++)
{
u32 red1, red2;
u32 green1, green2;
u32 blue1, blue2;
u16 tmp1, tmp2;
u32 currBlock = map[d], sy;
u16 pal1 = slot1[d];
u16 pal1offset = (pal1 & 0x3FFF)<<1;
u8 mode = pal1>>14;
u32 tmp_col[4];
red1=tmp_col[0]&0xff;
green1=(tmp_col[0]>>8)&0xff;
blue1=(tmp_col[0]>>16)&0xff;
red2=tmp_col[1]&0xff;
green2=(tmp_col[1]>>8)&0xff;
blue2=(tmp_col[1]>>16)&0xff;
tmp_col[0]=RGB16TO32(pal[pal1offset],255);
tmp_col[1]=RGB16TO32(pal[pal1offset+1],255);
tmp1=((red1*5+red2*3)>>6)|
(((green1*5+green2*3)>>6)<<5)|
(((blue1*5+blue2*3)>>6)<<10);
tmp2=((red2*5+red1*3)>>6)|
(((green2*5+green1*3)>>6)<<5)|
(((blue2*5+blue1*3)>>6)<<10);
tmp_col[2]=RGB16TO32(tmp1,255);
tmp_col[3]=RGB16TO32(tmp2,255);
break;
}
}
for (sy = 0; sy < 4; sy++)
switch (mode)
{
// Texture offset
u32 currentPos = (x<<2) + tmpPos[sy];
u8 currRow = (u8)((currBlock>>(sy<<3))&0xFF);
dwdst[currentPos] = tmp_col[currRow&3];
dwdst[currentPos+1] = tmp_col[(currRow>>2)&3];
dwdst[currentPos+2] = tmp_col[(currRow>>4)&3];
dwdst[currentPos+3] = tmp_col[(currRow>>6)&3];
if(dead) {
memset(dwdst, 0, sizeof(dwdst[0]) * 4);
}
txt_slot_current_size-=4;;
if (txt_slot_current_size<=0)
case 0:
tmp_col[2]=RGB16TO32(pal[pal1offset+2],255);
tmp_col[3]=RGB16TO32(0x7FFF,0);
break;
case 1:
tmp_col[2]=(((tmp_col[0]&0xFF)+(tmp_col[1]&0xff))>>1)|
(((tmp_col[0]&(0xFF<<8))+(tmp_col[1]&(0xFF<<8)))>>1)|
(((tmp_col[0]&(0xFF<<16))+(tmp_col[1]&(0xFF<<16)))>>1)|
(0xff<<24);
tmp_col[3]=RGB16TO32(0x7FFF,0);
break;
case 2:
tmp_col[2]=RGB16TO32(pal[pal1offset+2],255);
tmp_col[3]=RGB16TO32(pal[pal1offset+3],255);
break;
case 3:
{
//dead = true;
txt_slot_current++;
map=(unsigned int*)ARM9Mem.textureSlotAddr[txt_slot_current];
map-=txt_slot_size>>2; //this is weird, but necessary since we use map[d] above
txt_slot_size=txt_slot_current_size=0x020000;
u32 red1, red2;
u32 green1, green2;
u32 blue1, blue2;
u16 tmp1, tmp2;
red1=tmp_col[0]&0xff;
green1=(tmp_col[0]>>8)&0xff;
blue1=(tmp_col[0]>>16)&0xff;
red2=tmp_col[1]&0xff;
green2=(tmp_col[1]>>8)&0xff;
blue2=(tmp_col[1]>>16)&0xff;
tmp1=((red1*5+red2*3)>>6)|
(((green1*5+green2*3)>>6)<<5)|
(((blue1*5+blue2*3)>>6)<<10);
tmp2=((red2*5+red1*3)>>6)|
(((green2*5+green1*3)>>6)<<5)|
(((blue2*5+blue1*3)>>6)<<10);
tmp_col[2]=RGB16TO32(tmp1,255);
tmp_col[3]=RGB16TO32(tmp2,255);
break;
}
}
for (sy = 0; sy < 4; sy++)
{
// Texture offset
u32 currentPos = (x<<2) + tmpPos[sy];
u8 currRow = (u8)((currBlock>>(sy<<3))&0xFF);
dwdst[currentPos] = tmp_col[currRow&3];
dwdst[currentPos+1] = tmp_col[(currRow>>2)&3];
dwdst[currentPos+2] = tmp_col[(currRow>>4)&3];
dwdst[currentPos+3] = tmp_col[(currRow>>6)&3];
if(dead) {
memset(dwdst, 0, sizeof(dwdst[0]) * 4);
}
txt_slot_current_size-=4;;
if (txt_slot_current_size<=0)
{
//dead = true;
txt_slot_current++;
map=(unsigned int*)ARM9Mem.textureSlotAddr[txt_slot_current];
map-=txt_slot_size>>2; //this is weird, but necessary since we use map[d] above
txt_slot_size=txt_slot_current_size=0x020000;
}
}
}
}
}
break;
}
case 6: //a5i3
{
for(x = 0; x < imageSize; x++)
{
u16 c = pal[*adr&0x07];
u8 alpha = (*adr>>3);
*dwdst++ = RGB15TO32(c,material_5bit_to_8bit[alpha]);
adr++;
CHECKSLOT;
break;
}
break;
}
case 7: //16bpp
{
unsigned short * map = ((unsigned short *)adr);
for(x = 0; x < imageSize; ++x)
case 6: //a5i3
{
u16 c = map[x];
int alpha = ((c&0x8000)?255:0);
*dwdst++ = RGB15TO32(c&0x7FFF,alpha);
txt_slot_current_size-=2;;
if (txt_slot_current_size<=0)
pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4));
for(x = 0; x < imageSize; x++)
{
txt_slot_current++;
map=(unsigned short *)ARM9Mem.textureSlotAddr[txt_slot_current];
map-=txt_slot_size>>1;
txt_slot_size=txt_slot_current_size=0x020000;
u16 c = pal[adr[x]&0x07];
u8 alpha = (adr[x]>>3);
*dwdst++ = RGB15TO32(c,material_5bit_to_8bit[alpha]);
CHECKSLOT;
}
break;
}
case 7: //16bpp
{
unsigned short * map = ((unsigned short *)adr);
pal = (unsigned short *)(ARM9Mem.texPalSlot[0] + (texturePalette<<4));
for(x = 0; x < imageSize; ++x)
{
u16 c = map[x];
int alpha = ((c&0x8000)?255:0);
*dwdst++ = RGB15TO32(c&0x7FFF,alpha);
txt_slot_current_size-=2;;
if (txt_slot_current_size<=0)
{
txt_slot_current++;
map=(unsigned short *)ARM9Mem.textureSlotAddr[txt_slot_current];
map-=txt_slot_size>>1;
txt_slot_size=txt_slot_current_size=0x020000;
}
}
break;
}
break;
}
}
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
texcache[i].sizeX, texcache[i].sizeY, 0,
GL_RGBA, GL_UNSIGNED_BYTE, texMAP);
@ -1086,7 +1039,7 @@ static void OGLRender()
//printf("%d\n",gfx3d.projlist->count);
//we're not using the alpha clear color right now
glClearColor(gfx3d.clearColor[0],gfx3d.clearColor[1],gfx3d.clearColor[2], gfx3d.clearColor[3]);
glClearColor(gfx3d.clearColor[0],gfx3d.clearColor[1],gfx3d.clearColor[2], clearAlpha);
glClearDepth(gfx3d.clearDepth);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
@ -1167,7 +1120,7 @@ static void GL_ReadFramebuffer()
{
if(!BEGINGL()) return;
glFinish();
// glReadPixels(0,0,256,192,GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, GPU_screenStencil);
glReadPixels(0,0,256,192,GL_STENCIL_INDEX, GL_UNSIGNED_BYTE, GPU_screenStencil);
glReadPixels(0,0,256,192,GL_BGRA_EXT, GL_UNSIGNED_BYTE, GPU_screen3D);
ENDGL();
@ -1209,31 +1162,30 @@ static void OGLGetLineCaptured(int line, u16* dst)
}
u8 *screen3D = (u8*)GPU_screen3D+((191-line)<<10);
// u8 *screenStencil = (u8*)GPU_screenStencil+((191-line)<<8);
u8 *screenStencil = (u8*)GPU_screenStencil+((191-line)<<8);
for(int i = 0; i < 256; i++)
{
/* u32 stencil = screenStencil[i];
u32 stencil = screenStencil[i];
if(!stencil)
{
dst[i] = 0x0000;
continue;
}*/
}
int t=i<<2;
/* u8 r = screen3D[t+2];
u8 g = screen3D[t+1];
u8 b = screen3D[t+0];*/
u32 r = screen3D[t+2];
u32 g = screen3D[t+1];
u32 b = screen3D[t+0];
//if this math strikes you as wrong, be sure to look at GL_ReadFramebuffer() where the pixel format in screen3D is changed
//dst[i] = (b<<10) | (g<<5) | (r) | 0x8000;
dst[i] = (screen3D[t+2] | (screen3D[t+1] << 5) | (screen3D[t+0] << 10) | ((screen3D[t+3] > 0) ? 0x8000 : 0x0000));
dst[i] = (b<<10) | (g<<5) | (r) | 0x8000;
}
}
static void OGLGetLine(int line, int start, int end_inclusive, u16* dst, u8* dstAlpha)
static void OGLGetLine(int line, int start, int end_inclusive, u16* dst)
{
assert(line<192 && line>=0);
@ -1243,7 +1195,7 @@ static void OGLGetLine(int line, int start, int end_inclusive, u16* dst, u8* dst
}
u8 *screen3D = (u8*)GPU_screen3D+((191-line)<<10);
//u8 *screenStencil = (u8*)GPU_screenStencil+((191-line)<<8);
u8 *screenStencil = (u8*)GPU_screenStencil+((191-line)<<8);
//the renderer clears the stencil to 0
//then it sets it to 1 whenever it renders a pixel that passes the alpha test
@ -1257,18 +1209,15 @@ static void OGLGetLine(int line, int start, int end_inclusive, u16* dst, u8* dst
for(int i = start, j=0; i <= end_inclusive; ++i, ++j)
{
// u32 stencil = screenStencil[i];
u32 stencil = screenStencil[i];
//you would use this if you wanted to use the stencil buffer to make decisions here
// if(!stencil) continue;
if(!stencil) continue;
// u16 oldcolor = dst[j];
u16 oldcolor = dst[j];
int t=i<<2;
// u32 dstpixel;
dst[j] = (screen3D[t+2] | (screen3D[t+1] << 5) | (screen3D[t+0] << 10) | ((screen3D[t+3] > 0) ? 0x8000 : 0x0000));
dstAlpha[j] = (screen3D[t+3] / 2);
u32 dstpixel;
//old debug reminder: display alpha channel
//u32 r = screen3D[t+3];
@ -1277,7 +1226,7 @@ static void OGLGetLine(int line, int start, int end_inclusive, u16* dst, u8* dst
//if this math strikes you as wrong, be sure to look at GL_ReadFramebuffer() where the pixel format in screen3D is changed
/* u32 a = screen3D[t+3];
u32 a = screen3D[t+3];
typedef u8 mixtbl[32][32];
mixtbl & mix = mixTable555[a];
@ -1300,7 +1249,7 @@ static void OGLGetLine(int line, int start, int end_inclusive, u16* dst, u8* dst
newpix = mix[newpix][oldpix];
dstpixel |= (newpix<<10);
dst[j] = dstpixel;*/
dst[j] = dstpixel;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -32,11 +32,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>0.8</string>
<string>0.9</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0.8</string>
<string>0.9</string>
<key>NSMainNibFile</key>
<string>MainMenu</string>
<key>NSPrincipalClass</key>

Some files were not shown because too many files have changed in this diff Show More