diff --git a/.github/workflows/PS2.yml b/.github/workflows/PS2.yml new file mode 100644 index 0000000000..af61258f15 --- /dev/null +++ b/.github/workflows/PS2.yml @@ -0,0 +1,38 @@ +name: CI PS2 + +on: + push: + pull_request: + repository_dispatch: + types: [run_build] + +jobs: + build: + runs-on: ubuntu-latest + container: + image: git.libretro.com:5050/libretro-infrastructure/libretro-build-ps2:latest + options: --user root + + steps: + - uses: actions/checkout@v2 + + - name: Compile Salamander + run: | + make -f Makefile.ps2.salamander -j$(getconf _NPROCESSORS_ONLN) clean + make -f Makefile.ps2.salamander -j$(getconf _NPROCESSORS_ONLN) release + + - name: Compile RA + run: | + make -f Makefile.ps2 -j$(getconf _NPROCESSORS_ONLN) clean + make -f Makefile.ps2 -j$(getconf _NPROCESSORS_ONLN) HAVE_STATIC_DUMMY=1 release + + - name: Get short SHA + id: slug + run: echo "::set-output name=sha8::$(echo ${GITHUB_SHA} | cut -c1-8)" + + - uses: actions/upload-artifact@v2 + with: + name: RA-PS2-dummy-${{ steps.slug.outputs.sha8 }} + path: | + raboot.elf + retroarchps2.elf \ No newline at end of file diff --git a/.gitignore b/.gitignore index 1cc9d98bf7..3266549691 100644 --- a/.gitignore +++ b/.gitignore @@ -198,8 +198,7 @@ retroarch_switch.nro retroarch_switch.nso # PS2 -ps2/irx/*.c -*.irx +*_irx.c # Wayland gfx/common/wayland/idle-inhibit-unstable-v1.c diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b00b879406..05b437575c 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -688,6 +688,8 @@ build-static-retroarch-dummy-vita: build-static-retroarch-ps2: image: $CI_SERVER_HOST:5050/libretro-infrastructure/libretro-build-ps2:latest stage: prepare-for-static-cores + before_script: + - export NUMPROC=$(($(nproc)/3)) artifacts: paths: - retroarch-precompiled/ @@ -698,8 +700,7 @@ build-static-retroarch-ps2: - build-static-retroarch-dummy-ps2 script: # Allow failure since we don't have a core - # PS2 makefile for now doesn't allow -jX so this is why is hardcoded to -j1 - - "make -f Makefile.ps2 -j1 ||:" + - "make -f Makefile.ps2 -j$NUMPROC ||:" - "mkdir .retroarch-precompiled" - "cp -r ./* .retroarch-precompiled/" - "mv .retroarch-precompiled/ retroarch-precompiled/" @@ -708,8 +709,7 @@ build-static-retroarch-dummy-ps2: image: $CI_SERVER_HOST:5050/libretro-infrastructure/libretro-build-ps2:latest stage: build before_script: - # PS2 doesn't allow to use -jX for now - - export NUMPROC=1 + - export NUMPROC=$(($(nproc)/3)) artifacts: paths: - raboot.elf diff --git a/Makefile.common b/Makefile.common index 3018d59bee..41cd247453 100644 --- a/Makefile.common +++ b/Makefile.common @@ -198,6 +198,10 @@ ifeq ($(TARGET), retroarch_3ds) OBJ += frontend/drivers/platform_ctr.o endif +ifeq ($(TARGET), retroarch_ps2) + OBJ += frontend/drivers/platform_ps2.o +endif + # Git Version GIT_VERSION_CACHEDIR = $(if $(OBJDIR),$(OBJDIR),$(CURDIR)) GIT_VERSION_CACHEFILE = $(GIT_VERSION_CACHEDIR)/git-version.cache @@ -378,6 +382,10 @@ DEFINES += -DHAVE_VIDEO_FILTER OBJ += gfx/video_filter.o endif +ifeq ($(HAVE_WINDOW_OFFSET), 1) +DEFINES += -DHAVE_WINDOW_OFFSET +endif + OBJ += $(LIBRETRO_COMM_DIR)/audio/resampler/audio_resampler.o ifeq ($(HAVE_DSP_FILTER), 1) @@ -823,6 +831,10 @@ ifeq ($(TARGET), retroarch_3ds) OBJ += gfx/drivers_font/ctr_font.o endif +ifeq ($(TARGET), retroarch_ps2) + OBJ += gfx/drivers_font/ps2_font.o +endif + ifeq ($(HAVE_LIBNX), 1) OBJ += gfx/drivers_font/switch_font.o endif @@ -1169,6 +1181,13 @@ ifeq ($(TARGET), retroarch_3ds) input/drivers_joypad/ctr_joypad.o endif +ifeq ($(TARGET), retroarch_ps2) + OBJ += gfx/drivers/ps2_gfx.o \ + input/drivers/ps2_input.o \ + input/drivers_joypad/ps2_joypad.o \ + audio/drivers/ps2_audio.o +endif + ifeq ($(TARGET), retroarch_orbis) OBJ += input/drivers/ps4_input.o \ input/drivers_joypad/ps4_joypad.o \ diff --git a/Makefile.griffin b/Makefile.griffin index cb29ea90a8..95c6d25455 100644 --- a/Makefile.griffin +++ b/Makefile.griffin @@ -1197,6 +1197,10 @@ ifeq ($(HAVE_FILTERS_BUILTIN), 1) CFLAGS += -DHAVE_FILTERS_BUILTIN endif +ifeq ($(HAVE_WINDOW_OFFSET), 1) + CFLAGS += -DHAVE_WINDOW_OFFSET +endif + ifeq ($(HAVE_THREADS), 1) CFLAGS += -DHAVE_THREADS diff --git a/Makefile.ps2 b/Makefile.ps2 index b9a71317f3..de1323a31b 100644 --- a/Makefile.ps2 +++ b/Makefile.ps2 @@ -1,61 +1,33 @@ +TARGET := retroarch_ps2 +TARGET_RELEASE = retroarchps2.elf + BUILD_FOR_PCSX2 = 0 DEBUG = 0 SCREEN_DEBUG = 0 +GRIFFIN_BUILD = 0 HAVE_THREADS = 0 MUTE_WARNINGS = 1 +WHOLE_ARCHIVE_LINK = 0 +HAVE_STATIC_DUMMY ?= 0 PS2_IP = 192.168.1.10 -TARGET = retroarchps2-debug.elf -TARGET_RELEASE = retroarchps2.elf - -# Compile the IRXs first -IRX_DIR = ps2/irx - ifeq ($(DEBUG), 1) OPTIMIZE_LV := -O0 -g - RARCH_DEFINES += -DDEBUG + DEFINES += -DDEBUG else OPTIMIZE_LV := -O3 - LDFLAGS := -s + # LDFLAGS := -s endif ifeq ($(MUTE_WARNINGS), 1) DISABLE_WARNINGS := -Wno-unused -Wno-format -Wno-format-truncation endif -INCDIR = -I$(PS2DEV)/gsKit/include -I$(PS2SDK)/ports/include -INCDIR += -Ips2/include -Ilibretro-common/include -Ideps -Ideps/stb -Ideps/7zip -CFLAGS = $(OPTIMIZE_LV) $(DISABLE_WARNINGS) -ffast-math -fsingle-precision-constant -ASFLAGS = $(CFLAGS) - -RARCH_DEFINES += -DPS2 \ - -DHAVE_GRIFFIN=1 \ - -DRARCH_INTERNAL \ - -DHAVE_SCREENSHOTS \ - -DHAVE_REWIND \ - -DRARCH_CONSOLE \ - -DHAVE_MENU \ - -DHAVE_CONFIGFILE \ - -DHAVE_PATCH \ - -DHAVE_CHEATS \ - -DHAVE_ZLIB \ - -DHAVE_NO_BUILTINZLIB \ - -DHAVE_RPNG \ - -DHAVE_RJPEG \ - -DHAVE_FILTERS_BUILTIN \ - -DHAVE_7ZIP \ - -D_7ZIP_ST \ - -DHAVE_CC_RESAMPLER \ - -DHAVE_AUDIOMIXER \ - -DHAVE_WINDOW_OFFSET \ - -DHAVE_VIDEO_FILTER \ - -DHAVE_RGUI \ - -DHAVE_DSP_FILTER \ - -DHAVE_CORE_INFO_CACHE - -LDFLAGS += -L$(PS2DEV)/gsKit/lib -L$(PS2SDK)/ports/lib -L. -# Lib cdvd is needed to get proper time -LIBS += -lretro_ps2 -lpatches -lgskit -ldmakit -laudsrv -lmtap -lpadx -lz -lcdvd -lelf-loader -lfileXio -lpoweroff +ifeq ($(HAVE_STATIC_DUMMY),1) + DEFINES += -DHAVE_STATIC_DUMMY +else + LIBS += -lretro_ps2 +endif ifeq ($(SCREEN_DEBUG), 1) LIBS += -ldebug @@ -66,25 +38,73 @@ ifeq ($(BUILD_FOR_PCSX2), 1) RARCH_DEFINES += -DBUILD_FOR_PCSX2 endif -ifeq ($(HAVE_THREADS), 1) -RARCH_DEFINES += -DHAVE_THREADS +DEFINES += -DRARCH_INTERNAL -DRARCH_CONSOLE + +ifeq ($(GRIFFIN_BUILD), 1) + OBJ += griffin/griffin.o + DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_SCREENSHOTS -DHAVE_REWIND -DHAVE_MENU -DHAVE_CONFIGFILE -DHAVE_PATCH -DHAVE_CHEATS + DEFINES += -DHAVE_ZLIB -DHAVE_NO_BUILTINZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_FILTERS_BUILTIN -DHAVE_7ZIP -D_7ZIP_ST -DHAVE_CC_RESAMPLER -DHAVE_AUDIOMIXER + DEFINES += -DHAVE_VIDEO_FILTER -DHAVE_RGUI -DHAVE_WINDOW_OFFSET + DEFINES += -DHAVE_DSP_FILTER +else + HAVE_CC_RESAMPLER = 1 + HAVE_MENU_COMMON = 1 + HAVE_RPNG = 1 + HAVE_RJPEG = 1 + HAVE_RBMP = 1 + HAVE_MENU = 1 + HAVE_CONFIGFILE = 1 + HAVE_PATCH = 1 + HAVE_CHEATS = 1 + HAVE_RGUI = 1 + HAVE_ZLIB = 1 + HAVE_NO_BUILTINZLIB = 1 + HAVE_7ZIP = 1 + HAVE_SCREENSHOTS = 1 + HAVE_REWIND = 1 + HAVE_AUDIOMIXER = 1 + HAVE_RWAV = 1 + HAVE_DSP_FILTER = 1 + HAVE_VIDEO_FILTER = 1 + HAVE_FILTERS_BUILTIN = 1 + HAVE_WINDOW_OFFSET = 1 + + include Makefile.common + CFLAGS += $(DEF_FLAGS) + BLACKLIST := + OBJ := $(filter-out $(BLACKLIST),$(OBJ)) + INCDIRS += $(INCLUDE_DIRS) endif -CFLAGS += $(RARCH_DEFINES) +ifeq ($(strip $(PS2SDK)),) +$(error "Please set PS2SDK in your environment. export PS2SDK=ps2sdk") +endif -# All the IRX objects -EE_OBJS += $(IRX_DIR)/sio2man_irx.o $ $(IRX_DIR)/iomanX_irx.o $(IRX_DIR)/fileXio_irx.o -EE_OBJS += $(IRX_DIR)/mcman_irx.o $(IRX_DIR)/mcserv_irx.o -EE_OBJS += $(IRX_DIR)/usbd_irx.o $(IRX_DIR)/bdm_irx.o $(IRX_DIR)/bdmfs_vfat_irx.o $(IRX_DIR)/usbmass_bd_irx.o -EE_OBJS += $(IRX_DIR)/libsd_irx.o $(IRX_DIR)/audsrv_irx.o -EE_OBJS += $(IRX_DIR)/cdfs_irx.o -EE_OBJS += $(IRX_DIR)/ps2dev9_irx.o $(IRX_DIR)/ps2atad_irx.o $(IRX_DIR)/ps2hdd_irx.o $(IRX_DIR)/ps2fs_irx.o $(IRX_DIR)/poweroff_irx.o -EE_OBJS += $(IRX_DIR)/mtapman_irx.o $(IRX_DIR)/padman_irx.o +INCDIR = -I$(PS2DEV)/gsKit/include -I$(PS2SDK)/ports/include +INCDIR += -Ips2/include -Ilibretro-common/include -Ideps -Ideps/stb -Ideps/7zip + +LDFLAGS += -L$(PS2DEV)/gsKit/lib -L$(PS2SDK)/ports/lib -L. +# Lib cdvd is needed to get proper time +LIBS += -lpatches -lgskit -ldmakit -laudsrv -lmtap -lpadx -lz -lcdvd -lelf-loader -lfileXio -lpoweroff + + +CFLAGS = $(OPTIMIZE_LV) $(DISABLE_WARNINGS) $(DEFINES) -DPS2 -ffast-math -fsingle-precision-constant +ASFLAGS = $(CFLAGS) + +# IRX libs +IRX_FILES += sio2man.irx iomanX.irx fileXio.irx +IRX_FILES += mcman.irx mcserv.irx +IRX_FILES += usbd.irx bdm.irx bdmfs_vfat.irx usbmass_bd.irx +IRX_FILES += libsd.irx audsrv.irx +IRX_FILES += cdfs.irx +IRX_FILES += ps2dev9.irx ps2atad.irx ps2hdd.irx ps2fs.irx poweroff.irx +IRX_FILES += mtapman.irx padman.irx +EE_OBJS += $(IRX_FILES:.irx=_irx.o) # Missing objecst on the PS2SDK EE_OBJS += ps2/compat_files/ps2_devices.o -EE_OBJS += griffin/griffin.o +EE_OBJS += $(OBJ) EE_CFLAGS = $(CFLAGS) EE_CXXFLAGS = $(CFLAGS) @@ -92,18 +112,14 @@ EE_LDFLAGS = $(LDFLAGS) EE_LIBS = $(LIBS) EE_ASFLAGS = $(ASFLAGS) EE_INCS = $(INCDIR) -EE_BIN = $(TARGET) +EE_BIN = $(TARGET).elf EE_GPVAL = $(GPVAL) -all: irxdir $(EE_BIN) - -irxdir: - $(MAKE) -C $(IRX_DIR) +all: $(EE_BIN) clean: rm -f $(EE_BIN) $(EE_OBJS) - $(MAKE) -C $(IRX_DIR) clean prepare: ps2client -h $(PS2_IP) reset @@ -117,10 +133,12 @@ sim: debug: clean all run -package: +release: all ps2-packer $(EE_BIN) $(TARGET_RELEASE) -release: clean all package +# IRX files +%_irx.c: + $(PS2SDK)/bin/bin2c $(PS2SDK)/iop/irx/$*.irx $@ $*_irx #Include preferences include $(PS2SDK)/samples/Makefile.pref diff --git a/Makefile.ps2.salamander b/Makefile.ps2.salamander index 548b9f69af..652760a182 100644 --- a/Makefile.ps2.salamander +++ b/Makefile.ps2.salamander @@ -7,9 +7,6 @@ PS2_IP = 192.168.1.150 TARGET = raboot-debug.elf TARGET_RELEASE = raboot.elf -# Compile the IRXs first -IRX_DIR = ps2/irx - ifeq ($(DEBUG), 1) OPTIMIZE_LV := -O0 -g RARCH_DEFINES += -DDEBUG @@ -19,7 +16,7 @@ else endif ifeq ($(MUTE_WARNINGS), 1) - DISABLE_WARNINGS := -Wno-sign-compare -Wno-unused -Wno-parentheses + DISABLE_WARNINGS := -Wno-unused -Wno-format -Wno-format-truncation endif INCDIR = -Ilibretro-common/include @@ -63,14 +60,15 @@ EE_OBJS = frontend/frontend_salamander.o \ libretro-common/hash/lrc_hash.o \ libretro-common/time/rtime.o \ verbosity.o \ - ps2/compat_files/ps2_devices.o + ps2/compat_files/ps2_devices.o -# Needed IRX objects -EE_OBJS += $(IRX_DIR)/sio2man_irx.o $ $(IRX_DIR)/iomanX_irx.o $(IRX_DIR)/fileXio_irx.o -EE_OBJS += $(IRX_DIR)/mcman_irx.o $(IRX_DIR)/mcserv_irx.o -EE_OBJS += $(IRX_DIR)/usbd_irx.o $(IRX_DIR)/bdm_irx.o $(IRX_DIR)/bdmfs_vfat_irx.o $(IRX_DIR)/usbmass_bd_irx.o -EE_OBJS += $(IRX_DIR)/cdfs_irx.o -EE_OBJS += $(IRX_DIR)/ps2dev9_irx.o $(IRX_DIR)/ps2atad_irx.o $(IRX_DIR)/ps2hdd_irx.o $(IRX_DIR)/ps2fs_irx.o $(IRX_DIR)/poweroff_irx.o +# IRX libs +IRX_FILES += sio2man.irx iomanX.irx fileXio.irx +IRX_FILES += mcman.irx mcserv.irx +IRX_FILES += usbd.irx bdm.irx bdmfs_vfat.irx usbmass_bd.irx +IRX_FILES += cdfs.irx +IRX_FILES += ps2dev9.irx ps2atad.irx ps2hdd.irx ps2fs.irx poweroff.irx +EE_OBJS += $(IRX_FILES:.irx=_irx.o) EE_CFLAGS = $(CFLAGS) EE_CXXFLAGS = $(CFLAGS) @@ -81,24 +79,22 @@ EE_INCS = $(INCDIR) EE_BIN = $(TARGET) EE_GPVAL = $(GPVAL) -all: irxdir $(EE_BIN) - -irxdir: - $(MAKE) -C $(IRX_DIR) +all: $(EE_BIN) clean: rm -f $(EE_BIN) $(EE_OBJS) - $(MAKE) -C $(IRX_DIR) clean debug: clean all run run: ps2client -h $(PS2_IP) execee host:$(EE_BIN) -package: +release: all ps2-packer $(EE_BIN) $(TARGET_RELEASE) -release: clean all package +# IRX files +%_irx.c: + $(PS2SDK)/bin/bin2c $(PS2SDK)/iop/irx/$*.irx $@ $*_irx #Include preferences include $(PS2SDK)/samples/Makefile.pref diff --git a/cores/dynamic_dummy.c b/cores/dynamic_dummy.c index 4d3d9b09e8..43f2fbdad6 100644 --- a/cores/dynamic_dummy.c +++ b/cores/dynamic_dummy.c @@ -34,7 +34,7 @@ static uint16_t *dummy_frame_buf; static uint16_t frame_buf_width; static uint16_t frame_buf_height; -#if defined(HAVE_LIBNX) && defined(HAVE_STATIC_DUMMY) +#if defined(HAVE_STATIC_DUMMY) void retro_init(void) { libretro_dummy_retro_init(); } void retro_deinit(void) { libretro_dummy_retro_deinit(); } unsigned retro_api_version(void) { return libretro_dummy_retro_api_version(); } diff --git a/frontend/drivers/platform_ps2.c b/frontend/drivers/platform_ps2.c index 842cf59d47..2a6a7ead00 100644 --- a/frontend/drivers/platform_ps2.c +++ b/frontend/drivers/platform_ps2.c @@ -26,6 +26,9 @@ #include #include #include +#include +#include +#include #define NEWLIB_PORT_AWARE #include @@ -36,6 +39,13 @@ #include #endif +#ifndef IS_SALAMANDER +#include "../../retroarch.h" +#ifdef HAVE_MENU +#include "../../menu/menu_driver.h" +#endif +#endif + #include #include @@ -144,23 +154,23 @@ static int hddCheck(void) return ret; } -static void load_hdd_modules() +static void load_hdd_modules() { pfsModuleLoaded = 0; int ret; char hddarg[] = "-o" "\0" "4" "\0" "-n" "\0" "20"; - + ret = SifExecModuleBuffer(&ps2dev9_irx, size_ps2dev9_irx, 0, NULL, NULL); ret = SifExecModuleBuffer(&ps2atad_irx, size_ps2atad_irx, 0, NULL, NULL); - if (ret < 0) + if (ret < 0) { RARCH_WARN("HDD: No HardDisk Drive detected.\n"); return; } ret = SifExecModuleBuffer(&ps2hdd_irx, size_ps2hdd_irx, sizeof(hddarg), hddarg, NULL); - if (ret < 0) + if (ret < 0) { RARCH_WARN("HDD: No HardDisk Drive detected.\n"); return; @@ -182,7 +192,7 @@ static void load_hdd_modules() pfsModuleLoaded = 1; } -static void load_modules() +static void load_modules() { /* I/O Files */ SifExecModuleBuffer(&iomanX_irx, size_iomanX_irx, 0, NULL, NULL); @@ -232,9 +242,9 @@ static int mount_hdd_partition() { { shouldMount = 1; strlcpy(mountPath, cwd, sizeof(mountPath)); - } + } #if !defined(IS_SALAMANDER) && defined(DEBUG) - else + else { // Even if we're booting from USB, try to mount default partition strcpy(mountPath, DEFAULT_PARTITION); @@ -245,22 +255,22 @@ static int mount_hdd_partition() { if (!shouldMount) return 0; - if (getMountInfo(mountPath, mountString, mountPoint, newCWD) != 1) + if (getMountInfo(mountPath, mountString, mountPoint, newCWD) != 1) { RARCH_WARN("Partition info not readed\n"); return 0; - } - - if (fileXioMount(mountString, mountPoint, FIO_MT_RDWR) < 0) + } + + if (fileXioMount(mountString, mountPoint, FIO_MT_RDWR) < 0) { RARCH_WARN("Error mount mounting partition %s, %s\n", mountString, mountPoint); return 0; - } - + } + if (bootDeviceID == BOOT_DEVICE_HDD || bootDeviceID == BOOT_DEVICE_HDD0) { // If we're booting from HDD, we must update the cwd variable and add : to the mount point - sprintf(cwd, "%s", newCWD); + strncpy(cwd, newCWD, sizeof(cwd)); strcat(mountPoint, ":"); } else { // we MUST put mountPoint as empty to avoid wrong results with LoadELFFromFileWithPartition @@ -270,9 +280,9 @@ static int mount_hdd_partition() { return 1; } -static void prepare_for_exit(void) +static void prepare_for_exit(void) { - if (hddMounted) + if (hddMounted) { fileXioUmount(mountString); fileXioDevctl(mountString, PDIOC_CLOSEALL, NULL, 0, NULL, 0); @@ -292,7 +302,6 @@ static void poweroffHandler(void *arg) static void frontend_ps2_get_env(int *argc, char *argv[], void *args, void *params_data) { - int i; create_path_names(); #ifndef IS_SALAMANDER @@ -489,7 +498,7 @@ static int frontend_ps2_parse_drive_list(void *data, bool load_content) msg_hash_to_str(MENU_ENUM_LABEL_FILE_DETECT_CORE_LIST_PUSH_DIR), enum_idx, FILE_TYPE_DIRECTORY, 0, 0); - if (hddMounted) + if (hddMounted) { sprintf(hdd, "%s/", mountString); menu_entries_append_enum(list, diff --git a/gfx/common/ps2_common.h b/gfx/common/ps2_common.h new file mode 100644 index 0000000000..476960a13f --- /dev/null +++ b/gfx/common/ps2_common.h @@ -0,0 +1,52 @@ +#ifndef PS2_COMMON_H__ +#define PS2_COMMON_H__ + +#include +#include + +#include +#include + +#include "../video_defines.h" +#include "../../libretro-common/include/libretro_gskit_ps2.h" + +typedef struct ps2_video +{ + /* I need to create this additional field + * to be used in the font driver*/ + bool clearVRAM_font; + bool menuVisible; + bool vsync; + int vsync_callback_id; + bool force_aspect; + + int8_t vmode; + int video_window_offset_x; + int video_window_offset_y; + + int PSM; + int tex_filter; + int menu_filter; + + video_viewport_t vp; + + /* Palette in the cores */ + struct retro_hw_render_interface_gskit_ps2 iface; + + GSGLOBAL *gsGlobal; + GSTEXTURE *menuTexture; + GSTEXTURE *coreTexture; + + /* Last scaling state, for detecting changes */ + int iTextureWidth; + int iTextureHeight; + float fDAR; + bool bScaleInteger; + struct retro_hw_ps2_insets padding; + + /* Current scaling calculation result */ + int iDisplayWidth; + int iDisplayHeight; +} ps2_video_t; + +#endif diff --git a/gfx/drivers/ps2_gfx.c b/gfx/drivers/ps2_gfx.c index 92936894ef..285a7363df 100644 --- a/gfx/drivers/ps2_gfx.c +++ b/gfx/drivers/ps2_gfx.c @@ -22,6 +22,8 @@ #include "../../verbosity.h" #include "../../libretro-common/include/libretro_gskit_ps2.h" +#include "../gfx_display.h" +#include "../common/ps2_common.h" /* Generic tint color */ #define GS_TEXT GS_SETREG_RGBA(0x80, 0x80, 0x80, 0x80) @@ -59,45 +61,6 @@ static struct rm_mode rm_mode_table[NUM_RM_VMODES] = { {GS_MODE_DTV_576P, 704, 576, 2, GS_NONINTERLACED, GS_FRAME, 12, 11, "DTV576P@50Hz"}, }; -typedef struct ps2_video -{ - /* I need to create this additional field - * to be used in the font driver*/ - bool clearVRAM_font; - bool menuVisible; - bool vsync; - int vsync_callback_id; - bool force_aspect; - - int8_t vmode; - int video_window_offset_x; - int video_window_offset_y; - - int PSM; - int tex_filter; - int menu_filter; - - video_viewport_t vp; - - /* Palette in the cores */ - struct retro_hw_render_interface_gskit_ps2 iface; - - GSGLOBAL *gsGlobal; - GSTEXTURE *menuTexture; - GSTEXTURE *coreTexture; - - /* Last scaling state, for detecting changes */ - int iTextureWidth; - int iTextureHeight; - float fDAR; - bool bScaleInteger; - struct retro_hw_ps2_insets padding; - - /* Current scaling calculation result */ - int iDisplayWidth; - int iDisplayHeight; -} ps2_video_t; - static int vsync_sema_id; /* PRIVATE METHODS */ diff --git a/gfx/drivers_font/ps2_font.c b/gfx/drivers_font/ps2_font.c index 7ee91f6269..88ea2e8f3a 100644 --- a/gfx/drivers_font/ps2_font.c +++ b/gfx/drivers_font/ps2_font.c @@ -15,13 +15,20 @@ #include #include +#include #include #include #include #include +#include + +#include "../common/ps2_common.h" #include "../font_driver.h" +#include "../../configuration.h" +#include "../../verbosity.h" + typedef struct { GSTEXTURE *texture; @@ -35,7 +42,6 @@ static void* ps2_font_init_font(void* data, const char* font_path, const struct font_atlas* atlas = NULL; uint32_t j; ps2_font_t* font = (ps2_font_t*)calloc(1, sizeof(*font)); - ps2_video_t* ps2 = (ps2_video_t*)data; if (!font) return NULL; @@ -146,7 +152,7 @@ static void ps2_font_render_line( if (!ps2) return; - + /* Enable Alpha for font */ gsKit_set_primalpha(ps2->gsGlobal, GS_SETREG_ALPHA(0, 1, 0, 1, 0), 0); ps2->gsGlobal->PrimAlphaEnable = GS_SETTING_ON; diff --git a/input/drivers_joypad/ps2_joypad.c b/input/drivers_joypad/ps2_joypad.c index 771d264b7e..e0801c52e1 100644 --- a/input/drivers_joypad/ps2_joypad.c +++ b/input/drivers_joypad/ps2_joypad.c @@ -16,8 +16,10 @@ #include #include #include +#include #include "../../config.def.h" +#include "../../tasks/tasks_internal.h" #include "../input_driver.h" diff --git a/ps2/include/ps2_irx_variables.h b/ps2/include/ps2_irx_variables.h index cc52452e94..b62702f6bf 100644 --- a/ps2/include/ps2_irx_variables.h +++ b/ps2/include/ps2_irx_variables.h @@ -15,73 +15,73 @@ #ifndef PS2_IRX_VARIABLES_H #define PS2_IRX_VARIABLES_H -extern unsigned char sio2man_irx; +extern unsigned char sio2man_irx[] __attribute__((aligned(16))); extern unsigned int size_sio2man_irx; -extern unsigned char mcman_irx; +extern unsigned char mcman_irx[] __attribute__((aligned(16))); extern unsigned int size_mcman_irx; -extern unsigned char mcserv_irx; +extern unsigned char mcserv_irx[] __attribute__((aligned(16))); extern unsigned int size_mcserv_irx; -extern unsigned char mtapman_irx; +extern unsigned char mtapman_irx[] __attribute__((aligned(16))); extern unsigned int size_mtapman_irx; -extern unsigned char padman_irx; +extern unsigned char padman_irx[] __attribute__((aligned(16))); extern unsigned int size_padman_irx; -extern unsigned char iomanX_irx; +extern unsigned char iomanX_irx[] __attribute__((aligned(16))); extern unsigned int size_iomanX_irx; -extern unsigned char fileXio_irx; +extern unsigned char fileXio_irx[] __attribute__((aligned(16))); extern unsigned int size_fileXio_irx; -extern unsigned char ps2dev9_irx; +extern unsigned char ps2dev9_irx[] __attribute__((aligned(16))); extern unsigned int size_ps2dev9_irx; -extern unsigned char ps2atad_irx; +extern unsigned char ps2atad_irx[] __attribute__((aligned(16))); extern unsigned int size_ps2atad_irx; -extern unsigned char ps2hdd_irx; +extern unsigned char ps2hdd_irx[] __attribute__((aligned(16))); extern unsigned int size_ps2hdd_irx; -extern unsigned char ps2fs_irx; +extern unsigned char ps2fs_irx[] __attribute__((aligned(16))); extern unsigned int size_ps2fs_irx; -extern unsigned char usbd_irx; +extern unsigned char usbd_irx[] __attribute__((aligned(16))); extern unsigned int size_usbd_irx; -extern unsigned char bdm_irx; +extern unsigned char bdm_irx[] __attribute__((aligned(16))); extern unsigned int size_bdm_irx; -extern unsigned char bdmfs_vfat_irx; +extern unsigned char bdmfs_vfat_irx[] __attribute__((aligned(16))); extern unsigned int size_bdmfs_vfat_irx; -extern unsigned char usbmass_bd_irx; +extern unsigned char usbmass_bd_irx[] __attribute__((aligned(16))); extern unsigned int size_usbmass_bd_irx; -extern unsigned char cdfs_irx; +extern unsigned char cdfs_irx[] __attribute__((aligned(16))); extern unsigned int size_cdfs_irx; -extern unsigned char libsd_irx; +extern unsigned char libsd_irx[] __attribute__((aligned(16))); extern unsigned int size_libsd_irx; -extern unsigned char audsrv_irx; +extern unsigned char audsrv_irx[] __attribute__((aligned(16))); extern unsigned int size_audsrv_irx; -extern unsigned char ps2dev9_irx; +extern unsigned char ps2dev9_irx[] __attribute__((aligned(16))); extern unsigned int size_ps2dev9_irx; -extern unsigned char ps2atad_irx; +extern unsigned char ps2atad_irx[] __attribute__((aligned(16))); extern unsigned int size_ps2atad_irx; -extern unsigned char ps2hdd_irx; +extern unsigned char ps2hdd_irx[] __attribute__((aligned(16))); extern unsigned int size_ps2hdd_irx; -extern unsigned char ps2fs_irx; +extern unsigned char ps2fs_irx[] __attribute__((aligned(16))); extern unsigned int size_ps2fs_irx; -extern unsigned char poweroff_irx; +extern unsigned char poweroff_irx[] __attribute__((aligned(16))); extern unsigned int size_poweroff_irx; #endif /* PS2_IRX_VARIABLES_H */ diff --git a/ps2/irx/Makefile b/ps2/irx/Makefile deleted file mode 100644 index 8e6e89ed76..0000000000 --- a/ps2/irx/Makefile +++ /dev/null @@ -1,27 +0,0 @@ -#Configuration for IRX -EE_BIN2C = bin2c -IRX_DIR = $(PS2SDK)/iop/irx - -#IRX modules -# IRX modules - modules have to be in IRX_DIR -IRX_FILES += mtapman.irx padman.irx poweroff.irx -IRX_FILES += iomanX.irx fileXio.irx sio2man.irx mcman.irx mcserv.irx -IRX_FILES += usbd.irx bdm.irx bdmfs_vfat.irx usbmass_bd.irx -IRX_FILES += ps2dev9.irx ps2atad.irx ps2hdd.irx ps2fs.irx -IRX_FILES += libsd.irx audsrv.irx cdfs.irx -IRX_C_FILES = $(IRX_FILES:.irx=_irx.c) - -all: irxs - -# Specific file name and output per IRX Module -%.irx: - $(EE_BIN2C) $(IRX_DIR)/$@ $(@:.irx=_irx.c) $(@:.irx=_irx) - -irxs: $(IRX_FILES) - -clean: - rm -f $(IRX_C_FILES) - -#Include preferences -include $(PS2SDK)/samples/Makefile.pref -include $(PS2SDK)/samples/Makefile.eeglobal