mirror of https://github.com/PCSX2/pcsx2.git
Remove zerogs and zerospu2 source project files.
This commit is contained in:
parent
664559b6d4
commit
383fa03a34
|
@ -1,7 +0,0 @@
|
|||
# zerogs plugin dx
|
||||
# put Windows stuff here [TODO]
|
||||
|
||||
# zerogs plugin opengl
|
||||
if(UNIX)
|
||||
add_subdirectory(opengl)
|
||||
endif()
|
|
@ -1,37 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
curdir=`pwd`
|
||||
|
||||
echo ----------------------
|
||||
echo Building ZeroGS OpenGL
|
||||
echo ----------------------
|
||||
|
||||
if test "${ZEROGSOPTIONS+set}" != set ; then
|
||||
export ZEROGSOPTIONS="--enable-sse2"
|
||||
fi
|
||||
|
||||
cd ${curdir}/opengl
|
||||
|
||||
if [ $# -gt 0 ] && [ $1 = "all" ]
|
||||
then
|
||||
|
||||
aclocal
|
||||
automake
|
||||
autoconf
|
||||
chmod +x configure
|
||||
./configure ${ZEROGSOPTIONS} --prefix=${PCSX2PLUGINS}
|
||||
|
||||
make clean
|
||||
make install
|
||||
|
||||
else
|
||||
make $@
|
||||
fi
|
||||
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#cp libZeroGSogl*.so* ${PCSX2PLUGINS}/
|
||||
cp Win32/ps2hw.dat ${PCSX2PLUGINS}/
|
|
@ -1,81 +0,0 @@
|
|||
# zerogs Plugin
|
||||
|
||||
# plugin name
|
||||
set(zerogsName zerogs)
|
||||
|
||||
# zerogs sources
|
||||
set(zerogsSources
|
||||
CDVD.cpp)
|
||||
|
||||
# zerogs headers
|
||||
set(zerogsHeaders
|
||||
CDVD.h)
|
||||
|
||||
# zerogs Linux sources
|
||||
set(zerogsLinuxSources
|
||||
Linux/callbacks.c
|
||||
Linux/Config.cpp
|
||||
Linux/interface.c
|
||||
Linux/support.c)
|
||||
|
||||
# zerogs Linux headers
|
||||
set(zerogsLinuxHeaders
|
||||
Linux/callbacks.h
|
||||
Linux/Config.h
|
||||
Linux/interface.h
|
||||
Linux/support.h)
|
||||
|
||||
# zerogs Windows sources
|
||||
set(zerogsWindowsSources
|
||||
Windows/zerogs.def
|
||||
Windows/plugin.def)
|
||||
|
||||
# zerogs Windows headers
|
||||
set(zerogsWindowsHeaders
|
||||
)
|
||||
|
||||
# add library
|
||||
add_library(${zerogsName} SHARED
|
||||
${zerogsSources}
|
||||
${zerogsHeaders}
|
||||
${zerogsLinuxSources}
|
||||
${zerogsLinuxHeaders})
|
||||
|
||||
# set output directory
|
||||
set_target_properties(${zerogsName} PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/plugins)
|
||||
|
||||
# Debug - Build
|
||||
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
set(CMAKE_C_FLAGS_DEBUG "-Wall -fPIC -m32 -g")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -fPIC -m32 -g")
|
||||
|
||||
# add defines
|
||||
add_definitions()
|
||||
endif(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
|
||||
# Devel - Build
|
||||
if(CMAKE_BUILD_TYPE STREQUAL Devel)
|
||||
set(CMAKE_C_FLAGS_DEVEL "-Wall -fPIC -m32 -O2")
|
||||
set(CMAKE_CXX_FLAGS_DEVEL "-Wall -fPIC -m32 -O2")
|
||||
|
||||
# add defines
|
||||
add_definitions()
|
||||
endif(CMAKE_BUILD_TYPE STREQUAL Devel)
|
||||
|
||||
# Release - Build
|
||||
if(CMAKE_BUILD_TYPE STREQUAL Release)
|
||||
set(CMAKE_C_FLAGS_RELEASE "-Wall -fPIC -m32 -O2 -s")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -fPIC -m32 -O2 -s")
|
||||
|
||||
# add defines
|
||||
add_definitions()
|
||||
endif(CMAKE_BUILD_TYPE STREQUAL Release)
|
||||
|
||||
# link target with wx
|
||||
target_link_libraries(${zerogsName})
|
||||
|
||||
# add additional include directories
|
||||
include_directories(.
|
||||
../../common/include)
|
||||
|
|
@ -1,749 +0,0 @@
|
|||
/* ZeroGS
|
||||
* Copyright (C) 2005-2006 zerofrog@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 __GS_H__
|
||||
#define __GS_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
|
||||
#define GSdefs
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
|
||||
extern HWND GShwnd;
|
||||
|
||||
#else
|
||||
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define __inline inline
|
||||
|
||||
typedef int BOOL;
|
||||
|
||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#define FASTCALL(fn) __fastcall fn
|
||||
#else
|
||||
|
||||
#ifdef __x86_64
|
||||
#define FASTCALL(fn) fn
|
||||
#else
|
||||
#define FASTCALL(fn) __attribute__((fastcall)) fn
|
||||
#endif
|
||||
#endif
|
||||
|
||||
struct Vector_16F
|
||||
{
|
||||
u16 x, y, z, w;
|
||||
};
|
||||
|
||||
|
||||
/////////////////////
|
||||
// define when releasing
|
||||
// The only code that uses it is commented out!
|
||||
//#define ZEROGS_CACHEDCLEAR // much better performance
|
||||
//#define RELEASE_TO_PUBLIC
|
||||
|
||||
#if defined(ZEROGS_DEVBUILD)
|
||||
#define GS_LOG __Log
|
||||
#else
|
||||
#define GS_LOG 0&&
|
||||
#endif
|
||||
|
||||
#define ERROR_LOG __LogToConsole
|
||||
#define DEBUG_LOG printf
|
||||
|
||||
#ifdef RELEASE_TO_PUBLIC
|
||||
#define WARN_LOG 0&&
|
||||
#define PRIM_LOG 0&&
|
||||
#else
|
||||
#define WARN_LOG printf
|
||||
#define PRIM_LOG if (conf.log & 0x00000010) GS_LOG
|
||||
#endif
|
||||
|
||||
#ifndef GREG_LOG
|
||||
#define GREG_LOG 0&&
|
||||
#endif
|
||||
#ifndef PRIM_LOG
|
||||
#define PRIM_LOG 0&&
|
||||
#endif
|
||||
#ifndef WARN_LOG
|
||||
#define WARN_LOG 0&&
|
||||
#endif
|
||||
|
||||
#define REG64(name) \
|
||||
union name \
|
||||
{ \
|
||||
u64 i64; \
|
||||
u32 ai32[2]; \
|
||||
struct { \
|
||||
|
||||
#define REG128(name)\
|
||||
union name \
|
||||
{ \
|
||||
u64 ai64[2]; \
|
||||
u32 ai32[4]; \
|
||||
struct { \
|
||||
|
||||
#define REG64_(prefix, name) REG64(prefix##name)
|
||||
#define REG128_(prefix, name) REG128(prefix##name)
|
||||
|
||||
#define REG_END }; };
|
||||
#define REG_END2 };
|
||||
|
||||
#define REG64_SET(name) \
|
||||
union name \
|
||||
{ \
|
||||
u64 i64; \
|
||||
u32 ai32[2]; \
|
||||
|
||||
#define REG128_SET(name)\
|
||||
union name \
|
||||
{ \
|
||||
u64 ai64[2]; \
|
||||
u32 ai32[4]; \
|
||||
|
||||
#define REG_SET_END };
|
||||
|
||||
REG64_(GSReg, BGCOLOR)
|
||||
u32 R:8;
|
||||
u32 G:8;
|
||||
u32 B:8;
|
||||
u32 _PAD1:8;
|
||||
u32 _PAD2:32;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, BUSDIR)
|
||||
u32 DIR:1;
|
||||
u32 _PAD1:31;
|
||||
u32 _PAD2:32;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, CSR)
|
||||
u32 SIGNAL:1;
|
||||
u32 FINISH:1;
|
||||
u32 HSINT:1;
|
||||
u32 VSINT:1;
|
||||
u32 EDWINT:1;
|
||||
u32 ZERO1:1;
|
||||
u32 ZERO2:1;
|
||||
u32 _PAD1:1;
|
||||
u32 FLUSH:1;
|
||||
u32 RESET:1;
|
||||
u32 _PAD2:2;
|
||||
u32 NFIELD:1;
|
||||
u32 FIELD:1;
|
||||
u32 FIFO:2;
|
||||
u32 REV:8;
|
||||
u32 ID:8;
|
||||
u32 _PAD3:32;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, DISPFB) // (-1/2)
|
||||
u32 FBP:9;
|
||||
u32 FBW:6;
|
||||
u32 PSM:5;
|
||||
u32 _PAD:12;
|
||||
u32 DBX:11;
|
||||
u32 DBY:11;
|
||||
u32 _PAD2:10;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, DISPLAY) // (-1/2)
|
||||
u32 DX:12;
|
||||
u32 DY:11;
|
||||
u32 MAGH:4;
|
||||
u32 MAGV:2;
|
||||
u32 _PAD:3;
|
||||
u32 DW:12;
|
||||
u32 DH:11;
|
||||
u32 _PAD2:9;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, EXTBUF)
|
||||
u32 EXBP:14;
|
||||
u32 EXBW:6;
|
||||
u32 FBIN:2;
|
||||
u32 WFFMD:1;
|
||||
u32 EMODA:2;
|
||||
u32 EMODC:2;
|
||||
u32 _PAD1:5;
|
||||
u32 WDX:11;
|
||||
u32 WDY:11;
|
||||
u32 _PAD2:10;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, EXTDATA)
|
||||
u32 SX:12;
|
||||
u32 SY:11;
|
||||
u32 SMPH:4;
|
||||
u32 SMPV:2;
|
||||
u32 _PAD1:3;
|
||||
u32 WW:12;
|
||||
u32 WH:11;
|
||||
u32 _PAD2:9;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, EXTWRITE)
|
||||
u32 WRITE;
|
||||
u32 _PAD2:32;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, IMR)
|
||||
u32 _PAD1:8;
|
||||
u32 SIGMSK:1;
|
||||
u32 FINISHMSK:1;
|
||||
u32 HSMSK:1;
|
||||
u32 VSMSK:1;
|
||||
u32 EDWMSK:1;
|
||||
u32 _PAD2:19;
|
||||
u32 _PAD3:32;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, PMODE)
|
||||
u32 EN1:1;
|
||||
u32 EN2:1;
|
||||
u32 CRTMD:3;
|
||||
u32 MMOD:1;
|
||||
u32 AMOD:1;
|
||||
u32 SLBG:1;
|
||||
u32 ALP:8;
|
||||
u32 _PAD:16;
|
||||
u32 _PAD1:32;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, SIGLBLID)
|
||||
u32 SIGID:32;
|
||||
u32 LBLID:32;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, SMODE1)
|
||||
u32 RC:3;
|
||||
u32 LC:7;
|
||||
u32 T1248:2;
|
||||
u32 SLCK:1;
|
||||
u32 CMOD:2;
|
||||
u32 EX:1;
|
||||
u32 PRST:1;
|
||||
u32 SINT:1;
|
||||
u32 XPCK:1;
|
||||
u32 PCK2:2;
|
||||
u32 SPML:4;
|
||||
u32 GCONT:1;
|
||||
u32 PHS:1;
|
||||
u32 PVS:1;
|
||||
u32 PEHS:1;
|
||||
u32 PEVS:1;
|
||||
u32 CLKSEL:2;
|
||||
u32 NVCK:1;
|
||||
u32 SLCK2:1;
|
||||
u32 VCKSEL:2;
|
||||
u32 VHP:1;
|
||||
u32 _PAD1:27;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, SMODE2)
|
||||
u32 INT:1;
|
||||
u32 FFMD:1;
|
||||
u32 DPMS:2;
|
||||
u32 _PAD2:28;
|
||||
u32 _PAD3:32;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, SIGBLID)
|
||||
u32 SIGID;
|
||||
u32 LBLID;
|
||||
REG_END
|
||||
|
||||
extern int g_LastCRC;
|
||||
extern u8* g_pBasePS2Mem;
|
||||
#define PMODE ((GSRegPMODE*)(g_pBasePS2Mem+0x0000))
|
||||
#define SMODE1 ((GSRegSMODE1*)(g_pBasePS2Mem+0x0010))
|
||||
#define SMODE2 ((GSRegSMODE2*)(g_pBasePS2Mem+0x0020))
|
||||
// SRFSH
|
||||
#define SYNCH1 ((GSRegSYNCH1*)(g_pBasePS2Mem+0x0040))
|
||||
#define SYNCH2 ((GSRegSYNCH2*)(g_pBasePS2Mem+0x0050))
|
||||
#define SYNCV ((GSRegSYNCV*)(g_pBasePS2Mem+0x0060))
|
||||
#define DISPFB1 ((GSRegDISPFB*)(g_pBasePS2Mem+0x0070))
|
||||
#define DISPLAY1 ((GSRegDISPLAY*)(g_pBasePS2Mem+0x0080))
|
||||
#define DISPFB2 ((GSRegDISPFB*)(g_pBasePS2Mem+0x0090))
|
||||
#define DISPLAY2 ((GSRegDISPLAY*)(g_pBasePS2Mem+0x00a0))
|
||||
#define EXTBUF ((GSRegEXTBUF*)(g_pBasePS2Mem+0x00b0))
|
||||
#define EXTDATA ((GSRegEXTDATA*)(g_pBasePS2Mem+0x00c0))
|
||||
#define EXTWRITE ((GSRegEXTWRITE*)(g_pBasePS2Mem+0x00d0))
|
||||
#define BGCOLOR ((GSRegBGCOLOR*)(g_pBasePS2Mem+0x00e0))
|
||||
#define CSR ((GSRegCSR*)(g_pBasePS2Mem+0x1000))
|
||||
#define IMR ((GSRegIMR*)(g_pBasePS2Mem+0x1010))
|
||||
#define BUSDIR ((GSRegBUSDIR*)(g_pBasePS2Mem+0x1040))
|
||||
#define SIGLBLID ((GSRegSIGBLID*)(g_pBasePS2Mem+0x1080))
|
||||
|
||||
#define GET_GSFPS (((SMODE1->CMOD&1) ? 50 : 60) / (SMODE2->INT ? 1 : 2))
|
||||
|
||||
//
|
||||
// sps2tags.h
|
||||
//
|
||||
#ifdef _M_AMD64
|
||||
#define GET_GIF_REG(tag, reg) \
|
||||
(((tag).ai64[1] >> ((reg) << 2)) & 0xf)
|
||||
#else
|
||||
#define GET_GIF_REG(tag, reg) \
|
||||
(((tag).ai32[2 + ((reg) >> 3)] >> (((reg) & 7) << 2)) & 0xf)
|
||||
#endif
|
||||
|
||||
//
|
||||
// GIFTag
|
||||
REG128(GIFTag)
|
||||
u32 NLOOP:15;
|
||||
u32 EOP:1;
|
||||
u32 _PAD1:16;
|
||||
u32 _PAD2:14;
|
||||
u32 PRE:1;
|
||||
u32 PRIM:11;
|
||||
u32 FLG:2; // enum GIF_FLG
|
||||
u32 NREG:4;
|
||||
u64 REGS:64;
|
||||
REG_END
|
||||
|
||||
typedef struct {
|
||||
int x, y, w, h;
|
||||
} Rect;
|
||||
|
||||
typedef struct {
|
||||
int x, y;
|
||||
} Point;
|
||||
|
||||
typedef struct {
|
||||
int x0, y0;
|
||||
int x1, y1;
|
||||
} Rect2;
|
||||
|
||||
typedef struct {
|
||||
int x, y, c;
|
||||
} PointC;
|
||||
|
||||
#define GSOPTION_FULLSCREEN 0x2
|
||||
#define GSOPTION_BMPSNAP 0x4
|
||||
#define GSOPTION_CAPTUREAVI 0x8
|
||||
|
||||
#define GSOPTION_WINDIMS 0x70
|
||||
#define GSOPTION_WIN640 0x00
|
||||
#define GSOPTION_WIN800 0x10
|
||||
#define GSOPTION_WIN1024 0x20
|
||||
#define GSOPTION_WIN1280 0x30
|
||||
#define GSOPTION_WIN960W 0x40
|
||||
#define GSOPTION_WIN1280W 0x50
|
||||
#define GSOPTION_WIN1920W 0x60
|
||||
|
||||
#define GSOPTION_WIREFRAME 0x100
|
||||
#define GSOPTION_WIDESCREEN 0x200
|
||||
#define GSOPTION_LOADED 0x8000
|
||||
|
||||
typedef struct {
|
||||
u8 mrtdepth; // write color in render target
|
||||
u8 interlace;
|
||||
u8 aa; // antialiasing 0 - off, 1 - 2x, 2 - 4x
|
||||
u8 bilinear; // set to enable bilinear support
|
||||
u32 options;
|
||||
u32 gamesettings; // default game settings
|
||||
int width, height;
|
||||
int winstyle; // window style before full screen
|
||||
#ifdef GS_LOG
|
||||
u32 log;
|
||||
#endif
|
||||
} GSconf;
|
||||
|
||||
#define VERTEXGPU \
|
||||
union \
|
||||
{ \
|
||||
struct \
|
||||
{ \
|
||||
u16 x, y, f, resv0; /* note: xy is 12d3*/ \
|
||||
u32 rgba; \
|
||||
u32 z; \
|
||||
}; \
|
||||
}; \
|
||||
\
|
||||
float s, t, q; \
|
||||
|
||||
typedef struct {
|
||||
s16 x, y, f, resv0; /* note: xy is 12d3*/ \
|
||||
u32 rgba;
|
||||
u32 z;
|
||||
float s, t, q;
|
||||
} VertexGPU;
|
||||
|
||||
typedef struct {
|
||||
VERTEXGPU
|
||||
u16 u, v;
|
||||
} Vertex;
|
||||
|
||||
extern int g_GameSettings;
|
||||
extern GSconf conf;
|
||||
extern int ppf;
|
||||
|
||||
#define PSMCT32 0
|
||||
#define PSMCT24 1
|
||||
#define PSMCT16 2
|
||||
#define PSMCT16S 10
|
||||
#define PSMT8 19
|
||||
#define PSMT4 20
|
||||
#define PSMT8H 27
|
||||
#define PSMT4HL 36
|
||||
#define PSMT4HH 44
|
||||
#define PSMT32Z 48
|
||||
#define PSMT24Z 49
|
||||
#define PSMT16Z 50
|
||||
#define PSMT16SZ 58
|
||||
|
||||
#define PSMT_ISCLUT(psm) (((psm)&0x7)>2)
|
||||
#define PSMT_IS16BIT(psm) (((psm)&7)==2||((psm)&7)==10)
|
||||
|
||||
typedef struct {
|
||||
int nloop;
|
||||
int eop;
|
||||
int nreg;
|
||||
} tagInfo;
|
||||
|
||||
typedef union {
|
||||
s64 SD;
|
||||
u64 UD;
|
||||
s32 SL[2];
|
||||
u32 UL[2];
|
||||
s16 SS[4];
|
||||
u16 US[4];
|
||||
s8 SC[8];
|
||||
u8 UC[8];
|
||||
} reg64;
|
||||
|
||||
/* general purpose regs structs */
|
||||
typedef struct {
|
||||
int fbp;
|
||||
int fbw;
|
||||
int fbh;
|
||||
int psm;
|
||||
u32 fbm;
|
||||
} frameInfo;
|
||||
|
||||
typedef struct {
|
||||
u16 prim;
|
||||
|
||||
union {
|
||||
struct {
|
||||
u16 iip : 1;
|
||||
u16 tme : 1;
|
||||
u16 fge : 1;
|
||||
u16 abe : 1;
|
||||
u16 aa1 : 1;
|
||||
u16 fst : 1;
|
||||
u16 ctxt : 1;
|
||||
u16 fix : 1;
|
||||
u16 resv : 8;
|
||||
};
|
||||
u16 _val;
|
||||
};
|
||||
} primInfo;
|
||||
|
||||
extern primInfo *prim;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
u32 ate : 1;
|
||||
u32 atst : 3;
|
||||
u32 aref : 8;
|
||||
u32 afail : 2;
|
||||
u32 date : 1;
|
||||
u32 datm : 1;
|
||||
u32 zte : 1;
|
||||
u32 ztst : 2;
|
||||
u32 resv : 13;
|
||||
};
|
||||
u32 _val;
|
||||
} pixTest;
|
||||
|
||||
typedef struct {
|
||||
int bp;
|
||||
int bw;
|
||||
int psm;
|
||||
} bufInfo;
|
||||
|
||||
typedef struct {
|
||||
int tbp0;
|
||||
int tbw;
|
||||
int cbp;
|
||||
u16 tw, th;
|
||||
u8 psm;
|
||||
u8 tcc;
|
||||
u8 tfx;
|
||||
u8 cpsm;
|
||||
u8 csm;
|
||||
u8 csa;
|
||||
u8 cld;
|
||||
} tex0Info;
|
||||
|
||||
#define TEX_MODULATE 0
|
||||
#define TEX_DECAL 1
|
||||
#define TEX_HIGHLIGHT 2
|
||||
#define TEX_HIGHLIGHT2 3
|
||||
|
||||
typedef struct {
|
||||
int lcm;
|
||||
int mxl;
|
||||
int mmag;
|
||||
int mmin;
|
||||
int mtba;
|
||||
int l;
|
||||
int k;
|
||||
} tex1Info;
|
||||
|
||||
typedef struct {
|
||||
int wms;
|
||||
int wmt;
|
||||
int minu;
|
||||
int maxu;
|
||||
int minv;
|
||||
int maxv;
|
||||
} clampInfo;
|
||||
|
||||
typedef struct {
|
||||
int cbw;
|
||||
int cou;
|
||||
int cov;
|
||||
} clutInfo;
|
||||
|
||||
typedef struct {
|
||||
int tbp[3];
|
||||
int tbw[3];
|
||||
} miptbpInfo;
|
||||
|
||||
typedef struct {
|
||||
u16 aem;
|
||||
u8 ta[2];
|
||||
float fta[2];
|
||||
} texaInfo;
|
||||
|
||||
typedef struct {
|
||||
int sx;
|
||||
int sy;
|
||||
int dx;
|
||||
int dy;
|
||||
int dir;
|
||||
} trxposInfo;
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
struct {
|
||||
u8 a : 2;
|
||||
u8 b : 2;
|
||||
u8 c : 2;
|
||||
u8 d : 2;
|
||||
};
|
||||
u8 abcd;
|
||||
};
|
||||
|
||||
u8 fix : 8;
|
||||
} alphaInfo;
|
||||
|
||||
typedef struct {
|
||||
u16 zbp; // word address / 64
|
||||
u8 psm;
|
||||
u8 zmsk;
|
||||
} zbufInfo;
|
||||
|
||||
typedef struct {
|
||||
int fba;
|
||||
} fbaInfo;
|
||||
|
||||
typedef struct {
|
||||
int mode;
|
||||
int regn;
|
||||
u64 regs;
|
||||
tagInfo tag;
|
||||
} pathInfo;
|
||||
|
||||
typedef struct {
|
||||
Vertex gsvertex[3];
|
||||
u32 rgba;
|
||||
float q;
|
||||
Vertex vertexregs;
|
||||
|
||||
int primC; // number of verts current storing
|
||||
int primIndex; // current prim index
|
||||
int nTriFanVert;
|
||||
|
||||
int prac;
|
||||
int dthe;
|
||||
int colclamp;
|
||||
int fogcol;
|
||||
int smask;
|
||||
int pabe;
|
||||
u64 buff[2];
|
||||
int buffsize;
|
||||
int cbp[2]; // internal cbp registers
|
||||
|
||||
u32 CSRw;
|
||||
|
||||
primInfo _prim[2];
|
||||
bufInfo srcbuf, srcbufnew;
|
||||
bufInfo dstbuf, dstbufnew;
|
||||
|
||||
clutInfo clut;
|
||||
|
||||
texaInfo texa;
|
||||
trxposInfo trxpos, trxposnew;
|
||||
|
||||
int imageWtemp, imageHtemp;
|
||||
|
||||
int imageTransfer;
|
||||
int imageWnew, imageHnew, imageX, imageY, imageEndX, imageEndY;
|
||||
|
||||
pathInfo path1;
|
||||
pathInfo path2;
|
||||
pathInfo path3;
|
||||
|
||||
} GSinternal;
|
||||
|
||||
extern GSinternal gs;
|
||||
|
||||
extern FILE *gsLog;
|
||||
|
||||
void __Log(const char *fmt, ...);
|
||||
void __LogToConsole(const char *fmt, ...);
|
||||
|
||||
void LoadConfig();
|
||||
void SaveConfig();
|
||||
|
||||
extern void (*GSirq)();
|
||||
|
||||
void *SysLoadLibrary(char *lib); // Loads Library
|
||||
void *SysLoadSym(void *lib, char *sym); // Loads Symbol from Library
|
||||
char *SysLibError(); // Gets previous error loading sysbols
|
||||
void SysCloseLibrary(void *lib); // Closes Library
|
||||
void SysMessage(char *fmt, ...);
|
||||
|
||||
extern u8 memcmp_mmx(const void *dest, const void *src, int n);
|
||||
|
||||
template <typename T>
|
||||
class CInterfacePtr
|
||||
{
|
||||
public:
|
||||
inline CInterfacePtr() : ptr(NULL) {}
|
||||
inline explicit CInterfacePtr(T* newptr) : ptr(newptr) { if ( ptr != NULL ) ptr->AddRef(); }
|
||||
inline ~CInterfacePtr() { if( ptr != NULL ) ptr->Release(); }
|
||||
|
||||
inline T* operator* () { assert( ptr != NULL); return *ptr; }
|
||||
inline T* operator->() { return ptr; }
|
||||
inline T* get() { return ptr; }
|
||||
|
||||
inline void release() {
|
||||
if( ptr != NULL ) { ptr->Release(); ptr = NULL; }
|
||||
}
|
||||
|
||||
inline operator T*() { return ptr; }
|
||||
|
||||
inline bool operator==(T* rhs) { return ptr == rhs; }
|
||||
inline bool operator!=(T* rhs) { return ptr != rhs; }
|
||||
|
||||
inline CInterfacePtr& operator= (T* newptr) {
|
||||
if( ptr != NULL ) ptr->Release();
|
||||
ptr = newptr;
|
||||
|
||||
if( ptr != NULL ) ptr->AddRef();
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
T* ptr;
|
||||
};
|
||||
|
||||
#define RGBA32to16(c) \
|
||||
(u16)((((c) & 0x000000f8) >> 3) | \
|
||||
(((c) & 0x0000f800) >> 6) | \
|
||||
(((c) & 0x00f80000) >> 9) | \
|
||||
(((c) & 0x80000000) >> 16)) \
|
||||
|
||||
#define RGBA16to32(c) \
|
||||
(((c) & 0x001f) << 3) | \
|
||||
(((c) & 0x03e0) << 6) | \
|
||||
(((c) & 0x7c00) << 9) | \
|
||||
(((c) & 0x8000) ? 0xff000000 : 0) \
|
||||
|
||||
// converts float16 [0,1] to BYTE [0,255] (assumes value is in range, otherwise will take lower 8bits)
|
||||
// f is a u16
|
||||
__forceinline u16 Float16ToBYTE(u16 f) {
|
||||
//assert( !(f & 0x8000) );
|
||||
if( f & 0x8000 ) return 0;
|
||||
|
||||
u16 d = ((((f&0x3ff)|0x400)*255)>>(10-((f>>10)&0x1f)+15));
|
||||
return d > 255 ? 255 : d;
|
||||
}
|
||||
|
||||
__forceinline u16 Float16ToALPHA(u16 f) {
|
||||
//assert( !(f & 0x8000) );
|
||||
if( f & 0x8000 ) return 0;
|
||||
|
||||
// round up instead of down (crash and burn), too much and charlie breaks
|
||||
u16 d = (((((f&0x3ff)|0x400))*255)>>(10-((f>>10)&0x1f)+15));
|
||||
d = (d)>>1;
|
||||
return d > 255 ? 255 : d;
|
||||
}
|
||||
|
||||
#ifndef COLOR_ARGB
|
||||
#define COLOR_ARGB(a,r,g,b) \
|
||||
((u32)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
|
||||
#endif
|
||||
|
||||
// assumes that positive in [1,2] (then extracts fraction by just looking at the specified bits)
|
||||
#define Float16ToBYTE_2(f) ((u8)(*(u16*)&f>>2))
|
||||
#define Float16To5BIT(f) (Float16ToBYTE(f)>>3)
|
||||
|
||||
#define Float16Alpha(f) (((*(u16*)&f&0x7c00)>=0x3900)?0x8000:0) // alpha is >= 1
|
||||
|
||||
// converts an array of 4 u16s to a u32 color
|
||||
// f is a pointer to a u16
|
||||
#define Float16ToARGB(f) COLOR_ARGB(Float16ToALPHA(f.w), Float16ToBYTE(f.x), Float16ToBYTE(f.y), Float16ToBYTE(f.z));
|
||||
|
||||
#define Float16ToARGB16(f) (Float16Alpha(f.w)|(Float16To5BIT(f.x)<<10)|(Float16To5BIT(f.y)<<5)|Float16To5BIT(f.z))
|
||||
|
||||
// used for Z values
|
||||
#define Float16ToARGB_Z(f) COLOR_ARGB((u32)Float16ToBYTE_2(f.w), Float16ToBYTE_2(f.x), Float16ToBYTE_2(f.y), Float16ToBYTE_2(f.z))
|
||||
#define Float16ToARGB16_Z(f) ((Float16ToBYTE_2(f.y)<<8)|Float16ToBYTE_2(f.z))
|
||||
|
||||
|
||||
inline float Clamp(float fx, float fmin, float fmax)
|
||||
{
|
||||
if( fx < fmin ) return fmin;
|
||||
return fx > fmax ? fmax : fx;
|
||||
}
|
||||
|
||||
#include <string>
|
||||
|
||||
extern std::string s_strIniPath;
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -1,904 +0,0 @@
|
|||
/* ZeroGS
|
||||
* Copyright (C) 2005-2006 zerofrog@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 <d3dx9.h>
|
||||
|
||||
#include "GS.h"
|
||||
#include "Mem.h"
|
||||
#include "zerogs.h"
|
||||
#include "targets.h"
|
||||
#include "x86.h"
|
||||
|
||||
u32 g_blockTable32[4][8] = {
|
||||
{ 0, 1, 4, 5, 16, 17, 20, 21},
|
||||
{ 2, 3, 6, 7, 18, 19, 22, 23},
|
||||
{ 8, 9, 12, 13, 24, 25, 28, 29},
|
||||
{ 10, 11, 14, 15, 26, 27, 30, 31}
|
||||
};
|
||||
|
||||
u32 g_blockTable32Z[4][8] = {
|
||||
{ 24, 25, 28, 29, 8, 9, 12, 13},
|
||||
{ 26, 27, 30, 31, 10, 11, 14, 15},
|
||||
{ 16, 17, 20, 21, 0, 1, 4, 5},
|
||||
{ 18, 19, 22, 23, 2, 3, 6, 7}
|
||||
};
|
||||
|
||||
u32 g_blockTable16[8][4] = {
|
||||
{ 0, 2, 8, 10 },
|
||||
{ 1, 3, 9, 11 },
|
||||
{ 4, 6, 12, 14 },
|
||||
{ 5, 7, 13, 15 },
|
||||
{ 16, 18, 24, 26 },
|
||||
{ 17, 19, 25, 27 },
|
||||
{ 20, 22, 28, 30 },
|
||||
{ 21, 23, 29, 31 }
|
||||
};
|
||||
|
||||
u32 g_blockTable16S[8][4] = {
|
||||
{ 0, 2, 16, 18 },
|
||||
{ 1, 3, 17, 19 },
|
||||
{ 8, 10, 24, 26 },
|
||||
{ 9, 11, 25, 27 },
|
||||
{ 4, 6, 20, 22 },
|
||||
{ 5, 7, 21, 23 },
|
||||
{ 12, 14, 28, 30 },
|
||||
{ 13, 15, 29, 31 }
|
||||
};
|
||||
|
||||
u32 g_blockTable16Z[8][4] = {
|
||||
{ 24, 26, 16, 18 },
|
||||
{ 25, 27, 17, 19 },
|
||||
{ 28, 30, 20, 22 },
|
||||
{ 29, 31, 21, 23 },
|
||||
{ 8, 10, 0, 2 },
|
||||
{ 9, 11, 1, 3 },
|
||||
{ 12, 14, 4, 6 },
|
||||
{ 13, 15, 5, 7 }
|
||||
};
|
||||
|
||||
u32 g_blockTable16SZ[8][4] = {
|
||||
{ 24, 26, 8, 10 },
|
||||
{ 25, 27, 9, 11 },
|
||||
{ 16, 18, 0, 2 },
|
||||
{ 17, 19, 1, 3 },
|
||||
{ 28, 30, 12, 14 },
|
||||
{ 29, 31, 13, 15 },
|
||||
{ 20, 22, 4, 6 },
|
||||
{ 21, 23, 5, 7 }
|
||||
};
|
||||
|
||||
u32 g_blockTable8[4][8] = {
|
||||
{ 0, 1, 4, 5, 16, 17, 20, 21},
|
||||
{ 2, 3, 6, 7, 18, 19, 22, 23},
|
||||
{ 8, 9, 12, 13, 24, 25, 28, 29},
|
||||
{ 10, 11, 14, 15, 26, 27, 30, 31}
|
||||
};
|
||||
|
||||
u32 g_blockTable4[8][4] = {
|
||||
{ 0, 2, 8, 10 },
|
||||
{ 1, 3, 9, 11 },
|
||||
{ 4, 6, 12, 14 },
|
||||
{ 5, 7, 13, 15 },
|
||||
{ 16, 18, 24, 26 },
|
||||
{ 17, 19, 25, 27 },
|
||||
{ 20, 22, 28, 30 },
|
||||
{ 21, 23, 29, 31 }
|
||||
};
|
||||
|
||||
u32 g_columnTable32[8][8] = {
|
||||
{ 0, 1, 4, 5, 8, 9, 12, 13 },
|
||||
{ 2, 3, 6, 7, 10, 11, 14, 15 },
|
||||
{ 16, 17, 20, 21, 24, 25, 28, 29 },
|
||||
{ 18, 19, 22, 23, 26, 27, 30, 31 },
|
||||
{ 32, 33, 36, 37, 40, 41, 44, 45 },
|
||||
{ 34, 35, 38, 39, 42, 43, 46, 47 },
|
||||
{ 48, 49, 52, 53, 56, 57, 60, 61 },
|
||||
{ 50, 51, 54, 55, 58, 59, 62, 63 },
|
||||
};
|
||||
|
||||
u32 g_columnTable16[8][16] = {
|
||||
{ 0, 2, 8, 10, 16, 18, 24, 26,
|
||||
1, 3, 9, 11, 17, 19, 25, 27 },
|
||||
{ 4, 6, 12, 14, 20, 22, 28, 30,
|
||||
5, 7, 13, 15, 21, 23, 29, 31 },
|
||||
{ 32, 34, 40, 42, 48, 50, 56, 58,
|
||||
33, 35, 41, 43, 49, 51, 57, 59 },
|
||||
{ 36, 38, 44, 46, 52, 54, 60, 62,
|
||||
37, 39, 45, 47, 53, 55, 61, 63 },
|
||||
{ 64, 66, 72, 74, 80, 82, 88, 90,
|
||||
65, 67, 73, 75, 81, 83, 89, 91 },
|
||||
{ 68, 70, 76, 78, 84, 86, 92, 94,
|
||||
69, 71, 77, 79, 85, 87, 93, 95 },
|
||||
{ 96, 98, 104, 106, 112, 114, 120, 122,
|
||||
97, 99, 105, 107, 113, 115, 121, 123 },
|
||||
{ 100, 102, 108, 110, 116, 118, 124, 126,
|
||||
101, 103, 109, 111, 117, 119, 125, 127 },
|
||||
};
|
||||
|
||||
u32 g_columnTable8[16][16] = {
|
||||
{ 0, 4, 16, 20, 32, 36, 48, 52, // column 0
|
||||
2, 6, 18, 22, 34, 38, 50, 54 },
|
||||
{ 8, 12, 24, 28, 40, 44, 56, 60,
|
||||
10, 14, 26, 30, 42, 46, 58, 62 },
|
||||
{ 33, 37, 49, 53, 1, 5, 17, 21,
|
||||
35, 39, 51, 55, 3, 7, 19, 23 },
|
||||
{ 41, 45, 57, 61, 9, 13, 25, 29,
|
||||
43, 47, 59, 63, 11, 15, 27, 31 },
|
||||
{ 96, 100, 112, 116, 64, 68, 80, 84, // column 1
|
||||
98, 102, 114, 118, 66, 70, 82, 86 },
|
||||
{ 104, 108, 120, 124, 72, 76, 88, 92,
|
||||
106, 110, 122, 126, 74, 78, 90, 94 },
|
||||
{ 65, 69, 81, 85, 97, 101, 113, 117,
|
||||
67, 71, 83, 87, 99, 103, 115, 119 },
|
||||
{ 73, 77, 89, 93, 105, 109, 121, 125,
|
||||
75, 79, 91, 95, 107, 111, 123, 127 },
|
||||
{ 128, 132, 144, 148, 160, 164, 176, 180, // column 2
|
||||
130, 134, 146, 150, 162, 166, 178, 182 },
|
||||
{ 136, 140, 152, 156, 168, 172, 184, 188,
|
||||
138, 142, 154, 158, 170, 174, 186, 190 },
|
||||
{ 161, 165, 177, 181, 129, 133, 145, 149,
|
||||
163, 167, 179, 183, 131, 135, 147, 151 },
|
||||
{ 169, 173, 185, 189, 137, 141, 153, 157,
|
||||
171, 175, 187, 191, 139, 143, 155, 159 },
|
||||
{ 224, 228, 240, 244, 192, 196, 208, 212, // column 3
|
||||
226, 230, 242, 246, 194, 198, 210, 214 },
|
||||
{ 232, 236, 248, 252, 200, 204, 216, 220,
|
||||
234, 238, 250, 254, 202, 206, 218, 222 },
|
||||
{ 193, 197, 209, 213, 225, 229, 241, 245,
|
||||
195, 199, 211, 215, 227, 231, 243, 247 },
|
||||
{ 201, 205, 217, 221, 233, 237, 249, 253,
|
||||
203, 207, 219, 223, 235, 239, 251, 255 },
|
||||
};
|
||||
|
||||
u32 g_columnTable4[16][32] = {
|
||||
{ 0, 8, 32, 40, 64, 72, 96, 104, // column 0
|
||||
2, 10, 34, 42, 66, 74, 98, 106,
|
||||
4, 12, 36, 44, 68, 76, 100, 108,
|
||||
6, 14, 38, 46, 70, 78, 102, 110 },
|
||||
{ 16, 24, 48, 56, 80, 88, 112, 120,
|
||||
18, 26, 50, 58, 82, 90, 114, 122,
|
||||
20, 28, 52, 60, 84, 92, 116, 124,
|
||||
22, 30, 54, 62, 86, 94, 118, 126 },
|
||||
{ 65, 73, 97, 105, 1, 9, 33, 41,
|
||||
67, 75, 99, 107, 3, 11, 35, 43,
|
||||
69, 77, 101, 109, 5, 13, 37, 45,
|
||||
71, 79, 103, 111, 7, 15, 39, 47 },
|
||||
{ 81, 89, 113, 121, 17, 25, 49, 57,
|
||||
83, 91, 115, 123, 19, 27, 51, 59,
|
||||
85, 93, 117, 125, 21, 29, 53, 61,
|
||||
87, 95, 119, 127, 23, 31, 55, 63 },
|
||||
{ 192, 200, 224, 232, 128, 136, 160, 168, // column 1
|
||||
194, 202, 226, 234, 130, 138, 162, 170,
|
||||
196, 204, 228, 236, 132, 140, 164, 172,
|
||||
198, 206, 230, 238, 134, 142, 166, 174 },
|
||||
{ 208, 216, 240, 248, 144, 152, 176, 184,
|
||||
210, 218, 242, 250, 146, 154, 178, 186,
|
||||
212, 220, 244, 252, 148, 156, 180, 188,
|
||||
214, 222, 246, 254, 150, 158, 182, 190 },
|
||||
{ 129, 137, 161, 169, 193, 201, 225, 233,
|
||||
131, 139, 163, 171, 195, 203, 227, 235,
|
||||
133, 141, 165, 173, 197, 205, 229, 237,
|
||||
135, 143, 167, 175, 199, 207, 231, 239 },
|
||||
{ 145, 153, 177, 185, 209, 217, 241, 249,
|
||||
147, 155, 179, 187, 211, 219, 243, 251,
|
||||
149, 157, 181, 189, 213, 221, 245, 253,
|
||||
151, 159, 183, 191, 215, 223, 247, 255 },
|
||||
{ 256, 264, 288, 296, 320, 328, 352, 360, // column 2
|
||||
258, 266, 290, 298, 322, 330, 354, 362,
|
||||
260, 268, 292, 300, 324, 332, 356, 364,
|
||||
262, 270, 294, 302, 326, 334, 358, 366 },
|
||||
{ 272, 280, 304, 312, 336, 344, 368, 376,
|
||||
274, 282, 306, 314, 338, 346, 370, 378,
|
||||
276, 284, 308, 316, 340, 348, 372, 380,
|
||||
278, 286, 310, 318, 342, 350, 374, 382 },
|
||||
{ 321, 329, 353, 361, 257, 265, 289, 297,
|
||||
323, 331, 355, 363, 259, 267, 291, 299,
|
||||
325, 333, 357, 365, 261, 269, 293, 301,
|
||||
327, 335, 359, 367, 263, 271, 295, 303 },
|
||||
{ 337, 345, 369, 377, 273, 281, 305, 313,
|
||||
339, 347, 371, 379, 275, 283, 307, 315,
|
||||
341, 349, 373, 381, 277, 285, 309, 317,
|
||||
343, 351, 375, 383, 279, 287, 311, 319 },
|
||||
{ 448, 456, 480, 488, 384, 392, 416, 424, // column 3
|
||||
450, 458, 482, 490, 386, 394, 418, 426,
|
||||
452, 460, 484, 492, 388, 396, 420, 428,
|
||||
454, 462, 486, 494, 390, 398, 422, 430 },
|
||||
{ 464, 472, 496, 504, 400, 408, 432, 440,
|
||||
466, 474, 498, 506, 402, 410, 434, 442,
|
||||
468, 476, 500, 508, 404, 412, 436, 444,
|
||||
470, 478, 502, 510, 406, 414, 438, 446 },
|
||||
{ 385, 393, 417, 425, 449, 457, 481, 489,
|
||||
387, 395, 419, 427, 451, 459, 483, 491,
|
||||
389, 397, 421, 429, 453, 461, 485, 493,
|
||||
391, 399, 423, 431, 455, 463, 487, 495 },
|
||||
{ 401, 409, 433, 441, 465, 473, 497, 505,
|
||||
403, 411, 435, 443, 467, 475, 499, 507,
|
||||
405, 413, 437, 445, 469, 477, 501, 509,
|
||||
407, 415, 439, 447, 471, 479, 503, 511 },
|
||||
};
|
||||
|
||||
u32 g_pageTable32[32][64];
|
||||
u32 g_pageTable32Z[32][64];
|
||||
u32 g_pageTable16[64][64];
|
||||
u32 g_pageTable16S[64][64];
|
||||
u32 g_pageTable16Z[64][64];
|
||||
u32 g_pageTable16SZ[64][64];
|
||||
u32 g_pageTable8[64][128];
|
||||
u32 g_pageTable4[128][128];
|
||||
|
||||
BLOCK m_Blocks[0x40]; // do so blocks are indexable
|
||||
static __aligned16 u32 tempblock[64];
|
||||
|
||||
#define DSTPSM gs.dstbuf.psm
|
||||
|
||||
#define START_HOSTLOCAL() \
|
||||
assert( gs.imageTransfer == 0 ); \
|
||||
u8* pstart = ZeroGS::g_pbyGSMemory + gs.dstbuf.bp*256; \
|
||||
\
|
||||
const u8* pendbuf = (const u8*)pbyMem + nQWordSize*4; \
|
||||
int i = gs.imageY, j = gs.imageX; \
|
||||
|
||||
extern BOOL g_bSaveTrans;
|
||||
|
||||
#define END_HOSTLOCAL() \
|
||||
End: \
|
||||
if( i >= gs.imageEndY ) { \
|
||||
assert( gs.imageTransfer == -1 || i == gs.imageEndY ); \
|
||||
gs.imageTransfer = -1; \
|
||||
/*int start, end; \
|
||||
ZeroGS::GetRectMemAddress(start, end, gs.dstbuf.psm, gs.trxpos.dx, gs.trxpos.dy, gs.imageWnew, gs.imageHnew, gs.dstbuf.bp, gs.dstbuf.bw); \
|
||||
ZeroGS::g_MemTargs.ClearRange(start, end);*/ \
|
||||
} \
|
||||
else { \
|
||||
/* update new params */ \
|
||||
gs.imageY = i; \
|
||||
gs.imageX = j; \
|
||||
} \
|
||||
|
||||
// transfers whole rows
|
||||
#define TRANSMIT_HOSTLOCAL_Y_(psm, T, widthlimit, endY) { \
|
||||
assert( (nSize%widthlimit) == 0 && widthlimit <= 4 ); \
|
||||
if( (gs.imageEndX-gs.trxpos.dx)%widthlimit ) { \
|
||||
/*GS_LOG("Bad Transmission! %d %d, psm: %d\n", gs.trxpos.dx, gs.imageEndX, DSTPSM);*/ \
|
||||
for(; i < endY; ++i) { \
|
||||
for(; j < gs.imageEndX && nSize > 0; j += 1, nSize -= 1, pbuf += 1) { \
|
||||
/* write as many pixel at one time as possible */ \
|
||||
writePixel##psm##_0(pstart, j%2048, i%2048, pbuf[0], gs.dstbuf.bw); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
for(; i < endY; ++i) { \
|
||||
for(; j < gs.imageEndX && nSize > 0; j += widthlimit, nSize -= widthlimit, pbuf += widthlimit) { \
|
||||
/* write as many pixel at one time as possible */ \
|
||||
if( nSize < widthlimit ) goto End; \
|
||||
writePixel##psm##_0(pstart, j%2048, i%2048, pbuf[0], gs.dstbuf.bw); \
|
||||
\
|
||||
if( widthlimit > 1 ) { \
|
||||
writePixel##psm##_0(pstart, (j+1)%2048, i%2048, pbuf[1], gs.dstbuf.bw); \
|
||||
\
|
||||
if( widthlimit > 2 ) { \
|
||||
writePixel##psm##_0(pstart, (j+2)%2048, i%2048, pbuf[2], gs.dstbuf.bw); \
|
||||
\
|
||||
if( widthlimit > 3 ) { \
|
||||
writePixel##psm##_0(pstart, (j+3)%2048, i%2048, pbuf[3], gs.dstbuf.bw); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
if( j >= gs.imageEndX ) { assert(j == gs.imageEndX); j = gs.trxpos.dx; } \
|
||||
else { assert( gs.imageTransfer == -1 || nSize*sizeof(T)/4 == 0 ); goto End; } \
|
||||
} \
|
||||
} \
|
||||
|
||||
// transmit until endX, don't check size since it has already been prevalidated
|
||||
#define TRANSMIT_HOSTLOCAL_X_(psm, T, widthlimit, blockheight, startX) { \
|
||||
for(int tempi = 0; tempi < blockheight; ++tempi) { \
|
||||
for(j = startX; j < gs.imageEndX; j++, pbuf++) { \
|
||||
writePixel##psm##_0(pstart, j%2048, (i+tempi)%2048, pbuf[0], gs.dstbuf.bw); \
|
||||
} \
|
||||
pbuf += pitch-fracX; \
|
||||
} \
|
||||
} \
|
||||
|
||||
// transfers whole rows
|
||||
#define TRANSMIT_HOSTLOCAL_Y_24(psm, T, widthlimit, endY) { \
|
||||
if( widthlimit != 8 || ((gs.imageEndX-gs.trxpos.dx)%widthlimit) ) { \
|
||||
/*GS_LOG("Bad Transmission! %d %d, psm: %d\n", gs.trxpos.dx, gs.imageEndX, DSTPSM);*/ \
|
||||
for(; i < endY; ++i) { \
|
||||
for(; j < gs.imageEndX && nSize > 0; j += 1, nSize -= 1, pbuf += 3) { \
|
||||
writePixel##psm##_0(pstart, j%2048, i%2048, *(u32*)(pbuf), gs.dstbuf.bw); \
|
||||
} \
|
||||
\
|
||||
if( j >= gs.imageEndX ) { assert(gs.imageTransfer == -1 || j == gs.imageEndX); j = gs.trxpos.dx; } \
|
||||
else { assert( gs.imageTransfer == -1 || nSize == 0 ); goto End; } \
|
||||
} \
|
||||
} \
|
||||
else { \
|
||||
assert( /*(nSize%widthlimit) == 0 &&*/ widthlimit == 8 ); \
|
||||
for(; i < endY; ++i) { \
|
||||
for(; j < gs.imageEndX && nSize > 0; j += widthlimit, nSize -= widthlimit, pbuf += 3*widthlimit) { \
|
||||
if( nSize < widthlimit ) goto End; \
|
||||
/* write as many pixel at one time as possible */ \
|
||||
writePixel##psm##_0(pstart, j%2048, i%2048, *(u32*)(pbuf+0), gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+1)%2048, i%2048, *(u32*)(pbuf+3), gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+2)%2048, i%2048, *(u32*)(pbuf+6), gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+3)%2048, i%2048, *(u32*)(pbuf+9), gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+4)%2048, i%2048, *(u32*)(pbuf+12), gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+5)%2048, i%2048, *(u32*)(pbuf+15), gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+6)%2048, i%2048, *(u32*)(pbuf+18), gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+7)%2048, i%2048, *(u32*)(pbuf+21), gs.dstbuf.bw); \
|
||||
} \
|
||||
\
|
||||
if( j >= gs.imageEndX ) { assert(gs.imageTransfer == -1 || j == gs.imageEndX); j = gs.trxpos.dx; } \
|
||||
else { \
|
||||
if( nSize < 0 ) { \
|
||||
/* extracted too much */ \
|
||||
assert( (nSize%3)==0 && nSize > -24 ); \
|
||||
j += nSize/3; \
|
||||
nSize = 0; \
|
||||
} \
|
||||
assert( gs.imageTransfer == -1 || nSize == 0 ); \
|
||||
goto End; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
|
||||
// transmit until endX, don't check size since it has already been prevalidated
|
||||
#define TRANSMIT_HOSTLOCAL_X_24(psm, T, widthlimit, blockheight, startX) { \
|
||||
for(int tempi = 0; tempi < blockheight; ++tempi) { \
|
||||
for(j = startX; j < gs.imageEndX; j++, pbuf += 3) { \
|
||||
writePixel##psm##_0(pstart, j%2048, (i+tempi)%2048, *(u32*)pbuf, gs.dstbuf.bw); \
|
||||
} \
|
||||
pbuf += 3*(pitch-fracX); \
|
||||
} \
|
||||
} \
|
||||
|
||||
// meant for 4bit transfers
|
||||
#define TRANSMIT_HOSTLOCAL_Y_4(psm, T, widthlimit, endY) { \
|
||||
for(; i < endY; ++i) { \
|
||||
for(; j < gs.imageEndX && nSize > 0; j += widthlimit, nSize -= widthlimit) { \
|
||||
/* write as many pixel at one time as possible */ \
|
||||
writePixel##psm##_0(pstart, j%2048, i%2048, *pbuf&0x0f, gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+1)%2048, i%2048, *pbuf>>4, gs.dstbuf.bw); \
|
||||
pbuf++; \
|
||||
if( widthlimit > 2 ) { \
|
||||
writePixel##psm##_0(pstart, (j+2)%2048, i%2048, *pbuf&0x0f, gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+3)%2048, i%2048, *pbuf>>4, gs.dstbuf.bw); \
|
||||
pbuf++; \
|
||||
\
|
||||
if( widthlimit > 4 ) { \
|
||||
writePixel##psm##_0(pstart, (j+4)%2048, i%2048, *pbuf&0x0f, gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+5)%2048, i%2048, *pbuf>>4, gs.dstbuf.bw); \
|
||||
pbuf++; \
|
||||
\
|
||||
if( widthlimit > 6 ) { \
|
||||
writePixel##psm##_0(pstart, (j+6)%2048, i%2048, *pbuf&0x0f, gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+7)%2048, i%2048, *pbuf>>4, gs.dstbuf.bw); \
|
||||
pbuf++; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
if( j >= gs.imageEndX ) { j = gs.trxpos.dx; } \
|
||||
else { assert( gs.imageTransfer == -1 || (nSize/32) == 0 ); goto End; } \
|
||||
} \
|
||||
} \
|
||||
|
||||
// transmit until endX, don't check size since it has already been prevalidated
|
||||
#define TRANSMIT_HOSTLOCAL_X_4(psm, T, widthlimit, blockheight, startX) { \
|
||||
for(int tempi = 0; tempi < blockheight; ++tempi) { \
|
||||
for(j = startX; j < gs.imageEndX; j+=2, pbuf++) { \
|
||||
writePixel##psm##_0(pstart, j%2048, (i+tempi)%2048, pbuf[0]&0x0f, gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+1)%2048, (i+tempi)%2048, pbuf[0]>>4, gs.dstbuf.bw); \
|
||||
} \
|
||||
pbuf += (pitch-fracX)/2; \
|
||||
} \
|
||||
} \
|
||||
|
||||
// calculate pitch in source buffer
|
||||
#define TRANSMIT_PITCH_(pitch, T) (pitch*sizeof(T))
|
||||
#define TRANSMIT_PITCH_24(pitch, T) (pitch*3)
|
||||
#define TRANSMIT_PITCH_4(pitch, T) (pitch/2)
|
||||
|
||||
// special swizzle macros
|
||||
#define SwizzleBlock24(dst, src, pitch) { \
|
||||
u8* pnewsrc = src; \
|
||||
u32* pblock = tempblock; \
|
||||
\
|
||||
for(int by = 0; by < 7; ++by, pblock += 8, pnewsrc += pitch-24) { \
|
||||
for(int bx = 0; bx < 8; ++bx, pnewsrc += 3) { \
|
||||
pblock[bx] = *(u32*)pnewsrc; \
|
||||
} \
|
||||
} \
|
||||
for(int bx = 0; bx < 7; ++bx, pnewsrc += 3) { \
|
||||
/* might be 1 byte out of bounds of GS memory */ \
|
||||
pblock[bx] = *(u32*)pnewsrc; \
|
||||
} \
|
||||
/* do 3 bytes for the last copy */ \
|
||||
*((u8*)pblock+28) = pnewsrc[0]; \
|
||||
*((u8*)pblock+29) = pnewsrc[1]; \
|
||||
*((u8*)pblock+30) = pnewsrc[2]; \
|
||||
SwizzleBlock32((u8*)dst, (u8*)tempblock, 32, 0x00ffffff); \
|
||||
} \
|
||||
|
||||
#define SwizzleBlock24u SwizzleBlock24
|
||||
|
||||
#define SwizzleBlock8H(dst, src, pitch) { \
|
||||
u8* pnewsrc = src; \
|
||||
u32* pblock = tempblock; \
|
||||
\
|
||||
for(int by = 0; by < 8; ++by, pblock += 8, pnewsrc += pitch) { \
|
||||
u32 u = *(u32*)pnewsrc; \
|
||||
pblock[0] = u<<24; \
|
||||
pblock[1] = u<<16; \
|
||||
pblock[2] = u<<8; \
|
||||
pblock[3] = u; \
|
||||
u = *(u32*)(pnewsrc+4); \
|
||||
pblock[4] = u<<24; \
|
||||
pblock[5] = u<<16; \
|
||||
pblock[6] = u<<8; \
|
||||
pblock[7] = u; \
|
||||
} \
|
||||
SwizzleBlock32((u8*)dst, (u8*)tempblock, 32, 0xff000000); \
|
||||
} \
|
||||
|
||||
#define SwizzleBlock8Hu SwizzleBlock8H
|
||||
|
||||
#define SwizzleBlock4HH(dst, src, pitch) { \
|
||||
u8* pnewsrc = src; \
|
||||
u32* pblock = tempblock; \
|
||||
\
|
||||
for(int by = 0; by < 8; ++by, pblock += 8, pnewsrc += pitch) { \
|
||||
u32 u = *(u32*)pnewsrc; \
|
||||
pblock[0] = u<<28; \
|
||||
pblock[1] = u<<24; \
|
||||
pblock[2] = u<<20; \
|
||||
pblock[3] = u<<16; \
|
||||
pblock[4] = u<<12; \
|
||||
pblock[5] = u<<8; \
|
||||
pblock[6] = u<<4; \
|
||||
pblock[7] = u; \
|
||||
} \
|
||||
SwizzleBlock32((u8*)dst, (u8*)tempblock, 32, 0xf0000000); \
|
||||
} \
|
||||
|
||||
#define SwizzleBlock4HHu SwizzleBlock4HH
|
||||
|
||||
#define SwizzleBlock4HL(dst, src, pitch) { \
|
||||
u8* pnewsrc = src; \
|
||||
u32* pblock = tempblock; \
|
||||
\
|
||||
for(int by = 0; by < 8; ++by, pblock += 8, pnewsrc += pitch) { \
|
||||
u32 u = *(u32*)pnewsrc; \
|
||||
pblock[0] = u<<24; \
|
||||
pblock[1] = u<<20; \
|
||||
pblock[2] = u<<16; \
|
||||
pblock[3] = u<<12; \
|
||||
pblock[4] = u<<8; \
|
||||
pblock[5] = u<<4; \
|
||||
pblock[6] = u; \
|
||||
pblock[7] = u>>4; \
|
||||
} \
|
||||
SwizzleBlock32((u8*)dst, (u8*)tempblock, 32, 0x0f000000); \
|
||||
} \
|
||||
|
||||
#define SwizzleBlock4HLu SwizzleBlock4HL
|
||||
|
||||
// ------------------------
|
||||
// | Y |
|
||||
// ------------------------
|
||||
// | block | |
|
||||
// | aligned area | X |
|
||||
// | | |
|
||||
// ------------------------
|
||||
// | Y |
|
||||
// ------------------------
|
||||
#define DEFINE_TRANSFERLOCAL(psm, T, widthlimit, blockbits, blockwidth, blockheight, TransSfx, SwizzleBlock) \
|
||||
int TransferHostLocal##psm(const void* pbyMem, u32 nQWordSize) \
|
||||
{ \
|
||||
START_HOSTLOCAL(); \
|
||||
\
|
||||
const T* pbuf = (const T*)pbyMem; \
|
||||
int nLeftOver = (nQWordSize*4*2)%(TRANSMIT_PITCH##TransSfx(2, T)); \
|
||||
int nSize = nQWordSize*4*2/TRANSMIT_PITCH##TransSfx(2, T); \
|
||||
nSize = min(nSize, gs.imageWnew * gs.imageHnew); \
|
||||
\
|
||||
int pitch, area, fracX; \
|
||||
int endY = ROUND_UPPOW2(i, blockheight); \
|
||||
int alignedY = ROUND_DOWNPOW2(gs.imageEndY, blockheight); \
|
||||
int alignedX = ROUND_DOWNPOW2(gs.imageEndX, blockwidth); \
|
||||
bool bAligned, bCanAlign = MOD_POW2(gs.trxpos.dx, blockwidth) == 0 && (j == gs.trxpos.dx) && (alignedY > endY) && alignedX > gs.trxpos.dx; \
|
||||
\
|
||||
if( (gs.imageEndX-gs.trxpos.dx)%widthlimit ) { \
|
||||
/* hack */ \
|
||||
int testwidth = (int)nSize - (gs.imageEndY-i)*(gs.imageEndX-gs.trxpos.dx)+(j-gs.trxpos.dx); \
|
||||
if ((testwidth <= widthlimit) && (testwidth >= -widthlimit)) { \
|
||||
/* Don't transfer */ \
|
||||
/*DEBUG_LOG("bad texture %s: %d %d %d\n", #psm, gs.trxpos.dx, gs.imageEndX, nQWordSize);*/ \
|
||||
gs.imageTransfer = -1; \
|
||||
} \
|
||||
bCanAlign = false; \
|
||||
} \
|
||||
\
|
||||
/* first align on block boundary */ \
|
||||
if( MOD_POW2(i, blockheight) || !bCanAlign ) { \
|
||||
\
|
||||
if( !bCanAlign ) \
|
||||
endY = gs.imageEndY; /* transfer the whole image */ \
|
||||
else \
|
||||
assert( endY < gs.imageEndY); /* part of alignment condition */ \
|
||||
\
|
||||
if( ((gs.imageEndX-gs.trxpos.dx)%widthlimit) || ((gs.imageEndX-j)%widthlimit) ) { \
|
||||
/* transmit with a width of 1 */ \
|
||||
TRANSMIT_HOSTLOCAL_Y##TransSfx(psm, T, (1+(DSTPSM == 0x14)), endY); \
|
||||
} \
|
||||
else { \
|
||||
TRANSMIT_HOSTLOCAL_Y##TransSfx(psm, T, widthlimit, endY); \
|
||||
} \
|
||||
\
|
||||
if( nSize == 0 || i == gs.imageEndY ) \
|
||||
goto End; \
|
||||
} \
|
||||
\
|
||||
assert( MOD_POW2(i, blockheight) == 0 && j == gs.trxpos.dx); \
|
||||
\
|
||||
/* can align! */ \
|
||||
pitch = gs.imageEndX-gs.trxpos.dx; \
|
||||
area = pitch*blockheight; \
|
||||
fracX = gs.imageEndX-alignedX; \
|
||||
\
|
||||
/* on top of checking whether pbuf is alinged, make sure that the width is at least aligned to its limits (due to bugs in pcsx2) */ \
|
||||
bAligned = !((uptr)pbuf & 0xf) && (TRANSMIT_PITCH##TransSfx(pitch, T)&0xf) == 0; \
|
||||
\
|
||||
/* transfer aligning to blocks */ \
|
||||
for(; i < alignedY && nSize >= area; i += blockheight, nSize -= area) { \
|
||||
\
|
||||
if( bAligned || ((DSTPSM==PSMCT24) || (DSTPSM==PSMT8H) || (DSTPSM==PSMT4HH) || (DSTPSM==PSMT4HL)) ) { \
|
||||
for(int tempj = gs.trxpos.dx; tempj < alignedX; tempj += blockwidth, pbuf += TRANSMIT_PITCH##TransSfx(blockwidth, T)/sizeof(T)) { \
|
||||
SwizzleBlock(pstart + getPixelAddress##psm##_0(tempj, i, gs.dstbuf.bw)*blockbits/8, \
|
||||
(u8*)pbuf, TRANSMIT_PITCH##TransSfx(pitch, T)); \
|
||||
} \
|
||||
} \
|
||||
else { \
|
||||
for(int tempj = gs.trxpos.dx; tempj < alignedX; tempj += blockwidth, pbuf += TRANSMIT_PITCH##TransSfx(blockwidth, T)/sizeof(T)) { \
|
||||
SwizzleBlock##u(pstart + getPixelAddress##psm##_0(tempj, i, gs.dstbuf.bw)*blockbits/8, \
|
||||
(u8*)pbuf, TRANSMIT_PITCH##TransSfx(pitch, T)); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
/* transfer the rest */ \
|
||||
if( alignedX < gs.imageEndX ) { \
|
||||
TRANSMIT_HOSTLOCAL_X##TransSfx(psm, T, widthlimit, blockheight, alignedX); \
|
||||
pbuf -= TRANSMIT_PITCH##TransSfx((alignedX-gs.trxpos.dx), T)/sizeof(T); \
|
||||
} \
|
||||
else pbuf += (blockheight-1)*TRANSMIT_PITCH##TransSfx(pitch, T)/sizeof(T); \
|
||||
j = gs.trxpos.dx; \
|
||||
} \
|
||||
\
|
||||
if( TRANSMIT_PITCH##TransSfx(nSize, T)/4 > 0 ) { \
|
||||
TRANSMIT_HOSTLOCAL_Y##TransSfx(psm, T, widthlimit, gs.imageEndY); \
|
||||
/* sometimes wrong sizes are sent (tekken tag) */ \
|
||||
assert( gs.imageTransfer == -1 || TRANSMIT_PITCH##TransSfx(nSize,T)/4 <= 2 ); \
|
||||
} \
|
||||
\
|
||||
END_HOSTLOCAL(); \
|
||||
return (nSize * TRANSMIT_PITCH##TransSfx(2, T) + nLeftOver)/2; \
|
||||
} \
|
||||
|
||||
DEFINE_TRANSFERLOCAL(32, u32, 2, 32, 8, 8, _, SwizzleBlock32);
|
||||
DEFINE_TRANSFERLOCAL(32Z, u32, 2, 32, 8, 8, _, SwizzleBlock32);
|
||||
DEFINE_TRANSFERLOCAL(24, u8, 8, 32, 8, 8, _24, SwizzleBlock24);
|
||||
DEFINE_TRANSFERLOCAL(24Z, u8, 8, 32, 8, 8, _24, SwizzleBlock24);
|
||||
DEFINE_TRANSFERLOCAL(16, u16, 4, 16, 16, 8, _, SwizzleBlock16);
|
||||
DEFINE_TRANSFERLOCAL(16S, u16, 4, 16, 16, 8, _, SwizzleBlock16);
|
||||
DEFINE_TRANSFERLOCAL(16Z, u16, 4, 16, 16, 8, _, SwizzleBlock16);
|
||||
DEFINE_TRANSFERLOCAL(16SZ, u16, 4, 16, 16, 8, _, SwizzleBlock16);
|
||||
DEFINE_TRANSFERLOCAL(8, u8, 4, 8, 16, 16, _, SwizzleBlock8);
|
||||
DEFINE_TRANSFERLOCAL(4, u8, 8, 4, 32, 16, _4, SwizzleBlock4);
|
||||
DEFINE_TRANSFERLOCAL(8H, u8, 4, 32, 8, 8, _, SwizzleBlock8H);
|
||||
DEFINE_TRANSFERLOCAL(4HL, u8, 8, 32, 8, 8, _4, SwizzleBlock4HL);
|
||||
DEFINE_TRANSFERLOCAL(4HH, u8, 8, 32, 8, 8, _4, SwizzleBlock4HH);
|
||||
|
||||
//#define T u8
|
||||
//#define widthlimit 8
|
||||
//#define blockbits 4
|
||||
//#define blockwidth 32
|
||||
//#define blockheight 16
|
||||
//
|
||||
//void TransferHostLocal4(const void* pbyMem, u32 nQWordSize)
|
||||
//{
|
||||
// START_HOSTLOCAL();
|
||||
//
|
||||
// const T* pbuf = (const T*)pbyMem;
|
||||
// u32 nSize = nQWordSize*16*2/TRANSMIT_PITCH_4(2, T);
|
||||
// nSize = min(nSize, gs.imageWnew * gs.imageHnew);
|
||||
//
|
||||
// int endY = ROUND_UPPOW2(i, blockheight);
|
||||
// int alignedY = ROUND_DOWNPOW2(gs.imageEndY, blockheight);
|
||||
// int alignedX = ROUND_DOWNPOW2(gs.imageEndX, blockwidth);
|
||||
// bool bCanAlign = MOD_POW2(gs.trxpos.dx, blockwidth) == 0 && (j == gs.trxpos.dx) && (alignedY > endY) && alignedX > gs.trxpos.dx;
|
||||
//
|
||||
// if( (gs.imageEndX-gs.trxpos.dx)%widthlimit ) {
|
||||
// /* hack */
|
||||
// if( abs((int)nSize - (gs.imageEndY-i)*(gs.imageEndX-gs.trxpos.dx)+(j-gs.trxpos.dx)) <= widthlimit ) {
|
||||
// /* don't transfer */
|
||||
// /*DEBUG_LOG("bad texture %s: %d %d %d\n", #psm, gs.trxpos.dx, gs.imageEndX, nQWordSize);*/
|
||||
// gs.imageTransfer = -1;
|
||||
// }
|
||||
// bCanAlign = false;
|
||||
// }
|
||||
//
|
||||
// /* first align on block boundary */
|
||||
// if( MOD_POW2(i, blockheight) || !bCanAlign ) {
|
||||
//
|
||||
// if( !bCanAlign )
|
||||
// endY = gs.imageEndY; /* transfer the whole image */
|
||||
// else
|
||||
// assert( endY < gs.imageEndY); /* part of alignment condition */
|
||||
//
|
||||
// if( (DSTPSM == 0x13 || DSTPSM == 0x14) && ((gs.imageEndX-gs.trxpos.dx)%widthlimit) ) {
|
||||
// /* transmit with a width of 1 */
|
||||
// TRANSMIT_HOSTLOCAL_Y_4(4, T, (1+(DSTPSM == 0x14)), endY);
|
||||
// }
|
||||
// else {
|
||||
// TRANSMIT_HOSTLOCAL_Y_4(4, T, widthlimit, endY);
|
||||
// }
|
||||
//
|
||||
// if( nSize == 0 || i == gs.imageEndY )
|
||||
// goto End;
|
||||
// }
|
||||
//
|
||||
// assert( MOD_POW2(i, blockheight) == 0 && j == gs.trxpos.dx);
|
||||
//
|
||||
// /* can align! */
|
||||
// int pitch = gs.imageEndX-gs.trxpos.dx;
|
||||
// u32 area = pitch*blockheight;
|
||||
// int fracX = gs.imageEndX-alignedX;
|
||||
//
|
||||
// /* on top of checking whether pbuf is alinged, make sure that the width is at least aligned to its limits (due to bugs in pcsx2) */
|
||||
// bool bAligned = !((u32)pbuf & 0xf) && (TRANSMIT_PITCH_4(pitch, T)&0xf) == 0;
|
||||
//
|
||||
// /* transfer aligning to blocks */
|
||||
// for(; i < alignedY && nSize >= area; i += blockheight, nSize -= area) {
|
||||
//
|
||||
// if( bAligned || ((DSTPSM==PSMCT24) || (DSTPSM==PSMT8H) || (DSTPSM==PSMT4HH) || (DSTPSM==PSMT4HL)) ) {
|
||||
// for(int tempj = gs.trxpos.dx; tempj < alignedX; tempj += blockwidth, pbuf += TRANSMIT_PITCH_4(blockwidth, T)/sizeof(T)) {
|
||||
// SwizzleBlock4(pstart + getPixelAddress4_0(tempj, i, gs.dstbuf.bw)*blockbits/8,
|
||||
// (u8*)pbuf, TRANSMIT_PITCH_4(pitch, T));
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// for(int tempj = gs.trxpos.dx; tempj < alignedX; tempj += blockwidth, pbuf += TRANSMIT_PITCH_4(blockwidth, T)/sizeof(T)) {
|
||||
// SwizzleBlock4u(pstart + getPixelAddress4_0(tempj, i, gs.dstbuf.bw)*blockbits/8,
|
||||
// (u8*)pbuf, TRANSMIT_PITCH_4(pitch, T));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /* transfer the rest */
|
||||
// if( alignedX < gs.imageEndX ) {
|
||||
// TRANSMIT_HOSTLOCAL_X_4(4, T, widthlimit, blockheight, alignedX);
|
||||
// pbuf -= TRANSMIT_PITCH_4((alignedX-gs.trxpos.dx), T)/sizeof(T);
|
||||
// }
|
||||
// else pbuf += (blockheight-1)*TRANSMIT_PITCH_4(pitch, T)/sizeof(T);
|
||||
// j = 0;
|
||||
// }
|
||||
//
|
||||
// if( TRANSMIT_PITCH_4(nSize, T)/4 > 0 ) {
|
||||
// TRANSMIT_HOSTLOCAL_Y_4(4, T, widthlimit, gs.imageEndY);
|
||||
// /* sometimes wrong sizes are sent (tekken tag) */
|
||||
// assert( gs.imageTransfer == -1 || TRANSMIT_PITCH_4(nSize,T)/4 <= 2 );
|
||||
// }
|
||||
//
|
||||
// END_HOSTLOCAL();
|
||||
//}
|
||||
|
||||
void TransferLocalHost32(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost24(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost16(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost16S(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost8(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost4(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost8H(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost4HL(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost4HH(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost32Z(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost24Z(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost16Z(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost16SZ(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
#define FILL_BLOCK(bw, bh, ox, oy, mult, psm, psmcol) { \
|
||||
b.vTexDims = D3DXVECTOR2(BLOCK_TEXWIDTH/(float)(bw), BLOCK_TEXHEIGHT/(float)bh); \
|
||||
b.vTexBlock = D3DXVECTOR4((float)bw/BLOCK_TEXWIDTH, (float)bh/BLOCK_TEXHEIGHT, ((float)ox+0.2f)/BLOCK_TEXWIDTH, ((float)oy+0.05f)/BLOCK_TEXHEIGHT); \
|
||||
b.width = bw; \
|
||||
b.height = bh; \
|
||||
b.colwidth = bh / 4; \
|
||||
b.colheight = bw / 8; \
|
||||
b.bpp = 32/mult; \
|
||||
\
|
||||
b.pageTable = &g_pageTable##psm[0][0]; \
|
||||
b.blockTable = &g_blockTable##psm[0][0]; \
|
||||
b.columnTable = &g_columnTable##psmcol[0][0]; \
|
||||
assert( sizeof(g_pageTable##psm) == bw*bh*sizeof(g_pageTable##psm[0][0]) ); \
|
||||
psrcf = (float*)pBlockTexture->pBits + ox + oy * pBlockTexture->Pitch/sizeof(float); \
|
||||
psrcw = (WORD*)pBlockTexture->pBits + ox + oy * pBlockTexture->Pitch/sizeof(WORD); \
|
||||
for(i = 0; i < bh; ++i) { \
|
||||
for(j = 0; j < bw; ++j) { \
|
||||
/* fill the table */ \
|
||||
u32 u = g_blockTable##psm[(i / b.colheight)][(j / b.colwidth)] * 64 * mult + g_columnTable##psmcol[i%b.colheight][j%b.colwidth]; \
|
||||
b.pageTable[i*bw+j] = u; \
|
||||
if( format == D3DFMT_R32F ) { \
|
||||
psrcf[i*pBlockTexture->Pitch/sizeof(float)+j] = (float)(u) / (float)(GPU_TEXWIDTH*mult); \
|
||||
} \
|
||||
else { \
|
||||
psrcw[i*pBlockTexture->Pitch/sizeof(WORD)+j] = u; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
if( pBilinearTexture != NULL ) { \
|
||||
assert( format == D3DFMT_R32F ); \
|
||||
psrcv = (DXVEC4*)pBilinearTexture->pBits + ox + oy * pBilinearTexture->Pitch/sizeof(DXVEC4); \
|
||||
for(i = 0; i < bh; ++i) { \
|
||||
for(j = 0; j < bw; ++j) { \
|
||||
DXVEC4* pv = &psrcv[i*pBilinearTexture->Pitch/sizeof(DXVEC4)+j]; \
|
||||
pv->x = psrcf[i*pBlockTexture->Pitch/sizeof(float)+j]; \
|
||||
pv->y = psrcf[i*pBlockTexture->Pitch/sizeof(float)+((j+1)%bw)]; \
|
||||
pv->z = psrcf[((i+1)%bh)*pBlockTexture->Pitch/sizeof(float)+j]; \
|
||||
pv->w = psrcf[((i+1)%bh)*pBlockTexture->Pitch/sizeof(float)+((j+1)%bw)]; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
b.getPixelAddress = getPixelAddress##psm; \
|
||||
b.getPixelAddress_0 = getPixelAddress##psm##_0; \
|
||||
b.writePixel = writePixel##psm; \
|
||||
b.writePixel_0 = writePixel##psm##_0; \
|
||||
b.readPixel = readPixel##psm; \
|
||||
b.readPixel_0 = readPixel##psm##_0; \
|
||||
b.TransferHostLocal = TransferHostLocal##psm; \
|
||||
b.TransferLocalHost = TransferLocalHost##psm; \
|
||||
} \
|
||||
|
||||
void BLOCK::FillBlocks(const D3DLOCKED_RECT* pBlockTexture, const D3DLOCKED_RECT* pBilinearTexture, D3DFORMAT format)
|
||||
{
|
||||
assert( pBlockTexture != NULL );
|
||||
assert( format == D3DFMT_R32F || format == D3DFMT_G16R16 );
|
||||
|
||||
int i, j;
|
||||
BLOCK b;
|
||||
float* psrcf = NULL;
|
||||
WORD* psrcw = NULL;
|
||||
DXVEC4* psrcv = NULL;
|
||||
|
||||
memset(m_Blocks, 0, sizeof(m_Blocks));
|
||||
|
||||
// 32
|
||||
FILL_BLOCK(64, 32, 0, 0, 1, 32, 32);
|
||||
m_Blocks[PSMCT32] = b;
|
||||
|
||||
// 24 (same as 32 except write/readPixel are different)
|
||||
m_Blocks[PSMCT24] = b;
|
||||
m_Blocks[PSMCT24].writePixel = writePixel24;
|
||||
m_Blocks[PSMCT24].writePixel_0 = writePixel24_0;
|
||||
m_Blocks[PSMCT24].readPixel = readPixel24;
|
||||
m_Blocks[PSMCT24].readPixel_0 = readPixel24_0;
|
||||
m_Blocks[PSMCT24].TransferHostLocal = TransferHostLocal24;
|
||||
m_Blocks[PSMCT24].TransferLocalHost = TransferLocalHost24;
|
||||
|
||||
// 8H (same as 32 except write/readPixel are different)
|
||||
m_Blocks[PSMT8H] = b;
|
||||
m_Blocks[PSMT8H].writePixel = writePixel8H;
|
||||
m_Blocks[PSMT8H].writePixel_0 = writePixel8H_0;
|
||||
m_Blocks[PSMT8H].readPixel = readPixel8H;
|
||||
m_Blocks[PSMT8H].readPixel_0 = readPixel8H_0;
|
||||
m_Blocks[PSMT8H].TransferHostLocal = TransferHostLocal8H;
|
||||
m_Blocks[PSMT8H].TransferLocalHost = TransferLocalHost8H;
|
||||
|
||||
m_Blocks[PSMT4HL] = b;
|
||||
m_Blocks[PSMT4HL].writePixel = writePixel4HL;
|
||||
m_Blocks[PSMT4HL].writePixel_0 = writePixel4HL_0;
|
||||
m_Blocks[PSMT4HL].readPixel = readPixel4HL;
|
||||
m_Blocks[PSMT4HL].readPixel_0 = readPixel4HL_0;
|
||||
m_Blocks[PSMT4HL].TransferHostLocal = TransferHostLocal4HL;
|
||||
m_Blocks[PSMT4HL].TransferLocalHost = TransferLocalHost4HL;
|
||||
|
||||
m_Blocks[PSMT4HH] = b;
|
||||
m_Blocks[PSMT4HH].writePixel = writePixel4HH;
|
||||
m_Blocks[PSMT4HH].writePixel_0 = writePixel4HH_0;
|
||||
m_Blocks[PSMT4HH].readPixel = readPixel4HH;
|
||||
m_Blocks[PSMT4HH].readPixel_0 = readPixel4HH_0;
|
||||
m_Blocks[PSMT4HH].TransferHostLocal = TransferHostLocal4HH;
|
||||
m_Blocks[PSMT4HH].TransferLocalHost = TransferLocalHost4HH;
|
||||
|
||||
// 32z
|
||||
FILL_BLOCK(64, 32, 64, 0, 1, 32Z, 32);
|
||||
m_Blocks[PSMT32Z] = b;
|
||||
|
||||
// 24Z (same as 32Z except write/readPixel are different)
|
||||
m_Blocks[PSMT24Z] = b;
|
||||
m_Blocks[PSMT24Z].writePixel = writePixel24Z;
|
||||
m_Blocks[PSMT24Z].writePixel_0 = writePixel24Z_0;
|
||||
m_Blocks[PSMT24Z].readPixel = readPixel24Z;
|
||||
m_Blocks[PSMT24Z].readPixel_0 = readPixel24Z_0;
|
||||
m_Blocks[PSMT24Z].TransferHostLocal = TransferHostLocal24Z;
|
||||
m_Blocks[PSMT24Z].TransferLocalHost = TransferLocalHost24Z;
|
||||
|
||||
// 16
|
||||
FILL_BLOCK(64, 64, 0, 32, 2, 16, 16);
|
||||
m_Blocks[PSMCT16] = b;
|
||||
|
||||
// 16s
|
||||
FILL_BLOCK(64, 64, 64, 32, 2, 16S, 16);
|
||||
m_Blocks[PSMCT16S] = b;
|
||||
|
||||
// 16z
|
||||
FILL_BLOCK(64, 64, 0, 96, 2, 16Z, 16);
|
||||
m_Blocks[PSMT16Z] = b;
|
||||
|
||||
// 16sz
|
||||
FILL_BLOCK(64, 64, 64, 96, 2, 16SZ, 16);
|
||||
m_Blocks[PSMT16SZ] = b;
|
||||
|
||||
// 8
|
||||
FILL_BLOCK(128, 64, 0, 160, 4, 8, 8);
|
||||
m_Blocks[PSMT8] = b;
|
||||
|
||||
// 4
|
||||
FILL_BLOCK(128, 128, 0, 224, 8, 4, 4);
|
||||
m_Blocks[PSMT4] = b;
|
||||
}
|
|
@ -1,486 +0,0 @@
|
|||
/* ZeroGS
|
||||
* Copyright (C) 2005-2006 zerofrog@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 __MEM_H__
|
||||
#define __MEM_H__
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
// works only when base is a power of 2
|
||||
#define ROUND_UPPOW2(val, base) (((val)+(base-1))&~(base-1))
|
||||
#define ROUND_DOWNPOW2(val, base) ((val)&~(base-1))
|
||||
#define MOD_POW2(val, base) ((val)&(base-1))
|
||||
|
||||
// d3d texture dims
|
||||
#define BLOCK_TEXWIDTH 128
|
||||
#define BLOCK_TEXHEIGHT 512
|
||||
|
||||
// rest not visible externally
|
||||
struct BLOCK
|
||||
{
|
||||
BLOCK() { memset(this, 0, sizeof(BLOCK)); }
|
||||
|
||||
// shader constants for this block
|
||||
D3DXVECTOR4 vTexBlock;
|
||||
D3DXVECTOR2 vTexDims;
|
||||
int width, height; // dims of one page in pixels
|
||||
int bpp;
|
||||
int colwidth, colheight;
|
||||
u32* pageTable; // offset inside each page
|
||||
u32* blockTable;
|
||||
u32* columnTable;
|
||||
|
||||
u32 (*getPixelAddress)(int x, int y, u32 bp, u32 bw);
|
||||
u32 (*getPixelAddress_0)(int x, int y, u32 bw);
|
||||
void (*writePixel)(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw);
|
||||
void (*writePixel_0)(void* pmem, int x, int y, u32 pixel, u32 bw);
|
||||
u32 (*readPixel)(const void* pmem, int x, int y, u32 bp, u32 bw);
|
||||
u32 (*readPixel_0)(const void* pmem, int x, int y, u32 bw);
|
||||
int (*TransferHostLocal)(const void* pbyMem, u32 nQWordSize);
|
||||
void (*TransferLocalHost)(void* pbyMem, u32 nQWordSize);
|
||||
|
||||
// texture must be of dims BLOCK_TEXWIDTH and BLOCK_TEXHEIGHT
|
||||
static void FillBlocks(const D3DLOCKED_RECT* pBlockTexture, const D3DLOCKED_RECT* pBilinearTexture, D3DFORMAT format);
|
||||
};
|
||||
|
||||
extern BLOCK m_Blocks[];
|
||||
|
||||
extern u32 g_blockTable32[4][8];
|
||||
extern u32 g_blockTable32Z[4][8];
|
||||
extern u32 g_blockTable16[8][4];
|
||||
extern u32 g_blockTable16S[8][4];
|
||||
extern u32 g_blockTable16Z[8][4];
|
||||
extern u32 g_blockTable16SZ[8][4];
|
||||
extern u32 g_blockTable8[4][8];
|
||||
extern u32 g_blockTable4[8][4];
|
||||
|
||||
extern u32 g_columnTable32[8][8];
|
||||
extern u32 g_columnTable16[8][16];
|
||||
extern u32 g_columnTable8[16][16];
|
||||
extern u32 g_columnTable4[16][32];
|
||||
|
||||
extern u32 g_pageTable32[32][64];
|
||||
extern u32 g_pageTable32Z[32][64];
|
||||
extern u32 g_pageTable16[64][64];
|
||||
extern u32 g_pageTable16S[64][64];
|
||||
extern u32 g_pageTable16Z[64][64];
|
||||
extern u32 g_pageTable16SZ[64][64];
|
||||
extern u32 g_pageTable8[64][128];
|
||||
extern u32 g_pageTable4[128][128];
|
||||
|
||||
static __forceinline u32 getPixelAddress32(int x, int y, u32 bp, u32 bw) {
|
||||
u32 basepage = ((y>>5) * (bw>>6)) + (x>>6);
|
||||
u32 word = bp * 64 + basepage * 2048 + g_pageTable32[y&31][x&63];
|
||||
//assert (word < 0x100000);
|
||||
//word = min(word, 0xfffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress32_0(int x, int y, u32 bw) {
|
||||
u32 basepage = ((y>>5) * (bw>>6)) + (x>>6);
|
||||
u32 word = basepage * 2048 + g_pageTable32[y&31][x&63];
|
||||
//assert (word < 0x100000);
|
||||
//word = min(word, 0xfffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
#define getPixelAddress24 getPixelAddress32
|
||||
#define getPixelAddress24_0 getPixelAddress32_0
|
||||
#define getPixelAddress8H getPixelAddress32
|
||||
#define getPixelAddress8H_0 getPixelAddress32_0
|
||||
#define getPixelAddress4HL getPixelAddress32
|
||||
#define getPixelAddress4HL_0 getPixelAddress32_0
|
||||
#define getPixelAddress4HH getPixelAddress32
|
||||
#define getPixelAddress4HH_0 getPixelAddress32_0
|
||||
|
||||
static __forceinline u32 getPixelAddress16(int x, int y, u32 bp, u32 bw) {
|
||||
u32 basepage = ((y>>6) * (bw>>6)) + (x>>6);
|
||||
u32 word = bp * 128 + basepage * 4096 + g_pageTable16[y&63][x&63];
|
||||
//assert (word < 0x200000);
|
||||
//word = min(word, 0x1fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress16_0(int x, int y, u32 bw) {
|
||||
u32 basepage = ((y>>6) * (bw>>6)) + (x>>6);
|
||||
u32 word = basepage * 4096 + g_pageTable16[y&63][x&63];
|
||||
//assert (word < 0x200000);
|
||||
//word = min(word, 0x1fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress16S(int x, int y, u32 bp, u32 bw) {
|
||||
u32 basepage = ((y>>6) * (bw>>6)) + (x>>6);
|
||||
u32 word = bp * 128 + basepage * 4096 + g_pageTable16S[y&63][x&63];
|
||||
//assert (word < 0x200000);
|
||||
//word = min(word, 0x1fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress16S_0(int x, int y, u32 bw) {
|
||||
u32 basepage = ((y>>6) * (bw>>6)) + (x>>6);
|
||||
u32 word = basepage * 4096 + g_pageTable16S[y&63][x&63];
|
||||
//assert (word < 0x200000);
|
||||
//word = min(word, 0x1fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress8(int x, int y, u32 bp, u32 bw) {
|
||||
u32 basepage = ((y>>6) * ((bw+127)>>7)) + (x>>7);
|
||||
u32 word = bp * 256 + basepage * 8192 + g_pageTable8[y&63][x&127];
|
||||
//assert (word < 0x400000);
|
||||
//word = min(word, 0x3fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress8_0(int x, int y, u32 bw) {
|
||||
u32 basepage = ((y>>6) * ((bw+127)>>7)) + (x>>7);
|
||||
u32 word = basepage * 8192 + g_pageTable8[y&63][x&127];
|
||||
//assert (word < 0x400000);
|
||||
//word = min(word, 0x3fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress4(int x, int y, u32 bp, u32 bw) {
|
||||
u32 basepage = ((y>>7) * ((bw+127)>>7)) + (x>>7);
|
||||
u32 word = bp * 512 + basepage * 16384 + g_pageTable4[y&127][x&127];
|
||||
//assert (word < 0x800000);
|
||||
//word = min(word, 0x7fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress4_0(int x, int y, u32 bw) {
|
||||
u32 basepage = ((y>>7) * ((bw+127)>>7)) + (x>>7);
|
||||
u32 word = basepage * 16384 + g_pageTable4[y&127][x&127];
|
||||
//assert (word < 0x800000);
|
||||
//word = min(word, 0x7fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress32Z(int x, int y, u32 bp, u32 bw) {
|
||||
u32 basepage = ((y>>5) * (bw>>6)) + (x>>6);
|
||||
u32 word = bp * 64 + basepage * 2048 + g_pageTable32Z[y&31][x&63];
|
||||
//assert (word < 0x100000);
|
||||
//word = min(word, 0xfffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress32Z_0(int x, int y, u32 bw) {
|
||||
u32 basepage = ((y>>5) * (bw>>6)) + (x>>6);
|
||||
u32 word = basepage * 2048 + g_pageTable32Z[y&31][x&63];
|
||||
//assert (word < 0x100000);
|
||||
//word = min(word, 0xfffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
#define getPixelAddress24Z getPixelAddress32Z
|
||||
#define getPixelAddress24Z_0 getPixelAddress32Z_0
|
||||
|
||||
static __forceinline u32 getPixelAddress16Z(int x, int y, u32 bp, u32 bw) {
|
||||
u32 basepage = ((y>>6) * (bw>>6)) + (x>>6);
|
||||
u32 word = bp * 128 + basepage * 4096 + g_pageTable16Z[y&63][x&63];
|
||||
//assert (word < 0x200000);
|
||||
//word = min(word, 0x1fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress16Z_0(int x, int y, u32 bw) {
|
||||
u32 basepage = ((y>>6) * (bw>>6)) + (x>>6);
|
||||
u32 word = basepage * 4096 + g_pageTable16Z[y&63][x&63];
|
||||
//assert (word < 0x200000);
|
||||
//word = min(word, 0x1fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress16SZ(int x, int y, u32 bp, u32 bw) {
|
||||
u32 basepage = ((y>>6) * (bw>>6)) + (x>>6);
|
||||
u32 word = bp * 128 + basepage * 4096 + g_pageTable16SZ[y&63][x&63];
|
||||
//assert (word < 0x200000);
|
||||
//word = min(word, 0x1fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress16SZ_0(int x, int y, u32 bw) {
|
||||
u32 basepage = ((y>>6) * (bw>>6)) + (x>>6);
|
||||
u32 word = basepage * 4096 + g_pageTable16SZ[y&63][x&63];
|
||||
//assert (word < 0x200000);
|
||||
//word = min(word, 0x1fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel32(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
((u32*)pmem)[getPixelAddress32(x, y, bp, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel24(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
u8 *buf = (u8*)&((u32*)pmem)[getPixelAddress32(x, y, bp, bw)];
|
||||
u8 *pix = (u8*)&pixel;
|
||||
buf[0] = pix[0]; buf[1] = pix[1]; buf[2] = pix[2];
|
||||
}
|
||||
|
||||
static __forceinline void writePixel16(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
((u16*)pmem)[getPixelAddress16(x, y, bp, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel16S(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
((u16*)pmem)[getPixelAddress16S(x, y, bp, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel8(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
((u8*)pmem)[getPixelAddress8(x, y, bp, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel8H(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
((u8*)pmem)[4*getPixelAddress32(x, y, bp, bw)+3] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel4(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
u32 addr = getPixelAddress4(x, y, bp, bw);
|
||||
u8 pix = ((u8*)pmem)[addr/2];
|
||||
if (addr & 0x1) ((u8*)pmem)[addr/2] = (pix & 0x0f) | (pixel << 4);
|
||||
else ((u8*)pmem)[addr/2] = (pix & 0xf0) | (pixel);
|
||||
}
|
||||
|
||||
static __forceinline void writePixel4HL(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
u8 *p = (u8*)pmem + 4*getPixelAddress4HL(x, y, bp, bw)+3;
|
||||
*p = (*p & 0xf0) | pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel4HH(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
u8 *p = (u8*)pmem + 4*getPixelAddress4HH(x, y, bp, bw)+3;
|
||||
*p = (*p & 0x0f) | (pixel<<4);
|
||||
}
|
||||
|
||||
static __forceinline void writePixel32Z(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
((u32*)pmem)[getPixelAddress32Z(x, y, bp, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel24Z(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
u8 *buf = (u8*)pmem + 4*getPixelAddress32Z(x, y, bp, bw);
|
||||
u8 *pix = (u8*)&pixel;
|
||||
buf[0] = pix[0]; buf[1] = pix[1]; buf[2] = pix[2];
|
||||
}
|
||||
|
||||
static __forceinline void writePixel16Z(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
((u16*)pmem)[getPixelAddress16Z(x, y, bp, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel16SZ(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
((u16*)pmem)[getPixelAddress16SZ(x, y, bp, bw)] = pixel;
|
||||
}
|
||||
|
||||
|
||||
///////////////
|
||||
|
||||
static __forceinline u32 readPixel32(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
return ((const u32*)pmem)[getPixelAddress32(x, y, bp, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel24(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
return ((const u32*)pmem)[getPixelAddress32(x, y, bp, bw)] & 0xffffff;
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel16(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
return ((const u16*)pmem)[getPixelAddress16(x, y, bp, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel16S(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
return ((const u16*)pmem)[getPixelAddress16S(x, y, bp, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel8(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
return ((const u8*)pmem)[getPixelAddress8(x, y, bp, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel8H(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
return ((const u8*)pmem)[4*getPixelAddress32(x, y, bp, bw) + 3];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel4(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
u32 addr = getPixelAddress4(x, y, bp, bw);
|
||||
u8 pix = ((const u8*)pmem)[addr/2];
|
||||
if (addr & 0x1)
|
||||
return pix >> 4;
|
||||
else return pix & 0xf;
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel4HL(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
const u8 *p = (const u8*)pmem+4*getPixelAddress4HL(x, y, bp, bw)+3;
|
||||
return *p & 0x0f;
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel4HH(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
const u8 *p = (const u8*)pmem+4*getPixelAddress4HH(x, y, bp, bw) + 3;
|
||||
return *p >> 4;
|
||||
}
|
||||
|
||||
///////////////
|
||||
|
||||
static __forceinline u32 readPixel32Z(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
return ((const u32*)pmem)[getPixelAddress32Z(x, y, bp, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel24Z(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
return ((const u32*)pmem)[getPixelAddress32Z(x, y, bp, bw)] & 0xffffff;
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel16Z(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
return ((const u16*)pmem)[getPixelAddress16Z(x, y, bp, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel16SZ(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
return ((const u16*)pmem)[getPixelAddress16SZ(x, y, bp, bw)];
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
// Functions that take 0 bps //
|
||||
///////////////////////////////
|
||||
|
||||
static __forceinline void writePixel32_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
((u32*)pmem)[getPixelAddress32_0(x, y, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel24_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
u8 *buf = (u8*)&((u32*)pmem)[getPixelAddress32_0(x, y, bw)];
|
||||
u8 *pix = (u8*)&pixel;
|
||||
#if defined(_MSC_VER) && defined(__x86_64__)
|
||||
memcpy(buf, pix, 3);
|
||||
#else
|
||||
buf[0] = pix[0]; buf[1] = pix[1]; buf[2] = pix[2];
|
||||
#endif
|
||||
}
|
||||
|
||||
static __forceinline void writePixel16_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
((u16*)pmem)[getPixelAddress16_0(x, y, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel16S_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
((u16*)pmem)[getPixelAddress16S_0(x, y, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel8_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
((u8*)pmem)[getPixelAddress8_0(x, y, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel8H_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
((u8*)pmem)[4*getPixelAddress32_0(x, y, bw)+3] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel4_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
u32 addr = getPixelAddress4_0(x, y, bw);
|
||||
u8 pix = ((u8*)pmem)[addr/2];
|
||||
if (addr & 0x1) ((u8*)pmem)[addr/2] = (pix & 0x0f) | (pixel << 4);
|
||||
else ((u8*)pmem)[addr/2] = (pix & 0xf0) | (pixel);
|
||||
}
|
||||
|
||||
static __forceinline void writePixel4HL_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
u8 *p = (u8*)pmem + 4*getPixelAddress4HL_0(x, y, bw)+3;
|
||||
*p = (*p & 0xf0) | pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel4HH_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
u8 *p = (u8*)pmem + 4*getPixelAddress4HH_0(x, y, bw)+3;
|
||||
*p = (*p & 0x0f) | (pixel<<4);
|
||||
}
|
||||
|
||||
static __forceinline void writePixel32Z_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
((u32*)pmem)[getPixelAddress32Z_0(x, y, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel24Z_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
u8 *buf = (u8*)pmem + 4*getPixelAddress32Z_0(x, y, bw);
|
||||
u8 *pix = (u8*)&pixel;
|
||||
#if defined(_MSC_VER) && defined(__x86_64__)
|
||||
memcpy(buf, pix, 3);
|
||||
#else
|
||||
buf[0] = pix[0]; buf[1] = pix[1]; buf[2] = pix[2];
|
||||
#endif
|
||||
}
|
||||
|
||||
static __forceinline void writePixel16Z_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
((u16*)pmem)[getPixelAddress16Z_0(x, y, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel16SZ_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
((u16*)pmem)[getPixelAddress16SZ_0(x, y, bw)] = pixel;
|
||||
}
|
||||
|
||||
|
||||
///////////////
|
||||
|
||||
static __forceinline u32 readPixel32_0(const void* pmem, int x, int y, u32 bw) {
|
||||
return ((const u32*)pmem)[getPixelAddress32_0(x, y, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel24_0(const void* pmem, int x, int y, u32 bw) {
|
||||
return ((const u32*)pmem)[getPixelAddress32_0(x, y, bw)] & 0xffffff;
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel16_0(const void* pmem, int x, int y, u32 bw) {
|
||||
return ((const u16*)pmem)[getPixelAddress16_0(x, y, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel16S_0(const void* pmem, int x, int y, u32 bw) {
|
||||
return ((const u16*)pmem)[getPixelAddress16S_0(x, y, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel8_0(const void* pmem, int x, int y, u32 bw) {
|
||||
return ((const u8*)pmem)[getPixelAddress8_0(x, y, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel8H_0(const void* pmem, int x, int y, u32 bw) {
|
||||
return ((const u8*)pmem)[4*getPixelAddress32_0(x, y, bw) + 3];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel4_0(const void* pmem, int x, int y, u32 bw) {
|
||||
u32 addr = getPixelAddress4_0(x, y, bw);
|
||||
u8 pix = ((const u8*)pmem)[addr/2];
|
||||
if (addr & 0x1)
|
||||
return pix >> 4;
|
||||
else return pix & 0xf;
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel4HL_0(const void* pmem, int x, int y, u32 bw) {
|
||||
const u8 *p = (const u8*)pmem+4*getPixelAddress4HL_0(x, y, bw)+3;
|
||||
return *p & 0x0f;
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel4HH_0(const void* pmem, int x, int y, u32 bw) {
|
||||
const u8 *p = (const u8*)pmem+4*getPixelAddress4HH_0(x, y, bw) + 3;
|
||||
return *p >> 4;
|
||||
}
|
||||
|
||||
///////////////
|
||||
|
||||
static __forceinline u32 readPixel32Z_0(const void* pmem, int x, int y, u32 bw) {
|
||||
return ((const u32*)pmem)[getPixelAddress32Z_0(x, y, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel24Z_0(const void* pmem, int x, int y, u32 bw) {
|
||||
return ((const u32*)pmem)[getPixelAddress32Z_0(x, y, bw)] & 0xffffff;
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel16Z_0(const void* pmem, int x, int y, u32 bw) {
|
||||
return ((const u16*)pmem)[getPixelAddress16Z_0(x, y, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel16SZ_0(const void* pmem, int x, int y, u32 bw) {
|
||||
return ((const u16*)pmem)[getPixelAddress16SZ_0(x, y, bw)];
|
||||
}
|
||||
|
||||
#endif /* __MEM_H__ */
|
|
@ -1,13 +0,0 @@
|
|||
ZeroGS DirectX
|
||||
--------------
|
||||
author: zerofrog (@gmail.com)
|
||||
|
||||
ZeroGS heavily uses GPU shaders. All the shaders are written in Microsoft's HLSL language and can be found in ps2hw.fx, ps2hw_ctx0.fx and ps2hw_ctx1.fx.
|
||||
|
||||
'Dev' versions of ZeroGS directly read ps2hw.fx
|
||||
'Release' versions of ZeroGS read a precompiled version of ps2hw.fx from ps2hw.dat. In order to build ps2hw.dat, compile ZeroGSShaders and execute:
|
||||
|
||||
./ZeroGSShaders ps2hw.fx ps2hw.dat
|
||||
|
||||
For Windows users, once ZeroGSShaders is built, run buildshaders.bat directly. It will update all necessary resource files.
|
||||
Note that ZeroGSShaders has only been tested in Windows so far, but the Windows ps2hw.dat can be used in linux builds.
|
File diff suppressed because it is too large
Load Diff
|
@ -1,122 +0,0 @@
|
|||
/* ZeroGS
|
||||
* Copyright (C) 2005-2006 zerofrog@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 __GSREGS_H__
|
||||
#define __GSREGS_H__
|
||||
|
||||
typedef void (__fastcall *GIFRegHandler)(u32* data);
|
||||
|
||||
void __fastcall GIFPackedRegHandlerNull(u32* data);
|
||||
void __fastcall GIFPackedRegHandlerRGBA(u32* data);
|
||||
void __fastcall GIFPackedRegHandlerSTQ(u32* data);
|
||||
void __fastcall GIFPackedRegHandlerUV(u32* data);
|
||||
void __fastcall GIFPackedRegHandlerXYZF2(u32* data);
|
||||
void __fastcall GIFPackedRegHandlerXYZ2(u32* data);
|
||||
void __fastcall GIFPackedRegHandlerFOG(u32* data);
|
||||
void __fastcall GIFPackedRegHandlerA_D(u32* data);
|
||||
void __fastcall GIFPackedRegHandlerNOP(u32* data);
|
||||
|
||||
void __fastcall GIFRegHandlerNull(u32* data);
|
||||
void __fastcall GIFRegHandlerPRIM(u32* data);
|
||||
void __fastcall GIFRegHandlerRGBAQ(u32* data);
|
||||
void __fastcall GIFRegHandlerST(u32* data);
|
||||
void __fastcall GIFRegHandlerUV(u32* data);
|
||||
void __fastcall GIFRegHandlerXYZF2(u32* data);
|
||||
void __fastcall GIFRegHandlerXYZ2(u32* data);
|
||||
void __fastcall GIFRegHandlerTEX0_1(u32* data);
|
||||
void __fastcall GIFRegHandlerTEX0_2(u32* data);
|
||||
void __fastcall GIFRegHandlerCLAMP_1(u32* data);
|
||||
void __fastcall GIFRegHandlerCLAMP_2(u32* data);
|
||||
void __fastcall GIFRegHandlerFOG(u32* data);
|
||||
void __fastcall GIFRegHandlerXYZF3(u32* data);
|
||||
void __fastcall GIFRegHandlerXYZ3(u32* data);
|
||||
void __fastcall GIFRegHandlerNOP(u32* data);
|
||||
void __fastcall GIFRegHandlerTEX1_1(u32* data);
|
||||
void __fastcall GIFRegHandlerTEX1_2(u32* data);
|
||||
void __fastcall GIFRegHandlerTEX2_1(u32* data);
|
||||
void __fastcall GIFRegHandlerTEX2_2(u32* data);
|
||||
void __fastcall GIFRegHandlerXYOFFSET_1(u32* data);
|
||||
void __fastcall GIFRegHandlerXYOFFSET_2(u32* data);
|
||||
void __fastcall GIFRegHandlerPRMODECONT(u32* data);
|
||||
void __fastcall GIFRegHandlerPRMODE(u32* data);
|
||||
void __fastcall GIFRegHandlerTEXCLUT(u32* data);
|
||||
void __fastcall GIFRegHandlerSCANMSK(u32* data);
|
||||
void __fastcall GIFRegHandlerMIPTBP1_1(u32* data);
|
||||
void __fastcall GIFRegHandlerMIPTBP1_2(u32* data);
|
||||
void __fastcall GIFRegHandlerMIPTBP2_1(u32* data);
|
||||
void __fastcall GIFRegHandlerMIPTBP2_2(u32* data);
|
||||
void __fastcall GIFRegHandlerTEXA(u32* data);
|
||||
void __fastcall GIFRegHandlerFOGCOL(u32* data);
|
||||
void __fastcall GIFRegHandlerTEXFLUSH(u32* data);
|
||||
void __fastcall GIFRegHandlerSCISSOR_1(u32* data);
|
||||
void __fastcall GIFRegHandlerSCISSOR_2(u32* data);
|
||||
void __fastcall GIFRegHandlerALPHA_1(u32* data);
|
||||
void __fastcall GIFRegHandlerALPHA_2(u32* data);
|
||||
void __fastcall GIFRegHandlerDIMX(u32* data);
|
||||
void __fastcall GIFRegHandlerDTHE(u32* data);
|
||||
void __fastcall GIFRegHandlerCOLCLAMP(u32* data);
|
||||
void __fastcall GIFRegHandlerTEST_1(u32* data);
|
||||
void __fastcall GIFRegHandlerTEST_2(u32* data);
|
||||
void __fastcall GIFRegHandlerPABE(u32* data);
|
||||
void __fastcall GIFRegHandlerFBA_1(u32* data);
|
||||
void __fastcall GIFRegHandlerFBA_2(u32* data);
|
||||
void __fastcall GIFRegHandlerFRAME_1(u32* data);
|
||||
void __fastcall GIFRegHandlerFRAME_2(u32* data);
|
||||
void __fastcall GIFRegHandlerZBUF_1(u32* data);
|
||||
void __fastcall GIFRegHandlerZBUF_2(u32* data);
|
||||
void __fastcall GIFRegHandlerBITBLTBUF(u32* data);
|
||||
void __fastcall GIFRegHandlerTRXPOS(u32* data);
|
||||
void __fastcall GIFRegHandlerTRXREG(u32* data);
|
||||
void __fastcall GIFRegHandlerTRXDIR(u32* data);
|
||||
void __fastcall GIFRegHandlerHWREG(u32* data);
|
||||
void __fastcall GIFRegHandlerSIGNAL(u32* data);
|
||||
void __fastcall GIFRegHandlerFINISH(u32* data);
|
||||
void __fastcall GIFRegHandlerLABEL(u32* data);
|
||||
|
||||
// special buffers that delay executing some insturctions
|
||||
//#include <vector>
|
||||
//
|
||||
//class ExecuteBuffer
|
||||
//{
|
||||
//public:
|
||||
// virtual void Execute()=0;
|
||||
//};
|
||||
//
|
||||
//class ExecuteBufferXeno : public ExecuteBuffer
|
||||
//{
|
||||
//public:
|
||||
// ExecuteBufferXeno();
|
||||
// virtual void Execute();
|
||||
//
|
||||
// void SetTex0(u32* data);
|
||||
// void SetTex1(u32* data);
|
||||
// void SetClamp(u32* data);
|
||||
// void SetTri();
|
||||
//
|
||||
// u32 clampdata[2];
|
||||
// u32 tex0data[2];
|
||||
// u32 tex1data[2];
|
||||
// primInfo curprim;
|
||||
//
|
||||
// std::vector<Vertex> vertices;
|
||||
// bool bCanExecute;
|
||||
//};
|
||||
//
|
||||
//extern ExecuteBufferXeno g_ebXeno;
|
||||
|
||||
#endif
|
|
@ -1,103 +0,0 @@
|
|||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
#include <d3dx9.h>
|
||||
#include <dxerr.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "Win32.h"
|
||||
|
||||
extern HINSTANCE hInst;
|
||||
|
||||
void SaveConfig() {
|
||||
|
||||
char szValue[256];
|
||||
const std::string iniFile( s_strIniPath + "/zerogs.ini" );
|
||||
|
||||
sprintf(szValue,"%u",conf.interlace);
|
||||
WritePrivateProfileString("Settings", "Interlace",szValue,iniFile.c_str());
|
||||
sprintf(szValue,"%u",conf.aa);
|
||||
WritePrivateProfileString("Settings", "Antialiasing",szValue,iniFile.c_str());
|
||||
sprintf(szValue,"%u",conf.bilinear);
|
||||
WritePrivateProfileString("Settings", "Bilinear",szValue,iniFile.c_str());
|
||||
sprintf(szValue,"%u",conf.options);
|
||||
WritePrivateProfileString("Settings", "Options",szValue,iniFile.c_str());
|
||||
sprintf(szValue,"%u",conf.gamesettings);
|
||||
WritePrivateProfileString("Settings", "AdvancedOptions",szValue,iniFile.c_str());
|
||||
}
|
||||
|
||||
void LoadConfig() {
|
||||
|
||||
char szValue[256];
|
||||
const std::string iniFile( s_strIniPath + "/zerogs.ini" );
|
||||
|
||||
memset(&conf, 0, sizeof(conf));
|
||||
conf.interlace = 0; // on, mode 1
|
||||
conf.mrtdepth = 1;
|
||||
conf.options = 0;
|
||||
conf.bilinear = 1;
|
||||
conf.width = 640;
|
||||
conf.height = 480;
|
||||
|
||||
FILE *fp=fopen(iniFile.c_str(),"rt");
|
||||
if (!fp)
|
||||
{
|
||||
CreateDirectory(s_strIniPath.c_str(),NULL);
|
||||
SaveConfig();//save and return
|
||||
return ;
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
GetPrivateProfileString("Settings", "Interlace", NULL, szValue, 20, iniFile.c_str());
|
||||
conf.interlace = (u8)strtoul(szValue, NULL, 10);
|
||||
GetPrivateProfileString("Settings", "Antialiasing", NULL, szValue, 20, iniFile.c_str());
|
||||
conf.aa = (u8)strtoul(szValue, NULL, 10);
|
||||
GetPrivateProfileString("Settings", "Options", NULL, szValue, 20, iniFile.c_str());
|
||||
conf.options = strtoul(szValue, NULL, 10);
|
||||
GetPrivateProfileString("Settings", "AdvancedOptions", NULL, szValue, 20, iniFile.c_str());
|
||||
conf.gamesettings = strtoul(szValue, NULL, 10);
|
||||
GetPrivateProfileString("Settings", "Bilinear", NULL, szValue, 20, iniFile.c_str());
|
||||
conf.bilinear = strtoul(szValue, NULL, 10);
|
||||
|
||||
if( conf.aa < 0 || conf.aa > 4 ) conf.aa = 0;
|
||||
|
||||
switch(conf.options&GSOPTION_WINDIMS) {
|
||||
case GSOPTION_WIN640:
|
||||
conf.width = 640;
|
||||
conf.height = 480;
|
||||
break;
|
||||
case GSOPTION_WIN800:
|
||||
conf.width = 800;
|
||||
conf.height = 600;
|
||||
break;
|
||||
case GSOPTION_WIN1024:
|
||||
conf.width = 1024;
|
||||
conf.height = 768;
|
||||
break;
|
||||
case GSOPTION_WIN1280:
|
||||
conf.width = 1280;
|
||||
conf.height = 960;
|
||||
break;
|
||||
case GSOPTION_WIN960W:
|
||||
conf.width = 960;
|
||||
conf.height = 540;
|
||||
break;
|
||||
case GSOPTION_WIN1280W:
|
||||
conf.width = 1280;
|
||||
conf.height = 720;
|
||||
break;
|
||||
case GSOPTION_WIN1920W:
|
||||
conf.width = 1920;
|
||||
conf.height = 1080;
|
||||
break;
|
||||
}
|
||||
|
||||
// turn off all hacks by defaultof
|
||||
conf.options &= ~(GSOPTION_FULLSCREEN|GSOPTION_WIREFRAME|GSOPTION_CAPTUREAVI);
|
||||
conf.options |= GSOPTION_LOADED;
|
||||
|
||||
if( conf.width <= 0 || conf.height <= 0 ) {
|
||||
conf.width = 640;
|
||||
conf.height = 480;
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
; Declares the module parameters for the DLL.
|
||||
|
||||
;LIBRARY "ZeroGS"
|
||||
|
||||
EXPORTS
|
||||
; Explicit exports can go here
|
||||
PS2EgetLibType @2
|
||||
PS2EgetLibName @3
|
||||
PS2EgetLibVersion2 @4
|
||||
GSinit @5
|
||||
GSshutdown @6
|
||||
GSopen @7
|
||||
GSclose @8
|
||||
GSgifTransfer1 @13
|
||||
GSgifTransfer2 @14
|
||||
GSgifTransfer3 @15
|
||||
GSreadFIFO @16
|
||||
GSvsync @17
|
||||
GSmakeSnapshot @18
|
||||
GSkeyEvent @19
|
||||
GSfreeze @20
|
||||
GSconfigure @21
|
||||
GStest @22
|
||||
GSabout @23
|
||||
GSreadFIFO2 @28
|
||||
GSirqCallback @29
|
||||
GSsetBaseMem @30
|
||||
GSwriteCSR @31
|
||||
GSchangeSaveState @32
|
||||
GSreset @33
|
||||
GSgifSoftReset @34
|
||||
GSsetFrameSkip @35
|
||||
GSsetGameCRC @36
|
||||
GSgetLastTag @37
|
||||
GSsetupRecording @38
|
||||
GSsetSettingsDir @39
|
|
@ -1,266 +0,0 @@
|
|||
#if defined(_WIN32) || defined(__WIN32__)
|
||||
#include <d3dx9.h>
|
||||
#include <dxerr.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
|
||||
#include "resrc1.h"
|
||||
|
||||
#include "Win32.h"
|
||||
|
||||
#include <map>
|
||||
using namespace std;
|
||||
|
||||
extern int g_nPixelShaderVer;
|
||||
HINSTANCE hInst=NULL;
|
||||
static int prevbilinearfilter = 0;
|
||||
|
||||
void CALLBACK GSkeyEvent(keyEvent *ev) {
|
||||
// switch (ev->event) {
|
||||
// case KEYPRESS:
|
||||
// switch (ev->key) {
|
||||
// case VK_PRIOR:
|
||||
// if (conf.fps) fpspos++; break;
|
||||
// case VK_NEXT:
|
||||
// if (conf.fps) fpspos--; break;
|
||||
// case VK_END:
|
||||
// if (conf.fps) fpspress = 1; break;
|
||||
// case VK_DELETE:
|
||||
// conf.fps = 1 - conf.fps;
|
||||
// break;
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
|
||||
BOOL CALLBACK LoggingDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
switch(uMsg) {
|
||||
case WM_INITDIALOG:
|
||||
if (conf.log) CheckDlgButton(hW, IDC_LOG, TRUE);
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch(LOWORD(wParam)) {
|
||||
case IDCANCEL:
|
||||
EndDialog(hW, FALSE);
|
||||
return TRUE;
|
||||
case IDOK:
|
||||
if (IsDlgButtonChecked(hW, IDC_LOG))
|
||||
conf.log = 1;
|
||||
else conf.log = 0;
|
||||
|
||||
SaveConfig();
|
||||
EndDialog(hW, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
map<int, int> mapConfOpts;
|
||||
#define PUT_CONF(id) mapConfOpts[IDC_CONFOPT_##id] = 0x##id;
|
||||
|
||||
void OnInitDialog(HWND hW)
|
||||
{
|
||||
if( !(conf.options & GSOPTION_LOADED) )
|
||||
LoadConfig();
|
||||
|
||||
CheckDlgButton(hW, IDC_CONFIG_INTERLACE, conf.interlace);
|
||||
CheckDlgButton(hW, IDC_CONFIG_BILINEAR, !!conf.bilinear);
|
||||
CheckDlgButton(hW, IDC_CONFIG_DEPTHWRITE, conf.mrtdepth);
|
||||
CheckRadioButton(hW,IDC_CONFIG_AANONE,IDC_CONFIG_AA16, IDC_CONFIG_AANONE+conf.aa);
|
||||
CheckDlgButton(hW, IDC_CONFIG_WIREFRAME, (conf.options&GSOPTION_WIREFRAME)?1:0);
|
||||
CheckDlgButton(hW, IDC_CONFIG_CAPTUREAVI, (conf.options&GSOPTION_CAPTUREAVI)?1:0);
|
||||
CheckDlgButton(hW, IDC_CONFIG_FULLSCREEN, (conf.options&GSOPTION_FULLSCREEN)?1:0);
|
||||
//CheckDlgButton(hW, IDC_CONFIG_FFX, (conf.options&GSOPTION_FFXHACK)?1:0);
|
||||
CheckDlgButton(hW, IDC_CONFIG_BMPSS, (conf.options&GSOPTION_BMPSNAP)?1:0);
|
||||
CheckRadioButton(hW,IDC_CONF_WIN640, IDC_CONF_WIN1920W, IDC_CONF_WIN640+((conf.options&GSOPTION_WINDIMS)>>4));
|
||||
|
||||
prevbilinearfilter = conf.bilinear;
|
||||
|
||||
mapConfOpts.clear();
|
||||
PUT_CONF(00000001);
|
||||
PUT_CONF(00000002);
|
||||
PUT_CONF(00000004);
|
||||
PUT_CONF(00000008);
|
||||
PUT_CONF(00000010);
|
||||
PUT_CONF(00000020);
|
||||
PUT_CONF(00000040);
|
||||
PUT_CONF(00000080);
|
||||
PUT_CONF(00000200);
|
||||
PUT_CONF(00000400);
|
||||
PUT_CONF(00000800);
|
||||
PUT_CONF(00001000);
|
||||
PUT_CONF(00002000);
|
||||
PUT_CONF(00004000);
|
||||
PUT_CONF(00008000);
|
||||
PUT_CONF(00010000);
|
||||
PUT_CONF(00020000);
|
||||
PUT_CONF(00040000);
|
||||
PUT_CONF(00080000);
|
||||
PUT_CONF(00100000);
|
||||
PUT_CONF(00200000);
|
||||
PUT_CONF(01000000);
|
||||
PUT_CONF(02000000);
|
||||
PUT_CONF(04000000);
|
||||
PUT_CONF(08000000);
|
||||
|
||||
for(map<int, int>::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it) {
|
||||
CheckDlgButton(hW, it->first, (conf.gamesettings&it->second)?1:0);
|
||||
}
|
||||
}
|
||||
|
||||
void OnOK(HWND hW) {
|
||||
|
||||
u32 newinterlace = IsDlgButtonChecked(hW, IDC_CONFIG_INTERLACE);
|
||||
|
||||
if( !conf.interlace ) conf.interlace = newinterlace;
|
||||
else if( !newinterlace ) conf.interlace = 2; // off
|
||||
|
||||
conf.bilinear = IsDlgButtonChecked(hW, IDC_CONFIG_BILINEAR);
|
||||
// restore
|
||||
if( conf.bilinear && prevbilinearfilter )
|
||||
conf.bilinear = prevbilinearfilter;
|
||||
|
||||
if( SendDlgItemMessage(hW,IDC_CONFIG_AANONE,BM_GETCHECK,0,0) ) {
|
||||
conf.aa = 0;
|
||||
}
|
||||
else if( SendDlgItemMessage(hW,IDC_CONFIG_AA2,BM_GETCHECK,0,0) ) {
|
||||
conf.aa = 1;
|
||||
}
|
||||
else if( SendDlgItemMessage(hW,IDC_CONFIG_AA4,BM_GETCHECK,0,0) ) {
|
||||
conf.aa = 2;
|
||||
}
|
||||
else if( SendDlgItemMessage(hW,IDC_CONFIG_AA8,BM_GETCHECK,0,0) ) {
|
||||
conf.aa = 3;
|
||||
}
|
||||
else if( SendDlgItemMessage(hW,IDC_CONFIG_AA16,BM_GETCHECK,0,0) ) {
|
||||
conf.aa = 4;
|
||||
}
|
||||
else conf.aa = 0;
|
||||
|
||||
conf.options = 0;
|
||||
conf.options |= IsDlgButtonChecked(hW, IDC_CONFIG_CAPTUREAVI) ? GSOPTION_CAPTUREAVI : 0;
|
||||
conf.options |= IsDlgButtonChecked(hW, IDC_CONFIG_WIREFRAME) ? GSOPTION_WIREFRAME : 0;
|
||||
conf.options |= IsDlgButtonChecked(hW, IDC_CONFIG_FULLSCREEN) ? GSOPTION_FULLSCREEN : 0;
|
||||
conf.options |= IsDlgButtonChecked(hW, IDC_CONFIG_BMPSS) ? GSOPTION_BMPSNAP : 0;
|
||||
|
||||
conf.gamesettings = 0;
|
||||
for(map<int, int>::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it) {
|
||||
if( IsDlgButtonChecked(hW, it->first) )
|
||||
conf.gamesettings |= it->second;
|
||||
}
|
||||
GSsetGameCRC(g_LastCRC, conf.gamesettings);
|
||||
|
||||
if( SendDlgItemMessage(hW,IDC_CONF_WIN640,BM_GETCHECK,0,0) ) conf.options |= GSOPTION_WIN640;
|
||||
else if( SendDlgItemMessage(hW,IDC_CONF_WIN800,BM_GETCHECK,0,0) ) conf.options |= GSOPTION_WIN800;
|
||||
else if( SendDlgItemMessage(hW,IDC_CONF_WIN1024,BM_GETCHECK,0,0) ) conf.options |= GSOPTION_WIN1024;
|
||||
else if( SendDlgItemMessage(hW,IDC_CONF_WIN1280,BM_GETCHECK,0,0) ) conf.options |= GSOPTION_WIN1280;
|
||||
else if( SendDlgItemMessage(hW,IDC_CONF_WIN960W,BM_GETCHECK,0,0) ) conf.options |= GSOPTION_WIN960W;
|
||||
else if( SendDlgItemMessage(hW,IDC_CONF_WIN1280W,BM_GETCHECK,0,0) ) conf.options |= GSOPTION_WIN1280W;
|
||||
else if( SendDlgItemMessage(hW,IDC_CONF_WIN1920W,BM_GETCHECK,0,0) ) conf.options |= GSOPTION_WIN1920W;
|
||||
|
||||
SaveConfig();
|
||||
EndDialog(hW, FALSE);
|
||||
}
|
||||
|
||||
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
switch(uMsg) {
|
||||
case WM_INITDIALOG:
|
||||
OnInitDialog(hW);
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch(LOWORD(wParam)) {
|
||||
case IDCANCEL:
|
||||
EndDialog(hW, TRUE);
|
||||
return TRUE;
|
||||
case IDOK:
|
||||
OnOK(hW);
|
||||
return TRUE;
|
||||
case IDC_CONFOPT_COMPUTEOR:
|
||||
{
|
||||
int value = 0;
|
||||
for(map<int, int>::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it) {
|
||||
if( IsDlgButtonChecked(hW, it->first) )
|
||||
value|= it->second;
|
||||
}
|
||||
char str[20];
|
||||
sprintf(str, "%.8x", value);
|
||||
SetWindowText(GetDlgItem(hW, IDC_CONFOPT_IDS), str);
|
||||
break;
|
||||
}
|
||||
case IDC_CONF_DEFAULT:
|
||||
{
|
||||
for(map<int, int>::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it) {
|
||||
CheckDlgButton(hW, it->first, 0);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
switch(uMsg) {
|
||||
case WM_INITDIALOG:
|
||||
|
||||
//ZeroGS uses floating point render targets because A8R8G8B8 format is not sufficient for ps2 blending and this requires alpha blending on floating point render targets
|
||||
//There might be a problem with pixel shader precision with older geforce models (textures will look blocky).
|
||||
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch(LOWORD(wParam)) {
|
||||
case IDOK:
|
||||
EndDialog(hW, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s32 CALLBACK GStest() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CALLBACK GSabout() {
|
||||
DialogBox(hInst,
|
||||
MAKEINTRESOURCE(IDD_ABOUT),
|
||||
GetActiveWindow(),
|
||||
(DLGPROC)AboutDlgProc);
|
||||
}
|
||||
|
||||
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
||||
DWORD dwReason,
|
||||
LPVOID lpReserved) {
|
||||
hInst = (HINSTANCE)hModule;
|
||||
return TRUE; // very quick :)
|
||||
}
|
||||
|
||||
static char *err = "Error Loading Symbol";
|
||||
static int errval;
|
||||
|
||||
void *SysLoadLibrary(char *lib) {
|
||||
return LoadLibrary(lib);
|
||||
}
|
||||
|
||||
void *SysLoadSym(void *lib, char *sym) {
|
||||
void *tmp = GetProcAddress((HINSTANCE)lib, sym);
|
||||
if (tmp == NULL) errval = 1;
|
||||
else errval = 0;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
char *SysLibError() {
|
||||
if (errval) { errval = 0; return err; }
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void SysCloseLibrary(void *lib) {
|
||||
FreeLibrary((HINSTANCE)lib);
|
||||
}
|
|
@ -1,11 +0,0 @@
|
|||
#ifndef __WIN32_H__
|
||||
#define __WIN32_H__
|
||||
|
||||
#include "../GS.h"
|
||||
|
||||
#include "resrc1.h"
|
||||
#include "resource.h"
|
||||
|
||||
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
#endif /* __WIN32_H__ */
|
|
@ -1,484 +0,0 @@
|
|||
#define AVIIF_KEYFRAME 0x00000010L // this frame is a key frame.
|
||||
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
#include <memory.h>
|
||||
#include <mmsystem.h>
|
||||
#include <vfw.h>
|
||||
|
||||
BOOL AVI_Init()
|
||||
{
|
||||
/* first let's make sure we are running on 1.1 */
|
||||
WORD wVer = HIWORD(VideoForWindowsVersion());
|
||||
if (wVer < 0x010a){
|
||||
/* oops, we are too old, blow out of here */
|
||||
//MessageBeep(MB_ICONHAND);
|
||||
MessageBox(NULL, "Cant't init AVI File - Video for Windows version is to old", "Error", MB_OK|MB_ICONSTOP);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
AVIFileInit();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL AVI_FileOpenWrite(PAVIFILE * pfile, const char *filename)
|
||||
{
|
||||
HRESULT hr = AVIFileOpen(pfile, // returned file pointer
|
||||
filename, // file name
|
||||
OF_WRITE | OF_CREATE, // mode to open file with
|
||||
NULL); // use handler determined
|
||||
// from file extension....
|
||||
if (hr != AVIERR_OK)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DWORD getFOURCC(const char* value)
|
||||
{
|
||||
if(_stricmp(value, "DIB") == 0)
|
||||
{
|
||||
return mmioFOURCC(value[0],value[1],value[2],' ');
|
||||
}
|
||||
else if((_stricmp(value, "CVID") == 0)
|
||||
|| (_stricmp(value, "IV32") == 0)
|
||||
|| (_stricmp(value, "MSVC") == 0)
|
||||
|| (_stricmp(value, "IV50") == 0))
|
||||
{
|
||||
return mmioFOURCC(value[0],value[1],value[2],value[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill in the header for the video stream....
|
||||
// The video stream will run in rate ths of a second....
|
||||
BOOL AVI_CreateStream(PAVIFILE pfile, PAVISTREAM * ps, int rate, // sample/second
|
||||
unsigned long buffersize, int rectwidth, int rectheight,
|
||||
const char* _compressor)
|
||||
{
|
||||
AVISTREAMINFO strhdr;
|
||||
memset(&strhdr, 0, sizeof(strhdr));
|
||||
strhdr.fccType = streamtypeVIDEO;// stream type
|
||||
strhdr.fccHandler = getFOURCC(_compressor);
|
||||
//strhdr.fccHandler = 0; // no compression!
|
||||
//strhdr.fccHandler = mmioFOURCC('D','I','B',' '); // Uncompressed
|
||||
//strhdr.fccHandler = mmioFOURCC('C','V','I','D'); // Cinpak
|
||||
//strhdr.fccHandler = mmioFOURCC('I','V','3','2'); // Intel video 3.2
|
||||
//strhdr.fccHandler = mmioFOURCC('M','S','V','C'); // Microsoft video 1
|
||||
//strhdr.fccHandler = mmioFOURCC('I','V','5','0'); // Intel video 5.0
|
||||
//strhdr.dwFlags = AVISTREAMINFO_DISABLED;
|
||||
//strhdr.dwCaps =
|
||||
//strhdr.wPriority =
|
||||
//strhdr.wLanguage =
|
||||
strhdr.dwScale = 1;
|
||||
strhdr.dwRate = rate; // rate fps
|
||||
//strhdr.dwStart =
|
||||
//strhdr.dwLength =
|
||||
//strhdr.dwInitialFrames =
|
||||
strhdr.dwSuggestedBufferSize = buffersize;
|
||||
strhdr.dwQuality = -1; // use the default
|
||||
//strhdr.dwSampleSize =
|
||||
SetRect(&strhdr.rcFrame, 0, 0, // rectangle for stream
|
||||
(int) rectwidth,
|
||||
(int) rectheight);
|
||||
//strhdr.dwEditCount =
|
||||
//strhdr.dwFormatChangeCount =
|
||||
//strcpy(strhdr.szName, "Full Frames (Uncompressed)");
|
||||
|
||||
// And create the stream;
|
||||
HRESULT hr = AVIFileCreateStream(pfile, // file pointer
|
||||
ps, // returned stream pointer
|
||||
&strhdr); // stream header
|
||||
if (hr != AVIERR_OK) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
string getFOURCCVAsString(DWORD value)
|
||||
{
|
||||
string returnValue = "";
|
||||
if( value == 0 )
|
||||
return returnValue;
|
||||
|
||||
DWORD ch0 = value & 0x000000FF;
|
||||
returnValue.push_back((char) ch0);
|
||||
DWORD ch1 = (value & 0x0000FF00)>>8;
|
||||
returnValue.push_back((char) ch1);
|
||||
DWORD ch2 = (value & 0x00FF0000)>>16;
|
||||
returnValue.push_back((char) ch2);
|
||||
DWORD ch3 = (value & 0xFF000000)>>24;
|
||||
returnValue.push_back((char) ch3);
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
string dumpAVICOMPRESSOPTIONS(AVICOMPRESSOPTIONS opts)
|
||||
{
|
||||
char tmp[255];
|
||||
string returnValue = "Dump of AVICOMPRESSOPTIONS\n";
|
||||
|
||||
returnValue += "DWORD fccType = streamtype("; returnValue += getFOURCCVAsString(opts.fccType); returnValue += ")\n";
|
||||
returnValue += "DWORD fccHandler = "; returnValue += getFOURCCVAsString(opts.fccHandler); returnValue += "\n";
|
||||
|
||||
_snprintf(tmp, 255, "DWORD dwKeyFrameEvery = %d\n", opts.dwKeyFrameEvery);
|
||||
returnValue += tmp;
|
||||
|
||||
_snprintf(tmp, 255, "DWORD dwQuality = %d\n", opts.dwQuality);
|
||||
returnValue += tmp;
|
||||
|
||||
_snprintf(tmp, 255, "DWORD dwBytesPerSecond = %d\n", opts.dwBytesPerSecond);
|
||||
returnValue += tmp;
|
||||
|
||||
if((opts.dwFlags & AVICOMPRESSF_DATARATE) == AVICOMPRESSF_DATARATE){strcpy(tmp, "DWORD fccType = AVICOMPRESSF_DATARATE\n");}
|
||||
else if((opts.dwFlags & AVICOMPRESSF_INTERLEAVE) == AVICOMPRESSF_INTERLEAVE){strcpy(tmp, "DWORD fccType = AVICOMPRESSF_INTERLEAVE\n");}
|
||||
else if((opts.dwFlags & AVICOMPRESSF_KEYFRAMES) == AVICOMPRESSF_KEYFRAMES){strcpy(tmp, "DWORD fccType = AVICOMPRESSF_KEYFRAMES\n");}
|
||||
else if((opts.dwFlags & AVICOMPRESSF_VALID) == AVICOMPRESSF_VALID){strcpy(tmp, "DWORD fccType = AVICOMPRESSF_VALID\n");}
|
||||
else {_snprintf(tmp, 255, "DWORD dwFlags = Unknown(%d)\n", opts.dwFlags);}
|
||||
returnValue += tmp;
|
||||
|
||||
_snprintf(tmp, 255, "LPVOID lpFormat = %d\n", opts.lpFormat);
|
||||
returnValue += tmp;
|
||||
|
||||
_snprintf(tmp, 255, "DWORD cbFormat = %d\n", opts.cbFormat);
|
||||
returnValue += tmp;
|
||||
|
||||
_snprintf(tmp, 255, "LPVOID lpParms = %d\n", opts.lpParms);
|
||||
returnValue += tmp;
|
||||
|
||||
_snprintf(tmp, 255, "DWORD cbParms = %d\n", opts.cbParms);
|
||||
returnValue += tmp;
|
||||
|
||||
_snprintf(tmp, 255, "DWORD dwInterleaveEvery = %d\n", opts.dwInterleaveEvery);
|
||||
returnValue += tmp;
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
BOOL AVI_SetOptions(PAVISTREAM * ps, PAVISTREAM * psCompressed, LPBITMAPINFOHEADER lpbi,
|
||||
const char* _compressor)
|
||||
{
|
||||
|
||||
AVICOMPRESSOPTIONS opts;
|
||||
AVICOMPRESSOPTIONS FAR * aopts[1] = {&opts};
|
||||
|
||||
memset(&opts, 0, sizeof(opts));
|
||||
opts.fccType = streamtypeVIDEO;
|
||||
opts.fccHandler = getFOURCC(_compressor);
|
||||
//opts.fccHandler = 0;
|
||||
//opts.fccHandler = mmioFOURCC('D','I','B',' '); // Uncompressed
|
||||
//opts.fccHandler = mmioFOURCC('C','V','I','D'); // Cinpak
|
||||
//opts.fccHandler = mmioFOURCC('I','V','3','2'); // Intel video 3.2
|
||||
//opts.fccHandler = mmioFOURCC('M','S','V','C'); // Microsoft video 1
|
||||
//opts.fccHandler = mmioFOURCC('I','V','5','0'); // Intel video 5.0
|
||||
//opts.dwKeyFrameEvery = 5;
|
||||
//opts.dwQuality
|
||||
//opts.dwBytesPerSecond
|
||||
//opts.dwFlags = AVICOMPRESSF_KEYFRAMES;
|
||||
//opts.lpFormat
|
||||
//opts.cbFormat
|
||||
//opts.lpParms
|
||||
//opts.cbParms
|
||||
//opts.dwInterleaveEvery
|
||||
|
||||
/* display the compression options dialog box if specified compressor is unknown */
|
||||
if(getFOURCC(_compressor) == NULL)
|
||||
{
|
||||
if (!AVISaveOptions(NULL, 0, 1, ps, (LPAVICOMPRESSOPTIONS FAR *) &aopts))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//printf("%s", dumpAVICOMPRESSOPTIONS(opts));
|
||||
//MessageBox(NULL, dumpAVICOMPRESSOPTIONS(opts).c_str(), "AVICOMPRESSOPTIONS", MB_OK);
|
||||
}
|
||||
|
||||
HRESULT hr = AVIMakeCompressedStream(psCompressed, *ps, &opts, NULL);
|
||||
if (hr != AVIERR_OK) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hr = AVIStreamSetFormat(*psCompressed, 0,
|
||||
lpbi, // stream format
|
||||
lpbi->biSize // format size
|
||||
+ lpbi->biClrUsed * sizeof(RGBQUAD)
|
||||
);
|
||||
if (hr != AVIERR_OK) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL AVI_SetText(PAVIFILE pfile, PAVISTREAM psText, char *szText, int width, int height, int TextHeight)
|
||||
{
|
||||
// Fill in the stream header for the text stream....
|
||||
AVISTREAMINFO strhdr;
|
||||
DWORD dwTextFormat;
|
||||
// The text stream is in 60ths of a second....
|
||||
|
||||
memset(&strhdr, 0, sizeof(strhdr));
|
||||
strhdr.fccType = streamtypeTEXT;
|
||||
strhdr.fccHandler = mmioFOURCC('D', 'R', 'A', 'W');
|
||||
strhdr.dwScale = 1;
|
||||
strhdr.dwRate = 60;
|
||||
strhdr.dwSuggestedBufferSize = sizeof(szText);
|
||||
SetRect(&strhdr.rcFrame, 0, (int) height,
|
||||
(int) width, (int) height + TextHeight); // #define TEXT_HEIGHT 20
|
||||
|
||||
// ....and create the stream.
|
||||
HRESULT hr = AVIFileCreateStream(pfile, &psText, &strhdr);
|
||||
if (hr != AVIERR_OK) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
dwTextFormat = sizeof(dwTextFormat);
|
||||
hr = AVIStreamSetFormat(psText, 0, &dwTextFormat, sizeof(dwTextFormat));
|
||||
if (hr != AVIERR_OK) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL AVI_AddFrame(PAVISTREAM psCompressed, int time, LPBITMAPINFOHEADER lpbi)
|
||||
{
|
||||
int ImageSize = lpbi->biSizeImage;
|
||||
if (ImageSize == 0)
|
||||
{
|
||||
if (lpbi->biBitCount == 24)
|
||||
{
|
||||
ImageSize = lpbi->biWidth * lpbi->biHeight * 3;
|
||||
}
|
||||
}
|
||||
HRESULT hr = AVIStreamWrite(psCompressed, // stream pointer
|
||||
time, // time of this frame
|
||||
1, // number to write
|
||||
(LPBYTE) lpbi + // pointer to data
|
||||
lpbi->biSize +
|
||||
lpbi->biClrUsed * sizeof(RGBQUAD),
|
||||
ImageSize, // lpbi->biSizeImage, // size of this frame
|
||||
AVIIF_KEYFRAME, // flags....
|
||||
NULL,
|
||||
NULL);
|
||||
if (hr != AVIERR_OK)
|
||||
{
|
||||
char strMsg[255];
|
||||
_snprintf(strMsg, 255, "Error: AVIStreamWrite, error %d",hr);
|
||||
MessageBox(NULL, strMsg, "", MB_OK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL AVI_AddText(PAVISTREAM psText, int time, char *szText)
|
||||
{
|
||||
int iLen = strlen(szText);
|
||||
|
||||
HRESULT hr = AVIStreamWrite(psText,
|
||||
time,
|
||||
1,
|
||||
szText,
|
||||
iLen + 1,
|
||||
AVIIF_KEYFRAME,
|
||||
NULL,
|
||||
NULL);
|
||||
if (hr != AVIERR_OK)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL AVI_CloseStream(PAVISTREAM ps, PAVISTREAM psCompressed, PAVISTREAM psText)
|
||||
{
|
||||
if (ps)
|
||||
AVIStreamClose(ps);
|
||||
|
||||
if (psCompressed)
|
||||
AVIStreamClose(psCompressed);
|
||||
|
||||
if (psText)
|
||||
AVIStreamClose(psText);
|
||||
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL AVI_CloseFile(PAVIFILE pfile)
|
||||
{
|
||||
if (pfile)
|
||||
AVIFileClose(pfile);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL AVI_Exit()
|
||||
{
|
||||
AVIFileExit();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Here are the additional functions we need! */
|
||||
|
||||
|
||||
static PAVIFILE pfile = NULL;
|
||||
static PAVISTREAM ps = NULL;
|
||||
static PAVISTREAM psCompressed = NULL;
|
||||
static int counter = 0;
|
||||
|
||||
|
||||
// Initialization...
|
||||
bool START_AVI(const char* file_name)
|
||||
{
|
||||
if(! AVI_Init())
|
||||
{
|
||||
//printf("Error - AVI_Init()\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(! AVI_FileOpenWrite(&pfile, file_name))
|
||||
{
|
||||
//printf("Error - AVI_FileOpenWrite()\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ADD_FRAME_FROM_DIB_TO_AVI(const char* _compressor, int _frameRate, int width, int height, int bits, void* pdata)
|
||||
{
|
||||
if(counter == 0)
|
||||
{
|
||||
if(! AVI_CreateStream(pfile, &ps, _frameRate,
|
||||
width*height/bits,
|
||||
width,
|
||||
height, _compressor))
|
||||
{
|
||||
//printf("Error - AVI_CreateStream()\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
BITMAPINFOHEADER bi;
|
||||
memset(&bi, 0, sizeof(bi));
|
||||
bi.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bi.biWidth = width;
|
||||
bi.biHeight = height;
|
||||
bi.biPlanes = 1;
|
||||
bi.biBitCount = bits;
|
||||
bi.biCompression = BI_RGB;
|
||||
bi.biSizeImage = width * height * bits /8;
|
||||
if(! AVI_SetOptions(&ps, &psCompressed, &bi, _compressor))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT hr = AVIStreamWrite(psCompressed, // stream pointer
|
||||
counter, // time of this frame
|
||||
1, // number to write
|
||||
pdata,
|
||||
width*height/8, // lpbi->biSizeImage, // size of this frame
|
||||
AVIIF_KEYFRAME, // flags....
|
||||
NULL,
|
||||
NULL);
|
||||
if (hr != AVIERR_OK)
|
||||
{
|
||||
char strMsg[255];
|
||||
_snprintf(strMsg, 255, "Error: AVIStreamWrite, error %d",hr);
|
||||
MessageBox(NULL, strMsg, "", MB_OK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
counter++;
|
||||
return true;
|
||||
}
|
||||
|
||||
//Now we can add frames
|
||||
// ie. ADD_FRAME_FROM_DIB_TO_AVI(yourDIB, "CVID", 25);
|
||||
bool ADD_FRAME_FROM_DIB_TO_AVI(HANDLE dib, const char* _compressor, int _frameRate)
|
||||
{
|
||||
LPBITMAPINFOHEADER lpbi;
|
||||
if(counter == 0)
|
||||
{
|
||||
lpbi = (LPBITMAPINFOHEADER)GlobalLock(dib);
|
||||
if(! AVI_CreateStream(pfile, &ps, _frameRate,
|
||||
(unsigned long) lpbi->biSizeImage,
|
||||
(int) lpbi->biWidth,
|
||||
(int) lpbi->biHeight, _compressor))
|
||||
{
|
||||
//printf("Error - AVI_CreateStream()\n");
|
||||
GlobalUnlock(lpbi);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(! AVI_SetOptions(&ps, &psCompressed, lpbi, _compressor))
|
||||
{
|
||||
//printf("Error - AVI_SetOptions()\n");
|
||||
GlobalUnlock(lpbi);
|
||||
return false;
|
||||
}
|
||||
|
||||
GlobalUnlock(lpbi);
|
||||
}
|
||||
|
||||
lpbi = (LPBITMAPINFOHEADER)GlobalLock(dib);
|
||||
if(! AVI_AddFrame(psCompressed, counter * 1, lpbi))
|
||||
{
|
||||
//printf("Error - AVI_AddFrame()\n");
|
||||
GlobalUnlock(lpbi);
|
||||
return false;
|
||||
}
|
||||
|
||||
GlobalUnlock(lpbi);
|
||||
counter++;
|
||||
return true;
|
||||
}
|
||||
|
||||
// The end...
|
||||
bool STOP_AVI()
|
||||
{
|
||||
if(! AVI_CloseStream(ps, psCompressed, NULL))
|
||||
{
|
||||
//printf("Error - AVI_CloseStream()\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(! AVI_CloseFile(pfile))
|
||||
{
|
||||
//printf("Error - AVI_CloseFile()\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(! AVI_Exit())
|
||||
{
|
||||
//printf("Error - AVI_Exit()\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1,31 +0,0 @@
|
|||
EXPORTS
|
||||
GSabout = GSabout@0 @90
|
||||
GSclose = GSclose@0 @91
|
||||
GSconfigure = GSconfigure@0 @92
|
||||
GSfreeze = GSfreeze@8 @93
|
||||
GSgetDriverInfo = GSgetDriverInfo@4 @94
|
||||
GSgifTransfer1 = GSgifTransfer1@8 @95
|
||||
GSgifTransfer2 = GSgifTransfer2@8 @96
|
||||
GSgifTransfer3 = GSgifTransfer3@8 @97
|
||||
GSinit = GSinit@0 @99
|
||||
GSirqCallback = GSirqCallback@4 @101
|
||||
GSkeyEvent = GSkeyEvent@4 @102
|
||||
GSmakeSnapshot = GSmakeSnapshot@4 @103
|
||||
GSopen = GSopen@8 @104
|
||||
GSprintf = GSprintf@0 @105
|
||||
GSread16 = GSread16@4 @106
|
||||
GSread32 = GSread32@4 @107
|
||||
GSread64 = GSread64@4 @108
|
||||
GSread8 = GSread8@4 @109
|
||||
GSreadFIFO = GSreadFIFO@4 @110
|
||||
GSreset @111
|
||||
GSshutdown = GSshutdown@0 @112
|
||||
GStest = GStest@0 @113
|
||||
GSvsync = GSvsync@0 @115
|
||||
GSwrite16 = GSwrite16@8 @117
|
||||
GSwrite32 = GSwrite32@8 @118
|
||||
GSwrite64 = GSwrite64@12 @119
|
||||
GSwrite8 = GSwrite8@8 @120
|
||||
PS2EgetLibName = PS2EgetLibName@0 @128
|
||||
PS2EgetLibType = PS2EgetLibType@0 @129
|
||||
PS2EgetLibVersion2 = PS2EgetLibVersion2@4 @130
|
Binary file not shown.
|
@ -1,45 +0,0 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by GSsoftdx.rc
|
||||
//
|
||||
#define IDD_CONFIG 101
|
||||
#define IDD_ABOUT 102
|
||||
#define IDD_LOGGING 106
|
||||
#define IDB_ZEROGSLOGO 108
|
||||
#define IDR_REALPS2_FX 109
|
||||
#define IDR_SHADERS 110
|
||||
#define IDC_CHECK1 1000
|
||||
#define IDC_FULLSCREEN 1000
|
||||
#define IDC_NAME 1000
|
||||
#define IDC_LOG 1000
|
||||
#define IDC_CHECK2 1001
|
||||
#define IDC_FPSCOUNT 1001
|
||||
#define IDC_CHECK5 1002
|
||||
#define IDC_FRAMESKIP 1002
|
||||
#define IDC_STRETCH 1003
|
||||
#define IDC_LOGGING 1004
|
||||
#define IDC_COMBO1 1005
|
||||
#define IDC_CACHE 1005
|
||||
#define IDC_CACHESIZE 1006
|
||||
#define IDC_CHECK3 1007
|
||||
#define IDC_RECORD 1007
|
||||
#define IDC_COMBO2 1008
|
||||
#define IDC_DSPRES 1008
|
||||
#define IDC_WRES 1008
|
||||
#define IDC_COMBO3 1009
|
||||
#define IDC_DDDRV 1009
|
||||
#define IDC_FRES 1009
|
||||
#define IDC_COMBO4 1012
|
||||
#define IDC_CODEC 1012
|
||||
#define IDC_FILTERS 1014
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 112
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1015
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
|
@ -1,87 +0,0 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by zerogs.rc
|
||||
//
|
||||
#define IDC_CONF_DEFAULT 3
|
||||
#define IDR_DATA1 112
|
||||
#define IDC_ABOUTTEXT 1015
|
||||
#define IDC_CONFIG_AA 1016
|
||||
#define IDC_CONFIG_INTERLACE 1017
|
||||
#define IDC_CONFIG_AA3 1018
|
||||
#define IDC_CONFIG_CAPTUREAVI 1018
|
||||
#define IDC_CONFIG_CAPTUREAVI2 1019
|
||||
#define IDC_CONFIG_FULLSCREEN 1019
|
||||
#define IDC_CONFIG_FULLSCREEN2 1020
|
||||
#define IDC_CONFIG_FFX 1020
|
||||
#define IDC_CONFIG_WIDESCREEN 1020
|
||||
#define IDC_CONFIG_INTERLACE2 1021
|
||||
#define IDC_CONFIG_DEPTHWRITE 1021
|
||||
#define IDC_CONFIG_FFX2 1021
|
||||
#define IDC_CONFIG_BMPSS 1021
|
||||
#define IDC_RADIO3 1024
|
||||
#define IDC_CONFIG_INTERLACE3 1025
|
||||
#define IDC_CONFIG_BILINEAR 1025
|
||||
#define IDC_CONF_WIN640 1026
|
||||
#define IDC_CONF_WIN800 1027
|
||||
#define IDC_CONF_WIN1024 1028
|
||||
#define IDC_CONF_WIN1280 1029
|
||||
#define IDC_CONF_WIN960W 1030
|
||||
#define IDC_CONF_WIN1280W 1031
|
||||
#define IDC_CONF_WIN1920W 1032
|
||||
#define IDC_CONFOPT_00002000 1033
|
||||
#define IDC_CONFIG_CAPTUREAVI3 1034
|
||||
#define IDC_CONFIG_WIREFRAME 1034
|
||||
#define IDC_CONFOPT_00001000 1035
|
||||
#define IDC_CONFIG_CAPTUREAVI4 1036
|
||||
#define IDC_CONFIG_CACHEFBP 1036
|
||||
#define IDC_CONFIG_SHOWFPS 1036
|
||||
#define IDC_CONFOPT_00100000 1036
|
||||
#define IDC_CONFOPT_00000200 1037
|
||||
#define IDC_CONFOPT_00000080 1038
|
||||
#define IDC_CONFOPT_201 1039
|
||||
#define IDC_CONFOPT_00000040 1039
|
||||
#define IDC_CONFOPT_00000020 1040
|
||||
#define IDC_CONFOPT_00080000 1041
|
||||
#define IDC_CONF_WIN1283 1041
|
||||
#define IDC_CONFOPT_00000001 1042
|
||||
#define IDC_CONFOPT_00000004 1044
|
||||
#define IDC_CONFOPT_IDS 1045
|
||||
#define IDC_CONFOPT_00200000 1046
|
||||
#define IDC_CONFOPT_00004000 1047
|
||||
#define IDC_BUTTON1 1048
|
||||
#define IDC_CONFOPT_COMPUTEOR 1048
|
||||
#define IDC_CONFOPT_4001 1049
|
||||
#define IDC_CONFOPT_00000010 1049
|
||||
#define IDC_CONFOPT_00008000 1050
|
||||
#define IDC_CONFOPT_00010000 1052
|
||||
#define IDC_CONFOPT_00020000 1054
|
||||
#define IDC_CONFOPT_00000002 1055
|
||||
#define IDC_CONFOPT_20001 1056
|
||||
#define IDC_CONFOPT_01000000 1056
|
||||
#define IDC_CONFOPT_16961 1057
|
||||
#define IDC_CONFOPT_08000000 1057
|
||||
#define IDC_CONFOPT_00000008 1058
|
||||
#define IDC_CONFOPT_00000400 1060
|
||||
#define IDC_CONFOPT_00000800 1061
|
||||
#define IDC_CONFOPT_NOALPHABLEND30 1062
|
||||
#define IDC_CONFOPT_00040000 1063
|
||||
#define IDC_CONFOPT_40001 1064
|
||||
#define IDC_CONFOPT_02000000 1064
|
||||
#define IDC_CONFOPT_33921 1065
|
||||
#define IDC_CONFOPT_04000000 1065
|
||||
#define IDC_CONFIG_AANONE 2000
|
||||
#define IDC_CONFIG_AA2 2001
|
||||
#define IDC_CONFIG_AA4 2002
|
||||
#define IDC_CONFIG_AA8 2003
|
||||
#define IDC_CONFIG_AA16 2004
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 113
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1052
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
Binary file not shown.
Before Width: | Height: | Size: 900 KiB |
|
@ -1,233 +0,0 @@
|
|||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resrc1.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "resource.h"
|
||||
#include "afxresmw.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDB_ZEROGSLOGO BITMAP "zerogs.bmp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// RCDATA
|
||||
//
|
||||
|
||||
IDR_SHADERS RCDATA "ps2fx.dat"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_CONFIG DIALOGEX 0, 0, 427, 385
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
CONTROL "Interlace Enable (toggle with F5)\n there are 2 modes + interlace off",IDC_CONFIG_INTERLACE,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,7,134,18
|
||||
CONTROL "Bilinear Filtering (Shift+F5)\n Best quality is on, turn off for speed.",IDC_CONFIG_BILINEAR,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,31,135,18
|
||||
CONTROL "None",IDC_CONFIG_AANONE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,19,92,34,11
|
||||
CONTROL "2X",IDC_CONFIG_AA2,"Button",BS_AUTORADIOBUTTON,69,92,26,11
|
||||
CONTROL "4X",IDC_CONFIG_AA4,"Button",BS_AUTORADIOBUTTON,111,92,28,11
|
||||
CONTROL "8X",IDC_CONFIG_AA8,"Button",BS_AUTORADIOBUTTON,69,108,26,11
|
||||
CONTROL "16X",IDC_CONFIG_AA16,"Button",BS_AUTORADIOBUTTON,111,108,28,11
|
||||
CONTROL "Wireframe rendering (F7)",IDC_CONFIG_WIREFRAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,129,93,10
|
||||
CONTROL "Capture Avi (zerogs.avi) (F12)",IDC_CONFIG_CAPTUREAVI,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,145,109,10
|
||||
CONTROL "Save Snapshots as BMPs (default is JPG)",IDC_CONFIG_BMPSS,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,162,147,10
|
||||
CONTROL "Fullscreen (Alt+Enter)\n to get out press Alt+Enter again",IDC_CONFIG_FULLSCREEN,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,178,146,17
|
||||
CONTROL "640 x 480",IDC_CONF_WIN640,"Button",BS_AUTORADIOBUTTON | WS_GROUP,15,233,59,8
|
||||
CONTROL "800 x 600",IDC_CONF_WIN800,"Button",BS_AUTORADIOBUTTON,78,233,59,8
|
||||
CONTROL "1024 x 768",IDC_CONF_WIN1024,"Button",BS_AUTORADIOBUTTON,15,246,59,8
|
||||
CONTROL "1280 x 960",IDC_CONF_WIN1280,"Button",BS_AUTORADIOBUTTON,78,246,59,8
|
||||
CONTROL "960 x 540",IDC_CONF_WIN960W,"Button",BS_AUTORADIOBUTTON,14,270,53,8
|
||||
CONTROL "1280 x 720",IDC_CONF_WIN1280W,"Button",BS_AUTORADIOBUTTON,77,270,53,8
|
||||
CONTROL "1920 x 1080",IDC_CONF_WIN1920W,"Button",BS_AUTORADIOBUTTON,14,283,53,8
|
||||
DEFPUSHBUTTON "OK",IDOK,7,364,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,94,364,50,14
|
||||
GROUPBOX "Anti-aliasing for sharper graphics",IDC_STATIC,7,57,136,66
|
||||
GROUPBOX "Default Window Size (no speed impact)",IDC_STATIC,7,223,141,76
|
||||
LTEXT "Show Frames Per Second (Shift+F7)",IDC_STATIC,7,314,140,10
|
||||
GROUPBOX "Advanced Options",IDC_STATIC,152,7,268,371
|
||||
LTEXT "Each option is presented with a unique ID in hex. In order to preserve options across games, go into the game's patch (.pnach) file and type\n zerogs=IDS\nwhere IDS is the OR all of the values in hex for every option you want enabled. ",IDC_STATIC,161,16,252,33
|
||||
PUSHBUTTON "Use Defaults (recommended)",IDC_CONF_DEFAULT,159,76,151,14
|
||||
CONTROL "Disable alpha testing - 00080000",IDC_CONFOPT_00080000,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,104,119,10
|
||||
CONTROL "Disable stencil buffer - 00002000\nusually safe to do for simple scenes",IDC_CONFOPT_00002000,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,159,114,118,22
|
||||
CONTROL "No target CLUT - 00001000\n(use on RE4, or foggy scenes)",IDC_CONFOPT_00001000,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,169,120,24
|
||||
CONTROL "Disable depth updates - 00000200",IDC_CONFOPT_00000200,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,158,161,125,10
|
||||
CONTROL "FFX hack - 00000080\nshows missing geometry",IDC_CONFOPT_00000080,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,190,121,17
|
||||
CONTROL "Exact color testing - 00000020\nfixes overbright or shadow/black artifacts (crash n burn)",IDC_CONFOPT_00000020,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,209,119,25
|
||||
CONTROL "Tex Target checking - 00000001\nlego racers",IDC_CONFOPT_00000001,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,233,123,22
|
||||
CONTROL "Interlace 2X - 00000004\nfixes 2x bigger screen (gradius3)",IDC_CONFOPT_00000004,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,254,119,20
|
||||
CONTROL "32 bit render targets - 00200000",IDC_CONFOPT_00200000,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,285,93,117,10
|
||||
CONTROL "No Vertical Stripes - 00004000\n try when there's a lot of garbage on screen",IDC_CONFOPT_00004000,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,138,111,28
|
||||
CONTROL "No depth resolve - 00008000\nmight give z buffer artifacts",IDC_CONFOPT_00008000,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,164,121,19
|
||||
CONTROL "full 16 bit resolution - 00010000\nuse when half the screen is missing, etc",IDC_CONFOPT_00010000,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,185,125,23
|
||||
CONTROL "Auto Reset Targs - 00000002\nshadow hearts, samurai warriors (use when game is slow and toggling AA fixes it)",IDC_CONFOPT_00000002,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,283,212,124,32
|
||||
CONTROL "Tex Alpha Hack - 00000008\nnightmare before christmas",IDC_CONFOPT_00000008,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,286,252,125,17
|
||||
EDITTEXT IDC_CONFOPT_IDS,372,364,48,14,ES_AUTOHSCROLL | ES_READONLY
|
||||
CONTROL "Resolve Hack #1 - 00000400\nspeeds some games (kingdom hearts)",IDC_CONFOPT_00000400,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,270,135,19
|
||||
CONTROL "Resolve Hack #2 - 00000800\nshadow hearts, urbz",IDC_CONFOPT_00000800,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,276,117,17
|
||||
CONTROL "Resolve Hack #3 - 00020000\nneopets",IDC_CONFOPT_00020000,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,292,125,17
|
||||
CONTROL "Fast Update - 00040000\nspeeds some games (okami)",IDC_CONFOPT_00040000,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,297,125,17
|
||||
PUSHBUTTON "Compute OR of IDS",IDC_CONFOPT_COMPUTEOR,287,364,73,14
|
||||
LTEXT "Important options are listed first. Note, setting option here means that they will be ADDED to whatever options are set in each pnach file.",IDC_STATIC,159,50,252,23
|
||||
CONTROL "No target resolves - 00000010\nStops all resolving of targets (try this first for really slow games)",IDC_CONFOPT_00000010,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,104,111,33
|
||||
CONTROL "Disable Multiple RTs - 00100000",IDC_CONFOPT_00100000,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,91,119,10
|
||||
CONTROL "No color clamping - 00000040\nSpeeds games up but might be too bright or too dim",IDC_CONFOPT_00000040,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,157,137,123,22
|
||||
CONTROL "Specular Highlights - 01000000\nMakes xenosaga graphics faster by removing highlights",IDC_CONFOPT_01000000,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,313,125,25
|
||||
CONTROL "Partial Targets - 02000000\nReduces artifacts and speeds up some games (mgs3)",IDC_CONFOPT_02000000,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,319,125,24
|
||||
CONTROL "Partial Depth - 04000000\nTries to save the depth target as much as possible (mgs3)",IDC_CONFOPT_04000000,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,159,347,125,24
|
||||
LTEXT "shortcuts: F6 - next, Shift+F6 - prev",IDC_STATIC,24,71,116,11
|
||||
CONTROL "16:9 widescreen (Shift+F9)",IDC_CONFIG_WIDESCREEN,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,199,146,17
|
||||
LTEXT "Widescreen:",IDC_STATIC,14,257,89,11
|
||||
CONTROL "Relaxed Depth - 08000000\nMight show hidden sprites (xenosaga text)",IDC_CONFOPT_08000000,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,338,125,25
|
||||
END
|
||||
|
||||
IDD_ABOUT DIALOGEX 0, 0, 182, 78
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About ZeroGS KSOMOS...."
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,65,57,50,14
|
||||
LTEXT "ZeroGS v0.97.1",IDC_STATIC,7,7,160,11
|
||||
LTEXT "Thanks to Gabest for some SSE optimizations",IDC_ABOUTTEXT,7,39,152,12
|
||||
LTEXT "Author: zerofrog(@gmail.com)",IDC_STATIC,8,23,144,14
|
||||
END
|
||||
|
||||
IDD_LOGGING DIALOG 0, 0, 152, 55
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,40,35,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,95,35,50,14
|
||||
CONTROL "Log",IDC_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,60,15,28,10
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_CONFIG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 420
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 378
|
||||
END
|
||||
|
||||
IDD_ABOUT, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 175
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 71
|
||||
END
|
||||
|
||||
IDD_LOGGING, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 145
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 48
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resrc1.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""resource.h""\r\n"
|
||||
"#include ""afxresmw.h""\r\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
|
@ -1,212 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Devel|Win32">
|
||||
<Configuration>Devel</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectName>ZeroGS</ProjectName>
|
||||
<ProjectGuid>{5C6B7D28-E73D-4F71-8FC0-17ADA640EBD8}</ProjectGuid>
|
||||
<RootNamespace>ZeroGS</RootNamespace>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<UseOfMfc>false</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<PlatformToolset>$(DefaultPlatformToolset)</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="..\..\..\..\common\vsprops\plugin_svnroot.props" />
|
||||
<Import Project="..\..\..\..\common\vsprops\BaseProperties.props" />
|
||||
<Import Project="..\..\..\..\common\vsprops\CodeGen_Release.props" />
|
||||
<Import Project="..\..\..\..\common\vsprops\3rdpartyDeps.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="..\..\..\..\common\vsprops\plugin_svnroot.props" />
|
||||
<Import Project="..\..\..\..\common\vsprops\BaseProperties.props" />
|
||||
<Import Project="..\..\..\..\common\vsprops\3rdpartyDeps.props" />
|
||||
<Import Project="..\..\..\..\common\vsprops\CodeGen_Debug.props" />
|
||||
<Import Project="..\..\..\..\common\vsprops\IncrementalLinking.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'" Label="PropertySheets">
|
||||
<Import Project="..\..\..\..\common\vsprops\plugin_svnroot.props" />
|
||||
<Import Project="..\..\..\..\common\vsprops\BaseProperties.props" />
|
||||
<Import Project="..\..\..\..\common\vsprops\3rdpartyDeps.props" />
|
||||
<Import Project="..\..\..\..\common\vsprops\CodeGen_Devel.props" />
|
||||
<Import Project="..\..\..\..\common\vsprops\IncrementalLinking.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<TargetName Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">$(ProjectName)-dev</TargetName>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/GSsoftdx.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(DXSDK_DIR)include;..\x86\;..\..\ZeroGSShaders\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;_USRDLL;__i386__;ZEROGS_DEVBUILD;ZEROGS_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeaderOutputFile>.\Release/GSsoftdx.pch</PrecompiledHeaderOutputFile>
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>dxerr.lib;dxguid.lib;d3dx9.lib;d3d9.lib;odbc32.lib;odbccp32.lib;winmm.lib;Vfw32.lib;comctl32.lib;RpcRT4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>..\;$(DXSDK_DIR)lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ModuleDefinitionFile>.\GSsoftdx.def</ModuleDefinitionFile>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(DXSDK_DIR)include;..\x86\;..\..\ZeroGSShaders\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>D3D_DEBUG_INFO;_USRDLL;__i386__;ZEROGS_DEVBUILD;ZEROGS_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>dxerr.lib;dxguid.lib;d3dx9.lib;d3d9.lib;odbc32.lib;odbccp32.lib;winmm.lib;Vfw32.lib;comctl32.lib;RpcRT4.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<AdditionalLibraryDirectories>..\;$(DXSDK_DIR)lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<IgnoreSpecificDefaultLibraries>%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
<ModuleDefinitionFile>.\GSsoftdx.def</ModuleDefinitionFile>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/GSsoftdx.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ClCompile>
|
||||
<AdditionalIncludeDirectories>$(DXSDK_DIR)include;..\x86\;..\..\ZeroGSShaders\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;__i386__;RELEASE_TO_PUBLIC;ZEROGS_SSE2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeaderOutputFile>
|
||||
</PrecompiledHeaderOutputFile>
|
||||
<CompileAs>Default</CompileAs>
|
||||
</ClCompile>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0409</Culture>
|
||||
</ResourceCompile>
|
||||
<Link>
|
||||
<AdditionalDependencies>dxerr.lib;dxguid.lib;d3dx9.lib;d3d9.lib;odbc32.lib;odbccp32.lib;winmm.lib;Vfw32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<AdditionalLibraryDirectories>..\;$(DXSDK_DIR)lib\x86;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<ModuleDefinitionFile>.\GSsoftdx.def</ModuleDefinitionFile>
|
||||
<RandomizedBaseAddress>false</RandomizedBaseAddress>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
<ImageHasSafeExceptionHandlers>false</ImageHasSafeExceptionHandlers>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Conf.cpp" />
|
||||
<ClCompile Include="..\GSmain.cpp" />
|
||||
<ClCompile Include="..\Mem.cpp" />
|
||||
<ClCompile Include="..\Regs.cpp" />
|
||||
<ClCompile Include="..\targets.cpp" />
|
||||
<ClCompile Include="Win32.cpp" />
|
||||
<ClCompile Include="..\x86.cpp" />
|
||||
<ClCompile Include="..\zerogs.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="GSsoftdx.def" />
|
||||
<CustomBuild Include="..\x86-32.asm">
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">ml /nologo /c /Zi /Fo"$(IntDir)%(Filename).obj" "%(FullPath)"
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">ml /nologo /c /Zi /Fo"$(IntDir)%(Filename).obj" "%(FullPath)"
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Devel|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
|
||||
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">ml /nologo /c /Zi /Fo"$(IntDir)%(Filename).obj" "%(FullPath)"
|
||||
</Command>
|
||||
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).obj;%(Outputs)</Outputs>
|
||||
</CustomBuild>
|
||||
<None Include="zerogs.bmp" />
|
||||
<None Include="ps2fx.dat" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="aviUtil.h" />
|
||||
<ClInclude Include="..\GS.h" />
|
||||
<ClInclude Include="..\Mem.h" />
|
||||
<ClInclude Include="..\Regs.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
<ClInclude Include="resrc1.h" />
|
||||
<ClInclude Include="..\targets.h" />
|
||||
<ClInclude Include="Win32.h" />
|
||||
<ClInclude Include="..\x86.h" />
|
||||
<ClInclude Include="..\zerogs.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="zerogs.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\..\..\3rdparty\pthreads4w\build\pthreads4w.vcxproj">
|
||||
<Project>{0fae817d-9a32-4830-857e-81da57246e16}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\3rdparty\zlib\zlib.vcxproj">
|
||||
<Project>{2f6c0388-20cb-4242-9f6c-a6ebb6a83f47}</Project>
|
||||
<Private>true</Private>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
<CopyLocalSatelliteAssemblies>false</CopyLocalSatelliteAssemblies>
|
||||
<LinkLibraryDependencies>true</LinkLibraryDependencies>
|
||||
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\..\common\build\Utilities\utilities.vcxproj">
|
||||
<Project>{4639972e-424e-4e13-8b07-ca403c481346}</Project>
|
||||
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
</Project>
|
|
@ -1,94 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{3d88e262-211f-4c7c-8e48-401a5e7e5693}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{0ec02065-4a77-4d4f-8eda-d1c1842fc718}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{069c51db-9551-438c-b89f-20063b43404f}</UniqueIdentifier>
|
||||
<Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Conf.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\GSmain.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Mem.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\Regs.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\targets.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="Win32.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\x86.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\zerogs.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="GSsoftdx.def">
|
||||
<Filter>Source Files</Filter>
|
||||
</None>
|
||||
<None Include="zerogs.bmp">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="ps2fx.dat" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="aviUtil.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\GS.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Mem.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\Regs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="resrc1.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\targets.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Win32.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\x86.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\zerogs.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="zerogs.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<CustomBuild Include="..\x86-32.asm">
|
||||
<Filter>Source Files</Filter>
|
||||
</CustomBuild>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1 +0,0 @@
|
|||
copy .\Release\ZeroGSShaders.exe ..\ZeroGS\
|
|
@ -1,407 +0,0 @@
|
|||
// Builds all possible shader files from ps2hw.fx and stores them in
|
||||
// a preprocessed database
|
||||
#include <stdio.h>
|
||||
|
||||
#include <windows.h>
|
||||
#include <d3dx9.h>
|
||||
#include <assert.h>
|
||||
|
||||
#define SAFE_RELEASE(x) { if( (x) != NULL ) { (x)->Release(); x = NULL; } }
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#include "zerogsshaders.h"
|
||||
|
||||
char* srcfilename = "ps2hw.fx";
|
||||
char* dstfilename = "ps2hw.dat";
|
||||
DWORD dwFlags = 0;
|
||||
|
||||
#ifndef ARRAYSIZE
|
||||
#define ARRAYSIZE(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#endif
|
||||
|
||||
struct SHADERINFO
|
||||
{
|
||||
DWORD type; // 1 - ps, 0 - vs
|
||||
LPD3DXBUFFER pbuf;
|
||||
};
|
||||
|
||||
map<DWORD, SHADERINFO> mapShaders;
|
||||
|
||||
class ZeroGSShaderInclude : public ID3DXInclude
|
||||
{
|
||||
public:
|
||||
int context;
|
||||
int ps2x; // if 0, ps20 only
|
||||
char* pEffectDir;
|
||||
|
||||
STDMETHOD(Open)(D3DXINCLUDE_TYPE IncludeType, LPCSTR pFileName, LPCVOID pParentData, LPCVOID *ppData, UINT *pBytes)
|
||||
{
|
||||
const char* pfilename = pFileName;
|
||||
char strfile[255];
|
||||
if( strstr(pFileName, "ps2hw_ctx") != NULL ) {
|
||||
|
||||
_snprintf(strfile, 255, "%sps2hw_ctx%d.fx", pEffectDir, context);
|
||||
pfilename = strfile;
|
||||
}
|
||||
// else if( strstr(pFileName, "ps2hw_ps2x") != NULL ) {
|
||||
// _snprintf(strfile, 255, "%sps2hw_ps2%c.fx", pEffectDir, ps2x?'x':'0');
|
||||
// pfilename = strfile;
|
||||
// }
|
||||
else if( strstr(pFileName, "ps2hw.fx") != NULL ) {
|
||||
_snprintf(strfile, 255, "%s%s", pEffectDir, pFileName);
|
||||
pfilename = strfile;
|
||||
}
|
||||
|
||||
FILE* f = fopen(pfilename, "rb");
|
||||
|
||||
if( f == NULL )
|
||||
return E_FAIL;
|
||||
|
||||
fseek(f, 0, SEEK_END);
|
||||
DWORD size = ftell(f);
|
||||
fseek(f, 0, SEEK_SET);
|
||||
char* buffer = new char[size+1];
|
||||
fread(buffer, size, 1, f);
|
||||
buffer[size] = 0;
|
||||
|
||||
*ppData = buffer;
|
||||
*pBytes = size;
|
||||
fclose(f);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
STDMETHOD(Close)(LPCVOID pData)
|
||||
{
|
||||
delete[] (char*)pData;
|
||||
return S_OK;
|
||||
}
|
||||
};
|
||||
|
||||
void LoadShader(int index, const char* name, const char* pshader, D3DXMACRO* pmacros, ID3DXInclude* pInclude)
|
||||
{
|
||||
LPD3DXBUFFER pShader = NULL, pError = NULL;
|
||||
|
||||
HRESULT hr = D3DXCompileShaderFromFile(srcfilename, pmacros, pInclude, name, pshader, dwFlags, &pShader, &pError, NULL);
|
||||
|
||||
if( FAILED(hr) )
|
||||
{
|
||||
printf("Failed to load %s\n%s\n", name, pError->GetBufferPointer());
|
||||
SAFE_RELEASE(pShader);
|
||||
SAFE_RELEASE(pError);
|
||||
return;
|
||||
}
|
||||
|
||||
SAFE_RELEASE(pError);
|
||||
|
||||
if( mapShaders.find(index) != mapShaders.end() ) {
|
||||
printf("two shaders share the same index %d\n", index);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
SHADERINFO info;
|
||||
info.type = name[0] == 'p' ? 0x80000000 : 0;
|
||||
info.pbuf = pShader;
|
||||
mapShaders[index] = info;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
printf("usage: [src] [dst] [opts]\n");
|
||||
|
||||
if( argc >= 2 ) srcfilename = argv[1];
|
||||
if( argc >= 3 ) dstfilename = argv[2];
|
||||
if( argc >= 4 ) {
|
||||
dwFlags = atoi(argv[3]);
|
||||
}
|
||||
|
||||
FILE* fsrc = fopen(srcfilename, "r");
|
||||
if( fsrc == NULL ) {
|
||||
printf("cannot open %s\n", srcfilename);
|
||||
return 0;
|
||||
}
|
||||
fclose(fsrc);
|
||||
|
||||
LoadShader(SH_BITBLTVS, "BitBltVS", "vs_2_0", NULL, NULL);
|
||||
LoadShader(SH_BITBLTVS|SH_30, "BitBltVS", "vs_3_0", NULL, NULL);
|
||||
LoadShader(SH_BITBLTPS, "BitBltPS", "ps_2_0", NULL, NULL);
|
||||
LoadShader(SH_BITBLTDEPTHPS, "BitBltDepthPS", "ps_2_0", NULL, NULL);
|
||||
LoadShader(SH_BITBLTDEPTHMRTPS, "BitBltDepthMRTPS", "ps_2_0", NULL, NULL);
|
||||
LoadShader(SH_BITBLTDEPTHTEXPS, "BitBltDepthTexPS", "ps_2_0", NULL, NULL);
|
||||
LoadShader(SH_BITBLTDEPTHTEXMRTPS, "BitBltDepthTexMRTPS", "ps_2_0", NULL, NULL);
|
||||
LoadShader(SH_CRTCTARGPS, "CRTCTargPS", "ps_2_0", NULL, NULL);
|
||||
LoadShader(SH_CRTCPS, "CRTCPS", "ps_2_0", NULL, NULL);
|
||||
LoadShader(SH_CRTC24PS, "CRTC24PS", "ps_2_0", NULL, NULL);
|
||||
LoadShader(SH_ZEROPS, "ZeroPS", "ps_2_0", NULL, NULL);
|
||||
LoadShader(SH_ZEROPS|SH_30, "ZeroPS", "ps_3_0", NULL, NULL);
|
||||
LoadShader(SH_BASETEXTUREPS, "BaseTexturePS", "ps_2_0", NULL, NULL);
|
||||
LoadShader(SH_BITBLTAAPS, "BitBltPS", "ps_2_0", NULL, NULL);
|
||||
LoadShader(SH_CRTCTARGINTERPS, "CRTCTargInterPS", "ps_2_0", NULL, NULL);
|
||||
LoadShader(SH_CRTCINTERPS, "CRTCInterPS", "ps_2_0", NULL, NULL);
|
||||
LoadShader(SH_CRTC24INTERPS, "CRTC24InterPS", "ps_2_0", NULL, NULL);
|
||||
LoadShader(SH_CONVERT16TO32PS, "Convert16to32PS", "ps_2_0", NULL, NULL);
|
||||
LoadShader(SH_CONVERT32TO16PS, "Convert32to16PS", "ps_2_0", NULL, NULL);
|
||||
|
||||
const int vsshaders[4] = { SH_REGULARVS, SH_TEXTUREVS, SH_REGULARFOGVS, SH_TEXTUREFOGVS };
|
||||
const char* pvsshaders[4] = { "RegularVS", "TextureVS", "RegularFogVS", "TextureFogVS" };
|
||||
|
||||
// load the texture shaders
|
||||
char str[255], strdir[255];
|
||||
|
||||
strcpy(strdir, srcfilename);
|
||||
int i = (int)strlen(strdir);
|
||||
while(i > 0) {
|
||||
if( strdir[i-1] == '/' || strdir[i-1] == '\\' )
|
||||
break;
|
||||
--i;
|
||||
}
|
||||
|
||||
strdir[i] = 0;
|
||||
|
||||
ZeroGSShaderInclude inc;
|
||||
inc.pEffectDir = strdir;
|
||||
|
||||
D3DXMACRO macros[10];
|
||||
memset(macros, 0, sizeof(macros));
|
||||
|
||||
macros[0].Name = "WRITE_DEPTH";
|
||||
macros[0].Definition = "1";
|
||||
|
||||
for(i = 0; i < ARRAYSIZE(vsshaders); ++i) {
|
||||
for(int vs30 = 0; vs30 < 2; ++vs30 ) {
|
||||
for(int writedepth = 0; writedepth < 2; ++writedepth ) {
|
||||
inc.context = 0;
|
||||
LoadShader(vsshaders[i]|(vs30?SH_30:0)|(writedepth?SH_WRITEDEPTH:0), pvsshaders[i], vs30 ? "vs_3_0" : "vs_2_0", writedepth ? macros : NULL, &inc);
|
||||
inc.context = 1;
|
||||
LoadShader(vsshaders[i]|(vs30?SH_30:0)|(writedepth?SH_WRITEDEPTH:0)|SH_CONTEXT1, pvsshaders[i], vs30 ? "vs_3_0" : "vs_2_0", writedepth ? macros : NULL, &inc);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const int psshaders[2] = { SH_REGULARPS, SH_REGULARFOGPS };
|
||||
const char* ppsshaders[2] = { "RegularPS", "RegularFogPS" };
|
||||
|
||||
for(i = 0; i < ARRAYSIZE(psshaders); ++i) {
|
||||
for(int ps30 = 0; ps30 < 2; ++ps30 ) {
|
||||
for(int writedepth = 0; writedepth < 2; ++writedepth ) {
|
||||
LoadShader(psshaders[i]|(ps30?SH_30:0)|(writedepth?SH_WRITEDEPTH:0), ppsshaders[i], ps30 ? "ps_3_0" : "ps_2_0", writedepth ? macros : NULL, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
printf("creating shaders, note that ps2hw_ctx0.fx, and ps2hw_ctx1.fx are required\n");
|
||||
|
||||
for(int texwrap = 0; texwrap < NUM_TEXWRAPS; ++texwrap ) {
|
||||
|
||||
int macroindex = 0;
|
||||
memset(macros, 0, sizeof(macros));
|
||||
|
||||
if( g_pPsTexWrap[texwrap] != NULL ) {
|
||||
macros[0].Name = g_pPsTexWrap[texwrap];
|
||||
macros[0].Definition = "1";
|
||||
macroindex++;
|
||||
}
|
||||
|
||||
for(int context = 0; context < 2; ++context) {
|
||||
inc.context = context;
|
||||
|
||||
for(int texfilter = 0; texfilter < NUM_FILTERS; ++texfilter) {
|
||||
for(int fog = 0; fog < 2; ++fog ) {
|
||||
for(int writedepth = 0; writedepth < 2; ++writedepth ) {
|
||||
|
||||
if( writedepth ) {
|
||||
macros[macroindex].Name = "WRITE_DEPTH";
|
||||
macros[macroindex].Definition = "1";
|
||||
macroindex++;
|
||||
}
|
||||
else {
|
||||
macros[macroindex].Name = NULL;
|
||||
macros[macroindex].Definition = NULL;
|
||||
}
|
||||
|
||||
for(int testaem = 0; testaem < 2; ++testaem ) {
|
||||
|
||||
if( testaem ) {
|
||||
macros[macroindex].Name = "TEST_AEM";
|
||||
macros[macroindex].Definition = "1";
|
||||
macroindex++;
|
||||
}
|
||||
else {
|
||||
macros[macroindex].Name = NULL;
|
||||
macros[macroindex].Definition = NULL;
|
||||
}
|
||||
|
||||
for(int exactcolor = 0; exactcolor < 2; ++exactcolor ) {
|
||||
|
||||
if( exactcolor ) {
|
||||
macros[macroindex].Name = "EXACT_COLOR";
|
||||
macros[macroindex].Definition = "1";
|
||||
macroindex++;
|
||||
}
|
||||
else {
|
||||
macros[macroindex].Name = NULL;
|
||||
macros[macroindex].Definition = NULL;
|
||||
}
|
||||
|
||||
// 32
|
||||
sprintf(str, "Texture%s%d_32PS", fog?"Fog":"", texfilter);
|
||||
inc.ps2x = 0;
|
||||
|
||||
if( macros[macroindex].Name != NULL )
|
||||
printf("error[%d] %s: %d %d %d %d!\n", macroindex, macros[macroindex].Name, texfilter, fog, writedepth, testaem);
|
||||
|
||||
macros[macroindex].Name = "ACCURATE_DECOMPRESSION";
|
||||
macros[macroindex].Definition = "1";
|
||||
|
||||
if( texfilter == 0 && exactcolor == 0 ) {
|
||||
LoadShader(GET_SHADER_INDEX(0, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20), str, g_pShaders[SHADER_20], macros, &inc);
|
||||
}
|
||||
|
||||
inc.ps2x = 1;
|
||||
LoadShader(GET_SHADER_INDEX(0, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20b), str, g_pShaders[SHADER_20b], macros, &inc);
|
||||
|
||||
macros[macroindex].Name = NULL;
|
||||
macros[macroindex].Definition = NULL;
|
||||
|
||||
LoadShader(GET_SHADER_INDEX(0, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20a), str, g_pShaders[SHADER_20a], macros, &inc);
|
||||
LoadShader(GET_SHADER_INDEX(0, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_30), str, g_pShaders[SHADER_30], macros, &inc);
|
||||
|
||||
if( texfilter == 0 ) {
|
||||
// tex32
|
||||
sprintf(str, "Texture%s%d_tex32PS", fog?"Fog":"", texfilter);
|
||||
inc.ps2x = 0;
|
||||
|
||||
macros[macroindex].Name = "ACCURATE_DECOMPRESSION";
|
||||
macros[macroindex].Definition = "1";
|
||||
|
||||
if( texfilter == 0 && exactcolor == 0 ) {
|
||||
LoadShader(GET_SHADER_INDEX(1, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20), str, g_pShaders[SHADER_20], macros, &inc);
|
||||
}
|
||||
|
||||
inc.ps2x = 1;
|
||||
|
||||
LoadShader(GET_SHADER_INDEX(1, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20b), str, g_pShaders[SHADER_20b], macros, &inc);
|
||||
|
||||
macros[macroindex].Name = NULL;
|
||||
macros[macroindex].Definition = NULL;
|
||||
|
||||
LoadShader(GET_SHADER_INDEX(1, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20a), str, g_pShaders[SHADER_20a], macros, &inc);
|
||||
LoadShader(GET_SHADER_INDEX(1, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_30), str, g_pShaders[SHADER_30], macros, &inc);
|
||||
|
||||
// clut32
|
||||
sprintf(str, "Texture%s%d_clut32PS", fog?"Fog":"", texfilter);
|
||||
inc.ps2x = 0;
|
||||
|
||||
macros[macroindex].Name = "ACCURATE_DECOMPRESSION";
|
||||
macros[macroindex].Definition = "1";
|
||||
|
||||
if( texfilter == 0 && exactcolor == 0 ) {
|
||||
LoadShader(GET_SHADER_INDEX(2, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20), str, g_pShaders[SHADER_20], macros, &inc);
|
||||
}
|
||||
|
||||
inc.ps2x = 1;
|
||||
|
||||
LoadShader(GET_SHADER_INDEX(2, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20b), str, g_pShaders[SHADER_20b], macros, &inc);
|
||||
|
||||
macros[macroindex].Name = NULL;
|
||||
macros[macroindex].Definition = NULL;
|
||||
|
||||
LoadShader(GET_SHADER_INDEX(2, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20a), str, g_pShaders[SHADER_20a], macros, &inc);
|
||||
LoadShader(GET_SHADER_INDEX(2, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_30), str, g_pShaders[SHADER_30], macros, &inc);
|
||||
|
||||
// tex32to16
|
||||
sprintf(str, "Texture%s%d_tex32to16PS", fog?"Fog":"", texfilter);
|
||||
inc.ps2x = 0;
|
||||
|
||||
macros[macroindex].Name = "ACCURATE_DECOMPRESSION";
|
||||
macros[macroindex].Definition = "1";
|
||||
|
||||
if( texfilter == 0 && exactcolor == 0 ) {
|
||||
LoadShader(GET_SHADER_INDEX(3, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20), str, g_pShaders[SHADER_20], macros, &inc);
|
||||
}
|
||||
|
||||
inc.ps2x = 1;
|
||||
|
||||
LoadShader(GET_SHADER_INDEX(3, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20b), str, g_pShaders[SHADER_20b], macros, &inc);
|
||||
|
||||
macros[macroindex].Name = NULL;
|
||||
macros[macroindex].Definition = NULL;
|
||||
|
||||
LoadShader(GET_SHADER_INDEX(3, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20a), str, g_pShaders[SHADER_20a], macros, &inc);
|
||||
LoadShader(GET_SHADER_INDEX(3, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_30), str, g_pShaders[SHADER_30], macros, &inc);
|
||||
|
||||
// tex16to8h
|
||||
sprintf(str, "Texture%s%d_tex16to8hPS", fog?"Fog":"", texfilter);
|
||||
inc.ps2x = 0;
|
||||
|
||||
macros[macroindex].Name = "ACCURATE_DECOMPRESSION";
|
||||
macros[macroindex].Definition = "1";
|
||||
|
||||
inc.ps2x = 1;
|
||||
|
||||
LoadShader(GET_SHADER_INDEX(4, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20b), str, g_pShaders[SHADER_20b], macros, &inc);
|
||||
|
||||
macros[macroindex].Name = NULL;
|
||||
macros[macroindex].Definition = NULL;
|
||||
|
||||
LoadShader(GET_SHADER_INDEX(4, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_20a), str, g_pShaders[SHADER_20a], macros, &inc);
|
||||
LoadShader(GET_SHADER_INDEX(4, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_30), str, g_pShaders[SHADER_30], macros, &inc);
|
||||
}
|
||||
}
|
||||
|
||||
--macroindex;
|
||||
macros[macroindex].Name = NULL;
|
||||
macros[macroindex].Definition = NULL;
|
||||
}
|
||||
|
||||
--macroindex;
|
||||
macros[macroindex].Name = NULL;
|
||||
macros[macroindex].Definition = NULL;
|
||||
}
|
||||
|
||||
--macroindex;
|
||||
macros[macroindex].Name = NULL;
|
||||
macros[macroindex].Definition = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// create the database
|
||||
FILE* fdst = fopen(dstfilename, "wb");
|
||||
if( fdst == NULL ) {
|
||||
printf("failed to open %s\n", dstfilename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
DWORD num = (DWORD)mapShaders.size();
|
||||
fwrite(&num, 4, 1, fdst);
|
||||
|
||||
i = 0;
|
||||
DWORD totaloffset = 4+sizeof(SHADERHEADER)*num;
|
||||
for(map<DWORD, SHADERINFO>::iterator it = mapShaders.begin(); it != mapShaders.end(); ++it, ++i) {
|
||||
SHADERHEADER h;
|
||||
h.index = it->first | it->second.type;
|
||||
h.offset = totaloffset;
|
||||
h.size = it->second.pbuf->GetBufferSize();
|
||||
|
||||
fseek(fdst, 4+i*sizeof(SHADERHEADER), SEEK_SET);
|
||||
fwrite(&h, sizeof(SHADERHEADER), 1, fdst);
|
||||
|
||||
fseek(fdst, totaloffset, SEEK_SET);
|
||||
fwrite(it->second.pbuf->GetBufferPointer(), it->second.pbuf->GetBufferSize(), 1, fdst);
|
||||
|
||||
totaloffset += it->second.pbuf->GetBufferSize();
|
||||
it->second.pbuf->Release();
|
||||
}
|
||||
|
||||
fclose(fdst);
|
||||
|
||||
printf("wrote %s\n", dstfilename);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,118 +0,0 @@
|
|||
#define NUM_FILTERS 2 // texture filtering
|
||||
#define NUM_TYPES 5 // types of texture read modes
|
||||
#define NUM_TEXWRAPS 4 // texture wrapping
|
||||
|
||||
#define NUM_SHADERS (NUM_FILTERS*NUM_TYPES*NUM_TEXWRAPS*32) // # shaders for a given ps
|
||||
|
||||
#define SHADER_20 0
|
||||
#define SHADER_20a 1
|
||||
#define SHADER_20b 2
|
||||
#define SHADER_30 3
|
||||
|
||||
// ps == 0, 2.0
|
||||
// ps == 1, 2.0a, nvidia
|
||||
// ps == 2, 2.0b, ati
|
||||
const static char* g_pShaders[4] = { "ps_2_0", "ps_2_a", "ps_2_b", "ps_3_0" };
|
||||
const static char* g_pPsTexWrap[] = { "REPEAT", "CLAMP", "REGION_REPEAT", NULL };
|
||||
const static char* g_pTexTypes[] = { "32", "tex32", "clut32", "tex32to16", "tex16to8h" };
|
||||
|
||||
#define TEXWRAP_REPEAT 0
|
||||
#define TEXWRAP_CLAMP 1
|
||||
#define TEXWRAP_REGION_REPEAT 2
|
||||
#define TEXWRAP_REPEAT_CLAMP 3
|
||||
|
||||
inline int GET_SHADER_INDEX(int type, int texfilter, int texwrap, int fog, int writedepth, int testaem, int exactcolor, int context, int ps)
|
||||
{
|
||||
return type + texfilter*NUM_TYPES + NUM_FILTERS*NUM_TYPES*texwrap + NUM_TEXWRAPS*NUM_FILTERS*NUM_TYPES*(fog+2*writedepth+4*testaem+8*exactcolor+16*context+32*ps);
|
||||
}
|
||||
|
||||
static HRESULT LoadShaderFromType(const char* srcfile, int type, int texfilter, int texwrap, int fog, int writedepth, int testaem, int exactcolor, int ps, DWORD flags,
|
||||
IDirect3DDevice9* pd3dDevice, ID3DXInclude* pInclude, IDirect3DPixelShader9** pps)
|
||||
{
|
||||
assert( texwrap < NUM_TEXWRAPS);
|
||||
assert( type < NUM_TYPES );
|
||||
|
||||
char str[255];
|
||||
sprintf(str, "Texture%s%d_%sPS", fog?"Fog":"", texfilter, g_pTexTypes[type]);
|
||||
|
||||
LPD3DXBUFFER pShader = NULL, pError = NULL;
|
||||
SAFE_RELEASE(*pps);
|
||||
|
||||
vector<D3DXMACRO> macros;
|
||||
D3DXMACRO dummy; dummy.Definition = NULL; dummy.Name = NULL;
|
||||
if( g_pPsTexWrap[texwrap] != NULL ) {
|
||||
D3DXMACRO m;
|
||||
m.Name = g_pPsTexWrap[texwrap];
|
||||
m.Definition = "1";
|
||||
macros.push_back(m);
|
||||
}
|
||||
if( writedepth ) {
|
||||
D3DXMACRO m;
|
||||
m.Name = "WRITE_DEPTH";
|
||||
m.Definition = "1";
|
||||
macros.push_back(m);
|
||||
}
|
||||
if( testaem ) {
|
||||
D3DXMACRO m;
|
||||
m.Name = "TEST_AEM";
|
||||
m.Definition = "1";
|
||||
macros.push_back(m);
|
||||
}
|
||||
if( exactcolor ) {
|
||||
D3DXMACRO m;
|
||||
m.Name = "EXACT_COLOR";
|
||||
m.Definition = "1";
|
||||
macros.push_back(m);
|
||||
}
|
||||
|
||||
macros.push_back(dummy);
|
||||
HRESULT hr = D3DXCompileShaderFromFile(srcfile, ¯os[0], pInclude, str, g_pShaders[ps], flags, &pShader, &pError, NULL);
|
||||
|
||||
if( FAILED(hr) )
|
||||
{
|
||||
DEBUG_LOG("Failed to load %s\n%s\n", str, reinterpret_cast<const char*>(pError->GetBufferPointer()));
|
||||
SAFE_RELEASE(pShader);
|
||||
SAFE_RELEASE(pError);
|
||||
return hr;
|
||||
}
|
||||
|
||||
DWORD* ptr = (DWORD*)pShader->GetBufferPointer();
|
||||
hr = pd3dDevice->CreatePixelShader(ptr, pps);
|
||||
SAFE_RELEASE(pShader);
|
||||
SAFE_RELEASE(pError);
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
struct SHADERHEADER
|
||||
{
|
||||
DWORD index, offset, size; // if highest bit of index is set, pixel shader
|
||||
};
|
||||
|
||||
#define SH_30 0x4000 // or for vs3.0 shaders
|
||||
#define SH_WRITEDEPTH 0x2000 // depth is written
|
||||
#define SH_CONTEXT1 0x1000 // context1 is used
|
||||
|
||||
#define SH_REGULARVS 0x8000
|
||||
#define SH_TEXTUREVS 0x8001
|
||||
#define SH_REGULARFOGVS 0x8002
|
||||
#define SH_TEXTUREFOGVS 0x8003
|
||||
#define SH_REGULARPS 0x8004
|
||||
#define SH_REGULARFOGPS 0x8005
|
||||
#define SH_BITBLTVS 0x8006
|
||||
#define SH_BITBLTPS 0x8007
|
||||
#define SH_BITBLTDEPTHPS 0x8009
|
||||
#define SH_CRTCTARGPS 0x800a
|
||||
#define SH_CRTCPS 0x800b
|
||||
#define SH_CRTC24PS 0x800c
|
||||
#define SH_ZEROPS 0x800e
|
||||
#define SH_BASETEXTUREPS 0x800f
|
||||
#define SH_BITBLTAAPS 0x8010
|
||||
#define SH_CRTCTARGINTERPS 0x8012
|
||||
#define SH_CRTCINTERPS 0x8013
|
||||
#define SH_CRTC24INTERPS 0x8014
|
||||
#define SH_BITBLTDEPTHMRTPS 0x8016
|
||||
#define SH_BITBLTDEPTHTEXPS 0x8017
|
||||
#define SH_BITBLTDEPTHTEXMRTPS 0x8018
|
||||
#define SH_CONVERT16TO32PS 0x8020
|
||||
#define SH_CONVERT32TO16PS 0x8021
|
|
@ -1,4 +0,0 @@
|
|||
@echo off
|
||||
call parsedate
|
||||
set TIMESTAMP=%month%%day%%year:~2,3%
|
||||
winrar u ZeroGS%TIMESTAMP%.zip *.h *.cpp Win32\*.sln Win32\*.vcproj Win32\*.suo Win32\*.bat Win32\*.cpp Win32\*.h Win32\*.def *.asm *.fx *.bat zerogs.psd ZeroGSShaders.exe x86\*.* Win32\*.rc Win32\*.bmp Win32\*.dat ..\ZeroGSShaders\*.h ..\ZeroGSShaders\*.cpp
|
|
@ -1,3 +0,0 @@
|
|||
ZeroGSShaders.exe ps2hw.fx ps2fx.dat
|
||||
del Win32\ps2fx.dat Win32\Release\*.res Win32\Debug\*.res
|
||||
move /y ps2fx.dat Win32\ps2fx.dat
|
File diff suppressed because it is too large
Load Diff
|
@ -1,993 +0,0 @@
|
|||
// Cg Shaders for PS2 GS emulation
|
||||
|
||||
// divides by z for every pixel, instead of in vertex shader
|
||||
// fixes kh textures
|
||||
#define PERSPECTIVE_CORRECT_TEX
|
||||
|
||||
//#define TEST_AEM // tests AEM for black pixels
|
||||
//#define REGION_REPEAT // set if texture wrapping mode is region repeat
|
||||
//#define WRITE_DEPTH // set if depth is also written in a MRT
|
||||
//#define ACCURATE_DECOMPRESSION // set for less capable hardware ATI Radeon 9000 series
|
||||
//#define EXACT_COLOR // make sure the output color is clamped to 1/255 boundaries (for alpha testing)
|
||||
|
||||
#ifdef PERSPECTIVE_CORRECT_TEX
|
||||
#define TEX_XY tex.xy/tex.z
|
||||
#define TEX_DECL float3
|
||||
#else
|
||||
#define TEX_XY tex.xy
|
||||
#define TEX_DECL float2
|
||||
#endif
|
||||
|
||||
#ifdef WRITE_DEPTH
|
||||
#define DOZWRITE(x) x
|
||||
#else
|
||||
#define DOZWRITE(x)
|
||||
#endif
|
||||
|
||||
#include "ps2hw_ctx0.fx"
|
||||
|
||||
// used to get the tiled offset into a page given the linear offset
|
||||
texture g_txBlocks;
|
||||
texture g_txBilinearBlocks;
|
||||
texture g_txSrc;
|
||||
|
||||
texture g_txConv16to32;
|
||||
texture g_txConv32to16;
|
||||
|
||||
// for region_repeat mode
|
||||
texture g_txBitwiseANDX;
|
||||
texture g_txBitwiseANDY;
|
||||
texture g_txCLUT;
|
||||
|
||||
sampler g_sSrcFinal : register(s2) = sampler_state {
|
||||
Texture = <g_txSrc>;
|
||||
MipFilter = LINEAR;
|
||||
MinFilter = LINEAR;
|
||||
MagFilter = LINEAR;
|
||||
AddressU = Clamp;
|
||||
AddressV = Clamp;
|
||||
};
|
||||
|
||||
sampler g_sBlocks : register(s3) = sampler_state {
|
||||
Texture = <g_txBlocks>;
|
||||
MipFilter = POINT;
|
||||
MinFilter = POINT;
|
||||
MagFilter = POINT;
|
||||
AddressU = Wrap;
|
||||
AddressV = Wrap;
|
||||
};
|
||||
|
||||
sampler g_sBilinearBlocks : register(s4) = sampler_state {
|
||||
Texture = <g_txBilinearBlocks>;
|
||||
MipFilter = POINT;
|
||||
MinFilter = POINT;
|
||||
MagFilter = POINT;
|
||||
AddressU = Wrap;
|
||||
AddressV = Wrap;
|
||||
};
|
||||
|
||||
sampler g_sConv16to32 : register(s4) = sampler_state {
|
||||
Texture = <g_txConv16to32>;
|
||||
MipFilter = POINT;
|
||||
MinFilter = POINT;
|
||||
MagFilter = POINT;
|
||||
AddressU = Wrap;
|
||||
AddressV = Wrap;
|
||||
};
|
||||
|
||||
sampler3D g_sConv32to16 : register(s4) = sampler_state {
|
||||
Texture = <g_txConv32to16>;
|
||||
MipFilter = POINT;
|
||||
MinFilter = POINT;
|
||||
MagFilter = POINT;
|
||||
AddressU = Wrap;
|
||||
AddressV = Wrap;
|
||||
};
|
||||
|
||||
sampler g_sBitwiseANDX : register(s5) = sampler_state {
|
||||
Texture = <g_txBitwiseANDX>;
|
||||
MipFilter = POINT;
|
||||
MinFilter = POINT;
|
||||
MagFilter = POINT;
|
||||
AddressU = Wrap;
|
||||
AddressV = Wrap;
|
||||
};
|
||||
|
||||
sampler g_sBitwiseANDY : register(s6) = sampler_state {
|
||||
Texture = <g_txBitwiseANDY>;
|
||||
MipFilter = POINT;
|
||||
MinFilter = POINT;
|
||||
MagFilter = POINT;
|
||||
AddressU = Wrap;
|
||||
AddressV = Wrap;
|
||||
};
|
||||
|
||||
// used only on rare cases where the render target is PSMT8H
|
||||
sampler g_sCLUT : register(s2) = sampler_state {
|
||||
Texture = <g_txCLUT>;
|
||||
MipFilter = POINT;
|
||||
MinFilter = POINT;
|
||||
MagFilter = POINT;
|
||||
AddressU = Wrap;
|
||||
AddressV = Wrap;
|
||||
};
|
||||
|
||||
// global pixel shader constants
|
||||
float4 g_fInvTexDims : register(c22); // similar to g_fClutOff
|
||||
float3 g_fFogColor : register(c23);
|
||||
|
||||
// used for rectblitting
|
||||
float4 g_fBitBltZ : register(c24);
|
||||
|
||||
half4 g_fOneColor : register(c25); // col*.xxxy+.zzzw
|
||||
|
||||
// vertex shader constants
|
||||
float4 g_fBitBltPos : register(c4);
|
||||
float4 g_fZ : register(c5); // transforms d3dcolor z into float z
|
||||
float2 g_fZNorm : register(c6);
|
||||
float4 g_fBitBltTex : register(c7);
|
||||
|
||||
// pixel shader consts
|
||||
// .z is used for the addressing fn
|
||||
half4 g_fExactColor : register(c27) = half4(0.5,0.5/256.0f,0,1/255.0f);
|
||||
float3 g_fBilinear : register(c28) = float3(-0.7f, -0.65f, 0.9);
|
||||
float4 g_fZBias : register(c29) = half4(1.0f/256.0f, 1.0004f, 1, 0.5);
|
||||
float4 g_fc0 : register(c30) = float4(0,1, 0.001, 0.5f); // also for vs
|
||||
float4 g_fMult : register(c31) = float4(1/1024.0f, 0.2f/1024.0f, 1/128.0f, 1/512.0f);
|
||||
|
||||
// vertex shader consts
|
||||
float4 g_fBitBltTrans : register(c31) = float4(0.5f, -0.5f, 0.5, 0.5 + 0.4/416.0f);
|
||||
|
||||
// given a local tex coord, returns the coord in the memory
|
||||
float2 ps2memcoord(float2 realtex)
|
||||
{
|
||||
float4 off;
|
||||
|
||||
// block off
|
||||
realtex.xy = realtex.xy * g_fTexDims.xy + g_fTexDims.zw;
|
||||
realtex.xy = (realtex.xy - frac(realtex.xy)) * g_fMult.zw;
|
||||
float2 fblock = frac(realtex.xy);
|
||||
off.xy = realtex.xy-fblock.xy;
|
||||
|
||||
#ifdef ACCURATE_DECOMPRESSION
|
||||
off.zw = tex2D(g_sBlocks, g_fTexBlock.xy*fblock + g_fTexBlock.zw).xw;
|
||||
off.x = dot(off.xyw, g_fTexOffset.xyw);
|
||||
float f = frac(off.x);
|
||||
float fadd = g_fTexOffset.z * off.z;
|
||||
off.w = off.x + fadd;
|
||||
off.x = frac(f + fadd);
|
||||
off.w -= off.x;
|
||||
#else
|
||||
off.z = tex2D(g_sBlocks, g_fTexBlock.xy*fblock + g_fTexBlock.zw).r;
|
||||
|
||||
// combine the two
|
||||
off.x = dot(off.xyz, g_fTexOffset.xyz)+g_fTexOffset.w;
|
||||
off.x = modf(off.x, off.w);
|
||||
#endif
|
||||
|
||||
off.y = off.w * g_fPageOffset.y + g_fPageOffset.x;
|
||||
return off.xy;
|
||||
}
|
||||
|
||||
// find all texcoords for bilinear filtering
|
||||
// assume that orgtex are already on boundaries
|
||||
void ps2memcoord4(float4 orgtex, out float4 off0, out float4 off1)
|
||||
{
|
||||
//float4 off0, off1, off2, off3;
|
||||
float4 realtex;
|
||||
|
||||
// block off
|
||||
realtex = (orgtex * g_fTexDims.xyxy + g_fTexDims.zwzw);// * g_fMult.zwzw;
|
||||
float4 fblock = frac(realtex.xyzw);
|
||||
float4 ftransblock = g_fTexBlock.xyxy*fblock + g_fTexBlock.zwzw;
|
||||
realtex -= fblock;
|
||||
|
||||
float4 transvals = g_fTexOffset.x * realtex.xzxz + g_fTexOffset.y * realtex.yyww + g_fTexOffset.w;
|
||||
|
||||
float4 colors;// = tex2D(g_sBilinearBlocks, ftransblock.xy);
|
||||
|
||||
// this is faster on ffx ingame
|
||||
colors.x = tex2D(g_sBlocks, ftransblock.xy).r;
|
||||
colors.y = tex2D(g_sBlocks, ftransblock.zy).r;
|
||||
colors.z = tex2D(g_sBlocks, ftransblock.xw).r;
|
||||
colors.w = tex2D(g_sBlocks, ftransblock.zw).r;
|
||||
|
||||
float4 fr, rem;
|
||||
|
||||
#ifdef ACCURATE_DECOMPRESSION
|
||||
fr = frac(transvals);
|
||||
float4 fadd = colors * g_fTexOffset.z;
|
||||
rem = transvals + fadd;
|
||||
fr = frac(fr + fadd);
|
||||
rem -= fr;
|
||||
#else
|
||||
transvals += colors * g_fTexOffset.z;
|
||||
|
||||
fr = modf(transvals, rem);
|
||||
#endif
|
||||
|
||||
rem = rem * g_fPageOffset.y + g_fPageOffset.x;
|
||||
|
||||
// combine
|
||||
off0 = g_fc0.yxyx * fr.xxyy + g_fc0.xyxy * rem.xxyy;
|
||||
off1 = g_fc0.yxyx * fr.zzww + g_fc0.xyxy * rem.zzww;
|
||||
}
|
||||
|
||||
void ps2memcoord4_fast(float4 orgtex, out float4 off0, out float4 off1)
|
||||
{
|
||||
float4 realtex;
|
||||
|
||||
realtex = (orgtex * g_fTexDims.xyxy + g_fTexDims.zwzw);// * g_fMult.zwzw;
|
||||
float4 fblock = frac(realtex.xyzw);
|
||||
float2 ftransblock = g_fTexBlock.xy*fblock.xy + g_fTexBlock.zw;
|
||||
realtex -= fblock;
|
||||
|
||||
float4 transvals = g_fTexOffset.x * realtex.xzxz + g_fTexOffset.y * realtex.yyww + g_fTexOffset.w;
|
||||
|
||||
float4 colors = tex2D(g_sBilinearBlocks, ftransblock.xy);
|
||||
float4 fr, rem;
|
||||
|
||||
#ifdef ACCURATE_DECOMPRESSION
|
||||
fr = frac(transvals);
|
||||
float4 fadd = colors * g_fTexOffset.z;
|
||||
rem = transvals + fadd;
|
||||
fr = frac(fr + fadd);
|
||||
rem -= fr;
|
||||
#else
|
||||
transvals += colors * g_fTexOffset.z;
|
||||
|
||||
fr = modf(transvals, rem);
|
||||
#endif
|
||||
|
||||
rem = rem * g_fPageOffset.y + g_fPageOffset.x;
|
||||
|
||||
off0 = g_fc0.yxyx * fr.xxyy + g_fc0.xyxy * rem.xxyy;
|
||||
off1 = g_fc0.yxyx * fr.zzww + g_fc0.xyxy * rem.zzww;
|
||||
}
|
||||
|
||||
// Wrapping modes
|
||||
#if defined(REPEAT)
|
||||
|
||||
float2 ps2addr(float2 coord)
|
||||
{
|
||||
return frac(coord.xy);
|
||||
}
|
||||
|
||||
#elif defined(CLAMP)
|
||||
|
||||
float2 ps2addr(float2 coord)
|
||||
{
|
||||
return clamp(coord.xy, g_fClampExts.xy, g_fClampExts.zw);
|
||||
}
|
||||
|
||||
#elif defined(REGION_REPEAT)
|
||||
|
||||
// computes the local tex coord along with addressing modes
|
||||
float2 ps2addr(float2 coord)
|
||||
{
|
||||
float2 final = frac(clamp(coord.xy, g_fClampExts.xy, g_fClampExts.zw));
|
||||
|
||||
if( TexWrapMode.x > g_fBilinear.z ) // region repeat mode for x (umsk&x)|ufix
|
||||
final.x = tex2D(g_sBitwiseANDX, abs(coord.x)*TexWrapMode.z).x * g_fClampExts.x + g_fClampExts.z;
|
||||
if( TexWrapMode.y > g_fBilinear.z ) // region repeat mode for x (vmsk&x)|vfix
|
||||
final.y = tex2D(g_sBitwiseANDY, abs(coord.y)*TexWrapMode.w).x * g_fClampExts.y + g_fClampExts.w;
|
||||
|
||||
return final;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
float2 ps2addr(float2 coord)
|
||||
{
|
||||
return frac(clamp(coord.xy, g_fClampExts.xy, g_fClampExts.zw));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
half4 tex2DPS_32(float2 tex0)
|
||||
{
|
||||
return tex2D(g_sMemory, ps2memcoord(tex0).xy);
|
||||
}
|
||||
|
||||
// use when texture is not tiled
|
||||
half4 tex2DPS_tex32(float2 tex0)
|
||||
{
|
||||
return tex2D(g_sMemory, g_fTexDims.xy*tex0+g_fTexDims.zw)*g_fZBias.zzzw+g_fPageOffset.w;
|
||||
}
|
||||
|
||||
// use when texture is not tiled
|
||||
half4 tex2DPS_clut32(float2 tex0)
|
||||
{
|
||||
float index = tex2D(g_sMemory, g_fTexDims.xy*tex0+g_fTexDims.zw).a+g_fPageOffset.w;
|
||||
return tex1D(g_sCLUT, index*g_fExactColor.x+g_fExactColor.y);
|
||||
}
|
||||
|
||||
// use when texture is not tiled and converting from 32bit to 16bit
|
||||
// don't convert on the block level, only on the column level
|
||||
// so every other 8 pixels, use the upper bits instead of lower
|
||||
half4 tex2DPS_tex32to16(float2 tex0)
|
||||
{
|
||||
bool upper = false;
|
||||
tex0.y += g_fPageOffset.z;
|
||||
float2 ffrac = fmod(tex0, g_fTexOffset.xy);
|
||||
//tex0.xy = g_fc0.ww * (tex0.xy + ffrac);
|
||||
tex0.y += ffrac.y;
|
||||
|
||||
if( ffrac.x > g_fTexOffset.z ) {
|
||||
tex0.x -= g_fTexOffset.z;
|
||||
upper = true;
|
||||
}
|
||||
if( ffrac.y >= g_fTexOffset.w ) {
|
||||
tex0.y -= g_fTexOffset.y;
|
||||
tex0.x += g_fTexOffset.z;
|
||||
}
|
||||
|
||||
half4 color = tex2D(g_sMemory, g_fTexDims.xy*tex0+g_fTexDims.zw)*g_fZBias.zzzw+g_fPageOffset.w;
|
||||
float2 uv = upper ? color.xw : color.zy;
|
||||
return tex2D(g_sConv16to32, uv+g_fPageOffset.xy).zyxw;
|
||||
}
|
||||
|
||||
// used when a 16 bit texture is used an 8h
|
||||
half4 tex2DPS_tex16to8h(float2 tex0)
|
||||
{
|
||||
float4 final;
|
||||
float2 ffrac = fmod(tex0+g_fPageOffset.zw, g_fTexOffset.xy);
|
||||
//tex0.xy = g_fPageOffset.xy * tex0.xy - ffrac * g_fc0.yw;
|
||||
tex0.y += g_fPageOffset.y * ffrac.y;
|
||||
|
||||
if( ffrac.x > g_fTexOffset.z ) {
|
||||
tex0.x -= g_fTexOffset.z;
|
||||
tex0.y += g_fTexOffset.w;
|
||||
}
|
||||
|
||||
float4 upper = tex2D(g_sMemory, g_fTexDims.xy*tex0+g_fTexDims.zw);
|
||||
|
||||
// only need alpha
|
||||
float index = tex3D(g_sConv32to16, upper.zyx-g_fc0.z).y + upper.w*g_fc0.w*g_fc0.w;
|
||||
return tex1D(g_sCLUT, index+g_fExactColor.y);
|
||||
}
|
||||
|
||||
// used when a 16 bit texture is used a 32bit one
|
||||
half4 tex2DPS_tex16to32(float2 tex0)
|
||||
{
|
||||
float4 final;
|
||||
float2 ffrac = fmod(tex0+g_fPageOffset.zw, g_fTexOffset.xy);
|
||||
//tex0.xy = g_fPageOffset.xy * tex0.xy - ffrac * g_fc0.yw;
|
||||
tex0.y += g_fPageOffset.y * ffrac.y;
|
||||
|
||||
if( ffrac.x > g_fTexOffset.z ) {
|
||||
tex0.x -= g_fTexOffset.z;
|
||||
tex0.y += g_fTexOffset.w;
|
||||
}
|
||||
|
||||
float fconst = g_fc0.w*g_fc0.w;
|
||||
float4 lower = tex2D(g_sSrcFinal, g_fTexDims.xy*tex0);
|
||||
float4 upper = tex2D(g_sMemory, g_fTexDims.xy*tex0+g_fTexDims.zw);
|
||||
|
||||
final.zy = tex3D(g_sConv32to16, lower.zyx).xy + lower.ww*fconst;
|
||||
final.xw = tex3D(g_sConv32to16, upper.zyx).xy + upper.ww*fconst;
|
||||
return final;
|
||||
}
|
||||
|
||||
//half4 f;
|
||||
//f.w = old.y > (127.2f/255.0f) ? 1 : 0;
|
||||
//old.y -= 0.5f * f.w;
|
||||
//f.xyz = frac(old.yyx*half3(2.002*255.0f/256.0f, 64.025f*255.0f/256.0f, 8.002*255.0f/256.0f));
|
||||
//f.y += old.x * (0.25f*255.0f/256.0f);
|
||||
|
||||
////////////////////////////////
|
||||
// calculates the texture color
|
||||
////////////////////////////////
|
||||
|
||||
#define decl_ps2shade(num) \
|
||||
decl_ps2shade_##num(_32); \
|
||||
decl_ps2shade_##num(_tex32); \
|
||||
decl_ps2shade_##num(_clut32); \
|
||||
decl_ps2shade_##num(_tex32to16); \
|
||||
decl_ps2shade_##num(_tex16to8h); \
|
||||
|
||||
// nearest
|
||||
#define decl_ps2shade_0(bit) \
|
||||
half4 ps2shade0##bit( TEX_DECL tex) \
|
||||
{ \
|
||||
return tex2DPS##bit( ps2addr(TEX_XY)); \
|
||||
} \
|
||||
|
||||
// do fast memcoord4 calcs when textures behave well
|
||||
#ifdef REPEAT
|
||||
#define PS2MEMCOORD4 ps2memcoord4
|
||||
#else
|
||||
#define PS2MEMCOORD4 ps2memcoord4
|
||||
#endif
|
||||
|
||||
#define decl_BilinearFilter(bit, addrfn) \
|
||||
half4 BilinearFilter##bit(float2 tex0) \
|
||||
{ \
|
||||
float4 off0, off1; \
|
||||
float4 ftex; \
|
||||
float2 ffrac; \
|
||||
ftex.xy = tex0 + g_fBilinear.xy * g_fRealTexDims.zw; \
|
||||
ffrac = frac(ftex.xy*g_fRealTexDims.xy); \
|
||||
ftex.xy -= ffrac.xy * g_fRealTexDims.zw; \
|
||||
\
|
||||
ftex.zw = ps2addr(ftex.xy + g_fRealTexDims.zw); \
|
||||
ftex.xy = ps2addr(ftex.xy); \
|
||||
\
|
||||
PS2MEMCOORD4(ftex, off0, off1); \
|
||||
half4 c0 = tex2D(g_sMemory, off0.xy); \
|
||||
half4 c1 = tex2D(g_sMemory, off0.zw); \
|
||||
half4 c2 = tex2D(g_sMemory, off1.xy); \
|
||||
half4 c3 = tex2D(g_sMemory, off1.zw); \
|
||||
return lerp( lerp(c0, c1, ffrac.x), lerp(c2, c3, ffrac.x), ffrac.y ); \
|
||||
} \
|
||||
|
||||
decl_BilinearFilter(_32, ps2addr);
|
||||
decl_BilinearFilter(_tex32, ps2addr);
|
||||
decl_BilinearFilter(_clut32, ps2addr);
|
||||
decl_BilinearFilter(_tex32to16, ps2addr);
|
||||
decl_BilinearFilter(_tex16to8h, ps2addr);
|
||||
|
||||
//TODO! For mip maps, only apply when LOD >= 0
|
||||
// lcm == 0, LOD = log(1/Q)*L + K, lcm == 1, LOD = K
|
||||
|
||||
// bilinear
|
||||
#define decl_ps2shade_1(bit) \
|
||||
half4 ps2shade1##bit(TEX_DECL tex) \
|
||||
{ \
|
||||
return BilinearFilter##bit(TEX_XY); \
|
||||
} \
|
||||
|
||||
// nearest, mip nearest
|
||||
#define decl_ps2shade_2(bit) \
|
||||
half4 ps2shade2##bit(TEX_DECL tex) \
|
||||
{ \
|
||||
return tex2DPS##bit( ps2addr(TEX_XY)); \
|
||||
} \
|
||||
|
||||
// nearest, mip linear
|
||||
#define decl_ps2shade_3(bit) \
|
||||
half4 ps2shade3##bit(TEX_DECL tex) \
|
||||
{ \
|
||||
return tex2DPS##bit(ps2addr(TEX_XY)); \
|
||||
} \
|
||||
|
||||
// linear, mip nearest
|
||||
#define decl_ps2shade_4(bit) \
|
||||
half4 ps2shade4##bit(TEX_DECL tex) \
|
||||
{ \
|
||||
return BilinearFilter##bit(TEX_XY); \
|
||||
} \
|
||||
|
||||
// linear, mip linear
|
||||
#define decl_ps2shade_5(bit) \
|
||||
half4 ps2shade5##bit(TEX_DECL tex) \
|
||||
{ \
|
||||
return BilinearFilter##bit(TEX_XY); \
|
||||
} \
|
||||
|
||||
decl_ps2shade(0);
|
||||
decl_ps2shade(1);
|
||||
decl_ps2shade(2);
|
||||
decl_ps2shade(3);
|
||||
decl_ps2shade(4);
|
||||
decl_ps2shade(5);
|
||||
|
||||
half4 ps2CalcShade(half4 texcol, half4 color)
|
||||
{
|
||||
#ifdef TEST_AEM
|
||||
if( dot(texcol.xyzw, g_fTestBlack.xyzw) <= g_fc0.z )
|
||||
texcol.w = g_fc0.x;
|
||||
else
|
||||
#endif
|
||||
texcol.w = texcol.w * fTexAlpha.y + fTexAlpha.x;
|
||||
|
||||
texcol = texcol * (fTexAlpha2.zzzw * color + fTexAlpha2.xxxy) + fTexAlpha.zzzw * color.wwww;
|
||||
|
||||
return texcol;
|
||||
}
|
||||
|
||||
// final ops on the color
|
||||
#ifdef EXACT_COLOR
|
||||
|
||||
half4 ps2FinalColor(half4 col)
|
||||
{
|
||||
// g_fOneColor has to scale by 255
|
||||
half4 temp = col * g_fOneColor.xxxy + g_fOneColor.zzzw;
|
||||
temp.w = floor(temp.w)*g_fExactColor.w;
|
||||
return temp;
|
||||
}
|
||||
|
||||
#else
|
||||
half4 ps2FinalColor(half4 col)
|
||||
{
|
||||
return col * g_fOneColor.xxxy + g_fOneColor.zzzw;
|
||||
}
|
||||
#endif
|
||||
|
||||
////////////////
|
||||
// Techniques //
|
||||
////////////////
|
||||
|
||||
// technique to copy a rectangle from source to target
|
||||
struct VSOUT_
|
||||
{
|
||||
float4 pos : POSITION;
|
||||
half4 color : COLOR0;
|
||||
DOZWRITE(float4 z : TEXCOORD0;)
|
||||
};
|
||||
|
||||
struct VSOUT_T
|
||||
{
|
||||
float4 pos : POSITION;
|
||||
half4 color : COLOR0;
|
||||
TEX_DECL tex : TEXCOORD0;
|
||||
DOZWRITE(float4 z : TEXCOORD1;)
|
||||
};
|
||||
|
||||
struct VSOUT_F
|
||||
{
|
||||
float4 pos : POSITION;
|
||||
half4 color : COLOR0;
|
||||
float fog : TEXCOORD0;
|
||||
DOZWRITE(float4 z : TEXCOORD1;)
|
||||
};
|
||||
|
||||
struct VSOUT_TF
|
||||
{
|
||||
float4 pos : POSITION;
|
||||
half4 color : COLOR0;
|
||||
TEX_DECL tex : TEXCOORD0;
|
||||
half fog : TEXCOORD1;
|
||||
DOZWRITE(float4 z : TEXCOORD2;)
|
||||
};
|
||||
|
||||
// just smooth shadering
|
||||
VSOUT_ RegularVS(float4 pos : POSITION,
|
||||
half4 color : COLOR0,
|
||||
float4 z : TEXCOORD0
|
||||
)
|
||||
{
|
||||
VSOUT_ o;
|
||||
|
||||
o.pos.xy = pos.xy*g_fPosXY.xy+g_fPosXY.zw;
|
||||
o.pos.z = log(g_fc0.y+dot(g_fZ, z.zyxw))*g_fZNorm.x+g_fZNorm.y;
|
||||
o.pos.w = g_fc0.y; // 1
|
||||
o.color = color;
|
||||
|
||||
DOZWRITE(o.z = z*g_fZBias.x+g_fZBias.y; o.z.w = g_fc0.y;)
|
||||
return o;
|
||||
}
|
||||
|
||||
void RegularPS(VSOUT_ i, out half4 c0 : COLOR0
|
||||
#ifdef WRITE_DEPTH
|
||||
, out float4 c1 : COLOR1
|
||||
#endif
|
||||
)
|
||||
{
|
||||
// whenever outputting depth, make sure to mult by 255/256 and 1
|
||||
c0 = ps2FinalColor(i.color);
|
||||
DOZWRITE(c1 = i.z;)
|
||||
}
|
||||
|
||||
technique Regular {
|
||||
pass p0 {
|
||||
VertexShader = compile vs_3_0 RegularVS();
|
||||
PixelShader = compile ps_3_0 RegularPS();
|
||||
}
|
||||
};
|
||||
|
||||
// diffuse texture mapping
|
||||
VSOUT_T TextureVS(float4 pos : POSITION,
|
||||
half4 color : COLOR0,
|
||||
float3 tex0 : TEXCOORD1,
|
||||
float4 z : TEXCOORD0)
|
||||
{
|
||||
VSOUT_T o;
|
||||
o.pos.xy = pos.xy*g_fPosXY.xy+g_fPosXY.zw;
|
||||
o.pos.z = log(g_fc0.y+dot(g_fZ, z.zyxw))*g_fZNorm.x + g_fZNorm.y;
|
||||
o.pos.w = g_fc0.y;
|
||||
o.color = color;
|
||||
DOZWRITE(o.z = z*g_fZBias.x+g_fZBias.y; o.z.w = g_fc0.y;)
|
||||
#ifdef PERSPECTIVE_CORRECT_TEX
|
||||
o.tex = tex0;
|
||||
#else
|
||||
o.tex = tex0.xy/tex0.z;
|
||||
#endif
|
||||
return o;
|
||||
}
|
||||
|
||||
#ifdef WRITE_DEPTH
|
||||
|
||||
#define DECL_TEXPS(num, bit) \
|
||||
void Texture##num##bit##PS(VSOUT_T i, out half4 c0 : COLOR0, out float4 c1 : COLOR1) \
|
||||
{ \
|
||||
c0 = ps2FinalColor(ps2CalcShade(ps2shade##num##bit(i.tex), i.color)); \
|
||||
c1 = i.z; \
|
||||
} \
|
||||
|
||||
#else
|
||||
|
||||
#define DECL_TEXPS(num, bit) \
|
||||
void Texture##num##bit##PS(VSOUT_T i, out half4 c0 : COLOR0) \
|
||||
{ \
|
||||
c0 = ps2FinalColor(ps2CalcShade(ps2shade##num##bit(i.tex), i.color)); \
|
||||
} \
|
||||
|
||||
#endif
|
||||
|
||||
#define DECL_TEXPS_(num) \
|
||||
DECL_TEXPS(num, _32); \
|
||||
DECL_TEXPS(num, _tex32); \
|
||||
DECL_TEXPS(num, _clut32); \
|
||||
DECL_TEXPS(num, _tex32to16); \
|
||||
DECL_TEXPS(num, _tex16to8h); \
|
||||
|
||||
DECL_TEXPS_(0);
|
||||
DECL_TEXPS_(1);
|
||||
DECL_TEXPS_(2);
|
||||
DECL_TEXPS_(3);
|
||||
DECL_TEXPS_(4);
|
||||
DECL_TEXPS_(5);
|
||||
|
||||
// special functions for limitations on ps20
|
||||
technique Texture {
|
||||
pass p0 {
|
||||
VertexShader = compile vs_2_0 TextureVS();
|
||||
PixelShader = compile ps_2_a Texture0_32PS();
|
||||
}
|
||||
}
|
||||
|
||||
VSOUT_F RegularFogVS(float4 pos : POSITION,
|
||||
half4 color : COLOR0,
|
||||
float4 z : TEXCOORD0)
|
||||
{
|
||||
VSOUT_F o;
|
||||
|
||||
o.pos.xy = pos.xy*g_fPosXY.xy+g_fPosXY.zw;
|
||||
o.pos.z = log(g_fc0.y+dot(g_fZ, z.zyxw))*g_fZNorm.x+g_fZNorm.y;
|
||||
o.pos.w = g_fc0.y;
|
||||
DOZWRITE(o.z = z*g_fZBias.x+g_fZBias.y; o.z.w = g_fc0.y;)
|
||||
o.color = color;
|
||||
o.fog = pos.z;
|
||||
return o;
|
||||
}
|
||||
|
||||
void RegularFogPS(VSOUT_F i, out half4 c0 : COLOR0
|
||||
#ifdef WRITE_DEPTH
|
||||
, out float4 c1 : COLOR1
|
||||
#endif
|
||||
)
|
||||
{
|
||||
half4 c;
|
||||
c.xyz = lerp(g_fFogColor.xyz, i.color.xyz, i.fog); \
|
||||
c.w = i.color.w;
|
||||
c0 = ps2FinalColor(c);
|
||||
DOZWRITE(c1 = i.z;)
|
||||
}
|
||||
|
||||
technique RegularFog {
|
||||
pass p0 {
|
||||
VertexShader = compile vs_2_0 RegularFogVS();
|
||||
PixelShader = compile ps_2_a RegularFogPS();
|
||||
}
|
||||
};
|
||||
|
||||
VSOUT_TF TextureFogVS(float4 pos : POSITION,
|
||||
half4 color : COLOR0,
|
||||
float3 tex0 : TEXCOORD1,
|
||||
float4 z : TEXCOORD0)
|
||||
{
|
||||
VSOUT_TF o;
|
||||
|
||||
o.pos.xy = pos.xy*g_fPosXY.xy+g_fPosXY.zw;
|
||||
o.pos.z = log(g_fc0.y+dot(g_fZ, z.zyxw))*g_fZNorm.x+g_fZNorm.y;
|
||||
o.pos.w = g_fc0.y;
|
||||
o.color = color;
|
||||
o.fog = pos.z;
|
||||
DOZWRITE(o.z = z*g_fZBias.x+g_fZBias.y; o.z.w = g_fc0.y;)
|
||||
#ifdef PERSPECTIVE_CORRECT_TEX
|
||||
o.tex = tex0;
|
||||
#else
|
||||
o.tex = tex0.xy/tex0.z;
|
||||
#endif
|
||||
return o;
|
||||
}
|
||||
|
||||
#ifdef WRITE_DEPTH
|
||||
|
||||
#define DECL_TEXFOGPS(num, bit) \
|
||||
void TextureFog##num##bit##PS(VSOUT_TF i, out half4 c0 : COLOR0, out float4 c1 : COLOR1 ) \
|
||||
{ \
|
||||
half4 c = ps2CalcShade(ps2shade##num##bit(i.tex), i.color); \
|
||||
c.xyz = lerp(g_fFogColor.xyz, c.xyz, i.fog); \
|
||||
c0 = ps2FinalColor(c); \
|
||||
c1 = i.z; \
|
||||
} \
|
||||
|
||||
#else
|
||||
|
||||
#define DECL_TEXFOGPS(num, bit) \
|
||||
void TextureFog##num##bit##PS(VSOUT_TF i, out half4 c0 : COLOR0) \
|
||||
{ \
|
||||
half4 c = ps2CalcShade(ps2shade##num##bit(i.tex), i.color); \
|
||||
c.xyz = lerp(g_fFogColor.xyz, c.xyz, i.fog); \
|
||||
c0 = ps2FinalColor(c); \
|
||||
} \
|
||||
|
||||
#endif
|
||||
|
||||
#define DECL_TEXFOGPS_(num) \
|
||||
DECL_TEXFOGPS(num, _32); \
|
||||
DECL_TEXFOGPS(num, _tex32); \
|
||||
DECL_TEXFOGPS(num, _clut32); \
|
||||
DECL_TEXFOGPS(num, _tex32to16); \
|
||||
DECL_TEXFOGPS(num, _tex16to8h); \
|
||||
|
||||
DECL_TEXFOGPS_(0);
|
||||
DECL_TEXFOGPS_(1);
|
||||
DECL_TEXFOGPS_(2);
|
||||
DECL_TEXFOGPS_(3);
|
||||
DECL_TEXFOGPS_(4);
|
||||
DECL_TEXFOGPS_(5);
|
||||
|
||||
technique TextureFog {
|
||||
pass p0 {
|
||||
VertexShader = compile vs_2_0 TextureFogVS();
|
||||
PixelShader = compile ps_2_a TextureFog0_32PS();
|
||||
}
|
||||
};
|
||||
|
||||
//-------------------------------------------------------
|
||||
// Techniques not related to the main primitive commands
|
||||
half4 BilinearBitBlt(float2 tex0)
|
||||
{
|
||||
float4 ftex;
|
||||
float2 ffrac;
|
||||
|
||||
ffrac.xy = frac(tex0*g_fRealTexDims.xy);
|
||||
ftex.xy = tex0 - ffrac.xy * g_fRealTexDims.zw;
|
||||
ftex.zw = ftex.xy + g_fRealTexDims.zw;
|
||||
|
||||
float4 off0, off1;
|
||||
ps2memcoord4_fast(ftex, off0, off1);
|
||||
half4 c0 = tex2D(g_sMemory, off0.xy);
|
||||
half4 c1 = tex2D(g_sMemory, off0.zw);
|
||||
half4 c2 = tex2D(g_sMemory, off1.xy);
|
||||
half4 c3 = tex2D(g_sMemory, off1.zw);
|
||||
|
||||
return lerp( lerp(c0, c1, ffrac.x), lerp(c2, c3, ffrac.x), ffrac.y );
|
||||
}
|
||||
|
||||
void BitBltVS(in float4 pos : POSITION,
|
||||
in half4 tex0 : TEXCOORD0,
|
||||
in float3 tex : TEXCOORD1,
|
||||
out float4 opos : POSITION,
|
||||
out float2 otex0 : TEXCOORD0,
|
||||
out float2 ointerpos : TEXCOORD1)
|
||||
{
|
||||
opos.xy = pos.xy * g_fBitBltPos.xy + g_fBitBltPos.zw;
|
||||
ointerpos = opos.xy * g_fBitBltTrans.xy + g_fBitBltTrans.zw;
|
||||
opos.zw = g_fc0.xy;
|
||||
otex0 = tex * g_fBitBltTex.xy + g_fBitBltTex.zw;
|
||||
}
|
||||
|
||||
half4 BitBltPS(in float2 tex0 : TEXCOORD0) : COLOR
|
||||
{
|
||||
return tex2D(g_sMemory, ps2memcoord(tex0).xy)*g_fOneColor.xxxy;
|
||||
}
|
||||
|
||||
// used when AA
|
||||
half4 BitBltAAPS(in float2 tex0 : TEXCOORD0) : COLOR
|
||||
{
|
||||
return BilinearBitBlt(tex0)*g_fOneColor.xxxy;
|
||||
}
|
||||
|
||||
void BitBltDepthPS(in float2 tex0 : TEXCOORD0,
|
||||
out float4 c : COLOR0,
|
||||
out float depth : DEPTH)
|
||||
{
|
||||
c = tex2D(g_sMemory, ps2memcoord(tex0));
|
||||
|
||||
depth = log(g_fc0.y+dot(c, g_fBitBltZ))*g_fOneColor.w;
|
||||
c += g_fZBias.y;
|
||||
}
|
||||
|
||||
void BitBltDepthMRTPS(in float2 tex0 : TEXCOORD0,
|
||||
out half4 c0 : COLOR0,
|
||||
out float4 c1 : COLOR1,
|
||||
out float depth : DEPTH)
|
||||
{
|
||||
c1 = tex2D(g_sMemory, ps2memcoord(tex0));
|
||||
|
||||
depth = log(g_fc0.y+dot(c1, g_fBitBltZ))*g_fOneColor.w;
|
||||
c1 += g_fZBias.y;
|
||||
c0 = g_fc0.x;
|
||||
}
|
||||
|
||||
// no swizzling
|
||||
void BitBltDepthTexPS(in float2 tex0 : TEXCOORD0,
|
||||
out float4 c : COLOR0,
|
||||
out float depth : DEPTH)
|
||||
{
|
||||
c = tex2D(g_sSrcFinal, tex0);
|
||||
|
||||
depth = log(g_fc0.y+dot(c-g_fZBias.y, g_fBitBltZ))*g_fOneColor.w;
|
||||
//c += g_fZBias.y;
|
||||
}
|
||||
|
||||
// no swizzling
|
||||
void BitBltDepthTexMRTPS(in float2 tex0 : TEXCOORD0,
|
||||
out half4 c0 : COLOR0,
|
||||
out float4 c1 : COLOR1,
|
||||
out float depth : DEPTH)
|
||||
{
|
||||
c1 = tex2D(g_sSrcFinal, tex0);
|
||||
|
||||
depth = log(g_fc0.y+dot(c1-g_fZBias.y, g_fBitBltZ))*g_fOneColor.w;
|
||||
//c1 += g_fZBias.y;
|
||||
c0 = g_fc0.x;
|
||||
}
|
||||
|
||||
technique BitBlt {
|
||||
pass p0 {
|
||||
VertexShader = compile vs_1_1 BitBltVS();
|
||||
PixelShader = compile ps_2_0 BitBltDepthMRTPS();
|
||||
}
|
||||
}
|
||||
|
||||
/*static const float BlurKernel[9] = {
|
||||
0.027601,
|
||||
0.066213,
|
||||
0.123701,
|
||||
0.179952,
|
||||
0.205065,
|
||||
0.179952,
|
||||
0.123701,
|
||||
0.066213,
|
||||
0.027601
|
||||
};*/
|
||||
|
||||
half4 BilinearFloat16(float2 tex0)
|
||||
{
|
||||
/*float4 ffrac, ftex;
|
||||
ffrac.xy = frac(tex0);
|
||||
ftex.xy = (tex0 - ffrac.xy) * g_fInvTexDims.xy + g_fInvTexDims.zw;
|
||||
ftex.zw = ftex.xy + g_fInvTexDims.xy;
|
||||
|
||||
half4 c0 = tex2D(g_sSrcFinal, ftex.xy);
|
||||
half4 c1 = tex2D(g_sSrcFinal, ftex.zy);
|
||||
half4 c2 = tex2D(g_sSrcFinal, ftex.xw);
|
||||
half4 c3 = tex2D(g_sSrcFinal, ftex.zw);
|
||||
|
||||
return lerp( lerp(c0, c1, ffrac.x), lerp(c2, c3, ffrac.x), ffrac.y );*/
|
||||
return tex2D(g_sSrcFinal, tex0.xy);
|
||||
// return 0.55f * tex2D(g_sSrcFinal, tex0.xy) +
|
||||
// 0.15f * tex2D(g_sSrcFinal, tex0.xy+g_fInvTexDims.xz) +
|
||||
// 0.15f * tex2D(g_sSrcFinal, tex0.xy+g_fInvTexDims.zy) +
|
||||
// 0.15f * tex2D(g_sSrcFinal, tex0.xy+g_fInvTexDims.xy);
|
||||
}
|
||||
|
||||
half4 CRTCTargInterPS(in float2 tex0 : TEXCOORD0, in float2 ointerpos : TEXCOORD1) : COLOR
|
||||
{
|
||||
float finter = tex1D(g_sBitwiseANDX, ointerpos.y).x;
|
||||
clip(finter * g_fOneColor.z + g_fOneColor.w);
|
||||
|
||||
half4 c = BilinearFloat16(tex0);
|
||||
c.w = g_fc0.w*c.w * g_fOneColor.x + g_fOneColor.y;
|
||||
return c.zyxw;
|
||||
}
|
||||
|
||||
half4 CRTCTargPS(in float2 tex0 : TEXCOORD0) : COLOR
|
||||
{
|
||||
float4 c = BilinearFloat16(tex0);
|
||||
c.w = g_fc0.w*c.w * g_fOneColor.x + g_fOneColor.y;
|
||||
return c.zyxw;
|
||||
}
|
||||
|
||||
half4 CRTCInterPS(in float2 tex0 : TEXCOORD0, in float2 ointerpos : TEXCOORD1) : COLOR
|
||||
{
|
||||
float2 filtcoord = (tex0-frac(tex0))*g_fInvTexDims.xy+g_fInvTexDims.zw;
|
||||
float finter = tex1D(g_sBitwiseANDX, ointerpos.y).x;
|
||||
clip(finter * g_fOneColor.z + g_fOneColor.w);
|
||||
|
||||
half4 c = BilinearBitBlt(filtcoord);
|
||||
c.w = c.w * g_fOneColor.x + g_fOneColor.y;
|
||||
|
||||
return c.zyxw;
|
||||
}
|
||||
|
||||
half4 CRTCPS(in float2 tex0 : TEXCOORD0) : COLOR
|
||||
{
|
||||
float2 filtcoord = (tex0/*-frac(tex0)*/)*g_fInvTexDims.xy+g_fInvTexDims.zw;
|
||||
half4 c = BilinearBitBlt(filtcoord);
|
||||
c.w = c.w * g_fOneColor.x + g_fOneColor.y;
|
||||
|
||||
return c.zyxw;
|
||||
}
|
||||
|
||||
half4 CRTC24InterPS(in float2 tex0 : TEXCOORD0, in float2 ointerpos : TEXCOORD1) : COLOR
|
||||
{
|
||||
float2 filtcoord = (tex0-frac(tex0))*g_fInvTexDims.xy+g_fInvTexDims.zw;
|
||||
float finter = tex1D(g_sBitwiseANDX, ointerpos.y).x;
|
||||
clip(finter * g_fOneColor.z + g_fOneColor.w);
|
||||
|
||||
half4 c = tex2D(g_sMemory, ps2memcoord(filtcoord).xy).x;
|
||||
c.w = c.w * g_fOneColor.x + g_fOneColor.y;
|
||||
|
||||
return c.zyxw;
|
||||
}
|
||||
|
||||
half4 CRTC24PS(in float2 tex0 : TEXCOORD0) : COLOR
|
||||
{
|
||||
float2 filtcoord = (tex0-frac(tex0))*g_fInvTexDims.xy+g_fInvTexDims.zw;
|
||||
half4 c = tex2D(g_sMemory, ps2memcoord(filtcoord).xy).x;
|
||||
c.w = c.w * g_fOneColor.x + g_fOneColor.y;
|
||||
|
||||
return c.zyxw;
|
||||
}
|
||||
|
||||
technique CRTC {
|
||||
pass p0 {
|
||||
VertexShader = compile vs_1_1 BitBltVS();
|
||||
PixelShader = compile ps_2_0 CRTCTargInterPS();
|
||||
}
|
||||
}
|
||||
|
||||
half4 ZeroPS() : COLOR
|
||||
{
|
||||
return g_fOneColor.x;
|
||||
}
|
||||
|
||||
half4 BaseTexturePS(in float2 tex0 : TEXCOORD0) : COLOR
|
||||
{
|
||||
return tex2D(g_sSrcFinal, tex0) * g_fOneColor;
|
||||
}
|
||||
|
||||
// inverse of 32->16bit conversion
|
||||
half4 Convert16to32PS(float2 tex0 : TEXCOORD0) : COLOR
|
||||
{
|
||||
float4 final;
|
||||
float2 ffrac = fmod(tex0+g_fTexDims.zw, g_fTexOffset.xy);
|
||||
tex0.y += g_fTexDims.y * ffrac.y;
|
||||
|
||||
if( ffrac.x > g_fTexOffset.z ) {
|
||||
tex0.x -= g_fTexOffset.z;
|
||||
tex0.y += g_fTexOffset.w;
|
||||
}
|
||||
|
||||
float4 lower = tex2D(g_sSrcFinal, tex0);
|
||||
float4 upper = tex2D(g_sSrcFinal, tex0+g_fPageOffset.xy);
|
||||
|
||||
//return half4(frac(32*tex0.x),frac(7*tex0.y),0,1);
|
||||
final.zy = tex3D(g_sConv32to16, lower.zyx).xy + lower.ww*g_fPageOffset.zw;
|
||||
final.xw = tex3D(g_sConv32to16, upper.zyx).xy + upper.ww*g_fPageOffset.zw;
|
||||
return final;
|
||||
}
|
||||
|
||||
// use when texture is not tiled and converting from 32bit to 16bit
|
||||
// one condition is that the converted texture has to keep the same block configuration
|
||||
// every 16 32bit horz pixels gets converted to 16x2 16bit horz pixels.
|
||||
// the first row is the first 8 pixels, the second row is the last 8 pixels
|
||||
// the last 8 columns are the upper bits
|
||||
half4 Convert32to16PS(float2 tex0 : TEXCOORD0) : COLOR
|
||||
{
|
||||
bool upper = false;
|
||||
float2 ffrac = fmod(tex0+g_fTexDims.zw, g_fTexOffset.xy);
|
||||
//tex0 += g_fTexDims.xy * ffrac;
|
||||
//tex0.y += g_fTexDims.y * ffrac.y;
|
||||
tex0.y += ffrac.y;
|
||||
//tex0.x -= g_fc0.w*ffrac.x;
|
||||
if( ffrac.x > g_fTexOffset.z ) {
|
||||
tex0.x -= g_fTexOffset.z;
|
||||
upper = true;
|
||||
}
|
||||
if( ffrac.y >= g_fTexOffset.w ) {
|
||||
tex0.y -= g_fTexOffset.y;
|
||||
tex0.x += g_fTexOffset.z;
|
||||
}
|
||||
|
||||
//return half4(frac(32*tex0.x),frac(7*tex0.y),0,1);
|
||||
half4 color = tex2D(g_sSrcFinal, tex0)*g_fc0.yyyw;
|
||||
float2 uv = upper ? color.xw : color.zy;
|
||||
return tex2D(g_sConv16to32, uv*g_fPageOffset.xy+g_fPageOffset.zw).zyxw*g_fOneColor;
|
||||
}
|
|
@ -1,33 +0,0 @@
|
|||
// main ps2 memory, each pixel is stored in 32bit color
|
||||
texture g_txMem0;
|
||||
|
||||
sampler g_sMemory : register(s0) = sampler_state {
|
||||
Texture = <g_txMem0>;
|
||||
MipFilter = POINT;
|
||||
MinFilter = POINT;
|
||||
MagFilter = POINT;
|
||||
AddressU = Clamp;
|
||||
AddressV = Clamp;
|
||||
};
|
||||
|
||||
// per context pixel shader constants
|
||||
half4 fTexAlpha2 : register(c2);
|
||||
|
||||
float4 g_fTexOffset : register(c4); // converts the page and block offsets into the mem addr/1024
|
||||
float4 g_fTexDims : register(c6); // mult by tex dims when accessing the block texture
|
||||
float4 g_fTexBlock : register(c8);
|
||||
|
||||
float4 g_fClampExts : register(c10); // if clamping the texture, use (minu, minv, maxu, maxv)
|
||||
float4 TexWrapMode : register(c12); // 0 - repeat/clamp, 1 - region rep (use fRegRepMask)
|
||||
|
||||
float4 g_fRealTexDims : register(c14); // tex dims used for linear filtering (w,h,1/w,1/h)
|
||||
|
||||
// (alpha0, alpha1, 1 if highlight2 and tcc is rgba, 1-y)
|
||||
half4 g_fTestBlack : register(c16); // used for aem bit
|
||||
|
||||
float4 g_fPageOffset : register(c18);
|
||||
|
||||
half4 fTexAlpha : register(c20);
|
||||
|
||||
// vertex shader constants
|
||||
float4 g_fPosXY : register(c2);
|
|
@ -1,32 +0,0 @@
|
|||
texture g_txMem1;
|
||||
|
||||
sampler g_sMemory : register(s1) = sampler_state {
|
||||
Texture = <g_txMem1>;
|
||||
MipFilter = POINT;
|
||||
MinFilter = POINT;
|
||||
MagFilter = POINT;
|
||||
AddressU = Clamp;
|
||||
AddressV = Clamp;
|
||||
};
|
||||
|
||||
// per context pixel shader constants
|
||||
half4 fTexAlpha2 : register(c3);
|
||||
|
||||
float4 g_fTexOffset : register(c5); // converts the page and block offsets into the mem addr/1024
|
||||
float4 g_fTexDims : register(c7); // mult by tex dims when accessing the block texture
|
||||
float4 g_fTexBlock : register(c9);
|
||||
|
||||
float4 g_fClampExts : register(c11); // if clamping the texture, use (minu, minv, maxu, maxv)
|
||||
float4 TexWrapMode : register(c13); // 0 - repeat/clamp, 1 - region rep (use fRegRepMask)
|
||||
|
||||
float4 g_fRealTexDims : register(c15); // tex dims used for linear filtering (w,h,1/w,1/h)
|
||||
|
||||
// (alpha0, alpha1, 1 if highlight2 and tcc is rgba, 1-y)
|
||||
half4 g_fTestBlack : register(c17); // used for aem bit
|
||||
|
||||
float4 g_fPageOffset : register(c19);
|
||||
|
||||
half4 fTexAlpha : register(c21);
|
||||
|
||||
// vertex shader constants
|
||||
float4 g_fPosXY : register(c3);
|
File diff suppressed because it is too large
Load Diff
|
@ -1,232 +0,0 @@
|
|||
#define TARGET_VIRTUAL_KEY 0x80000000
|
||||
|
||||
namespace ZeroGS
|
||||
{
|
||||
// manages render targets
|
||||
class CRenderTargetMngr
|
||||
{
|
||||
public:
|
||||
typedef map<u32, CRenderTarget*> MAPTARGETS;
|
||||
|
||||
enum TargetOptions
|
||||
{
|
||||
TO_DepthBuffer = 1,
|
||||
TO_StrictHeight = 2, // height returned has to be the same as requested
|
||||
TO_Virtual = 4
|
||||
};
|
||||
|
||||
~CRenderTargetMngr() { Destroy(); }
|
||||
|
||||
void Destroy();
|
||||
static MAPTARGETS::iterator GetOldestTarg(MAPTARGETS& m);
|
||||
|
||||
CRenderTarget* GetTarg(const frameInfo& frame, DWORD Options, int maxposheight);
|
||||
inline CRenderTarget* GetTarg(int fbp, int fbw) {
|
||||
MAPTARGETS::iterator it = mapTargets.find(fbp|(fbw<<16));
|
||||
return it != mapTargets.end() ? it->second : NULL;
|
||||
}
|
||||
|
||||
// gets all targets with a range
|
||||
void GetTargs(int start, int end, list<ZeroGS::CRenderTarget*>& listTargets) const;
|
||||
|
||||
virtual void DestroyChildren(CRenderTarget* ptarg);
|
||||
|
||||
// resolves all targets within a range
|
||||
__forceinline void Resolve(int start, int end);
|
||||
__forceinline void ResolveAll() {
|
||||
for(MAPTARGETS::iterator it = mapTargets.begin(); it != mapTargets.end(); ++it )
|
||||
it->second->Resolve();
|
||||
}
|
||||
|
||||
void DestroyTarg(CRenderTarget* ptarg) {
|
||||
for(int i = 0; i < 2; ++i) {
|
||||
if( ptarg == vb[i].prndr ) { vb[i].prndr = NULL; vb[i].bNeedFrameCheck = 1; }
|
||||
if( ptarg == vb[i].pdepth ) { vb[i].pdepth = NULL; vb[i].bNeedZCheck = 1; }
|
||||
}
|
||||
|
||||
DestroyChildren(ptarg);
|
||||
delete ptarg;
|
||||
}
|
||||
|
||||
inline void DestroyAll(int start, int end, int fbw) {
|
||||
for(MAPTARGETS::iterator it = mapTargets.begin(); it != mapTargets.end();) {
|
||||
if( it->second->start < end && start < it->second->end ) {
|
||||
// if is depth, only resolve if fbw is the same
|
||||
if( !it->second->IsDepth() ) {
|
||||
// only resolve if the widths are the same or it->second has bit outside the range
|
||||
// shadow of colossus swaps between fbw=256,fbh=256 and fbw=512,fbh=448. This kills the game if doing || it->second->end > end
|
||||
|
||||
// kh hack, sometimes kh movies do this to clear the target, so have a static count that periodically checks end
|
||||
static int count = 0;
|
||||
|
||||
if( it->second->fbw == fbw || (it->second->fbw != fbw && (it->second->start < start || ((count++&0xf)?0:it->second->end > end) )) )
|
||||
it->second->Resolve();
|
||||
else {
|
||||
if( vb[0].prndr == it->second || vb[0].pdepth == it->second ) Flush(0);
|
||||
if( vb[1].prndr == it->second || vb[1].pdepth == it->second ) Flush(1);
|
||||
|
||||
it->second->status |= CRenderTarget::TS_Resolved;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if( it->second->fbw == fbw )
|
||||
it->second->Resolve();
|
||||
else {
|
||||
if( vb[0].prndr == it->second || vb[0].pdepth == it->second ) Flush(0);
|
||||
if( vb[1].prndr == it->second || vb[1].pdepth == it->second ) Flush(1);
|
||||
|
||||
it->second->status |= CRenderTarget::TS_Resolved;
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 2; ++i) {
|
||||
if( it->second == vb[i].prndr ) { vb[i].prndr = NULL; vb[i].bNeedFrameCheck = 1; }
|
||||
if( it->second == vb[i].pdepth ) { vb[i].pdepth = NULL; vb[i].bNeedZCheck = 1; }
|
||||
}
|
||||
|
||||
u32 dummykey = (it->second->fbw<<16)|it->second->fbh;
|
||||
if( it->second->pmimicparent != NULL && mapDummyTargs.find(dummykey) == mapDummyTargs.end() ) {
|
||||
DestroyChildren(it->second);
|
||||
mapDummyTargs[dummykey] = it->second;
|
||||
}
|
||||
else {
|
||||
DestroyChildren(it->second);
|
||||
delete it->second;
|
||||
}
|
||||
it = mapTargets.erase(it);
|
||||
}
|
||||
else ++it;
|
||||
}
|
||||
}
|
||||
|
||||
inline void DestroyIntersecting(CRenderTarget* prndr)
|
||||
{
|
||||
assert( prndr != NULL );
|
||||
|
||||
int start, end;
|
||||
GetRectMemAddress(start, end, prndr->psm, 0, 0, prndr->fbw, prndr->fbh, prndr->fbp, prndr->fbw);
|
||||
|
||||
for(MAPTARGETS::iterator it = mapTargets.begin(); it != mapTargets.end();) {
|
||||
if( it->second != prndr && it->second->start < end && start < it->second->end ) {
|
||||
it->second->Resolve();
|
||||
|
||||
for(int i = 0; i < 2; ++i) {
|
||||
if( it->second == vb[i].prndr ) { vb[i].prndr = NULL; vb[i].bNeedFrameCheck = 1; }
|
||||
if( it->second == vb[i].pdepth ) { vb[i].pdepth = NULL; vb[i].bNeedZCheck = 1; }
|
||||
}
|
||||
|
||||
u32 dummykey = (it->second->fbw<<16)|it->second->fbh;
|
||||
if( it->second->pmimicparent != NULL && mapDummyTargs.find(dummykey) == mapDummyTargs.end() ) {
|
||||
DestroyChildren(it->second);
|
||||
mapDummyTargs[dummykey] = it->second;
|
||||
}
|
||||
else {
|
||||
DestroyChildren(it->second);
|
||||
delete it->second;
|
||||
}
|
||||
|
||||
it = mapTargets.erase(it);
|
||||
}
|
||||
else ++it;
|
||||
}
|
||||
}
|
||||
|
||||
// promotes a target from virtual to real
|
||||
inline CRenderTarget* Promote(u32 key) {
|
||||
assert( !(key & TARGET_VIRTUAL_KEY) );
|
||||
|
||||
// promote to regular targ
|
||||
CRenderTargetMngr::MAPTARGETS::iterator it = mapTargets.find(key|TARGET_VIRTUAL_KEY);
|
||||
assert( it != mapTargets.end() );
|
||||
|
||||
CRenderTarget* ptarg = it->second;
|
||||
mapTargets.erase(it);
|
||||
|
||||
DestroyIntersecting(ptarg);
|
||||
|
||||
it = mapTargets.find(key);
|
||||
if( it != mapTargets.end() ) {
|
||||
DestroyTarg(it->second);
|
||||
it->second = ptarg;
|
||||
}
|
||||
else
|
||||
mapTargets[key] = ptarg;
|
||||
|
||||
if( g_GameSettings & GAME_RESOLVEPROMOTED )
|
||||
ptarg->status = CRenderTarget::TS_Resolved;
|
||||
else
|
||||
ptarg->status = CRenderTarget::TS_NeedUpdate;
|
||||
return ptarg;
|
||||
}
|
||||
|
||||
MAPTARGETS mapTargets, mapDummyTargs;
|
||||
};
|
||||
|
||||
class CMemoryTargetMngr
|
||||
{
|
||||
public:
|
||||
CMemoryTargetMngr() : curstamp(0) {}
|
||||
CMemoryTarget* GetMemoryTarget(const tex0Info& tex0, int forcevalidate); // pcbp is pointer to start of clut
|
||||
|
||||
void Destroy(); // destroy all targs
|
||||
|
||||
void ClearRange(int starty, int endy); // set all targets to cleared
|
||||
void DestroyCleared(); // flush all cleared targes
|
||||
void DestroyOldest();
|
||||
|
||||
list<CMemoryTarget> listTargets, listClearedTargets;
|
||||
u32 curstamp;
|
||||
|
||||
private:
|
||||
list<CMemoryTarget>::iterator DestroyTargetIter(list<CMemoryTarget>::iterator& it);
|
||||
};
|
||||
|
||||
class CBitwiseTextureMngr
|
||||
{
|
||||
public:
|
||||
~CBitwiseTextureMngr() { Destroy(); }
|
||||
|
||||
void Destroy();
|
||||
|
||||
// since GetTex can delete textures to free up mem, it is dangerous if using that texture, so specify at least one other tex to save
|
||||
__forceinline LPD3DTEX GetTex(u32 bitvalue, LPD3DTEX ptexDoNotDelete) {
|
||||
map<u32, LPD3DTEX>::iterator it = mapTextures.find(bitvalue);
|
||||
if( it != mapTextures.end() )
|
||||
return it->second;
|
||||
return GetTexInt(bitvalue, ptexDoNotDelete);
|
||||
}
|
||||
|
||||
private:
|
||||
LPD3DTEX GetTexInt(u32 bitvalue, LPD3DTEX ptexDoNotDelete);
|
||||
|
||||
map<u32, LPD3DTEX> mapTextures;
|
||||
};
|
||||
|
||||
// manages
|
||||
class CRangeManager
|
||||
{
|
||||
public:
|
||||
CRangeManager()
|
||||
{
|
||||
ranges.reserve(16);
|
||||
}
|
||||
|
||||
// [start, end)
|
||||
struct RANGE
|
||||
{
|
||||
RANGE() {}
|
||||
inline RANGE(int start, int end) : start(start), end(end) {}
|
||||
int start, end;
|
||||
};
|
||||
|
||||
// works in semi logN
|
||||
void Insert(int start, int end);
|
||||
inline void Clear() { ranges.resize(0); }
|
||||
|
||||
vector<RANGE> ranges; // organized in ascending order, non-intersecting
|
||||
};
|
||||
|
||||
extern CRenderTargetMngr s_RTs, s_DepthRTs;
|
||||
extern CBitwiseTextureMngr s_BitwiseTextures;
|
||||
extern CMemoryTargetMngr g_MemTargs;
|
||||
}
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -1,573 +0,0 @@
|
|||
/* ZeroGS KOSMOS
|
||||
* Copyright (C) 2005-2006 Gabest/zerofrog@gmail.com
|
||||
* http://www.gabest.org
|
||||
*
|
||||
* 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, 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
#include <d3dx9.h>
|
||||
|
||||
#include "GS.h"
|
||||
#include "Mem.h"
|
||||
#include "x86.h"
|
||||
|
||||
#if defined(ZEROGS_SSE2) && (defined(_WIN32)||defined(__x86_64__))
|
||||
#include <xmmintrin.h>
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
|
||||
// swizzling
|
||||
|
||||
void FASTCALL(SwizzleBlock32_c(u8* dst, u8* src, int srcpitch, u32 WriteMask))
|
||||
{
|
||||
u32* d = &g_columnTable32[0][0];
|
||||
|
||||
if(WriteMask == 0xffffffff)
|
||||
{
|
||||
for(int j = 0; j < 8; j++, d += 8, src += srcpitch)
|
||||
for(int i = 0; i < 8; i++)
|
||||
((u32*)dst)[d[i]] = ((u32*)src)[i];
|
||||
}
|
||||
else
|
||||
{
|
||||
for(int j = 0; j < 8; j++, d += 8, src += srcpitch)
|
||||
for(int i = 0; i < 8; i++)
|
||||
((u32*)dst)[d[i]] = (((u32*)dst)[d[i]] & ~WriteMask) | (((u32*)src)[i] & WriteMask);
|
||||
}
|
||||
}
|
||||
|
||||
void FASTCALL(SwizzleBlock16_c(u8* dst, u8* src, int srcpitch))
|
||||
{
|
||||
u32* d = &g_columnTable16[0][0];
|
||||
|
||||
for(int j = 0; j < 8; j++, d += 16, src += srcpitch)
|
||||
for(int i = 0; i < 16; i++)
|
||||
((u16*)dst)[d[i]] = ((u16*)src)[i];
|
||||
}
|
||||
|
||||
void FASTCALL(SwizzleBlock8_c(u8* dst, u8* src, int srcpitch))
|
||||
{
|
||||
u32* d = &g_columnTable8[0][0];
|
||||
|
||||
for(int j = 0; j < 16; j++, d += 16, src += srcpitch)
|
||||
for(int i = 0; i < 16; i++)
|
||||
dst[d[i]] = src[i];
|
||||
}
|
||||
|
||||
void FASTCALL(SwizzleBlock4_c(u8* dst, u8* src, int srcpitch))
|
||||
{
|
||||
u32* d = &g_columnTable4[0][0];
|
||||
|
||||
for(int j = 0; j < 16; j++, d += 32, src += srcpitch)
|
||||
{
|
||||
for(int i = 0; i < 32; i++)
|
||||
{
|
||||
u32 addr = d[i];
|
||||
u8 c = (src[i>>1] >> ((i&1) << 2)) & 0x0f;
|
||||
u32 shift = (addr&1) << 2;
|
||||
dst[addr >> 1] = (dst[addr >> 1] & (0xf0 >> shift)) | (c << shift);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#define _FrameSwizzleBlock(type, transfer, transfer16, incsrc) \
|
||||
/* FrameSwizzleBlock32 */ \
|
||||
void FASTCALL(FrameSwizzleBlock32##type##c(u32* dst, u32* src, int srcpitch, u32 WriteMask)) \
|
||||
{ \
|
||||
u32* d = &g_columnTable32[0][0]; \
|
||||
\
|
||||
if( WriteMask == 0xffffffff ) { \
|
||||
for(int i = 0; i < 8; ++i, d += 8) { \
|
||||
for(int j = 0; j < 8; ++j) { \
|
||||
dst[d[j]] = (transfer); \
|
||||
} \
|
||||
src += srcpitch << incsrc; \
|
||||
} \
|
||||
} \
|
||||
else { \
|
||||
for(int i = 0; i < 8; ++i, d += 8) { \
|
||||
for(int j = 0; j < 8; ++j) { \
|
||||
dst[d[j]] = ((transfer)&WriteMask)|(dst[d[j]]&~WriteMask); \
|
||||
} \
|
||||
src += srcpitch << incsrc; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
/* FrameSwizzleBlock16 */ \
|
||||
void FASTCALL(FrameSwizzleBlock16##type##c(u16* dst, u32* src, int srcpitch, u32 WriteMask)) \
|
||||
{ \
|
||||
u32* d = &g_columnTable16[0][0]; \
|
||||
\
|
||||
if( WriteMask == 0xffff ) { \
|
||||
for(int i = 0; i < 8; ++i, d += 16) { \
|
||||
for(int j = 0; j < 16; ++j) { \
|
||||
u32 temp = (transfer); \
|
||||
dst[d[j]] = RGBA32to16(temp); \
|
||||
} \
|
||||
src += srcpitch << incsrc; \
|
||||
} \
|
||||
} \
|
||||
else { \
|
||||
for(int i = 0; i < 8; ++i, d += 16) { \
|
||||
for(int j = 0; j < 16; ++j) { \
|
||||
u32 temp = (transfer); \
|
||||
u32 dsrc = RGBA32to16(temp); \
|
||||
dst[d[j]] = (dsrc&WriteMask)|(dst[d[j]]&~WriteMask); \
|
||||
} \
|
||||
src += srcpitch << incsrc; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
/* Frame16SwizzleBlock32 */ \
|
||||
void FASTCALL(Frame16SwizzleBlock32##type##c(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask)) \
|
||||
{ \
|
||||
u32* d = &g_columnTable32[0][0]; \
|
||||
\
|
||||
if( WriteMask == 0xffffffff ) { \
|
||||
for(int i = 0; i < 8; ++i, d += 8) { \
|
||||
for(int j = 0; j < 8; ++j) { \
|
||||
Vector_16F dsrc16 = (transfer16); \
|
||||
dst[d[j]] = Float16ToARGB(dsrc16); \
|
||||
} \
|
||||
src += srcpitch << incsrc; \
|
||||
} \
|
||||
} \
|
||||
else { \
|
||||
for(int i = 0; i < 8; ++i, d += 8) { \
|
||||
for(int j = 0; j < 8; ++j) { \
|
||||
Vector_16F dsrc16 = (transfer16); \
|
||||
u32 dsrc = Float16ToARGB(dsrc16); \
|
||||
dst[d[j]] = (dsrc&WriteMask)|(dst[d[j]]&~WriteMask); \
|
||||
} \
|
||||
src += srcpitch << incsrc; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
/* Frame16SwizzleBlock32Z */ \
|
||||
void FASTCALL(Frame16SwizzleBlock32Z##type##c(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask)) \
|
||||
{ \
|
||||
u32* d = &g_columnTable32[0][0]; \
|
||||
if( WriteMask == 0xffffffff ) { /* breaks KH text if not checked */ \
|
||||
for(int i = 0; i < 8; ++i, d += 8) { \
|
||||
for(int j = 0; j < 8; ++j) { \
|
||||
Vector_16F dsrc16 = (transfer16); \
|
||||
dst[d[j]] = Float16ToARGB_Z(dsrc16); \
|
||||
} \
|
||||
src += srcpitch << incsrc; \
|
||||
} \
|
||||
} \
|
||||
else { \
|
||||
for(int i = 0; i < 8; ++i, d += 8) { \
|
||||
for(int j = 0; j < 8; ++j) { \
|
||||
Vector_16F dsrc16 = (transfer16); \
|
||||
u32 dsrc = Float16ToARGB_Z(dsrc16); \
|
||||
dst[d[j]] = (dsrc&WriteMask)|(dst[d[j]]&~WriteMask); \
|
||||
} \
|
||||
src += srcpitch << incsrc; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
/* Frame16SwizzleBlock16 */ \
|
||||
void FASTCALL(Frame16SwizzleBlock16##type##c(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask)) \
|
||||
{ \
|
||||
u32* d = &g_columnTable16[0][0]; \
|
||||
\
|
||||
if( (WriteMask&0xfff8f8f8) == 0xfff8f8f8) { \
|
||||
for(int i = 0; i < 8; ++i, d += 16) { \
|
||||
for(int j = 0; j < 16; ++j) { \
|
||||
Vector_16F dsrc16 = (transfer16); \
|
||||
dst[d[j]] = Float16ToARGB16(dsrc16); \
|
||||
} \
|
||||
src += srcpitch << incsrc; \
|
||||
} \
|
||||
} \
|
||||
else { \
|
||||
for(int i = 0; i < 8; ++i, d += 16) { \
|
||||
for(int j = 0; j < 16; ++j) { \
|
||||
Vector_16F dsrc16 = (transfer16); \
|
||||
u32 dsrc = Float16ToARGB16(dsrc16); \
|
||||
dst[d[j]] = (dsrc&WriteMask)|(dst[d[j]]&~WriteMask); \
|
||||
} \
|
||||
src += srcpitch << incsrc; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
/* Frame16SwizzleBlock16Z */ \
|
||||
void FASTCALL(Frame16SwizzleBlock16Z##type##c(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask)) \
|
||||
{ \
|
||||
u32* d = &g_columnTable16[0][0]; \
|
||||
\
|
||||
for(int i = 0; i < 8; ++i, d += 16) { \
|
||||
for(int j = 0; j < 16; ++j) { \
|
||||
Vector_16F dsrc16 = (transfer16); \
|
||||
dst[d[j]] = Float16ToARGB16_Z(dsrc16); \
|
||||
} \
|
||||
src += srcpitch << incsrc; \
|
||||
} \
|
||||
} \
|
||||
|
||||
_FrameSwizzleBlock(_, src[j], src[j], 0);
|
||||
_FrameSwizzleBlock(A2_, (src[2*j]+src[2*j+1])>>1, src[2*j], 0);
|
||||
_FrameSwizzleBlock(A4_, (src[2*j]+src[2*j+1]+src[2*j+srcpitch]+src[2*j+srcpitch+1])>>2, src[2*j], 1);
|
||||
|
||||
#ifdef ZEROGS_SSE2
|
||||
|
||||
//void FASTCALL(WriteCLUT_T16_I8_CSM1_sse2(u32* vm, u32* clut)
|
||||
//{
|
||||
// __asm {
|
||||
// mov eax, vm
|
||||
// mov ecx, clut
|
||||
// mov edx, 8
|
||||
// }
|
||||
//
|
||||
//Extract32x2:
|
||||
// __asm {
|
||||
// movdqa xmm0, qword ptr [eax]
|
||||
// movdqa xmm1, qword ptr [eax+16]
|
||||
// movdqa xmm2, qword ptr [eax+32]
|
||||
// movdqa xmm3, qword ptr [eax+48]
|
||||
//
|
||||
// // rearrange
|
||||
// pshuflw xmm0, xmm0, 0xd8
|
||||
// pshufhw xmm0, xmm0, 0xd8
|
||||
// pshuflw xmm1, xmm1, 0xd8
|
||||
// pshufhw xmm1, xmm1, 0xd8
|
||||
// pshuflw xmm2, xmm2, 0xd8
|
||||
// pshufhw xmm2, xmm2, 0xd8
|
||||
// pshuflw xmm3, xmm3, 0xd8
|
||||
// pshufhw xmm3, xmm3, 0xd8
|
||||
//
|
||||
// movdqa xmm4, xmm0
|
||||
// movdqa xmm6, xmm2
|
||||
//
|
||||
// shufps xmm0, xmm1, 0x88
|
||||
// shufps xmm2, xmm3, 0x88
|
||||
//
|
||||
// shufps xmm4, xmm1, 0xdd
|
||||
// shufps xmm6, xmm3, 0xdd
|
||||
//
|
||||
// pshufd xmm0, xmm0, 0xd8
|
||||
// pshufd xmm2, xmm2, 0xd8
|
||||
// pshufd xmm4, xmm4, 0xd8
|
||||
// pshufd xmm6, xmm6, 0xd8
|
||||
//
|
||||
// // left column
|
||||
// movhlps xmm1, xmm0
|
||||
// movlhps xmm0, xmm2
|
||||
// //movdqa xmm7, [ecx]
|
||||
//
|
||||
// movdqa [ecx], xmm0
|
||||
// shufps xmm1, xmm2, 0xe4
|
||||
// movdqa [ecx+16], xmm1
|
||||
//
|
||||
// // right column
|
||||
// movhlps xmm3, xmm4
|
||||
// movlhps xmm4, xmm6
|
||||
// movdqa [ecx+32], xmm4
|
||||
// shufps xmm3, xmm6, 0xe4
|
||||
// movdqa [ecx+48], xmm3
|
||||
//
|
||||
// add eax, 16*4
|
||||
// add ecx, 16*8
|
||||
// sub edx, 1
|
||||
// cmp edx, 0
|
||||
// jne Extract32x2
|
||||
// }
|
||||
//}
|
||||
|
||||
#if (defined(_WIN32)||defined(__x86_64__))
|
||||
|
||||
extern "C" void FASTCALL(WriteCLUT_T32_I8_CSM1_sse2(u32* vm, u32* clut))
|
||||
{
|
||||
__m128i* src = (__m128i*)vm;
|
||||
__m128i* dst = (__m128i*)clut;
|
||||
|
||||
for(int j = 0; j < 64; j += 32, src += 32, dst += 32)
|
||||
{
|
||||
for(int i = 0; i < 16; i += 4)
|
||||
{
|
||||
__m128i r0 = _mm_load_si128(&src[i+0]);
|
||||
__m128i r1 = _mm_load_si128(&src[i+1]);
|
||||
__m128i r2 = _mm_load_si128(&src[i+2]);
|
||||
__m128i r3 = _mm_load_si128(&src[i+3]);
|
||||
|
||||
_mm_store_si128(&dst[i*2+0], _mm_unpacklo_epi64(r0, r1));
|
||||
_mm_store_si128(&dst[i*2+1], _mm_unpacklo_epi64(r2, r3));
|
||||
_mm_store_si128(&dst[i*2+2], _mm_unpackhi_epi64(r0, r1));
|
||||
_mm_store_si128(&dst[i*2+3], _mm_unpackhi_epi64(r2, r3));
|
||||
|
||||
__m128i r4 = _mm_load_si128(&src[i+0+16]);
|
||||
__m128i r5 = _mm_load_si128(&src[i+1+16]);
|
||||
__m128i r6 = _mm_load_si128(&src[i+2+16]);
|
||||
__m128i r7 = _mm_load_si128(&src[i+3+16]);
|
||||
|
||||
_mm_store_si128(&dst[i*2+4], _mm_unpacklo_epi64(r4, r5));
|
||||
_mm_store_si128(&dst[i*2+5], _mm_unpacklo_epi64(r6, r7));
|
||||
_mm_store_si128(&dst[i*2+6], _mm_unpackhi_epi64(r4, r5));
|
||||
_mm_store_si128(&dst[i*2+7], _mm_unpackhi_epi64(r6, r7));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
extern "C" void FASTCALL(WriteCLUT_T32_I4_CSM1_sse2(u32* vm, u32* clut))
|
||||
{
|
||||
__m128i* src = (__m128i*)vm;
|
||||
__m128i* dst = (__m128i*)clut;
|
||||
|
||||
__m128i r0 = _mm_load_si128(&src[0]);
|
||||
__m128i r1 = _mm_load_si128(&src[1]);
|
||||
__m128i r2 = _mm_load_si128(&src[2]);
|
||||
__m128i r3 = _mm_load_si128(&src[3]);
|
||||
|
||||
_mm_store_si128(&dst[0], _mm_unpacklo_epi64(r0, r1));
|
||||
_mm_store_si128(&dst[1], _mm_unpacklo_epi64(r2, r3));
|
||||
_mm_store_si128(&dst[2], _mm_unpackhi_epi64(r0, r1));
|
||||
_mm_store_si128(&dst[3], _mm_unpackhi_epi64(r2, r3));
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
extern "C" {
|
||||
__aligned16 int s_clut16mask2[4] = { 0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff };
|
||||
__aligned16 int s_clut16mask[8] = { 0xffff0000, 0xffff0000, 0xffff0000, 0xffff0000,
|
||||
0x0000ffff, 0x0000ffff, 0x0000ffff, 0x0000ffff};
|
||||
}
|
||||
|
||||
#if !defined(__x86_64__)
|
||||
|
||||
extern "C" void FASTCALL(WriteCLUT_T16_I4_CSM1_sse2(u32* vm, u32* clut))
|
||||
{
|
||||
__asm {
|
||||
mov eax, vm
|
||||
mov ecx, clut
|
||||
movdqa xmm0, qword ptr [eax]
|
||||
movdqa xmm1, qword ptr [eax+16]
|
||||
movdqa xmm2, qword ptr [eax+32]
|
||||
movdqa xmm3, qword ptr [eax+48]
|
||||
|
||||
// rearrange
|
||||
pshuflw xmm0, xmm0, 0x88
|
||||
pshufhw xmm0, xmm0, 0x88
|
||||
pshuflw xmm1, xmm1, 0x88
|
||||
pshufhw xmm1, xmm1, 0x88
|
||||
pshuflw xmm2, xmm2, 0x88
|
||||
pshufhw xmm2, xmm2, 0x88
|
||||
pshuflw xmm3, xmm3, 0x88
|
||||
pshufhw xmm3, xmm3, 0x88
|
||||
|
||||
shufps xmm0, xmm1, 0x88
|
||||
shufps xmm2, xmm3, 0x88
|
||||
|
||||
pshufd xmm0, xmm0, 0xd8
|
||||
pshufd xmm2, xmm2, 0xd8
|
||||
|
||||
pxor xmm6, xmm6
|
||||
|
||||
test ecx, 15
|
||||
jnz WriteUnaligned
|
||||
|
||||
movdqa xmm7, s_clut16mask // saves upper 16 bits
|
||||
|
||||
// have to save interlaced with the old data
|
||||
movdqa xmm4, [ecx]
|
||||
movdqa xmm5, [ecx+32]
|
||||
movhlps xmm1, xmm0
|
||||
movlhps xmm0, xmm2 // lower 8 colors
|
||||
|
||||
pand xmm4, xmm7
|
||||
pand xmm5, xmm7
|
||||
|
||||
shufps xmm1, xmm2, 0xe4 // upper 8 colors
|
||||
movdqa xmm2, xmm0
|
||||
movdqa xmm3, xmm1
|
||||
|
||||
punpcklwd xmm0, xmm6
|
||||
punpcklwd xmm1, xmm6
|
||||
por xmm0, xmm4
|
||||
por xmm1, xmm5
|
||||
|
||||
punpckhwd xmm2, xmm6
|
||||
punpckhwd xmm3, xmm6
|
||||
|
||||
movdqa [ecx], xmm0
|
||||
movdqa [ecx+32], xmm1
|
||||
|
||||
movdqa xmm5, xmm7
|
||||
pand xmm7, [ecx+16]
|
||||
pand xmm5, [ecx+48]
|
||||
|
||||
por xmm2, xmm7
|
||||
por xmm3, xmm5
|
||||
|
||||
movdqa [ecx+16], xmm2
|
||||
movdqa [ecx+48], xmm3
|
||||
jmp End
|
||||
|
||||
WriteUnaligned:
|
||||
// ecx is offset by 2
|
||||
sub ecx, 2
|
||||
|
||||
movdqa xmm7, s_clut16mask2 // saves lower 16 bits
|
||||
|
||||
// have to save interlaced with the old data
|
||||
movdqa xmm4, [ecx]
|
||||
movdqa xmm5, [ecx+32]
|
||||
movhlps xmm1, xmm0
|
||||
movlhps xmm0, xmm2 // lower 8 colors
|
||||
|
||||
pand xmm4, xmm7
|
||||
pand xmm5, xmm7
|
||||
|
||||
shufps xmm1, xmm2, 0xe4 // upper 8 colors
|
||||
movdqa xmm2, xmm0
|
||||
movdqa xmm3, xmm1
|
||||
|
||||
punpcklwd xmm0, xmm6
|
||||
punpcklwd xmm1, xmm6
|
||||
pslld xmm0, 16
|
||||
pslld xmm1, 16
|
||||
por xmm0, xmm4
|
||||
por xmm1, xmm5
|
||||
|
||||
punpckhwd xmm2, xmm6
|
||||
punpckhwd xmm3, xmm6
|
||||
pslld xmm2, 16
|
||||
pslld xmm3, 16
|
||||
|
||||
movdqa [ecx], xmm0
|
||||
movdqa [ecx+32], xmm1
|
||||
|
||||
movdqa xmm5, xmm7
|
||||
pand xmm7, [ecx+16]
|
||||
pand xmm5, [ecx+48]
|
||||
|
||||
por xmm2, xmm7
|
||||
por xmm3, xmm5
|
||||
|
||||
movdqa [ecx+16], xmm2
|
||||
movdqa [ecx+48], xmm3
|
||||
End:
|
||||
}
|
||||
}
|
||||
#endif // __x86_64__
|
||||
#endif // _MSC_VER
|
||||
|
||||
#endif // ZEROGS_SSE2
|
||||
|
||||
void FASTCALL(WriteCLUT_T16_I8_CSM1_c(u32* _vm, u32* _clut))
|
||||
{
|
||||
const static u32 map[] =
|
||||
{
|
||||
0, 2, 8, 10, 16, 18, 24, 26,
|
||||
4, 6, 12, 14, 20, 22, 28, 30,
|
||||
1, 3, 9, 11, 17, 19, 25, 27,
|
||||
5, 7, 13, 15, 21, 23, 29, 31
|
||||
};
|
||||
|
||||
u16* vm = (u16*)_vm;
|
||||
u16* clut = (u16*)_clut;
|
||||
|
||||
int left = ((u32)(uptr)clut&2) ? 512 : 512-(((u32)(uptr)clut)&0x3ff)/2;
|
||||
|
||||
for(int j = 0; j < 8; j++, vm += 32, clut += 64, left -= 32)
|
||||
{
|
||||
if(left == 32) {
|
||||
assert( left == 32 );
|
||||
for(int i = 0; i < 16; i++)
|
||||
clut[2*i] = vm[map[i]];
|
||||
|
||||
clut = (u16*)((uptr)clut & ~0x3ff) + 1;
|
||||
|
||||
for(int i = 16; i < 32; i++)
|
||||
clut[2*i] = vm[map[i]];
|
||||
}
|
||||
else {
|
||||
if( left == 0 ) {
|
||||
clut = (u16*)((uptr)clut & ~0x3ff) + 1;
|
||||
left = -1;
|
||||
}
|
||||
|
||||
for(int i = 0; i < 32; i++)
|
||||
clut[2*i] = vm[map[i]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FASTCALL(WriteCLUT_T32_I8_CSM1_c(u32* vm, u32* clut))
|
||||
{
|
||||
u64* src = (u64*)vm;
|
||||
u64* dst = (u64*)clut;
|
||||
|
||||
for(int j = 0; j < 2; j++, src += 32) {
|
||||
for(int i = 0; i < 4; i++, dst+=16, src+=8)
|
||||
{
|
||||
dst[0] = src[0];
|
||||
dst[1] = src[2];
|
||||
dst[2] = src[4];
|
||||
dst[3] = src[6];
|
||||
dst[4] = src[1];
|
||||
dst[5] = src[3];
|
||||
dst[6] = src[5];
|
||||
dst[7] = src[7];
|
||||
|
||||
dst[8] = src[32];
|
||||
dst[9] = src[32+2];
|
||||
dst[10] = src[32+4];
|
||||
dst[11] = src[32+6];
|
||||
dst[12] = src[32+1];
|
||||
dst[13] = src[32+3];
|
||||
dst[14] = src[32+5];
|
||||
dst[15] = src[32+7];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void FASTCALL(WriteCLUT_T16_I4_CSM1_c(u32* _vm, u32* _clut))
|
||||
{
|
||||
u16* dst = (u16*)_clut;
|
||||
u16* src = (u16*)_vm;
|
||||
|
||||
dst[0] = src[0]; dst[2] = src[2];
|
||||
dst[4] = src[8]; dst[6] = src[10];
|
||||
dst[8] = src[16]; dst[10] = src[18];
|
||||
dst[12] = src[24]; dst[14] = src[26];
|
||||
dst[16] = src[4]; dst[18] = src[6];
|
||||
dst[20] = src[12]; dst[22] = src[14];
|
||||
dst[24] = src[20]; dst[26] = src[22];
|
||||
dst[28] = src[28]; dst[30] = src[30];
|
||||
}
|
||||
|
||||
void FASTCALL(WriteCLUT_T32_I4_CSM1_c(u32* vm, u32* clut))
|
||||
{
|
||||
u64* src = (u64*)vm;
|
||||
u64* dst = (u64*)clut;
|
||||
|
||||
dst[0] = src[0];
|
||||
dst[1] = src[2];
|
||||
dst[2] = src[4];
|
||||
dst[3] = src[6];
|
||||
dst[4] = src[1];
|
||||
dst[5] = src[3];
|
||||
dst[6] = src[5];
|
||||
dst[7] = src[7];
|
||||
}
|
|
@ -1,184 +0,0 @@
|
|||
/* ZeroGS KOSMOS
|
||||
* Copyright (C) 2005-2006 Gabest/zerofrog@gmail.com
|
||||
* http://www.gabest.org
|
||||
*
|
||||
* 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, 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 GNU Make; see the file COPYING. If not, write to
|
||||
* the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA USA.
|
||||
* http://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef ZEROGS_X86
|
||||
#define ZEROGS_X86
|
||||
|
||||
#include <xmmintrin.h>
|
||||
#include <emmintrin.h>
|
||||
#include "GS.h"
|
||||
|
||||
extern "C" void FASTCALL(SwizzleBlock32_sse2(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff));
|
||||
extern "C" void FASTCALL(SwizzleBlock16_sse2(u8* dst, u8* src, int srcpitch));
|
||||
extern "C" void FASTCALL(SwizzleBlock8_sse2(u8* dst, u8* src, int srcpitch));
|
||||
extern "C" void FASTCALL(SwizzleBlock4_sse2(u8* dst, u8* src, int srcpitch));
|
||||
extern "C" void FASTCALL(SwizzleBlock32u_sse2(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff));
|
||||
extern "C" void FASTCALL(SwizzleBlock16u_sse2(u8* dst, u8* src, int srcpitch));
|
||||
extern "C" void FASTCALL(SwizzleBlock8u_sse2(u8* dst, u8* src, int srcpitch));
|
||||
extern "C" void FASTCALL(SwizzleBlock4u_sse2(u8* dst, u8* src, int srcpitch));
|
||||
|
||||
// frame swizzling
|
||||
|
||||
// no AA
|
||||
extern "C" void FASTCALL(FrameSwizzleBlock32_sse2(u32* dst, u32* src, int srcpitch, u32 WriteMask));
|
||||
extern "C" void FASTCALL(FrameSwizzleBlock16_sse2(u16* dst, u32* src, int srcpitch, u32 WriteMask));
|
||||
extern "C" void FASTCALL(Frame16SwizzleBlock32_sse2(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
extern "C" void FASTCALL(Frame16SwizzleBlock32Z_sse2(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
extern "C" void FASTCALL(Frame16SwizzleBlock16_sse2(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
extern "C" void FASTCALL(Frame16SwizzleBlock16Z_sse2(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
|
||||
// AA 2x
|
||||
extern "C" void FASTCALL(FrameSwizzleBlock32A2_sse2(u32* dst, u32* src, int srcpitch, u32 WriteMask));
|
||||
extern "C" void FASTCALL(FrameSwizzleBlock16A2_sse2(u16* dst, u32* src, int srcpitch, u32 WriteMask));
|
||||
extern "C" void FASTCALL(Frame16SwizzleBlock32A2_sse2(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
extern "C" void FASTCALL(Frame16SwizzleBlock32ZA2_sse2(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
extern "C" void FASTCALL(Frame16SwizzleBlock16A2_sse2(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
extern "C" void FASTCALL(Frame16SwizzleBlock16ZA2_sse2(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
|
||||
// AA 4x
|
||||
extern "C" void FASTCALL(FrameSwizzleBlock32A4_sse2(u32* dst, u32* src, int srcpitch, u32 WriteMask));
|
||||
extern "C" void FASTCALL(FrameSwizzleBlock16A4_sse2(u16* dst, u32* src, int srcpitch, u32 WriteMask));
|
||||
extern "C" void FASTCALL(Frame16SwizzleBlock32A4_sse2(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
extern "C" void FASTCALL(Frame16SwizzleBlock32ZA4_sse2(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
extern "C" void FASTCALL(Frame16SwizzleBlock16A4_sse2(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
extern "C" void FASTCALL(Frame16SwizzleBlock16ZA4_sse2(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
|
||||
extern void FASTCALL(SwizzleBlock32_c(u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff));
|
||||
extern void FASTCALL(SwizzleBlock16_c(u8* dst, u8* src, int srcpitch));
|
||||
extern void FASTCALL(SwizzleBlock8_c(u8* dst, u8* src, int srcpitch));
|
||||
extern void FASTCALL(SwizzleBlock4_c(u8* dst, u8* src, int srcpitch));
|
||||
|
||||
// no AA
|
||||
extern void FASTCALL(FrameSwizzleBlock32_c(u32* dst, u32* src, int srcpitch, u32 WriteMask));
|
||||
extern void FASTCALL(FrameSwizzleBlock16_c(u16* dst, u32* src, int srcpitch, u32 WriteMask));
|
||||
extern void FASTCALL(Frame16SwizzleBlock32_c(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
extern void FASTCALL(Frame16SwizzleBlock32Z_c(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
extern void FASTCALL(Frame16SwizzleBlock16_c(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
extern void FASTCALL(Frame16SwizzleBlock16Z_c(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
|
||||
// AA 2x
|
||||
extern void FASTCALL(FrameSwizzleBlock32A2_c(u32* dst, u32* src, int srcpitch, u32 WriteMask));
|
||||
extern void FASTCALL(FrameSwizzleBlock16A2_c(u16* dst, u32* src, int srcpitch, u32 WriteMask));
|
||||
extern void FASTCALL(Frame16SwizzleBlock32A2_c(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
extern void FASTCALL(Frame16SwizzleBlock32ZA2_c(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
extern void FASTCALL(Frame16SwizzleBlock16A2_c(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
extern void FASTCALL(Frame16SwizzleBlock16ZA2_c(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
|
||||
// AA 4x
|
||||
extern void FASTCALL(FrameSwizzleBlock32A4_c(u32* dst, u32* src, int srcpitch, u32 WriteMask));
|
||||
extern void FASTCALL(FrameSwizzleBlock16A4_c(u16* dst, u32* src, int srcpitch, u32 WriteMask));
|
||||
extern void FASTCALL(Frame16SwizzleBlock32A4_c(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
extern void FASTCALL(Frame16SwizzleBlock32ZA4_c(u32* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
extern void FASTCALL(Frame16SwizzleBlock16A4_c(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
extern void FASTCALL(Frame16SwizzleBlock16ZA4_c(u16* dst, Vector_16F* src, int srcpitch, u32 WriteMask));
|
||||
|
||||
extern void FASTCALL(SwizzleColumn32_c(int y, u8* dst, u8* src, int srcpitch, u32 WriteMask = 0xffffffff));
|
||||
extern void FASTCALL(SwizzleColumn16_c(int y, u8* dst, u8* src, int srcpitch));
|
||||
extern void FASTCALL(SwizzleColumn8_c(int y, u8* dst, u8* src, int srcpitch));
|
||||
extern void FASTCALL(SwizzleColumn4_c(int y, u8* dst, u8* src, int srcpitch));
|
||||
|
||||
extern "C" void FASTCALL(WriteCLUT_T16_I8_CSM1_sse2(u32* vm, u32* clut));
|
||||
extern "C" void FASTCALL(WriteCLUT_T32_I8_CSM1_sse2(u32* vm, u32* clut));
|
||||
extern "C" void FASTCALL(WriteCLUT_T16_I4_CSM1_sse2(u32* vm, u32* clut));
|
||||
extern "C" void FASTCALL(WriteCLUT_T32_I4_CSM1_sse2(u32* vm, u32* clut));
|
||||
extern void FASTCALL(WriteCLUT_T16_I8_CSM1_c(u32* vm, u32* clut));
|
||||
extern void FASTCALL(WriteCLUT_T32_I8_CSM1_c(u32* vm, u32* clut));
|
||||
|
||||
extern void FASTCALL(WriteCLUT_T16_I4_CSM1_c(u32* vm, u32* clut));
|
||||
extern void FASTCALL(WriteCLUT_T32_I4_CSM1_c(u32* vm, u32* clut));
|
||||
|
||||
#ifdef ZEROGS_SSE2
|
||||
|
||||
#define SwizzleBlock32 SwizzleBlock32_sse2
|
||||
#define SwizzleBlock16 SwizzleBlock16_sse2
|
||||
#define SwizzleBlock8 SwizzleBlock8_sse2
|
||||
#define SwizzleBlock4 SwizzleBlock4_sse2
|
||||
#define SwizzleBlock32u SwizzleBlock32u_sse2
|
||||
#define SwizzleBlock16u SwizzleBlock16u_sse2
|
||||
#define SwizzleBlock8u SwizzleBlock8u_sse2
|
||||
#define SwizzleBlock4u SwizzleBlock4u_sse2
|
||||
|
||||
#define FrameSwizzleBlock32 FrameSwizzleBlock32_c
|
||||
#define FrameSwizzleBlock16 FrameSwizzleBlock16_c
|
||||
#define Frame16SwizzleBlock32 Frame16SwizzleBlock32_c
|
||||
#define Frame16SwizzleBlock32Z Frame16SwizzleBlock32Z_c
|
||||
#define Frame16SwizzleBlock16 Frame16SwizzleBlock16_c
|
||||
#define Frame16SwizzleBlock16Z Frame16SwizzleBlock16Z_c
|
||||
|
||||
#define FrameSwizzleBlock32A2 FrameSwizzleBlock32A2_c
|
||||
#define FrameSwizzleBlock16A2 FrameSwizzleBlock16A2_c
|
||||
#define Frame16SwizzleBlock32A2 Frame16SwizzleBlock32A2_c
|
||||
#define Frame16SwizzleBlock32ZA2 Frame16SwizzleBlock32ZA2_c
|
||||
#define Frame16SwizzleBlock16A2 Frame16SwizzleBlock16A2_c
|
||||
#define Frame16SwizzleBlock16ZA2 Frame16SwizzleBlock16ZA2_c
|
||||
|
||||
#define FrameSwizzleBlock32A4 FrameSwizzleBlock32A4_c
|
||||
#define FrameSwizzleBlock16A4 FrameSwizzleBlock16A4_c
|
||||
#define Frame16SwizzleBlock32A4 Frame16SwizzleBlock32A4_c
|
||||
#define Frame16SwizzleBlock32ZA4 Frame16SwizzleBlock32ZA4_c
|
||||
#define Frame16SwizzleBlock16A4 Frame16SwizzleBlock16A4_c
|
||||
#define Frame16SwizzleBlock16ZA4 Frame16SwizzleBlock16ZA4_c
|
||||
|
||||
#define WriteCLUT_T16_I8_CSM1 WriteCLUT_T16_I8_CSM1_sse2
|
||||
#define WriteCLUT_T32_I8_CSM1 WriteCLUT_T32_I8_CSM1_sse2
|
||||
#define WriteCLUT_T16_I4_CSM1 WriteCLUT_T16_I4_CSM1_sse2
|
||||
#define WriteCLUT_T32_I4_CSM1 WriteCLUT_T32_I4_CSM1_sse2
|
||||
|
||||
#else
|
||||
|
||||
#define SwizzleBlock32 SwizzleBlock32_c
|
||||
#define SwizzleBlock16 SwizzleBlock16_c
|
||||
#define SwizzleBlock8 SwizzleBlock8_c
|
||||
#define SwizzleBlock4 SwizzleBlock4_c
|
||||
#define SwizzleBlock32u SwizzleBlock32_c
|
||||
#define SwizzleBlock16u SwizzleBlock16_c
|
||||
#define SwizzleBlock8u SwizzleBlock8_c
|
||||
#define SwizzleBlock4u SwizzleBlock4_c
|
||||
|
||||
#define FrameSwizzleBlock32 FrameSwizzleBlock32_c
|
||||
#define FrameSwizzleBlock16 FrameSwizzleBlock16_c
|
||||
#define Frame16SwizzleBlock32 Frame16SwizzleBlock32_c
|
||||
#define Frame16SwizzleBlock32Z Frame16SwizzleBlock32Z_c
|
||||
#define Frame16SwizzleBlock16 Frame16SwizzleBlock16_c
|
||||
#define Frame16SwizzleBlock16Z Frame16SwizzleBlock16Z_c
|
||||
|
||||
#define FrameSwizzleBlock32A2 FrameSwizzleBlock32A2_c
|
||||
#define FrameSwizzleBlock16A2 FrameSwizzleBlock16A2_c
|
||||
#define Frame16SwizzleBlock32A2 Frame16SwizzleBlock32A2_c
|
||||
#define Frame16SwizzleBlock32ZA2 Frame16SwizzleBlock32ZA2_c
|
||||
#define Frame16SwizzleBlock16A2 Frame16SwizzleBlock16A2_c
|
||||
#define Frame16SwizzleBlock16ZA2 Frame16SwizzleBlock16ZA2_c
|
||||
|
||||
#define FrameSwizzleBlock32A4 FrameSwizzleBlock32A4_c
|
||||
#define FrameSwizzleBlock16A4 FrameSwizzleBlock16A4_c
|
||||
#define Frame16SwizzleBlock32A4 Frame16SwizzleBlock32A4_c
|
||||
#define Frame16SwizzleBlock32ZA4 Frame16SwizzleBlock32ZA4_c
|
||||
#define Frame16SwizzleBlock16A4 Frame16SwizzleBlock16A4_c
|
||||
#define Frame16SwizzleBlock16ZA4 Frame16SwizzleBlock16ZA4_c
|
||||
|
||||
#define WriteCLUT_T16_I8_CSM1 WriteCLUT_T16_I8_CSM1_c
|
||||
#define WriteCLUT_T32_I8_CSM1 WriteCLUT_T32_I8_CSM1_c
|
||||
#define WriteCLUT_T16_I4_CSM1 WriteCLUT_T16_I4_CSM1_c
|
||||
#define WriteCLUT_T32_I4_CSM1 WriteCLUT_T32_I4_CSM1_c
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -1,514 +0,0 @@
|
|||
/* ZeroGS
|
||||
* Copyright (C) 2005-2006 zerofrog@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 __ZEROGS__H
|
||||
#define __ZEROGS__H
|
||||
|
||||
#pragma warning(disable:4200) // nonstandard extension used : zero-sized array in struct/union
|
||||
|
||||
#include <tchar.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <list>
|
||||
using namespace std;
|
||||
|
||||
#ifndef SAFE_DELETE
|
||||
#define SAFE_DELETE(x) if( (x) != NULL ) { delete (x); (x) = NULL; }
|
||||
#endif
|
||||
#ifndef SAFE_DELETE_ARRAY
|
||||
#define SAFE_DELETE_ARRAY(x) if( (x) != NULL ) { delete[] (x); (x) = NULL; }
|
||||
#endif
|
||||
#ifndef SAFE_RELEASE
|
||||
#define SAFE_RELEASE(x) if( (x) != NULL ) { (x)->Release(); (x) = NULL; }
|
||||
#endif
|
||||
|
||||
#define FORIT(it, v) for(it = (v).begin(); it != (v).end(); ++(it))
|
||||
|
||||
typedef D3DXVECTOR2 DXVEC2;
|
||||
typedef D3DXVECTOR3 DXVEC3;
|
||||
typedef D3DXVECTOR4 DXVEC4;
|
||||
typedef D3DXMATRIX DXMAT;
|
||||
|
||||
// sends a message to output window if assert fails
|
||||
#define BMSG(x, str) { if( !(x) ) { GS_LOG(str); GS_LOG(str); } }
|
||||
#define BMSG_RETURN(x, str) { if( !(x) ) { GS_LOG(str); GS_LOG(str); return; } }
|
||||
#define BMSG_RETURNX(x, str, rtype) { if( !(x) ) { GS_LOG(str); GS_LOG(str); return (##rtype); } }
|
||||
#define B(x) { if( !(x) ) { GS_LOG(_T(#x"\n")); GS_LOG(#x"\n"); } }
|
||||
#define B_RETURN(x) { if( !(x) ) { GS_LOG(_T(#x"\n")); GS_LOG(#x"\n"); return; } }
|
||||
#define B_RETURNX(x, rtype) { if( !(x) ) { GS_LOG(_T(#x"\n")); GS_LOG(#x"\n"); return (##rtype); } }
|
||||
#define B_G(x, action) { if( !(x) ) { GS_LOG(#x"\n"); action; } }
|
||||
|
||||
#ifndef RELEASE_TO_PUBLIC
|
||||
#ifndef V
|
||||
#define V(x) { hr = x; if( FAILED(hr) ) { ERROR_LOG("%s:%d: %s (%8.8x)\n", __FILE__, (DWORD)__LINE__, _T(#x), hr); } }
|
||||
#endif
|
||||
#ifndef V_RETURN
|
||||
#define V_RETURN(x) { hr = x; if( FAILED(hr) ) { ERROR_LOG("%s:%d: %s (%8.8x)\n", __FILE__, (DWORD)__LINE__, _T(#x), hr); return hr; } }
|
||||
#endif
|
||||
#else
|
||||
#ifndef V
|
||||
#define V(x) { hr = x; }
|
||||
#endif
|
||||
#ifndef V_RETURN
|
||||
#define V_RETURN(x) { hr = x; if( FAILED(hr) ) { return hr; } }
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define SETRS(state, val) pd3dDevice->SetRenderState(state, val)
|
||||
#ifndef ArraySize
|
||||
#define ArraySize(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#endif
|
||||
|
||||
// all textures have this width
|
||||
//#define GPU_TEXWIDTH 512
|
||||
extern int GPU_TEXWIDTH;
|
||||
extern float g_fiGPU_TEXWIDTH;
|
||||
#define GPU_TEXMASKWIDTH 1024 // bitwise mask width for region repeat mode
|
||||
|
||||
// set these shader constants
|
||||
#define GPU_TEXALPHA20 (2|0x8000)
|
||||
#define GPU_TEXOFFSET0 (4|0x8000)
|
||||
#define GPU_TEXDIMS0 (6|0x8000)
|
||||
#define GPU_TEXBLOCK0 (8|0x8000)
|
||||
#define GPU_CLAMPEXTS0 (10|0x8000)
|
||||
#define GPU_TEXWRAPMODE0 (12|0x8000)
|
||||
#define GPU_REALTEXDIMS0 (14|0x8000)
|
||||
#define GPU_TESTBLACK0 (16|0x8000)
|
||||
#define GPU_PAGEOFFSET0 (18|0x8000)
|
||||
#define GPU_TEXALPHA0 (20|0x8000)
|
||||
|
||||
#define GPU_INVTEXDIMS (22|0x8000)
|
||||
#define GPU_FOGCOLOR (23|0x8000)
|
||||
#define GPU_BITBLTZ (24|0x8000)
|
||||
#define GPU_ONECOLOR (25|0x8000)
|
||||
|
||||
#define GPU_CLIPPLANE0 (24|0x8000)
|
||||
#define GPU_CLIPPLANE1 (26|0x8000)
|
||||
|
||||
#define GPU_POSXY0 2
|
||||
|
||||
#define GPU_BITBLTPOS 4
|
||||
#define GPU_Z 5
|
||||
#define GPU_ZNORM 6
|
||||
#define GPU_BITBLTTEX 7
|
||||
|
||||
#define SETCONSTF(id, ptr) { if( id & 0x8000 ) pd3dDevice->SetPixelShaderConstantF(id&0x7fff, (FLOAT*)ptr, 1); \
|
||||
else pd3dDevice->SetVertexShaderConstantF(id&0x7fff, (FLOAT*)ptr, 1); }
|
||||
|
||||
#define SAMP_MEMORY0 0
|
||||
#define SAMP_MEMORY1 1
|
||||
#define SAMP_FINAL 2
|
||||
#define SAMP_BLOCKS 3
|
||||
#define SAMP_BILINEARBLOCKS 4
|
||||
#define SAMP_INTERLACE 5
|
||||
#define SAMP_BITWISEANDX 5
|
||||
#define SAMP_BITWISEANDY 6
|
||||
|
||||
// don't change these values!
|
||||
#define GAME_TEXTURETARGS 0x01
|
||||
#define GAME_AUTORESET 0x02
|
||||
#define GAME_INTERLACE2X 0x04
|
||||
#define GAME_TEXAHACK 0x08 // apply texa to non textured polys
|
||||
#define GAME_NOTARGETRESOLVE 0x10
|
||||
#define GAME_EXACTCOLOR 0x20
|
||||
#define GAME_NOCOLORCLAMP 0x40
|
||||
#define GAME_FFXHACK 0x80
|
||||
#define GAME_NODEPTHUPDATE 0x0200
|
||||
#define GAME_QUICKRESOLVE1 0x0400
|
||||
#define GAME_NOQUICKRESOLVE 0x0800
|
||||
#define GAME_NOTARGETCLUT 0x1000 // full 16 bit resolution
|
||||
#define GAME_NOSTENCIL 0x2000
|
||||
#define GAME_VSSHACKOFF 0x4000 // vertical stripe syndrome
|
||||
#define GAME_NODEPTHRESOLVE 0x8000
|
||||
#define GAME_FULL16BITRES 0x00010000
|
||||
#define GAME_RESOLVEPROMOTED 0x00020000
|
||||
#define GAME_FASTUPDATE 0x00040000
|
||||
#define GAME_NOALPHATEST 0x00080000
|
||||
#define GAME_DISABLEMRTDEPTH 0x00100000
|
||||
#define GAME_32BITTARGS 0x00200000
|
||||
#define GAME_PATH3HACK 0x00400000
|
||||
#define GAME_DOPARALLELCTX 0x00800000 // tries to parallelize both contexts so that render calls are reduced (xenosaga)
|
||||
// makes the game faster, but can be buggy
|
||||
#define GAME_XENOSPECHACK 0x01000000 // xenosaga specularity hack (ignore any zmask=1 draws)
|
||||
#define GAME_PARTIALPOINTERS 0x02000000 // whenver the texture or render target are small, tries to look for bigger ones to read from
|
||||
#define GAME_PARTIALDEPTH 0x04000000 // tries to save depth targets as much as possible across height changes
|
||||
#define GAME_RELAXEDDEPTH 0x08000000 // tries to save depth targets as much as possible across height changes
|
||||
|
||||
#define USEALPHABLENDING 1//(!(g_GameSettings&GAME_NOALPHABLEND))
|
||||
#define USEALPHATESTING (!(g_GameSettings&GAME_NOALPHATEST))
|
||||
|
||||
typedef IDirect3DDevice9* LPD3DDEV;
|
||||
typedef IDirect3DVertexBuffer9* LPD3DVB;
|
||||
typedef IDirect3DIndexBuffer9* LPD3DIB;
|
||||
typedef IDirect3DBaseTexture9* LPD3DBASETEX;
|
||||
typedef IDirect3DTexture9* LPD3DTEX;
|
||||
typedef IDirect3DCubeTexture9* LPD3DCUBETEX;
|
||||
typedef IDirect3DVolumeTexture9* LPD3DVOLUMETEX;
|
||||
typedef IDirect3DSurface9* LPD3DSURF;
|
||||
typedef IDirect3DVertexDeclaration9* LPD3DDECL;
|
||||
typedef IDirect3DVertexShader9* LPD3DVS;
|
||||
typedef IDirect3DPixelShader9* LPD3DPS;
|
||||
typedef ID3DXAnimationController* LPD3DXAC;
|
||||
|
||||
namespace ZeroGS
|
||||
{
|
||||
typedef void (*DrawFn)();
|
||||
|
||||
// managers render-to-texture targets
|
||||
class CRenderTarget
|
||||
{
|
||||
public:
|
||||
CRenderTarget();
|
||||
CRenderTarget(const frameInfo& frame, CRenderTarget& r); // virtualized a target
|
||||
virtual ~CRenderTarget();
|
||||
|
||||
virtual BOOL Create(const frameInfo& frame);
|
||||
virtual void Destroy();
|
||||
|
||||
// set the GPU_POSXY variable, scissor rect, and current render target
|
||||
void SetTarget(int fbplocal, const Rect2& scissor, int context);
|
||||
void SetViewport();
|
||||
|
||||
// copies/creates the feedback contents
|
||||
inline void CreateFeedback() {
|
||||
if( ptexFeedback == NULL || !(status&TS_FeedbackReady) )
|
||||
_CreateFeedback();
|
||||
}
|
||||
|
||||
virtual void Resolve();
|
||||
virtual void Resolve(int startrange, int endrange); // resolves only in the allowed range
|
||||
virtual void Update(int context, CRenderTarget* pdepth);
|
||||
virtual void ConvertTo32(); // converts a psm==2 target, to a psm==0
|
||||
virtual void ConvertTo16(); // converts a psm==0 target, to a psm==2
|
||||
|
||||
virtual bool IsDepth() { return false; }
|
||||
|
||||
LPD3DSURF psurf, psys;
|
||||
LPD3DTEX ptex;
|
||||
|
||||
int targoffx, targoffy; // the offset from the target that the real fbp starts at (in pixels)
|
||||
int targheight; // height of ptex
|
||||
CRenderTarget* pmimicparent; // if not NULL, this target is a subtarget of pmimicparent
|
||||
|
||||
int fbp, fbw, fbh; // if fbp is negative, virtual target (not mapped to any real addr)
|
||||
int start, end; // in bytes
|
||||
u32 lastused; // time stamp since last used
|
||||
DXVEC4 vposxy;
|
||||
|
||||
u32 fbm;
|
||||
u16 status;
|
||||
u8 psm;
|
||||
u8 resv0;
|
||||
RECT scissorrect;
|
||||
|
||||
//int startresolve, endresolve;
|
||||
u32 nUpdateTarg; // use this target to update the texture if non 0 (one time only)
|
||||
|
||||
// this is optionally used when feedback effects are used (render target is used as a texture when rendering to itself)
|
||||
LPD3DTEX ptexFeedback;
|
||||
LPD3DSURF psurfFeedback;
|
||||
|
||||
enum TargetStatus {
|
||||
TS_Resolved = 1,
|
||||
TS_NeedUpdate = 2,
|
||||
TS_Virtual = 4, // currently not mapped to memory
|
||||
TS_FeedbackReady = 8, // feedback effect is ready and doesn't need to be updated
|
||||
TS_NeedConvert32 = 16,
|
||||
TS_NeedConvert16 = 32,
|
||||
};
|
||||
|
||||
private:
|
||||
void _CreateFeedback();
|
||||
};
|
||||
|
||||
// manages zbuffers
|
||||
class CDepthTarget : public CRenderTarget
|
||||
{
|
||||
public:
|
||||
CDepthTarget();
|
||||
virtual ~CDepthTarget();
|
||||
|
||||
virtual BOOL Create(const frameInfo& frame);
|
||||
virtual void Destroy();
|
||||
|
||||
virtual void Resolve();
|
||||
virtual void Resolve(int startrange, int endrange); // resolves only in the allowed range
|
||||
virtual void Update(int context, CRenderTarget* prndr);
|
||||
|
||||
virtual bool IsDepth() { return true; }
|
||||
|
||||
void SetDepthTarget();
|
||||
|
||||
LPD3DSURF pdepth;
|
||||
};
|
||||
|
||||
// manages contiguous chunks of memory (width is always 1024)
|
||||
class CMemoryTarget
|
||||
{
|
||||
public:
|
||||
struct MEMORY
|
||||
{
|
||||
inline MEMORY() : ptr(NULL), ref(0) {}
|
||||
inline ~MEMORY() { _aligned_free(ptr); }
|
||||
|
||||
BYTE* ptr;
|
||||
int ref;
|
||||
};
|
||||
|
||||
inline CMemoryTarget() : ptex(NULL), ptexsys(NULL), starty(0), height(0), realy(0), realheight(0), usedstamp(0), psm(0),
|
||||
cpsm(0), memory(NULL), clearminy(0), clearmaxy(0), validatecount(0) {}
|
||||
inline CMemoryTarget(const CMemoryTarget& r) {
|
||||
ptex = r.ptex;
|
||||
ptexsys = r.ptexsys;
|
||||
if( ptex != NULL ) ptex->AddRef();
|
||||
if( ptexsys != NULL ) ptexsys->AddRef();
|
||||
starty = r.starty;
|
||||
height = r.height;
|
||||
realy = r.realy;
|
||||
realheight = r.realheight;
|
||||
usedstamp = r.usedstamp;
|
||||
psm = r.psm;
|
||||
cpsm = r.cpsm;
|
||||
clut = r.clut;
|
||||
memory = r.memory;
|
||||
clearminy = r.clearminy;
|
||||
clearmaxy = r.clearmaxy;
|
||||
widthmult = r.widthmult;
|
||||
validatecount = r.validatecount;
|
||||
fmt = r.fmt;
|
||||
if( memory != NULL ) memory->ref++;
|
||||
}
|
||||
|
||||
~CMemoryTarget() { Destroy(); }
|
||||
|
||||
inline void Destroy() {
|
||||
SAFE_RELEASE(ptex);
|
||||
SAFE_RELEASE(ptexsys);
|
||||
|
||||
if( memory != NULL && memory->ref > 0 ) {
|
||||
if( --memory->ref <= 0 ) {
|
||||
SAFE_DELETE(memory);
|
||||
}
|
||||
}
|
||||
memory = NULL;
|
||||
}
|
||||
|
||||
// returns true if clut data is synced
|
||||
bool ValidateClut(const tex0Info& tex0);
|
||||
// returns true if tex data is synced
|
||||
bool ValidateTex(const tex0Info& tex0, int starttex, int endtex, bool bDeleteBadTex);
|
||||
|
||||
int clearminy, clearmaxy; // when maxy > 0, need to check for clearing
|
||||
|
||||
// realy is offset in pixels from start of valid region
|
||||
// so texture in memory is [realy,starty+height]
|
||||
// valid texture is [starty,starty+height]
|
||||
// offset in mem [starty-realy, height]
|
||||
int starty, height; // assert(starty >= realy)
|
||||
int realy, realheight; // this is never touched once allocated
|
||||
u32 usedstamp;
|
||||
LPD3DTEX ptex; // can be 16bit if
|
||||
LPD3DTEX ptexsys;
|
||||
D3DFORMAT fmt;
|
||||
|
||||
int widthmult;
|
||||
|
||||
int validatecount; // count how many times has been validated, if too many, destroy
|
||||
|
||||
vector<BYTE> clut; // if nonzero, texture uses CLUT
|
||||
MEMORY* memory; // system memory used to compare for changes
|
||||
u8 psm, cpsm; // texture and clut format. For psm, only 16bit/32bit differentiation matters
|
||||
};
|
||||
|
||||
|
||||
struct VB
|
||||
{
|
||||
VB();
|
||||
~VB();
|
||||
|
||||
void Destroy();
|
||||
|
||||
inline bool IsLocked() { return pbuf != NULL; }
|
||||
inline void Lock();
|
||||
inline void Unlock() {
|
||||
if( pbuf != NULL ) {
|
||||
pvb->Unlock();
|
||||
pbuf = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
__forceinline bool CheckPrim();
|
||||
void CheckFrame(int tbp);
|
||||
|
||||
// context specific state
|
||||
Point offset;
|
||||
Rect2 scissor;
|
||||
tex0Info tex0;
|
||||
tex1Info tex1;
|
||||
miptbpInfo miptbp0;
|
||||
miptbpInfo miptbp1;
|
||||
alphaInfo alpha;
|
||||
fbaInfo fba;
|
||||
clampInfo clamp;
|
||||
pixTest test;
|
||||
LPD3DTEX ptexClamp[2]; // textures for x and y dir region clamping
|
||||
|
||||
public:
|
||||
|
||||
void FlushTexData();
|
||||
|
||||
u8 bNeedFrameCheck;
|
||||
u8 bNeedZCheck;
|
||||
u8 bNeedTexCheck;
|
||||
u8 dummy0;
|
||||
|
||||
union {
|
||||
struct {
|
||||
u8 bTexConstsSync; // only pixel shader constants that context owns
|
||||
u8 bVarsTexSync; // texture info
|
||||
u8 bVarsSetTarg;
|
||||
u8 dummy1;
|
||||
};
|
||||
u32 bSyncVars;
|
||||
};
|
||||
|
||||
int ictx;
|
||||
VertexGPU* pbuf;
|
||||
DWORD dwCurOff;
|
||||
DWORD dwCount;
|
||||
primInfo curprim; // the previous prim the current buffers are set to
|
||||
|
||||
zbufInfo zbuf;
|
||||
frameInfo gsfb; // the real info set by FRAME cmd
|
||||
frameInfo frame;
|
||||
int zprimmask; // zmask for incoming points
|
||||
|
||||
u32 uCurTex0Data[2]; // current tex0 data
|
||||
u32 uNextTex0Data[2]; // tex0 data that has to be applied if bNeedTexCheck is 1
|
||||
|
||||
//int nFrameHeights[8]; // frame heights for the past frame changes
|
||||
int nNextFrameHeight;
|
||||
|
||||
CMemoryTarget* pmemtarg; // the current mem target set
|
||||
LPD3DVB pvb;
|
||||
CRenderTarget* prndr;
|
||||
CDepthTarget* pdepth;
|
||||
};
|
||||
|
||||
// visible members
|
||||
extern DrawFn drawfn[8];
|
||||
extern VB vb[2];
|
||||
extern float fiTexWidth[2], fiTexHeight[2]; // current tex width and height
|
||||
extern LONG width, height;
|
||||
extern u8* g_pbyGSMemory;
|
||||
extern u8* g_pbyGSClut; // the temporary clut buffer
|
||||
|
||||
void AddMessage(const char* pstr, DWORD ms = 5000);
|
||||
void ChangeWindowSize(int nNewWidth, int nNewHeight);
|
||||
void SetChangeDeviceSize(int nNewWidth, int nNewHeight);
|
||||
void ChangeDeviceSize(int nNewWidth, int nNewHeight);
|
||||
void SetAA(int mode);
|
||||
void SetCRC(int crc);
|
||||
|
||||
void ReloadEffects();
|
||||
|
||||
// Methods //
|
||||
|
||||
HRESULT Create(LONG width, LONG height);
|
||||
void Destroy(BOOL bD3D);
|
||||
|
||||
void Restore(); // call to restore device
|
||||
void Reset(); // call to destroy video resources
|
||||
|
||||
HRESULT InitDeviceObjects();
|
||||
void DeleteDeviceObjects();
|
||||
|
||||
void GSStateReset();
|
||||
|
||||
// called on a primitive switch
|
||||
void Prim();
|
||||
|
||||
void SetTexFlush();
|
||||
// flush current vertices, call before setting new registers (the main render method)
|
||||
void Flush(int context);
|
||||
|
||||
void ExtWrite();
|
||||
|
||||
void SetWriteDepth();
|
||||
BOOL IsWriteDepth();
|
||||
|
||||
void SetDestAlphaTest();
|
||||
BOOL IsWriteDestAlphaTest();
|
||||
|
||||
void SetFogColor(u32 fog);
|
||||
void SaveTex(tex0Info* ptex, int usevid);
|
||||
|
||||
// called when trxdir is accessed. If host is involved, transfers memory to temp buffer byTransferBuf.
|
||||
// Otherwise performs the transfer. TODO: Perhaps divide the transfers into chunks?
|
||||
void InitTransferHostLocal();
|
||||
void TransferHostLocal(const void* pbyMem, u32 nQWordSize);
|
||||
|
||||
void InitTransferLocalHost();
|
||||
void TransferLocalHost(void* pbyMem, u32 nQWordSize);
|
||||
inline void TerminateLocalHost() {}
|
||||
|
||||
void TransferLocalLocal();
|
||||
|
||||
// switches the render target to the real target, flushes the current render targets and renders the real image
|
||||
void RenderCRTC(int interlace);
|
||||
|
||||
bool CheckChangeInClut(u32 highdword, u32 psm); // returns true if clut will change after this tex0 op
|
||||
|
||||
// call to load CLUT data (depending on CLD)
|
||||
void texClutWrite(int ctx);
|
||||
|
||||
int Save(char* pbydata);
|
||||
bool Load(char* pbydata);
|
||||
|
||||
void SaveSnapshot(const char* filename);
|
||||
|
||||
// private methods
|
||||
void FlushSysMem(const RECT* prc);
|
||||
void _Resolve(const D3DLOCKED_RECT& locksrc, int fbp, int fbw, int fbh, int psm, u32 fbm);
|
||||
|
||||
// returns the first and last addresses aligned to a page that cover
|
||||
void GetRectMemAddress(int& start, int& end, int psm, int x, int y, int w, int h, int bp, int bw);
|
||||
|
||||
// inits the smallest rectangle in ptexMem that covers this region in ptexMem
|
||||
// returns the offset that needs to be added to the locked rect to get the beginning of the buffer
|
||||
//void GetMemRect(RECT& rc, int psm, int x, int y, int w, int h, int bp, int bw);
|
||||
|
||||
// only sets a limited amount of state (for Update)
|
||||
void SetTexVariablesInt(int context, int bilinear, const tex0Info& tex0, ZeroGS::CMemoryTarget* pmemtarg, int force);
|
||||
|
||||
void ResetAlphaVariables();
|
||||
|
||||
bool StartCapture();
|
||||
void StopCapture();
|
||||
void CaptureFrame();
|
||||
};
|
||||
|
||||
extern LPDIRECT3DDEVICE9 pd3dDevice;
|
||||
extern const u32 g_primmult[8];
|
||||
extern const u32 g_primsub[8];
|
||||
|
||||
#endif
|
|
@ -1,140 +0,0 @@
|
|||
# zerogs Plugin
|
||||
|
||||
# plugin name
|
||||
set(Output zerogs)
|
||||
|
||||
set(CommonFlags
|
||||
-Wall
|
||||
-Wno-parentheses
|
||||
)
|
||||
|
||||
# Debug - Build
|
||||
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
# add defines
|
||||
add_definitions(${CommonFlags} -g)
|
||||
endif(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||
|
||||
# Devel - Build
|
||||
if(CMAKE_BUILD_TYPE STREQUAL Devel)
|
||||
# add defines
|
||||
add_definitions(${CommonFlags} -fvisibility=hidden)
|
||||
endif(CMAKE_BUILD_TYPE STREQUAL Devel)
|
||||
|
||||
# Release - Build
|
||||
if(CMAKE_BUILD_TYPE STREQUAL Release)
|
||||
# add defines
|
||||
add_definitions(${CommonFlags} -fvisibility=hidden)
|
||||
endif(CMAKE_BUILD_TYPE STREQUAL Release)
|
||||
|
||||
# zerogs sources
|
||||
set(zerogsSources
|
||||
GifTransfer.cpp
|
||||
glprocs.c
|
||||
GSmain.cpp
|
||||
GLWinX11.cpp
|
||||
Mem.cpp
|
||||
rasterfont.cpp
|
||||
Regs.cpp
|
||||
targets.cpp
|
||||
x86.cpp
|
||||
zerogs.cpp
|
||||
zpipe.cpp)
|
||||
|
||||
# zerogs headers
|
||||
set(zerogsHeaders
|
||||
common.h
|
||||
GifTransfer.h
|
||||
glprocs.h
|
||||
GS.h
|
||||
Mem.h
|
||||
rasterfont.h
|
||||
Regs.h
|
||||
targets.h
|
||||
x86.h
|
||||
zerogs.h
|
||||
zerogsmath.h
|
||||
zpipe.h)
|
||||
|
||||
# zerogs S sources
|
||||
set(zerogsSSources
|
||||
x86-32.S)
|
||||
|
||||
# zerogs shader sources
|
||||
set(zerogsShaderSources
|
||||
ctx0/ps2hw_ctx.fx
|
||||
ctx1/ps2hw_ctx.fx)
|
||||
|
||||
# zerogs Linux sources
|
||||
set(zerogsLinuxSources
|
||||
# Linux/callbacks.c
|
||||
Linux/Conf.cpp
|
||||
Linux/interface.c
|
||||
Linux/Linux.cpp
|
||||
Linux/support.c)
|
||||
|
||||
# zerogs Linux headers
|
||||
set(zerogsLinuxHeaders
|
||||
Linux/callbacks.h
|
||||
Linux/interface.h
|
||||
Linux/Linux.h
|
||||
Linux/support.h)
|
||||
|
||||
# zerogs Windows sources
|
||||
set(zerogsWindowsSources
|
||||
Win32/Conf.cpp
|
||||
Win32/Win32.cpp
|
||||
Win32/zerogs.def
|
||||
Win32/zerogs.rc)
|
||||
|
||||
# zerogs Windows headers
|
||||
set(zerogsWindowsHeaders
|
||||
aviUtil.h
|
||||
jcofig.h
|
||||
jmorecfg.h
|
||||
jpeglib.h
|
||||
resource.h
|
||||
resrc1.h
|
||||
Win32.h)
|
||||
|
||||
# change language of .S-files to c++
|
||||
set_source_files_properties(${zerogsSSources} PROPERTIES LANGUAGE CXX)
|
||||
|
||||
# add additional include directories
|
||||
include_directories(.)
|
||||
|
||||
# add library
|
||||
add_library(${Output} SHARED
|
||||
${zerogsSources}
|
||||
${zerogsHeaders}
|
||||
${zerogsSSources}
|
||||
${zerogsShaderSources}
|
||||
${zerogsLinuxSources}
|
||||
${zerogsLinuxHeaders})
|
||||
|
||||
# set output directory
|
||||
set_target_properties(${Output} PROPERTIES
|
||||
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin/plugins)
|
||||
|
||||
# copy ps2hw.dat to plugins folder
|
||||
add_custom_command(TARGET ${Output} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/plugins/zerogs/opengl/Win32/ps2hw.dat ${CMAKE_SOURCE_DIR}/bin/plugins)
|
||||
|
||||
# link target with Cg
|
||||
target_link_libraries(${Output} ${CG_LIBRARIES})
|
||||
|
||||
# link target with glew
|
||||
target_link_libraries(${Output} ${GLEW_LIBRARY})
|
||||
|
||||
# link target with opengl
|
||||
target_link_libraries(${Output} ${OPENGL_LIBRARIES})
|
||||
|
||||
# link target with X11
|
||||
target_link_libraries(${Output} ${X11_LIBRARIES})
|
||||
|
||||
# link target with X11 videomod
|
||||
target_link_libraries(${Output} ${X11_Xxf86vm_LIB})
|
||||
|
||||
# User flags options
|
||||
if(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
|
||||
target_link_libraries(${Output} "${USER_CMAKE_LD_FLAGS}")
|
||||
endif(NOT USER_CMAKE_LD_FLAGS STREQUAL "")
|
|
@ -1,247 +0,0 @@
|
|||
/* ZeroGS KOSMOS
|
||||
* Copyright (C) 2005-2006 zerofrog@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 "GS.h"
|
||||
#include "zerogs.h"
|
||||
|
||||
#ifdef GL_X11_WINDOW
|
||||
|
||||
bool GLWindow::CreateWindow(void *pDisplay)
|
||||
{
|
||||
glDisplay = XOpenDisplay(0);
|
||||
glScreen = DefaultScreen(glDisplay);
|
||||
|
||||
if ( pDisplay == NULL ) return false;
|
||||
|
||||
*(Display**)pDisplay = glDisplay;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool GLWindow::DestroyWindow()
|
||||
{
|
||||
if (context)
|
||||
{
|
||||
if (!glXMakeCurrent(glDisplay, None, NULL))
|
||||
{
|
||||
ERROR_LOG("Could not release drawing context.\n");
|
||||
}
|
||||
|
||||
glXDestroyContext(glDisplay, context);
|
||||
context = NULL;
|
||||
}
|
||||
|
||||
/* switch back to original desktop resolution if we were in fullScreen */
|
||||
if ( glDisplay != NULL )
|
||||
{
|
||||
if (fullScreen)
|
||||
{
|
||||
XF86VidModeSwitchToMode(glDisplay, glScreen, &deskMode);
|
||||
XF86VidModeSetViewPort(glDisplay, glScreen, 0, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GLWindow::CloseWindow()
|
||||
{
|
||||
if ( glDisplay != NULL )
|
||||
{
|
||||
XCloseDisplay(glDisplay);
|
||||
glDisplay = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void GLWindow::DisplayWindow(int _width, int _height)
|
||||
{
|
||||
XVisualInfo *vi;
|
||||
Colormap cmap;
|
||||
int GLDisplayWidth, GLDisplayHeight;
|
||||
int glxMajorVersion, glxMinorVersion;
|
||||
int vidModeMajorVersion, vidModeMinorVersion;
|
||||
Atom wmDelete;
|
||||
Window winDummy;
|
||||
unsigned int borderDummy;
|
||||
|
||||
// attributes for a single buffered visual in RGBA format with at least
|
||||
// 8 bits per color and a 24 bit depth buffer
|
||||
int attrListSgl[] = {GLX_RGBA, GLX_RED_SIZE, 8,
|
||||
GLX_GREEN_SIZE, 8,
|
||||
GLX_BLUE_SIZE, 8,
|
||||
GLX_DEPTH_SIZE, 24,
|
||||
None};
|
||||
|
||||
// attributes for a double buffered visual in RGBA format with at least
|
||||
// 8 bits per color and a 24 bit depth buffer
|
||||
int attrListDbl[] = { GLX_RGBA, GLX_DOUBLEBUFFER,
|
||||
GLX_RED_SIZE, 8,
|
||||
GLX_GREEN_SIZE, 8,
|
||||
GLX_BLUE_SIZE, 8,
|
||||
GLX_DEPTH_SIZE, 24,
|
||||
None };
|
||||
|
||||
fullScreen = !!(conf.options & GSOPTION_FULLSCREEN);
|
||||
|
||||
/* get an appropriate visual */
|
||||
vi = glXChooseVisual(glDisplay, glScreen, attrListDbl);
|
||||
if (vi == NULL) {
|
||||
vi = glXChooseVisual(glDisplay, glScreen, attrListSgl);
|
||||
doubleBuffered = false;
|
||||
ERROR_LOG("Only Singlebuffered Visual!\n");
|
||||
}
|
||||
else {
|
||||
doubleBuffered = true;
|
||||
ERROR_LOG("Got Doublebuffered Visual!\n");
|
||||
}
|
||||
if (vi == NULL)
|
||||
{
|
||||
ERROR_LOG("Failed to get buffered Visual!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
glXQueryVersion(glDisplay, &glxMajorVersion, &glxMinorVersion);
|
||||
ERROR_LOG("glX-Version %d.%d\n", glxMajorVersion, glxMinorVersion);
|
||||
/* create a GLX context */
|
||||
context = glXCreateContext(glDisplay, vi, 0, GL_TRUE);
|
||||
/* create a color map */
|
||||
cmap = XCreateColormap(glDisplay, RootWindow(glDisplay, vi->screen),
|
||||
vi->visual, AllocNone);
|
||||
attr.colormap = cmap;
|
||||
attr.border_pixel = 0;
|
||||
|
||||
// get a connection
|
||||
XF86VidModeQueryVersion(glDisplay, &vidModeMajorVersion, &vidModeMinorVersion);
|
||||
|
||||
if (fullScreen) {
|
||||
|
||||
XF86VidModeModeInfo **modes = NULL;
|
||||
int modeNum = 0;
|
||||
int bestMode = 0;
|
||||
|
||||
// set best mode to current
|
||||
bestMode = 0;
|
||||
ERROR_LOG("XF86VidModeExtension-Version %d.%d\n", vidModeMajorVersion, vidModeMinorVersion);
|
||||
XF86VidModeGetAllModeLines(glDisplay, glScreen, &modeNum, &modes);
|
||||
|
||||
if( modeNum > 0 && modes != NULL ) {
|
||||
/* save desktop-resolution before switching modes */
|
||||
GLWin.deskMode = *modes[0];
|
||||
/* look for mode with requested resolution */
|
||||
for (int i = 0; i < modeNum; i++) {
|
||||
if ((modes[i]->hdisplay == _width) && (modes[i]->vdisplay == _height)) {
|
||||
bestMode = i;
|
||||
}
|
||||
}
|
||||
|
||||
XF86VidModeSwitchToMode(glDisplay, glScreen, modes[bestMode]);
|
||||
XF86VidModeSetViewPort(glDisplay, glScreen, 0, 0);
|
||||
GLDisplayWidth = modes[bestMode]->hdisplay;
|
||||
GLDisplayHeight = modes[bestMode]->vdisplay;
|
||||
ERROR_LOG("Resolution %dx%d\n", GLDisplayWidth, GLDisplayHeight);
|
||||
XFree(modes);
|
||||
|
||||
/* create a fullscreen window */
|
||||
attr.override_redirect = True;
|
||||
attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask |
|
||||
StructureNotifyMask;
|
||||
glWindow = XCreateWindow(glDisplay, RootWindow(glDisplay, vi->screen),
|
||||
0, 0, GLDisplayWidth, GLDisplayHeight, 0, vi->depth, InputOutput, vi->visual,
|
||||
CWBorderPixel | CWColormap | CWEventMask | CWOverrideRedirect,
|
||||
&attr);
|
||||
XWarpPointer(glDisplay, None, glWindow, 0, 0, 0, 0, 0, 0);
|
||||
XMapRaised(glDisplay, glWindow);
|
||||
XGrabKeyboard(glDisplay, glWindow, True, GrabModeAsync,
|
||||
GrabModeAsync, CurrentTime);
|
||||
XGrabPointer(glDisplay, glWindow, True, ButtonPressMask,
|
||||
GrabModeAsync, GrabModeAsync, glWindow, None, CurrentTime);
|
||||
}
|
||||
else {
|
||||
ERROR_LOG("Failed to start fullscreen. If you received the \n"
|
||||
"\"XFree86-VidModeExtension\" extension is missing, add\n"
|
||||
"Load \"extmod\"\n"
|
||||
"to your X configuration file (under the Module Section)\n");
|
||||
fullScreen = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if( !fullScreen ) {
|
||||
|
||||
//XRootWindow(glDisplay,glScreen)
|
||||
//int X = (rcdesktop.right-rcdesktop.left)/2 - (rc.right-rc.left)/2;
|
||||
//int Y = (rcdesktop.bottom-rcdesktop.top)/2 - (rc.bottom-rc.top)/2;
|
||||
|
||||
// create a window in window mode
|
||||
attr.event_mask = ExposureMask | KeyPressMask | ButtonPressMask |
|
||||
StructureNotifyMask;
|
||||
glWindow = XCreateWindow(glDisplay, RootWindow(glDisplay, vi->screen),
|
||||
0, 0, _width, _height, 0, vi->depth, InputOutput, vi->visual,
|
||||
CWBorderPixel | CWColormap | CWEventMask, &attr);
|
||||
// only set window title and handle wm_delete_events if in windowed mode
|
||||
wmDelete = XInternAtom(glDisplay, "WM_DELETE_WINDOW", True);
|
||||
XSetWMProtocols(glDisplay, glWindow, &wmDelete, 1);
|
||||
XSetStandardProperties(glDisplay, glWindow, "ZeroGS",
|
||||
"ZeroGS", None, NULL, 0, NULL);
|
||||
XMapRaised(glDisplay, glWindow);
|
||||
}
|
||||
|
||||
// connect the glx-context to the window
|
||||
glXMakeCurrent(glDisplay, glWindow, context);
|
||||
XGetGeometry(glDisplay, glWindow, &winDummy, &x, &y,
|
||||
&width, &height, &borderDummy, &depth);
|
||||
ERROR_LOG("Depth %d\n", depth);
|
||||
if (glXIsDirect(glDisplay, context))
|
||||
ERROR_LOG("you have Direct Rendering!\n");
|
||||
else
|
||||
ERROR_LOG("no Direct Rendering possible!\n");
|
||||
|
||||
// better for pad plugin key input (thc)
|
||||
XSelectInput(glDisplay, glWindow, ExposureMask | KeyPressMask | KeyReleaseMask |
|
||||
ButtonPressMask | StructureNotifyMask | EnterWindowMask | LeaveWindowMask |
|
||||
FocusChangeMask );
|
||||
}
|
||||
|
||||
void GLWindow::SwapBuffers()
|
||||
{
|
||||
glXSwapBuffers(glDisplay, glWindow);
|
||||
}
|
||||
|
||||
void GLWindow::SetTitle(char *strtitle)
|
||||
{
|
||||
XTextProperty prop;
|
||||
memset(&prop, 0, sizeof(prop));
|
||||
char* ptitle = strtitle;
|
||||
if( XStringListToTextProperty(&ptitle, 1, &prop) )
|
||||
XSetWMName(glDisplay, glWindow, &prop);
|
||||
XFree(prop.value);
|
||||
}
|
||||
|
||||
void GLWindow::ResizeCheck()
|
||||
{
|
||||
XEvent event;
|
||||
|
||||
while(XCheckTypedEvent(glDisplay, ConfigureNotify, &event))
|
||||
{
|
||||
if ((event.xconfigure.width != width) || (event.xconfigure.height != height)) {
|
||||
ZeroGS::ChangeWindowSize(event.xconfigure.width, event.xconfigure.height);
|
||||
width = event.xconfigure.width;
|
||||
height = event.xconfigure.height;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -1,843 +0,0 @@
|
|||
/* ZeroGS KOSMOS
|
||||
* Copyright (C) 2005-2006 zerofrog@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 __GS_H__
|
||||
#define __GS_H__
|
||||
|
||||
#ifdef _WIN32
|
||||
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
|
||||
extern HWND GShwnd;
|
||||
|
||||
#else // linux basic definitions
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glx.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/Xutil.h>
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/extensions/xf86vmode.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <malloc.h>
|
||||
#include <assert.h>
|
||||
|
||||
// need C definitions
|
||||
extern "C" {
|
||||
#define GSdefs
|
||||
#include "PS2Edefs.h"
|
||||
|
||||
extern "C" u32 CALLBACK PS2EgetLibType(void);
|
||||
extern "C" u32 CALLBACK PS2EgetLibVersion2(u32 type);
|
||||
extern "C" char* CALLBACK PS2EgetLibName(void);
|
||||
}
|
||||
|
||||
#include "zerogsmath.h"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <assert.h>
|
||||
|
||||
#include <vector>
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
extern std::string s_strIniPath;
|
||||
|
||||
extern u32 THR_KeyEvent; // value for passing out key events beetwen threads
|
||||
extern bool THR_bShift;
|
||||
|
||||
#if !defined(_MSC_VER)
|
||||
// declare linux equivalents (alignment must be power of 2 (1,2,4...2^15)
|
||||
static __forceinline void* _aligned_malloc(size_t size, size_t alignment) {
|
||||
void *result=0;
|
||||
posix_memalign(&result, alignment, size);
|
||||
return result;
|
||||
}
|
||||
|
||||
static __forceinline void _aligned_free(void* p) {
|
||||
free(p);
|
||||
}
|
||||
#endif
|
||||
|
||||
#include <sys/timeb.h> // ftime(), struct timeb
|
||||
|
||||
inline unsigned long timeGetTime()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
_timeb t;
|
||||
_ftime(&t);
|
||||
#else
|
||||
timeb t;
|
||||
ftime(&t);
|
||||
#endif
|
||||
|
||||
return (unsigned long)(t.time*1000+t.millitm);
|
||||
}
|
||||
|
||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
|
||||
struct RECT
|
||||
{
|
||||
int left, top;
|
||||
int right, bottom;
|
||||
};
|
||||
|
||||
#define GL_X11_WINDOW
|
||||
|
||||
class GLWindow
|
||||
{
|
||||
private:
|
||||
#ifdef GL_X11_WINDOW
|
||||
Display *glDisplay;
|
||||
Window glWindow;
|
||||
int glScreen;
|
||||
GLXContext context;
|
||||
XSetWindowAttributes attr;
|
||||
XF86VidModeModeInfo deskMode;
|
||||
#endif
|
||||
bool fullScreen, doubleBuffered;
|
||||
s32 x, y;
|
||||
u32 width, height, depth;
|
||||
|
||||
public:
|
||||
void SwapBuffers();
|
||||
void SetTitle(char *strtitle);
|
||||
bool CreateWindow(void *pDisplay);
|
||||
bool DestroyWindow();
|
||||
void CloseWindow();
|
||||
void DisplayWindow(int _width, int _height);
|
||||
void ResizeCheck();
|
||||
};
|
||||
|
||||
extern GLWindow GLWin;
|
||||
|
||||
#endif // linux basic definitions
|
||||
|
||||
struct Vector_16F
|
||||
{
|
||||
u16 x, y, z, w;
|
||||
};
|
||||
|
||||
/////////////////////
|
||||
|
||||
#ifdef ZEROGS_DEVBUILD
|
||||
#define GS_LOG __Log
|
||||
#else
|
||||
#define GS_LOG 0&&
|
||||
#endif
|
||||
|
||||
#define ERROR_LOG __LogToConsole
|
||||
#define DEBUG_LOG printf
|
||||
|
||||
#ifndef ZEROGS_DEVBUILD
|
||||
#define WARN_LOG 0&&
|
||||
#define PRIM_LOG 0&&
|
||||
#else
|
||||
#define WARN_LOG printf
|
||||
#define PRIM_LOG if (conf.log & 0x00000010) GS_LOG
|
||||
#endif
|
||||
|
||||
#ifndef GREG_LOG
|
||||
#define GREG_LOG 0&&
|
||||
#endif
|
||||
#ifndef PRIM_LOG
|
||||
#define PRIM_LOG 0&&
|
||||
#endif
|
||||
#ifndef WARN_LOG
|
||||
#define WARN_LOG 0&&
|
||||
#endif
|
||||
|
||||
#define REG64(name) \
|
||||
union name \
|
||||
{ \
|
||||
u64 i64; \
|
||||
u32 ai32[2]; \
|
||||
struct { \
|
||||
|
||||
#define REG128(name)\
|
||||
union name \
|
||||
{ \
|
||||
u64 ai64[2]; \
|
||||
u32 ai32[4]; \
|
||||
struct { \
|
||||
|
||||
#define REG64_(prefix, name) REG64(prefix##name)
|
||||
#define REG128_(prefix, name) REG128(prefix##name)
|
||||
|
||||
#define REG_END }; };
|
||||
#define REG_END2 };
|
||||
|
||||
#define REG64_SET(name) \
|
||||
union name \
|
||||
{ \
|
||||
u64 i64; \
|
||||
u32 ai32[2]; \
|
||||
|
||||
#define REG128_SET(name)\
|
||||
union name \
|
||||
{ \
|
||||
u64 ai64[2]; \
|
||||
u32 ai32[4]; \
|
||||
|
||||
#define REG_SET_END };
|
||||
|
||||
REG64_(GSReg, BGCOLOR)
|
||||
u32 R:8;
|
||||
u32 G:8;
|
||||
u32 B:8;
|
||||
u32 _PAD1:8;
|
||||
u32 _PAD2:32;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, BUSDIR)
|
||||
u32 DIR:1;
|
||||
u32 _PAD1:31;
|
||||
u32 _PAD2:32;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, CSR)
|
||||
u32 SIGNAL:1;
|
||||
u32 FINISH:1;
|
||||
u32 HSINT:1;
|
||||
u32 VSINT:1;
|
||||
u32 EDWINT:1;
|
||||
u32 ZERO1:1;
|
||||
u32 ZERO2:1;
|
||||
u32 _PAD1:1;
|
||||
u32 FLUSH:1;
|
||||
u32 RESET:1;
|
||||
u32 _PAD2:2;
|
||||
u32 NFIELD:1;
|
||||
u32 FIELD:1;
|
||||
u32 FIFO:2;
|
||||
u32 REV:8;
|
||||
u32 ID:8;
|
||||
u32 _PAD3:32;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, DISPFB) // (-1/2)
|
||||
u32 FBP:9;
|
||||
u32 FBW:6;
|
||||
u32 PSM:5;
|
||||
u32 _PAD:12;
|
||||
u32 DBX:11;
|
||||
u32 DBY:11;
|
||||
u32 _PAD2:10;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, DISPLAY) // (-1/2)
|
||||
u32 DX:12;
|
||||
u32 DY:11;
|
||||
u32 MAGH:4;
|
||||
u32 MAGV:2;
|
||||
u32 _PAD:3;
|
||||
u32 DW:12;
|
||||
u32 DH:11;
|
||||
u32 _PAD2:9;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, EXTBUF)
|
||||
u32 EXBP:14;
|
||||
u32 EXBW:6;
|
||||
u32 FBIN:2;
|
||||
u32 WFFMD:1;
|
||||
u32 EMODA:2;
|
||||
u32 EMODC:2;
|
||||
u32 _PAD1:5;
|
||||
u32 WDX:11;
|
||||
u32 WDY:11;
|
||||
u32 _PAD2:10;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, EXTDATA)
|
||||
u32 SX:12;
|
||||
u32 SY:11;
|
||||
u32 SMPH:4;
|
||||
u32 SMPV:2;
|
||||
u32 _PAD1:3;
|
||||
u32 WW:12;
|
||||
u32 WH:11;
|
||||
u32 _PAD2:9;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, EXTWRITE)
|
||||
u32 WRITE;
|
||||
u32 _PAD2:32;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, IMR)
|
||||
u32 _PAD1:8;
|
||||
u32 SIGMSK:1;
|
||||
u32 FINISHMSK:1;
|
||||
u32 HSMSK:1;
|
||||
u32 VSMSK:1;
|
||||
u32 EDWMSK:1;
|
||||
u32 _PAD2:19;
|
||||
u32 _PAD3:32;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, PMODE)
|
||||
u32 EN1:1;
|
||||
u32 EN2:1;
|
||||
u32 CRTMD:3;
|
||||
u32 MMOD:1;
|
||||
u32 AMOD:1;
|
||||
u32 SLBG:1;
|
||||
u32 ALP:8;
|
||||
u32 _PAD:16;
|
||||
u32 _PAD1:32;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, SIGLBLID)
|
||||
u32 SIGID:32;
|
||||
u32 LBLID:32;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, SMODE1)
|
||||
u32 RC:3;
|
||||
u32 LC:7;
|
||||
u32 T1248:2;
|
||||
u32 SLCK:1;
|
||||
u32 CMOD:2;
|
||||
u32 EX:1;
|
||||
u32 PRST:1;
|
||||
u32 SINT:1;
|
||||
u32 XPCK:1;
|
||||
u32 PCK2:2;
|
||||
u32 SPML:4;
|
||||
u32 GCONT:1;
|
||||
u32 PHS:1;
|
||||
u32 PVS:1;
|
||||
u32 PEHS:1;
|
||||
u32 PEVS:1;
|
||||
u32 CLKSEL:2;
|
||||
u32 NVCK:1;
|
||||
u32 SLCK2:1;
|
||||
u32 VCKSEL:2;
|
||||
u32 VHP:1;
|
||||
u32 _PAD1:27;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, SMODE2)
|
||||
u32 INT:1;
|
||||
u32 FFMD:1;
|
||||
u32 DPMS:2;
|
||||
u32 _PAD2:28;
|
||||
u32 _PAD3:32;
|
||||
REG_END
|
||||
|
||||
REG64_(GSReg, SIGBLID)
|
||||
u32 SIGID;
|
||||
u32 LBLID;
|
||||
REG_END
|
||||
|
||||
extern int g_LastCRC;
|
||||
extern u8* g_pBasePS2Mem;
|
||||
|
||||
#define PMODE ((GSRegPMODE*)(g_pBasePS2Mem+0x0000))
|
||||
#define SMODE1 ((GSRegSMODE1*)(g_pBasePS2Mem+0x0010))
|
||||
#define SMODE2 ((GSRegSMODE2*)(g_pBasePS2Mem+0x0020))
|
||||
// SRFSH
|
||||
#define SYNCH1 ((GSRegSYNCH1*)(g_pBasePS2Mem+0x0040))
|
||||
#define SYNCH2 ((GSRegSYNCH2*)(g_pBasePS2Mem+0x0050))
|
||||
#define SYNCV ((GSRegSYNCV*)(g_pBasePS2Mem+0x0060))
|
||||
#define DISPFB1 ((GSRegDISPFB*)(g_pBasePS2Mem+0x0070))
|
||||
#define DISPLAY1 ((GSRegDISPLAY*)(g_pBasePS2Mem+0x0080))
|
||||
#define DISPFB2 ((GSRegDISPFB*)(g_pBasePS2Mem+0x0090))
|
||||
#define DISPLAY2 ((GSRegDISPLAY*)(g_pBasePS2Mem+0x00a0))
|
||||
#define EXTBUF ((GSRegEXTBUF*)(g_pBasePS2Mem+0x00b0))
|
||||
#define EXTDATA ((GSRegEXTDATA*)(g_pBasePS2Mem+0x00c0))
|
||||
#define EXTWRITE ((GSRegEXTWRITE*)(g_pBasePS2Mem+0x00d0))
|
||||
#define BGCOLOR ((GSRegBGCOLOR*)(g_pBasePS2Mem+0x00e0))
|
||||
#define CSR ((GSRegCSR*)(g_pBasePS2Mem+0x1000))
|
||||
#define IMR ((GSRegIMR*)(g_pBasePS2Mem+0x1010))
|
||||
#define BUSDIR ((GSRegBUSDIR*)(g_pBasePS2Mem+0x1040))
|
||||
#define SIGLBLID ((GSRegSIGBLID*)(g_pBasePS2Mem+0x1080))
|
||||
|
||||
#define GET_GSFPS (((SMODE1->CMOD&1) ? 50 : 60) / (SMODE2->INT ? 1 : 2))
|
||||
|
||||
//
|
||||
// sps2tags.h
|
||||
//
|
||||
#ifdef _M_AMD64
|
||||
#define GET_GIF_REG(tag, reg) \
|
||||
(((tag).ai64[1] >> ((reg) << 2)) & 0xf)
|
||||
#else
|
||||
#define GET_GIF_REG(tag, reg) \
|
||||
(((tag).ai32[2 + ((reg) >> 3)] >> (((reg) & 7) << 2)) & 0xf)
|
||||
#endif
|
||||
|
||||
//
|
||||
// GIFTag
|
||||
REG128(GIFTag)
|
||||
u32 NLOOP:15;
|
||||
u32 EOP:1;
|
||||
u32 _PAD1:16;
|
||||
u32 _PAD2:14;
|
||||
u32 PRE:1;
|
||||
u32 PRIM:11;
|
||||
u32 FLG:2; // enum GIF_FLG
|
||||
u32 NREG:4;
|
||||
u64 REGS:64;
|
||||
REG_END
|
||||
|
||||
typedef struct {
|
||||
int x, y, w, h;
|
||||
} Rect;
|
||||
|
||||
typedef struct {
|
||||
int x, y;
|
||||
} Point;
|
||||
|
||||
typedef struct {
|
||||
int x0, y0;
|
||||
int x1, y1;
|
||||
} Rect2;
|
||||
|
||||
typedef struct {
|
||||
int x, y, c;
|
||||
} PointC;
|
||||
|
||||
#define GSOPTION_FULLSCREEN 0x2
|
||||
#define GSOPTION_TGASNAP 0x4
|
||||
#define GSOPTION_CAPTUREAVI 0x8
|
||||
|
||||
#define GSOPTION_WINDIMS 0x30
|
||||
#define GSOPTION_WIN640 0x00
|
||||
#define GSOPTION_WIN800 0x10
|
||||
#define GSOPTION_WIN1024 0x20
|
||||
#define GSOPTION_WIN1280 0x30
|
||||
|
||||
#define GSOPTION_WIREFRAME 0x100
|
||||
#define GSOPTION_LOADED 0x8000
|
||||
|
||||
typedef struct {
|
||||
u8 mrtdepth; // write color in render target
|
||||
u8 interlace;
|
||||
u8 aa; // antialiasing 0 - off, 1 - 2x, 2 - 4x
|
||||
u8 bilinear; // set to enable bilinear support
|
||||
u32 options;
|
||||
u32 gamesettings; // default game settings
|
||||
int width, height;
|
||||
int winstyle; // window style before full screen
|
||||
#ifdef GS_LOG
|
||||
u32 log;
|
||||
#endif
|
||||
} GSconf;
|
||||
|
||||
struct VertexGPU
|
||||
{
|
||||
s16 x, y, f, resv0; // note: xy is 12d3
|
||||
u32 rgba;
|
||||
u32 z;
|
||||
float s, t, q;
|
||||
};
|
||||
|
||||
struct Vertex
|
||||
{
|
||||
u16 x, y, f, resv0; // note: xy is 12d3
|
||||
u32 rgba;
|
||||
u32 z;
|
||||
float s, t, q;
|
||||
u16 u, v;
|
||||
};
|
||||
|
||||
extern int g_GameSettings;
|
||||
extern GSconf conf;
|
||||
extern int ppf;
|
||||
|
||||
// PSM values
|
||||
// PSM types == Texture Storage Format
|
||||
enum PSM_value{
|
||||
PSMCT32 = 0, // 000000
|
||||
PSMCT24 = 1, // 000001
|
||||
PSMCT16 = 2, // 000010
|
||||
PSMCT16S = 10, // 001010
|
||||
PSMT8 = 19, // 010011
|
||||
PSMT4 = 20, // 010100
|
||||
PSMT8H = 27, // 011011
|
||||
PSMT4HL = 36, // 100100
|
||||
PSMT4HH = 44, // 101100
|
||||
PSMT32Z = 48, // 110000
|
||||
PSMT24Z = 49, // 110001
|
||||
PSMT16Z = 50, // 110010
|
||||
PSMT16SZ = 58, // 111010
|
||||
};
|
||||
|
||||
static __forceinline bool PSMT_ISCLUT(u32 psm) { return ((psm & 0x7) > 2);}
|
||||
static __forceinline bool PSMT_IS16BIT(u32 psm) { return ((psm & 0x7) == 2);}
|
||||
|
||||
typedef struct {
|
||||
int nloop;
|
||||
int eop;
|
||||
int nreg;
|
||||
} tagInfo;
|
||||
|
||||
typedef union {
|
||||
s64 SD;
|
||||
u64 UD;
|
||||
s32 SL[2];
|
||||
u32 UL[2];
|
||||
s16 SS[4];
|
||||
u16 US[4];
|
||||
s8 SC[8];
|
||||
u8 UC[8];
|
||||
} reg64;
|
||||
|
||||
/* general purpose regs structs */
|
||||
typedef struct {
|
||||
int fbp;
|
||||
int fbw;
|
||||
int fbh;
|
||||
int psm;
|
||||
u32 fbm;
|
||||
} frameInfo;
|
||||
|
||||
typedef struct {
|
||||
u16 prim;
|
||||
|
||||
union {
|
||||
struct {
|
||||
u16 iip : 1;
|
||||
u16 tme : 1;
|
||||
u16 fge : 1;
|
||||
u16 abe : 1;
|
||||
u16 aa1 : 1;
|
||||
u16 fst : 1;
|
||||
u16 ctxt : 1;
|
||||
u16 fix : 1;
|
||||
u16 resv : 8;
|
||||
};
|
||||
u16 _val;
|
||||
};
|
||||
} primInfo;
|
||||
|
||||
extern primInfo *prim;
|
||||
|
||||
typedef union {
|
||||
struct {
|
||||
u32 ate : 1;
|
||||
u32 atst : 3;
|
||||
u32 aref : 8;
|
||||
u32 afail : 2;
|
||||
u32 date : 1;
|
||||
u32 datm : 1;
|
||||
u32 zte : 1;
|
||||
u32 ztst : 2;
|
||||
u32 resv : 13;
|
||||
};
|
||||
u32 _val;
|
||||
} pixTest;
|
||||
|
||||
typedef struct {
|
||||
int bp;
|
||||
int bw;
|
||||
int psm;
|
||||
} bufInfo;
|
||||
|
||||
typedef struct {
|
||||
int tbp0;
|
||||
int tbw;
|
||||
int cbp;
|
||||
u16 tw, th;
|
||||
u8 psm;
|
||||
u8 tcc;
|
||||
u8 tfx;
|
||||
u8 cpsm;
|
||||
u8 csm;
|
||||
u8 csa;
|
||||
u8 cld;
|
||||
} tex0Info;
|
||||
|
||||
#define TEX_MODULATE 0
|
||||
#define TEX_DECAL 1
|
||||
#define TEX_HIGHLIGHT 2
|
||||
#define TEX_HIGHLIGHT2 3
|
||||
|
||||
typedef struct {
|
||||
int lcm;
|
||||
int mxl;
|
||||
int mmag;
|
||||
int mmin;
|
||||
int mtba;
|
||||
int l;
|
||||
int k;
|
||||
} tex1Info;
|
||||
|
||||
typedef struct {
|
||||
int wms;
|
||||
int wmt;
|
||||
int minu;
|
||||
int maxu;
|
||||
int minv;
|
||||
int maxv;
|
||||
} clampInfo;
|
||||
|
||||
typedef struct {
|
||||
int cbw;
|
||||
int cou;
|
||||
int cov;
|
||||
} clutInfo;
|
||||
|
||||
typedef struct {
|
||||
int tbp[3];
|
||||
int tbw[3];
|
||||
} miptbpInfo;
|
||||
|
||||
typedef struct {
|
||||
u16 aem;
|
||||
u8 ta[2];
|
||||
float fta[2];
|
||||
} texaInfo;
|
||||
|
||||
typedef struct {
|
||||
int sx;
|
||||
int sy;
|
||||
int dx;
|
||||
int dy;
|
||||
int dir;
|
||||
} trxposInfo;
|
||||
|
||||
typedef struct {
|
||||
union {
|
||||
struct {
|
||||
u8 a : 2;
|
||||
u8 b : 2;
|
||||
u8 c : 2;
|
||||
u8 d : 2;
|
||||
};
|
||||
u8 abcd;
|
||||
};
|
||||
|
||||
u8 fix : 8;
|
||||
} alphaInfo;
|
||||
|
||||
typedef struct {
|
||||
u16 zbp; // u16 address / 64
|
||||
u8 psm;
|
||||
u8 zmsk;
|
||||
} zbufInfo;
|
||||
|
||||
typedef struct {
|
||||
int fba;
|
||||
} fbaInfo;
|
||||
|
||||
typedef struct {
|
||||
int mode;
|
||||
int regn;
|
||||
u64 regs;
|
||||
tagInfo tag;
|
||||
} pathInfo;
|
||||
|
||||
typedef struct {
|
||||
Vertex gsvertex[3];
|
||||
u32 rgba;
|
||||
float q;
|
||||
Vertex vertexregs;
|
||||
|
||||
int primC; // number of verts current storing
|
||||
int primIndex; // current prim index
|
||||
int nTriFanVert;
|
||||
|
||||
int prac;
|
||||
int dthe;
|
||||
int colclamp;
|
||||
int fogcol;
|
||||
int smask;
|
||||
int pabe;
|
||||
u64 buff[2];
|
||||
int buffsize;
|
||||
int cbp[2]; // internal cbp registers
|
||||
|
||||
u32 CSRw;
|
||||
|
||||
primInfo _prim[2];
|
||||
bufInfo srcbuf, srcbufnew;
|
||||
bufInfo dstbuf, dstbufnew;
|
||||
|
||||
clutInfo clut;
|
||||
|
||||
texaInfo texa;
|
||||
trxposInfo trxpos, trxposnew;
|
||||
|
||||
int imageWtemp, imageHtemp;
|
||||
|
||||
int imageTransfer;
|
||||
int imageWnew, imageHnew, imageX, imageY, imageEndX, imageEndY;
|
||||
|
||||
pathInfo path1;
|
||||
pathInfo path2;
|
||||
pathInfo path3;
|
||||
|
||||
} GSinternal;
|
||||
|
||||
extern GSinternal gs;
|
||||
|
||||
extern FILE *gsLog;
|
||||
|
||||
void __Log(const char *fmt, ...);
|
||||
void __LogToConsole(const char *fmt, ...);
|
||||
|
||||
void LoadConfig();
|
||||
void SaveConfig();
|
||||
|
||||
extern void (*GSirq)();
|
||||
|
||||
void *SysLoadLibrary(char *lib); // Loads Library
|
||||
void *SysLoadSym(void *lib, char *sym); // Loads Symbol from Library
|
||||
char *SysLibError(); // Gets previous error loading sysbols
|
||||
void SysCloseLibrary(void *lib); // Closes Library
|
||||
void SysMessage(char *fmt, ...);
|
||||
|
||||
extern "C" u8 memcmp_mmx(const void *dest, const void *src, int n);
|
||||
|
||||
template <typename T>
|
||||
class CInterfacePtr
|
||||
{
|
||||
public:
|
||||
inline CInterfacePtr() : ptr(NULL) {}
|
||||
inline explicit CInterfacePtr(T* newptr) : ptr(newptr) { if ( ptr != NULL ) ptr->AddRef(); }
|
||||
inline ~CInterfacePtr() { if( ptr != NULL ) ptr->Release(); }
|
||||
|
||||
inline T* operator* () { assert( ptr != NULL); return *ptr; }
|
||||
inline T* operator->() { return ptr; }
|
||||
inline T* get() { return ptr; }
|
||||
|
||||
inline void release() {
|
||||
if( ptr != NULL ) { ptr->Release(); ptr = NULL; }
|
||||
}
|
||||
|
||||
inline operator T*() { return ptr; }
|
||||
|
||||
inline bool operator==(T* rhs) { return ptr == rhs; }
|
||||
inline bool operator!=(T* rhs) { return ptr != rhs; }
|
||||
|
||||
inline CInterfacePtr& operator= (T* newptr) {
|
||||
if( ptr != NULL ) ptr->Release();
|
||||
ptr = newptr;
|
||||
|
||||
if( ptr != NULL ) ptr->AddRef();
|
||||
return *this;
|
||||
}
|
||||
|
||||
private:
|
||||
T* ptr;
|
||||
};
|
||||
|
||||
#define RGBA32to16(c) \
|
||||
(u16)((((c) & 0x000000f8) >> 3) | \
|
||||
(((c) & 0x0000f800) >> 6) | \
|
||||
(((c) & 0x00f80000) >> 9) | \
|
||||
(((c) & 0x80000000) >> 16)) \
|
||||
|
||||
#define RGBA16to32(c) \
|
||||
(((c) & 0x001f) << 3) | \
|
||||
(((c) & 0x03e0) << 6) | \
|
||||
(((c) & 0x7c00) << 9) | \
|
||||
(((c) & 0x8000) ? 0xff000000 : 0) \
|
||||
|
||||
// converts float16 [0,1] to BYTE [0,255] (assumes value is in range, otherwise will take lower 8bits)
|
||||
// f is a u16
|
||||
static __forceinline u16 Float16ToBYTE(u16 f) {
|
||||
//assert( !(f & 0x8000) );
|
||||
if( f & 0x8000 ) return 0;
|
||||
|
||||
u16 d = ((((f&0x3ff)|0x400)*255)>>(10-((f>>10)&0x1f)+15));
|
||||
return d > 255 ? 255 : d;
|
||||
}
|
||||
|
||||
static __forceinline u16 Float16ToALPHA(u16 f) {
|
||||
//assert( !(f & 0x8000) );
|
||||
if( f & 0x8000 ) return 0;
|
||||
|
||||
// round up instead of down (crash and burn), too much and charlie breaks
|
||||
u16 d = (((((f&0x3ff)|0x400))*255)>>(10-((f>>10)&0x1f)+15));
|
||||
d = (d)>>1;
|
||||
return d > 255 ? 255 : d;
|
||||
}
|
||||
|
||||
#ifndef COLOR_ARGB
|
||||
#define COLOR_ARGB(a,r,g,b) \
|
||||
((u32)((((a)&0xff)<<24)|(((r)&0xff)<<16)|(((g)&0xff)<<8)|((b)&0xff)))
|
||||
#endif
|
||||
|
||||
// assumes that positive in [1,2] (then extracts fraction by just looking at the specified bits)
|
||||
#define Float16ToBYTE_2(f) ((u8)(*(u16*)&f>>2))
|
||||
#define Float16To5BIT(f) (Float16ToBYTE(f)>>3)
|
||||
|
||||
#define Float16Alpha(f) (((*(u16*)&f&0x7c00)>=0x3900)?0x8000:0) // alpha is >= 1
|
||||
|
||||
// converts an array of 4 u16s to a u32 color
|
||||
// f is a pointer to a u16
|
||||
#define Float16ToARGB(f) COLOR_ARGB(Float16ToALPHA(f.w), Float16ToBYTE(f.x), Float16ToBYTE(f.y), Float16ToBYTE(f.z));
|
||||
|
||||
#define Float16ToARGB16(f) (Float16Alpha(f.w)|(Float16To5BIT(f.x)<<10)|(Float16To5BIT(f.y)<<5)|Float16To5BIT(f.z))
|
||||
|
||||
// used for Z values
|
||||
#define Float16ToARGB_Z(f) COLOR_ARGB((u32)Float16ToBYTE_2(f.w), Float16ToBYTE_2(f.x), Float16ToBYTE_2(f.y), Float16ToBYTE_2(f.z))
|
||||
#define Float16ToARGB16_Z(f) ((Float16ToBYTE_2(f.y)<<8)|Float16ToBYTE_2(f.z))
|
||||
|
||||
|
||||
inline float Clamp(float fx, float fmin, float fmax)
|
||||
{
|
||||
if( fx < fmin ) return fmin;
|
||||
return fx > fmax ? fmax : fx;
|
||||
}
|
||||
|
||||
// IMPORTANT: For every Register there must be an End
|
||||
void DVProfRegister(char* pname); // first checks if this profiler exists in g_listProfilers
|
||||
void DVProfEnd(u32 dwUserData);
|
||||
void DVProfWrite(char* pfilename, u32 frames = 0);
|
||||
void DVProfClear(); // clears all the profilers
|
||||
|
||||
#define DVPROFILE
|
||||
#ifdef DVPROFILE
|
||||
|
||||
class DVProfileFunc
|
||||
{
|
||||
public:
|
||||
u32 dwUserData;
|
||||
DVProfileFunc(char* pname) { DVProfRegister(pname); dwUserData = 0; }
|
||||
DVProfileFunc(char* pname, u32 dwUserData) : dwUserData(dwUserData) { DVProfRegister(pname); }
|
||||
~DVProfileFunc() { DVProfEnd(dwUserData); }
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
class DVProfileFunc
|
||||
{
|
||||
public:
|
||||
u32 dwUserData;
|
||||
static __forceinline DVProfileFunc(char* pname) {}
|
||||
static __forceinline DVProfileFunc(char* pname, u32 dwUserData) { }
|
||||
~DVProfileFunc() {}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -1,312 +0,0 @@
|
|||
/* ZeroGS KOSMOS
|
||||
* Copyright (C) 2005-2006 zerofrog@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 "GifTransfer.h"
|
||||
|
||||
void GIFtag(pathInfo *path, u32 *data) {
|
||||
|
||||
path->tag.nloop = data[0] & 0x7fff;
|
||||
path->tag.eop = (data[0] >> 15) & 0x1;
|
||||
u32 tagpre = (data[1] >> 14) & 0x1;
|
||||
u32 tagprim = (data[1] >> 15) & 0x7ff;
|
||||
u32 tagflg = (data[1] >> 26) & 0x3;
|
||||
path->tag.nreg = (data[1] >> 28)<<2;
|
||||
|
||||
if (path->tag.nreg == 0) path->tag.nreg = 64;
|
||||
|
||||
gs.q = 1;
|
||||
|
||||
// GS_LOG("GIFtag: %8.8lx_%8.8lx_%8.8lx_%8.8lx: EOP=%d, NLOOP=%x, FLG=%x, NREG=%d, PRE=%d\n",
|
||||
// data[3], data[2], data[1], data[0],
|
||||
// path->tag.eop, path->tag.nloop, tagflg, path->tag.nreg, tagpre);
|
||||
|
||||
path->mode = tagflg+1;
|
||||
|
||||
switch (tagflg) {
|
||||
case 0x0:
|
||||
path->regs = *(u64 *)(data+2);
|
||||
path->regn = 0;
|
||||
if (tagpre)
|
||||
GIFRegHandlerPRIM((u32*)&tagprim);
|
||||
|
||||
break;
|
||||
|
||||
case 0x1:
|
||||
path->regs = *(u64 *)(data+2);
|
||||
path->regn = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void _GSgifPacket(pathInfo *path, u32 *pMem) { // 128bit
|
||||
|
||||
int reg = (int)((path->regs >> path->regn) & 0xf);
|
||||
g_GIFPackedRegHandlers[reg](pMem);
|
||||
|
||||
path->regn += 4;
|
||||
if (path->tag.nreg == path->regn) {
|
||||
path->regn = 0;
|
||||
path->tag.nloop--;
|
||||
}
|
||||
}
|
||||
|
||||
void _GSgifRegList(pathInfo *path, u32 *pMem) { // 64bit
|
||||
int reg;
|
||||
|
||||
reg = (int)((path->regs >> path->regn) & 0xf);
|
||||
|
||||
g_GIFRegHandlers[reg](pMem);
|
||||
path->regn += 4;
|
||||
if (path->tag.nreg == path->regn) {
|
||||
path->regn = 0;
|
||||
path->tag.nloop--;
|
||||
}
|
||||
}
|
||||
|
||||
static int nPath3Hack = 0;
|
||||
|
||||
void CALLBACK GSgetLastTag(u64* ptag)
|
||||
{
|
||||
*(u32*)ptag = nPath3Hack;
|
||||
nPath3Hack = 0;
|
||||
}
|
||||
|
||||
void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
assert( g_hCurrentThread == GetCurrentThread() );
|
||||
#endif
|
||||
|
||||
#ifdef _DEBUG
|
||||
if( conf.log & 0x20 ) {
|
||||
static int nSaveIndex=0;
|
||||
GS_LOG("%d: p:%d %x\n", nSaveIndex++, (path==&gs.path3)?3:(path==&gs.path2?2:1), size);
|
||||
int vals[4] = {0};
|
||||
for(int i = 0; i < size; i++) {
|
||||
for(int j = 0; j < 4; ++j )
|
||||
vals[j] ^= pMem[4*i+j];
|
||||
}
|
||||
GS_LOG("%x %x %x %x\n", vals[0], vals[1], vals[2], vals[3]);
|
||||
}
|
||||
#endif
|
||||
|
||||
while(size > 0)
|
||||
{
|
||||
//LOG(_T("Transfer(%08x, %d) START\n"), pMem, size);
|
||||
if (path->tag.nloop == 0)
|
||||
{
|
||||
GIFtag(path, pMem);
|
||||
pMem+= 4;
|
||||
size--;
|
||||
|
||||
if ((g_GameSettings & GAME_PATH3HACK) && path == &gs.path3 && gs.path3.tag.eop)
|
||||
nPath3Hack = 1;
|
||||
|
||||
if (path == &gs.path1)
|
||||
{
|
||||
// if too much data, just ignore
|
||||
if (path->tag.nloop * (path->tag.nreg / 4) > (int)size * (path->mode==2?2:1))
|
||||
{
|
||||
static int lasttime = 0;
|
||||
if( timeGetTime() - lasttime > 5000 )
|
||||
{
|
||||
ERROR_LOG("VU1 too much data, ignore if gfx are fine\n");
|
||||
lasttime = timeGetTime();
|
||||
}
|
||||
path->tag.nloop = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
if (path->mode == 1)
|
||||
{
|
||||
// check if 0xb is in any reg, if yes, exit (kh2)
|
||||
for(int i = 0; i < path->tag.nreg; i += 4)
|
||||
{
|
||||
if (((path->regs >> i)&0xf) == 11)
|
||||
{
|
||||
static int lasttime = 0;
|
||||
if( timeGetTime() - lasttime > 5000 )
|
||||
{
|
||||
ERROR_LOG("Invalid unpack type\n");
|
||||
lasttime = timeGetTime();
|
||||
}
|
||||
path->tag.nloop = 0;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(path->tag.nloop == 0 )
|
||||
{
|
||||
if( path == &gs.path1 )
|
||||
{
|
||||
// ffx hack
|
||||
/*if( g_GameSettings & GAME_FFXHACK )
|
||||
{*/
|
||||
if( path->tag.eop )
|
||||
return;
|
||||
continue;
|
||||
/*}*/
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if( !path->tag.eop )
|
||||
{
|
||||
//DEBUG_LOG("continuing from eop\n");
|
||||
continue;
|
||||
}
|
||||
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
switch(path->mode) {
|
||||
case 1: // PACKED
|
||||
{
|
||||
assert( path->tag.nloop > 0 );
|
||||
for(; size > 0; size--, pMem += 4)
|
||||
{
|
||||
int reg = (int)((path->regs >> path->regn) & 0xf);
|
||||
|
||||
g_GIFPackedRegHandlers[reg](pMem);
|
||||
|
||||
path->regn += 4;
|
||||
if (path->tag.nreg == path->regn)
|
||||
{
|
||||
path->regn = 0;
|
||||
if( path->tag.nloop-- <= 1 )
|
||||
{
|
||||
size--;
|
||||
pMem += 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 2: // REGLIST
|
||||
{
|
||||
//GS_LOG("%8.8x%8.8x %d L\n", ((u32*)&gs.regs)[1], *(u32*)&gs.regs, path->tag.nreg/4);
|
||||
assert( path->tag.nloop > 0 );
|
||||
size *= 2;
|
||||
for(; size > 0; pMem+= 2, size--)
|
||||
{
|
||||
int reg = (int)((path->regs >> path->regn) & 0xf);
|
||||
g_GIFRegHandlers[reg](pMem);
|
||||
path->regn += 4;
|
||||
if (path->tag.nreg == path->regn)
|
||||
{
|
||||
path->regn = 0;
|
||||
if( path->tag.nloop-- <= 1 )
|
||||
{
|
||||
size--;
|
||||
pMem += 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( size & 1 ) pMem += 2;
|
||||
size /= 2;
|
||||
break;
|
||||
}
|
||||
case 3: // GIF_IMAGE (FROM_VFRAM)
|
||||
case 4: // Used in the DirectX version, so we'll use it here too.
|
||||
{
|
||||
if(gs.imageTransfer >= 0 && gs.imageTransfer <= 1)
|
||||
{
|
||||
int process = min((int)size, path->tag.nloop);
|
||||
|
||||
if( process > 0 )
|
||||
{
|
||||
if ( gs.imageTransfer )
|
||||
ZeroGS::TransferLocalHost(pMem, process);
|
||||
else
|
||||
ZeroGS::TransferHostLocal(pMem, process*4);
|
||||
|
||||
path->tag.nloop -= process;
|
||||
pMem += process*4; size -= process;
|
||||
|
||||
assert( size == 0 || path->tag.nloop == 0 );
|
||||
}
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
// simulate
|
||||
int process = min((int)size, path->tag.nloop);
|
||||
path->tag.nloop -= process;
|
||||
pMem += process*4; size -= process;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default: // GIF_IMAGE
|
||||
GS_LOG("*** WARNING **** Unexpected GIFTag flag\n");
|
||||
assert(0);
|
||||
path->tag.nloop = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
if( path == &gs.path1 && path->tag.eop )
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void CALLBACK GSgifTransfer2(u32 *pMem, u32 size)
|
||||
{
|
||||
//GS_LOG("GSgifTransfer2 size = %lx (mode %d, gs.path2.tag.nloop = %d)\n", size, gs.path2.mode, gs.path2.tag.nloop);
|
||||
|
||||
_GSgifTransfer(&gs.path2, pMem, size);
|
||||
}
|
||||
|
||||
void CALLBACK GSgifTransfer3(u32 *pMem, u32 size)
|
||||
{
|
||||
//GS_LOG("GSgifTransfer3 size = %lx (mode %d, gs.path3.tag.nloop = %d)\n", size, gs.path3.mode, gs.path3.tag.nloop);
|
||||
|
||||
nPath3Hack = 0;
|
||||
_GSgifTransfer(&gs.path3, pMem, size);
|
||||
}
|
||||
|
||||
static int count = 0;
|
||||
void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr)
|
||||
{
|
||||
pathInfo *path = &gs.path1;
|
||||
|
||||
//GS_LOG("GSgifTransfer1 0x%x (mode %d)\n", addr, path->mode);
|
||||
|
||||
addr &= 0x3fff;
|
||||
|
||||
#ifdef _DEBUG
|
||||
PRIM_LOG("count: %d\n", count);
|
||||
count++;
|
||||
#endif
|
||||
|
||||
gs.path1.tag.nloop = 0;
|
||||
gs.path1.tag.eop = 0;
|
||||
_GSgifTransfer(&gs.path1, (u32*)((u8*)pMem+addr), (0x4000-addr)/16);
|
||||
|
||||
if( !gs.path1.tag.eop && gs.path1.tag.nloop > 0 ) {
|
||||
assert( (addr&0xf) == 0 ); //BUG
|
||||
gs.path1.tag.nloop = 0;
|
||||
ERROR_LOG("Transfer1 - 2\n");
|
||||
return;
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
/* ZeroGS KOSMOS
|
||||
* Copyright (C) 2005-2006 zerofrog@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 "GS.h"
|
||||
#include "Mem.h"
|
||||
#include "Regs.h"
|
||||
#include "zerogs.h"
|
||||
|
||||
void GIFtag(pathInfo *path, u32 *data);
|
||||
void _GSgifPacket(pathInfo *path, u32 *pMem);
|
||||
void _GSgifRegList(pathInfo *path, u32 *pMem);
|
||||
void _GSgifTransfer(pathInfo *path, u32 *pMem, u32 size);
|
||||
|
||||
extern GIFRegHandler g_GIFPackedRegHandlers[];
|
||||
extern GIFRegHandler g_GIFRegHandlers[];
|
|
@ -1,109 +0,0 @@
|
|||
/* GSsoft
|
||||
* Copyright (C) 2002-2004 GSsoft Team
|
||||
*
|
||||
* 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 <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <fcntl.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include "GS.h"
|
||||
|
||||
void SaveConfig()
|
||||
{
|
||||
const std::string iniFile( s_strIniPath + "zerogs.ini" );
|
||||
|
||||
FILE* f = fopen(iniFile.c_str(),"w");
|
||||
if (f == NULL)
|
||||
{
|
||||
printf("failed to open %s\n", iniFile.c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(f, "interlace = %hhx\n", conf.interlace);
|
||||
fprintf(f, "mrtdepth = %hhx\n", conf.mrtdepth);
|
||||
fprintf(f, "options = %x\n", conf.options); //u32
|
||||
fprintf(f, "bilinear = %hhx\n", conf.bilinear);
|
||||
fprintf(f, "aliasing = %hhx\n", conf.aa);
|
||||
fprintf(f, "gamesettings = %x\n", conf.gamesettings); //u32
|
||||
fclose(f);
|
||||
}
|
||||
|
||||
void LoadConfig()
|
||||
{
|
||||
char cfg[255];
|
||||
|
||||
memset(&conf, 0, sizeof(conf));
|
||||
conf.interlace = 0; // on, mode 1
|
||||
conf.mrtdepth = 1;
|
||||
conf.options = 0;
|
||||
conf.bilinear = 1;
|
||||
conf.width = 640;
|
||||
conf.height = 480;
|
||||
conf.aa = 0;
|
||||
|
||||
const std::string iniFile( s_strIniPath + "zerogs.ini" );
|
||||
FILE* f = fopen(iniFile.c_str(), "r");
|
||||
if (f == NULL)
|
||||
{
|
||||
printf("failed to open %s\n", iniFile.c_str());
|
||||
SaveConfig();//save and return
|
||||
return;
|
||||
}
|
||||
fscanf(f, "interlace = %hhx\n", &conf.interlace);
|
||||
fscanf(f, "mrtdepth = %hhx\n", &conf.mrtdepth);
|
||||
fscanf(f, "options = %x\n", &conf.options);//u32
|
||||
fscanf(f, "bilinear = %hhx\n", &conf.bilinear);
|
||||
fscanf(f, "aliasing = %hhx\n", &conf.aa);
|
||||
fscanf(f, "gamesettings = %x\n", &conf.gamesettings);//u32
|
||||
fclose(f);
|
||||
|
||||
// filter bad files
|
||||
if ((conf.aa < 0) || (conf.aa > 4)) conf.aa = 0;
|
||||
|
||||
switch(conf.options & GSOPTION_WINDIMS)
|
||||
{
|
||||
case GSOPTION_WIN640:
|
||||
conf.width = 640;
|
||||
conf.height = 480;
|
||||
break;
|
||||
case GSOPTION_WIN800:
|
||||
conf.width = 800;
|
||||
conf.height = 600;
|
||||
break;
|
||||
case GSOPTION_WIN1024:
|
||||
conf.width = 1024;
|
||||
conf.height = 768;
|
||||
break;
|
||||
case GSOPTION_WIN1280:
|
||||
conf.width = 1280;
|
||||
conf.height = 960;
|
||||
break;
|
||||
}
|
||||
|
||||
// turn off all hacks by default
|
||||
conf.options &= ~(GSOPTION_FULLSCREEN | GSOPTION_WIREFRAME | GSOPTION_CAPTUREAVI);
|
||||
conf.options |= GSOPTION_LOADED;
|
||||
|
||||
if( conf.width <= 0 || conf.height <= 0 )
|
||||
{
|
||||
conf.width = 640;
|
||||
conf.height = 480;
|
||||
}
|
||||
}
|
||||
|
|
@ -1,445 +0,0 @@
|
|||
/* ZeroGS
|
||||
* Copyright (C) 2002-2004 GSsoft Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <dlfcn.h>
|
||||
|
||||
#include "GS.h"
|
||||
|
||||
extern "C" {
|
||||
#include "interface.h"
|
||||
#include "support.h"
|
||||
#include "callbacks.h"
|
||||
}
|
||||
|
||||
#include "Linux.h"
|
||||
#include "zerogs.h"
|
||||
|
||||
#include <map>
|
||||
|
||||
GtkWidget *Conf, *Logging, *About;
|
||||
GList *fresl, *wresl, *cachesizel, *codecl, *filtersl;
|
||||
|
||||
static int prevbilinearfilter;
|
||||
|
||||
struct confOptsStruct
|
||||
{
|
||||
int value;
|
||||
const char *desc;
|
||||
} confOpts;
|
||||
|
||||
static map<string, confOptsStruct> mapConfOpts;
|
||||
|
||||
extern void OnKeyboardF5(int);
|
||||
extern void OnKeyboardF6(int);
|
||||
extern void OnKeyboardF7(int);
|
||||
extern void OnKeyboardF9(int);
|
||||
|
||||
void CALLBACK GSkeyEvent(keyEvent *ev)
|
||||
{
|
||||
//static bool bShift = false;
|
||||
static bool bAlt = false;
|
||||
|
||||
switch(ev->evt) {
|
||||
case KEYPRESS:
|
||||
switch(ev->key) {
|
||||
case XK_F5:
|
||||
case XK_F6:
|
||||
case XK_F7:
|
||||
case XK_F9:
|
||||
THR_KeyEvent = ev->key ;
|
||||
break;
|
||||
case XK_Escape:
|
||||
break;
|
||||
case XK_Shift_L:
|
||||
case XK_Shift_R:
|
||||
//bShift = true;
|
||||
THR_bShift = true;
|
||||
break;
|
||||
case XK_Alt_L:
|
||||
case XK_Alt_R:
|
||||
bAlt = true;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case KEYRELEASE:
|
||||
switch(ev->key) {
|
||||
case XK_Shift_L:
|
||||
case XK_Shift_R:
|
||||
//bShift = false;
|
||||
THR_bShift = false;
|
||||
break;
|
||||
case XK_Alt_L:
|
||||
case XK_Alt_R:
|
||||
bAlt = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void OnConf_Ok(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
GtkWidget *Btn;
|
||||
GtkWidget *treeview;
|
||||
GtkTreeModel *treemodel;
|
||||
GtkTreeIter treeiter;
|
||||
gboolean treeoptval;
|
||||
gchar *gbuf;
|
||||
char *str;
|
||||
int i;
|
||||
|
||||
conf.bilinear = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(Conf, "checkBilinear")));
|
||||
// restore
|
||||
if (conf.bilinear && prevbilinearfilter)
|
||||
conf.bilinear = prevbilinearfilter;
|
||||
|
||||
//conf.mrtdepth = 1;//IsDlgButtonChecked(hW, IDC_CONFIG_DEPTHWRITE);
|
||||
|
||||
if is_checked(Conf, "radioAANone")
|
||||
conf.aa = 0;
|
||||
else if is_checked(Conf, "radioAA2X")
|
||||
conf.aa = 1;
|
||||
else if is_checked(Conf, "radioAA4X")
|
||||
conf.aa = 2;
|
||||
else if is_checked(Conf, "radioAA8X")
|
||||
conf.aa = 3;
|
||||
else
|
||||
conf.aa = 4;
|
||||
|
||||
conf.options = 0;
|
||||
conf.options |= is_checked(Conf, "checkAVI") ? GSOPTION_CAPTUREAVI : 0;
|
||||
conf.options |= is_checked(Conf, "checkWireframe") ? GSOPTION_WIREFRAME : 0;
|
||||
conf.options |= is_checked(Conf, "checkfullscreen") ? GSOPTION_FULLSCREEN : 0;
|
||||
conf.options |= is_checked(Conf, "checkTGA") ? GSOPTION_TGASNAP : 0;
|
||||
|
||||
if is_checked(Conf, "radiointerlace0")
|
||||
conf.interlace = 0;
|
||||
else if is_checked(Conf, "radiointerlace1")
|
||||
conf.interlace = 1;
|
||||
else
|
||||
conf.interlace = 2;
|
||||
|
||||
//------- get advanced options from the treeview model -------//
|
||||
treeview = lookup_widget(Conf,"treeview1");
|
||||
treemodel = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
|
||||
gtk_tree_model_get_iter_first(treemodel, &treeiter);
|
||||
|
||||
conf.gamesettings = 0;
|
||||
for(map<string, confOptsStruct>::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it)
|
||||
{
|
||||
treeoptval = FALSE;
|
||||
gtk_tree_model_get(treemodel, &treeiter, 0, &treeoptval, -1);
|
||||
|
||||
if(treeoptval) conf.gamesettings |= it->second.value;
|
||||
|
||||
gtk_tree_model_iter_next(treemodel,&treeiter);
|
||||
}
|
||||
|
||||
GSsetGameCRC(0, conf.gamesettings);
|
||||
//---------- done getting advanced options ---------//
|
||||
|
||||
if is_checked(Conf, "radioSize640")
|
||||
conf.options |= GSOPTION_WIN640;
|
||||
else if is_checked(Conf, "radioSize800")
|
||||
conf.options |= GSOPTION_WIN800;
|
||||
else if is_checked(Conf, "radioSize1024")
|
||||
conf.options |= GSOPTION_WIN1024;
|
||||
else if is_checked(Conf, "radioSize1280")
|
||||
conf.options |= GSOPTION_WIN1280;
|
||||
|
||||
SaveConfig();
|
||||
|
||||
gtk_widget_destroy(Conf);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void OnConf_Cancel(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
gtk_widget_destroy(Conf);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void CALLBACK GSconfigure()
|
||||
{
|
||||
char name[32];
|
||||
char descbuf[255];
|
||||
int nmodes, i;
|
||||
bool itval;
|
||||
GtkWidget *treeview;
|
||||
GtkCellRenderer *treerend;
|
||||
GtkListStore *treestore;//Gets typecast as GtkTreeModel as needed.
|
||||
GtkTreeIter treeiter;
|
||||
GtkTreeViewColumn *treecol;
|
||||
|
||||
char strcurdir[256];
|
||||
getcwd(strcurdir, 256);
|
||||
|
||||
if (!(conf.options & GSOPTION_LOADED)) LoadConfig();
|
||||
Conf = create_Config();
|
||||
|
||||
// fixme; Need to check "checkInterlace" as well.
|
||||
if (conf.interlace == 0)
|
||||
set_checked(Conf, "radiointerlace0", true);
|
||||
else if (conf.interlace == 1)
|
||||
set_checked(Conf, "radiointerlace1", true);
|
||||
else
|
||||
set_checked(Conf, "radionointerlace", true);
|
||||
|
||||
set_checked(Conf, "checkBilinear", !!conf.bilinear);
|
||||
//set_checked(Conf, "checkbutton6", conf.mrtdepth);
|
||||
set_checked(Conf, "radioAANone", (conf.aa==0));
|
||||
set_checked(Conf, "radioAA2X", (conf.aa==1));
|
||||
set_checked(Conf, "radioAA4X", (conf.aa==2));
|
||||
set_checked(Conf, "radioAA8X", (conf.aa==3));
|
||||
set_checked(Conf, "radioAA16X", (conf.aa==4));
|
||||
set_checked(Conf, "checkWireframe", (conf.options&GSOPTION_WIREFRAME)?1:0);
|
||||
set_checked(Conf, "checkAVI", (conf.options&GSOPTION_CAPTUREAVI)?1:0);
|
||||
set_checked(Conf, "checkfullscreen", (conf.options&GSOPTION_FULLSCREEN)?1:0);
|
||||
set_checked(Conf, "checkTGA", (conf.options&GSOPTION_TGASNAP)?1:0);
|
||||
|
||||
set_checked(Conf, "radioSize640", ((conf.options&GSOPTION_WINDIMS)>>4)==0);
|
||||
set_checked(Conf, "radioSize800", ((conf.options&GSOPTION_WINDIMS)>>4)==1);
|
||||
set_checked(Conf, "radioSize1024", ((conf.options&GSOPTION_WINDIMS)>>4)==2);
|
||||
set_checked(Conf, "radioSize1280", ((conf.options&GSOPTION_WINDIMS)>>4)==3);
|
||||
|
||||
prevbilinearfilter = conf.bilinear;
|
||||
|
||||
//--------- Let's build a treeview for our advanced options! --------//
|
||||
treeview = lookup_widget(Conf,"treeview1");
|
||||
treestore = gtk_list_store_new(2,G_TYPE_BOOLEAN, G_TYPE_STRING);
|
||||
|
||||
//setup columns in treeview
|
||||
//COLUMN 0 is the checkboxes
|
||||
treecol = gtk_tree_view_column_new();
|
||||
gtk_tree_view_column_set_title(treecol, "Select");
|
||||
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), treecol);
|
||||
treerend = gtk_cell_renderer_toggle_new();
|
||||
gtk_tree_view_column_pack_start(treecol, treerend, TRUE);
|
||||
gtk_tree_view_column_add_attribute(treecol, treerend, "active", 0);//link 'active' attrib to first column of model
|
||||
g_object_set(treerend, "activatable", TRUE, NULL);//set 'activatable' attrib true by default for all rows regardless of model.
|
||||
g_signal_connect(treerend, "toggled", (GCallback) OnToggle_advopts, treestore);//set a global callback, we also pass a reference to our treestore.
|
||||
|
||||
//COLUMN 1 is the text descriptions
|
||||
treecol = gtk_tree_view_column_new();
|
||||
gtk_tree_view_column_set_title(treecol, "Description");
|
||||
gtk_tree_view_append_column(GTK_TREE_VIEW(treeview), treecol);
|
||||
treerend = gtk_cell_renderer_text_new();
|
||||
gtk_tree_view_column_pack_start(treecol, treerend, TRUE);
|
||||
gtk_tree_view_column_add_attribute(treecol, treerend, "text", 1);//link 'text' attrib to second column of model
|
||||
|
||||
//setup the model with all our rows of option data
|
||||
mapConfOpts.clear();
|
||||
confOpts.value = 0x00000001;
|
||||
confOpts.desc = "Tex Target checking - 00000001\nLego Racers";
|
||||
mapConfOpts["00000001"] = confOpts;
|
||||
confOpts.value = 0x00000002;
|
||||
confOpts.desc = "Auto reset targs - 00000002\nShadow Hearts, Samurai Warriors. Use when game is slow and toggling AA fixes it.";
|
||||
mapConfOpts["00000002"] = confOpts;
|
||||
confOpts.value = 0x00000004;
|
||||
confOpts.desc = "Interlace 2X - 00000004\nFixes 2x bigger screen (Gradius 3).";
|
||||
mapConfOpts["00000004"] = confOpts;
|
||||
confOpts.value = 0x00000008;
|
||||
confOpts.desc = "Text Alpha hack - 00000008\nNightmare Before Christmas.";
|
||||
mapConfOpts["00000008"] = confOpts;
|
||||
confOpts.value = 0x00000010;
|
||||
confOpts.desc = "No target resolves - 00000010\nStops all resolving of targets. Try this first for really slow games.";
|
||||
mapConfOpts["00000010"] = confOpts;
|
||||
confOpts.value = 0x00000020;
|
||||
confOpts.desc = "Exact color testing - 00000020\nFixes overbright or shadow/black artifacts (Crash 'n Burn).";
|
||||
mapConfOpts["00000020"] = confOpts;
|
||||
confOpts.value = 0x00000040;
|
||||
confOpts.desc = "No color clamping - 00000040\nSpeeds up games, but might be too bright or too dim.";
|
||||
mapConfOpts["00000040"] = confOpts;
|
||||
// confOpts.value = 0x00000080;
|
||||
// confOpts.desc = "FFX hack - 00000080\nShows missing geometry.";
|
||||
// mapConfOpts["00000080"] = confOpts;
|
||||
confOpts.value = 0x00000200;
|
||||
confOpts.desc = "Disable depth updates - 00000200";
|
||||
mapConfOpts["00000200"] = confOpts;
|
||||
confOpts.value = 0x00000400;
|
||||
confOpts.desc = "Resolve Hack #1 - 00000400\nKingdom Hearts. Speeds some games.";
|
||||
mapConfOpts["00000400"] = confOpts;
|
||||
confOpts.value = 0x00000800;
|
||||
confOpts.desc = "Resolve Hack #2 - 00000800\nShadow Hearts, Urbz.";
|
||||
mapConfOpts["00000800"] = confOpts;
|
||||
confOpts.value = 0x00001000;
|
||||
confOpts.desc = "No target CLUT - 00001000\nResident Evil 4, or foggy scenes.";
|
||||
mapConfOpts["00001000"] = confOpts;
|
||||
confOpts.value = 0x00002000;
|
||||
confOpts.desc = "Disable stencil buffer - 00002000\nUsually safe to do for simple scenes.";
|
||||
mapConfOpts["00002000"] = confOpts;
|
||||
// confOpts.value = 0x00004000;
|
||||
// confOpts.desc = "No vertical stripes - 00004000\nTry when there's a lot of garbage on screen.";
|
||||
// mapConfOpts["00004000"] = confOpts;
|
||||
confOpts.value = 0x00008000;
|
||||
confOpts.desc = "No depth resolve - 00008000\nMight give z buffer artifacts.";
|
||||
mapConfOpts["00008000"] = confOpts;
|
||||
confOpts.value = 0x00010000;
|
||||
confOpts.desc = "Full 16 bit resolution - 00010000\nUse when half the screen is missing.";
|
||||
mapConfOpts["00010000"] = confOpts;
|
||||
confOpts.value = 0x00020000;
|
||||
confOpts.desc = "Resolve Hack #3 - 00020000\nNeopets";
|
||||
mapConfOpts["00020000"] = confOpts;
|
||||
confOpts.value = 0x00040000;
|
||||
confOpts.desc = "Fast Update - 00040000\nOkami. Speeds some games.";
|
||||
mapConfOpts["00040000"] = confOpts;
|
||||
confOpts.value = 0x00080000;
|
||||
confOpts.desc = "Disable alpha testing - 00080000";
|
||||
mapConfOpts["00080000"] = confOpts;
|
||||
confOpts.value = 0x00100000;
|
||||
confOpts.desc = "Disable Multiple RTs - 00100000";
|
||||
mapConfOpts["00100000"] = confOpts;
|
||||
confOpts.value = 0x00200000;
|
||||
confOpts.desc = "32 bit render targets - 00200000";
|
||||
mapConfOpts["00200000"] = confOpts;
|
||||
|
||||
confOpts.value = 0x00400000;
|
||||
confOpts.desc = "Path 3 Hack - 00400000";
|
||||
mapConfOpts["00400000"] = confOpts;
|
||||
confOpts.value = 0x00800000;
|
||||
confOpts.desc = "Parallelize Contexts - 00800000 (Might speed things up, xenosaga is faster)";
|
||||
mapConfOpts["00800000"] = confOpts;
|
||||
confOpts.value = 0x01000000;
|
||||
confOpts.desc = "Specular Highlights - 01000000\nMakes xenosaga graphics faster by removing highlights";
|
||||
mapConfOpts["01000000"] = confOpts;
|
||||
|
||||
for(map<string, confOptsStruct>::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it)
|
||||
{
|
||||
gtk_list_store_append(treestore, &treeiter);//new row
|
||||
itval = (conf.gamesettings&it->second.value)?TRUE:FALSE;
|
||||
snprintf(descbuf, 254, "%s", it->second.desc);
|
||||
gtk_list_store_set(treestore, &treeiter, 0, itval, 1, descbuf, -1);
|
||||
}
|
||||
|
||||
gtk_tree_view_set_model(GTK_TREE_VIEW(treeview), GTK_TREE_MODEL(treestore));//NB: store is cast as tree model.
|
||||
g_object_unref(treestore);//allow model to be destroyed when the tree is destroyed.
|
||||
|
||||
//don't select/highlight rows
|
||||
gtk_tree_selection_set_mode(gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview)), GTK_SELECTION_NONE);
|
||||
//------treeview done -------//
|
||||
|
||||
//Let's do it!
|
||||
gtk_widget_show_all(Conf);
|
||||
gtk_main();
|
||||
}
|
||||
|
||||
void OnToggle_advopts(GtkCellRendererToggle *cell, gchar *path, gpointer user_data)
|
||||
{
|
||||
GtkTreeIter treeiter;
|
||||
gboolean val;
|
||||
|
||||
gtk_tree_model_get_iter_from_string(GTK_TREE_MODEL(user_data), &treeiter, path);
|
||||
gtk_tree_model_get(GTK_TREE_MODEL(user_data), &treeiter, 0, &val, -1);
|
||||
val = !val;
|
||||
gtk_list_store_set(GTK_LIST_STORE(user_data), &treeiter, 0, val, -1);
|
||||
|
||||
}
|
||||
|
||||
void OnAbout_Ok(GtkButton *button, gpointer user_data)
|
||||
{
|
||||
gtk_widget_destroy(About);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void CALLBACK GSabout()
|
||||
{
|
||||
About = create_About();
|
||||
|
||||
gtk_widget_show_all(About);
|
||||
gtk_main();
|
||||
}
|
||||
|
||||
s32 CALLBACK GStest()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
GtkWidget *MsgDlg;
|
||||
|
||||
void OnMsg_Ok()
|
||||
{
|
||||
gtk_widget_destroy(MsgDlg);
|
||||
gtk_main_quit();
|
||||
}
|
||||
|
||||
void SysMessage(char *fmt, ...)
|
||||
{
|
||||
GtkWidget *Ok,*Txt;
|
||||
GtkWidget *Box,*Box1;
|
||||
va_list list;
|
||||
char msg[512];
|
||||
|
||||
va_start(list, fmt);
|
||||
vsprintf(msg, fmt, list);
|
||||
va_end(list);
|
||||
|
||||
if (msg[strlen(msg)-1] == '\n') msg[strlen(msg)-1] = 0;
|
||||
|
||||
MsgDlg = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_window_set_position(GTK_WINDOW(MsgDlg), GTK_WIN_POS_CENTER);
|
||||
gtk_window_set_title(GTK_WINDOW(MsgDlg), "GSsoft Msg");
|
||||
gtk_container_set_border_width(GTK_CONTAINER(MsgDlg), 5);
|
||||
|
||||
Box = gtk_vbox_new(5, 0);
|
||||
gtk_container_add(GTK_CONTAINER(MsgDlg), Box);
|
||||
gtk_widget_show(Box);
|
||||
|
||||
Txt = gtk_label_new(msg);
|
||||
|
||||
gtk_box_pack_start(GTK_BOX(Box), Txt, FALSE, FALSE, 5);
|
||||
gtk_widget_show(Txt);
|
||||
|
||||
Box1 = gtk_hbutton_box_new();
|
||||
gtk_box_pack_start(GTK_BOX(Box), Box1, FALSE, FALSE, 0);
|
||||
gtk_widget_show(Box1);
|
||||
|
||||
Ok = gtk_button_new_with_label("Ok");
|
||||
gtk_signal_connect (GTK_OBJECT(Ok), "clicked", GTK_SIGNAL_FUNC(OnMsg_Ok), NULL);
|
||||
gtk_container_add(GTK_CONTAINER(Box1), Ok);
|
||||
GTK_WIDGET_SET_FLAGS(Ok, GTK_CAN_DEFAULT);
|
||||
gtk_widget_show(Ok);
|
||||
|
||||
gtk_widget_show(MsgDlg);
|
||||
|
||||
gtk_main();
|
||||
}
|
||||
|
||||
void *SysLoadLibrary(char *lib)
|
||||
{
|
||||
return dlopen(lib, RTLD_NOW | RTLD_GLOBAL);
|
||||
}
|
||||
|
||||
void *SysLoadSym(void *lib, char *sym)
|
||||
{
|
||||
void *ret = dlsym(lib, sym);
|
||||
if (ret == NULL) printf("null: %s\n", sym);
|
||||
return dlsym(lib, sym);
|
||||
}
|
||||
|
||||
char *SysLibError()
|
||||
{
|
||||
return dlerror();
|
||||
}
|
||||
|
||||
void SysCloseLibrary(void *lib)
|
||||
{
|
||||
dlclose(lib);
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
/*
|
||||
* Copyright (C) 2002-2004 GSsoft Team
|
||||
*
|
||||
* 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 __LINUX_H__
|
||||
#define __LINUX_H__
|
||||
#endif
|
||||
|
||||
void OnToggle_advopts(GtkCellRendererToggle *cell, gchar *path, gpointer user_data);
|
||||
|
||||
#define is_checked(main_widget, widget_name) (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name))))
|
||||
#define set_checked(main_widget,widget_name, state) gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(lookup_widget(main_widget, widget_name)), state)
|
|
@ -1,4 +0,0 @@
|
|||
noinst_LIBRARIES = libZeroGSLinux.a
|
||||
|
||||
INCLUDES = $(shell pkg-config --cflags gtk+-2.0) -I@srcdir@/../ -I@srcdir@/../common
|
||||
libZeroGSLinux_a_SOURCES = callbacks.c Conf.cpp interface.c Linux.cpp support.c
|
|
@ -1,9 +0,0 @@
|
|||
# builds the GUI C classes
|
||||
mkdir temp
|
||||
cp zerogs.glade temp/
|
||||
cd temp
|
||||
glade-2 --write-source zerogs.glade
|
||||
rm src/main.c
|
||||
cp src/*.h src/*.c ../
|
||||
cd ..
|
||||
/bin/rm -rf temp
|
|
@ -1,34 +0,0 @@
|
|||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "callbacks.h"
|
||||
#include "interface.h"
|
||||
#include "support.h"
|
||||
|
||||
|
||||
void
|
||||
OnConf_Ok (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OnConf_Cancel (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
OnAbout_Ok (GtkButton *button,
|
||||
gpointer user_data)
|
||||
{
|
||||
|
||||
}
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
#include <gtk/gtk.h>
|
||||
|
||||
|
||||
void
|
||||
OnConf_Ok (GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
OnConf_Cancel (GtkButton *button,
|
||||
gpointer user_data);
|
||||
|
||||
void
|
||||
OnAbout_Ok (GtkButton *button,
|
||||
gpointer user_data);
|
|
@ -1,386 +0,0 @@
|
|||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <gdk/gdkkeysyms.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "callbacks.h"
|
||||
#include "interface.h"
|
||||
#include "support.h"
|
||||
|
||||
#define GLADE_HOOKUP_OBJECT(component,widget,name) \
|
||||
g_object_set_data_full (G_OBJECT (component), name, \
|
||||
gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
|
||||
|
||||
#define GLADE_HOOKUP_OBJECT_NO_REF(component,widget,name) \
|
||||
g_object_set_data (G_OBJECT (component), name, widget)
|
||||
|
||||
GtkWidget*
|
||||
create_Config (void)
|
||||
{
|
||||
GtkWidget *Config;
|
||||
GtkWidget *vbox4;
|
||||
GtkWidget *frame7;
|
||||
GtkWidget *alignment4;
|
||||
GtkWidget *hbox8;
|
||||
GtkWidget *radionointerlace;
|
||||
GSList *radionointerlace_group = NULL;
|
||||
GtkWidget *radiointerlace0;
|
||||
GtkWidget *radiointerlace1;
|
||||
GtkWidget *label13;
|
||||
GtkWidget *checkBilinear;
|
||||
GtkWidget *frame4;
|
||||
GtkWidget *alignment1;
|
||||
GtkWidget *hbox6;
|
||||
GtkWidget *radioAANone;
|
||||
GSList *radioAANone_group = NULL;
|
||||
GtkWidget *radioAA2X;
|
||||
GtkWidget *radioAA4X;
|
||||
GtkWidget *radioAA8X;
|
||||
GtkWidget *radioAA16X;
|
||||
GtkWidget *label9;
|
||||
GtkWidget *checkWireframe;
|
||||
GtkWidget *checkAVI;
|
||||
GtkWidget *checkTGA;
|
||||
GtkWidget *checkfullscreen;
|
||||
GtkWidget *frame5;
|
||||
GtkWidget *alignment2;
|
||||
GtkWidget *hbox7;
|
||||
GtkWidget *radioSize640;
|
||||
GSList *radioSize640_group = NULL;
|
||||
GtkWidget *radioSize800;
|
||||
GtkWidget *radioSize1024;
|
||||
GtkWidget *radioSize1280;
|
||||
GtkWidget *label10;
|
||||
GtkWidget *frame6;
|
||||
GtkWidget *alignment3;
|
||||
GtkWidget *scrolledwindow1;
|
||||
GtkWidget *treeview1;
|
||||
GtkWidget *label12;
|
||||
GtkWidget *label11;
|
||||
GtkWidget *hbuttonbox1;
|
||||
GtkWidget *button1;
|
||||
GtkWidget *button2;
|
||||
|
||||
Config = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (Config), 5);
|
||||
gtk_window_set_title (GTK_WINDOW (Config), _("ZeroOGS Configuration"));
|
||||
|
||||
vbox4 = gtk_vbox_new (FALSE, 0);
|
||||
gtk_widget_show (vbox4);
|
||||
gtk_container_add (GTK_CONTAINER (Config), vbox4);
|
||||
|
||||
frame7 = gtk_frame_new (NULL);
|
||||
gtk_widget_show (frame7);
|
||||
gtk_box_pack_start (GTK_BOX (vbox4), frame7, FALSE, FALSE, 0);
|
||||
|
||||
alignment4 = gtk_alignment_new (0.5, 0.5, 1, 1);
|
||||
gtk_widget_show (alignment4);
|
||||
gtk_container_add (GTK_CONTAINER (frame7), alignment4);
|
||||
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment4), 0, 0, 12, 0);
|
||||
|
||||
hbox8 = gtk_hbox_new (FALSE, 0);
|
||||
gtk_widget_show (hbox8);
|
||||
gtk_container_add (GTK_CONTAINER (alignment4), hbox8);
|
||||
|
||||
radionointerlace = gtk_radio_button_new_with_mnemonic (NULL, _("Interlace Off"));
|
||||
gtk_widget_show (radionointerlace);
|
||||
gtk_box_pack_start (GTK_BOX (hbox8), radionointerlace, FALSE, FALSE, 0);
|
||||
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radionointerlace), radionointerlace_group);
|
||||
radionointerlace_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radionointerlace));
|
||||
|
||||
radiointerlace0 = gtk_radio_button_new_with_mnemonic (NULL, _("Interlace 0"));
|
||||
gtk_widget_show (radiointerlace0);
|
||||
gtk_box_pack_start (GTK_BOX (hbox8), radiointerlace0, FALSE, FALSE, 0);
|
||||
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiointerlace0), radionointerlace_group);
|
||||
radionointerlace_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiointerlace0));
|
||||
|
||||
radiointerlace1 = gtk_radio_button_new_with_mnemonic (NULL, _("Interlace 1"));
|
||||
gtk_widget_show (radiointerlace1);
|
||||
gtk_box_pack_start (GTK_BOX (hbox8), radiointerlace1, FALSE, FALSE, 0);
|
||||
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radiointerlace1), radionointerlace_group);
|
||||
radionointerlace_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radiointerlace1));
|
||||
|
||||
label13 = gtk_label_new (_("<b>Interlacing (F5 to toggle)</b>"));
|
||||
gtk_widget_show (label13);
|
||||
gtk_frame_set_label_widget (GTK_FRAME (frame7), label13);
|
||||
gtk_label_set_use_markup (GTK_LABEL (label13), TRUE);
|
||||
|
||||
checkBilinear = gtk_check_button_new_with_mnemonic (_("Bilinear Filtering (Shift+F5)\n Best quality is on, turn off for speed"));
|
||||
gtk_widget_show (checkBilinear);
|
||||
gtk_box_pack_start (GTK_BOX (vbox4), checkBilinear, FALSE, FALSE, 0);
|
||||
|
||||
frame4 = gtk_frame_new (NULL);
|
||||
gtk_widget_show (frame4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox4), frame4, FALSE, FALSE, 0);
|
||||
|
||||
alignment1 = gtk_alignment_new (0.5, 0.5, 1, 1);
|
||||
gtk_widget_show (alignment1);
|
||||
gtk_container_add (GTK_CONTAINER (frame4), alignment1);
|
||||
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment1), 0, 0, 12, 0);
|
||||
|
||||
hbox6 = gtk_hbox_new (TRUE, 0);
|
||||
gtk_widget_show (hbox6);
|
||||
gtk_container_add (GTK_CONTAINER (alignment1), hbox6);
|
||||
|
||||
radioAANone = gtk_radio_button_new_with_mnemonic (NULL, _("None"));
|
||||
gtk_widget_show (radioAANone);
|
||||
gtk_box_pack_start (GTK_BOX (hbox6), radioAANone, FALSE, FALSE, 0);
|
||||
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radioAANone), radioAANone_group);
|
||||
radioAANone_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radioAANone));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radioAANone), TRUE);
|
||||
|
||||
radioAA2X = gtk_radio_button_new_with_mnemonic (NULL, _("2X"));
|
||||
gtk_widget_show (radioAA2X);
|
||||
gtk_box_pack_start (GTK_BOX (hbox6), radioAA2X, FALSE, FALSE, 0);
|
||||
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radioAA2X), radioAANone_group);
|
||||
radioAANone_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radioAA2X));
|
||||
|
||||
radioAA4X = gtk_radio_button_new_with_mnemonic (NULL, _("4X"));
|
||||
gtk_widget_show (radioAA4X);
|
||||
gtk_box_pack_start (GTK_BOX (hbox6), radioAA4X, FALSE, FALSE, 0);
|
||||
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radioAA4X), radioAANone_group);
|
||||
radioAANone_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radioAA4X));
|
||||
|
||||
radioAA8X = gtk_radio_button_new_with_mnemonic (NULL, _("8X"));
|
||||
gtk_widget_show (radioAA8X);
|
||||
gtk_box_pack_start (GTK_BOX (hbox6), radioAA8X, FALSE, FALSE, 0);
|
||||
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radioAA8X), radioAANone_group);
|
||||
radioAANone_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radioAA8X));
|
||||
|
||||
radioAA16X = gtk_radio_button_new_with_mnemonic (NULL, _("16X"));
|
||||
gtk_widget_show (radioAA16X);
|
||||
gtk_box_pack_start (GTK_BOX (hbox6), radioAA16X, FALSE, FALSE, 0);
|
||||
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radioAA16X), radioAANone_group);
|
||||
radioAANone_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radioAA16X));
|
||||
|
||||
label9 = gtk_label_new (_("<b>Anti-aliasing for higher quality (F6)</b>"));
|
||||
gtk_widget_show (label9);
|
||||
gtk_frame_set_label_widget (GTK_FRAME (frame4), label9);
|
||||
gtk_label_set_use_markup (GTK_LABEL (label9), TRUE);
|
||||
|
||||
checkWireframe = gtk_check_button_new_with_mnemonic (_("Wireframe rendering (Shift+F6)"));
|
||||
gtk_widget_show (checkWireframe);
|
||||
gtk_box_pack_start (GTK_BOX (vbox4), checkWireframe, FALSE, FALSE, 0);
|
||||
|
||||
checkAVI = gtk_check_button_new_with_mnemonic (_("Capture Avi (zerogs.avi)(F7)"));
|
||||
gtk_widget_show (checkAVI);
|
||||
gtk_box_pack_start (GTK_BOX (vbox4), checkAVI, FALSE, FALSE, 0);
|
||||
|
||||
checkTGA = gtk_check_button_new_with_mnemonic (_("Save Snapshots as TGAs (default is JPG)"));
|
||||
gtk_widget_show (checkTGA);
|
||||
gtk_box_pack_start (GTK_BOX (vbox4), checkTGA, FALSE, FALSE, 0);
|
||||
|
||||
checkfullscreen = gtk_check_button_new_with_mnemonic (_("Fullscreen (Alt+Enter)\n to get out press Alt+Enter again (or ESC)"));
|
||||
gtk_widget_show (checkfullscreen);
|
||||
gtk_box_pack_start (GTK_BOX (vbox4), checkfullscreen, FALSE, FALSE, 0);
|
||||
|
||||
frame5 = gtk_frame_new (NULL);
|
||||
gtk_widget_show (frame5);
|
||||
gtk_box_pack_start (GTK_BOX (vbox4), frame5, FALSE, FALSE, 0);
|
||||
|
||||
alignment2 = gtk_alignment_new (0.5, 0.5, 1, 1);
|
||||
gtk_widget_show (alignment2);
|
||||
gtk_container_add (GTK_CONTAINER (frame5), alignment2);
|
||||
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment2), 0, 0, 12, 0);
|
||||
|
||||
hbox7 = gtk_hbox_new (TRUE, 0);
|
||||
gtk_widget_show (hbox7);
|
||||
gtk_container_add (GTK_CONTAINER (alignment2), hbox7);
|
||||
|
||||
radioSize640 = gtk_radio_button_new_with_mnemonic (NULL, _("640x480"));
|
||||
gtk_widget_show (radioSize640);
|
||||
gtk_box_pack_start (GTK_BOX (hbox7), radioSize640, FALSE, FALSE, 0);
|
||||
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radioSize640), radioSize640_group);
|
||||
radioSize640_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radioSize640));
|
||||
|
||||
radioSize800 = gtk_radio_button_new_with_mnemonic (NULL, _("800x600"));
|
||||
gtk_widget_show (radioSize800);
|
||||
gtk_box_pack_start (GTK_BOX (hbox7), radioSize800, FALSE, FALSE, 0);
|
||||
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radioSize800), radioSize640_group);
|
||||
radioSize640_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radioSize800));
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (radioSize800), TRUE);
|
||||
|
||||
radioSize1024 = gtk_radio_button_new_with_mnemonic (NULL, _("1024x768"));
|
||||
gtk_widget_show (radioSize1024);
|
||||
gtk_box_pack_start (GTK_BOX (hbox7), radioSize1024, FALSE, FALSE, 0);
|
||||
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radioSize1024), radioSize640_group);
|
||||
radioSize640_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radioSize1024));
|
||||
|
||||
radioSize1280 = gtk_radio_button_new_with_mnemonic (NULL, _("1280x960"));
|
||||
gtk_widget_show (radioSize1280);
|
||||
gtk_box_pack_start (GTK_BOX (hbox7), radioSize1280, FALSE, FALSE, 0);
|
||||
gtk_radio_button_set_group (GTK_RADIO_BUTTON (radioSize1280), radioSize640_group);
|
||||
radioSize640_group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (radioSize1280));
|
||||
|
||||
label10 = gtk_label_new (_("<b>Default Window Size (no speed impact)</b>"));
|
||||
gtk_widget_show (label10);
|
||||
gtk_frame_set_label_widget (GTK_FRAME (frame5), label10);
|
||||
gtk_label_set_use_markup (GTK_LABEL (label10), TRUE);
|
||||
|
||||
frame6 = gtk_frame_new (NULL);
|
||||
gtk_widget_show (frame6);
|
||||
gtk_box_pack_start (GTK_BOX (vbox4), frame6, TRUE, TRUE, 0);
|
||||
|
||||
alignment3 = gtk_alignment_new (0.5, 0.5, 1, 1);
|
||||
gtk_widget_show (alignment3);
|
||||
gtk_container_add (GTK_CONTAINER (frame6), alignment3);
|
||||
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment3), 0, 0, 12, 0);
|
||||
|
||||
scrolledwindow1 = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_widget_show (scrolledwindow1);
|
||||
gtk_container_add (GTK_CONTAINER (alignment3), scrolledwindow1);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow1), GTK_SHADOW_IN);
|
||||
|
||||
treeview1 = gtk_tree_view_new ();
|
||||
gtk_widget_show (treeview1);
|
||||
gtk_container_add (GTK_CONTAINER (scrolledwindow1), treeview1);
|
||||
|
||||
label12 = gtk_label_new (_("<b>Advanced Options</b>"));
|
||||
gtk_widget_show (label12);
|
||||
gtk_frame_set_label_widget (GTK_FRAME (frame6), label12);
|
||||
gtk_label_set_use_markup (GTK_LABEL (label12), TRUE);
|
||||
|
||||
label11 = gtk_label_new (_("Show Frames Per Second (Shift+F7)\n (value is the average over 4-16 PS2 frames)"));
|
||||
gtk_widget_show (label11);
|
||||
gtk_box_pack_start (GTK_BOX (vbox4), label11, FALSE, FALSE, 0);
|
||||
|
||||
hbuttonbox1 = gtk_hbutton_box_new ();
|
||||
gtk_widget_show (hbuttonbox1);
|
||||
gtk_box_pack_start (GTK_BOX (vbox4), hbuttonbox1, FALSE, FALSE, 0);
|
||||
gtk_button_box_set_layout (GTK_BUTTON_BOX (hbuttonbox1), GTK_BUTTONBOX_SPREAD);
|
||||
gtk_box_set_spacing (GTK_BOX (hbuttonbox1), 30);
|
||||
|
||||
button1 = gtk_button_new_with_mnemonic (_("Ok"));
|
||||
gtk_widget_show (button1);
|
||||
gtk_container_add (GTK_CONTAINER (hbuttonbox1), button1);
|
||||
GTK_WIDGET_SET_FLAGS (button1, GTK_CAN_DEFAULT);
|
||||
|
||||
button2 = gtk_button_new_with_mnemonic (_("Cancel"));
|
||||
gtk_widget_show (button2);
|
||||
gtk_container_add (GTK_CONTAINER (hbuttonbox1), button2);
|
||||
GTK_WIDGET_SET_FLAGS (button2, GTK_CAN_DEFAULT);
|
||||
|
||||
g_signal_connect ((gpointer) button1, "clicked",
|
||||
G_CALLBACK (OnConf_Ok),
|
||||
NULL);
|
||||
g_signal_connect ((gpointer) button2, "clicked",
|
||||
G_CALLBACK (OnConf_Cancel),
|
||||
NULL);
|
||||
|
||||
/* Store pointers to all widgets, for use by lookup_widget(). */
|
||||
GLADE_HOOKUP_OBJECT_NO_REF (Config, Config, "Config");
|
||||
GLADE_HOOKUP_OBJECT (Config, vbox4, "vbox4");
|
||||
GLADE_HOOKUP_OBJECT (Config, frame7, "frame7");
|
||||
GLADE_HOOKUP_OBJECT (Config, alignment4, "alignment4");
|
||||
GLADE_HOOKUP_OBJECT (Config, hbox8, "hbox8");
|
||||
GLADE_HOOKUP_OBJECT (Config, radionointerlace, "radionointerlace");
|
||||
GLADE_HOOKUP_OBJECT (Config, radiointerlace0, "radiointerlace0");
|
||||
GLADE_HOOKUP_OBJECT (Config, radiointerlace1, "radiointerlace1");
|
||||
GLADE_HOOKUP_OBJECT (Config, label13, "label13");
|
||||
GLADE_HOOKUP_OBJECT (Config, checkBilinear, "checkBilinear");
|
||||
GLADE_HOOKUP_OBJECT (Config, frame4, "frame4");
|
||||
GLADE_HOOKUP_OBJECT (Config, alignment1, "alignment1");
|
||||
GLADE_HOOKUP_OBJECT (Config, hbox6, "hbox6");
|
||||
GLADE_HOOKUP_OBJECT (Config, radioAANone, "radioAANone");
|
||||
GLADE_HOOKUP_OBJECT (Config, radioAA2X, "radioAA2X");
|
||||
GLADE_HOOKUP_OBJECT (Config, radioAA4X, "radioAA4X");
|
||||
GLADE_HOOKUP_OBJECT (Config, radioAA8X, "radioAA8X");
|
||||
GLADE_HOOKUP_OBJECT (Config, radioAA16X, "radioAA16X");
|
||||
GLADE_HOOKUP_OBJECT (Config, label9, "label9");
|
||||
GLADE_HOOKUP_OBJECT (Config, checkWireframe, "checkWireframe");
|
||||
GLADE_HOOKUP_OBJECT (Config, checkAVI, "checkAVI");
|
||||
GLADE_HOOKUP_OBJECT (Config, checkTGA, "checkTGA");
|
||||
GLADE_HOOKUP_OBJECT (Config, checkfullscreen, "checkfullscreen");
|
||||
GLADE_HOOKUP_OBJECT (Config, frame5, "frame5");
|
||||
GLADE_HOOKUP_OBJECT (Config, alignment2, "alignment2");
|
||||
GLADE_HOOKUP_OBJECT (Config, hbox7, "hbox7");
|
||||
GLADE_HOOKUP_OBJECT (Config, radioSize640, "radioSize640");
|
||||
GLADE_HOOKUP_OBJECT (Config, radioSize800, "radioSize800");
|
||||
GLADE_HOOKUP_OBJECT (Config, radioSize1024, "radioSize1024");
|
||||
GLADE_HOOKUP_OBJECT (Config, radioSize1280, "radioSize1280");
|
||||
GLADE_HOOKUP_OBJECT (Config, label10, "label10");
|
||||
GLADE_HOOKUP_OBJECT (Config, frame6, "frame6");
|
||||
GLADE_HOOKUP_OBJECT (Config, alignment3, "alignment3");
|
||||
GLADE_HOOKUP_OBJECT (Config, scrolledwindow1, "scrolledwindow1");
|
||||
GLADE_HOOKUP_OBJECT (Config, treeview1, "treeview1");
|
||||
GLADE_HOOKUP_OBJECT (Config, label12, "label12");
|
||||
GLADE_HOOKUP_OBJECT (Config, label11, "label11");
|
||||
GLADE_HOOKUP_OBJECT (Config, hbuttonbox1, "hbuttonbox1");
|
||||
GLADE_HOOKUP_OBJECT (Config, button1, "button1");
|
||||
GLADE_HOOKUP_OBJECT (Config, button2, "button2");
|
||||
|
||||
return Config;
|
||||
}
|
||||
|
||||
GtkWidget*
|
||||
create_About (void)
|
||||
{
|
||||
GtkWidget *About;
|
||||
GtkWidget *vbox2;
|
||||
GtkWidget *label2;
|
||||
GtkWidget *label3;
|
||||
GtkWidget *label4;
|
||||
GtkWidget *hbuttonbox2;
|
||||
GtkWidget *button3;
|
||||
|
||||
About = gtk_window_new (GTK_WINDOW_TOPLEVEL);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (About), 5);
|
||||
gtk_window_set_title (GTK_WINDOW (About), _("ZeroGS KOSMOS About"));
|
||||
|
||||
vbox2 = gtk_vbox_new (FALSE, 5);
|
||||
gtk_widget_show (vbox2);
|
||||
gtk_container_add (GTK_CONTAINER (About), vbox2);
|
||||
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 5);
|
||||
|
||||
label2 = gtk_label_new (_("OpenGL version"));
|
||||
gtk_widget_show (label2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label2, FALSE, FALSE, 0);
|
||||
gtk_label_set_justify (GTK_LABEL (label2), GTK_JUSTIFY_CENTER);
|
||||
|
||||
label3 = gtk_label_new (_("Author: zerofrog(@gmail.com)"));
|
||||
gtk_widget_show (label3);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label3, FALSE, FALSE, 0);
|
||||
|
||||
label4 = gtk_label_new (_("Many thanks to the Pcsx2 testing team"));
|
||||
gtk_widget_show (label4);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), label4, FALSE, FALSE, 0);
|
||||
|
||||
hbuttonbox2 = gtk_hbutton_box_new ();
|
||||
gtk_widget_show (hbuttonbox2);
|
||||
gtk_box_pack_start (GTK_BOX (vbox2), hbuttonbox2, TRUE, TRUE, 0);
|
||||
gtk_box_set_spacing (GTK_BOX (hbuttonbox2), 30);
|
||||
|
||||
button3 = gtk_button_new_with_mnemonic (_("Ok"));
|
||||
gtk_widget_show (button3);
|
||||
gtk_container_add (GTK_CONTAINER (hbuttonbox2), button3);
|
||||
GTK_WIDGET_SET_FLAGS (button3, GTK_CAN_DEFAULT);
|
||||
|
||||
g_signal_connect ((gpointer) button3, "clicked",
|
||||
G_CALLBACK (OnAbout_Ok),
|
||||
NULL);
|
||||
|
||||
/* Store pointers to all widgets, for use by lookup_widget(). */
|
||||
GLADE_HOOKUP_OBJECT_NO_REF (About, About, "About");
|
||||
GLADE_HOOKUP_OBJECT (About, vbox2, "vbox2");
|
||||
GLADE_HOOKUP_OBJECT (About, label2, "label2");
|
||||
GLADE_HOOKUP_OBJECT (About, label3, "label3");
|
||||
GLADE_HOOKUP_OBJECT (About, label4, "label4");
|
||||
GLADE_HOOKUP_OBJECT (About, hbuttonbox2, "hbuttonbox2");
|
||||
GLADE_HOOKUP_OBJECT (About, button3, "button3");
|
||||
|
||||
return About;
|
||||
}
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
||||
GtkWidget* create_Config (void);
|
||||
GtkWidget* create_About (void);
|
|
@ -1,144 +0,0 @@
|
|||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include "support.h"
|
||||
|
||||
GtkWidget*
|
||||
lookup_widget (GtkWidget *widget,
|
||||
const gchar *widget_name)
|
||||
{
|
||||
GtkWidget *parent, *found_widget;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (GTK_IS_MENU (widget))
|
||||
parent = gtk_menu_get_attach_widget (GTK_MENU (widget));
|
||||
else
|
||||
parent = widget->parent;
|
||||
if (!parent)
|
||||
parent = (GtkWidget*) g_object_get_data (G_OBJECT (widget), "GladeParentKey");
|
||||
if (parent == NULL)
|
||||
break;
|
||||
widget = parent;
|
||||
}
|
||||
|
||||
found_widget = (GtkWidget*) g_object_get_data (G_OBJECT (widget),
|
||||
widget_name);
|
||||
if (!found_widget)
|
||||
g_warning ("Widget not found: %s", widget_name);
|
||||
return found_widget;
|
||||
}
|
||||
|
||||
static GList *pixmaps_directories = NULL;
|
||||
|
||||
/* Use this function to set the directory containing installed pixmaps. */
|
||||
void
|
||||
add_pixmap_directory (const gchar *directory)
|
||||
{
|
||||
pixmaps_directories = g_list_prepend (pixmaps_directories,
|
||||
g_strdup (directory));
|
||||
}
|
||||
|
||||
/* This is an internally used function to find pixmap files. */
|
||||
static gchar*
|
||||
find_pixmap_file (const gchar *filename)
|
||||
{
|
||||
GList *elem;
|
||||
|
||||
/* We step through each of the pixmaps directory to find it. */
|
||||
elem = pixmaps_directories;
|
||||
while (elem)
|
||||
{
|
||||
gchar *pathname = g_strdup_printf ("%s%s%s", (gchar*)elem->data,
|
||||
G_DIR_SEPARATOR_S, filename);
|
||||
if (g_file_test (pathname, G_FILE_TEST_EXISTS))
|
||||
return pathname;
|
||||
g_free (pathname);
|
||||
elem = elem->next;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* This is an internally used function to create pixmaps. */
|
||||
GtkWidget*
|
||||
create_pixmap (GtkWidget *widget,
|
||||
const gchar *filename)
|
||||
{
|
||||
gchar *pathname = NULL;
|
||||
GtkWidget *pixmap;
|
||||
|
||||
if (!filename || !filename[0])
|
||||
return gtk_image_new ();
|
||||
|
||||
pathname = find_pixmap_file (filename);
|
||||
|
||||
if (!pathname)
|
||||
{
|
||||
g_warning (_("Couldn't find pixmap file: %s"), filename);
|
||||
return gtk_image_new ();
|
||||
}
|
||||
|
||||
pixmap = gtk_image_new_from_file (pathname);
|
||||
g_free (pathname);
|
||||
return pixmap;
|
||||
}
|
||||
|
||||
/* This is an internally used function to create pixmaps. */
|
||||
GdkPixbuf*
|
||||
create_pixbuf (const gchar *filename)
|
||||
{
|
||||
gchar *pathname = NULL;
|
||||
GdkPixbuf *pixbuf;
|
||||
GError *error = NULL;
|
||||
|
||||
if (!filename || !filename[0])
|
||||
return NULL;
|
||||
|
||||
pathname = find_pixmap_file (filename);
|
||||
|
||||
if (!pathname)
|
||||
{
|
||||
g_warning (_("Couldn't find pixmap file: %s"), filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pixbuf = gdk_pixbuf_new_from_file (pathname, &error);
|
||||
if (!pixbuf)
|
||||
{
|
||||
fprintf (stderr, "Failed to load pixbuf file: %s: %s\n",
|
||||
pathname, error->message);
|
||||
g_error_free (error);
|
||||
}
|
||||
g_free (pathname);
|
||||
return pixbuf;
|
||||
}
|
||||
|
||||
/* This is used to set ATK action descriptions. */
|
||||
void
|
||||
glade_set_atk_action_description (AtkAction *action,
|
||||
const gchar *action_name,
|
||||
const gchar *description)
|
||||
{
|
||||
gint n_actions, i;
|
||||
|
||||
n_actions = atk_action_get_n_actions (action);
|
||||
for (i = 0; i < n_actions; i++)
|
||||
{
|
||||
if (!strcmp (atk_action_get_name (action, i), action_name))
|
||||
atk_action_set_description (action, i, description);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,69 +0,0 @@
|
|||
/*
|
||||
* DO NOT EDIT THIS FILE - it is generated by Glade.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include <config.h>
|
||||
#endif
|
||||
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
/*
|
||||
* Standard gettext macros.
|
||||
*/
|
||||
#ifdef ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
# undef _
|
||||
# define _(String) dgettext (PACKAGE, String)
|
||||
# define Q_(String) g_strip_context ((String), gettext (String))
|
||||
# ifdef gettext_noop
|
||||
# define N_(String) gettext_noop (String)
|
||||
# else
|
||||
# define N_(String) (String)
|
||||
# endif
|
||||
#else
|
||||
# define textdomain(String) (String)
|
||||
# define gettext(String) (String)
|
||||
# define dgettext(Domain,Message) (Message)
|
||||
# define dcgettext(Domain,Message,Type) (Message)
|
||||
# define bindtextdomain(Domain,Directory) (Domain)
|
||||
# define _(String) (String)
|
||||
# define Q_(String) g_strip_context ((String), (String))
|
||||
# define N_(String) (String)
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* Public Functions.
|
||||
*/
|
||||
|
||||
/*
|
||||
* This function returns a widget in a component created by Glade.
|
||||
* Call it with the toplevel widget in the component (i.e. a window/dialog),
|
||||
* or alternatively any widget in the component, and the name of the widget
|
||||
* you want returned.
|
||||
*/
|
||||
GtkWidget* lookup_widget (GtkWidget *widget,
|
||||
const gchar *widget_name);
|
||||
|
||||
|
||||
/* Use this function to set the directory containing installed pixmaps. */
|
||||
void add_pixmap_directory (const gchar *directory);
|
||||
|
||||
|
||||
/*
|
||||
* Private Functions.
|
||||
*/
|
||||
|
||||
/* This is used to create the pixmaps used in the interface. */
|
||||
GtkWidget* create_pixmap (GtkWidget *widget,
|
||||
const gchar *filename);
|
||||
|
||||
/* This is used to create the pixbufs used in the interface. */
|
||||
GdkPixbuf* create_pixbuf (const gchar *filename);
|
||||
|
||||
/* This is used to set ATK action descriptions. */
|
||||
void glade_set_atk_action_description (AtkAction *action,
|
||||
const gchar *action_name,
|
||||
const gchar *description);
|
||||
|
|
@ -1,812 +0,0 @@
|
|||
<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
|
||||
<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
|
||||
|
||||
<glade-interface>
|
||||
|
||||
<widget class="GtkWindow" id="Config">
|
||||
<property name="border_width">5</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">ZeroOGS Configuration</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<property name="focus_on_map">True</property>
|
||||
<property name="urgency_hint">False</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox4">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkFrame" id="frame7">
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="label_yalign">0.5</property>
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment4">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">1</property>
|
||||
<property name="yscale">1</property>
|
||||
<property name="top_padding">0</property>
|
||||
<property name="bottom_padding">0</property>
|
||||
<property name="left_padding">12</property>
|
||||
<property name="right_padding">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox8">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radionointerlace">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Interlace Off</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radiointerlace0">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Interlace 0</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radionointerlace</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radiointerlace1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Interlace 1</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radionointerlace</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label13">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Interlacing (F5 to toggle)</b></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="checkBilinear">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Bilinear Filtering (Shift+F5)
|
||||
Best quality is on, turn off for speed</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkFrame" id="frame4">
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="label_yalign">0.5</property>
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment1">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">1</property>
|
||||
<property name="yscale">1</property>
|
||||
<property name="top_padding">0</property>
|
||||
<property name="bottom_padding">0</property>
|
||||
<property name="left_padding">12</property>
|
||||
<property name="right_padding">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox6">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radioAANone">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">None</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radioAA2X">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">2X</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radioAANone</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radioAA4X">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">4X</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radioAANone</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radioAA8X">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">8X</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radioAANone</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radioAA16X">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">16X</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radioAANone</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label9">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Anti-aliasing for higher quality (F6)</b></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="checkWireframe">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Wireframe rendering (Shift+F6)</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="checkAVI">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Capture Avi (zerogs.avi)(F7)</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="checkTGA">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Save Snapshots as TGAs (default is JPG)</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkCheckButton" id="checkfullscreen">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Fullscreen (Alt+Enter)
|
||||
to get out press Alt+Enter again (or ESC)</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkFrame" id="frame5">
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="label_yalign">0.5</property>
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment2">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">1</property>
|
||||
<property name="yscale">1</property>
|
||||
<property name="top_padding">0</property>
|
||||
<property name="bottom_padding">0</property>
|
||||
<property name="left_padding">12</property>
|
||||
<property name="right_padding">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHBox" id="hbox7">
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">True</property>
|
||||
<property name="spacing">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radioSize640">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">640x480</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radioSize800">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">800x600</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">True</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radioSize640</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radioSize1024">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">1024x768</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radioSize640</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkRadioButton" id="radioSize1280">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">1280x960</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<property name="active">False</property>
|
||||
<property name="inconsistent">False</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<property name="group">radioSize640</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label10">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Default Window Size (no speed impact)</b></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkFrame" id="frame6">
|
||||
<property name="visible">True</property>
|
||||
<property name="label_xalign">0</property>
|
||||
<property name="label_yalign">0.5</property>
|
||||
<property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkAlignment" id="alignment3">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xscale">1</property>
|
||||
<property name="yscale">1</property>
|
||||
<property name="top_padding">0</property>
|
||||
<property name="bottom_padding">0</property>
|
||||
<property name="left_padding">12</property>
|
||||
<property name="right_padding">0</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkScrolledWindow" id="scrolledwindow1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
|
||||
<property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property>
|
||||
<property name="shadow_type">GTK_SHADOW_IN</property>
|
||||
<property name="window_placement">GTK_CORNER_TOP_LEFT</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkTreeView" id="treeview1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="headers_visible">True</property>
|
||||
<property name="rules_hint">False</property>
|
||||
<property name="reorderable">False</property>
|
||||
<property name="enable_search">True</property>
|
||||
<property name="fixed_height_mode">False</property>
|
||||
<property name="hover_selection">False</property>
|
||||
<property name="hover_expand">False</property>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label12">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes"><b>Advanced Options</b></property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">True</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="type">label_item</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label11">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Show Frames Per Second (Shift+F7)
|
||||
(value is the average over 4-16 PS2 frames)</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox1">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_SPREAD</property>
|
||||
<property name="spacing">30</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button1">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Ok</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="OnConf_Ok"/>
|
||||
</widget>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button2">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Cancel</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="OnConf_Cancel"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
<widget class="GtkWindow" id="About">
|
||||
<property name="border_width">5</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="title" translatable="yes">ZeroGS KOSMOS About</property>
|
||||
<property name="type">GTK_WINDOW_TOPLEVEL</property>
|
||||
<property name="window_position">GTK_WIN_POS_NONE</property>
|
||||
<property name="modal">False</property>
|
||||
<property name="resizable">True</property>
|
||||
<property name="destroy_with_parent">False</property>
|
||||
<property name="decorated">True</property>
|
||||
<property name="skip_taskbar_hint">False</property>
|
||||
<property name="skip_pager_hint">False</property>
|
||||
<property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property>
|
||||
<property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
|
||||
<property name="focus_on_map">True</property>
|
||||
<property name="urgency_hint">False</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkVBox" id="vbox2">
|
||||
<property name="border_width">5</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="homogeneous">False</property>
|
||||
<property name="spacing">5</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label2">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">OpenGL version</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_CENTER</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label3">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Author: zerofrog(@gmail.com)</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkLabel" id="label4">
|
||||
<property name="visible">True</property>
|
||||
<property name="label" translatable="yes">Many thanks to the Pcsx2 testing team</property>
|
||||
<property name="use_underline">False</property>
|
||||
<property name="use_markup">False</property>
|
||||
<property name="justify">GTK_JUSTIFY_LEFT</property>
|
||||
<property name="wrap">False</property>
|
||||
<property name="selectable">False</property>
|
||||
<property name="xalign">0.5</property>
|
||||
<property name="yalign">0.5</property>
|
||||
<property name="xpad">0</property>
|
||||
<property name="ypad">0</property>
|
||||
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
|
||||
<property name="width_chars">-1</property>
|
||||
<property name="single_line_mode">False</property>
|
||||
<property name="angle">0</property>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
</packing>
|
||||
</child>
|
||||
|
||||
<child>
|
||||
<widget class="GtkHButtonBox" id="hbuttonbox2">
|
||||
<property name="visible">True</property>
|
||||
<property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
|
||||
<property name="spacing">30</property>
|
||||
|
||||
<child>
|
||||
<widget class="GtkButton" id="button3">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_default">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="label" translatable="yes">Ok</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="relief">GTK_RELIEF_NORMAL</property>
|
||||
<property name="focus_on_click">True</property>
|
||||
<signal name="clicked" handler="OnAbout_Ok"/>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
<packing>
|
||||
<property name="padding">0</property>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
</packing>
|
||||
</child>
|
||||
</widget>
|
||||
</child>
|
||||
</widget>
|
||||
|
||||
</glade-interface>
|
|
@ -1,38 +0,0 @@
|
|||
# Create a shared library libZeroGSogl
|
||||
AUTOMAKE_OPTIONS = foreign
|
||||
noinst_LIBRARIES = libZeroGSogl.a
|
||||
INCLUDES = -I@srcdir@/../../../common/include -I@srcdir@/../../../3rdparty
|
||||
|
||||
libZeroGSogl_a_CPPFLAGS = $(shell pkg-config --cflags gtk+-2.0)
|
||||
libZeroGSogl_a_CXXFLAGS = $(shell pkg-config --cflags gtk+-2.0)
|
||||
|
||||
# Create a shared object by faking an exe (thanks to ODE makefiles)
|
||||
traplibdir=$(prefix)
|
||||
|
||||
if RELEASE_TO_PUBLIC
|
||||
preext=r
|
||||
endif
|
||||
|
||||
EXEEXT=$(preext)@so_ext@
|
||||
|
||||
traplib_PROGRAMS=libZeroGSogl
|
||||
libZeroGSogl_SOURCES=
|
||||
libZeroGSogl_DEPENDENCIES = libZeroGSogl.a
|
||||
libZeroGSogl_LDFLAGS= @SHARED_LDFLAGS@
|
||||
libZeroGSogl_LDFLAGS+=-Wl,-soname,@ZEROGS_SONAME@
|
||||
libZeroGSogl_LDADD=$(libZeroGSogl_a_OBJECTS)
|
||||
|
||||
libZeroGSogl_a_SOURCES = \
|
||||
GSmain.cpp Regs.cpp x86.cpp zpipe.cpp \
|
||||
Mem.cpp rasterfont.cpp targets.cpp zerogs.cpp GifTransfer.cpp GLWinX11.cpp
|
||||
|
||||
libZeroGSogl_a_SOURCES += x86-32.S
|
||||
|
||||
if SSE2
|
||||
CCASFLAGS+= -DZEROGS_SSE2
|
||||
endif
|
||||
|
||||
libZeroGSogl_a_DEPENDENCIES = Linux/libZeroGSLinux.a
|
||||
libZeroGSogl_LDADD += Linux/libZeroGSLinux.a
|
||||
|
||||
SUBDIRS = Linux .
|
|
@ -1,903 +0,0 @@
|
|||
/* ZeroGS KOSMOS
|
||||
* Copyright (C) 2005-2006 zerofrog@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 "GS.h"
|
||||
#include "Mem.h"
|
||||
#include "zerogs.h"
|
||||
#include "targets.h"
|
||||
#include "x86.h"
|
||||
|
||||
u32 g_blockTable32[4][8] = {
|
||||
{ 0, 1, 4, 5, 16, 17, 20, 21},
|
||||
{ 2, 3, 6, 7, 18, 19, 22, 23},
|
||||
{ 8, 9, 12, 13, 24, 25, 28, 29},
|
||||
{ 10, 11, 14, 15, 26, 27, 30, 31}
|
||||
};
|
||||
|
||||
u32 g_blockTable32Z[4][8] = {
|
||||
{ 24, 25, 28, 29, 8, 9, 12, 13},
|
||||
{ 26, 27, 30, 31, 10, 11, 14, 15},
|
||||
{ 16, 17, 20, 21, 0, 1, 4, 5},
|
||||
{ 18, 19, 22, 23, 2, 3, 6, 7}
|
||||
};
|
||||
|
||||
u32 g_blockTable16[8][4] = {
|
||||
{ 0, 2, 8, 10 },
|
||||
{ 1, 3, 9, 11 },
|
||||
{ 4, 6, 12, 14 },
|
||||
{ 5, 7, 13, 15 },
|
||||
{ 16, 18, 24, 26 },
|
||||
{ 17, 19, 25, 27 },
|
||||
{ 20, 22, 28, 30 },
|
||||
{ 21, 23, 29, 31 }
|
||||
};
|
||||
|
||||
u32 g_blockTable16S[8][4] = {
|
||||
{ 0, 2, 16, 18 },
|
||||
{ 1, 3, 17, 19 },
|
||||
{ 8, 10, 24, 26 },
|
||||
{ 9, 11, 25, 27 },
|
||||
{ 4, 6, 20, 22 },
|
||||
{ 5, 7, 21, 23 },
|
||||
{ 12, 14, 28, 30 },
|
||||
{ 13, 15, 29, 31 }
|
||||
};
|
||||
|
||||
u32 g_blockTable16Z[8][4] = {
|
||||
{ 24, 26, 16, 18 },
|
||||
{ 25, 27, 17, 19 },
|
||||
{ 28, 30, 20, 22 },
|
||||
{ 29, 31, 21, 23 },
|
||||
{ 8, 10, 0, 2 },
|
||||
{ 9, 11, 1, 3 },
|
||||
{ 12, 14, 4, 6 },
|
||||
{ 13, 15, 5, 7 }
|
||||
};
|
||||
|
||||
u32 g_blockTable16SZ[8][4] = {
|
||||
{ 24, 26, 8, 10 },
|
||||
{ 25, 27, 9, 11 },
|
||||
{ 16, 18, 0, 2 },
|
||||
{ 17, 19, 1, 3 },
|
||||
{ 28, 30, 12, 14 },
|
||||
{ 29, 31, 13, 15 },
|
||||
{ 20, 22, 4, 6 },
|
||||
{ 21, 23, 5, 7 }
|
||||
};
|
||||
|
||||
u32 g_blockTable8[4][8] = {
|
||||
{ 0, 1, 4, 5, 16, 17, 20, 21},
|
||||
{ 2, 3, 6, 7, 18, 19, 22, 23},
|
||||
{ 8, 9, 12, 13, 24, 25, 28, 29},
|
||||
{ 10, 11, 14, 15, 26, 27, 30, 31}
|
||||
};
|
||||
|
||||
u32 g_blockTable4[8][4] = {
|
||||
{ 0, 2, 8, 10 },
|
||||
{ 1, 3, 9, 11 },
|
||||
{ 4, 6, 12, 14 },
|
||||
{ 5, 7, 13, 15 },
|
||||
{ 16, 18, 24, 26 },
|
||||
{ 17, 19, 25, 27 },
|
||||
{ 20, 22, 28, 30 },
|
||||
{ 21, 23, 29, 31 }
|
||||
};
|
||||
|
||||
u32 g_columnTable32[8][8] = {
|
||||
{ 0, 1, 4, 5, 8, 9, 12, 13 },
|
||||
{ 2, 3, 6, 7, 10, 11, 14, 15 },
|
||||
{ 16, 17, 20, 21, 24, 25, 28, 29 },
|
||||
{ 18, 19, 22, 23, 26, 27, 30, 31 },
|
||||
{ 32, 33, 36, 37, 40, 41, 44, 45 },
|
||||
{ 34, 35, 38, 39, 42, 43, 46, 47 },
|
||||
{ 48, 49, 52, 53, 56, 57, 60, 61 },
|
||||
{ 50, 51, 54, 55, 58, 59, 62, 63 },
|
||||
};
|
||||
|
||||
u32 g_columnTable16[8][16] = {
|
||||
{ 0, 2, 8, 10, 16, 18, 24, 26,
|
||||
1, 3, 9, 11, 17, 19, 25, 27 },
|
||||
{ 4, 6, 12, 14, 20, 22, 28, 30,
|
||||
5, 7, 13, 15, 21, 23, 29, 31 },
|
||||
{ 32, 34, 40, 42, 48, 50, 56, 58,
|
||||
33, 35, 41, 43, 49, 51, 57, 59 },
|
||||
{ 36, 38, 44, 46, 52, 54, 60, 62,
|
||||
37, 39, 45, 47, 53, 55, 61, 63 },
|
||||
{ 64, 66, 72, 74, 80, 82, 88, 90,
|
||||
65, 67, 73, 75, 81, 83, 89, 91 },
|
||||
{ 68, 70, 76, 78, 84, 86, 92, 94,
|
||||
69, 71, 77, 79, 85, 87, 93, 95 },
|
||||
{ 96, 98, 104, 106, 112, 114, 120, 122,
|
||||
97, 99, 105, 107, 113, 115, 121, 123 },
|
||||
{ 100, 102, 108, 110, 116, 118, 124, 126,
|
||||
101, 103, 109, 111, 117, 119, 125, 127 },
|
||||
};
|
||||
|
||||
u32 g_columnTable8[16][16] = {
|
||||
{ 0, 4, 16, 20, 32, 36, 48, 52, // column 0
|
||||
2, 6, 18, 22, 34, 38, 50, 54 },
|
||||
{ 8, 12, 24, 28, 40, 44, 56, 60,
|
||||
10, 14, 26, 30, 42, 46, 58, 62 },
|
||||
{ 33, 37, 49, 53, 1, 5, 17, 21,
|
||||
35, 39, 51, 55, 3, 7, 19, 23 },
|
||||
{ 41, 45, 57, 61, 9, 13, 25, 29,
|
||||
43, 47, 59, 63, 11, 15, 27, 31 },
|
||||
{ 96, 100, 112, 116, 64, 68, 80, 84, // column 1
|
||||
98, 102, 114, 118, 66, 70, 82, 86 },
|
||||
{ 104, 108, 120, 124, 72, 76, 88, 92,
|
||||
106, 110, 122, 126, 74, 78, 90, 94 },
|
||||
{ 65, 69, 81, 85, 97, 101, 113, 117,
|
||||
67, 71, 83, 87, 99, 103, 115, 119 },
|
||||
{ 73, 77, 89, 93, 105, 109, 121, 125,
|
||||
75, 79, 91, 95, 107, 111, 123, 127 },
|
||||
{ 128, 132, 144, 148, 160, 164, 176, 180, // column 2
|
||||
130, 134, 146, 150, 162, 166, 178, 182 },
|
||||
{ 136, 140, 152, 156, 168, 172, 184, 188,
|
||||
138, 142, 154, 158, 170, 174, 186, 190 },
|
||||
{ 161, 165, 177, 181, 129, 133, 145, 149,
|
||||
163, 167, 179, 183, 131, 135, 147, 151 },
|
||||
{ 169, 173, 185, 189, 137, 141, 153, 157,
|
||||
171, 175, 187, 191, 139, 143, 155, 159 },
|
||||
{ 224, 228, 240, 244, 192, 196, 208, 212, // column 3
|
||||
226, 230, 242, 246, 194, 198, 210, 214 },
|
||||
{ 232, 236, 248, 252, 200, 204, 216, 220,
|
||||
234, 238, 250, 254, 202, 206, 218, 222 },
|
||||
{ 193, 197, 209, 213, 225, 229, 241, 245,
|
||||
195, 199, 211, 215, 227, 231, 243, 247 },
|
||||
{ 201, 205, 217, 221, 233, 237, 249, 253,
|
||||
203, 207, 219, 223, 235, 239, 251, 255 },
|
||||
};
|
||||
|
||||
u32 g_columnTable4[16][32] = {
|
||||
{ 0, 8, 32, 40, 64, 72, 96, 104, // column 0
|
||||
2, 10, 34, 42, 66, 74, 98, 106,
|
||||
4, 12, 36, 44, 68, 76, 100, 108,
|
||||
6, 14, 38, 46, 70, 78, 102, 110 },
|
||||
{ 16, 24, 48, 56, 80, 88, 112, 120,
|
||||
18, 26, 50, 58, 82, 90, 114, 122,
|
||||
20, 28, 52, 60, 84, 92, 116, 124,
|
||||
22, 30, 54, 62, 86, 94, 118, 126 },
|
||||
{ 65, 73, 97, 105, 1, 9, 33, 41,
|
||||
67, 75, 99, 107, 3, 11, 35, 43,
|
||||
69, 77, 101, 109, 5, 13, 37, 45,
|
||||
71, 79, 103, 111, 7, 15, 39, 47 },
|
||||
{ 81, 89, 113, 121, 17, 25, 49, 57,
|
||||
83, 91, 115, 123, 19, 27, 51, 59,
|
||||
85, 93, 117, 125, 21, 29, 53, 61,
|
||||
87, 95, 119, 127, 23, 31, 55, 63 },
|
||||
{ 192, 200, 224, 232, 128, 136, 160, 168, // column 1
|
||||
194, 202, 226, 234, 130, 138, 162, 170,
|
||||
196, 204, 228, 236, 132, 140, 164, 172,
|
||||
198, 206, 230, 238, 134, 142, 166, 174 },
|
||||
{ 208, 216, 240, 248, 144, 152, 176, 184,
|
||||
210, 218, 242, 250, 146, 154, 178, 186,
|
||||
212, 220, 244, 252, 148, 156, 180, 188,
|
||||
214, 222, 246, 254, 150, 158, 182, 190 },
|
||||
{ 129, 137, 161, 169, 193, 201, 225, 233,
|
||||
131, 139, 163, 171, 195, 203, 227, 235,
|
||||
133, 141, 165, 173, 197, 205, 229, 237,
|
||||
135, 143, 167, 175, 199, 207, 231, 239 },
|
||||
{ 145, 153, 177, 185, 209, 217, 241, 249,
|
||||
147, 155, 179, 187, 211, 219, 243, 251,
|
||||
149, 157, 181, 189, 213, 221, 245, 253,
|
||||
151, 159, 183, 191, 215, 223, 247, 255 },
|
||||
{ 256, 264, 288, 296, 320, 328, 352, 360, // column 2
|
||||
258, 266, 290, 298, 322, 330, 354, 362,
|
||||
260, 268, 292, 300, 324, 332, 356, 364,
|
||||
262, 270, 294, 302, 326, 334, 358, 366 },
|
||||
{ 272, 280, 304, 312, 336, 344, 368, 376,
|
||||
274, 282, 306, 314, 338, 346, 370, 378,
|
||||
276, 284, 308, 316, 340, 348, 372, 380,
|
||||
278, 286, 310, 318, 342, 350, 374, 382 },
|
||||
{ 321, 329, 353, 361, 257, 265, 289, 297,
|
||||
323, 331, 355, 363, 259, 267, 291, 299,
|
||||
325, 333, 357, 365, 261, 269, 293, 301,
|
||||
327, 335, 359, 367, 263, 271, 295, 303 },
|
||||
{ 337, 345, 369, 377, 273, 281, 305, 313,
|
||||
339, 347, 371, 379, 275, 283, 307, 315,
|
||||
341, 349, 373, 381, 277, 285, 309, 317,
|
||||
343, 351, 375, 383, 279, 287, 311, 319 },
|
||||
{ 448, 456, 480, 488, 384, 392, 416, 424, // column 3
|
||||
450, 458, 482, 490, 386, 394, 418, 426,
|
||||
452, 460, 484, 492, 388, 396, 420, 428,
|
||||
454, 462, 486, 494, 390, 398, 422, 430 },
|
||||
{ 464, 472, 496, 504, 400, 408, 432, 440,
|
||||
466, 474, 498, 506, 402, 410, 434, 442,
|
||||
468, 476, 500, 508, 404, 412, 436, 444,
|
||||
470, 478, 502, 510, 406, 414, 438, 446 },
|
||||
{ 385, 393, 417, 425, 449, 457, 481, 489,
|
||||
387, 395, 419, 427, 451, 459, 483, 491,
|
||||
389, 397, 421, 429, 453, 461, 485, 493,
|
||||
391, 399, 423, 431, 455, 463, 487, 495 },
|
||||
{ 401, 409, 433, 441, 465, 473, 497, 505,
|
||||
403, 411, 435, 443, 467, 475, 499, 507,
|
||||
405, 413, 437, 445, 469, 477, 501, 509,
|
||||
407, 415, 439, 447, 471, 479, 503, 511 },
|
||||
};
|
||||
|
||||
u32 g_pageTable32[32][64];
|
||||
u32 g_pageTable32Z[32][64];
|
||||
u32 g_pageTable16[64][64];
|
||||
u32 g_pageTable16S[64][64];
|
||||
u32 g_pageTable16Z[64][64];
|
||||
u32 g_pageTable16SZ[64][64];
|
||||
u32 g_pageTable8[64][128];
|
||||
u32 g_pageTable4[128][128];
|
||||
|
||||
BLOCK m_Blocks[0x40]; // do so blocks are indexable
|
||||
static PCSX2_ALIGNED16(u32 tempblock[64]);
|
||||
|
||||
#define DSTPSM gs.dstbuf.psm
|
||||
|
||||
#define START_HOSTLOCAL() \
|
||||
assert( gs.imageTransfer == 0 ); \
|
||||
u8* pstart = g_pbyGSMemory + gs.dstbuf.bp*256; \
|
||||
\
|
||||
const u8* pendbuf = (const u8*)pbyMem + nQWordSize*4; \
|
||||
int i = gs.imageY, j = gs.imageX; \
|
||||
|
||||
extern BOOL g_bSaveTrans;
|
||||
|
||||
#define END_HOSTLOCAL() \
|
||||
End: \
|
||||
if( i >= gs.imageEndY ) { \
|
||||
assert( gs.imageTransfer == -1 || i == gs.imageEndY ); \
|
||||
gs.imageTransfer = -1; \
|
||||
/*int start, end; \
|
||||
ZeroGS::GetRectMemAddress(start, end, gs.dstbuf.psm, gs.trxpos.dx, gs.trxpos.dy, gs.imageWnew, gs.imageHnew, gs.dstbuf.bp, gs.dstbuf.bw); \
|
||||
ZeroGS::g_MemTargs.ClearRange(start, end);*/ \
|
||||
} \
|
||||
else { \
|
||||
/* update new params */ \
|
||||
gs.imageY = i; \
|
||||
gs.imageX = j; \
|
||||
} \
|
||||
|
||||
// transfers whole rows
|
||||
#define TRANSMIT_HOSTLOCAL_Y_(psm, T, widthlimit, endY) { \
|
||||
assert( (nSize%widthlimit) == 0 && widthlimit <= 4 ); \
|
||||
if( (gs.imageEndX-gs.trxpos.dx)%widthlimit ) { \
|
||||
/*GS_LOG("Bad Transmission! %d %d, psm: %d\n", gs.trxpos.dx, gs.imageEndX, DSTPSM);*/ \
|
||||
for(; i < endY; ++i) { \
|
||||
for(; j < gs.imageEndX && nSize > 0; j += 1, nSize -= 1, pbuf += 1) { \
|
||||
/* write as many pixel at one time as possible */ \
|
||||
writePixel##psm##_0(pstart, j%2048, i%2048, pbuf[0], gs.dstbuf.bw); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
for(; i < endY; ++i) { \
|
||||
for(; j < gs.imageEndX && nSize > 0; j += widthlimit, nSize -= widthlimit, pbuf += widthlimit) { \
|
||||
/* write as many pixel at one time as possible */ \
|
||||
if( nSize < widthlimit ) goto End; \
|
||||
writePixel##psm##_0(pstart, j%2048, i%2048, pbuf[0], gs.dstbuf.bw); \
|
||||
\
|
||||
if( widthlimit > 1 ) { \
|
||||
writePixel##psm##_0(pstart, (j+1)%2048, i%2048, pbuf[1], gs.dstbuf.bw); \
|
||||
\
|
||||
if( widthlimit > 2 ) { \
|
||||
writePixel##psm##_0(pstart, (j+2)%2048, i%2048, pbuf[2], gs.dstbuf.bw); \
|
||||
\
|
||||
if( widthlimit > 3 ) { \
|
||||
writePixel##psm##_0(pstart, (j+3)%2048, i%2048, pbuf[3], gs.dstbuf.bw); \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
if( j >= gs.imageEndX ) { assert(j == gs.imageEndX); j = gs.trxpos.dx; } \
|
||||
else { assert( gs.imageTransfer == -1 || nSize*sizeof(T)/4 == 0 ); goto End; } \
|
||||
} \
|
||||
} \
|
||||
|
||||
// transmit until endX, don't check size since it has already been prevalidated
|
||||
#define TRANSMIT_HOSTLOCAL_X_(psm, T, widthlimit, blockheight, startX) { \
|
||||
for(int tempi = 0; tempi < blockheight; ++tempi) { \
|
||||
for(j = startX; j < gs.imageEndX; j++, pbuf++) { \
|
||||
writePixel##psm##_0(pstart, j%2048, (i+tempi)%2048, pbuf[0], gs.dstbuf.bw); \
|
||||
} \
|
||||
pbuf += pitch-fracX; \
|
||||
} \
|
||||
} \
|
||||
|
||||
// transfers whole rows
|
||||
#define TRANSMIT_HOSTLOCAL_Y_24(psm, T, widthlimit, endY) { \
|
||||
if( widthlimit != 8 || ((gs.imageEndX-gs.trxpos.dx)%widthlimit) ) { \
|
||||
/*GS_LOG("Bad Transmission! %d %d, psm: %d\n", gs.trxpos.dx, gs.imageEndX, DSTPSM);*/ \
|
||||
for(; i < endY; ++i) { \
|
||||
for(; j < gs.imageEndX && nSize > 0; j += 1, nSize -= 1, pbuf += 3) { \
|
||||
writePixel##psm##_0(pstart, j%2048, i%2048, *(u32*)(pbuf), gs.dstbuf.bw); \
|
||||
} \
|
||||
\
|
||||
if( j >= gs.imageEndX ) { assert(gs.imageTransfer == -1 || j == gs.imageEndX); j = gs.trxpos.dx; } \
|
||||
else { assert( gs.imageTransfer == -1 || nSize == 0 ); goto End; } \
|
||||
} \
|
||||
} \
|
||||
else { \
|
||||
assert( /*(nSize%widthlimit) == 0 &&*/ widthlimit == 8 ); \
|
||||
for(; i < endY; ++i) { \
|
||||
for(; j < gs.imageEndX && nSize > 0; j += widthlimit, nSize -= widthlimit, pbuf += 3*widthlimit) { \
|
||||
if( nSize < widthlimit ) goto End; \
|
||||
/* write as many pixel at one time as possible */ \
|
||||
writePixel##psm##_0(pstart, j%2048, i%2048, *(u32*)(pbuf+0), gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+1)%2048, i%2048, *(u32*)(pbuf+3), gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+2)%2048, i%2048, *(u32*)(pbuf+6), gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+3)%2048, i%2048, *(u32*)(pbuf+9), gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+4)%2048, i%2048, *(u32*)(pbuf+12), gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+5)%2048, i%2048, *(u32*)(pbuf+15), gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+6)%2048, i%2048, *(u32*)(pbuf+18), gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+7)%2048, i%2048, *(u32*)(pbuf+21), gs.dstbuf.bw); \
|
||||
} \
|
||||
\
|
||||
if( j >= gs.imageEndX ) { assert(gs.imageTransfer == -1 || j == gs.imageEndX); j = gs.trxpos.dx; } \
|
||||
else { \
|
||||
if( nSize < 0 ) { \
|
||||
/* extracted too much */ \
|
||||
assert( (nSize%3)==0 && nSize > -24 ); \
|
||||
j += nSize/3; \
|
||||
nSize = 0; \
|
||||
} \
|
||||
assert( gs.imageTransfer == -1 || nSize == 0 ); \
|
||||
goto End; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
|
||||
// transmit until endX, don't check size since it has already been prevalidated
|
||||
#define TRANSMIT_HOSTLOCAL_X_24(psm, T, widthlimit, blockheight, startX) { \
|
||||
for(int tempi = 0; tempi < blockheight; ++tempi) { \
|
||||
for(j = startX; j < gs.imageEndX; j++, pbuf += 3) { \
|
||||
writePixel##psm##_0(pstart, j%2048, (i+tempi)%2048, *(u32*)pbuf, gs.dstbuf.bw); \
|
||||
} \
|
||||
pbuf += 3*(pitch-fracX); \
|
||||
} \
|
||||
} \
|
||||
|
||||
// meant for 4bit transfers
|
||||
#define TRANSMIT_HOSTLOCAL_Y_4(psm, T, widthlimit, endY) { \
|
||||
for(; i < endY; ++i) { \
|
||||
for(; j < gs.imageEndX && nSize > 0; j += widthlimit, nSize -= widthlimit) { \
|
||||
/* write as many pixel at one time as possible */ \
|
||||
writePixel##psm##_0(pstart, j%2048, i%2048, *pbuf&0x0f, gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+1)%2048, i%2048, *pbuf>>4, gs.dstbuf.bw); \
|
||||
pbuf++; \
|
||||
if( widthlimit > 2 ) { \
|
||||
writePixel##psm##_0(pstart, (j+2)%2048, i%2048, *pbuf&0x0f, gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+3)%2048, i%2048, *pbuf>>4, gs.dstbuf.bw); \
|
||||
pbuf++; \
|
||||
\
|
||||
if( widthlimit > 4 ) { \
|
||||
writePixel##psm##_0(pstart, (j+4)%2048, i%2048, *pbuf&0x0f, gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+5)%2048, i%2048, *pbuf>>4, gs.dstbuf.bw); \
|
||||
pbuf++; \
|
||||
\
|
||||
if( widthlimit > 6 ) { \
|
||||
writePixel##psm##_0(pstart, (j+6)%2048, i%2048, *pbuf&0x0f, gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+7)%2048, i%2048, *pbuf>>4, gs.dstbuf.bw); \
|
||||
pbuf++; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
if( j >= gs.imageEndX ) { j = gs.trxpos.dx; } \
|
||||
else { assert( gs.imageTransfer == -1 || (nSize/32) == 0 ); goto End; } \
|
||||
} \
|
||||
} \
|
||||
|
||||
// transmit until endX, don't check size since it has already been prevalidated
|
||||
#define TRANSMIT_HOSTLOCAL_X_4(psm, T, widthlimit, blockheight, startX) { \
|
||||
for(int tempi = 0; tempi < blockheight; ++tempi) { \
|
||||
for(j = startX; j < gs.imageEndX; j+=2, pbuf++) { \
|
||||
writePixel##psm##_0(pstart, j%2048, (i+tempi)%2048, pbuf[0]&0x0f, gs.dstbuf.bw); \
|
||||
writePixel##psm##_0(pstart, (j+1)%2048, (i+tempi)%2048, pbuf[0]>>4, gs.dstbuf.bw); \
|
||||
} \
|
||||
pbuf += (pitch-fracX)/2; \
|
||||
} \
|
||||
} \
|
||||
|
||||
// calculate pitch in source buffer
|
||||
#define TRANSMIT_PITCH_(pitch, T) (pitch*sizeof(T))
|
||||
#define TRANSMIT_PITCH_24(pitch, T) (pitch*3)
|
||||
#define TRANSMIT_PITCH_4(pitch, T) (pitch/2)
|
||||
|
||||
// special swizzle macros
|
||||
#define SwizzleBlock24(dst, src, pitch) { \
|
||||
u8* pnewsrc = src; \
|
||||
u32* pblock = tempblock; \
|
||||
\
|
||||
for(int by = 0; by < 7; ++by, pblock += 8, pnewsrc += pitch-24) { \
|
||||
for(int bx = 0; bx < 8; ++bx, pnewsrc += 3) { \
|
||||
pblock[bx] = *(u32*)pnewsrc; \
|
||||
} \
|
||||
} \
|
||||
for(int bx = 0; bx < 7; ++bx, pnewsrc += 3) { \
|
||||
/* might be 1 byte out of bounds of GS memory */ \
|
||||
pblock[bx] = *(u32*)pnewsrc; \
|
||||
} \
|
||||
/* do 3 bytes for the last copy */ \
|
||||
*((u8*)pblock+28) = pnewsrc[0]; \
|
||||
*((u8*)pblock+29) = pnewsrc[1]; \
|
||||
*((u8*)pblock+30) = pnewsrc[2]; \
|
||||
SwizzleBlock32((u8*)dst, (u8*)tempblock, 32, 0x00ffffff); \
|
||||
} \
|
||||
|
||||
#define SwizzleBlock24u SwizzleBlock24
|
||||
|
||||
#define SwizzleBlock8H(dst, src, pitch) { \
|
||||
u8* pnewsrc = src; \
|
||||
u32* pblock = tempblock; \
|
||||
\
|
||||
for(int by = 0; by < 8; ++by, pblock += 8, pnewsrc += pitch) { \
|
||||
u32 u = *(u32*)pnewsrc; \
|
||||
pblock[0] = u<<24; \
|
||||
pblock[1] = u<<16; \
|
||||
pblock[2] = u<<8; \
|
||||
pblock[3] = u; \
|
||||
u = *(u32*)(pnewsrc+4); \
|
||||
pblock[4] = u<<24; \
|
||||
pblock[5] = u<<16; \
|
||||
pblock[6] = u<<8; \
|
||||
pblock[7] = u; \
|
||||
} \
|
||||
SwizzleBlock32((u8*)dst, (u8*)tempblock, 32, 0xff000000); \
|
||||
} \
|
||||
|
||||
#define SwizzleBlock8Hu SwizzleBlock8H
|
||||
|
||||
#define SwizzleBlock4HH(dst, src, pitch) { \
|
||||
u8* pnewsrc = src; \
|
||||
u32* pblock = tempblock; \
|
||||
\
|
||||
for(int by = 0; by < 8; ++by, pblock += 8, pnewsrc += pitch) { \
|
||||
u32 u = *(u32*)pnewsrc; \
|
||||
pblock[0] = u<<28; \
|
||||
pblock[1] = u<<24; \
|
||||
pblock[2] = u<<20; \
|
||||
pblock[3] = u<<16; \
|
||||
pblock[4] = u<<12; \
|
||||
pblock[5] = u<<8; \
|
||||
pblock[6] = u<<4; \
|
||||
pblock[7] = u; \
|
||||
} \
|
||||
SwizzleBlock32((u8*)dst, (u8*)tempblock, 32, 0xf0000000); \
|
||||
} \
|
||||
|
||||
#define SwizzleBlock4HHu SwizzleBlock4HH
|
||||
|
||||
#define SwizzleBlock4HL(dst, src, pitch) { \
|
||||
u8* pnewsrc = src; \
|
||||
u32* pblock = tempblock; \
|
||||
\
|
||||
for(int by = 0; by < 8; ++by, pblock += 8, pnewsrc += pitch) { \
|
||||
u32 u = *(u32*)pnewsrc; \
|
||||
pblock[0] = u<<24; \
|
||||
pblock[1] = u<<20; \
|
||||
pblock[2] = u<<16; \
|
||||
pblock[3] = u<<12; \
|
||||
pblock[4] = u<<8; \
|
||||
pblock[5] = u<<4; \
|
||||
pblock[6] = u; \
|
||||
pblock[7] = u>>4; \
|
||||
} \
|
||||
SwizzleBlock32((u8*)dst, (u8*)tempblock, 32, 0x0f000000); \
|
||||
} \
|
||||
|
||||
#define SwizzleBlock4HLu SwizzleBlock4HL
|
||||
|
||||
// ------------------------
|
||||
// | Y |
|
||||
// ------------------------
|
||||
// | block | |
|
||||
// | aligned area | X |
|
||||
// | | |
|
||||
// ------------------------
|
||||
// | Y |
|
||||
// ------------------------
|
||||
#define DEFINE_TRANSFERLOCAL(psm, T, widthlimit, blockbits, blockwidth, blockheight, TransSfx, SwizzleBlock) \
|
||||
int TransferHostLocal##psm(const void* pbyMem, u32 nQWordSize) \
|
||||
{ \
|
||||
START_HOSTLOCAL(); \
|
||||
\
|
||||
const T* pbuf = (const T*)pbyMem; \
|
||||
int nLeftOver = (nQWordSize*4*2)%(TRANSMIT_PITCH##TransSfx(2, T)); \
|
||||
int nSize = nQWordSize*4*2/TRANSMIT_PITCH##TransSfx(2, T); \
|
||||
nSize = min(nSize, gs.imageWnew * gs.imageHnew); \
|
||||
\
|
||||
int pitch, area, fracX; \
|
||||
int endY = ROUND_UPPOW2(i, blockheight); \
|
||||
int alignedY = ROUND_DOWNPOW2(gs.imageEndY, blockheight); \
|
||||
int alignedX = ROUND_DOWNPOW2(gs.imageEndX, blockwidth); \
|
||||
bool bAligned, bCanAlign = MOD_POW2(gs.trxpos.dx, blockwidth) == 0 && (j == gs.trxpos.dx) && (alignedY > endY) && alignedX > gs.trxpos.dx; \
|
||||
\
|
||||
if( (gs.imageEndX-gs.trxpos.dx)%widthlimit ) { \
|
||||
/* hack */ \
|
||||
int testwidth = (int)nSize - (gs.imageEndY-i)*(gs.imageEndX-gs.trxpos.dx)+(j-gs.trxpos.dx); \
|
||||
if( testwidth <= widthlimit && testwidth >= -widthlimit ) { \
|
||||
/* don't transfer */ \
|
||||
/*DEBUG_LOG("bad texture %s: %d %d %d\n", #psm, gs.trxpos.dx, gs.imageEndX, nQWordSize);*/ \
|
||||
gs.imageTransfer = -1; \
|
||||
} \
|
||||
bCanAlign = false; \
|
||||
} \
|
||||
\
|
||||
/* first align on block boundary */ \
|
||||
if( MOD_POW2(i, blockheight) || !bCanAlign ) { \
|
||||
\
|
||||
if( !bCanAlign ) \
|
||||
endY = gs.imageEndY; /* transfer the whole image */ \
|
||||
else \
|
||||
assert( endY < gs.imageEndY); /* part of alignment condition */ \
|
||||
\
|
||||
if( ((gs.imageEndX-gs.trxpos.dx)%widthlimit) || ((gs.imageEndX-j)%widthlimit) ) { \
|
||||
/* transmit with a width of 1 */ \
|
||||
TRANSMIT_HOSTLOCAL_Y##TransSfx(psm, T, (1+(DSTPSM == 0x14)), endY); \
|
||||
} \
|
||||
else { \
|
||||
TRANSMIT_HOSTLOCAL_Y##TransSfx(psm, T, widthlimit, endY); \
|
||||
} \
|
||||
\
|
||||
if( nSize == 0 || i == gs.imageEndY ) \
|
||||
goto End; \
|
||||
} \
|
||||
\
|
||||
assert( MOD_POW2(i, blockheight) == 0 && j == gs.trxpos.dx); \
|
||||
\
|
||||
/* can align! */ \
|
||||
pitch = gs.imageEndX-gs.trxpos.dx; \
|
||||
area = pitch*blockheight; \
|
||||
fracX = gs.imageEndX-alignedX; \
|
||||
\
|
||||
/* on top of checking whether pbuf is alinged, make sure that the width is at least aligned to its limits (due to bugs in pcsx2) */ \
|
||||
bAligned = !((uptr)pbuf & 0xf) && (TRANSMIT_PITCH##TransSfx(pitch, T)&0xf) == 0; \
|
||||
\
|
||||
/* transfer aligning to blocks */ \
|
||||
for(; i < alignedY && nSize >= area; i += blockheight, nSize -= area) { \
|
||||
\
|
||||
if( bAligned || ((DSTPSM==PSMCT24) || (DSTPSM==PSMT8H) || (DSTPSM==PSMT4HH) || (DSTPSM==PSMT4HL)) ) { \
|
||||
for(int tempj = gs.trxpos.dx; tempj < alignedX; tempj += blockwidth, pbuf += TRANSMIT_PITCH##TransSfx(blockwidth, T)/sizeof(T)) { \
|
||||
SwizzleBlock(pstart + getPixelAddress##psm##_0(tempj, i, gs.dstbuf.bw)*blockbits/8, \
|
||||
(u8*)pbuf, TRANSMIT_PITCH##TransSfx(pitch, T)); \
|
||||
} \
|
||||
} \
|
||||
else { \
|
||||
for(int tempj = gs.trxpos.dx; tempj < alignedX; tempj += blockwidth, pbuf += TRANSMIT_PITCH##TransSfx(blockwidth, T)/sizeof(T)) { \
|
||||
SwizzleBlock##u(pstart + getPixelAddress##psm##_0(tempj, i, gs.dstbuf.bw)*blockbits/8, \
|
||||
(u8*)pbuf, TRANSMIT_PITCH##TransSfx(pitch, T)); \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
/* transfer the rest */ \
|
||||
if( alignedX < gs.imageEndX ) { \
|
||||
TRANSMIT_HOSTLOCAL_X##TransSfx(psm, T, widthlimit, blockheight, alignedX); \
|
||||
pbuf -= TRANSMIT_PITCH##TransSfx((alignedX-gs.trxpos.dx), T)/sizeof(T); \
|
||||
} \
|
||||
else pbuf += (blockheight-1)*TRANSMIT_PITCH##TransSfx(pitch, T)/sizeof(T); \
|
||||
j = gs.trxpos.dx; \
|
||||
} \
|
||||
\
|
||||
if( TRANSMIT_PITCH##TransSfx(nSize, T)/4 > 0 ) { \
|
||||
TRANSMIT_HOSTLOCAL_Y##TransSfx(psm, T, widthlimit, gs.imageEndY); \
|
||||
/* sometimes wrong sizes are sent (tekken tag) */ \
|
||||
assert( gs.imageTransfer == -1 || TRANSMIT_PITCH##TransSfx(nSize,T)/4 <= 2 ); \
|
||||
} \
|
||||
\
|
||||
END_HOSTLOCAL(); \
|
||||
return (nSize * TRANSMIT_PITCH##TransSfx(2, T) + nLeftOver)/2; \
|
||||
} \
|
||||
|
||||
DEFINE_TRANSFERLOCAL(32, u32, 2, 32, 8, 8, _, SwizzleBlock32);
|
||||
DEFINE_TRANSFERLOCAL(32Z, u32, 2, 32, 8, 8, _, SwizzleBlock32);
|
||||
DEFINE_TRANSFERLOCAL(24, u8, 8, 32, 8, 8, _24, SwizzleBlock24);
|
||||
DEFINE_TRANSFERLOCAL(24Z, u8, 8, 32, 8, 8, _24, SwizzleBlock24);
|
||||
DEFINE_TRANSFERLOCAL(16, u16, 4, 16, 16, 8, _, SwizzleBlock16);
|
||||
DEFINE_TRANSFERLOCAL(16S, u16, 4, 16, 16, 8, _, SwizzleBlock16);
|
||||
DEFINE_TRANSFERLOCAL(16Z, u16, 4, 16, 16, 8, _, SwizzleBlock16);
|
||||
DEFINE_TRANSFERLOCAL(16SZ, u16, 4, 16, 16, 8, _, SwizzleBlock16);
|
||||
DEFINE_TRANSFERLOCAL(8, u8, 4, 8, 16, 16, _, SwizzleBlock8);
|
||||
DEFINE_TRANSFERLOCAL(4, u8, 8, 4, 32, 16, _4, SwizzleBlock4);
|
||||
DEFINE_TRANSFERLOCAL(8H, u8, 4, 32, 8, 8, _, SwizzleBlock8H);
|
||||
DEFINE_TRANSFERLOCAL(4HL, u8, 8, 32, 8, 8, _4, SwizzleBlock4HL);
|
||||
DEFINE_TRANSFERLOCAL(4HH, u8, 8, 32, 8, 8, _4, SwizzleBlock4HH);
|
||||
|
||||
//#define T u8
|
||||
//#define widthlimit 8
|
||||
//#define blockbits 4
|
||||
//#define blockwidth 32
|
||||
//#define blockheight 16
|
||||
//
|
||||
//void TransferHostLocal4(const void* pbyMem, u32 nQWordSize)
|
||||
//{
|
||||
// START_HOSTLOCAL();
|
||||
//
|
||||
// const T* pbuf = (const T*)pbyMem;
|
||||
// u32 nSize = nQWordSize*16*2/TRANSMIT_PITCH_4(2, T);
|
||||
// nSize = min(nSize, gs.imageWnew * gs.imageHnew);
|
||||
//
|
||||
// int endY = ROUND_UPPOW2(i, blockheight);
|
||||
// int alignedY = ROUND_DOWNPOW2(gs.imageEndY, blockheight);
|
||||
// int alignedX = ROUND_DOWNPOW2(gs.imageEndX, blockwidth);
|
||||
// bool bCanAlign = MOD_POW2(gs.trxpos.dx, blockwidth) == 0 && (j == gs.trxpos.dx) && (alignedY > endY) && alignedX > gs.trxpos.dx;
|
||||
//
|
||||
// if( (gs.imageEndX-gs.trxpos.dx)%widthlimit ) {
|
||||
// /* hack */
|
||||
// if( abs((int)nSize - (gs.imageEndY-i)*(gs.imageEndX-gs.trxpos.dx)+(j-gs.trxpos.dx)) <= widthlimit ) {
|
||||
// /* don't transfer */
|
||||
// /*DEBUG_LOG("bad texture %s: %d %d %d\n", #psm, gs.trxpos.dx, gs.imageEndX, nQWordSize);*/
|
||||
// gs.imageTransfer = -1;
|
||||
// }
|
||||
// bCanAlign = false;
|
||||
// }
|
||||
//
|
||||
// /* first align on block boundary */
|
||||
// if( MOD_POW2(i, blockheight) || !bCanAlign ) {
|
||||
//
|
||||
// if( !bCanAlign )
|
||||
// endY = gs.imageEndY; /* transfer the whole image */
|
||||
// else
|
||||
// assert( endY < gs.imageEndY); /* part of alignment condition */
|
||||
//
|
||||
// if( (DSTPSM == 0x13 || DSTPSM == 0x14) && ((gs.imageEndX-gs.trxpos.dx)%widthlimit) ) {
|
||||
// /* transmit with a width of 1 */
|
||||
// TRANSMIT_HOSTLOCAL_Y_4(4, T, (1+(DSTPSM == 0x14)), endY);
|
||||
// }
|
||||
// else {
|
||||
// TRANSMIT_HOSTLOCAL_Y_4(4, T, widthlimit, endY);
|
||||
// }
|
||||
//
|
||||
// if( nSize == 0 || i == gs.imageEndY )
|
||||
// goto End;
|
||||
// }
|
||||
//
|
||||
// assert( MOD_POW2(i, blockheight) == 0 && j == gs.trxpos.dx);
|
||||
//
|
||||
// /* can align! */
|
||||
// int pitch = gs.imageEndX-gs.trxpos.dx;
|
||||
// u32 area = pitch*blockheight;
|
||||
// int fracX = gs.imageEndX-alignedX;
|
||||
//
|
||||
// /* on top of checking whether pbuf is alinged, make sure that the width is at least aligned to its limits (due to bugs in pcsx2) */
|
||||
// bool bAligned = !((u32)pbuf & 0xf) && (TRANSMIT_PITCH_4(pitch, T)&0xf) == 0;
|
||||
//
|
||||
// /* transfer aligning to blocks */
|
||||
// for(; i < alignedY && nSize >= area; i += blockheight, nSize -= area) {
|
||||
//
|
||||
// if( bAligned || ((DSTPSM==PSMCT24) || (DSTPSM==PSMT8H) || (DSTPSM==PSMT4HH) || (DSTPSM==PSMT4HL)) ) {
|
||||
// for(int tempj = gs.trxpos.dx; tempj < alignedX; tempj += blockwidth, pbuf += TRANSMIT_PITCH_4(blockwidth, T)/sizeof(T)) {
|
||||
// SwizzleBlock4(pstart + getPixelAddress4_0(tempj, i, gs.dstbuf.bw)*blockbits/8,
|
||||
// (u8*)pbuf, TRANSMIT_PITCH_4(pitch, T));
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
// for(int tempj = gs.trxpos.dx; tempj < alignedX; tempj += blockwidth, pbuf += TRANSMIT_PITCH_4(blockwidth, T)/sizeof(T)) {
|
||||
// SwizzleBlock4u(pstart + getPixelAddress4_0(tempj, i, gs.dstbuf.bw)*blockbits/8,
|
||||
// (u8*)pbuf, TRANSMIT_PITCH_4(pitch, T));
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /* transfer the rest */
|
||||
// if( alignedX < gs.imageEndX ) {
|
||||
// TRANSMIT_HOSTLOCAL_X_4(4, T, widthlimit, blockheight, alignedX);
|
||||
// pbuf -= TRANSMIT_PITCH_4((alignedX-gs.trxpos.dx), T)/sizeof(T);
|
||||
// }
|
||||
// else pbuf += (blockheight-1)*TRANSMIT_PITCH_4(pitch, T)/sizeof(T);
|
||||
// j = 0;
|
||||
// }
|
||||
//
|
||||
// if( TRANSMIT_PITCH_4(nSize, T)/4 > 0 ) {
|
||||
// TRANSMIT_HOSTLOCAL_Y_4(4, T, widthlimit, gs.imageEndY);
|
||||
// /* sometimes wrong sizes are sent (tekken tag) */
|
||||
// assert( gs.imageTransfer == -1 || TRANSMIT_PITCH_4(nSize,T)/4 <= 2 );
|
||||
// }
|
||||
//
|
||||
// END_HOSTLOCAL();
|
||||
//}
|
||||
|
||||
void TransferLocalHost32(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost24(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost16(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost16S(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost8(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost4(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost8H(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost4HL(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost4HH(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost32Z(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost24Z(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost16Z(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
void TransferLocalHost16SZ(void* pbyMem, u32 nQWordSize)
|
||||
{
|
||||
}
|
||||
|
||||
#define FILL_BLOCK(bw, bh, ox, oy, mult, psm, psmcol) { \
|
||||
b.vTexDims = Vector(BLOCK_TEXWIDTH/(float)(bw), BLOCK_TEXHEIGHT/(float)bh, 0, 0); \
|
||||
b.vTexBlock = Vector((float)bw/BLOCK_TEXWIDTH, (float)bh/BLOCK_TEXHEIGHT, ((float)ox+0.2f)/BLOCK_TEXWIDTH, ((float)oy+0.05f)/BLOCK_TEXHEIGHT); \
|
||||
b.width = bw; \
|
||||
b.height = bh; \
|
||||
b.colwidth = bh / 4; \
|
||||
b.colheight = bw / 8; \
|
||||
b.bpp = 32/mult; \
|
||||
\
|
||||
b.pageTable = &g_pageTable##psm[0][0]; \
|
||||
b.blockTable = &g_blockTable##psm[0][0]; \
|
||||
b.columnTable = &g_columnTable##psmcol[0][0]; \
|
||||
assert( sizeof(g_pageTable##psm) == bw*bh*sizeof(g_pageTable##psm[0][0]) ); \
|
||||
psrcf = (float*)&vBlockData[0] + ox + oy * BLOCK_TEXWIDTH; \
|
||||
psrcw = (u16*)&vBlockData[0] + ox + oy * BLOCK_TEXWIDTH; \
|
||||
for(i = 0; i < bh; ++i) { \
|
||||
for(j = 0; j < bw; ++j) { \
|
||||
/* fill the table */ \
|
||||
u32 u = g_blockTable##psm[(i / b.colheight)][(j / b.colwidth)] * 64 * mult + g_columnTable##psmcol[i%b.colheight][j%b.colwidth]; \
|
||||
b.pageTable[i*bw+j] = u; \
|
||||
if( floatfmt ) { \
|
||||
psrcf[i*BLOCK_TEXWIDTH+j] = (float)(u) / (float)(GPU_TEXWIDTH*mult); \
|
||||
} \
|
||||
else { \
|
||||
psrcw[i*BLOCK_TEXWIDTH+j] = u; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
\
|
||||
if( floatfmt ) { \
|
||||
assert( floatfmt ); \
|
||||
psrcv = (Vector*)&vBilinearData[0] + ox + oy * BLOCK_TEXWIDTH; \
|
||||
for(i = 0; i < bh; ++i) { \
|
||||
for(j = 0; j < bw; ++j) { \
|
||||
Vector* pv = &psrcv[i*BLOCK_TEXWIDTH+j]; \
|
||||
pv->x = psrcf[i*BLOCK_TEXWIDTH+j]; \
|
||||
pv->y = psrcf[i*BLOCK_TEXWIDTH+((j+1)%bw)]; \
|
||||
pv->z = psrcf[((i+1)%bh)*BLOCK_TEXWIDTH+j]; \
|
||||
pv->w = psrcf[((i+1)%bh)*BLOCK_TEXWIDTH+((j+1)%bw)]; \
|
||||
} \
|
||||
} \
|
||||
} \
|
||||
b.getPixelAddress = getPixelAddress##psm; \
|
||||
b.getPixelAddress_0 = getPixelAddress##psm##_0; \
|
||||
b.writePixel = writePixel##psm; \
|
||||
b.writePixel_0 = writePixel##psm##_0; \
|
||||
b.readPixel = readPixel##psm; \
|
||||
b.readPixel_0 = readPixel##psm##_0; \
|
||||
b.TransferHostLocal = TransferHostLocal##psm; \
|
||||
b.TransferLocalHost = TransferLocalHost##psm; \
|
||||
} \
|
||||
|
||||
void BLOCK::FillBlocks(vector<char>& vBlockData, vector<char>& vBilinearData, int floatfmt)
|
||||
{
|
||||
vBlockData.resize(BLOCK_TEXWIDTH * BLOCK_TEXHEIGHT * (floatfmt ? 4 : 2));
|
||||
if( floatfmt )
|
||||
vBilinearData.resize(BLOCK_TEXWIDTH * BLOCK_TEXHEIGHT * sizeof(Vector));
|
||||
|
||||
int i, j;
|
||||
BLOCK b;
|
||||
float* psrcf = NULL;
|
||||
u16* psrcw = NULL;
|
||||
Vector* psrcv = NULL;
|
||||
|
||||
memset(m_Blocks, 0, sizeof(m_Blocks));
|
||||
|
||||
// 32
|
||||
FILL_BLOCK(64, 32, 0, 0, 1, 32, 32);
|
||||
m_Blocks[PSMCT32] = b;
|
||||
|
||||
// 24 (same as 32 except write/readPixel are different)
|
||||
m_Blocks[PSMCT24] = b;
|
||||
m_Blocks[PSMCT24].writePixel = writePixel24;
|
||||
m_Blocks[PSMCT24].writePixel_0 = writePixel24_0;
|
||||
m_Blocks[PSMCT24].readPixel = readPixel24;
|
||||
m_Blocks[PSMCT24].readPixel_0 = readPixel24_0;
|
||||
m_Blocks[PSMCT24].TransferHostLocal = TransferHostLocal24;
|
||||
m_Blocks[PSMCT24].TransferLocalHost = TransferLocalHost24;
|
||||
|
||||
// 8H (same as 32 except write/readPixel are different)
|
||||
m_Blocks[PSMT8H] = b;
|
||||
m_Blocks[PSMT8H].writePixel = writePixel8H;
|
||||
m_Blocks[PSMT8H].writePixel_0 = writePixel8H_0;
|
||||
m_Blocks[PSMT8H].readPixel = readPixel8H;
|
||||
m_Blocks[PSMT8H].readPixel_0 = readPixel8H_0;
|
||||
m_Blocks[PSMT8H].TransferHostLocal = TransferHostLocal8H;
|
||||
m_Blocks[PSMT8H].TransferLocalHost = TransferLocalHost8H;
|
||||
|
||||
m_Blocks[PSMT4HL] = b;
|
||||
m_Blocks[PSMT4HL].writePixel = writePixel4HL;
|
||||
m_Blocks[PSMT4HL].writePixel_0 = writePixel4HL_0;
|
||||
m_Blocks[PSMT4HL].readPixel = readPixel4HL;
|
||||
m_Blocks[PSMT4HL].readPixel_0 = readPixel4HL_0;
|
||||
m_Blocks[PSMT4HL].TransferHostLocal = TransferHostLocal4HL;
|
||||
m_Blocks[PSMT4HL].TransferLocalHost = TransferLocalHost4HL;
|
||||
|
||||
m_Blocks[PSMT4HH] = b;
|
||||
m_Blocks[PSMT4HH].writePixel = writePixel4HH;
|
||||
m_Blocks[PSMT4HH].writePixel_0 = writePixel4HH_0;
|
||||
m_Blocks[PSMT4HH].readPixel = readPixel4HH;
|
||||
m_Blocks[PSMT4HH].readPixel_0 = readPixel4HH_0;
|
||||
m_Blocks[PSMT4HH].TransferHostLocal = TransferHostLocal4HH;
|
||||
m_Blocks[PSMT4HH].TransferLocalHost = TransferLocalHost4HH;
|
||||
|
||||
// 32z
|
||||
FILL_BLOCK(64, 32, 64, 0, 1, 32Z, 32);
|
||||
m_Blocks[PSMT32Z] = b;
|
||||
|
||||
// 24Z (same as 32Z except write/readPixel are different)
|
||||
m_Blocks[PSMT24Z] = b;
|
||||
m_Blocks[PSMT24Z].writePixel = writePixel24Z;
|
||||
m_Blocks[PSMT24Z].writePixel_0 = writePixel24Z_0;
|
||||
m_Blocks[PSMT24Z].readPixel = readPixel24Z;
|
||||
m_Blocks[PSMT24Z].readPixel_0 = readPixel24Z_0;
|
||||
m_Blocks[PSMT24Z].TransferHostLocal = TransferHostLocal24Z;
|
||||
m_Blocks[PSMT24Z].TransferLocalHost = TransferLocalHost24Z;
|
||||
|
||||
// 16
|
||||
FILL_BLOCK(64, 64, 0, 32, 2, 16, 16);
|
||||
m_Blocks[PSMCT16] = b;
|
||||
|
||||
// 16s
|
||||
FILL_BLOCK(64, 64, 64, 32, 2, 16S, 16);
|
||||
m_Blocks[PSMCT16S] = b;
|
||||
|
||||
// 16z
|
||||
FILL_BLOCK(64, 64, 0, 96, 2, 16Z, 16);
|
||||
m_Blocks[PSMT16Z] = b;
|
||||
|
||||
// 16sz
|
||||
FILL_BLOCK(64, 64, 64, 96, 2, 16SZ, 16);
|
||||
m_Blocks[PSMT16SZ] = b;
|
||||
|
||||
// 8
|
||||
FILL_BLOCK(128, 64, 0, 160, 4, 8, 8);
|
||||
m_Blocks[PSMT8] = b;
|
||||
|
||||
// 4
|
||||
FILL_BLOCK(128, 128, 0, 224, 8, 4, 4);
|
||||
m_Blocks[PSMT4] = b;
|
||||
}
|
|
@ -1,480 +0,0 @@
|
|||
/* ZeroGS KOSMOS
|
||||
* Copyright (C) 2005-2006 zerofrog@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 __MEM_H__
|
||||
#define __MEM_H__
|
||||
|
||||
#include <assert.h>
|
||||
#include <vector>
|
||||
|
||||
// works only when base is a power of 2
|
||||
#define ROUND_UPPOW2(val, base) (((val)+(base-1))&~(base-1))
|
||||
#define ROUND_DOWNPOW2(val, base) ((val)&~(base-1))
|
||||
#define MOD_POW2(val, base) ((val)&(base-1))
|
||||
|
||||
// d3d texture dims
|
||||
#define BLOCK_TEXWIDTH 128
|
||||
#define BLOCK_TEXHEIGHT 512
|
||||
|
||||
// rest not visible externally
|
||||
struct BLOCK
|
||||
{
|
||||
BLOCK() { memset(this, 0, sizeof(BLOCK)); }
|
||||
|
||||
// shader constants for this block
|
||||
Vector vTexBlock;
|
||||
Vector vTexDims;
|
||||
int width, height; // dims of one page in pixels
|
||||
int bpp;
|
||||
int colwidth, colheight;
|
||||
u32* pageTable; // offset inside each page
|
||||
u32* blockTable;
|
||||
u32* columnTable;
|
||||
|
||||
u32 (*getPixelAddress)(int x, int y, u32 bp, u32 bw);
|
||||
u32 (*getPixelAddress_0)(int x, int y, u32 bw);
|
||||
void (*writePixel)(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw);
|
||||
void (*writePixel_0)(void* pmem, int x, int y, u32 pixel, u32 bw);
|
||||
u32 (*readPixel)(const void* pmem, int x, int y, u32 bp, u32 bw);
|
||||
u32 (*readPixel_0)(const void* pmem, int x, int y, u32 bw);
|
||||
int (*TransferHostLocal)(const void* pbyMem, u32 nQWordSize);
|
||||
void (*TransferLocalHost)(void* pbyMem, u32 nQWordSize);
|
||||
|
||||
// texture must be of dims BLOCK_TEXWIDTH and BLOCK_TEXHEIGHT
|
||||
static void FillBlocks(std::vector<char>& vBlockData, std::vector<char>& vBilinearData, int floatfmt);
|
||||
};
|
||||
|
||||
extern BLOCK m_Blocks[];
|
||||
|
||||
extern u32 g_blockTable32[4][8];
|
||||
extern u32 g_blockTable32Z[4][8];
|
||||
extern u32 g_blockTable16[8][4];
|
||||
extern u32 g_blockTable16S[8][4];
|
||||
extern u32 g_blockTable16Z[8][4];
|
||||
extern u32 g_blockTable16SZ[8][4];
|
||||
extern u32 g_blockTable8[4][8];
|
||||
extern u32 g_blockTable4[8][4];
|
||||
|
||||
extern u32 g_columnTable32[8][8];
|
||||
extern u32 g_columnTable16[8][16];
|
||||
extern u32 g_columnTable8[16][16];
|
||||
extern u32 g_columnTable4[16][32];
|
||||
|
||||
extern u32 g_pageTable32[32][64];
|
||||
extern u32 g_pageTable32Z[32][64];
|
||||
extern u32 g_pageTable16[64][64];
|
||||
extern u32 g_pageTable16S[64][64];
|
||||
extern u32 g_pageTable16Z[64][64];
|
||||
extern u32 g_pageTable16SZ[64][64];
|
||||
extern u32 g_pageTable8[64][128];
|
||||
extern u32 g_pageTable4[128][128];
|
||||
|
||||
static __forceinline u32 getPixelAddress32(int x, int y, u32 bp, u32 bw) {
|
||||
u32 basepage = ((y>>5) * (bw>>6)) + (x>>6);
|
||||
u32 word = bp * 64 + basepage * 2048 + g_pageTable32[y&31][x&63];
|
||||
//assert (word < 0x100000);
|
||||
//word = min(word, 0xfffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress32_0(int x, int y, u32 bw) {
|
||||
u32 basepage = ((y>>5) * (bw>>6)) + (x>>6);
|
||||
u32 word = basepage * 2048 + g_pageTable32[y&31][x&63];
|
||||
//assert (word < 0x100000);
|
||||
//word = min(word, 0xfffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
#define getPixelAddress24 getPixelAddress32
|
||||
#define getPixelAddress24_0 getPixelAddress32_0
|
||||
#define getPixelAddress8H getPixelAddress32
|
||||
#define getPixelAddress8H_0 getPixelAddress32_0
|
||||
#define getPixelAddress4HL getPixelAddress32
|
||||
#define getPixelAddress4HL_0 getPixelAddress32_0
|
||||
#define getPixelAddress4HH getPixelAddress32
|
||||
#define getPixelAddress4HH_0 getPixelAddress32_0
|
||||
|
||||
static __forceinline u32 getPixelAddress16(int x, int y, u32 bp, u32 bw) {
|
||||
u32 basepage = ((y>>6) * (bw>>6)) + (x>>6);
|
||||
u32 word = bp * 128 + basepage * 4096 + g_pageTable16[y&63][x&63];
|
||||
//assert (word < 0x200000);
|
||||
//word = min(word, 0x1fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress16_0(int x, int y, u32 bw) {
|
||||
u32 basepage = ((y>>6) * (bw>>6)) + (x>>6);
|
||||
u32 word = basepage * 4096 + g_pageTable16[y&63][x&63];
|
||||
//assert (word < 0x200000);
|
||||
//word = min(word, 0x1fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress16S(int x, int y, u32 bp, u32 bw) {
|
||||
u32 basepage = ((y>>6) * (bw>>6)) + (x>>6);
|
||||
u32 word = bp * 128 + basepage * 4096 + g_pageTable16S[y&63][x&63];
|
||||
//assert (word < 0x200000);
|
||||
//word = min(word, 0x1fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress16S_0(int x, int y, u32 bw) {
|
||||
u32 basepage = ((y>>6) * (bw>>6)) + (x>>6);
|
||||
u32 word = basepage * 4096 + g_pageTable16S[y&63][x&63];
|
||||
//assert (word < 0x200000);
|
||||
//word = min(word, 0x1fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress8(int x, int y, u32 bp, u32 bw) {
|
||||
u32 basepage = ((y>>6) * ((bw+127)>>7)) + (x>>7);
|
||||
u32 word = bp * 256 + basepage * 8192 + g_pageTable8[y&63][x&127];
|
||||
//assert (word < 0x400000);
|
||||
//word = min(word, 0x3fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress8_0(int x, int y, u32 bw) {
|
||||
u32 basepage = ((y>>6) * ((bw+127)>>7)) + (x>>7);
|
||||
u32 word = basepage * 8192 + g_pageTable8[y&63][x&127];
|
||||
//assert (word < 0x400000);
|
||||
//word = min(word, 0x3fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress4(int x, int y, u32 bp, u32 bw) {
|
||||
u32 basepage = ((y>>7) * ((bw+127)>>7)) + (x>>7);
|
||||
u32 word = bp * 512 + basepage * 16384 + g_pageTable4[y&127][x&127];
|
||||
//assert (word < 0x800000);
|
||||
//word = min(word, 0x7fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress4_0(int x, int y, u32 bw) {
|
||||
u32 basepage = ((y>>7) * ((bw+127)>>7)) + (x>>7);
|
||||
u32 word = basepage * 16384 + g_pageTable4[y&127][x&127];
|
||||
//assert (word < 0x800000);
|
||||
//word = min(word, 0x7fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress32Z(int x, int y, u32 bp, u32 bw) {
|
||||
u32 basepage = ((y>>5) * (bw>>6)) + (x>>6);
|
||||
u32 word = bp * 64 + basepage * 2048 + g_pageTable32Z[y&31][x&63];
|
||||
//assert (word < 0x100000);
|
||||
//word = min(word, 0xfffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress32Z_0(int x, int y, u32 bw) {
|
||||
u32 basepage = ((y>>5) * (bw>>6)) + (x>>6);
|
||||
u32 word = basepage * 2048 + g_pageTable32Z[y&31][x&63];
|
||||
//assert (word < 0x100000);
|
||||
//word = min(word, 0xfffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
#define getPixelAddress24Z getPixelAddress32Z
|
||||
#define getPixelAddress24Z_0 getPixelAddress32Z_0
|
||||
|
||||
static __forceinline u32 getPixelAddress16Z(int x, int y, u32 bp, u32 bw) {
|
||||
u32 basepage = ((y>>6) * (bw>>6)) + (x>>6);
|
||||
u32 word = bp * 128 + basepage * 4096 + g_pageTable16Z[y&63][x&63];
|
||||
//assert (word < 0x200000);
|
||||
//word = min(word, 0x1fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress16Z_0(int x, int y, u32 bw) {
|
||||
u32 basepage = ((y>>6) * (bw>>6)) + (x>>6);
|
||||
u32 word = basepage * 4096 + g_pageTable16Z[y&63][x&63];
|
||||
//assert (word < 0x200000);
|
||||
//word = min(word, 0x1fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress16SZ(int x, int y, u32 bp, u32 bw) {
|
||||
u32 basepage = ((y>>6) * (bw>>6)) + (x>>6);
|
||||
u32 word = bp * 128 + basepage * 4096 + g_pageTable16SZ[y&63][x&63];
|
||||
//assert (word < 0x200000);
|
||||
//word = min(word, 0x1fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline u32 getPixelAddress16SZ_0(int x, int y, u32 bw) {
|
||||
u32 basepage = ((y>>6) * (bw>>6)) + (x>>6);
|
||||
u32 word = basepage * 4096 + g_pageTable16SZ[y&63][x&63];
|
||||
//assert (word < 0x200000);
|
||||
//word = min(word, 0x1fffff);
|
||||
return word;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel32(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
((u32*)pmem)[getPixelAddress32(x, y, bp, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel24(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
u8 *buf = (u8*)&((u32*)pmem)[getPixelAddress32(x, y, bp, bw)];
|
||||
u8 *pix = (u8*)&pixel;
|
||||
buf[0] = pix[0]; buf[1] = pix[1]; buf[2] = pix[2];
|
||||
}
|
||||
|
||||
static __forceinline void writePixel16(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
((u16*)pmem)[getPixelAddress16(x, y, bp, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel16S(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
((u16*)pmem)[getPixelAddress16S(x, y, bp, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel8(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
((u8*)pmem)[getPixelAddress8(x, y, bp, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel8H(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
((u8*)pmem)[4*getPixelAddress32(x, y, bp, bw)+3] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel4(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
u32 addr = getPixelAddress4(x, y, bp, bw);
|
||||
u8 pix = ((u8*)pmem)[addr/2];
|
||||
if (addr & 0x1) ((u8*)pmem)[addr/2] = (pix & 0x0f) | (pixel << 4);
|
||||
else ((u8*)pmem)[addr/2] = (pix & 0xf0) | (pixel);
|
||||
}
|
||||
|
||||
static __forceinline void writePixel4HL(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
u8 *p = (u8*)pmem + 4*getPixelAddress4HL(x, y, bp, bw)+3;
|
||||
*p = (*p & 0xf0) | pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel4HH(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
u8 *p = (u8*)pmem + 4*getPixelAddress4HH(x, y, bp, bw)+3;
|
||||
*p = (*p & 0x0f) | (pixel<<4);
|
||||
}
|
||||
|
||||
static __forceinline void writePixel32Z(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
((u32*)pmem)[getPixelAddress32Z(x, y, bp, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel24Z(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
u8 *buf = (u8*)pmem + 4*getPixelAddress32Z(x, y, bp, bw);
|
||||
u8 *pix = (u8*)&pixel;
|
||||
buf[0] = pix[0]; buf[1] = pix[1]; buf[2] = pix[2];
|
||||
}
|
||||
|
||||
static __forceinline void writePixel16Z(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
((u16*)pmem)[getPixelAddress16Z(x, y, bp, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel16SZ(void* pmem, int x, int y, u32 pixel, u32 bp, u32 bw) {
|
||||
((u16*)pmem)[getPixelAddress16SZ(x, y, bp, bw)] = pixel;
|
||||
}
|
||||
|
||||
|
||||
///////////////
|
||||
|
||||
static __forceinline u32 readPixel32(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
return ((const u32*)pmem)[getPixelAddress32(x, y, bp, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel24(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
return ((const u32*)pmem)[getPixelAddress32(x, y, bp, bw)] & 0xffffff;
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel16(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
return ((const u16*)pmem)[getPixelAddress16(x, y, bp, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel16S(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
return ((const u16*)pmem)[getPixelAddress16S(x, y, bp, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel8(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
return ((const u8*)pmem)[getPixelAddress8(x, y, bp, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel8H(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
return ((const u8*)pmem)[4*getPixelAddress32(x, y, bp, bw) + 3];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel4(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
u32 addr = getPixelAddress4(x, y, bp, bw);
|
||||
u8 pix = ((const u8*)pmem)[addr/2];
|
||||
if (addr & 0x1)
|
||||
return pix >> 4;
|
||||
else return pix & 0xf;
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel4HL(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
const u8 *p = (const u8*)pmem+4*getPixelAddress4HL(x, y, bp, bw)+3;
|
||||
return *p & 0x0f;
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel4HH(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
const u8 *p = (const u8*)pmem+4*getPixelAddress4HH(x, y, bp, bw) + 3;
|
||||
return *p >> 4;
|
||||
}
|
||||
|
||||
///////////////
|
||||
|
||||
static __forceinline u32 readPixel32Z(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
return ((const u32*)pmem)[getPixelAddress32Z(x, y, bp, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel24Z(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
return ((const u32*)pmem)[getPixelAddress32Z(x, y, bp, bw)] & 0xffffff;
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel16Z(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
return ((const u16*)pmem)[getPixelAddress16Z(x, y, bp, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel16SZ(const void* pmem, int x, int y, u32 bp, u32 bw) {
|
||||
return ((const u16*)pmem)[getPixelAddress16SZ(x, y, bp, bw)];
|
||||
}
|
||||
|
||||
///////////////////////////////
|
||||
// Functions that take 0 bps //
|
||||
///////////////////////////////
|
||||
|
||||
static __forceinline void writePixel32_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
((u32*)pmem)[getPixelAddress32_0(x, y, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel24_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
u8 *buf = (u8*)&((u32*)pmem)[getPixelAddress32_0(x, y, bw)];
|
||||
u8 *pix = (u8*)&pixel;
|
||||
|
||||
buf[0] = pix[0]; buf[1] = pix[1]; buf[2] = pix[2];
|
||||
}
|
||||
|
||||
static __forceinline void writePixel16_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
((u16*)pmem)[getPixelAddress16_0(x, y, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel16S_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
((u16*)pmem)[getPixelAddress16S_0(x, y, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel8_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
((u8*)pmem)[getPixelAddress8_0(x, y, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel8H_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
((u8*)pmem)[4*getPixelAddress32_0(x, y, bw)+3] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel4_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
u32 addr = getPixelAddress4_0(x, y, bw);
|
||||
u8 pix = ((u8*)pmem)[addr/2];
|
||||
if (addr & 0x1) ((u8*)pmem)[addr/2] = (pix & 0x0f) | (pixel << 4);
|
||||
else ((u8*)pmem)[addr/2] = (pix & 0xf0) | (pixel);
|
||||
}
|
||||
|
||||
static __forceinline void writePixel4HL_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
u8 *p = (u8*)pmem + 4*getPixelAddress4HL_0(x, y, bw)+3;
|
||||
*p = (*p & 0xf0) | pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel4HH_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
u8 *p = (u8*)pmem + 4*getPixelAddress4HH_0(x, y, bw)+3;
|
||||
*p = (*p & 0x0f) | (pixel<<4);
|
||||
}
|
||||
|
||||
static __forceinline void writePixel32Z_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
((u32*)pmem)[getPixelAddress32Z_0(x, y, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel24Z_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
u8 *buf = (u8*)pmem + 4*getPixelAddress32Z_0(x, y, bw);
|
||||
u8 *pix = (u8*)&pixel;
|
||||
buf[0] = pix[0]; buf[1] = pix[1]; buf[2] = pix[2];
|
||||
}
|
||||
|
||||
static __forceinline void writePixel16Z_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
((u16*)pmem)[getPixelAddress16Z_0(x, y, bw)] = pixel;
|
||||
}
|
||||
|
||||
static __forceinline void writePixel16SZ_0(void* pmem, int x, int y, u32 pixel, u32 bw) {
|
||||
((u16*)pmem)[getPixelAddress16SZ_0(x, y, bw)] = pixel;
|
||||
}
|
||||
|
||||
|
||||
///////////////
|
||||
|
||||
static __forceinline u32 readPixel32_0(const void* pmem, int x, int y, u32 bw) {
|
||||
return ((const u32*)pmem)[getPixelAddress32_0(x, y, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel24_0(const void* pmem, int x, int y, u32 bw) {
|
||||
return ((const u32*)pmem)[getPixelAddress32_0(x, y, bw)] & 0xffffff;
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel16_0(const void* pmem, int x, int y, u32 bw) {
|
||||
return ((const u16*)pmem)[getPixelAddress16_0(x, y, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel16S_0(const void* pmem, int x, int y, u32 bw) {
|
||||
return ((const u16*)pmem)[getPixelAddress16S_0(x, y, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel8_0(const void* pmem, int x, int y, u32 bw) {
|
||||
return ((const u8*)pmem)[getPixelAddress8_0(x, y, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel8H_0(const void* pmem, int x, int y, u32 bw) {
|
||||
return ((const u8*)pmem)[4*getPixelAddress32_0(x, y, bw) + 3];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel4_0(const void* pmem, int x, int y, u32 bw) {
|
||||
u32 addr = getPixelAddress4_0(x, y, bw);
|
||||
u8 pix = ((const u8*)pmem)[addr/2];
|
||||
if (addr & 0x1)
|
||||
return pix >> 4;
|
||||
else return pix & 0xf;
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel4HL_0(const void* pmem, int x, int y, u32 bw) {
|
||||
const u8 *p = (const u8*)pmem+4*getPixelAddress4HL_0(x, y, bw)+3;
|
||||
return *p & 0x0f;
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel4HH_0(const void* pmem, int x, int y, u32 bw) {
|
||||
const u8 *p = (const u8*)pmem+4*getPixelAddress4HH_0(x, y, bw) + 3;
|
||||
return *p >> 4;
|
||||
}
|
||||
|
||||
///////////////
|
||||
|
||||
static __forceinline u32 readPixel32Z_0(const void* pmem, int x, int y, u32 bw) {
|
||||
return ((const u32*)pmem)[getPixelAddress32Z_0(x, y, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel24Z_0(const void* pmem, int x, int y, u32 bw) {
|
||||
return ((const u32*)pmem)[getPixelAddress32Z_0(x, y, bw)] & 0xffffff;
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel16Z_0(const void* pmem, int x, int y, u32 bw) {
|
||||
return ((const u16*)pmem)[getPixelAddress16Z_0(x, y, bw)];
|
||||
}
|
||||
|
||||
static __forceinline u32 readPixel16SZ_0(const void* pmem, int x, int y, u32 bw) {
|
||||
return ((const u16*)pmem)[getPixelAddress16SZ_0(x, y, bw)];
|
||||
}
|
||||
|
||||
#endif /* __MEM_H__ */
|
|
@ -1,13 +0,0 @@
|
|||
ZeroGS OpenGL
|
||||
-------------
|
||||
author: zerofrog (@gmail.com)
|
||||
|
||||
ZeroGS heavily uses GPU shaders. All the shaders are written in nVidia's Cg language and can be found in ps2hw.fx.
|
||||
|
||||
'Dev' versions of ZeroGS directly read ps2hw.fx
|
||||
'Release' versions of ZeroGS read a precompiled version of ps2hw.fx from ps2hw.dat. In order to build ps2hw.dat, compile ZeroGSShaders and execute:
|
||||
|
||||
./ZeroGSShaders ps2hw.fx ps2hw.dat
|
||||
|
||||
For Windows users, once ZeroGSShaders is built, run buildshaders.bat directly. It will update all necessary resource files.
|
||||
Note that ZeroGSShaders has only been tested in Windows so far, but the Windows ps2hw.dat can be used in linux builds.
|
File diff suppressed because it is too large
Load Diff
|
@ -1,97 +0,0 @@
|
|||
/* ZeroGS KOSMOS
|
||||
* Copyright (C) 2005-2006 zerofrog@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 __GSREGS_H__
|
||||
#define __GSREGS_H__
|
||||
|
||||
#ifdef _MSC_VER
|
||||
typedef void (__fastcall *GIFRegHandler)(u32* data);
|
||||
#else
|
||||
|
||||
typedef void (__fastcall *GIFRegHandler)(u32* data);
|
||||
|
||||
#endif
|
||||
|
||||
void __fastcall GIFPackedRegHandlerNull(u32* data);
|
||||
void __fastcall GIFPackedRegHandlerRGBA(u32* data);
|
||||
void __fastcall GIFPackedRegHandlerSTQ(u32* data);
|
||||
void __fastcall GIFPackedRegHandlerUV(u32* data);
|
||||
void __fastcall GIFPackedRegHandlerXYZF2(u32* data);
|
||||
void __fastcall GIFPackedRegHandlerXYZ2(u32* data);
|
||||
void __fastcall GIFPackedRegHandlerFOG(u32* data);
|
||||
void __fastcall GIFPackedRegHandlerA_D(u32* data);
|
||||
void __fastcall GIFPackedRegHandlerNOP(u32* data);
|
||||
|
||||
void __fastcall GIFRegHandlerNull(u32* data);
|
||||
void __fastcall GIFRegHandlerPRIM(u32* data);
|
||||
void __fastcall GIFRegHandlerRGBAQ(u32* data);
|
||||
void __fastcall GIFRegHandlerST(u32* data);
|
||||
void __fastcall GIFRegHandlerUV(u32* data);
|
||||
void __fastcall GIFRegHandlerXYZF2(u32* data);
|
||||
void __fastcall GIFRegHandlerXYZ2(u32* data);
|
||||
void __fastcall GIFRegHandlerTEX0_1(u32* data);
|
||||
void __fastcall GIFRegHandlerTEX0_2(u32* data);
|
||||
void __fastcall GIFRegHandlerCLAMP_1(u32* data);
|
||||
void __fastcall GIFRegHandlerCLAMP_2(u32* data);
|
||||
void __fastcall GIFRegHandlerFOG(u32* data);
|
||||
void __fastcall GIFRegHandlerXYZF3(u32* data);
|
||||
void __fastcall GIFRegHandlerXYZ3(u32* data);
|
||||
void __fastcall GIFRegHandlerNOP(u32* data);
|
||||
void __fastcall GIFRegHandlerTEX1_1(u32* data);
|
||||
void __fastcall GIFRegHandlerTEX1_2(u32* data);
|
||||
void __fastcall GIFRegHandlerTEX2_1(u32* data);
|
||||
void __fastcall GIFRegHandlerTEX2_2(u32* data);
|
||||
void __fastcall GIFRegHandlerXYOFFSET_1(u32* data);
|
||||
void __fastcall GIFRegHandlerXYOFFSET_2(u32* data);
|
||||
void __fastcall GIFRegHandlerPRMODECONT(u32* data);
|
||||
void __fastcall GIFRegHandlerPRMODE(u32* data);
|
||||
void __fastcall GIFRegHandlerTEXCLUT(u32* data);
|
||||
void __fastcall GIFRegHandlerSCANMSK(u32* data);
|
||||
void __fastcall GIFRegHandlerMIPTBP1_1(u32* data);
|
||||
void __fastcall GIFRegHandlerMIPTBP1_2(u32* data);
|
||||
void __fastcall GIFRegHandlerMIPTBP2_1(u32* data);
|
||||
void __fastcall GIFRegHandlerMIPTBP2_2(u32* data);
|
||||
void __fastcall GIFRegHandlerTEXA(u32* data);
|
||||
void __fastcall GIFRegHandlerFOGCOL(u32* data);
|
||||
void __fastcall GIFRegHandlerTEXFLUSH(u32* data);
|
||||
void __fastcall GIFRegHandlerSCISSOR_1(u32* data);
|
||||
void __fastcall GIFRegHandlerSCISSOR_2(u32* data);
|
||||
void __fastcall GIFRegHandlerALPHA_1(u32* data);
|
||||
void __fastcall GIFRegHandlerALPHA_2(u32* data);
|
||||
void __fastcall GIFRegHandlerDIMX(u32* data);
|
||||
void __fastcall GIFRegHandlerDTHE(u32* data);
|
||||
void __fastcall GIFRegHandlerCOLCLAMP(u32* data);
|
||||
void __fastcall GIFRegHandlerTEST_1(u32* data);
|
||||
void __fastcall GIFRegHandlerTEST_2(u32* data);
|
||||
void __fastcall GIFRegHandlerPABE(u32* data);
|
||||
void __fastcall GIFRegHandlerFBA_1(u32* data);
|
||||
void __fastcall GIFRegHandlerFBA_2(u32* data);
|
||||
void __fastcall GIFRegHandlerFRAME_1(u32* data);
|
||||
void __fastcall GIFRegHandlerFRAME_2(u32* data);
|
||||
void __fastcall GIFRegHandlerZBUF_1(u32* data);
|
||||
void __fastcall GIFRegHandlerZBUF_2(u32* data);
|
||||
void __fastcall GIFRegHandlerBITBLTBUF(u32* data);
|
||||
void __fastcall GIFRegHandlerTRXPOS(u32* data);
|
||||
void __fastcall GIFRegHandlerTRXREG(u32* data);
|
||||
void __fastcall GIFRegHandlerTRXDIR(u32* data);
|
||||
void __fastcall GIFRegHandlerHWREG(u32* data);
|
||||
void __fastcall GIFRegHandlerSIGNAL(u32* data);
|
||||
void __fastcall GIFRegHandlerFINISH(u32* data);
|
||||
void __fastcall GIFRegHandlerLABEL(u32* data);
|
||||
|
||||
#endif
|
|
@ -1,88 +0,0 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "GS.h"
|
||||
#include "Win32.h"
|
||||
|
||||
extern HINSTANCE hInst;
|
||||
|
||||
|
||||
void SaveConfig() {
|
||||
|
||||
char szValue[256];
|
||||
const std::string iniFile( s_strIniPath + "zerogs.ini" );
|
||||
|
||||
sprintf(szValue,"%u",conf.interlace);
|
||||
WritePrivateProfileString("Settings", "Interlace",szValue,iniFile.c_str());
|
||||
sprintf(szValue,"%u",conf.aa);
|
||||
WritePrivateProfileString("Settings", "Antialiasing",szValue,iniFile.c_str());
|
||||
sprintf(szValue,"%u",conf.bilinear);
|
||||
WritePrivateProfileString("Settings", "Bilinear",szValue,iniFile.c_str());
|
||||
sprintf(szValue,"%u",conf.options);
|
||||
WritePrivateProfileString("Settings", "Options",szValue,iniFile.c_str());
|
||||
sprintf(szValue,"%u",conf.gamesettings);
|
||||
WritePrivateProfileString("Settings", "AdvancedOptions",szValue,iniFile.c_str());
|
||||
}
|
||||
|
||||
void LoadConfig() {
|
||||
|
||||
char szValue[256];
|
||||
const std::string iniFile( s_strIniPath + "zerogs.ini" );
|
||||
|
||||
memset(&conf, 0, sizeof(conf));
|
||||
conf.interlace = 0; // on, mode 1
|
||||
conf.mrtdepth = 1;
|
||||
conf.options = 0;
|
||||
conf.bilinear = 1;
|
||||
conf.width = 640;
|
||||
conf.height = 480;
|
||||
|
||||
FILE *fp=fopen(iniFile.c_str(),"rt");
|
||||
if (!fp)
|
||||
{
|
||||
CreateDirectory(s_strIniPath.c_str(),NULL);
|
||||
SaveConfig();//save and return
|
||||
return ;
|
||||
}
|
||||
fclose(fp);
|
||||
|
||||
GetPrivateProfileString("Settings", "Interlace", NULL, szValue, 20, iniFile.c_str());
|
||||
conf.interlace = (u8)strtoul(szValue, NULL, 10);
|
||||
GetPrivateProfileString("Settings", "Antialiasing", NULL, szValue, 20, iniFile.c_str());
|
||||
conf.aa = (u8)strtoul(szValue, NULL, 10);
|
||||
GetPrivateProfileString("Settings", "Options", NULL, szValue, 20, iniFile.c_str());
|
||||
conf.options = strtoul(szValue, NULL, 10);
|
||||
GetPrivateProfileString("Settings", "AdvancedOptions", NULL, szValue, 20, iniFile.c_str());
|
||||
conf.gamesettings = strtoul(szValue, NULL, 10);
|
||||
GetPrivateProfileString("Settings", "Bilinear", NULL, szValue, 20, iniFile.c_str());
|
||||
conf.bilinear = strtoul(szValue, NULL, 10);
|
||||
|
||||
if( conf.aa < 0 || conf.aa > 2 ) conf.aa = 0;
|
||||
|
||||
switch(conf.options&GSOPTION_WINDIMS) {
|
||||
case GSOPTION_WIN640:
|
||||
conf.width = 640;
|
||||
conf.height = 480;
|
||||
break;
|
||||
case GSOPTION_WIN800:
|
||||
conf.width = 800;
|
||||
conf.height = 600;
|
||||
break;
|
||||
case GSOPTION_WIN1024:
|
||||
conf.width = 1024;
|
||||
conf.height = 768;
|
||||
break;
|
||||
case GSOPTION_WIN1280:
|
||||
conf.width = 1280;
|
||||
conf.height = 960;
|
||||
break;
|
||||
}
|
||||
|
||||
// turn off all hacks by defaultof
|
||||
conf.options &= ~(GSOPTION_FULLSCREEN|GSOPTION_WIREFRAME|GSOPTION_CAPTUREAVI);
|
||||
conf.options |= GSOPTION_LOADED;
|
||||
|
||||
if( conf.width <= 0 || conf.height <= 0 ) {
|
||||
conf.width = 640;
|
||||
conf.height = 480;
|
||||
}
|
||||
}
|
|
@ -1,246 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
|
||||
#include "resrc1.h"
|
||||
|
||||
#include "GS.h"
|
||||
#include "Win32.h"
|
||||
|
||||
#include <map>
|
||||
using namespace std;
|
||||
|
||||
extern int g_nPixelShaderVer;
|
||||
static int prevbilinearfilter;
|
||||
HINSTANCE hInst=NULL;
|
||||
|
||||
void CALLBACK GSkeyEvent(keyEvent *ev) {
|
||||
// switch (ev->event) {
|
||||
// case KEYPRESS:
|
||||
// switch (ev->key) {
|
||||
// case VK_PRIOR:
|
||||
// if (conf.fps) fpspos++; break;
|
||||
// case VK_NEXT:
|
||||
// if (conf.fps) fpspos--; break;
|
||||
// case VK_END:
|
||||
// if (conf.fps) fpspress = 1; break;
|
||||
// case VK_DELETE:
|
||||
// conf.fps = 1 - conf.fps;
|
||||
// break;
|
||||
// }
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
|
||||
#include "Win32/resource.h"
|
||||
|
||||
BOOL CALLBACK LoggingDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
switch(uMsg) {
|
||||
case WM_INITDIALOG:
|
||||
if (conf.log) CheckDlgButton(hW, IDC_LOG, TRUE);
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch(LOWORD(wParam)) {
|
||||
case IDCANCEL:
|
||||
EndDialog(hW, FALSE);
|
||||
return TRUE;
|
||||
case IDOK:
|
||||
if (IsDlgButtonChecked(hW, IDC_LOG))
|
||||
conf.log = 1;
|
||||
else conf.log = 0;
|
||||
|
||||
SaveConfig();
|
||||
EndDialog(hW, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
map<int, int> mapConfOpts;
|
||||
#define PUT_CONF(id) mapConfOpts[IDC_CONFOPT_##id] = 0x##id;
|
||||
|
||||
void OnInitDialog(HWND hW)
|
||||
{
|
||||
if( !(conf.options & GSOPTION_LOADED) )
|
||||
LoadConfig();
|
||||
|
||||
CheckDlgButton(hW, IDC_CONFIG_INTERLACE, conf.interlace);
|
||||
CheckDlgButton(hW, IDC_CONFIG_BILINEAR, conf.bilinear);
|
||||
CheckDlgButton(hW, IDC_CONFIG_DEPTHWRITE, conf.mrtdepth);
|
||||
CheckRadioButton(hW,IDC_CONFIG_AANONE,IDC_CONFIG_AA4, IDC_CONFIG_AANONE+conf.aa);
|
||||
CheckDlgButton(hW, IDC_CONFIG_WIREFRAME, (conf.options&GSOPTION_WIREFRAME)?1:0);
|
||||
CheckDlgButton(hW, IDC_CONFIG_CAPTUREAVI, (conf.options&GSOPTION_CAPTUREAVI)?1:0);
|
||||
//CheckDlgButton(hW, IDC_CONFIG_CACHEFBP, (conf.options&GSOPTION_ALPHACLAMP)?1:0);
|
||||
CheckDlgButton(hW, IDC_CONFIG_FULLSCREEN, (conf.options&GSOPTION_FULLSCREEN)?1:0);
|
||||
//CheckDlgButton(hW, IDC_CONFIG_FFX, (conf.options&GSOPTION_FFXHACK)?1:0);
|
||||
CheckDlgButton(hW, IDC_CONFIG_BMPSS, (conf.options&GSOPTION_TGASNAP)?1:0);
|
||||
CheckRadioButton(hW,IDC_CONF_WIN640, IDC_CONF_WIN1280, IDC_CONF_WIN640+((conf.options&GSOPTION_WINDIMS)>>4));
|
||||
|
||||
prevbilinearfilter = conf.bilinear;
|
||||
|
||||
mapConfOpts.clear();
|
||||
PUT_CONF(00000001);
|
||||
PUT_CONF(00000002);
|
||||
PUT_CONF(00000004);
|
||||
PUT_CONF(00000008);
|
||||
PUT_CONF(00000010);
|
||||
PUT_CONF(00000020);
|
||||
PUT_CONF(00000040);
|
||||
PUT_CONF(00000080);
|
||||
PUT_CONF(00000200);
|
||||
PUT_CONF(00000400);
|
||||
PUT_CONF(00000800);
|
||||
PUT_CONF(00001000);
|
||||
PUT_CONF(00002000);
|
||||
PUT_CONF(00004000);
|
||||
PUT_CONF(00008000);
|
||||
PUT_CONF(00010000);
|
||||
PUT_CONF(00020000);
|
||||
PUT_CONF(00040000);
|
||||
PUT_CONF(00080000);
|
||||
PUT_CONF(00100000);
|
||||
PUT_CONF(00200000);
|
||||
PUT_CONF(00800000);
|
||||
PUT_CONF(01000000);
|
||||
PUT_CONF(02000000);
|
||||
PUT_CONF(04000000);
|
||||
|
||||
for(map<int, int>::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it) {
|
||||
CheckDlgButton(hW, it->first, (conf.gamesettings&it->second)?1:0);
|
||||
}
|
||||
}
|
||||
|
||||
void OnOK(HWND hW) {
|
||||
|
||||
u32 newinterlace = IsDlgButtonChecked(hW, IDC_CONFIG_INTERLACE);
|
||||
|
||||
if( !conf.interlace ) conf.interlace = newinterlace;
|
||||
else if( !newinterlace ) conf.interlace = 2; // off
|
||||
|
||||
conf.bilinear = IsDlgButtonChecked(hW, IDC_CONFIG_BILINEAR);
|
||||
// restore
|
||||
if( conf.bilinear && prevbilinearfilter )
|
||||
conf.bilinear = prevbilinearfilter;
|
||||
|
||||
//conf.mrtdepth = 1;//IsDlgButtonChecked(hW, IDC_CONFIG_DEPTHWRITE);
|
||||
|
||||
if( SendDlgItemMessage(hW,IDC_CONFIG_AANONE,BM_GETCHECK,0,0) ) {
|
||||
conf.aa = 0;
|
||||
}
|
||||
else if( SendDlgItemMessage(hW,IDC_CONFIG_AA2,BM_GETCHECK,0,0) ) {
|
||||
conf.aa = 1;
|
||||
}
|
||||
else if( SendDlgItemMessage(hW,IDC_CONFIG_AA4,BM_GETCHECK,0,0) ) {
|
||||
conf.aa = 2;
|
||||
}
|
||||
else if( SendDlgItemMessage(hW,IDC_CONFIG_AA8,BM_GETCHECK,0,0) ) {
|
||||
conf.aa = 3;
|
||||
}
|
||||
else if( SendDlgItemMessage(hW,IDC_CONFIG_AA16,BM_GETCHECK,0,0) ) {
|
||||
conf.aa = 4;
|
||||
}
|
||||
else conf.aa = 0;
|
||||
|
||||
conf.options = 0;
|
||||
conf.options |= IsDlgButtonChecked(hW, IDC_CONFIG_CAPTUREAVI) ? GSOPTION_CAPTUREAVI : 0;
|
||||
conf.options |= IsDlgButtonChecked(hW, IDC_CONFIG_WIREFRAME) ? GSOPTION_WIREFRAME : 0;
|
||||
conf.options |= IsDlgButtonChecked(hW, IDC_CONFIG_FULLSCREEN) ? GSOPTION_FULLSCREEN : 0;
|
||||
//conf.options |= IsDlgButtonChecked(hW, IDC_CONFIG_FFX) ? GSOPTION_FFXHACK : 0;
|
||||
conf.options |= IsDlgButtonChecked(hW, IDC_CONFIG_BMPSS) ? GSOPTION_TGASNAP : 0;
|
||||
|
||||
conf.gamesettings = 0;
|
||||
for(map<int, int>::iterator it = mapConfOpts.begin(); it != mapConfOpts.end(); ++it) {
|
||||
if( IsDlgButtonChecked(hW, it->first) )
|
||||
conf.gamesettings |= it->second;
|
||||
}
|
||||
GSsetGameCRC(g_LastCRC, conf.gamesettings);
|
||||
|
||||
if( SendDlgItemMessage(hW,IDC_CONF_WIN640,BM_GETCHECK,0,0) ) conf.options |= GSOPTION_WIN640;
|
||||
else if( SendDlgItemMessage(hW,IDC_CONF_WIN800,BM_GETCHECK,0,0) ) conf.options |= GSOPTION_WIN800;
|
||||
else if( SendDlgItemMessage(hW,IDC_CONF_WIN1024,BM_GETCHECK,0,0) ) conf.options |= GSOPTION_WIN1024;
|
||||
else if( SendDlgItemMessage(hW,IDC_CONF_WIN1280,BM_GETCHECK,0,0) ) conf.options |= GSOPTION_WIN1280;
|
||||
|
||||
SaveConfig();
|
||||
EndDialog(hW, FALSE);
|
||||
}
|
||||
|
||||
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
switch(uMsg) {
|
||||
case WM_INITDIALOG:
|
||||
OnInitDialog(hW);
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch(LOWORD(wParam)) {
|
||||
case IDCANCEL:
|
||||
EndDialog(hW, TRUE);
|
||||
return TRUE;
|
||||
case IDOK:
|
||||
OnOK(hW);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL CALLBACK AboutDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam) {
|
||||
switch(uMsg) {
|
||||
case WM_INITDIALOG:
|
||||
|
||||
//ZeroGS uses floating point render targets because A8R8G8B8 format is not sufficient for ps2 blending and this requires alpha blending on floating point render targets
|
||||
//There might be a problem with pixel shader precision with older geforce models (textures will look blocky).
|
||||
|
||||
return TRUE;
|
||||
|
||||
case WM_COMMAND:
|
||||
switch(LOWORD(wParam)) {
|
||||
case IDOK:
|
||||
EndDialog(hW, FALSE);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
s32 CALLBACK GStest() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void CALLBACK GSabout() {
|
||||
DialogBox(hInst,
|
||||
MAKEINTRESOURCE(IDD_ABOUT),
|
||||
GetActiveWindow(),
|
||||
(DLGPROC)AboutDlgProc);
|
||||
}
|
||||
|
||||
BOOL APIENTRY DllMain(HANDLE hModule, // DLL INIT
|
||||
DWORD dwReason,
|
||||
LPVOID lpReserved) {
|
||||
hInst = (HINSTANCE)hModule;
|
||||
return TRUE; // very quick :)
|
||||
}
|
||||
|
||||
static char *err = "Error Loading Symbol";
|
||||
static int errval;
|
||||
|
||||
void *SysLoadLibrary(char *lib) {
|
||||
return LoadLibrary(lib);
|
||||
}
|
||||
|
||||
void *SysLoadSym(void *lib, char *sym) {
|
||||
void *tmp = GetProcAddress((HINSTANCE)lib, sym);
|
||||
if (tmp == NULL) errval = 1;
|
||||
else errval = 0;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
char *SysLibError() {
|
||||
if (errval) { errval = 0; return err; }
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void SysCloseLibrary(void *lib) {
|
||||
FreeLibrary((HINSTANCE)lib);
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
#ifndef __WIN32_H__
|
||||
#define __WIN32_H__
|
||||
|
||||
#include "resrc1.h"
|
||||
#include "Win32/resource.h"
|
||||
|
||||
BOOL CALLBACK ConfigureDlgProc(HWND hW, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
|
||||
#endif /* __WIN32_H__ */
|
|
@ -1,484 +0,0 @@
|
|||
#define AVIIF_KEYFRAME 0x00000010L // this frame is a key frame.
|
||||
|
||||
#include <string>
|
||||
using namespace std;
|
||||
|
||||
#include <memory.h>
|
||||
#include <mmsystem.h>
|
||||
#include <vfw.h>
|
||||
|
||||
BOOL AVI_Init()
|
||||
{
|
||||
/* first let's make sure we are running on 1.1 */
|
||||
WORD wVer = HIWORD(VideoForWindowsVersion());
|
||||
if (wVer < 0x010a){
|
||||
/* oops, we are too old, blow out of here */
|
||||
//MessageBeep(MB_ICONHAND);
|
||||
MessageBox(NULL, "Cant't init AVI File - Video for Windows version is to old", "Error", MB_OK|MB_ICONSTOP);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
AVIFileInit();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL AVI_FileOpenWrite(PAVIFILE * pfile, const char *filename)
|
||||
{
|
||||
HRESULT hr = AVIFileOpen(pfile, // returned file pointer
|
||||
filename, // file name
|
||||
OF_WRITE | OF_CREATE, // mode to open file with
|
||||
NULL); // use handler determined
|
||||
// from file extension....
|
||||
if (hr != AVIERR_OK)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DWORD getFOURCC(const char* value)
|
||||
{
|
||||
if(_stricmp(value, "DIB") == 0)
|
||||
{
|
||||
return mmioFOURCC(value[0],value[1],value[2],' ');
|
||||
}
|
||||
else if((_stricmp(value, "CVID") == 0)
|
||||
|| (_stricmp(value, "IV32") == 0)
|
||||
|| (_stricmp(value, "MSVC") == 0)
|
||||
|| (_stricmp(value, "IV50") == 0))
|
||||
{
|
||||
return mmioFOURCC(value[0],value[1],value[2],value[3]);
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
// Fill in the header for the video stream....
|
||||
// The video stream will run in rate ths of a second....
|
||||
BOOL AVI_CreateStream(PAVIFILE pfile, PAVISTREAM * ps, int rate, // sample/second
|
||||
unsigned long buffersize, int rectwidth, int rectheight,
|
||||
const char* _compressor)
|
||||
{
|
||||
AVISTREAMINFO strhdr;
|
||||
memset(&strhdr, 0, sizeof(strhdr));
|
||||
strhdr.fccType = streamtypeVIDEO;// stream type
|
||||
strhdr.fccHandler = getFOURCC(_compressor);
|
||||
//strhdr.fccHandler = 0; // no compression!
|
||||
//strhdr.fccHandler = mmioFOURCC('D','I','B',' '); // Uncompressed
|
||||
//strhdr.fccHandler = mmioFOURCC('C','V','I','D'); // Cinpak
|
||||
//strhdr.fccHandler = mmioFOURCC('I','V','3','2'); // Intel video 3.2
|
||||
//strhdr.fccHandler = mmioFOURCC('M','S','V','C'); // Microsoft video 1
|
||||
//strhdr.fccHandler = mmioFOURCC('I','V','5','0'); // Intel video 5.0
|
||||
//strhdr.dwFlags = AVISTREAMINFO_DISABLED;
|
||||
//strhdr.dwCaps =
|
||||
//strhdr.wPriority =
|
||||
//strhdr.wLanguage =
|
||||
strhdr.dwScale = 1;
|
||||
strhdr.dwRate = rate; // rate fps
|
||||
//strhdr.dwStart =
|
||||
//strhdr.dwLength =
|
||||
//strhdr.dwInitialFrames =
|
||||
strhdr.dwSuggestedBufferSize = buffersize;
|
||||
strhdr.dwQuality = -1; // use the default
|
||||
//strhdr.dwSampleSize =
|
||||
SetRect(&strhdr.rcFrame, 0, 0, // rectangle for stream
|
||||
(int) rectwidth,
|
||||
(int) rectheight);
|
||||
//strhdr.dwEditCount =
|
||||
//strhdr.dwFormatChangeCount =
|
||||
//strcpy(strhdr.szName, "Full Frames (Uncompressed)");
|
||||
|
||||
// And create the stream;
|
||||
HRESULT hr = AVIFileCreateStream(pfile, // file pointer
|
||||
ps, // returned stream pointer
|
||||
&strhdr); // stream header
|
||||
if (hr != AVIERR_OK) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
string getFOURCCVAsString(DWORD value)
|
||||
{
|
||||
string returnValue = "";
|
||||
if( value == 0 )
|
||||
return returnValue;
|
||||
|
||||
DWORD ch0 = value & 0x000000FF;
|
||||
returnValue.push_back((char) ch0);
|
||||
DWORD ch1 = (value & 0x0000FF00)>>8;
|
||||
returnValue.push_back((char) ch1);
|
||||
DWORD ch2 = (value & 0x00FF0000)>>16;
|
||||
returnValue.push_back((char) ch2);
|
||||
DWORD ch3 = (value & 0xFF000000)>>24;
|
||||
returnValue.push_back((char) ch3);
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
string dumpAVICOMPRESSOPTIONS(AVICOMPRESSOPTIONS opts)
|
||||
{
|
||||
char tmp[255];
|
||||
string returnValue = "Dump of AVICOMPRESSOPTIONS\n";
|
||||
|
||||
returnValue += "DWORD fccType = streamtype("; returnValue += getFOURCCVAsString(opts.fccType); returnValue += ")\n";
|
||||
returnValue += "DWORD fccHandler = "; returnValue += getFOURCCVAsString(opts.fccHandler); returnValue += "\n";
|
||||
|
||||
_snprintf(tmp, 255, "DWORD dwKeyFrameEvery = %d\n", opts.dwKeyFrameEvery);
|
||||
returnValue += tmp;
|
||||
|
||||
_snprintf(tmp, 255, "DWORD dwQuality = %d\n", opts.dwQuality);
|
||||
returnValue += tmp;
|
||||
|
||||
_snprintf(tmp, 255, "DWORD dwBytesPerSecond = %d\n", opts.dwBytesPerSecond);
|
||||
returnValue += tmp;
|
||||
|
||||
if((opts.dwFlags & AVICOMPRESSF_DATARATE) == AVICOMPRESSF_DATARATE){strcpy(tmp, "DWORD fccType = AVICOMPRESSF_DATARATE\n");}
|
||||
else if((opts.dwFlags & AVICOMPRESSF_INTERLEAVE) == AVICOMPRESSF_INTERLEAVE){strcpy(tmp, "DWORD fccType = AVICOMPRESSF_INTERLEAVE\n");}
|
||||
else if((opts.dwFlags & AVICOMPRESSF_KEYFRAMES) == AVICOMPRESSF_KEYFRAMES){strcpy(tmp, "DWORD fccType = AVICOMPRESSF_KEYFRAMES\n");}
|
||||
else if((opts.dwFlags & AVICOMPRESSF_VALID) == AVICOMPRESSF_VALID){strcpy(tmp, "DWORD fccType = AVICOMPRESSF_VALID\n");}
|
||||
else {_snprintf(tmp, 255, "DWORD dwFlags = Unknown(%d)\n", opts.dwFlags);}
|
||||
returnValue += tmp;
|
||||
|
||||
_snprintf(tmp, 255, "LPVOID lpFormat = %d\n", (int)opts.lpFormat);
|
||||
returnValue += tmp;
|
||||
|
||||
_snprintf(tmp, 255, "DWORD cbFormat = %d\n", opts.cbFormat);
|
||||
returnValue += tmp;
|
||||
|
||||
_snprintf(tmp, 255, "LPVOID lpParms = %d\n", (int)opts.lpParms);
|
||||
returnValue += tmp;
|
||||
|
||||
_snprintf(tmp, 255, "DWORD cbParms = %d\n", opts.cbParms);
|
||||
returnValue += tmp;
|
||||
|
||||
_snprintf(tmp, 255, "DWORD dwInterleaveEvery = %d\n", opts.dwInterleaveEvery);
|
||||
returnValue += tmp;
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
BOOL AVI_SetOptions(PAVISTREAM * ps, PAVISTREAM * psCompressed, LPBITMAPINFOHEADER lpbi,
|
||||
const char* _compressor)
|
||||
{
|
||||
|
||||
AVICOMPRESSOPTIONS opts;
|
||||
AVICOMPRESSOPTIONS FAR * aopts[1] = {&opts};
|
||||
|
||||
memset(&opts, 0, sizeof(opts));
|
||||
opts.fccType = streamtypeVIDEO;
|
||||
opts.fccHandler = getFOURCC(_compressor);
|
||||
//opts.fccHandler = 0;
|
||||
//opts.fccHandler = mmioFOURCC('D','I','B',' '); // Uncompressed
|
||||
//opts.fccHandler = mmioFOURCC('C','V','I','D'); // Cinpak
|
||||
//opts.fccHandler = mmioFOURCC('I','V','3','2'); // Intel video 3.2
|
||||
//opts.fccHandler = mmioFOURCC('M','S','V','C'); // Microsoft video 1
|
||||
//opts.fccHandler = mmioFOURCC('I','V','5','0'); // Intel video 5.0
|
||||
//opts.dwKeyFrameEvery = 5;
|
||||
//opts.dwQuality
|
||||
//opts.dwBytesPerSecond
|
||||
//opts.dwFlags = AVICOMPRESSF_KEYFRAMES;
|
||||
//opts.lpFormat
|
||||
//opts.cbFormat
|
||||
//opts.lpParms
|
||||
//opts.cbParms
|
||||
//opts.dwInterleaveEvery
|
||||
|
||||
/* display the compression options dialog box if specified compressor is unknown */
|
||||
if(getFOURCC(_compressor) == NULL)
|
||||
{
|
||||
if (!AVISaveOptions(NULL, 0, 1, ps, (LPAVICOMPRESSOPTIONS FAR *) &aopts))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
//printf("%s", dumpAVICOMPRESSOPTIONS(opts));
|
||||
//MessageBox(NULL, dumpAVICOMPRESSOPTIONS(opts).c_str(), "AVICOMPRESSOPTIONS", MB_OK);
|
||||
}
|
||||
|
||||
HRESULT hr = AVIMakeCompressedStream(psCompressed, *ps, &opts, NULL);
|
||||
if (hr != AVIERR_OK) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hr = AVIStreamSetFormat(*psCompressed, 0,
|
||||
lpbi, // stream format
|
||||
lpbi->biSize // format size
|
||||
+ lpbi->biClrUsed * sizeof(RGBQUAD)
|
||||
);
|
||||
if (hr != AVIERR_OK) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL AVI_SetText(PAVIFILE pfile, PAVISTREAM psText, char *szText, int width, int height, int TextHeight)
|
||||
{
|
||||
// Fill in the stream header for the text stream....
|
||||
AVISTREAMINFO strhdr;
|
||||
DWORD dwTextFormat;
|
||||
// The text stream is in 60ths of a second....
|
||||
|
||||
memset(&strhdr, 0, sizeof(strhdr));
|
||||
strhdr.fccType = streamtypeTEXT;
|
||||
strhdr.fccHandler = mmioFOURCC('D', 'R', 'A', 'W');
|
||||
strhdr.dwScale = 1;
|
||||
strhdr.dwRate = 60;
|
||||
strhdr.dwSuggestedBufferSize = sizeof(szText);
|
||||
SetRect(&strhdr.rcFrame, 0, (int) height,
|
||||
(int) width, (int) height + TextHeight); // #define TEXT_HEIGHT 20
|
||||
|
||||
// ....and create the stream.
|
||||
HRESULT hr = AVIFileCreateStream(pfile, &psText, &strhdr);
|
||||
if (hr != AVIERR_OK) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
dwTextFormat = sizeof(dwTextFormat);
|
||||
hr = AVIStreamSetFormat(psText, 0, &dwTextFormat, sizeof(dwTextFormat));
|
||||
if (hr != AVIERR_OK) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL AVI_AddFrame(PAVISTREAM psCompressed, int time, LPBITMAPINFOHEADER lpbi)
|
||||
{
|
||||
int ImageSize = lpbi->biSizeImage;
|
||||
if (ImageSize == 0)
|
||||
{
|
||||
if (lpbi->biBitCount == 24)
|
||||
{
|
||||
ImageSize = lpbi->biWidth * lpbi->biHeight * 3;
|
||||
}
|
||||
}
|
||||
HRESULT hr = AVIStreamWrite(psCompressed, // stream pointer
|
||||
time, // time of this frame
|
||||
1, // number to write
|
||||
(LPBYTE) lpbi + // pointer to data
|
||||
lpbi->biSize +
|
||||
lpbi->biClrUsed * sizeof(RGBQUAD),
|
||||
ImageSize, // lpbi->biSizeImage, // size of this frame
|
||||
AVIIF_KEYFRAME, // flags....
|
||||
NULL,
|
||||
NULL);
|
||||
if (hr != AVIERR_OK)
|
||||
{
|
||||
char strMsg[255];
|
||||
_snprintf(strMsg, 255, "Error: AVIStreamWrite, error %d",hr);
|
||||
MessageBox(NULL, strMsg, "", MB_OK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL AVI_AddText(PAVISTREAM psText, int time, char *szText)
|
||||
{
|
||||
int iLen = (int)strlen(szText);
|
||||
|
||||
HRESULT hr = AVIStreamWrite(psText,
|
||||
time,
|
||||
1,
|
||||
szText,
|
||||
iLen + 1,
|
||||
AVIIF_KEYFRAME,
|
||||
NULL,
|
||||
NULL);
|
||||
if (hr != AVIERR_OK)
|
||||
return FALSE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL AVI_CloseStream(PAVISTREAM ps, PAVISTREAM psCompressed, PAVISTREAM psText)
|
||||
{
|
||||
if (ps)
|
||||
AVIStreamClose(ps);
|
||||
|
||||
if (psCompressed)
|
||||
AVIStreamClose(psCompressed);
|
||||
|
||||
if (psText)
|
||||
AVIStreamClose(psText);
|
||||
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL AVI_CloseFile(PAVIFILE pfile)
|
||||
{
|
||||
if (pfile)
|
||||
AVIFileClose(pfile);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL AVI_Exit()
|
||||
{
|
||||
AVIFileExit();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/* Here are the additional functions we need! */
|
||||
|
||||
|
||||
static PAVIFILE pfile = NULL;
|
||||
static PAVISTREAM ps = NULL;
|
||||
static PAVISTREAM psCompressed = NULL;
|
||||
static int count = 0;
|
||||
|
||||
|
||||
// Initialization...
|
||||
bool START_AVI(const char* file_name)
|
||||
{
|
||||
if(! AVI_Init())
|
||||
{
|
||||
//printf("Error - AVI_Init()\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(! AVI_FileOpenWrite(&pfile, file_name))
|
||||
{
|
||||
//printf("Error - AVI_FileOpenWrite()\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ADD_FRAME_FROM_DIB_TO_AVI(const char* _compressor, int _frameRate, int width, int height, int bits, void* pdata)
|
||||
{
|
||||
if(count == 0)
|
||||
{
|
||||
if(! AVI_CreateStream(pfile, &ps, _frameRate,
|
||||
width*height/bits,
|
||||
width,
|
||||
height, _compressor))
|
||||
{
|
||||
//printf("Error - AVI_CreateStream()\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
BITMAPINFOHEADER bi;
|
||||
memset(&bi, 0, sizeof(bi));
|
||||
bi.biSize = sizeof(BITMAPINFOHEADER);
|
||||
bi.biWidth = width;
|
||||
bi.biHeight = height;
|
||||
bi.biPlanes = 1;
|
||||
bi.biBitCount = bits;
|
||||
bi.biCompression = BI_RGB;
|
||||
bi.biSizeImage = width * height * bits /8;
|
||||
if(! AVI_SetOptions(&ps, &psCompressed, &bi, _compressor))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
HRESULT hr = AVIStreamWrite(psCompressed, // stream pointer
|
||||
count, // time of this frame
|
||||
1, // number to write
|
||||
pdata,
|
||||
width*height/8, // lpbi->biSizeImage, // size of this frame
|
||||
AVIIF_KEYFRAME, // flags....
|
||||
NULL,
|
||||
NULL);
|
||||
if (hr != AVIERR_OK)
|
||||
{
|
||||
char strMsg[255];
|
||||
_snprintf(strMsg, 255, "Error: AVIStreamWrite, error %d",hr);
|
||||
MessageBox(NULL, strMsg, "", MB_OK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
count++;
|
||||
return true;
|
||||
}
|
||||
|
||||
//Now we can add frames
|
||||
// ie. ADD_FRAME_FROM_DIB_TO_AVI(yourDIB, "CVID", 25);
|
||||
bool ADD_FRAME_FROM_DIB_TO_AVI(HANDLE dib, const char* _compressor, int _frameRate)
|
||||
{
|
||||
LPBITMAPINFOHEADER lpbi;
|
||||
if(count == 0)
|
||||
{
|
||||
lpbi = (LPBITMAPINFOHEADER)GlobalLock(dib);
|
||||
if(! AVI_CreateStream(pfile, &ps, _frameRate,
|
||||
(unsigned long) lpbi->biSizeImage,
|
||||
(int) lpbi->biWidth,
|
||||
(int) lpbi->biHeight, _compressor))
|
||||
{
|
||||
//printf("Error - AVI_CreateStream()\n");
|
||||
GlobalUnlock(lpbi);
|
||||
return false;
|
||||
}
|
||||
|
||||
if(! AVI_SetOptions(&ps, &psCompressed, lpbi, _compressor))
|
||||
{
|
||||
//printf("Error - AVI_SetOptions()\n");
|
||||
GlobalUnlock(lpbi);
|
||||
return false;
|
||||
}
|
||||
|
||||
GlobalUnlock(lpbi);
|
||||
}
|
||||
|
||||
lpbi = (LPBITMAPINFOHEADER)GlobalLock(dib);
|
||||
if(! AVI_AddFrame(psCompressed, count * 1, lpbi))
|
||||
{
|
||||
//printf("Error - AVI_AddFrame()\n");
|
||||
GlobalUnlock(lpbi);
|
||||
return false;
|
||||
}
|
||||
|
||||
GlobalUnlock(lpbi);
|
||||
count++;
|
||||
return true;
|
||||
}
|
||||
|
||||
// The end...
|
||||
bool STOP_AVI()
|
||||
{
|
||||
if(! AVI_CloseStream(ps, psCompressed, NULL))
|
||||
{
|
||||
//printf("Error - AVI_CloseStream()\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(! AVI_CloseFile(pfile))
|
||||
{
|
||||
//printf("Error - AVI_CloseFile()\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
if(! AVI_Exit())
|
||||
{
|
||||
//printf("Error - AVI_Exit()\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
/* jconfig.mc6 --- jconfig.h for Microsoft C on MS-DOS, version 6.00A & up. */
|
||||
/* see jconfig.doc for explanations */
|
||||
|
||||
#define HAVE_PROTOTYPES
|
||||
#define HAVE_UNSIGNED_CHAR
|
||||
#define HAVE_UNSIGNED_SHORT
|
||||
/* #define void char */
|
||||
/* #define const */
|
||||
#undef CHAR_IS_UNSIGNED
|
||||
#define HAVE_STDDEF_H
|
||||
#define HAVE_STDLIB_H
|
||||
#undef NEED_BSD_STRINGS
|
||||
#undef NEED_SYS_TYPES_H
|
||||
//#define NEED_FAR_POINTERS /* for small or medium memory model */
|
||||
#undef NEED_SHORT_EXTERNAL_NAMES
|
||||
#undef INCOMPLETE_TYPES_BROKEN
|
||||
|
||||
#ifdef JPEG_INTERNALS
|
||||
|
||||
#undef RIGHT_SHIFT_IS_UNSIGNED
|
||||
|
||||
//#define USE_MSDOS_MEMMGR /* Define this if you use jmemdos.c */
|
||||
|
||||
#define MAX_ALLOC_CHUNK 65520L /* Maximum request to malloc() */
|
||||
|
||||
//#define USE_FMEM /* Microsoft has _fmemcpy() and _fmemset() */
|
||||
|
||||
#define NEED_FHEAPMIN /* far heap management routines are broken */
|
||||
|
||||
#define SHORTxLCONST_32 /* enable compiler-specific DCT optimization */
|
||||
/* Note: the above define is known to improve the code with Microsoft C 6.00A.
|
||||
* I do not know whether it is good for later compiler versions.
|
||||
* Please report any info on this point to jpeg-info@uunet.uu.net.
|
||||
*/
|
||||
|
||||
#endif /* JPEG_INTERNALS */
|
||||
|
||||
#ifdef JPEG_CJPEG_DJPEG
|
||||
|
||||
#define BMP_SUPPORTED /* BMP image file format */
|
||||
#define GIF_SUPPORTED /* GIF image file format */
|
||||
#define PPM_SUPPORTED /* PBMPLUS PPM/PGM image file format */
|
||||
#undef RLE_SUPPORTED /* Utah RLE image file format */
|
||||
#define TARGA_SUPPORTED /* Targa image file format */
|
||||
|
||||
#define TWO_FILE_COMMANDLINE
|
||||
#define USE_SETMODE /* Microsoft has setmode() */
|
||||
#define NEED_SIGNAL_CATCHER /* Define this if you use jmemdos.c */
|
||||
#undef DONT_USE_B_MODE
|
||||
#undef PROGRESS_REPORT /* optional */
|
||||
|
||||
#endif /* JPEG_CJPEG_DJPEG */
|
|
@ -1,363 +0,0 @@
|
|||
/*
|
||||
* jmorecfg.h
|
||||
*
|
||||
* Copyright (C) 1991-1997, Thomas G. Lane.
|
||||
* This file is part of the Independent JPEG Group's software.
|
||||
* For conditions of distribution and use, see the accompanying README file.
|
||||
*
|
||||
* This file contains additional configuration options that customize the
|
||||
* JPEG software for special applications or support machine-dependent
|
||||
* optimizations. Most users will not need to touch this file.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Define BITS_IN_JSAMPLE as either
|
||||
* 8 for 8-bit sample values (the usual setting)
|
||||
* 12 for 12-bit sample values
|
||||
* Only 8 and 12 are legal data precisions for lossy JPEG according to the
|
||||
* JPEG standard, and the IJG code does not support anything else!
|
||||
* We do not support run-time selection of data precision, sorry.
|
||||
*/
|
||||
|
||||
#define BITS_IN_JSAMPLE 8 /* use 8 or 12 */
|
||||
|
||||
|
||||
/*
|
||||
* Maximum number of components (color channels) allowed in JPEG image.
|
||||
* To meet the letter of the JPEG spec, set this to 255. However, darn
|
||||
* few applications need more than 4 channels (maybe 5 for CMYK + alpha
|
||||
* mask). We recommend 10 as a reasonable compromise; use 4 if you are
|
||||
* really short on memory. (Each allowed component costs a hundred or so
|
||||
* bytes of storage, whether actually used in an image or not.)
|
||||
*/
|
||||
|
||||
#define MAX_COMPONENTS 10 /* maximum number of image components */
|
||||
|
||||
|
||||
/*
|
||||
* Basic data types.
|
||||
* You may need to change these if you have a machine with unusual data
|
||||
* type sizes; for example, "char" not 8 bits, "short" not 16 bits,
|
||||
* or "long" not 32 bits. We don't care whether "int" is 16 or 32 bits,
|
||||
* but it had better be at least 16.
|
||||
*/
|
||||
|
||||
/* Representation of a single sample (pixel element value).
|
||||
* We frequently allocate large arrays of these, so it's important to keep
|
||||
* them small. But if you have memory to burn and access to char or short
|
||||
* arrays is very slow on your hardware, you might want to change these.
|
||||
*/
|
||||
|
||||
#if BITS_IN_JSAMPLE == 8
|
||||
/* JSAMPLE should be the smallest type that will hold the values 0..255.
|
||||
* You can use a signed char by having GETJSAMPLE mask it with 0xFF.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_UNSIGNED_CHAR
|
||||
|
||||
typedef unsigned char JSAMPLE;
|
||||
#define GETJSAMPLE(value) ((int) (value))
|
||||
|
||||
#else /* not HAVE_UNSIGNED_CHAR */
|
||||
|
||||
typedef char JSAMPLE;
|
||||
#ifdef CHAR_IS_UNSIGNED
|
||||
#define GETJSAMPLE(value) ((int) (value))
|
||||
#else
|
||||
#define GETJSAMPLE(value) ((int) (value) & 0xFF)
|
||||
#endif /* CHAR_IS_UNSIGNED */
|
||||
|
||||
#endif /* HAVE_UNSIGNED_CHAR */
|
||||
|
||||
#define MAXJSAMPLE 255
|
||||
#define CENTERJSAMPLE 128
|
||||
|
||||
#endif /* BITS_IN_JSAMPLE == 8 */
|
||||
|
||||
|
||||
#if BITS_IN_JSAMPLE == 12
|
||||
/* JSAMPLE should be the smallest type that will hold the values 0..4095.
|
||||
* On nearly all machines "short" will do nicely.
|
||||
*/
|
||||
|
||||
typedef short JSAMPLE;
|
||||
#define GETJSAMPLE(value) ((int) (value))
|
||||
|
||||
#define MAXJSAMPLE 4095
|
||||
#define CENTERJSAMPLE 2048
|
||||
|
||||
#endif /* BITS_IN_JSAMPLE == 12 */
|
||||
|
||||
|
||||
/* Representation of a DCT frequency coefficient.
|
||||
* This should be a signed value of at least 16 bits; "short" is usually OK.
|
||||
* Again, we allocate large arrays of these, but you can change to int
|
||||
* if you have memory to burn and "short" is really slow.
|
||||
*/
|
||||
|
||||
typedef short JCOEF;
|
||||
|
||||
|
||||
/* Compressed datastreams are represented as arrays of JOCTET.
|
||||
* These must be EXACTLY 8 bits wide, at least once they are written to
|
||||
* external storage. Note that when using the stdio data source/destination
|
||||
* managers, this is also the data type passed to fread/fwrite.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_UNSIGNED_CHAR
|
||||
|
||||
typedef unsigned char JOCTET;
|
||||
#define GETJOCTET(value) (value)
|
||||
|
||||
#else /* not HAVE_UNSIGNED_CHAR */
|
||||
|
||||
typedef char JOCTET;
|
||||
#ifdef CHAR_IS_UNSIGNED
|
||||
#define GETJOCTET(value) (value)
|
||||
#else
|
||||
#define GETJOCTET(value) ((value) & 0xFF)
|
||||
#endif /* CHAR_IS_UNSIGNED */
|
||||
|
||||
#endif /* HAVE_UNSIGNED_CHAR */
|
||||
|
||||
|
||||
/* These typedefs are used for various table entries and so forth.
|
||||
* They must be at least as wide as specified; but making them too big
|
||||
* won't cost a huge amount of memory, so we don't provide special
|
||||
* extraction code like we did for JSAMPLE. (In other words, these
|
||||
* typedefs live at a different point on the speed/space tradeoff curve.)
|
||||
*/
|
||||
|
||||
/* UINT8 must hold at least the values 0..255. */
|
||||
|
||||
#ifdef HAVE_UNSIGNED_CHAR
|
||||
typedef unsigned char UINT8;
|
||||
#else /* not HAVE_UNSIGNED_CHAR */
|
||||
#ifdef CHAR_IS_UNSIGNED
|
||||
typedef char UINT8;
|
||||
#else /* not CHAR_IS_UNSIGNED */
|
||||
typedef short UINT8;
|
||||
#endif /* CHAR_IS_UNSIGNED */
|
||||
#endif /* HAVE_UNSIGNED_CHAR */
|
||||
|
||||
/* UINT16 must hold at least the values 0..65535. */
|
||||
|
||||
#ifdef HAVE_UNSIGNED_SHORT
|
||||
typedef unsigned short UINT16;
|
||||
#else /* not HAVE_UNSIGNED_SHORT */
|
||||
typedef unsigned int UINT16;
|
||||
#endif /* HAVE_UNSIGNED_SHORT */
|
||||
|
||||
/* INT16 must hold at least the values -32768..32767. */
|
||||
|
||||
#ifndef XMD_H /* X11/xmd.h correctly defines INT16 */
|
||||
typedef short INT16;
|
||||
#endif
|
||||
|
||||
/* INT32 must hold at least signed 32-bit values. */
|
||||
|
||||
#ifndef XMD_H /* X11/xmd.h correctly defines INT32 */
|
||||
typedef long INT32;
|
||||
#endif
|
||||
|
||||
/* Datatype used for image dimensions. The JPEG standard only supports
|
||||
* images up to 64K*64K due to 16-bit fields in SOF markers. Therefore
|
||||
* "unsigned int" is sufficient on all machines. However, if you need to
|
||||
* handle larger images and you don't mind deviating from the spec, you
|
||||
* can change this datatype.
|
||||
*/
|
||||
|
||||
typedef unsigned int JDIMENSION;
|
||||
|
||||
#define JPEG_MAX_DIMENSION 65500L /* a tad under 64K to prevent overflows */
|
||||
|
||||
|
||||
/* These macros are used in all function definitions and extern declarations.
|
||||
* You could modify them if you need to change function linkage conventions;
|
||||
* in particular, you'll need to do that to make the library a Windows DLL.
|
||||
* Another application is to make all functions global for use with debuggers
|
||||
* or code profilers that require it.
|
||||
*/
|
||||
|
||||
/* a function called through method pointers: */
|
||||
#define METHODDEF(type) static type
|
||||
/* a function used only in its module: */
|
||||
#define LOCAL(type) static type
|
||||
/* a function referenced thru EXTERNs: */
|
||||
#define GLOBAL(type) type
|
||||
/* a reference to a GLOBAL function: */
|
||||
#define EXTERN(type) extern type
|
||||
|
||||
|
||||
/* This macro is used to declare a "method", that is, a function pointer.
|
||||
* We want to supply prototype parameters if the compiler can cope.
|
||||
* Note that the arglist parameter must be parenthesized!
|
||||
* Again, you can customize this if you need special linkage keywords.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_PROTOTYPES
|
||||
#define JMETHOD(type,methodname,arglist) type (*methodname) arglist
|
||||
#else
|
||||
#define JMETHOD(type,methodname,arglist) type (*methodname) ()
|
||||
#endif
|
||||
|
||||
|
||||
/* Here is the pseudo-keyword for declaring pointers that must be "far"
|
||||
* on 80x86 machines. Most of the specialized coding for 80x86 is handled
|
||||
* by just saying "FAR *" where such a pointer is needed. In a few places
|
||||
* explicit coding is needed; see uses of the NEED_FAR_POINTERS symbol.
|
||||
*/
|
||||
|
||||
#ifdef NEED_FAR_POINTERS
|
||||
#define FAR far
|
||||
#else
|
||||
#define FAR
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* On a few systems, type boolean and/or its values FALSE, TRUE may appear
|
||||
* in standard header files. Or you may have conflicts with application-
|
||||
* specific header files that you want to include together with these files.
|
||||
* Defining HAVE_BOOLEAN before including jpeglib.h should make it work.
|
||||
*/
|
||||
|
||||
#ifndef HAVE_BOOLEAN
|
||||
typedef int boolean;
|
||||
#endif
|
||||
#ifndef FALSE /* in case these macros already exist */
|
||||
#define FALSE 0 /* values of boolean */
|
||||
#endif
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
* The remaining options affect code selection within the JPEG library,
|
||||
* but they don't need to be visible to most applications using the library.
|
||||
* To minimize application namespace pollution, the symbols won't be
|
||||
* defined unless JPEG_INTERNALS or JPEG_INTERNAL_OPTIONS has been defined.
|
||||
*/
|
||||
|
||||
#ifdef JPEG_INTERNALS
|
||||
#define JPEG_INTERNAL_OPTIONS
|
||||
#endif
|
||||
|
||||
#ifdef JPEG_INTERNAL_OPTIONS
|
||||
|
||||
|
||||
/*
|
||||
* These defines indicate whether to include various optional functions.
|
||||
* Undefining some of these symbols will produce a smaller but less capable
|
||||
* library. Note that you can leave certain source files out of the
|
||||
* compilation/linking process if you've #undef'd the corresponding symbols.
|
||||
* (You may HAVE to do that if your compiler doesn't like null source files.)
|
||||
*/
|
||||
|
||||
/* Arithmetic coding is unsupported for legal reasons. Complaints to IBM. */
|
||||
|
||||
/* Capability options common to encoder and decoder: */
|
||||
|
||||
#define DCT_ISLOW_SUPPORTED /* slow but accurate integer algorithm */
|
||||
#define DCT_IFAST_SUPPORTED /* faster, less accurate integer method */
|
||||
#define DCT_FLOAT_SUPPORTED /* floating-point: accurate, fast on fast HW */
|
||||
|
||||
/* Encoder capability options: */
|
||||
|
||||
#undef C_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
|
||||
#define C_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
|
||||
#define C_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
|
||||
#define ENTROPY_OPT_SUPPORTED /* Optimization of entropy coding parms? */
|
||||
/* Note: if you selected 12-bit data precision, it is dangerous to turn off
|
||||
* ENTROPY_OPT_SUPPORTED. The standard Huffman tables are only good for 8-bit
|
||||
* precision, so jchuff.c normally uses entropy optimization to compute
|
||||
* usable tables for higher precision. If you don't want to do optimization,
|
||||
* you'll have to supply different default Huffman tables.
|
||||
* The exact same statements apply for progressive JPEG: the default tables
|
||||
* don't work for progressive mode. (This may get fixed, however.)
|
||||
*/
|
||||
#define INPUT_SMOOTHING_SUPPORTED /* Input image smoothing option? */
|
||||
|
||||
/* Decoder capability options: */
|
||||
|
||||
#undef D_ARITH_CODING_SUPPORTED /* Arithmetic coding back end? */
|
||||
#define D_MULTISCAN_FILES_SUPPORTED /* Multiple-scan JPEG files? */
|
||||
#define D_PROGRESSIVE_SUPPORTED /* Progressive JPEG? (Requires MULTISCAN)*/
|
||||
#define SAVE_MARKERS_SUPPORTED /* jpeg_save_markers() needed? */
|
||||
#define BLOCK_SMOOTHING_SUPPORTED /* Block smoothing? (Progressive only) */
|
||||
#define IDCT_SCALING_SUPPORTED /* Output rescaling via IDCT? */
|
||||
#undef UPSAMPLE_SCALING_SUPPORTED /* Output rescaling at upsample stage? */
|
||||
#define UPSAMPLE_MERGING_SUPPORTED /* Fast path for sloppy upsampling? */
|
||||
#define QUANT_1PASS_SUPPORTED /* 1-pass color quantization? */
|
||||
#define QUANT_2PASS_SUPPORTED /* 2-pass color quantization? */
|
||||
|
||||
/* more capability options later, no doubt */
|
||||
|
||||
|
||||
/*
|
||||
* Ordering of RGB data in scanlines passed to or from the application.
|
||||
* If your application wants to deal with data in the order B,G,R, just
|
||||
* change these macros. You can also deal with formats such as R,G,B,X
|
||||
* (one extra byte per pixel) by changing RGB_PIXELSIZE. Note that changing
|
||||
* the offsets will also change the order in which colormap data is organized.
|
||||
* RESTRICTIONS:
|
||||
* 1. The sample applications cjpeg,djpeg do NOT support modified RGB formats.
|
||||
* 2. These macros only affect RGB<=>YCbCr color conversion, so they are not
|
||||
* useful if you are using JPEG color spaces other than YCbCr or grayscale.
|
||||
* 3. The color quantizer modules will not behave desirably if RGB_PIXELSIZE
|
||||
* is not 3 (they don't understand about dummy color components!). So you
|
||||
* can't use color quantization if you change that value.
|
||||
*/
|
||||
|
||||
#define RGB_RED 0 /* Offset of Red in an RGB scanline element */
|
||||
#define RGB_GREEN 1 /* Offset of Green */
|
||||
#define RGB_BLUE 2 /* Offset of Blue */
|
||||
#define RGB_PIXELSIZE 3 /* JSAMPLEs per RGB scanline element */
|
||||
|
||||
|
||||
/* Definitions for speed-related optimizations. */
|
||||
|
||||
|
||||
/* If your compiler supports inline functions, define INLINE
|
||||
* as the inline keyword; otherwise define it as empty.
|
||||
*/
|
||||
|
||||
#ifndef INLINE
|
||||
#ifdef __GNUC__ /* for instance, GNU C knows about inline */
|
||||
#define INLINE __inline__
|
||||
#endif
|
||||
#ifndef INLINE
|
||||
#define INLINE /* default is to define it as empty */
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
/* On some machines (notably 68000 series) "int" is 32 bits, but multiplying
|
||||
* two 16-bit shorts is faster than multiplying two ints. Define MULTIPLIER
|
||||
* as short on such a machine. MULTIPLIER must be at least 16 bits wide.
|
||||
*/
|
||||
|
||||
#ifndef MULTIPLIER
|
||||
#define MULTIPLIER int /* type for fastest integer multiply */
|
||||
#endif
|
||||
|
||||
|
||||
/* FAST_FLOAT should be either float or double, whichever is done faster
|
||||
* by your compiler. (Note that this type is only used in the floating point
|
||||
* DCT routines, so it only matters if you've defined DCT_FLOAT_SUPPORTED.)
|
||||
* Typically, float is faster in ANSI C compilers, while double is faster in
|
||||
* pre-ANSI compilers (because they insist on converting to double anyway).
|
||||
* The code below therefore chooses float if we have ANSI-style prototypes.
|
||||
*/
|
||||
|
||||
#ifndef FAST_FLOAT
|
||||
#ifdef HAVE_PROTOTYPES
|
||||
#define FAST_FLOAT float
|
||||
#else
|
||||
#define FAST_FLOAT double
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#endif /* JPEG_INTERNAL_OPTIONS */
|
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -1,45 +0,0 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by GSsoftdx.rc
|
||||
//
|
||||
#define IDD_CONFIG 101
|
||||
#define IDD_ABOUT 102
|
||||
#define IDD_LOGGING 106
|
||||
#define IDB_ZEROGSLOGO 108
|
||||
#define IDR_REALPS2_FX 109
|
||||
#define IDR_SHADERS 110
|
||||
#define IDC_CHECK1 1000
|
||||
#define IDC_FULLSCREEN 1000
|
||||
#define IDC_NAME 1000
|
||||
#define IDC_LOG 1000
|
||||
#define IDC_CHECK2 1001
|
||||
#define IDC_FPSCOUNT 1001
|
||||
#define IDC_CHECK5 1002
|
||||
#define IDC_FRAMESKIP 1002
|
||||
#define IDC_STRETCH 1003
|
||||
#define IDC_LOGGING 1004
|
||||
#define IDC_COMBO1 1005
|
||||
#define IDC_CACHE 1005
|
||||
#define IDC_CACHESIZE 1006
|
||||
#define IDC_CHECK3 1007
|
||||
#define IDC_RECORD 1007
|
||||
#define IDC_COMBO2 1008
|
||||
#define IDC_DSPRES 1008
|
||||
#define IDC_WRES 1008
|
||||
#define IDC_COMBO3 1009
|
||||
#define IDC_DDDRV 1009
|
||||
#define IDC_FRES 1009
|
||||
#define IDC_COMBO4 1012
|
||||
#define IDC_CODEC 1012
|
||||
#define IDC_FILTERS 1014
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 112
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1015
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
|
@ -1,79 +0,0 @@
|
|||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by zerogs.rc
|
||||
//
|
||||
#define IDC_CONF_DEFAULT 3
|
||||
#define IDR_DATA1 112
|
||||
#define IDC_ABOUTTEXT 1015
|
||||
#define IDC_CONFIG_AA 1016
|
||||
#define IDC_CONFIG_INTERLACE 1017
|
||||
#define IDC_CONFIG_AA3 1018
|
||||
#define IDC_CONFIG_CAPTUREAVI 1018
|
||||
#define IDC_CONFIG_CAPTUREAVI2 1019
|
||||
#define IDC_CONFIG_FULLSCREEN 1019
|
||||
#define IDC_CONFIG_FULLSCREEN2 1020
|
||||
#define IDC_CONFIG_FFX 1020
|
||||
#define IDC_CONFIG_INTERLACE2 1021
|
||||
#define IDC_CONFIG_DEPTHWRITE 1021
|
||||
#define IDC_CONFIG_FFX2 1021
|
||||
#define IDC_CONFIG_BMPSS 1021
|
||||
#define IDC_CONFIG_AANONE 1022
|
||||
#define IDC_CONFIG_AA2 1023
|
||||
#define IDC_RADIO3 1024
|
||||
#define IDC_CONFIG_AA4 1024
|
||||
#define IDC_CONFIG_INTERLACE3 1025
|
||||
#define IDC_CONFIG_BILINEAR 1025
|
||||
#define IDC_CONF_WIN640 1026
|
||||
#define IDC_CONF_WIN800 1027
|
||||
#define IDC_CONF_WIN1024 1028
|
||||
#define IDC_RADIO5 1029
|
||||
#define IDC_CONF_WIN1280 1029
|
||||
#define IDC_CONFIG_CAPTUREAVI3 1030
|
||||
#define IDC_CONFIG_WIREFRAME 1030
|
||||
#define IDC_CONFIG_CAPTUREAVI4 1031
|
||||
#define IDC_CONFIG_CACHEFBP 1031
|
||||
#define IDC_CONFIG_SHOWFPS 1031
|
||||
#define IDC_CONFOPT_00100000 1031
|
||||
#define IDC_CONFOPT_00080000 1032
|
||||
#define IDC_CONFOPT_00002000 1033
|
||||
#define IDC_CONFOPT_00001000 1035
|
||||
#define IDC_CONFOPT_00000200 1037
|
||||
#define IDC_CONFOPT_00000080 1038
|
||||
#define IDC_CONFOPT_201 1039
|
||||
#define IDC_CONFOPT_00000040 1039
|
||||
#define IDC_CONFOPT_00000020 1040
|
||||
#define IDC_CONFOPT_00000001 1042
|
||||
#define IDC_CONFOPT_00000004 1044
|
||||
#define IDC_CONFOPT_IDS 1045
|
||||
#define IDC_CONFOPT_00200000 1046
|
||||
#define IDC_CONFOPT_00004000 1047
|
||||
#define IDC_BUTTON1 1048
|
||||
#define IDC_CONFOPT_COMPUTEOR 1048
|
||||
#define IDC_CONFOPT_4001 1049
|
||||
#define IDC_CONFOPT_00000010 1049
|
||||
#define IDC_CONFOPT_00008000 1050
|
||||
#define IDC_CONFOPT_00010000 1052
|
||||
#define IDC_CONFOPT_00020000 1054
|
||||
#define IDC_CONFOPT_00000002 1055
|
||||
#define IDC_CONFOPT_01000000 1056
|
||||
#define IDC_CONFOPT_00800000 1057
|
||||
#define IDC_CONFOPT_00000008 1058
|
||||
#define IDC_CONFOPT_00000400 1060
|
||||
#define IDC_CONFOPT_00000800 1061
|
||||
#define IDC_CONFOPT_NOALPHABLEND30 1062
|
||||
#define IDC_CONFOPT_00040000 1063
|
||||
#define IDC_CONFOPT_02000000 1064
|
||||
#define IDC_CONFOPT_04000000 1065
|
||||
#define IDC_CONFIG_AA8 2003
|
||||
#define IDC_CONFIG_AA16 2004
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 113
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1049
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
Binary file not shown.
Before Width: | Height: | Size: 900 KiB |
|
@ -1,37 +0,0 @@
|
|||
; Declares the module parameters for the DLL.
|
||||
|
||||
;LIBRARY "ZeroGS"
|
||||
;DESCRIPTION 'ZeroGS dll'
|
||||
|
||||
EXPORTS
|
||||
; Explicit exports can go here
|
||||
PS2EgetLibType @2
|
||||
PS2EgetLibName @3
|
||||
PS2EgetLibVersion2 @4
|
||||
GSinit @5
|
||||
GSshutdown @6
|
||||
GSopen @7
|
||||
GSclose @8
|
||||
GSgifTransfer1 @13
|
||||
GSgifTransfer2 @14
|
||||
GSgifTransfer3 @15
|
||||
GSreadFIFO @16
|
||||
GSvsync @17
|
||||
GSmakeSnapshot @18
|
||||
GSkeyEvent @19
|
||||
GSfreeze @20
|
||||
GSconfigure @21
|
||||
GStest @22
|
||||
GSabout @23
|
||||
GSreadFIFO2 @28
|
||||
GSirqCallback @29
|
||||
GSsetBaseMem @30
|
||||
GSwriteCSR @31
|
||||
GSchangeSaveState @32
|
||||
GSreset @33
|
||||
GSgifSoftReset @34
|
||||
GSsetFrameSkip @35
|
||||
GSsetGameCRC @36
|
||||
GSgetLastTag @37
|
||||
GSsetupRecording @38
|
||||
GSsetSettingsDir @39
|
|
@ -1,228 +0,0 @@
|
|||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resrc1.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "resource.h"
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (U.S.) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDB_ZEROGSLOGO BITMAP "zerogs.bmp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// RCDATA
|
||||
//
|
||||
|
||||
IDR_SHADERS RCDATA "ps2hw.dat"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_CONFIG DIALOGEX 0, 0, 427, 401
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
CONTROL "Interlace Enable (toggle with F5)\n there are 2 modes + interlace off",IDC_CONFIG_INTERLACE,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,7,134,18
|
||||
CONTROL "Bilinear Filtering (Shift+F5)\n Best quality is on, turn off for speed.",IDC_CONFIG_BILINEAR,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,31,135,18
|
||||
CONTROL "None",IDC_CONFIG_AANONE,"Button",BS_AUTORADIOBUTTON | WS_GROUP,19,81,34,11
|
||||
CONTROL "2X",IDC_CONFIG_AA2,"Button",BS_AUTORADIOBUTTON,69,81,26,11
|
||||
CONTROL "4X",IDC_CONFIG_AA4,"Button",BS_AUTORADIOBUTTON,111,81,28,11
|
||||
CONTROL "Wireframe rendering (F7)",IDC_CONFIG_WIREFRAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,122,93,10
|
||||
CONTROL "Capture Avi (zerogs.avi) (F12)",IDC_CONFIG_CAPTUREAVI,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,140,109,10
|
||||
CONTROL "Save Snapshots as BMPs (default is JPG)",IDC_CONFIG_BMPSS,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,7,161,147,10
|
||||
CONTROL "Fullscreen (Alt+Enter)\n to get out press Alt+Enter again",IDC_CONFIG_FULLSCREEN,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,7,177,146,17
|
||||
CONTROL "640 x 480",IDC_CONF_WIN640,"Button",BS_AUTORADIOBUTTON | WS_GROUP,15,210,59,8
|
||||
CONTROL "800 x 600",IDC_CONF_WIN800,"Button",BS_AUTORADIOBUTTON,78,210,59,8
|
||||
CONTROL "1024 x 768",IDC_CONF_WIN1024,"Button",BS_AUTORADIOBUTTON,15,223,59,8
|
||||
CONTROL "1280 x 960",IDC_CONF_WIN1280,"Button",BS_AUTORADIOBUTTON,78,223,59,8
|
||||
DEFPUSHBUTTON "OK",IDOK,7,380,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,94,380,50,14
|
||||
GROUPBOX "Anti-aliasing for sharper graphics (F6)",IDC_STATIC,7,55,132,61
|
||||
GROUPBOX "Default Window Size (no speed impact)",IDC_STATIC,7,201,141,35
|
||||
LTEXT "Show Frames Per Second (Shift+F7)",IDC_STATIC,7,244,140,10
|
||||
GROUPBOX "Advanced Options",IDC_STATIC,152,7,268,387
|
||||
LTEXT "Each option is presented with a unique ID in hex. In order to preserve options across games, go into the game's patch (.pnach) file and type\n zerogs=IDS\nwhere IDS is the OR all of the values in hex for every option you want enabled. ",IDC_STATIC,161,16,252,33
|
||||
PUSHBUTTON "Use Defaults (recommended)",IDC_CONF_DEFAULT,159,76,151,14
|
||||
CONTROL "Disable alpha testing - 00080000",IDC_CONFOPT_00080000,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,104,119,10
|
||||
CONTROL "Disable stencil buffer - 00002000\nusually safe to do for simple scenes",IDC_CONFOPT_00002000,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,159,114,118,22
|
||||
CONTROL "No target CLUT - 00001000\n(use on RE4, or foggy scenes)",IDC_CONFOPT_00001000,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,169,120,24
|
||||
CONTROL "Disable depth updates - 00000200",IDC_CONFOPT_00000200,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,158,161,125,10
|
||||
CONTROL "FFX hack - 00000080\nshows missing geometry",IDC_CONFOPT_00000080,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,190,121,17
|
||||
CONTROL "Exact color testing - 00000020\nfixes overbright or shadow/black artifacts (crash n burn)",IDC_CONFOPT_00000020,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,209,119,25
|
||||
CONTROL "Tex Target checking - 00000001\nlego racers",IDC_CONFOPT_00000001,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,233,123,22
|
||||
CONTROL "Interlace 2X - 00000004\nfixes 2x bigger screen (gradius3)",IDC_CONFOPT_00000004,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,254,119,20
|
||||
CONTROL "32 bit render targets - 00200000",IDC_CONFOPT_00200000,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,285,93,117,10
|
||||
CONTROL "No depth resolve - 00008000\nmight give z buffer artifacts",IDC_CONFOPT_00008000,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,164,121,19
|
||||
CONTROL "full 16 bit resolution - 00010000\nuse when half the screen is missing, etc",IDC_CONFOPT_00010000,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,185,125,23
|
||||
CONTROL "Auto Reset Targs - 00000002\nshadow hearts, samurai warriors (use when game is slow and toggling AA fixes it)",IDC_CONFOPT_00000002,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,212,124,32
|
||||
CONTROL "Tex Alpha Hack - 00000008\nnightmare before christmas",IDC_CONFOPT_00000008,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,247,125,17
|
||||
EDITTEXT IDC_CONFOPT_IDS,361,380,48,14,ES_AUTOHSCROLL | ES_READONLY
|
||||
CONTROL "Resolve Hack #1 - 00000400\nspeeds some games (kingdom hearts)",IDC_CONFOPT_00000400,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,266,135,19
|
||||
CONTROL "Resolve Hack #2 - 00000800\nshadow hearts, urbz",IDC_CONFOPT_00000800,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,276,117,17
|
||||
CONTROL "Resolve Hack #3 - 00020000\nneopets",IDC_CONFOPT_00020000,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,287,125,17
|
||||
CONTROL "Fast Update - 00040000\nspeeds some games (okami)",IDC_CONFOPT_00040000,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,297,125,17
|
||||
PUSHBUTTON "Compute OR of IDS",IDC_CONFOPT_COMPUTEOR,283,380,73,14
|
||||
LTEXT "Important options are listed first. Note, setting option here means that they will be ADDED to whatever options are set in each pnach file.",IDC_STATIC,159,50,252,23
|
||||
CONTROL "No target resolves - 00000010\nStops all resolving of targets (try this first for really slow games)",IDC_CONFOPT_00000010,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,104,111,33
|
||||
CONTROL "Disable Multiple RTs - 00100000",IDC_CONFOPT_00100000,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,159,91,119,10
|
||||
CONTROL "No color clamping - 00000040\nSpeeds games up but might be too bright or too dim",IDC_CONFOPT_00000040,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,157,137,123,22
|
||||
CONTROL "8X",IDC_CONFIG_AA8,"Button",BS_AUTORADIOBUTTON,65,97,26,11
|
||||
CONTROL "16X",IDC_CONFIG_AA16,"Button",BS_AUTORADIOBUTTON,107,97,28,11
|
||||
LTEXT "shortcuts: F6 - next, Shift+F6 - prev",IDC_STATIC,19,65,116,11
|
||||
CONTROL "No Vertical Stripes - 00004000\n try when there's a lot of garbage on screen",IDC_CONFOPT_00004000,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,138,111,28
|
||||
CONTROL "Partial Targets - 02000000\nReduces artifacts and speeds up some games (mgs3)",IDC_CONFOPT_02000000,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,158,319,125,24
|
||||
CONTROL "Partial Depth - 04000000\nTries to save the depth target as much as possible (mgs3)",IDC_CONFOPT_04000000,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,159,347,125,24
|
||||
CONTROL "Specular Highlights - 01000000\nMakes xenosaga graphics faster by removing highlights",IDC_CONFOPT_01000000,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,285,313,125,25
|
||||
CONTROL "Parallelize Contexts - 00800000 (Might speed things up, xenosaga is faster)",IDC_CONFOPT_00800000,
|
||||
"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,284,345,125,25
|
||||
END
|
||||
|
||||
IDD_ABOUT DIALOGEX 0, 0, 182, 220
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "GSabout"
|
||||
FONT 8, "MS Sans Serif", 0, 0, 0x0
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,65,199,50,14
|
||||
LTEXT "ZeroGS\n\nauthor: zerofrog(@gmail.com)\n\n\nthanks to Gabest for SSE optimizations",IDC_STATIC,7,7,160,47
|
||||
LTEXT "Static",IDC_ABOUTTEXT,7,65,152,124
|
||||
END
|
||||
|
||||
IDD_LOGGING DIALOG 0, 0, 152, 55
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Dialog"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,40,35,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,95,35,50,14
|
||||
CONTROL "Log",IDC_LOG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,60,15,28,10
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_CONFIG, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 420
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 394
|
||||
END
|
||||
|
||||
IDD_ABOUT, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 175
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 213
|
||||
END
|
||||
|
||||
IDD_LOGGING, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 145
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 48
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resrc1.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""resource.h""\r\n"
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
|
@ -1,2 +0,0 @@
|
|||
noinst_PROGRAMS = zgsbuild
|
||||
zgsbuild_SOURCES = zpipe.cpp zerogsshaders.cpp
|
|
@ -1,23 +0,0 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 9.00
|
||||
# Visual Studio 2005
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ZeroGSShaders", "ZeroGSShaders_2005.vcproj", "{811D47CC-E5F0-456A-918E-5908005E8FC0}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release (to Public)|Win32 = Release (to Public)|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{811D47CC-E5F0-456A-918E-5908005E8FC0}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{811D47CC-E5F0-456A-918E-5908005E8FC0}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{811D47CC-E5F0-456A-918E-5908005E8FC0}.Release (to Public)|Win32.ActiveCfg = Release (to Public)|Win32
|
||||
{811D47CC-E5F0-456A-918E-5908005E8FC0}.Release (to Public)|Win32.Build.0 = Release (to Public)|Win32
|
||||
{811D47CC-E5F0-456A-918E-5908005E8FC0}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{811D47CC-E5F0-456A-918E-5908005E8FC0}.Release|Win32.Build.0 = Release|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -1 +0,0 @@
|
|||
copy .\Release\ZeroGSShaders.exe ..\
|
|
@ -1,337 +0,0 @@
|
|||
#define _CRT_SECURE_NO_DEPRECATE
|
||||
|
||||
// Builds all possible shader files from ps2hw.fx and stores them in
|
||||
// a preprocessed database
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <zlib.h>
|
||||
#include "zpipe.h"
|
||||
|
||||
#include <Cg/cg.h>
|
||||
#include <Cg/cgGL.h>
|
||||
|
||||
#define SAFE_RELEASE(x) { if( (x) != NULL ) { (x)->Release(); x = NULL; } }
|
||||
|
||||
#include <map>
|
||||
#include <vector>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#include "zerogsshaders.h"
|
||||
|
||||
char* srcfilename = "ps2hw.fx";
|
||||
char* dstfilename = "ps2hw.dat";
|
||||
|
||||
#ifndef ArraySize
|
||||
#define ArraySize(x) (sizeof(x) / sizeof((x)[0]))
|
||||
#endif
|
||||
|
||||
struct SHADERINFO
|
||||
{
|
||||
int type;
|
||||
vector<char> buf;
|
||||
};
|
||||
|
||||
map<int, SHADERINFO> mapShaders;
|
||||
CGcontext g_cgcontext;
|
||||
|
||||
void LoadShader(int index, const char* pshader, CGprofile prof, vector<const char*>& vargs, int context)
|
||||
{
|
||||
vector<const char*> realargs;
|
||||
realargs.reserve(16);
|
||||
realargs.resize(vargs.size());
|
||||
if( vargs.size() > 0 )
|
||||
memcpy(&realargs[0], &vargs[0], realargs.size() * sizeof(realargs[0]));
|
||||
realargs.push_back(context ? "-Ictx1" : "-Ictx0");
|
||||
realargs.push_back(NULL);
|
||||
|
||||
CGprogram prog = cgCreateProgramFromFile(g_cgcontext, CG_SOURCE, srcfilename, prof, pshader, &realargs[0]);
|
||||
if( !cgIsProgram(prog) ) {
|
||||
printf("Failed to load shader %s: \n%s\n", pshader, cgGetLastListing(g_cgcontext));
|
||||
return;
|
||||
}
|
||||
|
||||
if( mapShaders.find(index) != mapShaders.end() ) {
|
||||
printf("error: two shaders share the same index %d\n", index);
|
||||
exit(0);
|
||||
}
|
||||
|
||||
if( !cgIsProgramCompiled(prog) )
|
||||
cgCompileProgram(prog);
|
||||
|
||||
const char* pstr = cgGetProgramString(prog, CG_COMPILED_PROGRAM);
|
||||
|
||||
const char* pprog = strstr(pstr, "#program");
|
||||
if( pprog == NULL ) {
|
||||
printf("program field not found!\n");
|
||||
return;
|
||||
}
|
||||
pprog += 9;
|
||||
const char* progend = strchr(pprog, '\r');
|
||||
if( progend == NULL ) progend = strchr(pprog, '\n');
|
||||
|
||||
if( progend == NULL ) {
|
||||
printf("prog end not found!\n");
|
||||
return;
|
||||
}
|
||||
|
||||
const char* defname = "main";
|
||||
|
||||
SHADERINFO info;
|
||||
info.type = 0;
|
||||
info.buf.resize(strlen(pstr)+1);
|
||||
|
||||
// change the program name to main
|
||||
memset(&info.buf[0], 0, info.buf.size());
|
||||
memcpy(&info.buf[0], pstr, pprog-pstr);
|
||||
memcpy(&info.buf[pprog-pstr], defname, 4);
|
||||
memcpy(&info.buf[pprog-pstr+4], progend, strlen(pstr)-(progend-pstr));
|
||||
|
||||
if( mapShaders.find(index) != mapShaders.end() )
|
||||
printf("same shader\n");
|
||||
assert( mapShaders.find(index) == mapShaders.end() );
|
||||
mapShaders[index] = info;
|
||||
|
||||
cgDestroyProgram(prog);
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
printf("usage: [src] [dst] [opts]\n");
|
||||
|
||||
if( argc >= 2 ) srcfilename = argv[1];
|
||||
if( argc >= 3 ) dstfilename = argv[2];
|
||||
|
||||
FILE* fsrc = fopen(srcfilename, "r");
|
||||
if( fsrc == NULL ) {
|
||||
printf("cannot open %s\n", srcfilename);
|
||||
return 0;
|
||||
}
|
||||
fclose(fsrc);
|
||||
|
||||
g_cgcontext = cgCreateContext();
|
||||
if( !cgIsContext(g_cgcontext) ) {
|
||||
printf("failed to create cg context\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
CGprofile cgvProf = CG_PROFILE_ARBVP1;
|
||||
CGprofile cgfProf = CG_PROFILE_ARBFP1;
|
||||
if( !cgGLIsProfileSupported(cgvProf) != CG_TRUE ) {
|
||||
printf("arbvp1 not supported\n");
|
||||
return 0;
|
||||
}
|
||||
if( !cgGLIsProfileSupported(cgfProf) != CG_TRUE ) {
|
||||
printf("arbfp1 not supported\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
cgGLEnableProfile(cgvProf);
|
||||
cgGLEnableProfile(cgfProf);
|
||||
cgGLSetOptimalOptions(cgvProf);
|
||||
cgGLSetOptimalOptions(cgfProf);
|
||||
|
||||
vector<const char*> vmacros;
|
||||
|
||||
LoadShader(SH_BITBLTVS, "BitBltVS", cgvProf, vmacros, 0);
|
||||
LoadShader(SH_BITBLTPS, "BitBltPS", cgfProf, vmacros, 0);
|
||||
LoadShader(SH_BITBLTDEPTHPS, "BitBltDepthPS", cgfProf, vmacros, 0);
|
||||
LoadShader(SH_BITBLTDEPTHMRTPS, "BitBltDepthMRTPS", cgfProf, vmacros, 0);
|
||||
LoadShader(SH_CRTCTARGPS, "CRTCTargPS", cgfProf, vmacros, 0);
|
||||
LoadShader(SH_CRTCPS, "CRTCPS", cgfProf, vmacros, 0);
|
||||
LoadShader(SH_CRTC_NEARESTPS, "CRTCPS_Nearest", cgfProf, vmacros, 0);
|
||||
LoadShader(SH_CRTC24PS, "CRTC24PS", cgfProf, vmacros, 0);
|
||||
LoadShader(SH_ZEROPS, "ZeroPS", cgfProf, vmacros, 0);
|
||||
LoadShader(SH_BASETEXTUREPS, "BaseTexturePS", cgfProf, vmacros, 0);
|
||||
LoadShader(SH_BITBLTAAPS, "BitBltPS", cgfProf, vmacros, 0);
|
||||
LoadShader(SH_CRTCTARGINTERPS, "CRTCTargInterPS", cgfProf, vmacros, 0);
|
||||
LoadShader(SH_CRTCINTERPS, "CRTCInterPS", cgfProf, vmacros, 0);
|
||||
LoadShader(SH_CRTCINTER_NEARESTPS, "CRTCInterPS_Nearest", cgfProf, vmacros, 0);
|
||||
LoadShader(SH_CRTC24INTERPS, "CRTC24InterPS", cgfProf, vmacros, 0);
|
||||
LoadShader(SH_CONVERT16TO32PS, "Convert16to32PS", cgfProf, vmacros, 0);
|
||||
LoadShader(SH_CONVERT32TO16PS, "Convert32to16PS", cgfProf, vmacros, 0);
|
||||
|
||||
const int vsshaders[4] = { SH_REGULARVS, SH_TEXTUREVS, SH_REGULARFOGVS, SH_TEXTUREFOGVS };
|
||||
const char* pvsshaders[4] = { "RegularVS", "TextureVS", "RegularFogVS", "TextureFogVS" };
|
||||
|
||||
// load the texture shaders
|
||||
char str[255], strdir[255];
|
||||
|
||||
strcpy(strdir, srcfilename);
|
||||
int i = (int)strlen(strdir);
|
||||
while(i > 0) {
|
||||
if( strdir[i-1] == '/' || strdir[i-1] == '\\' )
|
||||
break;
|
||||
--i;
|
||||
}
|
||||
|
||||
strdir[i] = 0;
|
||||
|
||||
for(i = 0; i < ArraySize(vsshaders); ++i) {
|
||||
for(int writedepth = 0; writedepth < 2; ++writedepth ) {
|
||||
|
||||
if( writedepth ) vmacros.push_back("-DWRITE_DEPTH");
|
||||
LoadShader(vsshaders[i]|(writedepth?SH_WRITEDEPTH:0), pvsshaders[i], cgvProf, vmacros, 0);
|
||||
LoadShader(vsshaders[i]|(writedepth?SH_WRITEDEPTH:0)|SH_CONTEXT1, pvsshaders[i], cgvProf, vmacros, 1);
|
||||
if( writedepth ) vmacros.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
const int psshaders[2] = { SH_REGULARPS, SH_REGULARFOGPS };
|
||||
const char* ppsshaders[2] = { "RegularPS", "RegularFogPS" };
|
||||
|
||||
for(i = 0; i < ArraySize(psshaders); ++i) {
|
||||
for(int writedepth = 0; writedepth < 2; ++writedepth ) {
|
||||
if( writedepth ) vmacros.push_back("-DWRITE_DEPTH");
|
||||
LoadShader(psshaders[i]|(writedepth?SH_WRITEDEPTH:0), ppsshaders[i], cgfProf, vmacros, 0);
|
||||
if( writedepth ) vmacros.pop_back();
|
||||
}
|
||||
}
|
||||
|
||||
printf("creating shaders, note that ctx0/ps2hw_ctx.fx, and ctx1/ps2hw_ctx.fx are required\n");
|
||||
vmacros.resize(0);
|
||||
|
||||
for(int texwrap = 0; texwrap < NUM_TEXWRAPS; ++texwrap ) {
|
||||
|
||||
if( g_pPsTexWrap[texwrap] != NULL )
|
||||
vmacros.push_back(g_pPsTexWrap[texwrap]);
|
||||
|
||||
for(int context = 0; context < 2; ++context) {
|
||||
|
||||
for(int texfilter = 0; texfilter < NUM_FILTERS; ++texfilter) {
|
||||
for(int fog = 0; fog < 2; ++fog ) {
|
||||
for(int writedepth = 0; writedepth < 2; ++writedepth ) {
|
||||
|
||||
if( writedepth )
|
||||
vmacros.push_back("-DWRITE_DEPTH");
|
||||
|
||||
for(int testaem = 0; testaem < 2; ++testaem ) {
|
||||
|
||||
if( testaem )
|
||||
vmacros.push_back("-DTEST_AEM");
|
||||
|
||||
for(int exactcolor = 0; exactcolor < 2; ++exactcolor ) {
|
||||
|
||||
if( exactcolor )
|
||||
vmacros.push_back("-DEXACT_COLOR");
|
||||
|
||||
// 32
|
||||
sprintf(str, "Texture%s%d_32PS", fog?"Fog":"", texfilter);
|
||||
|
||||
vmacros.push_back("-DACCURATE_DECOMPRESSION");
|
||||
LoadShader(GET_SHADER_INDEX(0, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_ACCURATE), str, cgfProf, vmacros, context);
|
||||
vmacros.pop_back();
|
||||
|
||||
LoadShader(GET_SHADER_INDEX(0, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, 0), str, cgfProf, vmacros, context);
|
||||
|
||||
if( texfilter == 0 ) {
|
||||
// tex32
|
||||
sprintf(str, "Texture%s%d_tex32PS", fog?"Fog":"", texfilter);
|
||||
|
||||
// vmacros.push_back("-DACCURATE_DECOMPRESSION");
|
||||
// LoadShader(GET_SHADER_INDEX(1, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_ACCURATE), str, cgfProf, vmacros, context);
|
||||
// vmacros.pop_back();
|
||||
|
||||
LoadShader(GET_SHADER_INDEX(1, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, 0), str, cgfProf, vmacros, context);
|
||||
|
||||
// clut32
|
||||
sprintf(str, "Texture%s%d_clut32PS", fog?"Fog":"", texfilter);
|
||||
|
||||
// vmacros.push_back("-DACCURATE_DECOMPRESSION");
|
||||
// LoadShader(GET_SHADER_INDEX(2, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_ACCURATE), str, cgfProf, vmacros, context);
|
||||
// vmacros.pop_back();
|
||||
|
||||
LoadShader(GET_SHADER_INDEX(2, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, 0), str, cgfProf, vmacros, context);
|
||||
|
||||
// tex32to16
|
||||
sprintf(str, "Texture%s%d_tex32to16PS", fog?"Fog":"", texfilter);
|
||||
|
||||
// vmacros.push_back("-DACCURATE_DECOMPRESSION");
|
||||
// LoadShader(GET_SHADER_INDEX(3, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_ACCURATE), str, cgfProf, vmacros, context);
|
||||
// vmacros.pop_back();
|
||||
|
||||
LoadShader(GET_SHADER_INDEX(3, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, 0), str, cgfProf, vmacros, context);
|
||||
|
||||
// tex16to8h
|
||||
sprintf(str, "Texture%s%d_tex16to8hPS", fog?"Fog":"", texfilter);
|
||||
|
||||
// vmacros.push_back("-DACCURATE_DECOMPRESSION");
|
||||
// LoadShader(GET_SHADER_INDEX(4, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, SHADER_ACCURATE), str, cgfProf, vmacros, context);
|
||||
// vmacros.pop_back();
|
||||
|
||||
LoadShader(GET_SHADER_INDEX(4, texfilter, texwrap, fog, writedepth, testaem, exactcolor, context, 0), str, cgfProf, vmacros, context);
|
||||
}
|
||||
|
||||
if( exactcolor )
|
||||
vmacros.pop_back();
|
||||
}
|
||||
|
||||
if( testaem )
|
||||
vmacros.pop_back();
|
||||
}
|
||||
|
||||
if( writedepth )
|
||||
vmacros.pop_back();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if( g_pPsTexWrap[texwrap] != NULL )
|
||||
vmacros.pop_back();
|
||||
}
|
||||
|
||||
if( vmacros.size() != 0 )
|
||||
printf("error with macros!\n");
|
||||
|
||||
// create the database
|
||||
|
||||
int num = (int)mapShaders.size();
|
||||
|
||||
// first compress
|
||||
vector<char> buffer;
|
||||
buffer.reserve(10000000); // 10mb
|
||||
buffer.resize(sizeof(SHADERHEADER)*num);
|
||||
|
||||
i = 0;
|
||||
for(map<int, SHADERINFO>::iterator it = mapShaders.begin(); it != mapShaders.end(); ++it, ++i) {
|
||||
SHADERHEADER h;
|
||||
h.index = it->first | it->second.type;
|
||||
h.offset = (int)buffer.size();
|
||||
h.size = (int)it->second.buf.size();
|
||||
|
||||
memcpy(&buffer[0] + i*sizeof(SHADERHEADER), &h, sizeof(SHADERHEADER));
|
||||
|
||||
size_t cur = buffer.size();
|
||||
buffer.resize(cur + it->second.buf.size());
|
||||
memcpy(&buffer[cur], &it->second.buf[0], it->second.buf.size());
|
||||
}
|
||||
|
||||
int compressed_size;
|
||||
int real_size = (int)buffer.size();
|
||||
vector<char> dst;
|
||||
dst.resize(buffer.size());
|
||||
def(&buffer[0], &dst[0], (int)buffer.size(), &compressed_size);
|
||||
|
||||
// write to file
|
||||
// fmt: num shaders, size of compressed, compressed data
|
||||
FILE* fdst = fopen(dstfilename, "wb");
|
||||
if( fdst == NULL ) {
|
||||
printf("failed to open %s\n", dstfilename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
fwrite(&num, 4, 1, fdst);
|
||||
fwrite(&compressed_size, 4, 1, fdst);
|
||||
fwrite(&real_size, 4, 1, fdst);
|
||||
fwrite(&dst[0], compressed_size, 1, fdst);
|
||||
|
||||
fclose(fdst);
|
||||
|
||||
printf("wrote %s\n", dstfilename);
|
||||
|
||||
cgDestroyContext(g_cgcontext);
|
||||
|
||||
return 0;
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
#include <Cg/cg.h>
|
||||
#include <Cg/cgGL.h>
|
||||
|
||||
#define NUM_FILTERS 2 // texture filtering
|
||||
#define NUM_TYPES 5 // types of texture read modes
|
||||
#define NUM_TEXWRAPS 4 // texture wrapping
|
||||
|
||||
#define SHADER_REDUCED 1 // equivalent to ps2.0
|
||||
#define SHADER_ACCURATE 2 // for older cards with less accurate math (ps2.x+)
|
||||
|
||||
#define NUM_SHADERS (NUM_FILTERS*NUM_TYPES*NUM_TEXWRAPS*32) // # shaders for a given ps
|
||||
|
||||
const static char* g_pShaders[] = { "full", "reduced", "accurate", "accurate-reduced" };
|
||||
const static char* g_pPsTexWrap[] = { "-DREPEAT", "-DCLAMP", "-DREGION_REPEAT", NULL };
|
||||
const static char* g_pTexTypes[] = { "32", "tex32", "clut32", "tex32to16", "tex16to8h" };
|
||||
|
||||
#define TEXWRAP_REPEAT 0
|
||||
#define TEXWRAP_CLAMP 1
|
||||
#define TEXWRAP_REGION_REPEAT 2
|
||||
#define TEXWRAP_REPEAT_CLAMP 3
|
||||
|
||||
inline int GET_SHADER_INDEX(int type, int texfilter, int texwrap, int fog, int writedepth, int testaem, int exactcolor, int context, int ps)
|
||||
{
|
||||
return type + texfilter*NUM_TYPES + NUM_FILTERS*NUM_TYPES*texwrap + NUM_TEXWRAPS*NUM_FILTERS*NUM_TYPES*(fog+2*writedepth+4*testaem+8*exactcolor+16*context+32*ps);
|
||||
}
|
||||
|
||||
extern CGcontext g_cgcontext;
|
||||
|
||||
static CGprogram LoadShaderFromType(const char* srcdir, const char* srcfile, int type, int texfilter, int texwrap, int fog, int writedepth, int testaem, int exactcolor, int ps, int context)
|
||||
{
|
||||
assert( texwrap < NUM_TEXWRAPS);
|
||||
assert( type < NUM_TYPES );
|
||||
|
||||
char str[255], strctx[255];
|
||||
sprintf(str, "Texture%s%d_%sPS", fog?"Fog":"", texfilter, g_pTexTypes[type]);
|
||||
sprintf(strctx, "-I%s%s", srcdir, context?"ctx1":"ctx0");
|
||||
|
||||
vector<const char*> macros;
|
||||
macros.push_back(strctx);
|
||||
#ifdef _DEBUG
|
||||
macros.push_back("-bestprecision");
|
||||
#endif
|
||||
if( g_pPsTexWrap[texwrap] != NULL ) macros.push_back(g_pPsTexWrap[texwrap]);
|
||||
if( writedepth ) macros.push_back("-DWRITE_DEPTH");
|
||||
if( testaem ) macros.push_back("-DTEST_AEM");
|
||||
if( exactcolor ) macros.push_back("-DEXACT_COLOR");
|
||||
if( ps & SHADER_ACCURATE ) macros.push_back("-DACCURATE_DECOMPRESSION");
|
||||
macros.push_back(NULL);
|
||||
|
||||
CGprogram prog = cgCreateProgramFromFile(g_cgcontext, CG_SOURCE, srcfile, CG_PROFILE_ARBFP1, str, ¯os[0]);
|
||||
if( !cgIsProgram(prog) ) {
|
||||
printf("Failed to load shader %s: \n%s\n", str, cgGetLastListing(g_cgcontext));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return prog;
|
||||
}
|
||||
|
||||
struct SHADERHEADER
|
||||
{
|
||||
unsigned int index, offset, size; // if highest bit of index is set, pixel shader
|
||||
};
|
||||
|
||||
#define SH_WRITEDEPTH 0x2000 // depth is written
|
||||
#define SH_CONTEXT1 0x1000 // context1 is used
|
||||
|
||||
#define SH_REGULARVS 0x8000
|
||||
#define SH_TEXTUREVS 0x8001
|
||||
#define SH_REGULARFOGVS 0x8002
|
||||
#define SH_TEXTUREFOGVS 0x8003
|
||||
#define SH_REGULARPS 0x8004
|
||||
#define SH_REGULARFOGPS 0x8005
|
||||
#define SH_BITBLTVS 0x8006
|
||||
#define SH_BITBLTPS 0x8007
|
||||
#define SH_BITBLTDEPTHPS 0x8009
|
||||
#define SH_CRTCTARGPS 0x800a
|
||||
#define SH_CRTCPS 0x800b
|
||||
#define SH_CRTC24PS 0x800c
|
||||
#define SH_ZEROPS 0x800e
|
||||
#define SH_BASETEXTUREPS 0x800f
|
||||
#define SH_BITBLTAAPS 0x8010
|
||||
#define SH_CRTCTARGINTERPS 0x8012
|
||||
#define SH_CRTCINTERPS 0x8013
|
||||
#define SH_CRTC24INTERPS 0x8014
|
||||
#define SH_BITBLTDEPTHMRTPS 0x8016
|
||||
#define SH_CONVERT16TO32PS 0x8020
|
||||
#define SH_CONVERT32TO16PS 0x8021
|
||||
#define SH_CRTC_NEARESTPS 0x8022
|
||||
#define SH_CRTCINTER_NEARESTPS 0x8023
|
|
@ -1,441 +0,0 @@
|
|||
/* crc32.h -- tables for rapid CRC calculation
|
||||
* Generated automatically by crc32.c
|
||||
*/
|
||||
|
||||
local const unsigned long FAR crc_table[TBLS][256] =
|
||||
{
|
||||
{
|
||||
0x00000000UL, 0x77073096UL, 0xee0e612cUL, 0x990951baUL, 0x076dc419UL,
|
||||
0x706af48fUL, 0xe963a535UL, 0x9e6495a3UL, 0x0edb8832UL, 0x79dcb8a4UL,
|
||||
0xe0d5e91eUL, 0x97d2d988UL, 0x09b64c2bUL, 0x7eb17cbdUL, 0xe7b82d07UL,
|
||||
0x90bf1d91UL, 0x1db71064UL, 0x6ab020f2UL, 0xf3b97148UL, 0x84be41deUL,
|
||||
0x1adad47dUL, 0x6ddde4ebUL, 0xf4d4b551UL, 0x83d385c7UL, 0x136c9856UL,
|
||||
0x646ba8c0UL, 0xfd62f97aUL, 0x8a65c9ecUL, 0x14015c4fUL, 0x63066cd9UL,
|
||||
0xfa0f3d63UL, 0x8d080df5UL, 0x3b6e20c8UL, 0x4c69105eUL, 0xd56041e4UL,
|
||||
0xa2677172UL, 0x3c03e4d1UL, 0x4b04d447UL, 0xd20d85fdUL, 0xa50ab56bUL,
|
||||
0x35b5a8faUL, 0x42b2986cUL, 0xdbbbc9d6UL, 0xacbcf940UL, 0x32d86ce3UL,
|
||||
0x45df5c75UL, 0xdcd60dcfUL, 0xabd13d59UL, 0x26d930acUL, 0x51de003aUL,
|
||||
0xc8d75180UL, 0xbfd06116UL, 0x21b4f4b5UL, 0x56b3c423UL, 0xcfba9599UL,
|
||||
0xb8bda50fUL, 0x2802b89eUL, 0x5f058808UL, 0xc60cd9b2UL, 0xb10be924UL,
|
||||
0x2f6f7c87UL, 0x58684c11UL, 0xc1611dabUL, 0xb6662d3dUL, 0x76dc4190UL,
|
||||
0x01db7106UL, 0x98d220bcUL, 0xefd5102aUL, 0x71b18589UL, 0x06b6b51fUL,
|
||||
0x9fbfe4a5UL, 0xe8b8d433UL, 0x7807c9a2UL, 0x0f00f934UL, 0x9609a88eUL,
|
||||
0xe10e9818UL, 0x7f6a0dbbUL, 0x086d3d2dUL, 0x91646c97UL, 0xe6635c01UL,
|
||||
0x6b6b51f4UL, 0x1c6c6162UL, 0x856530d8UL, 0xf262004eUL, 0x6c0695edUL,
|
||||
0x1b01a57bUL, 0x8208f4c1UL, 0xf50fc457UL, 0x65b0d9c6UL, 0x12b7e950UL,
|
||||
0x8bbeb8eaUL, 0xfcb9887cUL, 0x62dd1ddfUL, 0x15da2d49UL, 0x8cd37cf3UL,
|
||||
0xfbd44c65UL, 0x4db26158UL, 0x3ab551ceUL, 0xa3bc0074UL, 0xd4bb30e2UL,
|
||||
0x4adfa541UL, 0x3dd895d7UL, 0xa4d1c46dUL, 0xd3d6f4fbUL, 0x4369e96aUL,
|
||||
0x346ed9fcUL, 0xad678846UL, 0xda60b8d0UL, 0x44042d73UL, 0x33031de5UL,
|
||||
0xaa0a4c5fUL, 0xdd0d7cc9UL, 0x5005713cUL, 0x270241aaUL, 0xbe0b1010UL,
|
||||
0xc90c2086UL, 0x5768b525UL, 0x206f85b3UL, 0xb966d409UL, 0xce61e49fUL,
|
||||
0x5edef90eUL, 0x29d9c998UL, 0xb0d09822UL, 0xc7d7a8b4UL, 0x59b33d17UL,
|
||||
0x2eb40d81UL, 0xb7bd5c3bUL, 0xc0ba6cadUL, 0xedb88320UL, 0x9abfb3b6UL,
|
||||
0x03b6e20cUL, 0x74b1d29aUL, 0xead54739UL, 0x9dd277afUL, 0x04db2615UL,
|
||||
0x73dc1683UL, 0xe3630b12UL, 0x94643b84UL, 0x0d6d6a3eUL, 0x7a6a5aa8UL,
|
||||
0xe40ecf0bUL, 0x9309ff9dUL, 0x0a00ae27UL, 0x7d079eb1UL, 0xf00f9344UL,
|
||||
0x8708a3d2UL, 0x1e01f268UL, 0x6906c2feUL, 0xf762575dUL, 0x806567cbUL,
|
||||
0x196c3671UL, 0x6e6b06e7UL, 0xfed41b76UL, 0x89d32be0UL, 0x10da7a5aUL,
|
||||
0x67dd4accUL, 0xf9b9df6fUL, 0x8ebeeff9UL, 0x17b7be43UL, 0x60b08ed5UL,
|
||||
0xd6d6a3e8UL, 0xa1d1937eUL, 0x38d8c2c4UL, 0x4fdff252UL, 0xd1bb67f1UL,
|
||||
0xa6bc5767UL, 0x3fb506ddUL, 0x48b2364bUL, 0xd80d2bdaUL, 0xaf0a1b4cUL,
|
||||
0x36034af6UL, 0x41047a60UL, 0xdf60efc3UL, 0xa867df55UL, 0x316e8eefUL,
|
||||
0x4669be79UL, 0xcb61b38cUL, 0xbc66831aUL, 0x256fd2a0UL, 0x5268e236UL,
|
||||
0xcc0c7795UL, 0xbb0b4703UL, 0x220216b9UL, 0x5505262fUL, 0xc5ba3bbeUL,
|
||||
0xb2bd0b28UL, 0x2bb45a92UL, 0x5cb36a04UL, 0xc2d7ffa7UL, 0xb5d0cf31UL,
|
||||
0x2cd99e8bUL, 0x5bdeae1dUL, 0x9b64c2b0UL, 0xec63f226UL, 0x756aa39cUL,
|
||||
0x026d930aUL, 0x9c0906a9UL, 0xeb0e363fUL, 0x72076785UL, 0x05005713UL,
|
||||
0x95bf4a82UL, 0xe2b87a14UL, 0x7bb12baeUL, 0x0cb61b38UL, 0x92d28e9bUL,
|
||||
0xe5d5be0dUL, 0x7cdcefb7UL, 0x0bdbdf21UL, 0x86d3d2d4UL, 0xf1d4e242UL,
|
||||
0x68ddb3f8UL, 0x1fda836eUL, 0x81be16cdUL, 0xf6b9265bUL, 0x6fb077e1UL,
|
||||
0x18b74777UL, 0x88085ae6UL, 0xff0f6a70UL, 0x66063bcaUL, 0x11010b5cUL,
|
||||
0x8f659effUL, 0xf862ae69UL, 0x616bffd3UL, 0x166ccf45UL, 0xa00ae278UL,
|
||||
0xd70dd2eeUL, 0x4e048354UL, 0x3903b3c2UL, 0xa7672661UL, 0xd06016f7UL,
|
||||
0x4969474dUL, 0x3e6e77dbUL, 0xaed16a4aUL, 0xd9d65adcUL, 0x40df0b66UL,
|
||||
0x37d83bf0UL, 0xa9bcae53UL, 0xdebb9ec5UL, 0x47b2cf7fUL, 0x30b5ffe9UL,
|
||||
0xbdbdf21cUL, 0xcabac28aUL, 0x53b39330UL, 0x24b4a3a6UL, 0xbad03605UL,
|
||||
0xcdd70693UL, 0x54de5729UL, 0x23d967bfUL, 0xb3667a2eUL, 0xc4614ab8UL,
|
||||
0x5d681b02UL, 0x2a6f2b94UL, 0xb40bbe37UL, 0xc30c8ea1UL, 0x5a05df1bUL,
|
||||
0x2d02ef8dUL
|
||||
#ifdef BYFOUR
|
||||
},
|
||||
{
|
||||
0x00000000UL, 0x191b3141UL, 0x32366282UL, 0x2b2d53c3UL, 0x646cc504UL,
|
||||
0x7d77f445UL, 0x565aa786UL, 0x4f4196c7UL, 0xc8d98a08UL, 0xd1c2bb49UL,
|
||||
0xfaefe88aUL, 0xe3f4d9cbUL, 0xacb54f0cUL, 0xb5ae7e4dUL, 0x9e832d8eUL,
|
||||
0x87981ccfUL, 0x4ac21251UL, 0x53d92310UL, 0x78f470d3UL, 0x61ef4192UL,
|
||||
0x2eaed755UL, 0x37b5e614UL, 0x1c98b5d7UL, 0x05838496UL, 0x821b9859UL,
|
||||
0x9b00a918UL, 0xb02dfadbUL, 0xa936cb9aUL, 0xe6775d5dUL, 0xff6c6c1cUL,
|
||||
0xd4413fdfUL, 0xcd5a0e9eUL, 0x958424a2UL, 0x8c9f15e3UL, 0xa7b24620UL,
|
||||
0xbea97761UL, 0xf1e8e1a6UL, 0xe8f3d0e7UL, 0xc3de8324UL, 0xdac5b265UL,
|
||||
0x5d5daeaaUL, 0x44469febUL, 0x6f6bcc28UL, 0x7670fd69UL, 0x39316baeUL,
|
||||
0x202a5aefUL, 0x0b07092cUL, 0x121c386dUL, 0xdf4636f3UL, 0xc65d07b2UL,
|
||||
0xed705471UL, 0xf46b6530UL, 0xbb2af3f7UL, 0xa231c2b6UL, 0x891c9175UL,
|
||||
0x9007a034UL, 0x179fbcfbUL, 0x0e848dbaUL, 0x25a9de79UL, 0x3cb2ef38UL,
|
||||
0x73f379ffUL, 0x6ae848beUL, 0x41c51b7dUL, 0x58de2a3cUL, 0xf0794f05UL,
|
||||
0xe9627e44UL, 0xc24f2d87UL, 0xdb541cc6UL, 0x94158a01UL, 0x8d0ebb40UL,
|
||||
0xa623e883UL, 0xbf38d9c2UL, 0x38a0c50dUL, 0x21bbf44cUL, 0x0a96a78fUL,
|
||||
0x138d96ceUL, 0x5ccc0009UL, 0x45d73148UL, 0x6efa628bUL, 0x77e153caUL,
|
||||
0xbabb5d54UL, 0xa3a06c15UL, 0x888d3fd6UL, 0x91960e97UL, 0xded79850UL,
|
||||
0xc7cca911UL, 0xece1fad2UL, 0xf5facb93UL, 0x7262d75cUL, 0x6b79e61dUL,
|
||||
0x4054b5deUL, 0x594f849fUL, 0x160e1258UL, 0x0f152319UL, 0x243870daUL,
|
||||
0x3d23419bUL, 0x65fd6ba7UL, 0x7ce65ae6UL, 0x57cb0925UL, 0x4ed03864UL,
|
||||
0x0191aea3UL, 0x188a9fe2UL, 0x33a7cc21UL, 0x2abcfd60UL, 0xad24e1afUL,
|
||||
0xb43fd0eeUL, 0x9f12832dUL, 0x8609b26cUL, 0xc94824abUL, 0xd05315eaUL,
|
||||
0xfb7e4629UL, 0xe2657768UL, 0x2f3f79f6UL, 0x362448b7UL, 0x1d091b74UL,
|
||||
0x04122a35UL, 0x4b53bcf2UL, 0x52488db3UL, 0x7965de70UL, 0x607eef31UL,
|
||||
0xe7e6f3feUL, 0xfefdc2bfUL, 0xd5d0917cUL, 0xcccba03dUL, 0x838a36faUL,
|
||||
0x9a9107bbUL, 0xb1bc5478UL, 0xa8a76539UL, 0x3b83984bUL, 0x2298a90aUL,
|
||||
0x09b5fac9UL, 0x10aecb88UL, 0x5fef5d4fUL, 0x46f46c0eUL, 0x6dd93fcdUL,
|
||||
0x74c20e8cUL, 0xf35a1243UL, 0xea412302UL, 0xc16c70c1UL, 0xd8774180UL,
|
||||
0x9736d747UL, 0x8e2de606UL, 0xa500b5c5UL, 0xbc1b8484UL, 0x71418a1aUL,
|
||||
0x685abb5bUL, 0x4377e898UL, 0x5a6cd9d9UL, 0x152d4f1eUL, 0x0c367e5fUL,
|
||||
0x271b2d9cUL, 0x3e001cddUL, 0xb9980012UL, 0xa0833153UL, 0x8bae6290UL,
|
||||
0x92b553d1UL, 0xddf4c516UL, 0xc4eff457UL, 0xefc2a794UL, 0xf6d996d5UL,
|
||||
0xae07bce9UL, 0xb71c8da8UL, 0x9c31de6bUL, 0x852aef2aUL, 0xca6b79edUL,
|
||||
0xd37048acUL, 0xf85d1b6fUL, 0xe1462a2eUL, 0x66de36e1UL, 0x7fc507a0UL,
|
||||
0x54e85463UL, 0x4df36522UL, 0x02b2f3e5UL, 0x1ba9c2a4UL, 0x30849167UL,
|
||||
0x299fa026UL, 0xe4c5aeb8UL, 0xfdde9ff9UL, 0xd6f3cc3aUL, 0xcfe8fd7bUL,
|
||||
0x80a96bbcUL, 0x99b25afdUL, 0xb29f093eUL, 0xab84387fUL, 0x2c1c24b0UL,
|
||||
0x350715f1UL, 0x1e2a4632UL, 0x07317773UL, 0x4870e1b4UL, 0x516bd0f5UL,
|
||||
0x7a468336UL, 0x635db277UL, 0xcbfad74eUL, 0xd2e1e60fUL, 0xf9ccb5ccUL,
|
||||
0xe0d7848dUL, 0xaf96124aUL, 0xb68d230bUL, 0x9da070c8UL, 0x84bb4189UL,
|
||||
0x03235d46UL, 0x1a386c07UL, 0x31153fc4UL, 0x280e0e85UL, 0x674f9842UL,
|
||||
0x7e54a903UL, 0x5579fac0UL, 0x4c62cb81UL, 0x8138c51fUL, 0x9823f45eUL,
|
||||
0xb30ea79dUL, 0xaa1596dcUL, 0xe554001bUL, 0xfc4f315aUL, 0xd7626299UL,
|
||||
0xce7953d8UL, 0x49e14f17UL, 0x50fa7e56UL, 0x7bd72d95UL, 0x62cc1cd4UL,
|
||||
0x2d8d8a13UL, 0x3496bb52UL, 0x1fbbe891UL, 0x06a0d9d0UL, 0x5e7ef3ecUL,
|
||||
0x4765c2adUL, 0x6c48916eUL, 0x7553a02fUL, 0x3a1236e8UL, 0x230907a9UL,
|
||||
0x0824546aUL, 0x113f652bUL, 0x96a779e4UL, 0x8fbc48a5UL, 0xa4911b66UL,
|
||||
0xbd8a2a27UL, 0xf2cbbce0UL, 0xebd08da1UL, 0xc0fdde62UL, 0xd9e6ef23UL,
|
||||
0x14bce1bdUL, 0x0da7d0fcUL, 0x268a833fUL, 0x3f91b27eUL, 0x70d024b9UL,
|
||||
0x69cb15f8UL, 0x42e6463bUL, 0x5bfd777aUL, 0xdc656bb5UL, 0xc57e5af4UL,
|
||||
0xee530937UL, 0xf7483876UL, 0xb809aeb1UL, 0xa1129ff0UL, 0x8a3fcc33UL,
|
||||
0x9324fd72UL
|
||||
},
|
||||
{
|
||||
0x00000000UL, 0x01c26a37UL, 0x0384d46eUL, 0x0246be59UL, 0x0709a8dcUL,
|
||||
0x06cbc2ebUL, 0x048d7cb2UL, 0x054f1685UL, 0x0e1351b8UL, 0x0fd13b8fUL,
|
||||
0x0d9785d6UL, 0x0c55efe1UL, 0x091af964UL, 0x08d89353UL, 0x0a9e2d0aUL,
|
||||
0x0b5c473dUL, 0x1c26a370UL, 0x1de4c947UL, 0x1fa2771eUL, 0x1e601d29UL,
|
||||
0x1b2f0bacUL, 0x1aed619bUL, 0x18abdfc2UL, 0x1969b5f5UL, 0x1235f2c8UL,
|
||||
0x13f798ffUL, 0x11b126a6UL, 0x10734c91UL, 0x153c5a14UL, 0x14fe3023UL,
|
||||
0x16b88e7aUL, 0x177ae44dUL, 0x384d46e0UL, 0x398f2cd7UL, 0x3bc9928eUL,
|
||||
0x3a0bf8b9UL, 0x3f44ee3cUL, 0x3e86840bUL, 0x3cc03a52UL, 0x3d025065UL,
|
||||
0x365e1758UL, 0x379c7d6fUL, 0x35dac336UL, 0x3418a901UL, 0x3157bf84UL,
|
||||
0x3095d5b3UL, 0x32d36beaUL, 0x331101ddUL, 0x246be590UL, 0x25a98fa7UL,
|
||||
0x27ef31feUL, 0x262d5bc9UL, 0x23624d4cUL, 0x22a0277bUL, 0x20e69922UL,
|
||||
0x2124f315UL, 0x2a78b428UL, 0x2bbade1fUL, 0x29fc6046UL, 0x283e0a71UL,
|
||||
0x2d711cf4UL, 0x2cb376c3UL, 0x2ef5c89aUL, 0x2f37a2adUL, 0x709a8dc0UL,
|
||||
0x7158e7f7UL, 0x731e59aeUL, 0x72dc3399UL, 0x7793251cUL, 0x76514f2bUL,
|
||||
0x7417f172UL, 0x75d59b45UL, 0x7e89dc78UL, 0x7f4bb64fUL, 0x7d0d0816UL,
|
||||
0x7ccf6221UL, 0x798074a4UL, 0x78421e93UL, 0x7a04a0caUL, 0x7bc6cafdUL,
|
||||
0x6cbc2eb0UL, 0x6d7e4487UL, 0x6f38fadeUL, 0x6efa90e9UL, 0x6bb5866cUL,
|
||||
0x6a77ec5bUL, 0x68315202UL, 0x69f33835UL, 0x62af7f08UL, 0x636d153fUL,
|
||||
0x612bab66UL, 0x60e9c151UL, 0x65a6d7d4UL, 0x6464bde3UL, 0x662203baUL,
|
||||
0x67e0698dUL, 0x48d7cb20UL, 0x4915a117UL, 0x4b531f4eUL, 0x4a917579UL,
|
||||
0x4fde63fcUL, 0x4e1c09cbUL, 0x4c5ab792UL, 0x4d98dda5UL, 0x46c49a98UL,
|
||||
0x4706f0afUL, 0x45404ef6UL, 0x448224c1UL, 0x41cd3244UL, 0x400f5873UL,
|
||||
0x4249e62aUL, 0x438b8c1dUL, 0x54f16850UL, 0x55330267UL, 0x5775bc3eUL,
|
||||
0x56b7d609UL, 0x53f8c08cUL, 0x523aaabbUL, 0x507c14e2UL, 0x51be7ed5UL,
|
||||
0x5ae239e8UL, 0x5b2053dfUL, 0x5966ed86UL, 0x58a487b1UL, 0x5deb9134UL,
|
||||
0x5c29fb03UL, 0x5e6f455aUL, 0x5fad2f6dUL, 0xe1351b80UL, 0xe0f771b7UL,
|
||||
0xe2b1cfeeUL, 0xe373a5d9UL, 0xe63cb35cUL, 0xe7fed96bUL, 0xe5b86732UL,
|
||||
0xe47a0d05UL, 0xef264a38UL, 0xeee4200fUL, 0xeca29e56UL, 0xed60f461UL,
|
||||
0xe82fe2e4UL, 0xe9ed88d3UL, 0xebab368aUL, 0xea695cbdUL, 0xfd13b8f0UL,
|
||||
0xfcd1d2c7UL, 0xfe976c9eUL, 0xff5506a9UL, 0xfa1a102cUL, 0xfbd87a1bUL,
|
||||
0xf99ec442UL, 0xf85cae75UL, 0xf300e948UL, 0xf2c2837fUL, 0xf0843d26UL,
|
||||
0xf1465711UL, 0xf4094194UL, 0xf5cb2ba3UL, 0xf78d95faUL, 0xf64fffcdUL,
|
||||
0xd9785d60UL, 0xd8ba3757UL, 0xdafc890eUL, 0xdb3ee339UL, 0xde71f5bcUL,
|
||||
0xdfb39f8bUL, 0xddf521d2UL, 0xdc374be5UL, 0xd76b0cd8UL, 0xd6a966efUL,
|
||||
0xd4efd8b6UL, 0xd52db281UL, 0xd062a404UL, 0xd1a0ce33UL, 0xd3e6706aUL,
|
||||
0xd2241a5dUL, 0xc55efe10UL, 0xc49c9427UL, 0xc6da2a7eUL, 0xc7184049UL,
|
||||
0xc25756ccUL, 0xc3953cfbUL, 0xc1d382a2UL, 0xc011e895UL, 0xcb4dafa8UL,
|
||||
0xca8fc59fUL, 0xc8c97bc6UL, 0xc90b11f1UL, 0xcc440774UL, 0xcd866d43UL,
|
||||
0xcfc0d31aUL, 0xce02b92dUL, 0x91af9640UL, 0x906dfc77UL, 0x922b422eUL,
|
||||
0x93e92819UL, 0x96a63e9cUL, 0x976454abUL, 0x9522eaf2UL, 0x94e080c5UL,
|
||||
0x9fbcc7f8UL, 0x9e7eadcfUL, 0x9c381396UL, 0x9dfa79a1UL, 0x98b56f24UL,
|
||||
0x99770513UL, 0x9b31bb4aUL, 0x9af3d17dUL, 0x8d893530UL, 0x8c4b5f07UL,
|
||||
0x8e0de15eUL, 0x8fcf8b69UL, 0x8a809decUL, 0x8b42f7dbUL, 0x89044982UL,
|
||||
0x88c623b5UL, 0x839a6488UL, 0x82580ebfUL, 0x801eb0e6UL, 0x81dcdad1UL,
|
||||
0x8493cc54UL, 0x8551a663UL, 0x8717183aUL, 0x86d5720dUL, 0xa9e2d0a0UL,
|
||||
0xa820ba97UL, 0xaa6604ceUL, 0xaba46ef9UL, 0xaeeb787cUL, 0xaf29124bUL,
|
||||
0xad6fac12UL, 0xacadc625UL, 0xa7f18118UL, 0xa633eb2fUL, 0xa4755576UL,
|
||||
0xa5b73f41UL, 0xa0f829c4UL, 0xa13a43f3UL, 0xa37cfdaaUL, 0xa2be979dUL,
|
||||
0xb5c473d0UL, 0xb40619e7UL, 0xb640a7beUL, 0xb782cd89UL, 0xb2cddb0cUL,
|
||||
0xb30fb13bUL, 0xb1490f62UL, 0xb08b6555UL, 0xbbd72268UL, 0xba15485fUL,
|
||||
0xb853f606UL, 0xb9919c31UL, 0xbcde8ab4UL, 0xbd1ce083UL, 0xbf5a5edaUL,
|
||||
0xbe9834edUL
|
||||
},
|
||||
{
|
||||
0x00000000UL, 0xb8bc6765UL, 0xaa09c88bUL, 0x12b5afeeUL, 0x8f629757UL,
|
||||
0x37def032UL, 0x256b5fdcUL, 0x9dd738b9UL, 0xc5b428efUL, 0x7d084f8aUL,
|
||||
0x6fbde064UL, 0xd7018701UL, 0x4ad6bfb8UL, 0xf26ad8ddUL, 0xe0df7733UL,
|
||||
0x58631056UL, 0x5019579fUL, 0xe8a530faUL, 0xfa109f14UL, 0x42acf871UL,
|
||||
0xdf7bc0c8UL, 0x67c7a7adUL, 0x75720843UL, 0xcdce6f26UL, 0x95ad7f70UL,
|
||||
0x2d111815UL, 0x3fa4b7fbUL, 0x8718d09eUL, 0x1acfe827UL, 0xa2738f42UL,
|
||||
0xb0c620acUL, 0x087a47c9UL, 0xa032af3eUL, 0x188ec85bUL, 0x0a3b67b5UL,
|
||||
0xb28700d0UL, 0x2f503869UL, 0x97ec5f0cUL, 0x8559f0e2UL, 0x3de59787UL,
|
||||
0x658687d1UL, 0xdd3ae0b4UL, 0xcf8f4f5aUL, 0x7733283fUL, 0xeae41086UL,
|
||||
0x525877e3UL, 0x40edd80dUL, 0xf851bf68UL, 0xf02bf8a1UL, 0x48979fc4UL,
|
||||
0x5a22302aUL, 0xe29e574fUL, 0x7f496ff6UL, 0xc7f50893UL, 0xd540a77dUL,
|
||||
0x6dfcc018UL, 0x359fd04eUL, 0x8d23b72bUL, 0x9f9618c5UL, 0x272a7fa0UL,
|
||||
0xbafd4719UL, 0x0241207cUL, 0x10f48f92UL, 0xa848e8f7UL, 0x9b14583dUL,
|
||||
0x23a83f58UL, 0x311d90b6UL, 0x89a1f7d3UL, 0x1476cf6aUL, 0xaccaa80fUL,
|
||||
0xbe7f07e1UL, 0x06c36084UL, 0x5ea070d2UL, 0xe61c17b7UL, 0xf4a9b859UL,
|
||||
0x4c15df3cUL, 0xd1c2e785UL, 0x697e80e0UL, 0x7bcb2f0eUL, 0xc377486bUL,
|
||||
0xcb0d0fa2UL, 0x73b168c7UL, 0x6104c729UL, 0xd9b8a04cUL, 0x446f98f5UL,
|
||||
0xfcd3ff90UL, 0xee66507eUL, 0x56da371bUL, 0x0eb9274dUL, 0xb6054028UL,
|
||||
0xa4b0efc6UL, 0x1c0c88a3UL, 0x81dbb01aUL, 0x3967d77fUL, 0x2bd27891UL,
|
||||
0x936e1ff4UL, 0x3b26f703UL, 0x839a9066UL, 0x912f3f88UL, 0x299358edUL,
|
||||
0xb4446054UL, 0x0cf80731UL, 0x1e4da8dfUL, 0xa6f1cfbaUL, 0xfe92dfecUL,
|
||||
0x462eb889UL, 0x549b1767UL, 0xec277002UL, 0x71f048bbUL, 0xc94c2fdeUL,
|
||||
0xdbf98030UL, 0x6345e755UL, 0x6b3fa09cUL, 0xd383c7f9UL, 0xc1366817UL,
|
||||
0x798a0f72UL, 0xe45d37cbUL, 0x5ce150aeUL, 0x4e54ff40UL, 0xf6e89825UL,
|
||||
0xae8b8873UL, 0x1637ef16UL, 0x048240f8UL, 0xbc3e279dUL, 0x21e91f24UL,
|
||||
0x99557841UL, 0x8be0d7afUL, 0x335cb0caUL, 0xed59b63bUL, 0x55e5d15eUL,
|
||||
0x47507eb0UL, 0xffec19d5UL, 0x623b216cUL, 0xda874609UL, 0xc832e9e7UL,
|
||||
0x708e8e82UL, 0x28ed9ed4UL, 0x9051f9b1UL, 0x82e4565fUL, 0x3a58313aUL,
|
||||
0xa78f0983UL, 0x1f336ee6UL, 0x0d86c108UL, 0xb53aa66dUL, 0xbd40e1a4UL,
|
||||
0x05fc86c1UL, 0x1749292fUL, 0xaff54e4aUL, 0x322276f3UL, 0x8a9e1196UL,
|
||||
0x982bbe78UL, 0x2097d91dUL, 0x78f4c94bUL, 0xc048ae2eUL, 0xd2fd01c0UL,
|
||||
0x6a4166a5UL, 0xf7965e1cUL, 0x4f2a3979UL, 0x5d9f9697UL, 0xe523f1f2UL,
|
||||
0x4d6b1905UL, 0xf5d77e60UL, 0xe762d18eUL, 0x5fdeb6ebUL, 0xc2098e52UL,
|
||||
0x7ab5e937UL, 0x680046d9UL, 0xd0bc21bcUL, 0x88df31eaUL, 0x3063568fUL,
|
||||
0x22d6f961UL, 0x9a6a9e04UL, 0x07bda6bdUL, 0xbf01c1d8UL, 0xadb46e36UL,
|
||||
0x15080953UL, 0x1d724e9aUL, 0xa5ce29ffUL, 0xb77b8611UL, 0x0fc7e174UL,
|
||||
0x9210d9cdUL, 0x2aacbea8UL, 0x38191146UL, 0x80a57623UL, 0xd8c66675UL,
|
||||
0x607a0110UL, 0x72cfaefeUL, 0xca73c99bUL, 0x57a4f122UL, 0xef189647UL,
|
||||
0xfdad39a9UL, 0x45115eccUL, 0x764dee06UL, 0xcef18963UL, 0xdc44268dUL,
|
||||
0x64f841e8UL, 0xf92f7951UL, 0x41931e34UL, 0x5326b1daUL, 0xeb9ad6bfUL,
|
||||
0xb3f9c6e9UL, 0x0b45a18cUL, 0x19f00e62UL, 0xa14c6907UL, 0x3c9b51beUL,
|
||||
0x842736dbUL, 0x96929935UL, 0x2e2efe50UL, 0x2654b999UL, 0x9ee8defcUL,
|
||||
0x8c5d7112UL, 0x34e11677UL, 0xa9362eceUL, 0x118a49abUL, 0x033fe645UL,
|
||||
0xbb838120UL, 0xe3e09176UL, 0x5b5cf613UL, 0x49e959fdUL, 0xf1553e98UL,
|
||||
0x6c820621UL, 0xd43e6144UL, 0xc68bceaaUL, 0x7e37a9cfUL, 0xd67f4138UL,
|
||||
0x6ec3265dUL, 0x7c7689b3UL, 0xc4caeed6UL, 0x591dd66fUL, 0xe1a1b10aUL,
|
||||
0xf3141ee4UL, 0x4ba87981UL, 0x13cb69d7UL, 0xab770eb2UL, 0xb9c2a15cUL,
|
||||
0x017ec639UL, 0x9ca9fe80UL, 0x241599e5UL, 0x36a0360bUL, 0x8e1c516eUL,
|
||||
0x866616a7UL, 0x3eda71c2UL, 0x2c6fde2cUL, 0x94d3b949UL, 0x090481f0UL,
|
||||
0xb1b8e695UL, 0xa30d497bUL, 0x1bb12e1eUL, 0x43d23e48UL, 0xfb6e592dUL,
|
||||
0xe9dbf6c3UL, 0x516791a6UL, 0xccb0a91fUL, 0x740cce7aUL, 0x66b96194UL,
|
||||
0xde0506f1UL
|
||||
},
|
||||
{
|
||||
0x00000000UL, 0x96300777UL, 0x2c610eeeUL, 0xba510999UL, 0x19c46d07UL,
|
||||
0x8ff46a70UL, 0x35a563e9UL, 0xa395649eUL, 0x3288db0eUL, 0xa4b8dc79UL,
|
||||
0x1ee9d5e0UL, 0x88d9d297UL, 0x2b4cb609UL, 0xbd7cb17eUL, 0x072db8e7UL,
|
||||
0x911dbf90UL, 0x6410b71dUL, 0xf220b06aUL, 0x4871b9f3UL, 0xde41be84UL,
|
||||
0x7dd4da1aUL, 0xebe4dd6dUL, 0x51b5d4f4UL, 0xc785d383UL, 0x56986c13UL,
|
||||
0xc0a86b64UL, 0x7af962fdUL, 0xecc9658aUL, 0x4f5c0114UL, 0xd96c0663UL,
|
||||
0x633d0ffaUL, 0xf50d088dUL, 0xc8206e3bUL, 0x5e10694cUL, 0xe44160d5UL,
|
||||
0x727167a2UL, 0xd1e4033cUL, 0x47d4044bUL, 0xfd850dd2UL, 0x6bb50aa5UL,
|
||||
0xfaa8b535UL, 0x6c98b242UL, 0xd6c9bbdbUL, 0x40f9bcacUL, 0xe36cd832UL,
|
||||
0x755cdf45UL, 0xcf0dd6dcUL, 0x593dd1abUL, 0xac30d926UL, 0x3a00de51UL,
|
||||
0x8051d7c8UL, 0x1661d0bfUL, 0xb5f4b421UL, 0x23c4b356UL, 0x9995bacfUL,
|
||||
0x0fa5bdb8UL, 0x9eb80228UL, 0x0888055fUL, 0xb2d90cc6UL, 0x24e90bb1UL,
|
||||
0x877c6f2fUL, 0x114c6858UL, 0xab1d61c1UL, 0x3d2d66b6UL, 0x9041dc76UL,
|
||||
0x0671db01UL, 0xbc20d298UL, 0x2a10d5efUL, 0x8985b171UL, 0x1fb5b606UL,
|
||||
0xa5e4bf9fUL, 0x33d4b8e8UL, 0xa2c90778UL, 0x34f9000fUL, 0x8ea80996UL,
|
||||
0x18980ee1UL, 0xbb0d6a7fUL, 0x2d3d6d08UL, 0x976c6491UL, 0x015c63e6UL,
|
||||
0xf4516b6bUL, 0x62616c1cUL, 0xd8306585UL, 0x4e0062f2UL, 0xed95066cUL,
|
||||
0x7ba5011bUL, 0xc1f40882UL, 0x57c40ff5UL, 0xc6d9b065UL, 0x50e9b712UL,
|
||||
0xeab8be8bUL, 0x7c88b9fcUL, 0xdf1ddd62UL, 0x492dda15UL, 0xf37cd38cUL,
|
||||
0x654cd4fbUL, 0x5861b24dUL, 0xce51b53aUL, 0x7400bca3UL, 0xe230bbd4UL,
|
||||
0x41a5df4aUL, 0xd795d83dUL, 0x6dc4d1a4UL, 0xfbf4d6d3UL, 0x6ae96943UL,
|
||||
0xfcd96e34UL, 0x468867adUL, 0xd0b860daUL, 0x732d0444UL, 0xe51d0333UL,
|
||||
0x5f4c0aaaUL, 0xc97c0dddUL, 0x3c710550UL, 0xaa410227UL, 0x10100bbeUL,
|
||||
0x86200cc9UL, 0x25b56857UL, 0xb3856f20UL, 0x09d466b9UL, 0x9fe461ceUL,
|
||||
0x0ef9de5eUL, 0x98c9d929UL, 0x2298d0b0UL, 0xb4a8d7c7UL, 0x173db359UL,
|
||||
0x810db42eUL, 0x3b5cbdb7UL, 0xad6cbac0UL, 0x2083b8edUL, 0xb6b3bf9aUL,
|
||||
0x0ce2b603UL, 0x9ad2b174UL, 0x3947d5eaUL, 0xaf77d29dUL, 0x1526db04UL,
|
||||
0x8316dc73UL, 0x120b63e3UL, 0x843b6494UL, 0x3e6a6d0dUL, 0xa85a6a7aUL,
|
||||
0x0bcf0ee4UL, 0x9dff0993UL, 0x27ae000aUL, 0xb19e077dUL, 0x44930ff0UL,
|
||||
0xd2a30887UL, 0x68f2011eUL, 0xfec20669UL, 0x5d5762f7UL, 0xcb676580UL,
|
||||
0x71366c19UL, 0xe7066b6eUL, 0x761bd4feUL, 0xe02bd389UL, 0x5a7ada10UL,
|
||||
0xcc4add67UL, 0x6fdfb9f9UL, 0xf9efbe8eUL, 0x43beb717UL, 0xd58eb060UL,
|
||||
0xe8a3d6d6UL, 0x7e93d1a1UL, 0xc4c2d838UL, 0x52f2df4fUL, 0xf167bbd1UL,
|
||||
0x6757bca6UL, 0xdd06b53fUL, 0x4b36b248UL, 0xda2b0dd8UL, 0x4c1b0aafUL,
|
||||
0xf64a0336UL, 0x607a0441UL, 0xc3ef60dfUL, 0x55df67a8UL, 0xef8e6e31UL,
|
||||
0x79be6946UL, 0x8cb361cbUL, 0x1a8366bcUL, 0xa0d26f25UL, 0x36e26852UL,
|
||||
0x95770cccUL, 0x03470bbbUL, 0xb9160222UL, 0x2f260555UL, 0xbe3bbac5UL,
|
||||
0x280bbdb2UL, 0x925ab42bUL, 0x046ab35cUL, 0xa7ffd7c2UL, 0x31cfd0b5UL,
|
||||
0x8b9ed92cUL, 0x1daede5bUL, 0xb0c2649bUL, 0x26f263ecUL, 0x9ca36a75UL,
|
||||
0x0a936d02UL, 0xa906099cUL, 0x3f360eebUL, 0x85670772UL, 0x13570005UL,
|
||||
0x824abf95UL, 0x147ab8e2UL, 0xae2bb17bUL, 0x381bb60cUL, 0x9b8ed292UL,
|
||||
0x0dbed5e5UL, 0xb7efdc7cUL, 0x21dfdb0bUL, 0xd4d2d386UL, 0x42e2d4f1UL,
|
||||
0xf8b3dd68UL, 0x6e83da1fUL, 0xcd16be81UL, 0x5b26b9f6UL, 0xe177b06fUL,
|
||||
0x7747b718UL, 0xe65a0888UL, 0x706a0fffUL, 0xca3b0666UL, 0x5c0b0111UL,
|
||||
0xff9e658fUL, 0x69ae62f8UL, 0xd3ff6b61UL, 0x45cf6c16UL, 0x78e20aa0UL,
|
||||
0xeed20dd7UL, 0x5483044eUL, 0xc2b30339UL, 0x612667a7UL, 0xf71660d0UL,
|
||||
0x4d476949UL, 0xdb776e3eUL, 0x4a6ad1aeUL, 0xdc5ad6d9UL, 0x660bdf40UL,
|
||||
0xf03bd837UL, 0x53aebca9UL, 0xc59ebbdeUL, 0x7fcfb247UL, 0xe9ffb530UL,
|
||||
0x1cf2bdbdUL, 0x8ac2bacaUL, 0x3093b353UL, 0xa6a3b424UL, 0x0536d0baUL,
|
||||
0x9306d7cdUL, 0x2957de54UL, 0xbf67d923UL, 0x2e7a66b3UL, 0xb84a61c4UL,
|
||||
0x021b685dUL, 0x942b6f2aUL, 0x37be0bb4UL, 0xa18e0cc3UL, 0x1bdf055aUL,
|
||||
0x8def022dUL
|
||||
},
|
||||
{
|
||||
0x00000000UL, 0x41311b19UL, 0x82623632UL, 0xc3532d2bUL, 0x04c56c64UL,
|
||||
0x45f4777dUL, 0x86a75a56UL, 0xc796414fUL, 0x088ad9c8UL, 0x49bbc2d1UL,
|
||||
0x8ae8effaUL, 0xcbd9f4e3UL, 0x0c4fb5acUL, 0x4d7eaeb5UL, 0x8e2d839eUL,
|
||||
0xcf1c9887UL, 0x5112c24aUL, 0x1023d953UL, 0xd370f478UL, 0x9241ef61UL,
|
||||
0x55d7ae2eUL, 0x14e6b537UL, 0xd7b5981cUL, 0x96848305UL, 0x59981b82UL,
|
||||
0x18a9009bUL, 0xdbfa2db0UL, 0x9acb36a9UL, 0x5d5d77e6UL, 0x1c6c6cffUL,
|
||||
0xdf3f41d4UL, 0x9e0e5acdUL, 0xa2248495UL, 0xe3159f8cUL, 0x2046b2a7UL,
|
||||
0x6177a9beUL, 0xa6e1e8f1UL, 0xe7d0f3e8UL, 0x2483dec3UL, 0x65b2c5daUL,
|
||||
0xaaae5d5dUL, 0xeb9f4644UL, 0x28cc6b6fUL, 0x69fd7076UL, 0xae6b3139UL,
|
||||
0xef5a2a20UL, 0x2c09070bUL, 0x6d381c12UL, 0xf33646dfUL, 0xb2075dc6UL,
|
||||
0x715470edUL, 0x30656bf4UL, 0xf7f32abbUL, 0xb6c231a2UL, 0x75911c89UL,
|
||||
0x34a00790UL, 0xfbbc9f17UL, 0xba8d840eUL, 0x79dea925UL, 0x38efb23cUL,
|
||||
0xff79f373UL, 0xbe48e86aUL, 0x7d1bc541UL, 0x3c2ade58UL, 0x054f79f0UL,
|
||||
0x447e62e9UL, 0x872d4fc2UL, 0xc61c54dbUL, 0x018a1594UL, 0x40bb0e8dUL,
|
||||
0x83e823a6UL, 0xc2d938bfUL, 0x0dc5a038UL, 0x4cf4bb21UL, 0x8fa7960aUL,
|
||||
0xce968d13UL, 0x0900cc5cUL, 0x4831d745UL, 0x8b62fa6eUL, 0xca53e177UL,
|
||||
0x545dbbbaUL, 0x156ca0a3UL, 0xd63f8d88UL, 0x970e9691UL, 0x5098d7deUL,
|
||||
0x11a9ccc7UL, 0xd2fae1ecUL, 0x93cbfaf5UL, 0x5cd76272UL, 0x1de6796bUL,
|
||||
0xdeb55440UL, 0x9f844f59UL, 0x58120e16UL, 0x1923150fUL, 0xda703824UL,
|
||||
0x9b41233dUL, 0xa76bfd65UL, 0xe65ae67cUL, 0x2509cb57UL, 0x6438d04eUL,
|
||||
0xa3ae9101UL, 0xe29f8a18UL, 0x21cca733UL, 0x60fdbc2aUL, 0xafe124adUL,
|
||||
0xeed03fb4UL, 0x2d83129fUL, 0x6cb20986UL, 0xab2448c9UL, 0xea1553d0UL,
|
||||
0x29467efbUL, 0x687765e2UL, 0xf6793f2fUL, 0xb7482436UL, 0x741b091dUL,
|
||||
0x352a1204UL, 0xf2bc534bUL, 0xb38d4852UL, 0x70de6579UL, 0x31ef7e60UL,
|
||||
0xfef3e6e7UL, 0xbfc2fdfeUL, 0x7c91d0d5UL, 0x3da0cbccUL, 0xfa368a83UL,
|
||||
0xbb07919aUL, 0x7854bcb1UL, 0x3965a7a8UL, 0x4b98833bUL, 0x0aa99822UL,
|
||||
0xc9fab509UL, 0x88cbae10UL, 0x4f5def5fUL, 0x0e6cf446UL, 0xcd3fd96dUL,
|
||||
0x8c0ec274UL, 0x43125af3UL, 0x022341eaUL, 0xc1706cc1UL, 0x804177d8UL,
|
||||
0x47d73697UL, 0x06e62d8eUL, 0xc5b500a5UL, 0x84841bbcUL, 0x1a8a4171UL,
|
||||
0x5bbb5a68UL, 0x98e87743UL, 0xd9d96c5aUL, 0x1e4f2d15UL, 0x5f7e360cUL,
|
||||
0x9c2d1b27UL, 0xdd1c003eUL, 0x120098b9UL, 0x533183a0UL, 0x9062ae8bUL,
|
||||
0xd153b592UL, 0x16c5f4ddUL, 0x57f4efc4UL, 0x94a7c2efUL, 0xd596d9f6UL,
|
||||
0xe9bc07aeUL, 0xa88d1cb7UL, 0x6bde319cUL, 0x2aef2a85UL, 0xed796bcaUL,
|
||||
0xac4870d3UL, 0x6f1b5df8UL, 0x2e2a46e1UL, 0xe136de66UL, 0xa007c57fUL,
|
||||
0x6354e854UL, 0x2265f34dUL, 0xe5f3b202UL, 0xa4c2a91bUL, 0x67918430UL,
|
||||
0x26a09f29UL, 0xb8aec5e4UL, 0xf99fdefdUL, 0x3accf3d6UL, 0x7bfde8cfUL,
|
||||
0xbc6ba980UL, 0xfd5ab299UL, 0x3e099fb2UL, 0x7f3884abUL, 0xb0241c2cUL,
|
||||
0xf1150735UL, 0x32462a1eUL, 0x73773107UL, 0xb4e17048UL, 0xf5d06b51UL,
|
||||
0x3683467aUL, 0x77b25d63UL, 0x4ed7facbUL, 0x0fe6e1d2UL, 0xccb5ccf9UL,
|
||||
0x8d84d7e0UL, 0x4a1296afUL, 0x0b238db6UL, 0xc870a09dUL, 0x8941bb84UL,
|
||||
0x465d2303UL, 0x076c381aUL, 0xc43f1531UL, 0x850e0e28UL, 0x42984f67UL,
|
||||
0x03a9547eUL, 0xc0fa7955UL, 0x81cb624cUL, 0x1fc53881UL, 0x5ef42398UL,
|
||||
0x9da70eb3UL, 0xdc9615aaUL, 0x1b0054e5UL, 0x5a314ffcUL, 0x996262d7UL,
|
||||
0xd85379ceUL, 0x174fe149UL, 0x567efa50UL, 0x952dd77bUL, 0xd41ccc62UL,
|
||||
0x138a8d2dUL, 0x52bb9634UL, 0x91e8bb1fUL, 0xd0d9a006UL, 0xecf37e5eUL,
|
||||
0xadc26547UL, 0x6e91486cUL, 0x2fa05375UL, 0xe836123aUL, 0xa9070923UL,
|
||||
0x6a542408UL, 0x2b653f11UL, 0xe479a796UL, 0xa548bc8fUL, 0x661b91a4UL,
|
||||
0x272a8abdUL, 0xe0bccbf2UL, 0xa18dd0ebUL, 0x62defdc0UL, 0x23efe6d9UL,
|
||||
0xbde1bc14UL, 0xfcd0a70dUL, 0x3f838a26UL, 0x7eb2913fUL, 0xb924d070UL,
|
||||
0xf815cb69UL, 0x3b46e642UL, 0x7a77fd5bUL, 0xb56b65dcUL, 0xf45a7ec5UL,
|
||||
0x370953eeUL, 0x763848f7UL, 0xb1ae09b8UL, 0xf09f12a1UL, 0x33cc3f8aUL,
|
||||
0x72fd2493UL
|
||||
},
|
||||
{
|
||||
0x00000000UL, 0x376ac201UL, 0x6ed48403UL, 0x59be4602UL, 0xdca80907UL,
|
||||
0xebc2cb06UL, 0xb27c8d04UL, 0x85164f05UL, 0xb851130eUL, 0x8f3bd10fUL,
|
||||
0xd685970dUL, 0xe1ef550cUL, 0x64f91a09UL, 0x5393d808UL, 0x0a2d9e0aUL,
|
||||
0x3d475c0bUL, 0x70a3261cUL, 0x47c9e41dUL, 0x1e77a21fUL, 0x291d601eUL,
|
||||
0xac0b2f1bUL, 0x9b61ed1aUL, 0xc2dfab18UL, 0xf5b56919UL, 0xc8f23512UL,
|
||||
0xff98f713UL, 0xa626b111UL, 0x914c7310UL, 0x145a3c15UL, 0x2330fe14UL,
|
||||
0x7a8eb816UL, 0x4de47a17UL, 0xe0464d38UL, 0xd72c8f39UL, 0x8e92c93bUL,
|
||||
0xb9f80b3aUL, 0x3cee443fUL, 0x0b84863eUL, 0x523ac03cUL, 0x6550023dUL,
|
||||
0x58175e36UL, 0x6f7d9c37UL, 0x36c3da35UL, 0x01a91834UL, 0x84bf5731UL,
|
||||
0xb3d59530UL, 0xea6bd332UL, 0xdd011133UL, 0x90e56b24UL, 0xa78fa925UL,
|
||||
0xfe31ef27UL, 0xc95b2d26UL, 0x4c4d6223UL, 0x7b27a022UL, 0x2299e620UL,
|
||||
0x15f32421UL, 0x28b4782aUL, 0x1fdeba2bUL, 0x4660fc29UL, 0x710a3e28UL,
|
||||
0xf41c712dUL, 0xc376b32cUL, 0x9ac8f52eUL, 0xada2372fUL, 0xc08d9a70UL,
|
||||
0xf7e75871UL, 0xae591e73UL, 0x9933dc72UL, 0x1c259377UL, 0x2b4f5176UL,
|
||||
0x72f11774UL, 0x459bd575UL, 0x78dc897eUL, 0x4fb64b7fUL, 0x16080d7dUL,
|
||||
0x2162cf7cUL, 0xa4748079UL, 0x931e4278UL, 0xcaa0047aUL, 0xfdcac67bUL,
|
||||
0xb02ebc6cUL, 0x87447e6dUL, 0xdefa386fUL, 0xe990fa6eUL, 0x6c86b56bUL,
|
||||
0x5bec776aUL, 0x02523168UL, 0x3538f369UL, 0x087faf62UL, 0x3f156d63UL,
|
||||
0x66ab2b61UL, 0x51c1e960UL, 0xd4d7a665UL, 0xe3bd6464UL, 0xba032266UL,
|
||||
0x8d69e067UL, 0x20cbd748UL, 0x17a11549UL, 0x4e1f534bUL, 0x7975914aUL,
|
||||
0xfc63de4fUL, 0xcb091c4eUL, 0x92b75a4cUL, 0xa5dd984dUL, 0x989ac446UL,
|
||||
0xaff00647UL, 0xf64e4045UL, 0xc1248244UL, 0x4432cd41UL, 0x73580f40UL,
|
||||
0x2ae64942UL, 0x1d8c8b43UL, 0x5068f154UL, 0x67023355UL, 0x3ebc7557UL,
|
||||
0x09d6b756UL, 0x8cc0f853UL, 0xbbaa3a52UL, 0xe2147c50UL, 0xd57ebe51UL,
|
||||
0xe839e25aUL, 0xdf53205bUL, 0x86ed6659UL, 0xb187a458UL, 0x3491eb5dUL,
|
||||
0x03fb295cUL, 0x5a456f5eUL, 0x6d2fad5fUL, 0x801b35e1UL, 0xb771f7e0UL,
|
||||
0xeecfb1e2UL, 0xd9a573e3UL, 0x5cb33ce6UL, 0x6bd9fee7UL, 0x3267b8e5UL,
|
||||
0x050d7ae4UL, 0x384a26efUL, 0x0f20e4eeUL, 0x569ea2ecUL, 0x61f460edUL,
|
||||
0xe4e22fe8UL, 0xd388ede9UL, 0x8a36abebUL, 0xbd5c69eaUL, 0xf0b813fdUL,
|
||||
0xc7d2d1fcUL, 0x9e6c97feUL, 0xa90655ffUL, 0x2c101afaUL, 0x1b7ad8fbUL,
|
||||
0x42c49ef9UL, 0x75ae5cf8UL, 0x48e900f3UL, 0x7f83c2f2UL, 0x263d84f0UL,
|
||||
0x115746f1UL, 0x944109f4UL, 0xa32bcbf5UL, 0xfa958df7UL, 0xcdff4ff6UL,
|
||||
0x605d78d9UL, 0x5737bad8UL, 0x0e89fcdaUL, 0x39e33edbUL, 0xbcf571deUL,
|
||||
0x8b9fb3dfUL, 0xd221f5ddUL, 0xe54b37dcUL, 0xd80c6bd7UL, 0xef66a9d6UL,
|
||||
0xb6d8efd4UL, 0x81b22dd5UL, 0x04a462d0UL, 0x33cea0d1UL, 0x6a70e6d3UL,
|
||||
0x5d1a24d2UL, 0x10fe5ec5UL, 0x27949cc4UL, 0x7e2adac6UL, 0x494018c7UL,
|
||||
0xcc5657c2UL, 0xfb3c95c3UL, 0xa282d3c1UL, 0x95e811c0UL, 0xa8af4dcbUL,
|
||||
0x9fc58fcaUL, 0xc67bc9c8UL, 0xf1110bc9UL, 0x740744ccUL, 0x436d86cdUL,
|
||||
0x1ad3c0cfUL, 0x2db902ceUL, 0x4096af91UL, 0x77fc6d90UL, 0x2e422b92UL,
|
||||
0x1928e993UL, 0x9c3ea696UL, 0xab546497UL, 0xf2ea2295UL, 0xc580e094UL,
|
||||
0xf8c7bc9fUL, 0xcfad7e9eUL, 0x9613389cUL, 0xa179fa9dUL, 0x246fb598UL,
|
||||
0x13057799UL, 0x4abb319bUL, 0x7dd1f39aUL, 0x3035898dUL, 0x075f4b8cUL,
|
||||
0x5ee10d8eUL, 0x698bcf8fUL, 0xec9d808aUL, 0xdbf7428bUL, 0x82490489UL,
|
||||
0xb523c688UL, 0x88649a83UL, 0xbf0e5882UL, 0xe6b01e80UL, 0xd1dadc81UL,
|
||||
0x54cc9384UL, 0x63a65185UL, 0x3a181787UL, 0x0d72d586UL, 0xa0d0e2a9UL,
|
||||
0x97ba20a8UL, 0xce0466aaUL, 0xf96ea4abUL, 0x7c78ebaeUL, 0x4b1229afUL,
|
||||
0x12ac6fadUL, 0x25c6adacUL, 0x1881f1a7UL, 0x2feb33a6UL, 0x765575a4UL,
|
||||
0x413fb7a5UL, 0xc429f8a0UL, 0xf3433aa1UL, 0xaafd7ca3UL, 0x9d97bea2UL,
|
||||
0xd073c4b5UL, 0xe71906b4UL, 0xbea740b6UL, 0x89cd82b7UL, 0x0cdbcdb2UL,
|
||||
0x3bb10fb3UL, 0x620f49b1UL, 0x55658bb0UL, 0x6822d7bbUL, 0x5f4815baUL,
|
||||
0x06f653b8UL, 0x319c91b9UL, 0xb48adebcUL, 0x83e01cbdUL, 0xda5e5abfUL,
|
||||
0xed3498beUL
|
||||
},
|
||||
{
|
||||
0x00000000UL, 0x6567bcb8UL, 0x8bc809aaUL, 0xeeafb512UL, 0x5797628fUL,
|
||||
0x32f0de37UL, 0xdc5f6b25UL, 0xb938d79dUL, 0xef28b4c5UL, 0x8a4f087dUL,
|
||||
0x64e0bd6fUL, 0x018701d7UL, 0xb8bfd64aUL, 0xddd86af2UL, 0x3377dfe0UL,
|
||||
0x56106358UL, 0x9f571950UL, 0xfa30a5e8UL, 0x149f10faUL, 0x71f8ac42UL,
|
||||
0xc8c07bdfUL, 0xada7c767UL, 0x43087275UL, 0x266fcecdUL, 0x707fad95UL,
|
||||
0x1518112dUL, 0xfbb7a43fUL, 0x9ed01887UL, 0x27e8cf1aUL, 0x428f73a2UL,
|
||||
0xac20c6b0UL, 0xc9477a08UL, 0x3eaf32a0UL, 0x5bc88e18UL, 0xb5673b0aUL,
|
||||
0xd00087b2UL, 0x6938502fUL, 0x0c5fec97UL, 0xe2f05985UL, 0x8797e53dUL,
|
||||
0xd1878665UL, 0xb4e03addUL, 0x5a4f8fcfUL, 0x3f283377UL, 0x8610e4eaUL,
|
||||
0xe3775852UL, 0x0dd8ed40UL, 0x68bf51f8UL, 0xa1f82bf0UL, 0xc49f9748UL,
|
||||
0x2a30225aUL, 0x4f579ee2UL, 0xf66f497fUL, 0x9308f5c7UL, 0x7da740d5UL,
|
||||
0x18c0fc6dUL, 0x4ed09f35UL, 0x2bb7238dUL, 0xc518969fUL, 0xa07f2a27UL,
|
||||
0x1947fdbaUL, 0x7c204102UL, 0x928ff410UL, 0xf7e848a8UL, 0x3d58149bUL,
|
||||
0x583fa823UL, 0xb6901d31UL, 0xd3f7a189UL, 0x6acf7614UL, 0x0fa8caacUL,
|
||||
0xe1077fbeUL, 0x8460c306UL, 0xd270a05eUL, 0xb7171ce6UL, 0x59b8a9f4UL,
|
||||
0x3cdf154cUL, 0x85e7c2d1UL, 0xe0807e69UL, 0x0e2fcb7bUL, 0x6b4877c3UL,
|
||||
0xa20f0dcbUL, 0xc768b173UL, 0x29c70461UL, 0x4ca0b8d9UL, 0xf5986f44UL,
|
||||
0x90ffd3fcUL, 0x7e5066eeUL, 0x1b37da56UL, 0x4d27b90eUL, 0x284005b6UL,
|
||||
0xc6efb0a4UL, 0xa3880c1cUL, 0x1ab0db81UL, 0x7fd76739UL, 0x9178d22bUL,
|
||||
0xf41f6e93UL, 0x03f7263bUL, 0x66909a83UL, 0x883f2f91UL, 0xed589329UL,
|
||||
0x546044b4UL, 0x3107f80cUL, 0xdfa84d1eUL, 0xbacff1a6UL, 0xecdf92feUL,
|
||||
0x89b82e46UL, 0x67179b54UL, 0x027027ecUL, 0xbb48f071UL, 0xde2f4cc9UL,
|
||||
0x3080f9dbUL, 0x55e74563UL, 0x9ca03f6bUL, 0xf9c783d3UL, 0x176836c1UL,
|
||||
0x720f8a79UL, 0xcb375de4UL, 0xae50e15cUL, 0x40ff544eUL, 0x2598e8f6UL,
|
||||
0x73888baeUL, 0x16ef3716UL, 0xf8408204UL, 0x9d273ebcUL, 0x241fe921UL,
|
||||
0x41785599UL, 0xafd7e08bUL, 0xcab05c33UL, 0x3bb659edUL, 0x5ed1e555UL,
|
||||
0xb07e5047UL, 0xd519ecffUL, 0x6c213b62UL, 0x094687daUL, 0xe7e932c8UL,
|
||||
0x828e8e70UL, 0xd49eed28UL, 0xb1f95190UL, 0x5f56e482UL, 0x3a31583aUL,
|
||||
0x83098fa7UL, 0xe66e331fUL, 0x08c1860dUL, 0x6da63ab5UL, 0xa4e140bdUL,
|
||||
0xc186fc05UL, 0x2f294917UL, 0x4a4ef5afUL, 0xf3762232UL, 0x96119e8aUL,
|
||||
0x78be2b98UL, 0x1dd99720UL, 0x4bc9f478UL, 0x2eae48c0UL, 0xc001fdd2UL,
|
||||
0xa566416aUL, 0x1c5e96f7UL, 0x79392a4fUL, 0x97969f5dUL, 0xf2f123e5UL,
|
||||
0x05196b4dUL, 0x607ed7f5UL, 0x8ed162e7UL, 0xebb6de5fUL, 0x528e09c2UL,
|
||||
0x37e9b57aUL, 0xd9460068UL, 0xbc21bcd0UL, 0xea31df88UL, 0x8f566330UL,
|
||||
0x61f9d622UL, 0x049e6a9aUL, 0xbda6bd07UL, 0xd8c101bfUL, 0x366eb4adUL,
|
||||
0x53090815UL, 0x9a4e721dUL, 0xff29cea5UL, 0x11867bb7UL, 0x74e1c70fUL,
|
||||
0xcdd91092UL, 0xa8beac2aUL, 0x46111938UL, 0x2376a580UL, 0x7566c6d8UL,
|
||||
0x10017a60UL, 0xfeaecf72UL, 0x9bc973caUL, 0x22f1a457UL, 0x479618efUL,
|
||||
0xa939adfdUL, 0xcc5e1145UL, 0x06ee4d76UL, 0x6389f1ceUL, 0x8d2644dcUL,
|
||||
0xe841f864UL, 0x51792ff9UL, 0x341e9341UL, 0xdab12653UL, 0xbfd69aebUL,
|
||||
0xe9c6f9b3UL, 0x8ca1450bUL, 0x620ef019UL, 0x07694ca1UL, 0xbe519b3cUL,
|
||||
0xdb362784UL, 0x35999296UL, 0x50fe2e2eUL, 0x99b95426UL, 0xfcdee89eUL,
|
||||
0x12715d8cUL, 0x7716e134UL, 0xce2e36a9UL, 0xab498a11UL, 0x45e63f03UL,
|
||||
0x208183bbUL, 0x7691e0e3UL, 0x13f65c5bUL, 0xfd59e949UL, 0x983e55f1UL,
|
||||
0x2106826cUL, 0x44613ed4UL, 0xaace8bc6UL, 0xcfa9377eUL, 0x38417fd6UL,
|
||||
0x5d26c36eUL, 0xb389767cUL, 0xd6eecac4UL, 0x6fd61d59UL, 0x0ab1a1e1UL,
|
||||
0xe41e14f3UL, 0x8179a84bUL, 0xd769cb13UL, 0xb20e77abUL, 0x5ca1c2b9UL,
|
||||
0x39c67e01UL, 0x80fea99cUL, 0xe5991524UL, 0x0b36a036UL, 0x6e511c8eUL,
|
||||
0xa7166686UL, 0xc271da3eUL, 0x2cde6f2cUL, 0x49b9d394UL, 0xf0810409UL,
|
||||
0x95e6b8b1UL, 0x7b490da3UL, 0x1e2eb11bUL, 0x483ed243UL, 0x2d596efbUL,
|
||||
0xc3f6dbe9UL, 0xa6916751UL, 0x1fa9b0ccUL, 0x7ace0c74UL, 0x9461b966UL,
|
||||
0xf10605deUL
|
||||
#endif
|
||||
}
|
||||
};
|
|
@ -1,331 +0,0 @@
|
|||
/* deflate.h -- internal compression state
|
||||
* Copyright (C) 1995-2004 Jean-loup Gailly
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* WARNING: this file should *not* be used by applications. It is
|
||||
part of the implementation of the compression library and is
|
||||
subject to change. Applications should only use zlib.h.
|
||||
*/
|
||||
|
||||
/* @(#) $Id: deflate.h,v 1.2 2006/03/02 00:10:34 zerocool Exp $ */
|
||||
|
||||
#ifndef DEFLATE_H
|
||||
#define DEFLATE_H
|
||||
|
||||
#include "zutil.h"
|
||||
|
||||
/* define NO_GZIP when compiling if you want to disable gzip header and
|
||||
trailer creation by deflate(). NO_GZIP would be used to avoid linking in
|
||||
the crc code when it is not needed. For shared libraries, gzip encoding
|
||||
should be left enabled. */
|
||||
#ifndef NO_GZIP
|
||||
# define GZIP
|
||||
#endif
|
||||
|
||||
/* ===========================================================================
|
||||
* Internal compression state.
|
||||
*/
|
||||
|
||||
#define LENGTH_CODES 29
|
||||
/* number of length codes, not counting the special END_BLOCK code */
|
||||
|
||||
#define LITERALS 256
|
||||
/* number of literal bytes 0..255 */
|
||||
|
||||
#define L_CODES (LITERALS+1+LENGTH_CODES)
|
||||
/* number of Literal or Length codes, including the END_BLOCK code */
|
||||
|
||||
#define D_CODES 30
|
||||
/* number of distance codes */
|
||||
|
||||
#define BL_CODES 19
|
||||
/* number of codes used to transfer the bit lengths */
|
||||
|
||||
#define HEAP_SIZE (2*L_CODES+1)
|
||||
/* maximum heap size */
|
||||
|
||||
#define MAX_BITS 15
|
||||
/* All codes must not exceed MAX_BITS bits */
|
||||
|
||||
#define INIT_STATE 42
|
||||
#define EXTRA_STATE 69
|
||||
#define NAME_STATE 73
|
||||
#define COMMENT_STATE 91
|
||||
#define HCRC_STATE 103
|
||||
#define BUSY_STATE 113
|
||||
#define FINISH_STATE 666
|
||||
/* Stream status */
|
||||
|
||||
|
||||
/* Data structure describing a single value and its code string. */
|
||||
typedef struct ct_data_s {
|
||||
union {
|
||||
ush freq; /* frequency count */
|
||||
ush code; /* bit string */
|
||||
} fc;
|
||||
union {
|
||||
ush dad; /* father node in Huffman tree */
|
||||
ush len; /* length of bit string */
|
||||
} dl;
|
||||
} FAR ct_data;
|
||||
|
||||
#define Freq fc.freq
|
||||
#define Code fc.code
|
||||
#define Dad dl.dad
|
||||
#define Len dl.len
|
||||
|
||||
typedef struct static_tree_desc_s static_tree_desc;
|
||||
|
||||
typedef struct tree_desc_s {
|
||||
ct_data *dyn_tree; /* the dynamic tree */
|
||||
int max_code; /* largest code with non zero frequency */
|
||||
static_tree_desc *stat_desc; /* the corresponding static tree */
|
||||
} FAR tree_desc;
|
||||
|
||||
typedef ush Pos;
|
||||
typedef Pos FAR Posf;
|
||||
typedef unsigned IPos;
|
||||
|
||||
/* A Pos is an index in the character window. We use short instead of int to
|
||||
* save space in the various tables. IPos is used only for parameter passing.
|
||||
*/
|
||||
|
||||
typedef struct internal_state {
|
||||
z_streamp strm; /* pointer back to this zlib stream */
|
||||
int status; /* as the name implies */
|
||||
Bytef *pending_buf; /* output still pending */
|
||||
ulg pending_buf_size; /* size of pending_buf */
|
||||
Bytef *pending_out; /* next pending byte to output to the stream */
|
||||
uInt pending; /* nb of bytes in the pending buffer */
|
||||
int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
|
||||
gz_headerp gzhead; /* gzip header information to write */
|
||||
uInt gzindex; /* where in extra, name, or comment */
|
||||
Byte method; /* STORED (for zip only) or DEFLATED */
|
||||
int last_flush; /* value of flush param for previous deflate call */
|
||||
|
||||
/* used by deflate.c: */
|
||||
|
||||
uInt w_size; /* LZ77 window size (32K by default) */
|
||||
uInt w_bits; /* log2(w_size) (8..16) */
|
||||
uInt w_mask; /* w_size - 1 */
|
||||
|
||||
Bytef *window;
|
||||
/* Sliding window. Input bytes are read into the second half of the window,
|
||||
* and move to the first half later to keep a dictionary of at least wSize
|
||||
* bytes. With this organization, matches are limited to a distance of
|
||||
* wSize-MAX_MATCH bytes, but this ensures that IO is always
|
||||
* performed with a length multiple of the block size. Also, it limits
|
||||
* the window size to 64K, which is quite useful on MSDOS.
|
||||
* To do: use the user input buffer as sliding window.
|
||||
*/
|
||||
|
||||
ulg window_size;
|
||||
/* Actual size of window: 2*wSize, except when the user input buffer
|
||||
* is directly used as sliding window.
|
||||
*/
|
||||
|
||||
Posf *prev;
|
||||
/* Link to older string with same hash index. To limit the size of this
|
||||
* array to 64K, this link is maintained only for the last 32K strings.
|
||||
* An index in this array is thus a window index modulo 32K.
|
||||
*/
|
||||
|
||||
Posf *head; /* Heads of the hash chains or NIL. */
|
||||
|
||||
uInt ins_h; /* hash index of string to be inserted */
|
||||
uInt hash_size; /* number of elements in hash table */
|
||||
uInt hash_bits; /* log2(hash_size) */
|
||||
uInt hash_mask; /* hash_size-1 */
|
||||
|
||||
uInt hash_shift;
|
||||
/* Number of bits by which ins_h must be shifted at each input
|
||||
* step. It must be such that after MIN_MATCH steps, the oldest
|
||||
* byte no longer takes part in the hash key, that is:
|
||||
* hash_shift * MIN_MATCH >= hash_bits
|
||||
*/
|
||||
|
||||
long block_start;
|
||||
/* Window position at the beginning of the current output block. Gets
|
||||
* negative when the window is moved backwards.
|
||||
*/
|
||||
|
||||
uInt match_length; /* length of best match */
|
||||
IPos prev_match; /* previous match */
|
||||
int match_available; /* set if previous match exists */
|
||||
uInt strstart; /* start of string to insert */
|
||||
uInt match_start; /* start of matching string */
|
||||
uInt lookahead; /* number of valid bytes ahead in window */
|
||||
|
||||
uInt prev_length;
|
||||
/* Length of the best match at previous step. Matches not greater than this
|
||||
* are discarded. This is used in the lazy match evaluation.
|
||||
*/
|
||||
|
||||
uInt max_chain_length;
|
||||
/* To speed up deflation, hash chains are never searched beyond this
|
||||
* length. A higher limit improves compression ratio but degrades the
|
||||
* speed.
|
||||
*/
|
||||
|
||||
uInt max_lazy_match;
|
||||
/* Attempt to find a better match only when the current match is strictly
|
||||
* smaller than this value. This mechanism is used only for compression
|
||||
* levels >= 4.
|
||||
*/
|
||||
# define max_insert_length max_lazy_match
|
||||
/* Insert new strings in the hash table only if the match length is not
|
||||
* greater than this length. This saves time but degrades compression.
|
||||
* max_insert_length is used only for compression levels <= 3.
|
||||
*/
|
||||
|
||||
int level; /* compression level (1..9) */
|
||||
int strategy; /* favor or force Huffman coding*/
|
||||
|
||||
uInt good_match;
|
||||
/* Use a faster search when the previous match is longer than this */
|
||||
|
||||
int nice_match; /* Stop searching when current match exceeds this */
|
||||
|
||||
/* used by trees.c: */
|
||||
/* Didn't use ct_data typedef below to supress compiler warning */
|
||||
struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */
|
||||
struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */
|
||||
struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */
|
||||
|
||||
struct tree_desc_s l_desc; /* desc. for literal tree */
|
||||
struct tree_desc_s d_desc; /* desc. for distance tree */
|
||||
struct tree_desc_s bl_desc; /* desc. for bit length tree */
|
||||
|
||||
ush bl_count[MAX_BITS+1];
|
||||
/* number of codes at each bit length for an optimal tree */
|
||||
|
||||
int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */
|
||||
int heap_len; /* number of elements in the heap */
|
||||
int heap_max; /* element of largest frequency */
|
||||
/* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used.
|
||||
* The same heap array is used to build all trees.
|
||||
*/
|
||||
|
||||
uch depth[2*L_CODES+1];
|
||||
/* Depth of each subtree used as tie breaker for trees of equal frequency
|
||||
*/
|
||||
|
||||
uchf *l_buf; /* buffer for literals or lengths */
|
||||
|
||||
uInt lit_bufsize;
|
||||
/* Size of match buffer for literals/lengths. There are 4 reasons for
|
||||
* limiting lit_bufsize to 64K:
|
||||
* - frequencies can be kept in 16 bit counters
|
||||
* - if compression is not successful for the first block, all input
|
||||
* data is still in the window so we can still emit a stored block even
|
||||
* when input comes from standard input. (This can also be done for
|
||||
* all blocks if lit_bufsize is not greater than 32K.)
|
||||
* - if compression is not successful for a file smaller than 64K, we can
|
||||
* even emit a stored file instead of a stored block (saving 5 bytes).
|
||||
* This is applicable only for zip (not gzip or zlib).
|
||||
* - creating new Huffman trees less frequently may not provide fast
|
||||
* adaptation to changes in the input data statistics. (Take for
|
||||
* example a binary file with poorly compressible code followed by
|
||||
* a highly compressible string table.) Smaller buffer sizes give
|
||||
* fast adaptation but have of course the overhead of transmitting
|
||||
* trees more frequently.
|
||||
* - I can't count above 4
|
||||
*/
|
||||
|
||||
uInt last_lit; /* running index in l_buf */
|
||||
|
||||
ushf *d_buf;
|
||||
/* Buffer for distances. To simplify the code, d_buf and l_buf have
|
||||
* the same number of elements. To use different lengths, an extra flag
|
||||
* array would be necessary.
|
||||
*/
|
||||
|
||||
ulg opt_len; /* bit length of current block with optimal trees */
|
||||
ulg static_len; /* bit length of current block with static trees */
|
||||
uInt matches; /* number of string matches in current block */
|
||||
int last_eob_len; /* bit length of EOB code for last block */
|
||||
|
||||
#ifdef DEBUG
|
||||
ulg compressed_len; /* total bit length of compressed file mod 2^32 */
|
||||
ulg bits_sent; /* bit length of compressed data sent mod 2^32 */
|
||||
#endif
|
||||
|
||||
ush bi_buf;
|
||||
/* Output buffer. bits are inserted starting at the bottom (least
|
||||
* significant bits).
|
||||
*/
|
||||
int bi_valid;
|
||||
/* Number of valid bits in bi_buf. All bits above the last valid bit
|
||||
* are always zero.
|
||||
*/
|
||||
|
||||
} FAR deflate_state;
|
||||
|
||||
/* Output a byte on the stream.
|
||||
* IN assertion: there is enough room in pending_buf.
|
||||
*/
|
||||
#define put_byte(s, c) {s->pending_buf[s->pending++] = (c);}
|
||||
|
||||
|
||||
#define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1)
|
||||
/* Minimum amount of lookahead, except at the end of the input file.
|
||||
* See deflate.c for comments about the MIN_MATCH+1.
|
||||
*/
|
||||
|
||||
#define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD)
|
||||
/* In order to simplify the code, particularly on 16 bit machines, match
|
||||
* distances are limited to MAX_DIST instead of WSIZE.
|
||||
*/
|
||||
|
||||
/* in trees.c */
|
||||
void _tr_init OF((deflate_state *s));
|
||||
int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc));
|
||||
void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len,
|
||||
int eof));
|
||||
void _tr_align OF((deflate_state *s));
|
||||
void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len,
|
||||
int eof));
|
||||
|
||||
#define d_code(dist) \
|
||||
((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)])
|
||||
/* Mapping from a distance to a distance code. dist is the distance - 1 and
|
||||
* must not have side effects. _dist_code[256] and _dist_code[257] are never
|
||||
* used.
|
||||
*/
|
||||
|
||||
#ifndef DEBUG
|
||||
/* Inline versions of _tr_tally for speed: */
|
||||
|
||||
#if defined(GEN_TREES_H) || !defined(STDC)
|
||||
extern uch _length_code[];
|
||||
extern uch _dist_code[];
|
||||
#else
|
||||
extern const uch _length_code[];
|
||||
extern const uch _dist_code[];
|
||||
#endif
|
||||
|
||||
# define _tr_tally_lit(s, c, flush) \
|
||||
{ uch cc = (c); \
|
||||
s->d_buf[s->last_lit] = 0; \
|
||||
s->l_buf[s->last_lit++] = cc; \
|
||||
s->dyn_ltree[cc].Freq++; \
|
||||
flush = (s->last_lit == s->lit_bufsize-1); \
|
||||
}
|
||||
# define _tr_tally_dist(s, distance, length, flush) \
|
||||
{ uch len = (length); \
|
||||
ush dist = (distance); \
|
||||
s->d_buf[s->last_lit] = dist; \
|
||||
s->l_buf[s->last_lit++] = len; \
|
||||
dist--; \
|
||||
s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \
|
||||
s->dyn_dtree[d_code(dist)].Freq++; \
|
||||
flush = (s->last_lit == s->lit_bufsize-1); \
|
||||
}
|
||||
#else
|
||||
# define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c)
|
||||
# define _tr_tally_dist(s, distance, length, flush) \
|
||||
flush = _tr_tally(s, distance, length)
|
||||
#endif
|
||||
|
||||
#endif /* DEFLATE_H */
|
|
@ -1,11 +0,0 @@
|
|||
/* inffast.h -- header to use inffast.c
|
||||
* Copyright (C) 1995-2003 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* WARNING: this file should *not* be used by applications. It is
|
||||
part of the implementation of the compression library and is
|
||||
subject to change. Applications should only use zlib.h.
|
||||
*/
|
||||
|
||||
void inflate_fast OF((z_streamp strm, unsigned start));
|
|
@ -1,94 +0,0 @@
|
|||
/* inffixed.h -- table for decoding fixed codes
|
||||
* Generated automatically by makefixed().
|
||||
*/
|
||||
|
||||
/* WARNING: this file should *not* be used by applications. It
|
||||
is part of the implementation of the compression library and
|
||||
is subject to change. Applications should only use zlib.h.
|
||||
*/
|
||||
|
||||
static const code lenfix[512] = {
|
||||
{96,7,0},{0,8,80},{0,8,16},{20,8,115},{18,7,31},{0,8,112},{0,8,48},
|
||||
{0,9,192},{16,7,10},{0,8,96},{0,8,32},{0,9,160},{0,8,0},{0,8,128},
|
||||
{0,8,64},{0,9,224},{16,7,6},{0,8,88},{0,8,24},{0,9,144},{19,7,59},
|
||||
{0,8,120},{0,8,56},{0,9,208},{17,7,17},{0,8,104},{0,8,40},{0,9,176},
|
||||
{0,8,8},{0,8,136},{0,8,72},{0,9,240},{16,7,4},{0,8,84},{0,8,20},
|
||||
{21,8,227},{19,7,43},{0,8,116},{0,8,52},{0,9,200},{17,7,13},{0,8,100},
|
||||
{0,8,36},{0,9,168},{0,8,4},{0,8,132},{0,8,68},{0,9,232},{16,7,8},
|
||||
{0,8,92},{0,8,28},{0,9,152},{20,7,83},{0,8,124},{0,8,60},{0,9,216},
|
||||
{18,7,23},{0,8,108},{0,8,44},{0,9,184},{0,8,12},{0,8,140},{0,8,76},
|
||||
{0,9,248},{16,7,3},{0,8,82},{0,8,18},{21,8,163},{19,7,35},{0,8,114},
|
||||
{0,8,50},{0,9,196},{17,7,11},{0,8,98},{0,8,34},{0,9,164},{0,8,2},
|
||||
{0,8,130},{0,8,66},{0,9,228},{16,7,7},{0,8,90},{0,8,26},{0,9,148},
|
||||
{20,7,67},{0,8,122},{0,8,58},{0,9,212},{18,7,19},{0,8,106},{0,8,42},
|
||||
{0,9,180},{0,8,10},{0,8,138},{0,8,74},{0,9,244},{16,7,5},{0,8,86},
|
||||
{0,8,22},{64,8,0},{19,7,51},{0,8,118},{0,8,54},{0,9,204},{17,7,15},
|
||||
{0,8,102},{0,8,38},{0,9,172},{0,8,6},{0,8,134},{0,8,70},{0,9,236},
|
||||
{16,7,9},{0,8,94},{0,8,30},{0,9,156},{20,7,99},{0,8,126},{0,8,62},
|
||||
{0,9,220},{18,7,27},{0,8,110},{0,8,46},{0,9,188},{0,8,14},{0,8,142},
|
||||
{0,8,78},{0,9,252},{96,7,0},{0,8,81},{0,8,17},{21,8,131},{18,7,31},
|
||||
{0,8,113},{0,8,49},{0,9,194},{16,7,10},{0,8,97},{0,8,33},{0,9,162},
|
||||
{0,8,1},{0,8,129},{0,8,65},{0,9,226},{16,7,6},{0,8,89},{0,8,25},
|
||||
{0,9,146},{19,7,59},{0,8,121},{0,8,57},{0,9,210},{17,7,17},{0,8,105},
|
||||
{0,8,41},{0,9,178},{0,8,9},{0,8,137},{0,8,73},{0,9,242},{16,7,4},
|
||||
{0,8,85},{0,8,21},{16,8,258},{19,7,43},{0,8,117},{0,8,53},{0,9,202},
|
||||
{17,7,13},{0,8,101},{0,8,37},{0,9,170},{0,8,5},{0,8,133},{0,8,69},
|
||||
{0,9,234},{16,7,8},{0,8,93},{0,8,29},{0,9,154},{20,7,83},{0,8,125},
|
||||
{0,8,61},{0,9,218},{18,7,23},{0,8,109},{0,8,45},{0,9,186},{0,8,13},
|
||||
{0,8,141},{0,8,77},{0,9,250},{16,7,3},{0,8,83},{0,8,19},{21,8,195},
|
||||
{19,7,35},{0,8,115},{0,8,51},{0,9,198},{17,7,11},{0,8,99},{0,8,35},
|
||||
{0,9,166},{0,8,3},{0,8,131},{0,8,67},{0,9,230},{16,7,7},{0,8,91},
|
||||
{0,8,27},{0,9,150},{20,7,67},{0,8,123},{0,8,59},{0,9,214},{18,7,19},
|
||||
{0,8,107},{0,8,43},{0,9,182},{0,8,11},{0,8,139},{0,8,75},{0,9,246},
|
||||
{16,7,5},{0,8,87},{0,8,23},{64,8,0},{19,7,51},{0,8,119},{0,8,55},
|
||||
{0,9,206},{17,7,15},{0,8,103},{0,8,39},{0,9,174},{0,8,7},{0,8,135},
|
||||
{0,8,71},{0,9,238},{16,7,9},{0,8,95},{0,8,31},{0,9,158},{20,7,99},
|
||||
{0,8,127},{0,8,63},{0,9,222},{18,7,27},{0,8,111},{0,8,47},{0,9,190},
|
||||
{0,8,15},{0,8,143},{0,8,79},{0,9,254},{96,7,0},{0,8,80},{0,8,16},
|
||||
{20,8,115},{18,7,31},{0,8,112},{0,8,48},{0,9,193},{16,7,10},{0,8,96},
|
||||
{0,8,32},{0,9,161},{0,8,0},{0,8,128},{0,8,64},{0,9,225},{16,7,6},
|
||||
{0,8,88},{0,8,24},{0,9,145},{19,7,59},{0,8,120},{0,8,56},{0,9,209},
|
||||
{17,7,17},{0,8,104},{0,8,40},{0,9,177},{0,8,8},{0,8,136},{0,8,72},
|
||||
{0,9,241},{16,7,4},{0,8,84},{0,8,20},{21,8,227},{19,7,43},{0,8,116},
|
||||
{0,8,52},{0,9,201},{17,7,13},{0,8,100},{0,8,36},{0,9,169},{0,8,4},
|
||||
{0,8,132},{0,8,68},{0,9,233},{16,7,8},{0,8,92},{0,8,28},{0,9,153},
|
||||
{20,7,83},{0,8,124},{0,8,60},{0,9,217},{18,7,23},{0,8,108},{0,8,44},
|
||||
{0,9,185},{0,8,12},{0,8,140},{0,8,76},{0,9,249},{16,7,3},{0,8,82},
|
||||
{0,8,18},{21,8,163},{19,7,35},{0,8,114},{0,8,50},{0,9,197},{17,7,11},
|
||||
{0,8,98},{0,8,34},{0,9,165},{0,8,2},{0,8,130},{0,8,66},{0,9,229},
|
||||
{16,7,7},{0,8,90},{0,8,26},{0,9,149},{20,7,67},{0,8,122},{0,8,58},
|
||||
{0,9,213},{18,7,19},{0,8,106},{0,8,42},{0,9,181},{0,8,10},{0,8,138},
|
||||
{0,8,74},{0,9,245},{16,7,5},{0,8,86},{0,8,22},{64,8,0},{19,7,51},
|
||||
{0,8,118},{0,8,54},{0,9,205},{17,7,15},{0,8,102},{0,8,38},{0,9,173},
|
||||
{0,8,6},{0,8,134},{0,8,70},{0,9,237},{16,7,9},{0,8,94},{0,8,30},
|
||||
{0,9,157},{20,7,99},{0,8,126},{0,8,62},{0,9,221},{18,7,27},{0,8,110},
|
||||
{0,8,46},{0,9,189},{0,8,14},{0,8,142},{0,8,78},{0,9,253},{96,7,0},
|
||||
{0,8,81},{0,8,17},{21,8,131},{18,7,31},{0,8,113},{0,8,49},{0,9,195},
|
||||
{16,7,10},{0,8,97},{0,8,33},{0,9,163},{0,8,1},{0,8,129},{0,8,65},
|
||||
{0,9,227},{16,7,6},{0,8,89},{0,8,25},{0,9,147},{19,7,59},{0,8,121},
|
||||
{0,8,57},{0,9,211},{17,7,17},{0,8,105},{0,8,41},{0,9,179},{0,8,9},
|
||||
{0,8,137},{0,8,73},{0,9,243},{16,7,4},{0,8,85},{0,8,21},{16,8,258},
|
||||
{19,7,43},{0,8,117},{0,8,53},{0,9,203},{17,7,13},{0,8,101},{0,8,37},
|
||||
{0,9,171},{0,8,5},{0,8,133},{0,8,69},{0,9,235},{16,7,8},{0,8,93},
|
||||
{0,8,29},{0,9,155},{20,7,83},{0,8,125},{0,8,61},{0,9,219},{18,7,23},
|
||||
{0,8,109},{0,8,45},{0,9,187},{0,8,13},{0,8,141},{0,8,77},{0,9,251},
|
||||
{16,7,3},{0,8,83},{0,8,19},{21,8,195},{19,7,35},{0,8,115},{0,8,51},
|
||||
{0,9,199},{17,7,11},{0,8,99},{0,8,35},{0,9,167},{0,8,3},{0,8,131},
|
||||
{0,8,67},{0,9,231},{16,7,7},{0,8,91},{0,8,27},{0,9,151},{20,7,67},
|
||||
{0,8,123},{0,8,59},{0,9,215},{18,7,19},{0,8,107},{0,8,43},{0,9,183},
|
||||
{0,8,11},{0,8,139},{0,8,75},{0,9,247},{16,7,5},{0,8,87},{0,8,23},
|
||||
{64,8,0},{19,7,51},{0,8,119},{0,8,55},{0,9,207},{17,7,15},{0,8,103},
|
||||
{0,8,39},{0,9,175},{0,8,7},{0,8,135},{0,8,71},{0,9,239},{16,7,9},
|
||||
{0,8,95},{0,8,31},{0,9,159},{20,7,99},{0,8,127},{0,8,63},{0,9,223},
|
||||
{18,7,27},{0,8,111},{0,8,47},{0,9,191},{0,8,15},{0,8,143},{0,8,79},
|
||||
{0,9,255}
|
||||
};
|
||||
|
||||
static const code distfix[32] = {
|
||||
{16,5,1},{23,5,257},{19,5,17},{27,5,4097},{17,5,5},{25,5,1025},
|
||||
{21,5,65},{29,5,16385},{16,5,3},{24,5,513},{20,5,33},{28,5,8193},
|
||||
{18,5,9},{26,5,2049},{22,5,129},{64,5,0},{16,5,2},{23,5,385},
|
||||
{19,5,25},{27,5,6145},{17,5,7},{25,5,1537},{21,5,97},{29,5,24577},
|
||||
{16,5,4},{24,5,769},{20,5,49},{28,5,12289},{18,5,13},{26,5,3073},
|
||||
{22,5,193},{64,5,0}
|
||||
};
|
|
@ -1,115 +0,0 @@
|
|||
/* inflate.h -- internal inflate state definition
|
||||
* Copyright (C) 1995-2004 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* WARNING: this file should *not* be used by applications. It is
|
||||
part of the implementation of the compression library and is
|
||||
subject to change. Applications should only use zlib.h.
|
||||
*/
|
||||
|
||||
/* define NO_GZIP when compiling if you want to disable gzip header and
|
||||
trailer decoding by inflate(). NO_GZIP would be used to avoid linking in
|
||||
the crc code when it is not needed. For shared libraries, gzip decoding
|
||||
should be left enabled. */
|
||||
#ifndef NO_GZIP
|
||||
# define GUNZIP
|
||||
#endif
|
||||
|
||||
/* Possible inflate modes between inflate() calls */
|
||||
typedef enum {
|
||||
HEAD, /* i: waiting for magic header */
|
||||
FLAGS, /* i: waiting for method and flags (gzip) */
|
||||
TIME, /* i: waiting for modification time (gzip) */
|
||||
OS, /* i: waiting for extra flags and operating system (gzip) */
|
||||
EXLEN, /* i: waiting for extra length (gzip) */
|
||||
EXTRA, /* i: waiting for extra bytes (gzip) */
|
||||
NAME, /* i: waiting for end of file name (gzip) */
|
||||
COMMENT, /* i: waiting for end of comment (gzip) */
|
||||
HCRC, /* i: waiting for header crc (gzip) */
|
||||
DICTID, /* i: waiting for dictionary check value */
|
||||
DICT, /* waiting for inflateSetDictionary() call */
|
||||
TYPE, /* i: waiting for type bits, including last-flag bit */
|
||||
TYPEDO, /* i: same, but skip check to exit inflate on new block */
|
||||
STORED, /* i: waiting for stored size (length and complement) */
|
||||
COPY, /* i/o: waiting for input or output to copy stored block */
|
||||
TABLE, /* i: waiting for dynamic block table lengths */
|
||||
LENLENS, /* i: waiting for code length code lengths */
|
||||
CODELENS, /* i: waiting for length/lit and distance code lengths */
|
||||
LEN, /* i: waiting for length/lit code */
|
||||
LENEXT, /* i: waiting for length extra bits */
|
||||
DIST, /* i: waiting for distance code */
|
||||
DISTEXT, /* i: waiting for distance extra bits */
|
||||
MATCH, /* o: waiting for output space to copy string */
|
||||
LIT, /* o: waiting for output space to write literal */
|
||||
CHECK, /* i: waiting for 32-bit check value */
|
||||
LENGTH, /* i: waiting for 32-bit length (gzip) */
|
||||
DONE, /* finished check, done -- remain here until reset */
|
||||
BAD, /* got a data error -- remain here until reset */
|
||||
MEM, /* got an inflate() memory error -- remain here until reset */
|
||||
SYNC /* looking for synchronization bytes to restart inflate() */
|
||||
} inflate_mode;
|
||||
|
||||
/*
|
||||
State transitions between above modes -
|
||||
|
||||
(most modes can go to the BAD or MEM mode -- not shown for clarity)
|
||||
|
||||
Process header:
|
||||
HEAD -> (gzip) or (zlib)
|
||||
(gzip) -> FLAGS -> TIME -> OS -> EXLEN -> EXTRA -> NAME
|
||||
NAME -> COMMENT -> HCRC -> TYPE
|
||||
(zlib) -> DICTID or TYPE
|
||||
DICTID -> DICT -> TYPE
|
||||
Read deflate blocks:
|
||||
TYPE -> STORED or TABLE or LEN or CHECK
|
||||
STORED -> COPY -> TYPE
|
||||
TABLE -> LENLENS -> CODELENS -> LEN
|
||||
Read deflate codes:
|
||||
LEN -> LENEXT or LIT or TYPE
|
||||
LENEXT -> DIST -> DISTEXT -> MATCH -> LEN
|
||||
LIT -> LEN
|
||||
Process trailer:
|
||||
CHECK -> LENGTH -> DONE
|
||||
*/
|
||||
|
||||
/* state maintained between inflate() calls. Approximately 7K bytes. */
|
||||
struct inflate_state {
|
||||
inflate_mode mode; /* current inflate mode */
|
||||
int last; /* true if processing last block */
|
||||
int wrap; /* bit 0 true for zlib, bit 1 true for gzip */
|
||||
int havedict; /* true if dictionary provided */
|
||||
int flags; /* gzip header method and flags (0 if zlib) */
|
||||
unsigned dmax; /* zlib header max distance (INFLATE_STRICT) */
|
||||
unsigned long check; /* protected copy of check value */
|
||||
unsigned long total; /* protected copy of output count */
|
||||
gz_headerp head; /* where to save gzip header information */
|
||||
/* sliding window */
|
||||
unsigned wbits; /* log base 2 of requested window size */
|
||||
unsigned wsize; /* window size or zero if not using window */
|
||||
unsigned whave; /* valid bytes in the window */
|
||||
unsigned write; /* window write index */
|
||||
unsigned char FAR *window; /* allocated sliding window, if needed */
|
||||
/* bit accumulator */
|
||||
unsigned long hold; /* input bit accumulator */
|
||||
unsigned bits; /* number of bits in "in" */
|
||||
/* for string and stored block copying */
|
||||
unsigned length; /* literal or length of data to copy */
|
||||
unsigned offset; /* distance back to copy string from */
|
||||
/* for table and code decoding */
|
||||
unsigned extra; /* extra bits needed */
|
||||
/* fixed and dynamic code tables */
|
||||
code const FAR *lencode; /* starting table for length/literal codes */
|
||||
code const FAR *distcode; /* starting table for distance codes */
|
||||
unsigned lenbits; /* index bits for lencode */
|
||||
unsigned distbits; /* index bits for distcode */
|
||||
/* dynamic table building */
|
||||
unsigned ncode; /* number of code length code lengths */
|
||||
unsigned nlen; /* number of length code lengths */
|
||||
unsigned ndist; /* number of distance code lengths */
|
||||
unsigned have; /* number of code lengths in lens[] */
|
||||
code FAR *next; /* next available space in codes[] */
|
||||
unsigned short lens[320]; /* temporary storage for code lengths */
|
||||
unsigned short work[288]; /* work area for code table building */
|
||||
code codes[ENOUGH]; /* space for code tables */
|
||||
};
|
|
@ -1,55 +0,0 @@
|
|||
/* inftrees.h -- header to use inftrees.c
|
||||
* Copyright (C) 1995-2005 Mark Adler
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* WARNING: this file should *not* be used by applications. It is
|
||||
part of the implementation of the compression library and is
|
||||
subject to change. Applications should only use zlib.h.
|
||||
*/
|
||||
|
||||
/* Structure for decoding tables. Each entry provides either the
|
||||
information needed to do the operation requested by the code that
|
||||
indexed that table entry, or it provides a pointer to another
|
||||
table that indexes more bits of the code. op indicates whether
|
||||
the entry is a pointer to another table, a literal, a length or
|
||||
distance, an end-of-block, or an invalid code. For a table
|
||||
pointer, the low four bits of op is the number of index bits of
|
||||
that table. For a length or distance, the low four bits of op
|
||||
is the number of extra bits to get after the code. bits is
|
||||
the number of bits in this code or part of the code to drop off
|
||||
of the bit buffer. val is the actual byte to output in the case
|
||||
of a literal, the base length or distance, or the offset from
|
||||
the current table to the next table. Each entry is four bytes. */
|
||||
typedef struct {
|
||||
unsigned char op; /* operation, extra bits, table bits */
|
||||
unsigned char bits; /* bits in this part of the code */
|
||||
unsigned short val; /* offset in table or code value */
|
||||
} code;
|
||||
|
||||
/* op values as set by inflate_table():
|
||||
00000000 - literal
|
||||
0000tttt - table link, tttt != 0 is the number of table index bits
|
||||
0001eeee - length or distance, eeee is the number of extra bits
|
||||
01100000 - end of block
|
||||
01000000 - invalid code
|
||||
*/
|
||||
|
||||
/* Maximum size of dynamic tree. The maximum found in a long but non-
|
||||
exhaustive search was 1444 code structures (852 for length/literals
|
||||
and 592 for distances, the latter actually the result of an
|
||||
exhaustive search). The true maximum is not known, but the value
|
||||
below is more than safe. */
|
||||
#define ENOUGH 2048
|
||||
#define MAXD 592
|
||||
|
||||
/* Type of code to build for inftable() */
|
||||
typedef enum {
|
||||
CODES,
|
||||
LENS,
|
||||
DISTS
|
||||
} codetype;
|
||||
|
||||
extern int inflate_table OF((codetype type, unsigned short FAR *lens,
|
||||
unsigned codes, code FAR * FAR *table,
|
||||
unsigned FAR *bits, unsigned short FAR *work));
|
|
@ -1,128 +0,0 @@
|
|||
/* header created automatically with -DGEN_TREES_H */
|
||||
|
||||
local const ct_data static_ltree[L_CODES+2] = {
|
||||
{{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}},
|
||||
{{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}},
|
||||
{{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}},
|
||||
{{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}},
|
||||
{{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}},
|
||||
{{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}},
|
||||
{{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}},
|
||||
{{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}},
|
||||
{{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}},
|
||||
{{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}},
|
||||
{{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}},
|
||||
{{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}},
|
||||
{{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}},
|
||||
{{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}},
|
||||
{{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}},
|
||||
{{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}},
|
||||
{{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}},
|
||||
{{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}},
|
||||
{{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}},
|
||||
{{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}},
|
||||
{{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}},
|
||||
{{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}},
|
||||
{{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}},
|
||||
{{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}},
|
||||
{{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}},
|
||||
{{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}},
|
||||
{{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}},
|
||||
{{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}},
|
||||
{{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}},
|
||||
{{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}},
|
||||
{{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}},
|
||||
{{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}},
|
||||
{{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}},
|
||||
{{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}},
|
||||
{{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}},
|
||||
{{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}},
|
||||
{{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}},
|
||||
{{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}},
|
||||
{{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}},
|
||||
{{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}},
|
||||
{{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}},
|
||||
{{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}},
|
||||
{{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}},
|
||||
{{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}},
|
||||
{{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}},
|
||||
{{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}},
|
||||
{{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}},
|
||||
{{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}},
|
||||
{{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}},
|
||||
{{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}},
|
||||
{{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}},
|
||||
{{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}},
|
||||
{{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}},
|
||||
{{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}},
|
||||
{{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}},
|
||||
{{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}},
|
||||
{{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}},
|
||||
{{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}}
|
||||
};
|
||||
|
||||
local const ct_data static_dtree[D_CODES] = {
|
||||
{{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}},
|
||||
{{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}},
|
||||
{{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}},
|
||||
{{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}},
|
||||
{{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}},
|
||||
{{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}}
|
||||
};
|
||||
|
||||
const uch _dist_code[DIST_CODE_LEN] = {
|
||||
0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8,
|
||||
8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10,
|
||||
10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,
|
||||
11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
|
||||
12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13,
|
||||
13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
|
||||
13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
|
||||
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
|
||||
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,
|
||||
14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15,
|
||||
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
|
||||
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
|
||||
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17,
|
||||
18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22,
|
||||
23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
|
||||
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
|
||||
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27,
|
||||
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
|
||||
27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
|
||||
28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
|
||||
28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28,
|
||||
28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
|
||||
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
|
||||
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
|
||||
29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29
|
||||
};
|
||||
|
||||
const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12,
|
||||
13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16,
|
||||
17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19,
|
||||
19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
|
||||
21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22,
|
||||
22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23,
|
||||
23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
|
||||
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,
|
||||
25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26,
|
||||
26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,
|
||||
26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,
|
||||
27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28
|
||||
};
|
||||
|
||||
local const int base_length[LENGTH_CODES] = {
|
||||
0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56,
|
||||
64, 80, 96, 112, 128, 160, 192, 224, 0
|
||||
};
|
||||
|
||||
local const int base_dist[D_CODES] = {
|
||||
0, 1, 2, 3, 4, 6, 8, 12, 16, 24,
|
||||
32, 48, 64, 96, 128, 192, 256, 384, 512, 768,
|
||||
1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576
|
||||
};
|
||||
|
|
@ -1,332 +0,0 @@
|
|||
/* zconf.h -- configuration of the zlib compression library
|
||||
* Copyright (C) 1995-2005 Jean-loup Gailly.
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* @(#) $Id: zconf.h,v 1.2 2006/03/02 00:10:34 zerocool Exp $ */
|
||||
|
||||
#ifndef ZCONF_H
|
||||
#define ZCONF_H
|
||||
|
||||
/*
|
||||
* If you *really* need a unique prefix for all types and library functions,
|
||||
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
|
||||
*/
|
||||
#ifdef Z_PREFIX
|
||||
# define deflateInit_ z_deflateInit_
|
||||
# define deflate z_deflate
|
||||
# define deflateEnd z_deflateEnd
|
||||
# define inflateInit_ z_inflateInit_
|
||||
# define inflate z_inflate
|
||||
# define inflateEnd z_inflateEnd
|
||||
# define deflateInit2_ z_deflateInit2_
|
||||
# define deflateSetDictionary z_deflateSetDictionary
|
||||
# define deflateCopy z_deflateCopy
|
||||
# define deflateReset z_deflateReset
|
||||
# define deflateParams z_deflateParams
|
||||
# define deflateBound z_deflateBound
|
||||
# define deflatePrime z_deflatePrime
|
||||
# define inflateInit2_ z_inflateInit2_
|
||||
# define inflateSetDictionary z_inflateSetDictionary
|
||||
# define inflateSync z_inflateSync
|
||||
# define inflateSyncPoint z_inflateSyncPoint
|
||||
# define inflateCopy z_inflateCopy
|
||||
# define inflateReset z_inflateReset
|
||||
# define inflateBack z_inflateBack
|
||||
# define inflateBackEnd z_inflateBackEnd
|
||||
# define compress z_compress
|
||||
# define compress2 z_compress2
|
||||
# define compressBound z_compressBound
|
||||
# define uncompress z_uncompress
|
||||
# define adler32 z_adler32
|
||||
# define crc32 z_crc32
|
||||
# define get_crc_table z_get_crc_table
|
||||
# define zError z_zError
|
||||
|
||||
# define alloc_func z_alloc_func
|
||||
# define free_func z_free_func
|
||||
# define in_func z_in_func
|
||||
# define out_func z_out_func
|
||||
# define Byte z_Byte
|
||||
# define uInt z_uInt
|
||||
# define uLong z_uLong
|
||||
# define Bytef z_Bytef
|
||||
# define charf z_charf
|
||||
# define intf z_intf
|
||||
# define uIntf z_uIntf
|
||||
# define uLongf z_uLongf
|
||||
# define voidpf z_voidpf
|
||||
# define voidp z_voidp
|
||||
#endif
|
||||
|
||||
#if defined(__MSDOS__) && !defined(MSDOS)
|
||||
# define MSDOS
|
||||
#endif
|
||||
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
|
||||
# define OS2
|
||||
#endif
|
||||
#if defined(_WINDOWS) && !defined(WINDOWS)
|
||||
# define WINDOWS
|
||||
#endif
|
||||
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
|
||||
# ifndef WIN32
|
||||
# define WIN32
|
||||
# endif
|
||||
#endif
|
||||
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
|
||||
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
|
||||
# ifndef SYS16BIT
|
||||
# define SYS16BIT
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
|
||||
* than 64k bytes at a time (needed on systems with 16-bit int).
|
||||
*/
|
||||
#ifdef SYS16BIT
|
||||
# define MAXSEG_64K
|
||||
#endif
|
||||
#ifdef MSDOS
|
||||
# define UNALIGNED_OK
|
||||
#endif
|
||||
|
||||
#ifdef __STDC_VERSION__
|
||||
# ifndef STDC
|
||||
# define STDC
|
||||
# endif
|
||||
# if __STDC_VERSION__ >= 199901L
|
||||
# ifndef STDC99
|
||||
# define STDC99
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
|
||||
# define STDC
|
||||
#endif
|
||||
|
||||
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
|
||||
# define STDC
|
||||
#endif
|
||||
|
||||
#ifndef STDC
|
||||
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
|
||||
# define const /* note: need a more gentle solution here */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Some Mac compilers merge all .h files incorrectly: */
|
||||
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
|
||||
# define NO_DUMMY_DECL
|
||||
#endif
|
||||
|
||||
/* Maximum value for memLevel in deflateInit2 */
|
||||
#ifndef MAX_MEM_LEVEL
|
||||
# ifdef MAXSEG_64K
|
||||
# define MAX_MEM_LEVEL 8
|
||||
# else
|
||||
# define MAX_MEM_LEVEL 9
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
|
||||
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
|
||||
* created by gzip. (Files created by minigzip can still be extracted by
|
||||
* gzip.)
|
||||
*/
|
||||
#ifndef MAX_WBITS
|
||||
# define MAX_WBITS 15 /* 32K LZ77 window */
|
||||
#endif
|
||||
|
||||
/* The memory requirements for deflate are (in bytes):
|
||||
(1 << (windowBits+2)) + (1 << (memLevel+9))
|
||||
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
|
||||
plus a few kilobytes for small objects. For example, if you want to reduce
|
||||
the default memory requirements from 256K to 128K, compile with
|
||||
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
|
||||
Of course this will generally degrade compression (there's no free lunch).
|
||||
|
||||
The memory requirements for inflate are (in bytes) 1 << windowBits
|
||||
that is, 32K for windowBits=15 (default value) plus a few kilobytes
|
||||
for small objects.
|
||||
*/
|
||||
|
||||
/* Type declarations */
|
||||
|
||||
#ifndef OF /* function prototypes */
|
||||
# ifdef STDC
|
||||
# define OF(args) args
|
||||
# else
|
||||
# define OF(args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The following definitions for FAR are needed only for MSDOS mixed
|
||||
* model programming (small or medium model with some far allocations).
|
||||
* This was tested only with MSC; for other MSDOS compilers you may have
|
||||
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
|
||||
* just define FAR to be empty.
|
||||
*/
|
||||
#ifdef SYS16BIT
|
||||
# if defined(M_I86SM) || defined(M_I86MM)
|
||||
/* MSC small or medium model */
|
||||
# define SMALL_MEDIUM
|
||||
# ifdef _MSC_VER
|
||||
# define FAR _far
|
||||
# else
|
||||
# define FAR far
|
||||
# endif
|
||||
# endif
|
||||
# if (defined(__SMALL__) || defined(__MEDIUM__))
|
||||
/* Turbo C small or medium model */
|
||||
# define SMALL_MEDIUM
|
||||
# ifdef __BORLANDC__
|
||||
# define FAR _far
|
||||
# else
|
||||
# define FAR far
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(WINDOWS) || defined(WIN32)
|
||||
/* If building or using zlib as a DLL, define ZLIB_DLL.
|
||||
* This is not mandatory, but it offers a little performance increase.
|
||||
*/
|
||||
# ifdef ZLIB_DLL
|
||||
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
|
||||
# ifdef ZLIB_INTERNAL
|
||||
# define ZEXTERN extern __declspec(dllexport)
|
||||
# else
|
||||
# define ZEXTERN extern __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
# endif /* ZLIB_DLL */
|
||||
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
|
||||
* define ZLIB_WINAPI.
|
||||
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
|
||||
*/
|
||||
# ifdef ZLIB_WINAPI
|
||||
# ifdef FAR
|
||||
# undef FAR
|
||||
# endif
|
||||
# include <windows.h>
|
||||
/* No need for _export, use ZLIB.DEF instead. */
|
||||
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
|
||||
# define ZEXPORT WINAPI
|
||||
# ifdef WIN32
|
||||
# define ZEXPORTVA WINAPIV
|
||||
# else
|
||||
# define ZEXPORTVA FAR CDECL
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (__BEOS__)
|
||||
# ifdef ZLIB_DLL
|
||||
# ifdef ZLIB_INTERNAL
|
||||
# define ZEXPORT __declspec(dllexport)
|
||||
# define ZEXPORTVA __declspec(dllexport)
|
||||
# else
|
||||
# define ZEXPORT __declspec(dllimport)
|
||||
# define ZEXPORTVA __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ZEXTERN
|
||||
# define ZEXTERN extern
|
||||
#endif
|
||||
#ifndef ZEXPORT
|
||||
# define ZEXPORT
|
||||
#endif
|
||||
#ifndef ZEXPORTVA
|
||||
# define ZEXPORTVA
|
||||
#endif
|
||||
|
||||
#ifndef FAR
|
||||
# define FAR
|
||||
#endif
|
||||
|
||||
#if !defined(__MACTYPES__)
|
||||
typedef unsigned char Byte; /* 8 bits */
|
||||
#endif
|
||||
typedef unsigned int uInt; /* 16 bits or more */
|
||||
typedef unsigned long uLong; /* 32 bits or more */
|
||||
|
||||
#ifdef SMALL_MEDIUM
|
||||
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
|
||||
# define Bytef Byte FAR
|
||||
#else
|
||||
typedef Byte FAR Bytef;
|
||||
#endif
|
||||
typedef char FAR charf;
|
||||
typedef int FAR intf;
|
||||
typedef uInt FAR uIntf;
|
||||
typedef uLong FAR uLongf;
|
||||
|
||||
#ifdef STDC
|
||||
typedef void const *voidpc;
|
||||
typedef void FAR *voidpf;
|
||||
typedef void *voidp;
|
||||
#else
|
||||
typedef Byte const *voidpc;
|
||||
typedef Byte FAR *voidpf;
|
||||
typedef Byte *voidp;
|
||||
#endif
|
||||
|
||||
#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */
|
||||
# include <sys/types.h> /* for off_t */
|
||||
# include <unistd.h> /* for SEEK_* and off_t */
|
||||
# ifdef VMS
|
||||
# include <unixio.h> /* for off_t */
|
||||
# endif
|
||||
# define z_off_t off_t
|
||||
#endif
|
||||
#ifndef SEEK_SET
|
||||
# define SEEK_SET 0 /* Seek from beginning of file. */
|
||||
# define SEEK_CUR 1 /* Seek from current position. */
|
||||
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
|
||||
#endif
|
||||
#ifndef z_off_t
|
||||
# define z_off_t long
|
||||
#endif
|
||||
|
||||
#if defined(__OS400__)
|
||||
# define NO_vsnprintf
|
||||
#endif
|
||||
|
||||
#if defined(__MVS__)
|
||||
# define NO_vsnprintf
|
||||
# ifdef FAR
|
||||
# undef FAR
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* MVS linker does not support external names larger than 8 bytes */
|
||||
#if defined(__MVS__)
|
||||
# pragma map(deflateInit_,"DEIN")
|
||||
# pragma map(deflateInit2_,"DEIN2")
|
||||
# pragma map(deflateEnd,"DEEND")
|
||||
# pragma map(deflateBound,"DEBND")
|
||||
# pragma map(inflateInit_,"ININ")
|
||||
# pragma map(inflateInit2_,"ININ2")
|
||||
# pragma map(inflateEnd,"INEND")
|
||||
# pragma map(inflateSync,"INSY")
|
||||
# pragma map(inflateSetDictionary,"INSEDI")
|
||||
# pragma map(compressBound,"CMBND")
|
||||
# pragma map(inflate_table,"INTABL")
|
||||
# pragma map(inflate_fast,"INFA")
|
||||
# pragma map(inflate_copyright,"INCOPY")
|
||||
#endif
|
||||
|
||||
#endif /* ZCONF_H */
|
|
@ -1,332 +0,0 @@
|
|||
/* zconf.h -- configuration of the zlib compression library
|
||||
* Copyright (C) 1995-2005 Jean-loup Gailly.
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* @(#) $Id: zconf.in.h,v 1.2 2006/03/02 00:10:34 zerocool Exp $ */
|
||||
|
||||
#ifndef ZCONF_H
|
||||
#define ZCONF_H
|
||||
|
||||
/*
|
||||
* If you *really* need a unique prefix for all types and library functions,
|
||||
* compile with -DZ_PREFIX. The "standard" zlib should be compiled without it.
|
||||
*/
|
||||
#ifdef Z_PREFIX
|
||||
# define deflateInit_ z_deflateInit_
|
||||
# define deflate z_deflate
|
||||
# define deflateEnd z_deflateEnd
|
||||
# define inflateInit_ z_inflateInit_
|
||||
# define inflate z_inflate
|
||||
# define inflateEnd z_inflateEnd
|
||||
# define deflateInit2_ z_deflateInit2_
|
||||
# define deflateSetDictionary z_deflateSetDictionary
|
||||
# define deflateCopy z_deflateCopy
|
||||
# define deflateReset z_deflateReset
|
||||
# define deflateParams z_deflateParams
|
||||
# define deflateBound z_deflateBound
|
||||
# define deflatePrime z_deflatePrime
|
||||
# define inflateInit2_ z_inflateInit2_
|
||||
# define inflateSetDictionary z_inflateSetDictionary
|
||||
# define inflateSync z_inflateSync
|
||||
# define inflateSyncPoint z_inflateSyncPoint
|
||||
# define inflateCopy z_inflateCopy
|
||||
# define inflateReset z_inflateReset
|
||||
# define inflateBack z_inflateBack
|
||||
# define inflateBackEnd z_inflateBackEnd
|
||||
# define compress z_compress
|
||||
# define compress2 z_compress2
|
||||
# define compressBound z_compressBound
|
||||
# define uncompress z_uncompress
|
||||
# define adler32 z_adler32
|
||||
# define crc32 z_crc32
|
||||
# define get_crc_table z_get_crc_table
|
||||
# define zError z_zError
|
||||
|
||||
# define alloc_func z_alloc_func
|
||||
# define free_func z_free_func
|
||||
# define in_func z_in_func
|
||||
# define out_func z_out_func
|
||||
# define Byte z_Byte
|
||||
# define uInt z_uInt
|
||||
# define uLong z_uLong
|
||||
# define Bytef z_Bytef
|
||||
# define charf z_charf
|
||||
# define intf z_intf
|
||||
# define uIntf z_uIntf
|
||||
# define uLongf z_uLongf
|
||||
# define voidpf z_voidpf
|
||||
# define voidp z_voidp
|
||||
#endif
|
||||
|
||||
#if defined(__MSDOS__) && !defined(MSDOS)
|
||||
# define MSDOS
|
||||
#endif
|
||||
#if (defined(OS_2) || defined(__OS2__)) && !defined(OS2)
|
||||
# define OS2
|
||||
#endif
|
||||
#if defined(_WINDOWS) && !defined(WINDOWS)
|
||||
# define WINDOWS
|
||||
#endif
|
||||
#if defined(_WIN32) || defined(_WIN32_WCE) || defined(__WIN32__)
|
||||
# ifndef WIN32
|
||||
# define WIN32
|
||||
# endif
|
||||
#endif
|
||||
#if (defined(MSDOS) || defined(OS2) || defined(WINDOWS)) && !defined(WIN32)
|
||||
# if !defined(__GNUC__) && !defined(__FLAT__) && !defined(__386__)
|
||||
# ifndef SYS16BIT
|
||||
# define SYS16BIT
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Compile with -DMAXSEG_64K if the alloc function cannot allocate more
|
||||
* than 64k bytes at a time (needed on systems with 16-bit int).
|
||||
*/
|
||||
#ifdef SYS16BIT
|
||||
# define MAXSEG_64K
|
||||
#endif
|
||||
#ifdef MSDOS
|
||||
# define UNALIGNED_OK
|
||||
#endif
|
||||
|
||||
#ifdef __STDC_VERSION__
|
||||
# ifndef STDC
|
||||
# define STDC
|
||||
# endif
|
||||
# if __STDC_VERSION__ >= 199901L
|
||||
# ifndef STDC99
|
||||
# define STDC99
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(__STDC__) || defined(__cplusplus))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(__GNUC__) || defined(__BORLANDC__))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32))
|
||||
# define STDC
|
||||
#endif
|
||||
#if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__))
|
||||
# define STDC
|
||||
#endif
|
||||
|
||||
#if defined(__OS400__) && !defined(STDC) /* iSeries (formerly AS/400). */
|
||||
# define STDC
|
||||
#endif
|
||||
|
||||
#ifndef STDC
|
||||
# ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */
|
||||
# define const /* note: need a more gentle solution here */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Some Mac compilers merge all .h files incorrectly: */
|
||||
#if defined(__MWERKS__)||defined(applec)||defined(THINK_C)||defined(__SC__)
|
||||
# define NO_DUMMY_DECL
|
||||
#endif
|
||||
|
||||
/* Maximum value for memLevel in deflateInit2 */
|
||||
#ifndef MAX_MEM_LEVEL
|
||||
# ifdef MAXSEG_64K
|
||||
# define MAX_MEM_LEVEL 8
|
||||
# else
|
||||
# define MAX_MEM_LEVEL 9
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Maximum value for windowBits in deflateInit2 and inflateInit2.
|
||||
* WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files
|
||||
* created by gzip. (Files created by minigzip can still be extracted by
|
||||
* gzip.)
|
||||
*/
|
||||
#ifndef MAX_WBITS
|
||||
# define MAX_WBITS 15 /* 32K LZ77 window */
|
||||
#endif
|
||||
|
||||
/* The memory requirements for deflate are (in bytes):
|
||||
(1 << (windowBits+2)) + (1 << (memLevel+9))
|
||||
that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values)
|
||||
plus a few kilobytes for small objects. For example, if you want to reduce
|
||||
the default memory requirements from 256K to 128K, compile with
|
||||
make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7"
|
||||
Of course this will generally degrade compression (there's no free lunch).
|
||||
|
||||
The memory requirements for inflate are (in bytes) 1 << windowBits
|
||||
that is, 32K for windowBits=15 (default value) plus a few kilobytes
|
||||
for small objects.
|
||||
*/
|
||||
|
||||
/* Type declarations */
|
||||
|
||||
#ifndef OF /* function prototypes */
|
||||
# ifdef STDC
|
||||
# define OF(args) args
|
||||
# else
|
||||
# define OF(args) ()
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* The following definitions for FAR are needed only for MSDOS mixed
|
||||
* model programming (small or medium model with some far allocations).
|
||||
* This was tested only with MSC; for other MSDOS compilers you may have
|
||||
* to define NO_MEMCPY in zutil.h. If you don't need the mixed model,
|
||||
* just define FAR to be empty.
|
||||
*/
|
||||
#ifdef SYS16BIT
|
||||
# if defined(M_I86SM) || defined(M_I86MM)
|
||||
/* MSC small or medium model */
|
||||
# define SMALL_MEDIUM
|
||||
# ifdef _MSC_VER
|
||||
# define FAR _far
|
||||
# else
|
||||
# define FAR far
|
||||
# endif
|
||||
# endif
|
||||
# if (defined(__SMALL__) || defined(__MEDIUM__))
|
||||
/* Turbo C small or medium model */
|
||||
# define SMALL_MEDIUM
|
||||
# ifdef __BORLANDC__
|
||||
# define FAR _far
|
||||
# else
|
||||
# define FAR far
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(WINDOWS) || defined(WIN32)
|
||||
/* If building or using zlib as a DLL, define ZLIB_DLL.
|
||||
* This is not mandatory, but it offers a little performance increase.
|
||||
*/
|
||||
# ifdef ZLIB_DLL
|
||||
# if defined(WIN32) && (!defined(__BORLANDC__) || (__BORLANDC__ >= 0x500))
|
||||
# ifdef ZLIB_INTERNAL
|
||||
# define ZEXTERN extern __declspec(dllexport)
|
||||
# else
|
||||
# define ZEXTERN extern __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
# endif /* ZLIB_DLL */
|
||||
/* If building or using zlib with the WINAPI/WINAPIV calling convention,
|
||||
* define ZLIB_WINAPI.
|
||||
* Caution: the standard ZLIB1.DLL is NOT compiled using ZLIB_WINAPI.
|
||||
*/
|
||||
# ifdef ZLIB_WINAPI
|
||||
# ifdef FAR
|
||||
# undef FAR
|
||||
# endif
|
||||
# include <windows.h>
|
||||
/* No need for _export, use ZLIB.DEF instead. */
|
||||
/* For complete Windows compatibility, use WINAPI, not __stdcall. */
|
||||
# define ZEXPORT WINAPI
|
||||
# ifdef WIN32
|
||||
# define ZEXPORTVA WINAPIV
|
||||
# else
|
||||
# define ZEXPORTVA FAR CDECL
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined (__BEOS__)
|
||||
# ifdef ZLIB_DLL
|
||||
# ifdef ZLIB_INTERNAL
|
||||
# define ZEXPORT __declspec(dllexport)
|
||||
# define ZEXPORTVA __declspec(dllexport)
|
||||
# else
|
||||
# define ZEXPORT __declspec(dllimport)
|
||||
# define ZEXPORTVA __declspec(dllimport)
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef ZEXTERN
|
||||
# define ZEXTERN extern
|
||||
#endif
|
||||
#ifndef ZEXPORT
|
||||
# define ZEXPORT
|
||||
#endif
|
||||
#ifndef ZEXPORTVA
|
||||
# define ZEXPORTVA
|
||||
#endif
|
||||
|
||||
#ifndef FAR
|
||||
# define FAR
|
||||
#endif
|
||||
|
||||
#if !defined(__MACTYPES__)
|
||||
typedef unsigned char Byte; /* 8 bits */
|
||||
#endif
|
||||
typedef unsigned int uInt; /* 16 bits or more */
|
||||
typedef unsigned long uLong; /* 32 bits or more */
|
||||
|
||||
#ifdef SMALL_MEDIUM
|
||||
/* Borland C/C++ and some old MSC versions ignore FAR inside typedef */
|
||||
# define Bytef Byte FAR
|
||||
#else
|
||||
typedef Byte FAR Bytef;
|
||||
#endif
|
||||
typedef char FAR charf;
|
||||
typedef int FAR intf;
|
||||
typedef uInt FAR uIntf;
|
||||
typedef uLong FAR uLongf;
|
||||
|
||||
#ifdef STDC
|
||||
typedef void const *voidpc;
|
||||
typedef void FAR *voidpf;
|
||||
typedef void *voidp;
|
||||
#else
|
||||
typedef Byte const *voidpc;
|
||||
typedef Byte FAR *voidpf;
|
||||
typedef Byte *voidp;
|
||||
#endif
|
||||
|
||||
#if 0 /* HAVE_UNISTD_H -- this line is updated by ./configure */
|
||||
# include <sys/types.h> /* for off_t */
|
||||
# include <unistd.h> /* for SEEK_* and off_t */
|
||||
# ifdef VMS
|
||||
# include <unixio.h> /* for off_t */
|
||||
# endif
|
||||
# define z_off_t off_t
|
||||
#endif
|
||||
#ifndef SEEK_SET
|
||||
# define SEEK_SET 0 /* Seek from beginning of file. */
|
||||
# define SEEK_CUR 1 /* Seek from current position. */
|
||||
# define SEEK_END 2 /* Set file pointer to EOF plus "offset" */
|
||||
#endif
|
||||
#ifndef z_off_t
|
||||
# define z_off_t long
|
||||
#endif
|
||||
|
||||
#if defined(__OS400__)
|
||||
# define NO_vsnprintf
|
||||
#endif
|
||||
|
||||
#if defined(__MVS__)
|
||||
# define NO_vsnprintf
|
||||
# ifdef FAR
|
||||
# undef FAR
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* MVS linker does not support external names larger than 8 bytes */
|
||||
#if defined(__MVS__)
|
||||
# pragma map(deflateInit_,"DEIN")
|
||||
# pragma map(deflateInit2_,"DEIN2")
|
||||
# pragma map(deflateEnd,"DEEND")
|
||||
# pragma map(deflateBound,"DEBND")
|
||||
# pragma map(inflateInit_,"ININ")
|
||||
# pragma map(inflateInit2_,"ININ2")
|
||||
# pragma map(inflateEnd,"INEND")
|
||||
# pragma map(inflateSync,"INSY")
|
||||
# pragma map(inflateSetDictionary,"INSEDI")
|
||||
# pragma map(compressBound,"CMBND")
|
||||
# pragma map(inflate_table,"INTABL")
|
||||
# pragma map(inflate_fast,"INFA")
|
||||
# pragma map(inflate_copyright,"INCOPY")
|
||||
#endif
|
||||
|
||||
#endif /* ZCONF_H */
|
File diff suppressed because it is too large
Load Diff
|
@ -1,269 +0,0 @@
|
|||
/* zutil.h -- internal interface and configuration of the compression library
|
||||
* Copyright (C) 1995-2005 Jean-loup Gailly.
|
||||
* For conditions of distribution and use, see copyright notice in zlib.h
|
||||
*/
|
||||
|
||||
/* WARNING: this file should *not* be used by applications. It is
|
||||
part of the implementation of the compression library and is
|
||||
subject to change. Applications should only use zlib.h.
|
||||
*/
|
||||
|
||||
/* @(#) $Id: zutil.h,v 1.2 2006/03/02 00:10:34 zerocool Exp $ */
|
||||
|
||||
#ifndef ZUTIL_H
|
||||
#define ZUTIL_H
|
||||
|
||||
#define ZLIB_INTERNAL
|
||||
#include "zlib.h"
|
||||
|
||||
#ifdef STDC
|
||||
# ifndef _WIN32_WCE
|
||||
# include <stddef.h>
|
||||
# endif
|
||||
# include <string.h>
|
||||
# include <stdlib.h>
|
||||
#endif
|
||||
#ifdef NO_ERRNO_H
|
||||
# ifdef _WIN32_WCE
|
||||
/* The Microsoft C Run-Time Library for Windows CE doesn't have
|
||||
* errno. We define it as a global variable to simplify porting.
|
||||
* Its value is always 0 and should not be used. We rename it to
|
||||
* avoid conflict with other libraries that use the same workaround.
|
||||
*/
|
||||
# define errno z_errno
|
||||
# endif
|
||||
extern int errno;
|
||||
#else
|
||||
# ifndef _WIN32_WCE
|
||||
# include <errno.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef local
|
||||
# define local static
|
||||
#endif
|
||||
/* compile with -Dlocal if your debugger can't find static symbols */
|
||||
|
||||
typedef unsigned char uch;
|
||||
typedef uch FAR uchf;
|
||||
typedef unsigned short ush;
|
||||
typedef ush FAR ushf;
|
||||
typedef unsigned long ulg;
|
||||
|
||||
extern const char * const z_errmsg[10]; /* indexed by 2-zlib_error */
|
||||
/* (size given to avoid silly warnings with Visual C++) */
|
||||
|
||||
#define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)]
|
||||
|
||||
#define ERR_RETURN(strm,err) \
|
||||
return (strm->msg = (char*)ERR_MSG(err), (err))
|
||||
/* To be used only when the state is known to be valid */
|
||||
|
||||
/* common constants */
|
||||
|
||||
#ifndef DEF_WBITS
|
||||
# define DEF_WBITS MAX_WBITS
|
||||
#endif
|
||||
/* default windowBits for decompression. MAX_WBITS is for compression only */
|
||||
|
||||
#if MAX_MEM_LEVEL >= 8
|
||||
# define DEF_MEM_LEVEL 8
|
||||
#else
|
||||
# define DEF_MEM_LEVEL MAX_MEM_LEVEL
|
||||
#endif
|
||||
/* default memLevel */
|
||||
|
||||
#define STORED_BLOCK 0
|
||||
#define STATIC_TREES 1
|
||||
#define DYN_TREES 2
|
||||
/* The three kinds of block type */
|
||||
|
||||
#define MIN_MATCH 3
|
||||
#define MAX_MATCH 258
|
||||
/* The minimum and maximum match lengths */
|
||||
|
||||
#define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */
|
||||
|
||||
/* target dependencies */
|
||||
|
||||
#if defined(MSDOS) || (defined(WINDOWS) && !defined(WIN32))
|
||||
# define OS_CODE 0x00
|
||||
# if defined(__TURBOC__) || defined(__BORLANDC__)
|
||||
# if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__))
|
||||
/* Allow compilation with ANSI keywords only enabled */
|
||||
void _Cdecl farfree( void *block );
|
||||
void *_Cdecl farmalloc( unsigned long nbytes );
|
||||
# else
|
||||
# include <alloc.h>
|
||||
# endif
|
||||
# else /* MSC or DJGPP */
|
||||
# include <malloc.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef AMIGA
|
||||
# define OS_CODE 0x01
|
||||
#endif
|
||||
|
||||
#if defined(VAXC) || defined(VMS)
|
||||
# define OS_CODE 0x02
|
||||
# define F_OPEN(name, mode) \
|
||||
fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512")
|
||||
#endif
|
||||
|
||||
#if defined(ATARI) || defined(atarist)
|
||||
# define OS_CODE 0x05
|
||||
#endif
|
||||
|
||||
#ifdef OS2
|
||||
# define OS_CODE 0x06
|
||||
# ifdef M_I86
|
||||
#include <malloc.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(MACOS) || defined(TARGET_OS_MAC)
|
||||
# define OS_CODE 0x07
|
||||
# if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os
|
||||
# include <unix.h> /* for fdopen */
|
||||
# else
|
||||
# ifndef fdopen
|
||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
||||
# endif
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef TOPS20
|
||||
# define OS_CODE 0x0a
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
# ifndef __CYGWIN__ /* Cygwin is Unix, not Win32 */
|
||||
# define OS_CODE 0x0b
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __50SERIES /* Prime/PRIMOS */
|
||||
# define OS_CODE 0x0f
|
||||
#endif
|
||||
|
||||
#if defined(_BEOS_) || defined(RISCOS)
|
||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
||||
#endif
|
||||
|
||||
#if (defined(_MSC_VER) && (_MSC_VER > 600))
|
||||
# if defined(_WIN32_WCE)
|
||||
# define fdopen(fd,mode) NULL /* No fdopen() */
|
||||
# ifndef _PTRDIFF_T_DEFINED
|
||||
typedef int ptrdiff_t;
|
||||
# define _PTRDIFF_T_DEFINED
|
||||
# endif
|
||||
# else
|
||||
# define fdopen(fd,type) _fdopen(fd,type)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* common defaults */
|
||||
|
||||
#ifndef OS_CODE
|
||||
# define OS_CODE 0x03 /* assume Unix */
|
||||
#endif
|
||||
|
||||
#ifndef F_OPEN
|
||||
# define F_OPEN(name, mode) fopen((name), (mode))
|
||||
#endif
|
||||
|
||||
/* functions */
|
||||
|
||||
#if defined(STDC99) || (defined(__TURBOC__) && __TURBOC__ >= 0x550)
|
||||
# ifndef HAVE_VSNPRINTF
|
||||
# define HAVE_VSNPRINTF
|
||||
# endif
|
||||
#endif
|
||||
#if defined(__CYGWIN__)
|
||||
# ifndef HAVE_VSNPRINTF
|
||||
# define HAVE_VSNPRINTF
|
||||
# endif
|
||||
#endif
|
||||
#ifndef HAVE_VSNPRINTF
|
||||
# ifdef MSDOS
|
||||
/* vsnprintf may exist on some MS-DOS compilers (DJGPP?),
|
||||
but for now we just assume it doesn't. */
|
||||
# define NO_vsnprintf
|
||||
# endif
|
||||
# ifdef __TURBOC__
|
||||
# define NO_vsnprintf
|
||||
# endif
|
||||
# ifdef WIN32
|
||||
/* In Win32, vsnprintf is available as the "non-ANSI" _vsnprintf. */
|
||||
# if !defined(vsnprintf) && !defined(NO_vsnprintf)
|
||||
# define vsnprintf _vsnprintf
|
||||
# endif
|
||||
# endif
|
||||
# ifdef __SASC
|
||||
# define NO_vsnprintf
|
||||
# endif
|
||||
#endif
|
||||
#ifdef VMS
|
||||
# define NO_vsnprintf
|
||||
#endif
|
||||
|
||||
#if defined(pyr)
|
||||
# define NO_MEMCPY
|
||||
#endif
|
||||
#if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__)
|
||||
/* Use our own functions for small and medium model with MSC <= 5.0.
|
||||
* You may have to use the same strategy for Borland C (untested).
|
||||
* The __SC__ check is for Symantec.
|
||||
*/
|
||||
# define NO_MEMCPY
|
||||
#endif
|
||||
#if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY)
|
||||
# define HAVE_MEMCPY
|
||||
#endif
|
||||
#ifdef HAVE_MEMCPY
|
||||
# ifdef SMALL_MEDIUM /* MSDOS small or medium model */
|
||||
# define zmemcpy _fmemcpy
|
||||
# define zmemcmp _fmemcmp
|
||||
# define zmemzero(dest, len) _fmemset(dest, 0, len)
|
||||
# else
|
||||
# define zmemcpy memcpy
|
||||
# define zmemcmp memcmp
|
||||
# define zmemzero(dest, len) memset(dest, 0, len)
|
||||
# endif
|
||||
#else
|
||||
extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len));
|
||||
extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len));
|
||||
extern void zmemzero OF((Bytef* dest, uInt len));
|
||||
#endif
|
||||
|
||||
/* Diagnostic functions */
|
||||
#ifdef DEBUG
|
||||
# include <stdio.h>
|
||||
extern int z_verbose;
|
||||
extern void z_error OF((char *m));
|
||||
# define Assert(cond,msg) {if(!(cond)) z_error(msg);}
|
||||
# define Trace(x) {if (z_verbose>=0) fprintf x ;}
|
||||
# define Tracev(x) {if (z_verbose>0) fprintf x ;}
|
||||
# define Tracevv(x) {if (z_verbose>1) fprintf x ;}
|
||||
# define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;}
|
||||
# define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;}
|
||||
#else
|
||||
# define Assert(cond,msg)
|
||||
# define Trace(x)
|
||||
# define Tracev(x)
|
||||
# define Tracevv(x)
|
||||
# define Tracec(c,x)
|
||||
# define Tracecv(c,x)
|
||||
#endif
|
||||
|
||||
|
||||
voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size));
|
||||
void zcfree OF((voidpf opaque, voidpf ptr));
|
||||
|
||||
#define ZALLOC(strm, items, size) \
|
||||
(*((strm)->zalloc))((strm)->opaque, (items), (size))
|
||||
#define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr))
|
||||
#define TRY_FREE(s, p) {if (p) ZFREE(s, p);}
|
||||
|
||||
#endif /* ZUTIL_H */
|
|
@ -1,115 +0,0 @@
|
|||
// zpipe.cpp : Defines the entry point for the console application.
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <assert.h>
|
||||
|
||||
//#define ZLIB_WINAPI
|
||||
#include <zlib.h>
|
||||
|
||||
int def(char *src, char *dst, int bytes_to_compress, int *bytes_after_compressed) ;
|
||||
int inf(char *src, char *dst, int bytes_to_decompress, int maximum_after_decompress) ;
|
||||
|
||||
int def(char *src, char *dst, int bytes_to_compress, int *bytes_after_compressed)
|
||||
{
|
||||
z_stream strm;
|
||||
|
||||
int ret;//, flush;
|
||||
unsigned have;
|
||||
|
||||
/* allocate deflate state */
|
||||
strm.zalloc = Z_NULL;
|
||||
strm.zfree = Z_NULL;
|
||||
strm.opaque = Z_NULL;
|
||||
ret = deflateInit(&strm, Z_DEFAULT_COMPRESSION) ;
|
||||
if (ret != Z_OK)
|
||||
return ret;
|
||||
|
||||
/* compress */
|
||||
strm.avail_in = bytes_to_compress ;
|
||||
strm.avail_out = bytes_to_compress ;
|
||||
strm.next_in = (Bytef *)src ;
|
||||
strm.next_out = (Bytef *)dst ;
|
||||
|
||||
ret = deflate(&strm, Z_FINISH) ;
|
||||
have = bytes_to_compress - strm.avail_out ;
|
||||
*bytes_after_compressed = have ;
|
||||
|
||||
assert(ret == Z_STREAM_END); /* stream will be complete */
|
||||
|
||||
/* clean up and return */
|
||||
(void)deflateEnd(&strm);
|
||||
return Z_OK;
|
||||
}
|
||||
|
||||
int inf(char *src, char *dst, int bytes_to_decompress, int maximum_after_decompress, int* outbytes)
|
||||
{
|
||||
z_stream strm;
|
||||
|
||||
int ret;
|
||||
//unsigned have;
|
||||
|
||||
/* allocate inflate state */
|
||||
strm.zalloc = Z_NULL;
|
||||
strm.zfree = Z_NULL;
|
||||
strm.opaque = Z_NULL;
|
||||
strm.avail_in = 0;
|
||||
strm.next_in = Z_NULL;
|
||||
ret = inflateInit(&strm);
|
||||
if (ret != Z_OK)
|
||||
return ret;
|
||||
|
||||
/* decompress */
|
||||
strm.avail_in = bytes_to_decompress ;
|
||||
strm.next_in = (Bytef *)src ;
|
||||
strm.next_out = (Bytef *)dst ;
|
||||
strm.avail_out = maximum_after_decompress ;
|
||||
|
||||
ret = inflate(&strm, Z_NO_FLUSH) ;
|
||||
assert(ret != Z_STREAM_ERROR); /* state not clobbered */
|
||||
switch (ret) {
|
||||
case Z_NEED_DICT:
|
||||
ret = Z_DATA_ERROR; /* and fall through */
|
||||
case Z_DATA_ERROR:
|
||||
case Z_MEM_ERROR:
|
||||
(void)inflateEnd(&strm);
|
||||
return ret;
|
||||
}
|
||||
|
||||
assert(strm.avail_in == 0); /* all input will be used */
|
||||
|
||||
if( outbytes != NULL )
|
||||
*outbytes = strm.total_out;
|
||||
|
||||
/* clean up and return */
|
||||
(void)inflateEnd(&strm);
|
||||
return ret == Z_STREAM_END ? Z_OK : Z_DATA_ERROR;
|
||||
}
|
||||
|
||||
/* report a zlib or i/o error */
|
||||
void zerr(int ret)
|
||||
{
|
||||
fputs("zpipe: ", stderr);
|
||||
switch (ret) {
|
||||
case Z_ERRNO:
|
||||
if (ferror(stdin))
|
||||
fputs("error reading stdin\n", stderr);
|
||||
if (ferror(stdout))
|
||||
fputs("error writing stdout\n", stderr);
|
||||
break;
|
||||
case Z_STREAM_ERROR:
|
||||
fputs("invalid compression level\n", stderr);
|
||||
break;
|
||||
case Z_DATA_ERROR:
|
||||
fputs("invalid or incomplete deflate data\n", stderr);
|
||||
break;
|
||||
case Z_MEM_ERROR:
|
||||
fputs("out of memory\n", stderr);
|
||||
break;
|
||||
case Z_VERSION_ERROR:
|
||||
fputs("zlib version mismatch!\n", stderr);
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
#ifndef zpipe_h
|
||||
#define zpipe_h
|
||||
|
||||
int def(char *src, char *dst, int bytes_to_compress, int *bytes_after_compressed) ;
|
||||
int inf(char *src, char *dst, int bytes_to_decompress, int maximum_after_decompress, int* outbytes);
|
||||
|
||||
#endif
|
|
@ -1,3 +0,0 @@
|
|||
ZeroGSShaders.exe ps2hw.fx ps2hw.dat
|
||||
del Win32\ps2hw.dat Win32\Release\*.res Win32\Debug\*.res
|
||||
move /y ps2hw.dat Win32\ps2hw.dat
|
File diff suppressed because it is too large
Load Diff
|
@ -1,881 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* 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 __PS2EDEFS_H__
|
||||
#define __PS2EDEFS_H__
|
||||
|
||||
/*
|
||||
* PS2E Definitions v0.6.2 (beta)
|
||||
*
|
||||
* Author: linuzappz@hotmail.com
|
||||
* shadowpcsx2@yahoo.gr
|
||||
* florinsasu@hotmail.com
|
||||
*/
|
||||
|
||||
/*
|
||||
Notes:
|
||||
* Since this is still beta things may change.
|
||||
|
||||
* OSflags:
|
||||
__linux__ (linux OS)
|
||||
_WIN32 (win32 OS)
|
||||
|
||||
* common return values (for ie. GSinit):
|
||||
0 - success
|
||||
-1 - error
|
||||
|
||||
* reserved keys:
|
||||
F1 to F10 are reserved for the emulator
|
||||
|
||||
* plugins should NOT change the current
|
||||
working directory.
|
||||
(on win32, add flag OFN_NOCHANGEDIR for
|
||||
GetOpenFileName)
|
||||
|
||||
*/
|
||||
|
||||
#include "PS2Etypes.h"
|
||||
|
||||
|
||||
/* common defines */
|
||||
#if defined(GSdefs) || defined(PADdefs) || defined(SIOdefs) || \
|
||||
defined(SPU2defs) || defined(CDVDdefs) || defined(DEV9defs) || \
|
||||
defined(USBdefs) || defined(FWdefs)
|
||||
#define COMMONdefs
|
||||
#endif
|
||||
|
||||
// PS2EgetLibType returns (may be OR'd)
|
||||
#define PS2E_LT_GS 0x01
|
||||
#define PS2E_LT_PAD 0x02 // -=[ OBSOLETE ]=-
|
||||
#define PS2E_LT_SPU2 0x04
|
||||
#define PS2E_LT_CDVD 0x08
|
||||
#define PS2E_LT_DEV9 0x10
|
||||
#define PS2E_LT_USB 0x20
|
||||
#define PS2E_LT_FW 0x40
|
||||
#define PS2E_LT_SIO 0x80
|
||||
|
||||
// PS2EgetLibVersion2 (high 16 bits)
|
||||
#define PS2E_GS_VERSION 0x0006
|
||||
#define PS2E_PAD_VERSION 0x0002 // -=[ OBSOLETE ]=-
|
||||
#define PS2E_SPU2_VERSION 0x0005
|
||||
#define PS2E_CDVD_VERSION 0x0005
|
||||
#define PS2E_DEV9_VERSION 0x0003
|
||||
#define PS2E_USB_VERSION 0x0003
|
||||
#define PS2E_FW_VERSION 0x0002
|
||||
#define PS2E_SIO_VERSION 0x0001
|
||||
#ifdef COMMONdefs
|
||||
|
||||
u32 CALLBACK PS2EgetLibType(void);
|
||||
u32 CALLBACK PS2EgetLibVersion2(u32 type);
|
||||
char* CALLBACK PS2EgetLibName(void);
|
||||
|
||||
#endif
|
||||
|
||||
// key values:
|
||||
/* key values must be OS dependant:
|
||||
win32: the VK_XXX will be used (WinUser)
|
||||
linux: the XK_XXX will be used (XFree86)
|
||||
*/
|
||||
|
||||
// event values:
|
||||
#define KEYPRESS 1
|
||||
#define KEYRELEASE 2
|
||||
|
||||
typedef struct _keyEvent {
|
||||
u32 key;
|
||||
u32 evt;
|
||||
} keyEvent;
|
||||
|
||||
// for 64bit compilers
|
||||
typedef char __keyEvent_Size__[(sizeof(keyEvent) == 8)?1:-1];
|
||||
|
||||
// plugin types
|
||||
#define SIO_TYPE_PAD 0x00000001
|
||||
#define SIO_TYPE_MTAP 0x00000004
|
||||
#define SIO_TYPE_RM 0x00000040
|
||||
#define SIO_TYPE_MC 0x00000100
|
||||
|
||||
typedef int (CALLBACK * SIOchangeSlotCB)(int slot);
|
||||
|
||||
typedef struct _cdvdSubQ {
|
||||
u8 ctrl:4; // control and mode bits
|
||||
u8 mode:4; // control and mode bits
|
||||
u8 trackNum; // current track number (1 to 99)
|
||||
u8 trackIndex; // current index within track (0 to 99)
|
||||
u8 trackM; // current minute location on the disc (BCD encoded)
|
||||
u8 trackS; // current sector location on the disc (BCD encoded)
|
||||
u8 trackF; // current frame location on the disc (BCD encoded)
|
||||
u8 pad; // unused
|
||||
u8 discM; // current minute offset from first track (BCD encoded)
|
||||
u8 discS; // current sector offset from first track (BCD encoded)
|
||||
u8 discF; // current frame offset from first track (BCD encoded)
|
||||
} cdvdSubQ;
|
||||
|
||||
typedef struct _cdvdTD { // NOT bcd coded
|
||||
u32 lsn;
|
||||
u8 type;
|
||||
} cdvdTD;
|
||||
|
||||
typedef struct _cdvdTN {
|
||||
u8 strack; //number of the first track (usually 1)
|
||||
u8 etrack; //number of the last track
|
||||
} cdvdTN;
|
||||
|
||||
// CDVDreadTrack mode values:
|
||||
#define CDVD_MODE_2352 0 // full 2352 bytes
|
||||
#define CDVD_MODE_2340 1 // skip sync (12) bytes
|
||||
#define CDVD_MODE_2328 2 // skip sync+head+sub (24) bytes
|
||||
#define CDVD_MODE_2048 3 // skip sync+head+sub (24) bytes
|
||||
#define CDVD_MODE_2368 4 // full 2352 bytes + 16 subq
|
||||
|
||||
// CDVDgetDiskType returns:
|
||||
#define CDVD_TYPE_ILLEGAL 0xff // Illegal Disc
|
||||
#define CDVD_TYPE_DVDV 0xfe // DVD Video
|
||||
#define CDVD_TYPE_CDDA 0xfd // Audio CD
|
||||
#define CDVD_TYPE_PS2DVD 0x14 // PS2 DVD
|
||||
#define CDVD_TYPE_PS2CDDA 0x13 // PS2 CD (with audio)
|
||||
#define CDVD_TYPE_PS2CD 0x12 // PS2 CD
|
||||
#define CDVD_TYPE_PSCDDA 0x11 // PS CD (with audio)
|
||||
#define CDVD_TYPE_PSCD 0x10 // PS CD
|
||||
#define CDVD_TYPE_UNKNOWN 0x05 // Unknown
|
||||
#define CDVD_TYPE_DETCTDVDD 0x04 // Detecting Dvd Dual Sided
|
||||
#define CDVD_TYPE_DETCTDVDS 0x03 // Detecting Dvd Single Sided
|
||||
#define CDVD_TYPE_DETCTCD 0x02 // Detecting Cd
|
||||
#define CDVD_TYPE_DETCT 0x01 // Detecting
|
||||
#define CDVD_TYPE_NODISC 0x00 // No Disc
|
||||
|
||||
// CDVDgetTrayStatus returns:
|
||||
#define CDVD_TRAY_CLOSE 0x00
|
||||
#define CDVD_TRAY_OPEN 0x01
|
||||
|
||||
// cdvdTD.type (track types for cds)
|
||||
#define CDVD_AUDIO_TRACK 0x01
|
||||
#define CDVD_MODE1_TRACK 0x41
|
||||
#define CDVD_MODE2_TRACK 0x61
|
||||
|
||||
#define CDVD_AUDIO_MASK 0x00
|
||||
#define CDVD_DATA_MASK 0x40
|
||||
// CDROM_DATA_TRACK 0x04 //do not enable this! (from linux kernel)
|
||||
|
||||
typedef void (*DEV9callback)(int cycles);
|
||||
typedef int (*DEV9handler)(void);
|
||||
|
||||
typedef void (*USBcallback)(int cycles);
|
||||
typedef int (*USBhandler)(void);
|
||||
|
||||
// freeze modes:
|
||||
#define FREEZE_LOAD 0
|
||||
#define FREEZE_SAVE 1
|
||||
#define FREEZE_SIZE 2
|
||||
|
||||
typedef struct _GSdriverInfo {
|
||||
char name[8];
|
||||
void *common;
|
||||
} GSdriverInfo;
|
||||
|
||||
#ifdef _WINDOWS_
|
||||
typedef struct _winInfo { // unsupported values must be set to zero
|
||||
HWND hWnd;
|
||||
HMENU hMenu;
|
||||
HWND hStatusWnd;
|
||||
} winInfo;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* GS plugin API */
|
||||
|
||||
// if this file is included with this define
|
||||
// the next api will not be skipped by the compiler
|
||||
#ifdef GSdefs
|
||||
|
||||
// basic funcs
|
||||
|
||||
s32 CALLBACK GSinit();
|
||||
s32 CALLBACK GSopen(void *pDsp, char *Title, int multithread);
|
||||
void CALLBACK GSclose();
|
||||
void CALLBACK GSshutdown();
|
||||
void CALLBACK GSvsync(int field);
|
||||
void CALLBACK GSgifTransfer1(u32 *pMem, u32 addr);
|
||||
void CALLBACK GSgifTransfer2(u32 *pMem, u32 size);
|
||||
void CALLBACK GSgifTransfer3(u32 *pMem, u32 size);
|
||||
void CALLBACK GSgetLastTag(u64* ptag); // returns the last tag processed (64 bits)
|
||||
void CALLBACK GSgifSoftReset(u32 mask);
|
||||
void CALLBACK GSreadFIFO(u64 *mem);
|
||||
void CALLBACK GSreadFIFO2(u64 *mem, int qwc);
|
||||
|
||||
// extended funcs
|
||||
|
||||
// GSkeyEvent gets called when there is a keyEvent from the PAD plugin
|
||||
void CALLBACK GSkeyEvent(keyEvent *ev);
|
||||
void CALLBACK GSchangeSaveState(int, const char* filename);
|
||||
void CALLBACK GSmakeSnapshot(char *path);
|
||||
void CALLBACK GSmakeSnapshot2(char *pathname, int* snapdone, int savejpg);
|
||||
void CALLBACK GSirqCallback(void (*callback)());
|
||||
void CALLBACK GSprintf(int timeout, char *fmt, ...);
|
||||
void CALLBACK GSsetBaseMem(void*);
|
||||
void CALLBACK GSsetGameCRC(int crc, int gameoptions);
|
||||
|
||||
// controls frame skipping in the GS, if this routine isn't present, frame skipping won't be done
|
||||
void CALLBACK GSsetFrameSkip(int frameskip);
|
||||
|
||||
// if start is 1, starts recording spu2 data, else stops
|
||||
// returns a non zero value if successful
|
||||
// for now, pData is not used
|
||||
int CALLBACK GSsetupRecording(int start, void* pData);
|
||||
|
||||
void CALLBACK GSreset();
|
||||
void CALLBACK GSwriteCSR(u32 value);
|
||||
void CALLBACK GSgetDriverInfo(GSdriverInfo *info);
|
||||
#ifdef _WIN32
|
||||
s32 CALLBACK GSsetWindowInfo(winInfo *info);
|
||||
#endif
|
||||
s32 CALLBACK GSfreeze(int mode, freezeData *data);
|
||||
void CALLBACK GSconfigure();
|
||||
void CALLBACK GSabout();
|
||||
s32 CALLBACK GStest();
|
||||
|
||||
#endif
|
||||
|
||||
/* PAD plugin API -=[ OBSOLETE ]=- */
|
||||
|
||||
// if this file is included with this define
|
||||
// the next api will not be skipped by the compiler
|
||||
#ifdef PADdefs
|
||||
|
||||
// basic funcs
|
||||
|
||||
s32 CALLBACK PADinit(u32 flags);
|
||||
s32 CALLBACK PADopen(void *pDsp);
|
||||
void CALLBACK PADclose();
|
||||
void CALLBACK PADshutdown();
|
||||
// PADkeyEvent is called every vsync (return NULL if no event)
|
||||
keyEvent* CALLBACK PADkeyEvent();
|
||||
u8 CALLBACK PADstartPoll(int pad);
|
||||
u8 CALLBACK PADpoll(u8 value);
|
||||
// returns: 1 if supported pad1
|
||||
// 2 if supported pad2
|
||||
// 3 if both are supported
|
||||
u32 CALLBACK PADquery();
|
||||
|
||||
// call to give a hint to the PAD plugin to query for the keyboard state. A
|
||||
// good plugin will query the OS for keyboard state ONLY in this function.
|
||||
// This function is necessary when multithreading because otherwise
|
||||
// the PAD plugin can get into deadlocks with the thread that really owns
|
||||
// the window (and input). Note that PADupdate can be called from a different
|
||||
// thread than the other functions, so mutex or other multithreading primitives
|
||||
// have to be added to maintain data integrity.
|
||||
void CALLBACK PADupdate(int pad);
|
||||
|
||||
// extended funcs
|
||||
|
||||
void CALLBACK PADgsDriverInfo(GSdriverInfo *info);
|
||||
void CALLBACK PADconfigure();
|
||||
void CALLBACK PADabout();
|
||||
s32 CALLBACK PADtest();
|
||||
|
||||
#endif
|
||||
|
||||
/* SIO plugin API */
|
||||
|
||||
// if this file is included with this define
|
||||
// the next api will not be skipped by the compiler
|
||||
#ifdef SIOdefs
|
||||
|
||||
// basic funcs
|
||||
|
||||
s32 CALLBACK SIOinit(u32 port, u32 slot, SIOchangeSlotCB f);
|
||||
s32 CALLBACK SIOopen(void *pDsp);
|
||||
void CALLBACK SIOclose();
|
||||
void CALLBACK SIOshutdown();
|
||||
u8 CALLBACK SIOstartPoll(u8 value);
|
||||
u8 CALLBACK SIOpoll(u8 value);
|
||||
// returns: SIO_TYPE_{PAD,MTAP,RM,MC}
|
||||
u32 CALLBACK SIOquery();
|
||||
|
||||
// extended funcs
|
||||
|
||||
void CALLBACK SIOconfigure();
|
||||
void CALLBACK SIOabout();
|
||||
s32 CALLBACK SIOtest();
|
||||
|
||||
#endif
|
||||
|
||||
/* SPU2 plugin API */
|
||||
|
||||
// if this file is included with this define
|
||||
// the next api will not be skipped by the compiler
|
||||
#ifdef SPU2defs
|
||||
|
||||
// basic funcs
|
||||
|
||||
s32 CALLBACK SPU2init();
|
||||
s32 CALLBACK SPU2open(void *pDsp);
|
||||
void CALLBACK SPU2close();
|
||||
void CALLBACK SPU2shutdown();
|
||||
void CALLBACK SPU2write(u32 mem, u16 value);
|
||||
u16 CALLBACK SPU2read(u32 mem);
|
||||
void CALLBACK SPU2readDMA4Mem(u16 *pMem, int size);
|
||||
void CALLBACK SPU2writeDMA4Mem(u16 *pMem, int size);
|
||||
void CALLBACK SPU2interruptDMA4();
|
||||
void CALLBACK SPU2readDMA7Mem(u16* pMem, int size);
|
||||
void CALLBACK SPU2writeDMA7Mem(u16 *pMem, int size);
|
||||
|
||||
// all addresses passed by dma will be pointers to the array starting at baseaddr
|
||||
// This function is necessary to successfully save and reload the spu2 state
|
||||
void CALLBACK SPU2setDMABaseAddr(uptr baseaddr);
|
||||
|
||||
void CALLBACK SPU2interruptDMA7();
|
||||
u32 CALLBACK SPU2ReadMemAddr(int core);
|
||||
void CALLBACK SPU2WriteMemAddr(int core,u32 value);
|
||||
void CALLBACK SPU2irqCallback(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)());
|
||||
|
||||
// extended funcs
|
||||
// if start is 1, starts recording spu2 data, else stops
|
||||
// returns a non zero value if successful
|
||||
// for now, pData is not used
|
||||
int CALLBACK SPU2setupRecording(int start, void* pData);
|
||||
|
||||
void CALLBACK SPU2setClockPtr(u32* ptr);
|
||||
void CALLBACK SPU2setTimeStretcher(short int enable);
|
||||
|
||||
void CALLBACK SPU2async(u32 cycles);
|
||||
s32 CALLBACK SPU2freeze(int mode, freezeData *data);
|
||||
void CALLBACK SPU2configure();
|
||||
void CALLBACK SPU2about();
|
||||
s32 CALLBACK SPU2test();
|
||||
|
||||
#endif
|
||||
|
||||
/* CDVD plugin API */
|
||||
|
||||
// if this file is included with this define
|
||||
// the next api will not be skipped by the compiler
|
||||
#ifdef CDVDdefs
|
||||
|
||||
// basic funcs
|
||||
|
||||
s32 CALLBACK CDVDinit();
|
||||
s32 CALLBACK CDVDopen(const char* pTitleFilename);
|
||||
void CALLBACK CDVDclose();
|
||||
void CALLBACK CDVDshutdown();
|
||||
s32 CALLBACK CDVDreadTrack(u32 lsn, int mode);
|
||||
|
||||
// return can be NULL (for async modes)
|
||||
u8* CALLBACK CDVDgetBuffer();
|
||||
|
||||
s32 CALLBACK CDVDreadSubQ(u32 lsn, cdvdSubQ* subq);//read subq from disc (only cds have subq data)
|
||||
s32 CALLBACK CDVDgetTN(cdvdTN *Buffer); //disk information
|
||||
s32 CALLBACK CDVDgetTD(u8 Track, cdvdTD *Buffer); //track info: min,sec,frame,type
|
||||
s32 CALLBACK CDVDgetTOC(void* toc); //gets ps2 style toc from disc
|
||||
s32 CALLBACK CDVDgetDiskType(); //CDVD_TYPE_xxxx
|
||||
s32 CALLBACK CDVDgetTrayStatus(); //CDVD_TRAY_xxxx
|
||||
s32 CALLBACK CDVDctrlTrayOpen(); //open disc tray
|
||||
s32 CALLBACK CDVDctrlTrayClose(); //close disc tray
|
||||
|
||||
// extended funcs
|
||||
|
||||
void CALLBACK CDVDconfigure();
|
||||
void CALLBACK CDVDabout();
|
||||
s32 CALLBACK CDVDtest();
|
||||
void CALLBACK CDVDnewDiskCB(void (*callback)());
|
||||
|
||||
#endif
|
||||
|
||||
/* DEV9 plugin API */
|
||||
|
||||
// if this file is included with this define
|
||||
// the next api will not be skipped by the compiler
|
||||
#ifdef DEV9defs
|
||||
|
||||
// basic funcs
|
||||
|
||||
// NOTE: The read/write functions CANNOT use XMM/MMX regs
|
||||
// If you want to use them, need to save and restore current ones
|
||||
s32 CALLBACK DEV9init();
|
||||
s32 CALLBACK DEV9open(void *pDsp);
|
||||
void CALLBACK DEV9close();
|
||||
void CALLBACK DEV9shutdown();
|
||||
u8 CALLBACK DEV9read8(u32 addr);
|
||||
u16 CALLBACK DEV9read16(u32 addr);
|
||||
u32 CALLBACK DEV9read32(u32 addr);
|
||||
void CALLBACK DEV9write8(u32 addr, u8 value);
|
||||
void CALLBACK DEV9write16(u32 addr, u16 value);
|
||||
void CALLBACK DEV9write32(u32 addr, u32 value);
|
||||
void CALLBACK DEV9readDMA8Mem(u32 *pMem, int size);
|
||||
void CALLBACK DEV9writeDMA8Mem(u32 *pMem, int size);
|
||||
// cycles = IOP cycles before calling callback,
|
||||
// if callback returns 1 the irq is triggered, else not
|
||||
void CALLBACK DEV9irqCallback(DEV9callback callback);
|
||||
DEV9handler CALLBACK DEV9irqHandler(void);
|
||||
|
||||
// extended funcs
|
||||
|
||||
s32 CALLBACK DEV9freeze(int mode, freezeData *data);
|
||||
void CALLBACK DEV9configure();
|
||||
void CALLBACK DEV9about();
|
||||
s32 CALLBACK DEV9test();
|
||||
|
||||
#endif
|
||||
|
||||
/* USB plugin API */
|
||||
|
||||
// if this file is included with this define
|
||||
// the next api will not be skipped by the compiler
|
||||
#ifdef USBdefs
|
||||
|
||||
// basic funcs
|
||||
|
||||
s32 CALLBACK USBinit();
|
||||
s32 CALLBACK USBopen(void *pDsp);
|
||||
void CALLBACK USBclose();
|
||||
void CALLBACK USBshutdown();
|
||||
u8 CALLBACK USBread8(u32 addr);
|
||||
u16 CALLBACK USBread16(u32 addr);
|
||||
u32 CALLBACK USBread32(u32 addr);
|
||||
void CALLBACK USBwrite8(u32 addr, u8 value);
|
||||
void CALLBACK USBwrite16(u32 addr, u16 value);
|
||||
void CALLBACK USBwrite32(u32 addr, u32 value);
|
||||
void CALLBACK USBasync(u32 cycles);
|
||||
|
||||
// cycles = IOP cycles before calling callback,
|
||||
// if callback returns 1 the irq is triggered, else not
|
||||
void CALLBACK USBirqCallback(USBcallback callback);
|
||||
USBhandler CALLBACK USBirqHandler(void);
|
||||
void CALLBACK USBsetRAM(void *mem);
|
||||
|
||||
// extended funcs
|
||||
|
||||
s32 CALLBACK USBfreeze(int mode, freezeData *data);
|
||||
void CALLBACK USBconfigure();
|
||||
void CALLBACK USBabout();
|
||||
s32 CALLBACK USBtest();
|
||||
|
||||
#endif
|
||||
|
||||
/* FW plugin API */
|
||||
|
||||
// if this file is included with this define
|
||||
// the next api will not be skipped by the compiler
|
||||
#ifdef FWdefs
|
||||
// basic funcs
|
||||
|
||||
// NOTE: The read/write functions CANNOT use XMM/MMX regs
|
||||
// If you want to use them, need to save and restore current ones
|
||||
s32 CALLBACK FWinit();
|
||||
s32 CALLBACK FWopen(void *pDsp);
|
||||
void CALLBACK FWclose();
|
||||
void CALLBACK FWshutdown();
|
||||
u32 CALLBACK FWread32(u32 addr);
|
||||
void CALLBACK FWwrite32(u32 addr, u32 value);
|
||||
void CALLBACK FWirqCallback(void (*callback)());
|
||||
|
||||
// extended funcs
|
||||
|
||||
s32 CALLBACK FWfreeze(int mode, freezeData *data);
|
||||
void CALLBACK FWconfigure();
|
||||
void CALLBACK FWabout();
|
||||
s32 CALLBACK FWtest();
|
||||
#endif
|
||||
|
||||
// might be useful for emulators
|
||||
#ifdef PLUGINtypedefs
|
||||
|
||||
typedef u32 (CALLBACK* _PS2EgetLibType)(void);
|
||||
typedef u32 (CALLBACK* _PS2EgetLibVersion2)(u32 type);
|
||||
typedef char*(CALLBACK* _PS2EgetLibName)(void);
|
||||
|
||||
// GS
|
||||
// NOTE: GSreadFIFOX/GSwriteCSR functions CANNOT use XMM/MMX regs
|
||||
// If you want to use them, need to save and restore current ones
|
||||
typedef s32 (CALLBACK* _GSinit)();
|
||||
typedef s32 (CALLBACK* _GSopen)(void *pDsp, char *Title, int multithread);
|
||||
typedef void (CALLBACK* _GSclose)();
|
||||
typedef void (CALLBACK* _GSshutdown)();
|
||||
typedef void (CALLBACK* _GSvsync)(int field);
|
||||
typedef void (CALLBACK* _GSgifTransfer1)(u32 *pMem, u32 addr);
|
||||
typedef void (CALLBACK* _GSgifTransfer2)(u32 *pMem, u32 size);
|
||||
typedef void (CALLBACK* _GSgifTransfer3)(u32 *pMem, u32 size);
|
||||
typedef void (CALLBACK* _GSgetLastTag)(u64* ptag); // returns the last tag processed (64 bits)
|
||||
typedef void (CALLBACK* _GSgifSoftReset)(u32 mask);
|
||||
typedef void (CALLBACK* _GSreadFIFO)(u64 *pMem);
|
||||
typedef void (CALLBACK* _GSreadFIFO2)(u64 *pMem, int qwc);
|
||||
|
||||
typedef void (CALLBACK* _GSkeyEvent)(keyEvent* ev);
|
||||
typedef void (CALLBACK* _GSchangeSaveState)(int, const char* filename);
|
||||
typedef void (CALLBACK* _GSirqCallback)(void (*callback)());
|
||||
typedef void (CALLBACK* _GSprintf)(int timeout, char *fmt, ...);
|
||||
typedef void (CALLBACK* _GSsetBaseMem)(void*);
|
||||
typedef void (CALLBACK* _GSsetGameCRC)(int, int);
|
||||
typedef void (CALLBACK* _GSsetFrameSkip)(int frameskip);
|
||||
typedef int (CALLBACK* _GSsetupRecording)(int, void*);
|
||||
typedef void (CALLBACK* _GSreset)();
|
||||
typedef void (CALLBACK* _GSwriteCSR)(u32 value);
|
||||
typedef void (CALLBACK* _GSgetDriverInfo)(GSdriverInfo *info);
|
||||
#ifdef _WINDOWS_
|
||||
typedef s32 (CALLBACK* _GSsetWindowInfo)(winInfo *info);
|
||||
#endif
|
||||
typedef void (CALLBACK* _GSmakeSnapshot)(const char *path);
|
||||
typedef void (CALLBACK* _GSmakeSnapshot2)(const char *path, int*, int);
|
||||
typedef s32 (CALLBACK* _GSfreeze)(int mode, freezeData *data);
|
||||
typedef void (CALLBACK* _GSconfigure)();
|
||||
typedef s32 (CALLBACK* _GStest)();
|
||||
typedef void (CALLBACK* _GSabout)();
|
||||
|
||||
// PAD
|
||||
typedef s32 (CALLBACK* _PADinit)(u32 flags);
|
||||
typedef s32 (CALLBACK* _PADopen)(void *pDsp);
|
||||
typedef void (CALLBACK* _PADclose)();
|
||||
typedef void (CALLBACK* _PADshutdown)();
|
||||
typedef keyEvent* (CALLBACK* _PADkeyEvent)();
|
||||
typedef u8 (CALLBACK* _PADstartPoll)(int pad);
|
||||
typedef u8 (CALLBACK* _PADpoll)(u8 value);
|
||||
typedef u32 (CALLBACK* _PADquery)();
|
||||
typedef void (CALLBACK* _PADupdate)(int pad);
|
||||
|
||||
typedef void (CALLBACK* _PADgsDriverInfo)(GSdriverInfo *info);
|
||||
typedef void (CALLBACK* _PADconfigure)();
|
||||
typedef s32 (CALLBACK* _PADtest)();
|
||||
typedef void (CALLBACK* _PADabout)();
|
||||
|
||||
// SIO
|
||||
typedef s32 (CALLBACK* _SIOinit)(u32 port, u32 slot, SIOchangeSlotCB f);
|
||||
typedef s32 (CALLBACK* _SIOopen)(void *pDsp);
|
||||
typedef void (CALLBACK* _SIOclose)();
|
||||
typedef void (CALLBACK* _SIOshutdown)();
|
||||
typedef u8 (CALLBACK* _SIOstartPoll)(u8 value);
|
||||
typedef u8 (CALLBACK* _SIOpoll)(u8 value);
|
||||
typedef u32 (CALLBACK* _SIOquery)();
|
||||
|
||||
typedef void (CALLBACK* _SIOconfigure)();
|
||||
typedef s32 (CALLBACK* _SIOtest)();
|
||||
typedef void (CALLBACK* _SIOabout)();
|
||||
|
||||
// SPU2
|
||||
// NOTE: The read/write functions CANNOT use XMM/MMX regs
|
||||
// If you want to use them, need to save and restore current ones
|
||||
typedef s32 (CALLBACK* _SPU2init)();
|
||||
typedef s32 (CALLBACK* _SPU2open)(void *pDsp);
|
||||
typedef void (CALLBACK* _SPU2close)();
|
||||
typedef void (CALLBACK* _SPU2shutdown)();
|
||||
typedef void (CALLBACK* _SPU2write)(u32 mem, u16 value);
|
||||
typedef u16 (CALLBACK* _SPU2read)(u32 mem);
|
||||
typedef void (CALLBACK* _SPU2readDMA4Mem)(u16 *pMem, int size);
|
||||
typedef void (CALLBACK* _SPU2writeDMA4Mem)(u16 *pMem, int size);
|
||||
typedef void (CALLBACK* _SPU2interruptDMA4)();
|
||||
typedef void (CALLBACK* _SPU2readDMA7Mem)(u16 *pMem, int size);
|
||||
typedef void (CALLBACK* _SPU2writeDMA7Mem)(u16 *pMem, int size);
|
||||
typedef void (CALLBACK* _SPU2setDMABaseAddr)(uptr baseaddr);
|
||||
typedef void (CALLBACK* _SPU2interruptDMA7)();
|
||||
typedef void (CALLBACK* _SPU2irqCallback)(void (*SPU2callback)(),void (*DMA4callback)(),void (*DMA7callback)());
|
||||
typedef int (CALLBACK* _SPU2setupRecording)(int, void*);
|
||||
|
||||
typedef void (CALLBACK* _SPU2setClockPtr)(u32*ptr);
|
||||
typedef void (CALLBACK* _SPU2setTimeStretcher)(short int enable);
|
||||
|
||||
typedef u32 (CALLBACK* _SPU2ReadMemAddr)(int core);
|
||||
typedef void (CALLBACK* _SPU2WriteMemAddr)(int core,u32 value);
|
||||
typedef void (CALLBACK* _SPU2async)(u32 cycles);
|
||||
typedef s32 (CALLBACK* _SPU2freeze)(int mode, freezeData *data);
|
||||
typedef void (CALLBACK* _SPU2configure)();
|
||||
typedef s32 (CALLBACK* _SPU2test)();
|
||||
typedef void (CALLBACK* _SPU2about)();
|
||||
|
||||
|
||||
// CDVD
|
||||
// NOTE: The read/write functions CANNOT use XMM/MMX regs
|
||||
// If you want to use them, need to save and restore current ones
|
||||
typedef s32 (CALLBACK* _CDVDinit)();
|
||||
typedef s32 (CALLBACK* _CDVDopen)(const char* pTitleFilename);
|
||||
typedef void (CALLBACK* _CDVDclose)();
|
||||
typedef void (CALLBACK* _CDVDshutdown)();
|
||||
typedef s32 (CALLBACK* _CDVDreadTrack)(u32 lsn, int mode);
|
||||
typedef u8* (CALLBACK* _CDVDgetBuffer)();
|
||||
typedef s32 (CALLBACK* _CDVDreadSubQ)(u32 lsn, cdvdSubQ* subq);
|
||||
typedef s32 (CALLBACK* _CDVDgetTN)(cdvdTN *Buffer);
|
||||
typedef s32 (CALLBACK* _CDVDgetTD)(u8 Track, cdvdTD *Buffer);
|
||||
typedef s32 (CALLBACK* _CDVDgetTOC)(void* toc);
|
||||
typedef s32 (CALLBACK* _CDVDgetDiskType)();
|
||||
typedef s32 (CALLBACK* _CDVDgetTrayStatus)();
|
||||
typedef s32 (CALLBACK* _CDVDctrlTrayOpen)();
|
||||
typedef s32 (CALLBACK* _CDVDctrlTrayClose)();
|
||||
|
||||
typedef void (CALLBACK* _CDVDconfigure)();
|
||||
typedef s32 (CALLBACK* _CDVDtest)();
|
||||
typedef void (CALLBACK* _CDVDabout)();
|
||||
typedef void (CALLBACK* _CDVDnewDiskCB)(void (*callback)());
|
||||
|
||||
// DEV9
|
||||
// NOTE: The read/write functions CANNOT use XMM/MMX regs
|
||||
// If you want to use them, need to save and restore current ones
|
||||
typedef s32 (CALLBACK* _DEV9init)();
|
||||
typedef s32 (CALLBACK* _DEV9open)(void *pDsp);
|
||||
typedef void (CALLBACK* _DEV9close)();
|
||||
typedef void (CALLBACK* _DEV9shutdown)();
|
||||
typedef u8 (CALLBACK* _DEV9read8)(u32 mem);
|
||||
typedef u16 (CALLBACK* _DEV9read16)(u32 mem);
|
||||
typedef u32 (CALLBACK* _DEV9read32)(u32 mem);
|
||||
typedef void (CALLBACK* _DEV9write8)(u32 mem, u8 value);
|
||||
typedef void (CALLBACK* _DEV9write16)(u32 mem, u16 value);
|
||||
typedef void (CALLBACK* _DEV9write32)(u32 mem, u32 value);
|
||||
typedef void (CALLBACK* _DEV9readDMA8Mem)(u32 *pMem, int size);
|
||||
typedef void (CALLBACK* _DEV9writeDMA8Mem)(u32 *pMem, int size);
|
||||
typedef void (CALLBACK* _DEV9irqCallback)(DEV9callback callback);
|
||||
typedef DEV9handler (CALLBACK* _DEV9irqHandler)(void);
|
||||
|
||||
typedef s32 (CALLBACK* _DEV9freeze)(int mode, freezeData *data);
|
||||
typedef void (CALLBACK* _DEV9configure)();
|
||||
typedef s32 (CALLBACK* _DEV9test)();
|
||||
typedef void (CALLBACK* _DEV9about)();
|
||||
|
||||
// USB
|
||||
// NOTE: The read/write functions CANNOT use XMM/MMX regs
|
||||
// If you want to use them, need to save and restore current ones
|
||||
typedef s32 (CALLBACK* _USBinit)();
|
||||
typedef s32 (CALLBACK* _USBopen)(void *pDsp);
|
||||
typedef void (CALLBACK* _USBclose)();
|
||||
typedef void (CALLBACK* _USBshutdown)();
|
||||
typedef u8 (CALLBACK* _USBread8)(u32 mem);
|
||||
typedef u16 (CALLBACK* _USBread16)(u32 mem);
|
||||
typedef u32 (CALLBACK* _USBread32)(u32 mem);
|
||||
typedef void (CALLBACK* _USBwrite8)(u32 mem, u8 value);
|
||||
typedef void (CALLBACK* _USBwrite16)(u32 mem, u16 value);
|
||||
typedef void (CALLBACK* _USBwrite32)(u32 mem, u32 value);
|
||||
typedef void (CALLBACK* _USBasync)(u32 cycles);
|
||||
|
||||
|
||||
typedef void (CALLBACK* _USBirqCallback)(USBcallback callback);
|
||||
typedef USBhandler (CALLBACK* _USBirqHandler)(void);
|
||||
typedef void (CALLBACK* _USBsetRAM)(void *mem);
|
||||
|
||||
typedef s32 (CALLBACK* _USBfreeze)(int mode, freezeData *data);
|
||||
typedef void (CALLBACK* _USBconfigure)();
|
||||
typedef s32 (CALLBACK* _USBtest)();
|
||||
typedef void (CALLBACK* _USBabout)();
|
||||
|
||||
//FW
|
||||
typedef s32 (CALLBACK* _FWinit)();
|
||||
typedef s32 (CALLBACK* _FWopen)(void *pDsp);
|
||||
typedef void (CALLBACK* _FWclose)();
|
||||
typedef void (CALLBACK* _FWshutdown)();
|
||||
typedef u32 (CALLBACK* _FWread32)(u32 mem);
|
||||
typedef void (CALLBACK* _FWwrite32)(u32 mem, u32 value);
|
||||
typedef void (CALLBACK* _FWirqCallback)(void (*callback)());
|
||||
|
||||
typedef s32 (CALLBACK* _FWfreeze)(int mode, freezeData *data);
|
||||
typedef void (CALLBACK* _FWconfigure)();
|
||||
typedef s32 (CALLBACK* _FWtest)();
|
||||
typedef void (CALLBACK* _FWabout)();
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef PLUGINfuncs
|
||||
|
||||
// GS
|
||||
extern _GSinit GSinit;
|
||||
extern _GSopen GSopen;
|
||||
extern _GSclose GSclose;
|
||||
extern _GSshutdown GSshutdown;
|
||||
extern _GSvsync GSvsync;
|
||||
extern _GSgifTransfer1 GSgifTransfer1;
|
||||
extern _GSgifTransfer2 GSgifTransfer2;
|
||||
extern _GSgifTransfer3 GSgifTransfer3;
|
||||
extern _GSgetLastTag GSgetLastTag;
|
||||
extern _GSgifSoftReset GSgifSoftReset;
|
||||
extern _GSreadFIFO GSreadFIFO;
|
||||
extern _GSreadFIFO2 GSreadFIFO2;
|
||||
|
||||
extern _GSkeyEvent GSkeyEvent;
|
||||
extern _GSchangeSaveState GSchangeSaveState;
|
||||
extern _GSmakeSnapshot GSmakeSnapshot;
|
||||
extern _GSmakeSnapshot2 GSmakeSnapshot2;
|
||||
extern _GSirqCallback GSirqCallback;
|
||||
extern _GSprintf GSprintf;
|
||||
extern _GSsetBaseMem GSsetBaseMem;
|
||||
extern _GSsetGameCRC GSsetGameCRC;
|
||||
extern _GSsetFrameSkip GSsetFrameSkip;
|
||||
extern _GSsetupRecording GSsetupRecording;
|
||||
extern _GSreset GSreset;
|
||||
extern _GSwriteCSR GSwriteCSR;
|
||||
extern _GSgetDriverInfo GSgetDriverInfo;
|
||||
#ifdef _WINDOWS_
|
||||
extern _GSsetWindowInfo GSsetWindowInfo;
|
||||
#endif
|
||||
extern _GSfreeze GSfreeze;
|
||||
extern _GSconfigure GSconfigure;
|
||||
extern _GStest GStest;
|
||||
extern _GSabout GSabout;
|
||||
|
||||
// PAD1
|
||||
extern _PADinit PAD1init;
|
||||
extern _PADopen PAD1open;
|
||||
extern _PADclose PAD1close;
|
||||
extern _PADshutdown PAD1shutdown;
|
||||
extern _PADkeyEvent PAD1keyEvent;
|
||||
extern _PADstartPoll PAD1startPoll;
|
||||
extern _PADpoll PAD1poll;
|
||||
extern _PADquery PAD1query;
|
||||
extern _PADupdate PAD1update;
|
||||
|
||||
extern _PADgsDriverInfo PAD1gsDriverInfo;
|
||||
extern _PADconfigure PAD1configure;
|
||||
extern _PADtest PAD1test;
|
||||
extern _PADabout PAD1about;
|
||||
|
||||
// PAD2
|
||||
extern _PADinit PAD2init;
|
||||
extern _PADopen PAD2open;
|
||||
extern _PADclose PAD2close;
|
||||
extern _PADshutdown PAD2shutdown;
|
||||
extern _PADkeyEvent PAD2keyEvent;
|
||||
extern _PADstartPoll PAD2startPoll;
|
||||
extern _PADpoll PAD2poll;
|
||||
extern _PADquery PAD2query;
|
||||
extern _PADupdate PAD2update;
|
||||
|
||||
extern _PADgsDriverInfo PAD2gsDriverInfo;
|
||||
extern _PADconfigure PAD2configure;
|
||||
extern _PADtest PAD2test;
|
||||
extern _PADabout PAD2about;
|
||||
|
||||
// SIO[2]
|
||||
extern _SIOinit SIOinit[2][9];
|
||||
extern _SIOopen SIOopen[2][9];
|
||||
extern _SIOclose SIOclose[2][9];
|
||||
extern _SIOshutdown SIOshutdown[2][9];
|
||||
extern _SIOstartPoll SIOstartPoll[2][9];
|
||||
extern _SIOpoll SIOpoll[2][9];
|
||||
extern _SIOquery SIOquery[2][9];
|
||||
|
||||
extern _SIOconfigure SIOconfigure[2][9];
|
||||
extern _SIOtest SIOtest[2][9];
|
||||
extern _SIOabout SIOabout[2][9];
|
||||
|
||||
// SPU2
|
||||
extern _SPU2init SPU2init;
|
||||
extern _SPU2open SPU2open;
|
||||
extern _SPU2close SPU2close;
|
||||
extern _SPU2shutdown SPU2shutdown;
|
||||
extern _SPU2write SPU2write;
|
||||
extern _SPU2read SPU2read;
|
||||
extern _SPU2readDMA4Mem SPU2readDMA4Mem;
|
||||
extern _SPU2writeDMA4Mem SPU2writeDMA4Mem;
|
||||
extern _SPU2interruptDMA4 SPU2interruptDMA4;
|
||||
extern _SPU2readDMA7Mem SPU2readDMA7Mem;
|
||||
extern _SPU2writeDMA7Mem SPU2writeDMA7Mem;
|
||||
extern _SPU2setDMABaseAddr SPU2setDMABaseAddr;
|
||||
extern _SPU2interruptDMA7 SPU2interruptDMA7;
|
||||
extern _SPU2ReadMemAddr SPU2ReadMemAddr;
|
||||
extern _SPU2setupRecording SPU2setupRecording;
|
||||
extern _SPU2WriteMemAddr SPU2WriteMemAddr;
|
||||
extern _SPU2irqCallback SPU2irqCallback;
|
||||
|
||||
extern _SPU2setClockPtr SPU2setClockPtr;
|
||||
extern _SPU2setTimeStretcher SPU2setTimeStretcher;
|
||||
|
||||
extern _SPU2async SPU2async;
|
||||
extern _SPU2freeze SPU2freeze;
|
||||
extern _SPU2configure SPU2configure;
|
||||
extern _SPU2test SPU2test;
|
||||
extern _SPU2about SPU2about;
|
||||
|
||||
// CDVD
|
||||
extern _CDVDinit CDVDinit;
|
||||
extern _CDVDopen CDVDopen;
|
||||
extern _CDVDclose CDVDclose;
|
||||
extern _CDVDshutdown CDVDshutdown;
|
||||
extern _CDVDreadTrack CDVDreadTrack;
|
||||
extern _CDVDgetBuffer CDVDgetBuffer;
|
||||
extern _CDVDreadSubQ CDVDreadSubQ;
|
||||
extern _CDVDgetTN CDVDgetTN;
|
||||
extern _CDVDgetTD CDVDgetTD;
|
||||
extern _CDVDgetTOC CDVDgetTOC;
|
||||
extern _CDVDgetDiskType CDVDgetDiskType;
|
||||
extern _CDVDgetTrayStatus CDVDgetTrayStatus;
|
||||
extern _CDVDctrlTrayOpen CDVDctrlTrayOpen;
|
||||
extern _CDVDctrlTrayClose CDVDctrlTrayClose;
|
||||
|
||||
extern _CDVDconfigure CDVDconfigure;
|
||||
extern _CDVDtest CDVDtest;
|
||||
extern _CDVDabout CDVDabout;
|
||||
extern _CDVDnewDiskCB CDVDnewDiskCB;
|
||||
|
||||
// DEV9
|
||||
extern _DEV9init DEV9init;
|
||||
extern _DEV9open DEV9open;
|
||||
extern _DEV9close DEV9close;
|
||||
extern _DEV9shutdown DEV9shutdown;
|
||||
extern _DEV9read8 DEV9read8;
|
||||
extern _DEV9read16 DEV9read16;
|
||||
extern _DEV9read32 DEV9read32;
|
||||
extern _DEV9write8 DEV9write8;
|
||||
extern _DEV9write16 DEV9write16;
|
||||
extern _DEV9write32 DEV9write32;
|
||||
extern _DEV9readDMA8Mem DEV9readDMA8Mem;
|
||||
extern _DEV9writeDMA8Mem DEV9writeDMA8Mem;
|
||||
extern _DEV9irqCallback DEV9irqCallback;
|
||||
extern _DEV9irqHandler DEV9irqHandler;
|
||||
|
||||
extern _DEV9configure DEV9configure;
|
||||
extern _DEV9freeze DEV9freeze;
|
||||
extern _DEV9test DEV9test;
|
||||
extern _DEV9about DEV9about;
|
||||
|
||||
// USB
|
||||
extern _USBinit USBinit;
|
||||
extern _USBopen USBopen;
|
||||
extern _USBclose USBclose;
|
||||
extern _USBshutdown USBshutdown;
|
||||
extern _USBread8 USBread8;
|
||||
extern _USBread16 USBread16;
|
||||
extern _USBread32 USBread32;
|
||||
extern _USBwrite8 USBwrite8;
|
||||
extern _USBwrite16 USBwrite16;
|
||||
extern _USBwrite32 USBwrite32;
|
||||
extern _USBasync USBasync;
|
||||
|
||||
extern _USBirqCallback USBirqCallback;
|
||||
extern _USBirqHandler USBirqHandler;
|
||||
extern _USBsetRAM USBsetRAM;
|
||||
|
||||
extern _USBconfigure USBconfigure;
|
||||
extern _USBfreeze USBfreeze;
|
||||
extern _USBtest USBtest;
|
||||
extern _USBabout USBabout;
|
||||
|
||||
// FW
|
||||
extern _FWinit FWinit;
|
||||
extern _FWopen FWopen;
|
||||
extern _FWclose FWclose;
|
||||
extern _FWshutdown FWshutdown;
|
||||
extern _FWread32 FWread32;
|
||||
extern _FWwrite32 FWwrite32;
|
||||
extern _FWirqCallback FWirqCallback;
|
||||
|
||||
extern _FWconfigure FWconfigure;
|
||||
extern _FWfreeze FWfreeze;
|
||||
extern _FWtest FWtest;
|
||||
extern _FWabout FWabout;
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // End extern "C"
|
||||
#endif
|
||||
|
||||
#endif /* __PS2EDEFS_H__ */
|
|
@ -1,188 +0,0 @@
|
|||
/* Pcsx2 - Pc Ps2 Emulator
|
||||
* Copyright (C) 2002-2008 Pcsx2 Team
|
||||
*
|
||||
* 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 __PS2ETYPES_H__
|
||||
#define __PS2ETYPES_H__
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#define __linux__
|
||||
#endif
|
||||
|
||||
#ifndef ArraySize
|
||||
#define ArraySize(x) (sizeof(x)/sizeof((x)[0]))
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
#define CALLBACK
|
||||
#else
|
||||
#define CALLBACK __stdcall
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#define UNREACHABLE_CODE __assume(0)
|
||||
#else
|
||||
#define UNREACHABLE_CODE __builtin_unreachable()
|
||||
#endif
|
||||
|
||||
// disable the default case in a switch
|
||||
#define jNO_DEFAULT \
|
||||
{ \
|
||||
break; \
|
||||
\
|
||||
default: \
|
||||
UNREACHABLE_CODE; \
|
||||
break; \
|
||||
}
|
||||
|
||||
|
||||
// Basic types
|
||||
#if defined(_MSC_VER)
|
||||
|
||||
typedef __int8 s8;
|
||||
typedef __int16 s16;
|
||||
typedef __int32 s32;
|
||||
typedef __int64 s64;
|
||||
|
||||
typedef unsigned __int8 u8;
|
||||
typedef unsigned __int16 u16;
|
||||
typedef unsigned __int32 u32;
|
||||
typedef unsigned __int64 u64;
|
||||
|
||||
typedef unsigned int uint;
|
||||
|
||||
#define PCSX2_ALIGNED(alig,x) __declspec(align(alig)) x
|
||||
#define PCSX2_ALIGNED16(x) __declspec(align(16)) x
|
||||
#define PCSX2_ALIGNED16_DECL(x) __declspec(align(16)) x
|
||||
|
||||
#else // _MSC_VER
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
#ifdef HAVE_STDINT_H
|
||||
#include "stdint.h"
|
||||
|
||||
typedef int8_t s8;
|
||||
typedef int16_t s16;
|
||||
typedef int32_t s32;
|
||||
typedef int64_t s64;
|
||||
|
||||
typedef uint8_t u8;
|
||||
typedef uint16_t u16;
|
||||
typedef uint32_t u32;
|
||||
typedef uint64_t u64;
|
||||
|
||||
typedef uintptr_t uptr;
|
||||
typedef intptr_t sptr;
|
||||
|
||||
#else // HAVE_STDINT_H
|
||||
|
||||
typedef char s8;
|
||||
typedef short s16;
|
||||
typedef int s32;
|
||||
typedef long long s64;
|
||||
|
||||
typedef unsigned char u8;
|
||||
typedef unsigned short u16;
|
||||
typedef unsigned int u32;
|
||||
typedef unsigned long long u64;
|
||||
|
||||
#endif // HAVE_STDINT_H
|
||||
|
||||
typedef unsigned int uint;
|
||||
|
||||
#define LONG long
|
||||
|
||||
#define __fastcall __attribute__((fastcall))
|
||||
#define __unused __attribute__((unused))
|
||||
#define _inline __inline__ __attribute__((unused))
|
||||
#define __forceinline __attribute__((always_inline,unused))
|
||||
|
||||
#endif // __linux__
|
||||
|
||||
#define PCSX2_ALIGNED(alig,x) x __attribute((aligned(alig)))
|
||||
#define PCSX2_ALIGNED16(x) x __attribute((aligned(16)))
|
||||
|
||||
#define PCSX2_ALIGNED16_DECL(x) x
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
#if !defined(__linux__) || !defined(HAVE_STDINT_H)
|
||||
#if defined(__x86_64__)
|
||||
typedef u64 uptr;
|
||||
typedef s64 sptr;
|
||||
#else
|
||||
typedef u32 uptr;
|
||||
typedef s32 sptr;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// A rough-and-ready cross platform 128-bit datatype, Non-SSE style.
|
||||
#ifdef __cplusplus
|
||||
struct u128
|
||||
{
|
||||
u64 lo;
|
||||
u64 hi;
|
||||
|
||||
// Implicit conversion from u64
|
||||
u128( u64 src ) :
|
||||
lo( src )
|
||||
, hi( 0 ) {}
|
||||
|
||||
// Implicit conversion from u32
|
||||
u128( u32 src ) :
|
||||
lo( src )
|
||||
, hi( 0 ) {}
|
||||
};
|
||||
|
||||
struct s128
|
||||
{
|
||||
s64 lo;
|
||||
s64 hi;
|
||||
|
||||
// Implicit conversion from u64
|
||||
s128( s64 src ) :
|
||||
lo( src )
|
||||
, hi( 0 ) {}
|
||||
|
||||
// Implicit conversion from u32
|
||||
s128( s32 src ) :
|
||||
lo( src )
|
||||
, hi( 0 ) {}
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
typedef union _u128_t
|
||||
{
|
||||
u64 lo;
|
||||
u64 hi;
|
||||
} u128;
|
||||
|
||||
typedef union _s128_t
|
||||
{
|
||||
s64 lo;
|
||||
s64 hi;
|
||||
} s128;
|
||||
|
||||
#endif
|
||||
|
||||
typedef struct {
|
||||
int size;
|
||||
s8 *data;
|
||||
} freezeData;
|
||||
|
||||
#endif /* __PS2ETYPES_H__ */
|
|
@ -1 +0,0 @@
|
|||
link /usr/share/automake-1.9/compile
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue