Skip to content

Commit

Permalink
build, add windows (very experimental)
Browse files Browse the repository at this point in the history
  • Loading branch information
irixxxx committed Sep 10, 2024
1 parent aa99b32 commit 1909e86
Show file tree
Hide file tree
Showing 7 changed files with 146 additions and 184 deletions.
20 changes: 20 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,26 @@ jobs:
- name: make
run: LDFLAGS=-Wl,--no-undefined make -j$(getconf _NPROCESSORS_ONLN) -f Makefile.libretro

build-win32:
runs-on: ubuntu-latest
container: ghcr.io/irixxxx/toolchain-win32
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: build
run: |
git config --global --add safe.directory $PWD
ver=$(cut -d'"' -f2 platform/common/version.h)-$(git rev-parse --short HEAD)
./configure --platform=win32
make -j$(getconf _NPROCESSORS_ONLN)
mv PicoDrive.zip PicoDrive-win32-$ver.zip
- name: artifacts
uses: actions/upload-artifact@v4
with:
name: Win32
path: PicoDrive-win32*.zip


build-gp2x:
runs-on: ubuntu-latest
Expand Down
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,17 @@ PicoDrive.zip: $(TARGET)
all: PicoDrive.zip
endif

ifeq "$(PLATFORM)" "win32"
PicoDrive.zip: $(TARGET)
$(RM) -rf .od_data
mkdir .od_data
cp -r platform/linux/skin .od_data
cp platform/game_def.cfg .od_data
$(STRIP) $< -o .od_data/PicoDrive.exe
cd .od_data && zip -9 -r ../$@ *
all: PicoDrive.zip
endif

ifeq "$(PLATFORM)" "opendingux"
.od_data: $(TARGET)
$(RM) -rf .od_data
Expand Down Expand Up @@ -247,6 +258,14 @@ OBJS += platform/ps2/emu.o
OBJS += platform/ps2/in_ps2.o
USE_FRONTEND = 1
endif
ifeq "$(PLATFORM)" "win32"
CFLAGS += -DSDL_OVERLAY_2X -DSDL_BUFFER_3X -DSDL_REDRAW_EVT
OBJS += platform/win32/plat.o
OBJS += platform/linux/emu.o platform/linux/blit.o # FIXME
OBJS += platform/common/plat_sdl.o platform/common/inputmap_kbd.o
OBJS += platform/libpicofe/plat_sdl.o platform/libpicofe/in_sdl.o
USE_FRONTEND = 1
endif
ifeq "$(PLATFORM)" "libretro"
OBJS += platform/libretro/libretro.o
ifneq ($(STATIC_LINKING), 1)
Expand Down
7 changes: 5 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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 ps2 psp"
platform_list="generic pandora gph dingux retrofw opendingux[-gcw0] odbeta[-gcw0] miyoo rpi1 rpi2 ps2 psp win32"
platform="generic"
sound_driver_list="oss alsa sdl"
sound_drivers=""
Expand Down Expand Up @@ -160,6 +160,9 @@ set_platform()
CFLAGS="$CFLAGS -D_EE -G0 -I${PS2SDK}/ee/include -I${PS2SDK}/common/include -I${PS2DEV}/gsKit/include -I${PS2SDK}/ports/include"
LDFLAGS="$LDFLAGS -Wl,-zmax-page-size=128 -T${PS2SDK}/ee/startup/linkfile -L${PS2SDK}/ee/lib -L${PS2DEV}/gsKit/lib -L${PS2SDK}/ports/lib"
;;
win32)
MFLAGS=""
;;
*)
fail "unsupported platform: $platform"
;;
Expand Down Expand Up @@ -286,7 +289,7 @@ arm*)
esac

case "$platform" in
rpi1 | rpi2 | generic | opendingux)
rpi1 | rpi2 | generic | opendingux | win32)
need_sdl="yes"
;;
esac
Expand Down
29 changes: 19 additions & 10 deletions platform/common/menu_pico.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,25 @@ static void make_bg(int no_scale, int from_screen)

if (!no_scale && g_menuscreen_w / w >= 2 && g_menuscreen_h / h >= 2)
{
u32 t, *d = g_menubg_ptr;
d += (g_menuscreen_h / 2 - h * 2 / 2)
* g_menuscreen_w / 2;
d += (g_menuscreen_w / 2 - w * 2 / 2) / 2;
for (y = 0; y < h; y++, src += pp, d += g_menuscreen_w*2/2) {
for (x = 0; x < w; x++) {
t = src[x];
t = (PXMASKH(t,1)>>1) - (PXMASKH(t,3)>>3);
t |= t << 16;
d[x] = d[x + g_menuscreen_w / 2] = t;
int xf = g_menuscreen_w / w, yf = g_menuscreen_h / h;
int f = no_scale ? 1 : xf < yf ? xf : yf;
int xs = f * w, ys = f * h;
unsigned short t;
int i, j, k, l;

x = (g_menuscreen_w - xs)/2, y = (g_menuscreen_h - ys)/2;
dst = (short *)g_menubg_ptr + y * g_menuscreen_w + x;
for (i = 0; i < h; i++) {
for (j = 0; j < w; j++, src++) {
t = (PXMASKH(*src,1)>>1) - (PXMASKH(*src,3)>>3);
for (l = 0; l < f; l++)
*dst++ = t;
}
src += pp - w;
dst += g_menuscreen_w - xs;
for (k = 1; k < f; k++) {
memcpy(dst, dst-g_menuscreen_w, g_menuscreen_w*2);
dst += g_menuscreen_w;
}
}
return;
Expand Down
2 changes: 1 addition & 1 deletion platform/libpicofe
Submodule libpicofe updated 5 files
+23 −5 linux/host_dasm.c
+4 −1 linux/plat.c
+1 −1 menu.c
+2 −1 plat_sdl.c
+4 −1 posix.h
4 changes: 3 additions & 1 deletion platform/linux/emu.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@

#include <stdio.h>
#include <unistd.h>
#include <sys/mman.h>
#ifndef __MINGW32__
#include <sys/mman.h> // MAP_JIT
#endif

#include "../libpicofe/menu.h"
#include "../libpicofe/plat.h"
Expand Down
Loading

0 comments on commit 1909e86

Please sign in to comment.