diff --git a/pcsx2/Linux/LnxSysExec.h b/pcsx2/Linux/LnxSysExec.h index 31e852b070..853c8345d5 100644 --- a/pcsx2/Linux/LnxSysExec.h +++ b/pcsx2/Linux/LnxSysExec.h @@ -20,6 +20,7 @@ #define __LNXSYSEXEC_H__ #include "Linux.h" +#include "GS.h" #include extern void StartGui(); diff --git a/pcsx2/Makefile.am b/pcsx2/Makefile.am index 3fe3e0f970..34e0843b66 100644 --- a/pcsx2/Makefile.am +++ b/pcsx2/Makefile.am @@ -3,10 +3,10 @@ INCLUDES = -I@srcdir@/x86/ -I@srcdir@/common/ noinst_LIBRARIES = libpcsx2.a libpcsx2_a_SOURCES = \ -CDVD.cpp CDVDiso.cpp CDVDisodrv.cpp COP0.cpp COP2.cpp Cache.cpp CdRom.cpp Console.cpp \ +CDVD.cpp CDVDiso.cpp CDVDisodrv.cpp COP0.cpp COP2.cpp Cache.cpp CdRom.cpp Console.cpp HwRead.cpp HwWrite.cpp \ Counters.cpp Decode_XA.cpp Elfheader.cpp FPU.cpp FPU2.cpp FiFo.cpp Gif.cpp GS.cpp Hw.cpp Interpreter.cpp \ IopBios.cpp IopCounters.cpp IopDma.cpp IopHw.cpp IopMem.cpp IopSio2.cpp MMI.cpp MTGS.cpp \ -Memory.cpp Misc.cpp Patch.cpp PathUtils.cpp Plugins.cpp PrecompiledHeader.cpp R3000A.cpp \ +Memory.cpp MemoryCard.cpp Misc.cpp Patch.cpp PathUtils.cpp Plugins.cpp PrecompiledHeader.cpp R3000A.cpp \ R3000AInterpreter.cpp R3000AOpcodeTables.cpp R5900.cpp R5900OpcodeImpl.cpp R5900OpcodeTables.cpp \ SPR.cpp SaveState.cpp Sif.cpp Sio.cpp SourceLog.cpp Stats.cpp System.cpp ThreadTools.cpp \ VU0.cpp VU0micro.cpp VU0microInterp.cpp VU1micro.cpp VU1microInterp.cpp VUflags.cpp VUmicroMem.cpp VUops.cpp \ @@ -16,7 +16,7 @@ Vif.cpp VifDma.cpp vssprintf.cpp vtlb.cpp xmlpatchloader.cpp AlignedMalloc.cpp libpcsx2_a_SOURCES += \ CDVD.h CDVDiso.h CDVDisodrv.h CDVDlib.h COP0.h Cache.h CdRom.h Common.h Counters.h Decode_XA.h EEregs.h \ Elfheader.h Exceptions.h GS.h Hw.h IopBios.h IopBios2.h IopCounters.h IopDma.h IopHw.h IopMem.h IopSio2.h Memcpyfast.h \ -Memory.h Misc.h Patch.h Paths.h Plugins.h PrecompiledHeader.h PsxCommon.h R3000A.h R5900.h R5900OpcodeTables.h \ +Memory.h MemoryCard.h Misc.h Patch.h Paths.h Plugins.h PrecompiledHeader.h PsxCommon.h R3000A.h R5900.h R5900OpcodeTables.h \ SPR.h SamplProf.h SaveState.h Sif.h Sifcmd.h Sio.h SafeArray.h Stats.h StringUtils.h System.h Threading.h \ VU.h VUflags.h VUmicro.h VUops.h Vif.h VifDma.h cheatscpp.h vtlb.h diff --git a/pcsx2/Misc.cpp b/pcsx2/Misc.cpp index 5a02abb815..f32b0b318e 100644 --- a/pcsx2/Misc.cpp +++ b/pcsx2/Misc.cpp @@ -386,7 +386,7 @@ void SaveGSState(const string& file) if( g_SaveGSStream ) return; Console::WriteLn( _("Saving GS State...") ); - Console::WriteLn( "\t%hs", params file ); + Console::WriteLn( "\t%hs", params file.c_str() ); g_fGSSave = new gzSavingState( file ); diff --git a/plugins/build.sh b/plugins/build.sh index e7ecc9f662..d849a648db 100644 --- a/plugins/build.sh +++ b/plugins/build.sh @@ -2,7 +2,7 @@ curdir=`pwd` -function buildplugin { +buildplugin() { cd ${curdir}/$1 sh build.sh $2 diff --git a/plugins/zerogs/opengl/Linux/Conf.cpp b/plugins/zerogs/opengl/Linux/Conf.cpp index 75e75a715a..e58b39c234 100644 --- a/plugins/zerogs/opengl/Linux/Conf.cpp +++ b/plugins/zerogs/opengl/Linux/Conf.cpp @@ -39,12 +39,12 @@ void SaveConfig() return; } - fprintf(f, "interlace = %x\n", conf.interlace); - fprintf(f, "mrtdepth = %x\n", conf.mrtdepth); - fprintf(f, "options = %x\n", conf.options); - fprintf(f, "bilinear = %x\n", conf.bilinear); - fprintf(f, "aliasing = %x\n", conf.aa); - fprintf(f, "gamesettings = %x\n", conf.gamesettings); + 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); } @@ -70,12 +70,12 @@ void LoadConfig() SaveConfig();//save and return return; } - fscanf(f, "interlace = %x\n", &conf.interlace); - fscanf(f, "mrtdepth = %x\n", &conf.mrtdepth); - fscanf(f, "options = %x\n", &conf.options); - fscanf(f, "bilinear = %x\n", &conf.bilinear); - fscanf(f, "aliasing = %x\n", &conf.aa); - fscanf(f, "gamesettings = %x\n", &conf.gamesettings); + 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 diff --git a/plugins/zerogs/opengl/Linux/Linux.cpp b/plugins/zerogs/opengl/Linux/Linux.cpp index 3ce41ec09b..0011f96e53 100644 --- a/plugins/zerogs/opengl/Linux/Linux.cpp +++ b/plugins/zerogs/opengl/Linux/Linux.cpp @@ -112,6 +112,7 @@ void OnConf_Ok(GtkButton *button, gpointer user_data) char *str; int i; + // fixme; This doesn't look right; conf.interlace is a u8. u32 newinterlace = is_checked(Conf, "checkInterlace"); if (!conf.interlace ) @@ -198,13 +199,14 @@ void CALLBACK GSconfigure() if (!(conf.options & GSOPTION_LOADED)) LoadConfig(); Conf = create_Config(); + // fixme; Need to check "checkInterlace" as well. 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, "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); diff --git a/plugins/zerogs/opengl/configure b/plugins/zerogs/opengl/configure index 1f401f9f6e..9cbe945630 100644 --- a/plugins/zerogs/opengl/configure +++ b/plugins/zerogs/opengl/configure @@ -5361,6 +5361,8 @@ fi $as_echo "$ac_cv_lib_Xxf86vm_main" >&6; } if test "x$ac_cv_lib_Xxf86vm_main" = x""yes; then LIBS="$LIBS -lXxf86vm" +else + echo "Error! You need to have libXxf86vm-dev." ; exit -1 fi diff --git a/plugins/zerogs/opengl/configure.ac b/plugins/zerogs/opengl/configure.ac index 85fdcd4730..32187d7555 100644 --- a/plugins/zerogs/opengl/configure.ac +++ b/plugins/zerogs/opengl/configure.ac @@ -131,7 +131,7 @@ AC_CHECK_LIB(pthread,main,[LIBS="$LIBS -lpthread"]) AC_CHECK_LIB(stdc++,main,[LIBS="$LIBS -lstdc++"]) AC_CHECK_LIB(z,main,[LIBS="$LIBS -lz"]) AC_CHECK_LIB(dl,main,[LIBS="$LIBS -ldl"]) -AC_CHECK_LIB(Xxf86vm,main,[LIBS="$LIBS -lXxf86vm"]) +AC_CHECK_LIB(Xxf86vm,main,[LIBS="$LIBS -lXxf86vm"],[echo "Error! You need to have libXxf86vm-dev." ; exit -1]) dnl AC_CHECK_LIB(Cg,cgCreateContext,[LIBS="$LIBS -lCg"]) dnl AC_CHECK_LIB(CgGL,cgGLEnableProfile,[LIBS="$LIBS -lCgGL"]) diff --git a/plugins/zerogs/opengl/targets.cpp b/plugins/zerogs/opengl/targets.cpp index d8c11e5b9a..a73976eb5c 100644 --- a/plugins/zerogs/opengl/targets.cpp +++ b/plugins/zerogs/opengl/targets.cpp @@ -1883,16 +1883,33 @@ ZeroGS::CMemoryTarget* ZeroGS::CMemoryTargetMngr::GetMemoryTarget(const tex0Info } else { if( tex0.psm == PSMT16Z || tex0.psm == PSMT16SZ ) { - - texdata.resize(4*GPU_TEXWIDTH*channels*widthmult*(targ->realheight+widthmult-1)/widthmult); +#if defined(ZEROGS_SSE2) + // reserve additional elements for alignment if SSE2 used. + texdata.resize(4 * GPU_TEXWIDTH * channels * widthmult * (targ->realheight + widthmult - 1) / widthmult + 15); +#else + texdata.resize(4 * GPU_TEXWIDTH * channels * widthmult * (targ->realheight + widthmult - 1) / widthmult); +#endif ptexdata = &texdata[0]; // needs to be 8 bit, use xmm for unpacking u16* dst = (u16*)ptexdata; u16* src = (u16*)(g_pbyGSMemory + 4 * GPU_TEXWIDTH * targ->realy); - - assert( ((u32)(uptr)dst)%16 == 0 ); - + #if defined(ZEROGS_SSE2) + if (((u32)(uptr)dst) % 16 != 0) { + // This is not an unusual situation, when vector does not align 16bit, it is destructive for SSE2 + // instruction movdqa [%eax], xmm0 + // The idea would be resize vector to 15 elements, and set ptxedata to an aligned position. + // Later we would move eax by 16, so we should only verify that the first element is aligned + // FIXME. As I see, texdata used only once here, it does not have any impact on other code. + // Probably, usage of _aligned_maloc() would be preferable. + // -- Zeydlitz + + int disalignment = 16 - ((u32)(uptr)dst)%16 ; // This is value of shift. It could be 0 < disalignment <= 15 + ptexdata = &texdata[disalignment]; // Set pointer to aligned element + dst = (u16*)ptexdata; + GS_LOG("Made alignment for texdata, 0x%x\n", dst ); + assert( ((u32)(uptr)dst)%16 == 0 ); // Assert, because at future could be vectors with uncontigious spaces + } int iters = targ->height*GPU_TEXWIDTH/16; #if defined(_MSC_VER)