Skip to content

Commit 1909e86

Browse files
committed
build, add windows (very experimental)
1 parent aa99b32 commit 1909e86

File tree

7 files changed

+146
-184
lines changed

7 files changed

+146
-184
lines changed

.github/workflows/ci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,26 @@ jobs:
2525
- name: make
2626
run: LDFLAGS=-Wl,--no-undefined make -j$(getconf _NPROCESSORS_ONLN) -f Makefile.libretro
2727

28+
build-win32:
29+
runs-on: ubuntu-latest
30+
container: ghcr.io/irixxxx/toolchain-win32
31+
steps:
32+
- uses: actions/checkout@v4
33+
with:
34+
submodules: true
35+
- name: build
36+
run: |
37+
git config --global --add safe.directory $PWD
38+
ver=$(cut -d'"' -f2 platform/common/version.h)-$(git rev-parse --short HEAD)
39+
./configure --platform=win32
40+
make -j$(getconf _NPROCESSORS_ONLN)
41+
mv PicoDrive.zip PicoDrive-win32-$ver.zip
42+
- name: artifacts
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: Win32
46+
path: PicoDrive-win32*.zip
47+
2848

2949
build-gp2x:
3050
runs-on: ubuntu-latest

Makefile

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,17 @@ PicoDrive.zip: $(TARGET)
123123
all: PicoDrive.zip
124124
endif
125125

126+
ifeq "$(PLATFORM)" "win32"
127+
PicoDrive.zip: $(TARGET)
128+
$(RM) -rf .od_data
129+
mkdir .od_data
130+
cp -r platform/linux/skin .od_data
131+
cp platform/game_def.cfg .od_data
132+
$(STRIP) $< -o .od_data/PicoDrive.exe
133+
cd .od_data && zip -9 -r ../$@ *
134+
all: PicoDrive.zip
135+
endif
136+
126137
ifeq "$(PLATFORM)" "opendingux"
127138
.od_data: $(TARGET)
128139
$(RM) -rf .od_data
@@ -247,6 +258,14 @@ OBJS += platform/ps2/emu.o
247258
OBJS += platform/ps2/in_ps2.o
248259
USE_FRONTEND = 1
249260
endif
261+
ifeq "$(PLATFORM)" "win32"
262+
CFLAGS += -DSDL_OVERLAY_2X -DSDL_BUFFER_3X -DSDL_REDRAW_EVT
263+
OBJS += platform/win32/plat.o
264+
OBJS += platform/linux/emu.o platform/linux/blit.o # FIXME
265+
OBJS += platform/common/plat_sdl.o platform/common/inputmap_kbd.o
266+
OBJS += platform/libpicofe/plat_sdl.o platform/libpicofe/in_sdl.o
267+
USE_FRONTEND = 1
268+
endif
250269
ifeq "$(PLATFORM)" "libretro"
251270
OBJS += platform/libretro/libretro.o
252271
ifneq ($(STATIC_LINKING), 1)

configure

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ check_define()
3939
# "" means "autodetect".
4040

4141
# TODO this is annoyingly messy. should have platform and device
42-
platform_list="generic pandora gph dingux retrofw opendingux[-gcw0] odbeta[-gcw0] miyoo rpi1 rpi2 ps2 psp"
42+
platform_list="generic pandora gph dingux retrofw opendingux[-gcw0] odbeta[-gcw0] miyoo rpi1 rpi2 ps2 psp win32"
4343
platform="generic"
4444
sound_driver_list="oss alsa sdl"
4545
sound_drivers=""
@@ -160,6 +160,9 @@ set_platform()
160160
CFLAGS="$CFLAGS -D_EE -G0 -I${PS2SDK}/ee/include -I${PS2SDK}/common/include -I${PS2DEV}/gsKit/include -I${PS2SDK}/ports/include"
161161
LDFLAGS="$LDFLAGS -Wl,-zmax-page-size=128 -T${PS2SDK}/ee/startup/linkfile -L${PS2SDK}/ee/lib -L${PS2DEV}/gsKit/lib -L${PS2SDK}/ports/lib"
162162
;;
163+
win32)
164+
MFLAGS=""
165+
;;
163166
*)
164167
fail "unsupported platform: $platform"
165168
;;
@@ -286,7 +289,7 @@ arm*)
286289
esac
287290

288291
case "$platform" in
289-
rpi1 | rpi2 | generic | opendingux)
292+
rpi1 | rpi2 | generic | opendingux | win32)
290293
need_sdl="yes"
291294
;;
292295
esac

platform/common/menu_pico.c

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,25 @@ static void make_bg(int no_scale, int from_screen)
103103

104104
if (!no_scale && g_menuscreen_w / w >= 2 && g_menuscreen_h / h >= 2)
105105
{
106-
u32 t, *d = g_menubg_ptr;
107-
d += (g_menuscreen_h / 2 - h * 2 / 2)
108-
* g_menuscreen_w / 2;
109-
d += (g_menuscreen_w / 2 - w * 2 / 2) / 2;
110-
for (y = 0; y < h; y++, src += pp, d += g_menuscreen_w*2/2) {
111-
for (x = 0; x < w; x++) {
112-
t = src[x];
113-
t = (PXMASKH(t,1)>>1) - (PXMASKH(t,3)>>3);
114-
t |= t << 16;
115-
d[x] = d[x + g_menuscreen_w / 2] = t;
106+
int xf = g_menuscreen_w / w, yf = g_menuscreen_h / h;
107+
int f = no_scale ? 1 : xf < yf ? xf : yf;
108+
int xs = f * w, ys = f * h;
109+
unsigned short t;
110+
int i, j, k, l;
111+
112+
x = (g_menuscreen_w - xs)/2, y = (g_menuscreen_h - ys)/2;
113+
dst = (short *)g_menubg_ptr + y * g_menuscreen_w + x;
114+
for (i = 0; i < h; i++) {
115+
for (j = 0; j < w; j++, src++) {
116+
t = (PXMASKH(*src,1)>>1) - (PXMASKH(*src,3)>>3);
117+
for (l = 0; l < f; l++)
118+
*dst++ = t;
119+
}
120+
src += pp - w;
121+
dst += g_menuscreen_w - xs;
122+
for (k = 1; k < f; k++) {
123+
memcpy(dst, dst-g_menuscreen_w, g_menuscreen_w*2);
124+
dst += g_menuscreen_w;
116125
}
117126
}
118127
return;

platform/linux/emu.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99

1010
#include <stdio.h>
1111
#include <unistd.h>
12-
#include <sys/mman.h>
12+
#ifndef __MINGW32__
13+
#include <sys/mman.h> // MAP_JIT
14+
#endif
1315

1416
#include "../libpicofe/menu.h"
1517
#include "../libpicofe/plat.h"

0 commit comments

Comments
 (0)