From: Francisco Javier Trujillo Mata Date: Sat, 30 Dec 2023 20:56:14 +0000 (+0100) Subject: First PS2 compilation X-Git-Tag: v2.00~119^2~18 X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb774958736c62c637eab56c6aab1887d29a10fa;p=picodrive.git First PS2 compilation --- diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index af1f4392..fe8d360e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -94,6 +94,30 @@ jobs: name: PSP path: PicoDrive_psp_*.zip + build-ps2: + runs-on: ubuntu-latest + container: ps2dev/ps2dev + steps: + - name: build environment + run: | + apk add build-base cmake git zip make + - uses: actions/checkout@v3 + with: + submodules: true + - name: build + run: | + export CROSS_COMPILE=mips64r5900el-ps2-elf- + git config --global --add safe.directory $PWD + ver=$(cut -d'"' -f2 platform/common/version.h)-$(git rev-parse --short HEAD) + ./configure --platform=ps2 + make -j2 + make -C platform/ps2 rel VER=$ver + - name: artifacts + uses: actions/upload-artifact@v3 + with: + name: PS2 + path: PicoDrive_ps2_*.zip + build-dingux: runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index d8f7cae0..4174c294 100644 --- a/Makefile +++ b/Makefile @@ -235,6 +235,12 @@ OBJS += platform/psp/asm_utils.o OBJS += platform/psp/mp3.o USE_FRONTEND = 1 endif +ifeq "$(PLATFORM)" "ps2" +CFLAGS += -DUSE_BGR555 # -DLOG_TO_FILE +LDLIBS += -lpatches -lgskit -ldmakit -lps2_drivers +OBJS += platform/ps2/plat.o +USE_FRONTEND = 1 +endif ifeq "$(PLATFORM)" "libretro" OBJS += platform/libretro/libretro.o ifneq ($(STATIC_LINKING), 1) diff --git a/configure b/configure index fd2d9a7e..dc887617 100755 --- a/configure +++ b/configure @@ -39,7 +39,7 @@ check_define() # "" means "autodetect". # TODO this is annoyingly messy. should have platform and device -platform_list="generic pandora gph dingux retrofw opendingux[-gcw0] odbeta[-gcw0] miyoo rpi1 rpi2 psp" +platform_list="generic pandora gph dingux retrofw opendingux[-gcw0] odbeta[-gcw0] miyoo rpi1 rpi2 ps2 psp" platform="generic" sound_driver_list="oss alsa sdl" sound_drivers="" @@ -59,6 +59,7 @@ CC="${CC-${CROSS_COMPILE}gcc}" CXX="${CXX-${CROSS_COMPILE}g++}" AS="${AS-${CROSS_COMPILE}as}" STRIP="${STRIP-${CROSS_COMPILE}strip}" +LD="${LD-${CROSS_COMPILE}gcc}" # Use better gcc for linking SYSROOT=`$CC $CFLAGS $LDFLAGS --print-sysroot 2> /dev/null || true` config_mak="config.mak" @@ -150,6 +151,15 @@ set_platform() MFLAGS="-march=allegrex" ARCH=mipsel ;; + ps2) + # use newlib + SYSLIBS="" + MFLAGS="" + ARCH=mips64r5900el + ASFLAGS="$ASFLAGS -G0 -call_shared" + CFLAGS="$CFLAGS -D_EE -G0 -I${PS2SDK}/ee/include -I${PS2SDK}/common/include -I${PS2SDK}/ports/include" + LDFLAGS="$LDFLAGS -Wl,-zmax-page-size=128 -T${PS2SDK}/ee/startup/linkfile -L${PS2SDK}/ee/lib -L${PS2SDK}/ports/lib" + ;; *) fail "unsupported platform: $platform" ;; @@ -457,6 +467,7 @@ echo "CC = $CC" >> $config_mak echo "CXX = $CXX" >> $config_mak echo "AS = $AS" >> $config_mak echo "STRIP = $STRIP" >> $config_mak +echo "LD = $LD" >> $config_mak echo "CFLAGS += $MFLAGS $CFLAGS" >> $config_mak echo "ASFLAGS += $MFLAGS $ASFLAGS" >> $config_mak echo "LDFLAGS += $LDFLAGS" >> $config_mak diff --git a/platform/ps2/Makefile b/platform/ps2/Makefile new file mode 100644 index 00000000..42ba39d6 --- /dev/null +++ b/platform/ps2/Makefile @@ -0,0 +1,27 @@ + +# ----------- release ----------- +ifneq ($(findstring rel,$(MAKECMDGOALS)),) +ifeq ($(VER),) +$(error need VER) +endif +endif + +../../tools/textfilter: ../../tools/textfilter.c + make -C ../../tools/ textfilter + +readme.txt: ../../tools/textfilter ../base_readme.txt ../../ChangeLog + ../../tools/textfilter ../base_readme.txt $@ PS2 + +# ? +rel: ../../PicoDrive readme.txt ../game_def.cfg + mkdir -p PicoDrive/skin/ + cp $^ PicoDrive/ + cp ../../skin/* PicoDrive/skin/ + zip -9 -r ../../PicoDrive_ps2_$(VER).zip PicoDrive + rm -rf PicoDrive + mkdir bin_to_cso_mp3 + cp ../../tools/bin_to_cso_mp3/* bin_to_cso_mp3/ + zip -9 -r ../../PicoDrive_ps2_$(VER).zip bin_to_cso_mp3 + rm -rf bin_to_cso_mp3 + + diff --git a/platform/ps2/plat.c b/platform/ps2/plat.c new file mode 100644 index 00000000..02681734 --- /dev/null +++ b/platform/ps2/plat.c @@ -0,0 +1,108 @@ +#include +#include + +#include "../libpicofe/plat.h" + +const char *renderer_names[] = { "Software", "Hardware" }; +const char *renderer_names32x[] = { "Software", "Hardware", "Hardware (fast)" }; + +struct plat_target plat_target = {}; + +int plat_parse_arg(int argc, char *argv[], int *x) { return 1; } + +void plat_early_init(void) {} + +int plat_target_init(void) { return 0; } + +void plat_init(void) {} + +void plat_video_menu_enter(int is_rom_loaded) {} + +void plat_video_menu_leave(void) {} + +void plat_finish(void) {} + +void plat_target_finish(void) {} + +void plat_video_menu_begin(void) {} + +void plat_video_menu_end(void) {} + +int plat_get_root_dir(char *dst, int len) { return 0; } + + +unsigned int plat_get_ticks_ms(void) { return 0; } + +unsigned int plat_get_ticks_us(void) { return 0; } + +void plat_sleep_ms(int ms) {} + +void plat_video_toggle_renderer(int change, int menu_call) {} + +void plat_update_volume(int has_changed, int is_up) {} + +int plat_is_dir(const char *path) { return 0; } + +void plat_status_msg_busy_first(const char *msg) {} + +void pemu_prep_defconfig(void) {} + +void pemu_validate_config(void) {} + +void plat_status_msg_clear(void) {} + +void plat_status_msg_busy_next(const char *msg) {} + +void plat_video_loop_prepare(void) {} + +int plat_get_data_dir(char *dst, int len) { return 0; } + +void plat_video_flip(void) {} + +void plat_video_wait_vsync(void) {} + +void plat_wait_till_us(unsigned int us) {} + +int plat_get_skin_dir(char *dst, int len) { return 0; } + +void plat_debug_cat(char *str) {} + +int plat_wait_event(int *fds_hnds, int count, int timeout_ms) { return 0; } + +void pemu_loop_prep(void) {} + +void pemu_sound_start(void) {} + +void pemu_loop_end(void) {} + +void *plat_mem_get_for_drc(size_t size) { return NULL; } + +void *plat_mmap(unsigned long addr, size_t size, int need_exec, int is_fixed) { return NULL; } + +void *plat_mremap(void *ptr, size_t oldsize, size_t newsize) { return NULL; } + +void plat_munmap(void *ptr, size_t size) {} + +int plat_mem_set_exec(void *ptr, size_t size) { return 0; } + +void emu_video_mode_change(int start_line, int line_count, int start_col, int col_count) {} + +void pemu_forced_frame(int no_scale, int do_emu) {} + +void pemu_finalize_frame(const char *fps, const char *notice_msg) {} + +int _flush_cache (char *addr, const int size, const int op) { return 0; } + +/* lprintf */ +void lprintf(const char *fmt, ...) +{ + va_list vl; + + va_start(vl, fmt); +#if defined(LOG_TO_FILE) + vfprintf(logFile, fmt, vl); +#else + vprintf(fmt, vl); +#endif + va_end(vl); +} \ No newline at end of file