RetroGame

移植PCSX4ALL


PCSX4ALL模擬器應該是目前唯一一款針對MIPS CPU優化的PS1模擬器,司徒最早接觸這款模擬器是在丁果A320掌機,當初確實被其效果嚇到,先不論效果如何(畢竟當初Sony如何阻止模擬器發展,最近卻又開始販賣PlayStation Classic,據傳裡面就是PCSX ReARMed模擬器,淋淋種種,大家心中自有一把尺),畢竟很多東西都還是Undocument,可以達到如此效果,已經遠遠超出司徒的預期,當然效果還是無法跟PSP Go掌機相提並論,而PCSX4ALL模擬器得於GCW Zero掌機的出現,加上網友Dmitrysmagin再度深度優化MIPS相關效能,頓時讓PCSX4ALL可以流暢運行於GCW Zero掌機,因此,司徒特意移植PCSX4ALL到RetroGame掌機,藉此測試其效能表現是否有異於A320掌機,結果證明確實有蠻大的改進,而相較於GCW Zero掌機,由於RetroGame掌機的CPU速度較慢以及缺乏IPU(Image Process Unit)的硬體拉伸支援,因此,目前速度還不及GCW Zero掌機,而軟體畫面拉伸的程式碼如下:

diff -Nr old_pcsx4all/gcw0_pcsx4all_changelog.txt new_pcsx4all/gcw0_pcsx4all_changelog.txt
0a1,20
> gcw0_pcsx4all_20170830_4.opk:
> 1. fix bug: some case cannot press any key
> 2. use strip --strip-unneeded to reduce size
> 
> gcw0_pcsx4all_20170830_3.opk:
> 1. long press start+select can speedup(force frameskip 3), and then press start or select to restore the menu setting
> 
> gcw0_pcsx4all_20170830_2.opk:
> 1. Analog Arrow Keys off: press analog down(but not analog left+down/right+down) can into menu
> 
> gcw0_pcsx4all_20170830_1.opk:
> 1. auto fix Grandia(SLPS02124)'s 368x240 -> 352x240
> 2. change [pixel skip] to [Clip 368 -> 352], for fix other disp bug like Grandia
> 3. change menu key:
> 	select+start: menu
> 	start+select: none(for tekken3 quit to main menu)
> 4. add [Analog Arrow Keys] in core settings,
> 	Analog Arrow Keys off: analog left=L2, analog right=R2, analog up=L2+R2, analog down=menu
> 	Analog Arrow Keys on: analog stick = arrow keys, select+B=B, select+L1=L2, select+L2=R2
> 
diff -Nr old_pcsx4all/Makefile new_pcsx4all/Makefile
0a1,215
> TARGET = pcsx4all
> PORT   = sdl
> 
> # Using 'gpulib' adapted from PCSX Rearmed is default, specify
> #  USE_GPULIB=0 as param to 'make' when building to disable it.
> USE_GPULIB ?= 1
> 
> #GPU   = gpu_dfxvideo
> #GPU   = gpu_drhell
> #GPU   = gpu_null
> GPU   = gpu_unai
> 
> SPU   = spu_pcsxrearmed
> 
> RECOMPILER = mips
> 
> RM     = rm -f
> MD     = mkdir
> CC     = mipsel-linux-gcc
> CXX    = mipsel-linux-g++
> LD     = mipsel-linux-g++
> 
> SYSROOT     := $(shell $(CC) --print-sysroot)
> SDL_CONFIG  := $(SYSROOT)/usr/bin/sdl-config
> SDL_CFLAGS  := $(shell $(SDL_CONFIG) --cflags)
> SDL_LIBS    := $(shell $(SDL_CONFIG) --libs)
> 
> MCD1_FILE = \"mcd001.mcr\"
> MCD2_FILE = \"mcd002.mcr\"
> 
> ifdef A320
> 	C_ARCH = -mips32 -msoft-float -DTMPFS_MIRRORING -DTMPFS_DIR=\"/tmp\"
> else
> 	#C_ARCH = -mips32r2 -DSHMEM_MIRRORING
> 	C_ARCH = -mips32 -DSHMEM_MIRRORING
> endif
> 
> CFLAGS = $(C_ARCH) -mplt -mno-shared -ggdb3 -O2 -DGCW_ZERO \
> 	-Wall -Wunused -Wpointer-arith \
> 	-Wno-sign-compare -Wno-cast-align \
> 	-Isrc -Isrc/spu/$(SPU) -D$(SPU) -Isrc/gpu/$(GPU) \
> 	-Isrc/port/$(PORT) \
> 	-Isrc/plugin_lib \
> 	-DXA_HACK \
> 	-DINLINE="static __inline__" -Dasm="__asm__ __volatile__" \
> 	$(SDL_CFLAGS)
> 
> # Convert plugin names to uppercase and make them CFLAG defines
> CFLAGS += -D$(shell echo $(GPU) | tr a-z A-Z)
> CFLAGS += -D$(shell echo $(SPU) | tr a-z A-Z)
> 
> ifdef RECOMPILER
> CFLAGS += -DPSXREC -D$(RECOMPILER)
> endif
> 
> LDFLAGS = $(SDL_LIBS) -lSDL_mixer -lSDL_image -lrt -lz
> 
> OBJDIRS = obj obj/gpu obj/gpu/$(GPU) obj/spu obj/spu/$(SPU) \
> 	  obj/recompiler obj/recompiler/$(RECOMPILER) \
> 	  obj/port obj/port/$(PORT) \
> 	  obj/plugin_lib
> 
> all: maketree $(TARGET)
> 
> OBJS = \
> 	obj/r3000a.o obj/misc.o obj/plugins.o obj/psxmem.o obj/psxhw.o \
> 	obj/psxcounters.o obj/psxdma.o obj/psxbios.o obj/psxhle.o obj/psxevents.o \
> 	obj/psxcommon.o \
> 	obj/plugin_lib/plugin_lib.o obj/plugin_lib/pl_sshot.o \
> 	obj/psxinterpreter.o \
> 	obj/mdec.o obj/decode_xa.o \
> 	obj/cdriso.o obj/cdrom.o obj/ppf.o \
> 	obj/sio.o obj/pad.o
> 
> ifdef RECOMPILER
> OBJS += \
> 	obj/recompiler/mips/recompiler.o \
> 	obj/recompiler/mips/mips_disasm.o
> endif
> 
> ######################################################################
> #  GPULIB from PCSX Rearmed:
> #  Fixes many game incompatibilities and centralizes/improves many
> #  things that once were the responsibility of individual GPU plugins.
> #  NOTE: For now, only GPU Unai has been adapted.
> ifeq ($(USE_GPULIB),1)
> CFLAGS += -DUSE_GPULIB
> OBJDIRS += obj/gpu/gpulib
> OBJS += obj/gpu/$(GPU)/gpulib_if.o
> OBJS += obj/gpu/gpulib/gpu.o obj/gpu/gpulib/vout_port.o
> else
> OBJS += obj/gpu/$(GPU)/gpu.o
> endif
> ######################################################################
> 
> OBJS += obj/gte.o
> OBJS += obj/spu/$(SPU)/spu.o
> 
> OBJS += obj/port/$(PORT)/port.o
> OBJS += obj/port/$(PORT)/frontend.o
> 
> OBJS += obj/plugin_lib/perfmon.o
> 
> #******************************************
> # spu_pcsxrearmed section BEGIN
> #******************************************
> 
> ##########
> # Use a non-default SPU update frequency for these slower devices
> #  to avoid audio dropouts. 0: once-per-frame (default)   5: 32-times-per-frame
> #
> #  On slower Dingoo A320, update 8 times per frame
> ifdef A320
> CFLAGS += -DSPU_UPDATE_FREQ_DEFAULT=3
> else
> #  On faster GCW Zero platform, update 4 times per frame
> CFLAGS += -DSPU_UPDATE_FREQ_DEFAULT=2
> endif
> ##########
> 
> ##########
> # Similarly, set higher XA audio update frequency for slower devices
> #
> #  On slower Dingoo A320, force XA to update 8 times per frame (val 4)
> ifdef A320
> CFLAGS += -DFORCED_XA_UPDATES_DEFAULT=4
> else
> #  On faster GCW Zero platform, use auto-update
> CFLAGS += -DFORCED_XA_UPDATES_DEFAULT=1
> endif
> ##########
> 
> ifeq ($(SPU),spu_pcsxrearmed)
> # Specify which audio backend to use:
> SOUND_DRIVERS=sdl
> #SOUND_DRIVERS=alsa
> #SOUND_DRIVERS=oss
> #SOUND_DRIVERS=pulseaudio
> 
> # Note: obj/spu/spu_pcsxrearmed/spu.o will already have been added to OBJS
> #		list previously in Makefile
> OBJS += obj/spu/spu_pcsxrearmed/dma.o obj/spu/spu_pcsxrearmed/freeze.o \
> 	obj/spu/spu_pcsxrearmed/out.o obj/spu/spu_pcsxrearmed/nullsnd.o \
> 	obj/spu/spu_pcsxrearmed/registers.o
> ifeq "$(ARCH)" "arm"
> OBJS += obj/spu/spu_pcsxrearmed/arm_utils.o
> endif
> ifeq "$(HAVE_C64_TOOLS)" "1"
> obj/spu/spu_pcsxrearmed/spu.o: CFLAGS += -DC64X_DSP
> obj/spu/spu_pcsxrearmed/spu.o: obj/spu/spu_pcsxrearmed/spu_c64x.c
> frontend/menu.o: CFLAGS += -DC64X_DSP
> endif
> ifneq ($(findstring oss,$(SOUND_DRIVERS)),)
> obj/spu/spu_pcsxrearmed/out.o: CFLAGS += -DHAVE_OSS
> OBJS += obj/spu/spu_pcsxrearmed/oss.o
> endif
> ifneq ($(findstring alsa,$(SOUND_DRIVERS)),)
> obj/spu/spu_pcsxrearmed/out.o: CFLAGS += -DHAVE_ALSA
> OBJS += obj/spu/spu_pcsxrearmed/alsa.o
> LDFLAGS += -lasound
> endif
> ifneq ($(findstring sdl,$(SOUND_DRIVERS)),)
> obj/spu/spu_pcsxrearmed/out.o: CFLAGS += -DHAVE_SDL
> OBJS += obj/spu/spu_pcsxrearmed/sdl.o
> endif
> ifneq ($(findstring pulseaudio,$(SOUND_DRIVERS)),)
> obj/spu/spu_pcsxrearmed/out.o: CFLAGS += -DHAVE_PULSE
> OBJS += obj/spu/spu_pcsxrearmed/pulseaudio.o
> endif
> ifneq ($(findstring libretro,$(SOUND_DRIVERS)),)
> obj/spu/spu_pcsxrearmed/out.o: CFLAGS += -DHAVE_LIBRETRO
> endif
> 
> endif
> #******************************************
> # spu_pcsxrearmed END
> #******************************************
> 
> CXXFLAGS := $(CFLAGS) -fno-rtti -fno-exceptions
> 
> #If V=1 was passed to 'make', do not hide commands:
> ifdef V
> 	HIDECMD:=
> else
> 	HIDECMD:=@
> endif
> 
> $(TARGET): $(OBJS)
> 	@echo Linking $(TARGET)...
> 	$(HIDECMD)$(LD) $(OBJS) $(LDFLAGS) -o $@
> 
> obj/%.o: src/%.c
> 	@echo Compiling $<...
> 	$(HIDECMD)$(CC) $(CFLAGS) -c $< -o $@
> 
> obj/%.o: src/%.cpp
> 	@echo Compiling $<...
> 	$(HIDECMD)$(CXX) $(CXXFLAGS) -c $< -o $@
> 
> obj/%.o: src/%.s
> 	@echo Compiling $<...
> 	$(HIDECMD)$(CXX) $(CFLAGS) -c $< -o $@
> 
> obj/%.o: src/%.S
> 	@echo Compiling $<...
> 	$(HIDECMD)$(CXX) $(CFLAGS) -c $< -o $@
> 
> $(sort $(OBJDIRS)):
> 	$(HIDECMD)$(MD) $@
> 
> maketree: $(sort $(OBJDIRS))
> 
> clean:
> 	$(RM) -r obj
> 	$(RM) $(TARGET)
diff -Nr old_pcsx4all/make_opk.sh new_pcsx4all/make_opk.sh
12c12
< Exec=pcsx4all
---
> Exec=pcsx4all -iso %f
19a20
> #MimeType=application/x-pcsx4all-rom;application/x-pcsx4all-rom;application/bin;application/iso;
Binary files old_pcsx4all/pcsx4all.opk and new_pcsx4all/pcsx4all.opk differ
diff -Nr old_pcsx4all/src/gpu/gpulib/gpu.cpp new_pcsx4all/src/gpu/gpulib/gpu.cpp
226c226
<   gpulib_frameskip_prepare();
---
>   gpulib_frameskip_prepare(Config.FrameSkip);
794c794
< void gpulib_frameskip_prepare(void)
---
> void gpulib_frameskip_prepare(s8 frameskip)
796c796
<   gpu.frameskip.set = Config.FrameSkip;
---
>   gpu.frameskip.set = frameskip;
diff -Nr old_pcsx4all/src/gpu/gpulib/gpu.h new_pcsx4all/src/gpu/gpulib/gpu.h
129c129
< void gpulib_frameskip_prepare(void);
---
> void gpulib_frameskip_prepare(signed char frameskip);
diff -Nr old_pcsx4all/src/gpu/gpulib/vout_port.cpp new_pcsx4all/src/gpu/gpulib/vout_port.cpp
25c25,27
< #define RGB16(C)		(((C)&(0x1f<<10))>>10) | (((C)&(0x1f<<5))<<1) | (((C)&(0x1f<<0))<<11)
---
> //#define RGB16(C)		(((C)&(0x1f<<10))>>10) | (((C)&(0x1f<<5))<<1) | (((C)&(0x1f<<0))<<11)
> //#define RGB16(C)		( (C)>>10 | ((C) & 0x03e0)<<1 | ((C) & 0x1f)<<11 )
> #define RGB16(C)		( ((C) & 0x7c00)>>10 | ((C) & 0x03e0)<<1 | ((C) & 0x1f)<<11 )
37a40,84
> bool use_clip_368;
> 
> static inline u16 middle(u16 s1, u16 s2, u16 s3)
> {
> 	u16 x, y, temp;
> 	u16 a[] = {s1, s2, s3};
> 
> 	for(y=0; y<2; y++){
> 		for(x=1; x<3; x++){
> 			if(a[x] > a[y]){
> 				temp = a[x];
> 				a[x] = a[y];
> 				a[y] = temp;
> 			}
> 		}
> 	}
> 	return a[1];
> }
> 
> static inline u16 mask_filter(u16 *s)
> {/*
> 	u16 r0 = (s[0] & 0x7c00) >> 10;
> 	u16 r1 = (s[1] & 0x7c00) >> 10;
> 
> 	u16 g0 = (s[0] & 0x03e0) >> 5;
> 	u16 g1 = (s[1] & 0x03e0) >> 5;
> 	
> 	u16 b0 = s[0] & 0x1f;
> 	u16 b1 = s[1] & 0x1f;
> 
> 	u16 r = (r0 + r1) / 2;
> 	u16 g = (g0 + g1) / 2;
> 	u16 b = (b0 + b1) / 2;
> 
> 	return (b<<11) | (g<<6) | r;*/
> 
> 	u16 c1 = s[0];
> 	u16 c2 = s[1];
> 	u16 r = (u16)((u16)(c1 & 0x7c00) + (u16)(c2 & 0x7c00)) >> 11;
> 	u16 g = (u16)((u16)(c1 & 0x03e0) + (u16)(c2 & 0x03e0)); //>> 6
> 	u16 b = (u16)((u16)(c1 & 0x001f) + (u16)(c2 & 0x001f)) >> 1;
> 
> 	return (b<<11) | (g) | r; //(g<<6)
> }
> 
41c88,89
< static inline void GPU_BlitWW(const void* src, u16* dst16, bool isRGB24)
---
> // GPU_BlitWW
> static inline void GPU_Blit320(const void* src, u16* dst16, bool isRGB24)
68c116
< 		const u8* src8 = (const u8*)src;
---
> 		u8* src8 = (u8*)src;
93c141,142
< static inline void GPU_BlitWWSWWSWS(const void* src, u16* dst16, bool isRGB24)
---
> //  GPU_BlitWWSWWSWS
> static inline void GPU_Blit512(const void* src, u16* dst16, bool isRGB24)
100c149
< 		const u16* src16 = (const u16*) src;
---
> 		u16* src16 = (u16*)src;
101a151
> 		#if 0
111a162,173
> 		#else
> 			dst16[ 0] = RGB16(src16[0]);
> 			dst16[ 1] = mask_filter(&src16[1]);
> 			dst16[ 2] = RGB16(src16[3]);
> 			dst16[ 3] = mask_filter(&src16[4]);
> 			dst16[ 4] = mask_filter(&src16[6]);
> 			dst16[ 5] = RGB16(src16[8]);
> 			dst16[ 6] = mask_filter(&src16[9]);
> 			dst16[ 7] = RGB16(src16[11]);
> 			dst16[ 8] = mask_filter(&src16[12]);
> 			dst16[ 9] = mask_filter(&src16[14]);
> 		#endif
152c214,215
< static inline void GPU_BlitWWWWWS(const void* src, u16* dst16, bool isRGB24)
---
> //  GPU_BlitWWWWWS
> static inline void GPU_Blit384(const void* src, u16* dst16, bool isRGB24)
159c222
< 		const u16* src16 = (const u16*) src;
---
> 		u16* src16 = (u16*)src;
160a224
> 		#if 0
170a235,246
> 		#else
> 			dst16[ 0] = RGB16(src16[0]);
> 			dst16[ 1] = RGB16(src16[1]);
> 			dst16[ 2] = RGB16(src16[2]);
> 			dst16[ 3] = RGB16(src16[3]);
> 			dst16[ 4] = mask_filter(&src16[4]);
> 			dst16[ 5] = RGB16(src16[6]);
> 			dst16[ 6] = RGB16(src16[7]);
> 			dst16[ 7] = RGB16(src16[8]);
> 			dst16[ 8] = RGB16(src16[9]);
> 			dst16[ 9] = mask_filter(&src16[10]);
> 		#endif
207c283,332
< static inline void GPU_BlitWWWWWWWWS(const void* src, u16* dst16, bool isRGB24, u32 uClip_src)
---
> //  GPU_Blit368: 320 -6 -6 = 308
> static inline void GPU_Blit368_clip(const void* src, u16* dst16)
> {/*
> 	u32 uCount;
> 	u16* src16 = ((u16*) src);
> 	uCount = 22;
> 	//
> 	do {
> 		dst16[ 0] = RGB16(src16[0]);
> 		dst16[ 1] = RGB16(src16[1]);
> 		dst16[ 2] = RGB16(src16[2]);
> 		dst16[ 3] = RGB16(src16[3]);
> 		dst16[ 4] = RGB16(src16[4]);
> 		dst16[ 5] = RGB16(src16[5]);
> 		dst16[ 6] = mask_filter(&src16[6]);
> 		dst16[ 7] = RGB16(src16[8]);
> 		dst16[ 8] = RGB16(src16[9]);
> 		dst16[ 9] = RGB16(src16[10]);
> 		dst16[10] = RGB16(src16[11]);
> 		dst16[11] = RGB16(src16[12]);
> 		dst16[12] = RGB16(src16[13]);
> 		dst16[13] = mask_filter(&src16[14]);
> 		dst16 += 14;
> 		src16 += 16;
> 	} while (--uCount);   //6 + 22 * 14 = 314, 320 - 314 = 6
> 	// 补齐末尾
> 	dst16[0] = dst16[1] = dst16[2] = dst16[3] = dst16[4] = dst16[5] = 0;*/
> 	u32 uCount;
> 	u16* src16 = ((u16*) src);
> 	uCount = 32;
> 	//
> 	do {
> 		dst16[ 0] = RGB16(src16[0]);
> 		dst16[ 1] = RGB16(src16[1]);
> 		dst16[ 2] = RGB16(src16[2]);
> 		dst16[ 3] = RGB16(src16[3]);
> 		dst16[ 4] = RGB16(src16[4]);
> 		dst16[ 5] = RGB16(src16[5]);
> 		dst16[ 6] = RGB16(src16[6]);
> 		dst16[ 7] = RGB16(src16[7]);
> 		dst16[ 8] = RGB16(src16[8]);
> 		dst16[ 9] = mask_filter(&src16[9]);
> 		dst16 += 10;
> 		src16 += 11;
> 	} while (--uCount);
> }
> 
> 
> //  GPU_BlitWWWWWWWWS
> static inline void GPU_Blit368(const void* src, u16* dst16, bool isRGB24/*, u32 uClip_src*/)
212a338,339
> 		u16* src16 = ((u16*) src)/* + uClip_src*/;
>     #if 0
214d340
< 		const u16* src16 = ((const u16*) src) + uClip_src;
224d349
< 
235a361,411
> 	#else
> 	   {/*
> 			u16 x, cnt=0, sx=0;
> 			for(x=0; x<320; x++){
> 				sx++;
> 				if(++cnt == 7){
> 					cnt = 0;
> 					dst16[x] = mask_filter(&src16[sx]);
> 					sx++;
> 				}
> 				else{
> 					dst16[x] = RGB16(src16[sx]);
> 				}
> 			}*/
> 		}
> 		uCount = 22;
> 		dst16[0] = RGB16(src16[0]);
> 		dst16++;
> 		src16++;
> 		do {
> 			dst16[ 0] = RGB16(src16[0]);
> 			dst16[ 1] = RGB16(src16[1]);
> 			dst16[ 2] = RGB16(src16[2]);
> 			dst16[ 3] = RGB16(src16[3]);
> 			dst16[ 4] = RGB16(src16[4]);
> 			dst16[ 5] = RGB16(src16[5]);
> 			dst16[ 6] = mask_filter(&src16[6]);
> 			dst16[ 7] = RGB16(src16[8]);
> 			dst16[ 8] = RGB16(src16[9]);
> 			dst16[ 9] = RGB16(src16[10]);
> 			dst16[10] = RGB16(src16[11]);
> 			dst16[11] = RGB16(src16[12]);
> 			dst16[12] = RGB16(src16[13]);
> 			dst16[13] = mask_filter(&src16[14]);
> 			dst16 += 14;
> 			src16 += 16;
> 		} while (--uCount);   //1 + 22 * 14 = 309, 320 - 309 = 11
> 		{// 补齐末尾
> 			dst16[ 0] = RGB16(src16[0]);
> 			dst16[ 1] = RGB16(src16[1]);
> 			dst16[ 2] = RGB16(src16[2]);
> 			dst16[ 3] = RGB16(src16[3]);
> 			dst16[ 4] = RGB16(src16[4]);
> 			dst16[ 5] = RGB16(src16[5]);
> 			dst16[ 6] = mask_filter(&src16[6]);
> 			dst16[ 7] = RGB16(src16[8]);
> 			dst16[ 8] = RGB16(src16[9]);
> 			dst16[ 9] = RGB16(src16[10]);
> 			dst16[10] = RGB16(src16[11]);
> 		}
> 		#endif
238c414
< 		const u16* src16 = ((const u16*) src) + uClip_src;
---
> 		const u16* src16 = ((const u16*) src)/* + uClip_src*/;
251c427,428
< 	} else
---
> 	}
> 	else
254c431
< 		const u8* src8 = (const u8*)src + (uClip_src<<1) + uClip_src;
---
> 		const u8* src8 = (const u8*)src/* + (uClip_src<<1) + uClip_src*/;
279c456,458
< static inline void GPU_BlitWWDWW(const void* src, u16* dst16, bool isRGB24)
---
> 
> // GPU_BlitWWDWW
> static inline void GPU_Blit256(const void* src, u16* dst16, bool isRGB24)
335c514,515
< static inline void GPU_BlitWS(const void* src, u16* dst16, bool isRGB24)
---
> // GPU_BlitWS
> static inline void GPU_Blit640(const void* src, u16* dst16, bool isRGB24)
341c521
< 		const u16* src16 = (const u16*) src;
---
> 		u16* src16 = (u16*)src;
342a523
> 		#if 0
361a543,563
> 		#else
> 			dst16[ 0] = mask_filter(&src16[0]);
> 			dst16[ 1] = mask_filter(&src16[2]);
> 			dst16[ 2] = mask_filter(&src16[4]);
> 			dst16[ 3] = mask_filter(&src16[6]);
> 
> 			dst16[ 4] = mask_filter(&src16[8]);
> 			dst16[ 5] = mask_filter(&src16[10]);
> 			dst16[ 6] = mask_filter(&src16[12]);
> 			dst16[ 7] = mask_filter(&src16[14]);
> 
> 			dst16[ 8] = mask_filter(&src16[16]);
> 			dst16[ 9] = mask_filter(&src16[18]);
> 			dst16[10] = mask_filter(&src16[20]);
> 			dst16[11] = mask_filter(&src16[22]);
> 
> 			dst16[12] = mask_filter(&src16[24]);
> 			dst16[13] = mask_filter(&src16[26]);
> 			dst16[14] = mask_filter(&src16[28]);
> 			dst16[15] = mask_filter(&src16[30]);	
> 		#endif
456c658
< 
---
>   //printf("steward, %s, x:%d y:%d w:%d h0:%d h1:%d\n", __func__, x0, y0, w0, h0, h1);
461c663,665
< 				GPU_BlitWWDWW(src16 + src16_offs, dst16, isRGB24);
---
> 				GPU_Blit256(src16 + src16_offs, dst16, isRGB24);
> 				//GPU_Blit256(src16 + src16_offs, dst16 + VIDEO_WIDTH, isRGB24);
> 				dst16 += VIDEO_WIDTH;
468,469c672,683
< 			for (int y1=y0+h1; y0<y1; y0+=incY) {
< 				GPU_BlitWWWWWWWWS(src16 + src16_offs, dst16, isRGB24, 4);
---
> 			for (int y1=y0+h1; y0<y1; y0+=incY) {//SLPS02124
> 				if (use_clip_368 == false || isRGB24)
> 				{
> 				    GPU_Blit368(src16 + src16_offs, dst16, isRGB24/*, 0*/);
> 				    //GPU_Blit368(src16 + src16_offs, dst16 + VIDEO_WIDTH, isRGB24/*, 0*/);
> 				}
> 				else
> 				{
> 				    GPU_Blit368_clip(src16 + src16_offs, dst16);
> 				    //GPU_Blit368_clip(src16 + src16_offs, dst16 + VIDEO_WIDTH);
> 				}
> 				dst16 += VIDEO_WIDTH;
479c693,695
< 				GPU_BlitWW(src16 + src16_offs, dst16, isRGB24);
---
> 				GPU_Blit320(src16 + src16_offs, dst16, isRGB24);
> 				//GPU_Blit320(src16 + src16_offs, dst16 + VIDEO_WIDTH, isRGB24);
> 				dst16 += VIDEO_WIDTH;
487c703,705
< 				GPU_BlitWWWWWS(src16 + src16_offs, dst16, isRGB24);
---
> 				GPU_Blit384(src16 + src16_offs, dst16, isRGB24);
> 				//GPU_Blit384(src16 + src16_offs, dst16 + VIDEO_WIDTH, isRGB24);
> 				dst16 += VIDEO_WIDTH;
495c713,715
< 				GPU_BlitWWSWWSWS(src16 + src16_offs, dst16, isRGB24);
---
> 				GPU_Blit512(src16 + src16_offs, dst16, isRGB24);
> 				//GPU_Blit512(src16 + src16_offs, dst16 + VIDEO_WIDTH, isRGB24);
> 				dst16 += VIDEO_WIDTH;
503c723,725
< 				GPU_BlitWS(src16 + src16_offs, dst16, isRGB24);
---
> 				GPU_Blit640(src16 + src16_offs, dst16, isRGB24);
> 				//GPU_Blit640(src16 + src16_offs, dst16 + VIDEO_WIDTH, isRGB24);
> 				dst16 += VIDEO_WIDTH;
509d730
< 
diff -Nr old_pcsx4all/src/gpu/gpu_unai/gpu.h new_pcsx4all/src/gpu/gpu_unai/gpu.h
26c26,27
< 	uint8_t pixel_skip:1;     // If 1, allows skipping rendering pixels that
---
>     uint8_t clip_368:1;
> 	//uint8_t pixel_skip:1;     // If 1, allows skipping rendering pixels that
diff -Nr old_pcsx4all/src/gpu/gpu_unai/gpulib_if.cpp new_pcsx4all/src/gpu/gpu_unai/gpulib_if.cpp
107c107
< {
---
> {/*
119c119
<   } else {
---
>   } else */{
diff -Nr old_pcsx4all/src/gpu/gpu_unai/gpu_unai.h new_pcsx4all/src/gpu/gpu_unai/gpu_unai.h
305c305
< static inline bool PixelSkipEnabled()
---
> /*static inline bool PixelSkipEnabled()
308c308
< }
---
> }*/
diff -Nr old_pcsx4all/src/plugin_lib/plugin_lib.cpp new_pcsx4all/src/plugin_lib/plugin_lib.cpp
40c40
< static void pl_frameskip_prepare(void);
---
> static void pl_frameskip_prepare(s8 frameskip);
64c64
< static void pl_frameskip_prepare(void)
---
> static void pl_frameskip_prepare(s8 frameskip)
67c67
< 	pl_data.frameskip = Config.FrameSkip;
---
> 	pl_data.frameskip = frameskip;
80c80
< 	gpulib_frameskip_prepare();
---
> 	gpulib_frameskip_prepare(frameskip);
110c110,111
< 
---
>     extern boolean use_speedup;
>     s8 framskip = use_speedup == false ? Config.FrameSkip : 3;
112c113
< 	if (pl_data.frameskip != Config.FrameSkip ||
---
> 	if (pl_data.frameskip != framskip ||
115c116
< 		pl_frameskip_prepare();
---
> 		pl_frameskip_prepare(framskip);
140c141
< 	if (Config.FrameLimit && (diff > pl_data.frame_interval)) {
---
> 	if ((Config.FrameLimit && !use_speedup) && (diff > pl_data.frame_interval)) {
177c178
< 	pl_frameskip_prepare();
---
> 	pl_frameskip_prepare(Config.FrameSkip);
192c193
< 	pl_frameskip_prepare();
---
> 	pl_frameskip_prepare(Config.FrameSkip);
diff -Nr old_pcsx4all/src/port/sdl/frontend.cpp new_pcsx4all/src/port/sdl/frontend.cpp
42c42
< 
---
> #define _KEY_BACK   (KEY_SELECT|KEY_B)
246c246
< 		if (keys & KEY_SELECT) {
---
> 		if (keys & _KEY_BACK) {
929c929
< 		if ((swapping_cd) && (keys & KEY_SELECT)) {
---
> 		if ((swapping_cd) && (keys & _KEY_BACK)) {
1050a1051,1053
> 	{(char *)"GPU settings", &gui_GPUSettings, NULL, NULL, NULL},
> 	{(char *)"SPU settings", &gui_SPUSettings, NULL, NULL, NULL},
> 	{(char *)"Core settings", &gui_Settings, NULL, NULL, NULL},
1174a1178,1200
> static int Analog1_alter(u32 keys)
> {
> 	if (keys & KEY_RIGHT) {
> 		if (Config.AnalogArrow < 1) Config.AnalogArrow = 1;
> 	} else if (keys & KEY_LEFT) {
> 		if (Config.AnalogArrow > 0) Config.AnalogArrow = 0;
> 	}
> 
> 	return 0;
> }
> 
> static void Analog1_hint()
> {
> 	port_printf(6 * 8, 10 * 8, "Analog Stick -> Arrow Keys");
> }
> 
> static char *Analog1_show()
> {
> 	static char buf[16] = "\0";
> 	sprintf(buf, "%s", Config.AnalogArrow ? "on" : "off");
> 	return buf;
> }
> 
1187a1214
> 	Config.AnalogArrow = 0;
1208a1236
> 	{(char *)"Analog Arrow Keys    ", NULL, &Analog1_alter, &Analog1_show, &Analog1_hint},
1395c1423
< static int pixel_skip_alter(u32 keys)
---
> static int clip_368_alter(u32 keys)
1398,1399c1426,1427
< 		if (gpu_unai_config_ext.pixel_skip == false)
< 			gpu_unai_config_ext.pixel_skip = true;
---
> 		if (gpu_unai_config_ext.clip_368 == false)
> 			gpu_unai_config_ext.clip_368 = true;
1401,1402c1429,1430
< 		if (gpu_unai_config_ext.pixel_skip == true)
< 			gpu_unai_config_ext.pixel_skip = false;
---
> 		if (gpu_unai_config_ext.clip_368 == true)
> 			gpu_unai_config_ext.clip_368 = false;
1408c1436
< static char *pixel_skip_show()
---
> static char *clip_368_show()
1411c1439
< 	sprintf(buf, "%s", gpu_unai_config_ext.pixel_skip == true ? "on" : "off");
---
> 	sprintf(buf, "%s", gpu_unai_config_ext.clip_368 == true ? "on" : "off");
1427c1455
< 	gpu_unai_config_ext.pixel_skip = 1;
---
> 	gpu_unai_config_ext.clip_368 = 0;
1451c1479
< 	{(char *)"Pixel skip           ", NULL, &pixel_skip_alter, &pixel_skip_show, NULL},
---
> 	{(char *)"Clip 368 -> 352      ", NULL, &clip_368_alter, &clip_368_show, NULL},
1767c1795,1802
< 		if (keys & KEY_SELECT) {
---
> 		if (keys & _KEY_BACK) {
> 		    if (menu == &gui_GameMenu)
> 		    {
> 		        while (key_read() != 0)
>                 {
>                     timer_delay(50);
>                 }
> 			}
1823d1857
< 
diff -Nr old_pcsx4all/src/port/sdl/port.cpp new_pcsx4all/src/port/sdl/port.cpp
238a239,241
> 		} else if (!strcmp(line, "AnalogArrow")) {
> 			sscanf(arg, "%d", &value);
> 			Config.AnalogArrow = value;
298c301
< 		else if (!strcmp(line, "pixel_skip")) {
---
> 		else if (!strcmp(line, "clip_368")) {
300c303
< 			gpu_unai_config_ext.pixel_skip = value;
---
> 			gpu_unai_config_ext.clip_368 = value;
358c361,362
< 		   "FrameSkip %d\n",
---
> 		   "FrameSkip %d\n"
> 		   "AnalogArrow %d\n",
363c367
< 		   Config.FrameSkip);
---
> 		   Config.FrameSkip, Config.AnalogArrow);
377c381
< 		   "pixel_skip %d\n"
---
> 		   "clip_368 %d\n"
383c387
< 		   gpu_unai_config_ext.pixel_skip,
---
> 		   gpu_unai_config_ext.clip_368,
444c448
< 	//{ SDLK_ESCAPE,		DKEY_SELECT },
---
> 	{ SDLK_ESCAPE,		DKEY_SELECT },
460c464
< static unsigned short pad1 = 0xffff;
---
> static unsigned short pad1 = 0xffff, _pad1 = 0xffff;
461a466,509
> static unsigned short analog1 = 0;
> static int menu_check = 0;
> static int select_count = 0;
> boolean use_speedup = false;
> SDL_Joystick * sdl_joy;
> #define joy_commit_range    3276
> enum
> {
>     ANALOG_UP = 1,
>     ANALOG_DOWN = 2,
>     ANALOG_LEFT = 4,
>     ANALOG_RIGHT = 8
> };
> 
> void joy_init(void)
> {
>     sdl_joy = SDL_JoystickOpen(0);
>     SDL_JoystickEventState(SDL_ENABLE);
> /*
> 	int i;
> 	int joy_count;
> 	
> 	if (SDL_InitSubSystem(SDL_INIT_JOYSTICK))
> 		return;
> 	
> 	joy_count = SDL_NumJoysticks();
> 	
> 	if (!joy_count)
> 		return;
> 
> 	// now try and open one. If, for some reason it fails, move on to the next one
> 	for (i = 0; i < joy_count; i++)
> 	{
> 		sdl_joy = SDL_JoystickOpen(i);
> 		if (sdl_joy)
> 		{
> 			sdl_joy_num = i;
> 			break;
> 		}	
> 	}
> 	
> 	// make sure that Joystick event polling is a go
> 	SDL_JoystickEventState(SDL_ENABLE);*/
> }
464a513
>     int axisval;
468,469c517,520
< 	while (SDL_PollEvent(&event)) {
< 		switch (event.type) {
---
> 	while (SDL_PollEvent(&event))
> 	{
> 		switch (event.type)
> 		{
474,475c525,527
< 			switch (event.key.keysym.sym) {
< #ifndef GCW_ZERO
---
> 			switch (event.key.keysym.sym)
> 			{
>             #ifndef GCW_ZERO
480c532
< #endif
---
>             #endif
485c537,567
< 
---
>         case SDL_JOYAXISMOTION:
>             switch (event.jaxis.axis)
> 			{
> 			case 0: /* X axis */
> 			    axisval = event.jaxis.value;
> 			    analog1 &= ~(ANALOG_LEFT | ANALOG_RIGHT);
> 				if (axisval > joy_commit_range)
> 				{
> 				    analog1 |= ANALOG_RIGHT;
> 				}
> 				else if (axisval < -joy_commit_range)
> 				{
> 				    analog1 |= ANALOG_LEFT;
> 				}
> 				break;
> 		    case 1: /* Y axis*/
> 				axisval = event.jaxis.value;
> 				analog1 &= ~(ANALOG_UP | ANALOG_DOWN);
> 				if (axisval > joy_commit_range)
> 				{
> 				    analog1 |= ANALOG_DOWN;
> 				}
> 				else if (axisval < -joy_commit_range)
> 				{
> 				    analog1 |= ANALOG_UP;
> 				}
> 				break;
> 		    }
> 		    break;
> 		case SDL_JOYBUTTONDOWN:
> 		    break;
493c575
< 			pad1 &= ~(1 << keymap[k].bit);
---
> 			_pad1 &= ~(1 << keymap[k].bit);
495c577
< 			pad1 |= (1 << keymap[k].bit);
---
> 			_pad1 |= (1 << keymap[k].bit);
498a581
> 	pad1 = _pad1;
502,524c585,685
< 	// SELECT+B for psx's SELECT
< 	if (keys[SDLK_ESCAPE] && keys[SDLK_LALT]) {
< 		pad1 &= ~(1 << DKEY_SELECT);
< 		pad1 |= (1 << DKEY_CROSS);
< 	} else {
< 		pad1 |= (1 << DKEY_SELECT);
< 	}
< 
< 	// SELECT+L1 for psx's L2
< 	if (keys[SDLK_ESCAPE] && keys[SDLK_TAB]) {
< 		pad1 &= ~(1 << DKEY_L2);
< 		pad1 |= (1 << DKEY_L1);
< 	} else {
< 		pad1 |= (1 << DKEY_L2);
< 	}
< 
< 	// SELECT+R1 for R2
< 	if (keys[SDLK_ESCAPE] && keys[SDLK_BACKSPACE]) {
< 		pad1 &= ~(1 << DKEY_R2);
< 		pad1 |= (1 << DKEY_R1);
< 	} else {
< 		pad1 |= (1 << DKEY_R2);
< 	}
---
>     // SELECT + 
>     if (keys[SDLK_ESCAPE])
>     {
>         if (!keys[SDLK_RETURN])
>         {
>             menu_check = 1; //SELECT only
>         }
>         else if (menu_check == 1)
>         {
>             menu_check = 2; //SELECT + START
>         }
>         else
>         {// START + SELECT
>             if (use_speedup == false && ++select_count == 70)
>             {
>                 use_speedup = true;
>             }
>         }
>     }
>     else
>     {
>         menu_check = 0;
>     }
>     if (use_speedup)
>     {
>         if (!keys[SDLK_ESCAPE] && !keys[SDLK_RETURN])
>         {
>             select_count = 0;
>         }
>         else if (select_count == 0)
>         {
>             use_speedup = false;
>         }
>     }
>     //
>     if (Config.AnalogArrow)
>     {
>         pad1 |= (1 << DKEY_SELECT);
>     	// SELECT+B for psx's SELECT
>     	if (keys[SDLK_ESCAPE] && keys[SDLK_LALT])
>     	{
>     		pad1 &= ~(1 << DKEY_SELECT);
>     		pad1 |= (1 << DKEY_CROSS);
>     	}
>     	// SELECT+L1 for psx's L2
>     	if (keys[SDLK_ESCAPE] && keys[SDLK_TAB])
>     	{
>     		pad1 &= ~(1 << DKEY_L2);
>     		pad1 |= (1 << DKEY_L1);
>     	}
>     	else
>     	{
>     		pad1 |= (1 << DKEY_L2);
>     	}
>     	// SELECT+R1 for R2
>     	if (keys[SDLK_ESCAPE] && keys[SDLK_BACKSPACE])
>     	{
>     		pad1 &= ~(1 << DKEY_R2);
>     		pad1 |= (1 << DKEY_R1);
>     	}
>     	else
>     	{
>     		pad1 |= (1 << DKEY_R2);
>     	}
>     	if ((_pad1 & (1 << DKEY_UP)) && (analog1 & ANALOG_UP))
>     	{
>     	    pad1 &= ~(1 << DKEY_UP);
>     	}
>     	if ((_pad1 & (1 << DKEY_DOWN)) && (analog1 & ANALOG_DOWN))
>     	{
>     	    pad1 &= ~(1 << DKEY_DOWN);
>     	}
>     	if ((_pad1 & (1 << DKEY_LEFT)) && (analog1 & ANALOG_LEFT))
>     	{
>     	    pad1 &= ~(1 << DKEY_LEFT);
>     	}
>     	if ((_pad1 & (1 << DKEY_RIGHT)) && (analog1 & ANALOG_RIGHT))
>     	{
>     	    pad1 &= ~(1 << DKEY_RIGHT);
>     	}
>     }
>     else
> 	{// Analog Arrow Off
>         pad1 |= (1 << DKEY_L2) | (1 << DKEY_R2);
>         if (analog1 == ANALOG_UP)
>         {
>             pad1 &= ~((1 << DKEY_L2) | (1 << DKEY_R2));
>         }
>         else if (analog1 == ANALOG_DOWN)
>         {
>             menu_check = 2;
>         }
>         else if (analog1 & ANALOG_LEFT)
>         {
>             pad1 &= ~(1 << DKEY_L2);
>         }
>         else if (analog1 & ANALOG_RIGHT)
>         {
>             pad1 &= ~(1 << DKEY_R2);
>         }
>     }
527c688,689
< 	if (keys[SDLK_ESCAPE] && keys[SDLK_RETURN] && !keys[SDLK_LALT]) {
---
> 	if (menu_check == 2 && !keys[SDLK_LALT])
> 	{
537,538c699,702
< 		pad1 |= (1 << DKEY_START);
< 		pad1 |= (1 << DKEY_CROSS);
---
> 		use_speedup = false;
> 		menu_check = 0;
> 		analog1 = 0;
> 		pad1 |= (1 << DKEY_START) | (1 << DKEY_CROSS) | (1 << DKEY_SELECT);
649a814
> 	Config.AnalogArrow = false;
729c894
< 	gpu_unai_config_ext.pixel_skip = 1;
---
> 	gpu_unai_config_ext.clip_368 = 0;
915c1080
< 			gpu_unai_config_ext.pixel_skip = 0;
---
> 			gpu_unai_config_ext.clip_368 = 0;
1048c1213
< 	screen = SDL_SetVideoMode(320, 240, 16, flags);
---
> 	screen = SDL_SetVideoMode(320, 480, 16, flags);
1050c1215
< 		puts("NO Set VideoMode 320x240x16");
---
> 		puts("NO Set VideoMode 320x480x16");
1106a1272,1279
> 	
> 	extern bool use_clip_368;
> 	use_clip_368 = gpu_unai_config_ext.clip_368;
> 	if (strncmp(CdromId, "SLPS02124", 9) == 0)
> 	{// fix Grandia
> 		use_clip_368 = true;
> 	}
> 	joy_init();
1209a1383,1384
> 
>   y*= 2;
1213,1220c1388,1395
< 			screen[l*320+0]=(fontdata8x8[((text[i])*8)+l]&0x80)?0xffff:0x0000;
< 			screen[l*320+1]=(fontdata8x8[((text[i])*8)+l]&0x40)?0xffff:0x0000;
< 			screen[l*320+2]=(fontdata8x8[((text[i])*8)+l]&0x20)?0xffff:0x0000;
< 			screen[l*320+3]=(fontdata8x8[((text[i])*8)+l]&0x10)?0xffff:0x0000;
< 			screen[l*320+4]=(fontdata8x8[((text[i])*8)+l]&0x08)?0xffff:0x0000;
< 			screen[l*320+5]=(fontdata8x8[((text[i])*8)+l]&0x04)?0xffff:0x0000;
< 			screen[l*320+6]=(fontdata8x8[((text[i])*8)+l]&0x02)?0xffff:0x0000;
< 			screen[l*320+7]=(fontdata8x8[((text[i])*8)+l]&0x01)?0xffff:0x0000;
---
> 			screen[l*320*2+0]=(fontdata8x8[((text[i])*8)+l]&0x80)?0xffff:0x0000;
> 			screen[l*320*2+1]=(fontdata8x8[((text[i])*8)+l]&0x40)?0xffff:0x0000;
> 			screen[l*320*2+2]=(fontdata8x8[((text[i])*8)+l]&0x20)?0xffff:0x0000;
> 			screen[l*320*2+3]=(fontdata8x8[((text[i])*8)+l]&0x10)?0xffff:0x0000;
> 			screen[l*320*2+4]=(fontdata8x8[((text[i])*8)+l]&0x08)?0xffff:0x0000;
> 			screen[l*320*2+5]=(fontdata8x8[((text[i])*8)+l]&0x04)?0xffff:0x0000;
> 			screen[l*320*2+6]=(fontdata8x8[((text[i])*8)+l]&0x02)?0xffff:0x0000;
> 			screen[l*320*2+7]=(fontdata8x8[((text[i])*8)+l]&0x01)?0xffff:0x0000;
diff -Nr old_pcsx4all/src/psxcommon.h new_pcsx4all/src/psxcommon.h
164c164,165
< 
---
> 	// add new ...
>     boolean AnalogArrow;

完成


返回上一頁