Skip to content

Commit 8af77a2

Browse files
authored
Merge branch 'libretro:master' into master
2 parents 5d40390 + 0daf92b commit 8af77a2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+1280
-532
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)

Makefile.libretro

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ else ifneq (,$(findstring ios,$(platform)))
146146
ifeq ($(platform),ios-arm64)
147147
CC = clang -arch arm64 -isysroot $(IOSSDK)
148148
CXX = clang++ -arch arm64 -isysroot $(IOSSDK)
149-
CFLAGS += -marm -DARM -D__aarch64__=1
149+
CFLAGS += -DARM -D__aarch64__=1
150150
else
151151
CC = clang -arch armv7 -isysroot $(IOSSDK)
152152
CXX = clang++ -arch armv7 -isysroot $(IOSSDK)
@@ -179,8 +179,13 @@ else ifeq ($(platform), tvos-arm64)
179179
CC_AS = perl ./tools/gas-preprocessor.pl $(CC)
180180
CC = cc -arch arm64 -isysroot $(IOSSDK)
181181
CXX = c++ -arch arm64 -isysroot $(IOSSDK)
182-
CFLAGS += -marm -DARM -D__aarch64__=1
182+
CFLAGS += -DARM -D__aarch64__=1
183183
CFLAGS += -DIOS
184+
MINVERSION = -mappletvos-version-min=11.0
185+
CC += $(MINVERSION)
186+
CXX += $(MINVERSION)
187+
CC_AS += $(MINVERSION)
188+
CFLAGS += $(MINVERSION)
184189

185190
# Lightweight PS3 Homebrew SDK
186191
else ifneq (,$(filter $(platform), ps3 psl1ght))

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,13 @@ At present, most development activity occurs in
1717
[irixxxx's fork](https://github.com/irixxxx/picodrive);
1818
[notaz's repo](https://github.com/notaz/picodrive) is updated less frequently.
1919

20+
### Using MSU, MD+/32X+, and Mode 1 on Sega/Mega CD
21+
22+
PicoDrive supports using CD audio enhanced cartridge games in all 3 formats.
23+
To start an enhanced cartridge, load the .cue or .chd file. The cartridge
24+
file should have the same base name and be placed in the same directory.
25+
Further instructions can be found in `platform/base_readme.txt`.
26+
2027
### Sega Pico and Storyware Pages
2128

2229
PicoDrive can use Storyware pages and pad overlays in png format in the same

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

pico/32x/memory.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,11 +1172,9 @@ static void PicoWrite16_32x_on_io_cd(u32 a, u32 d)
11721172

11731173
static void PicoWrite16_32x_on_io_ssf2(u32 a, u32 d)
11741174
{
1175-
PicoWrite16_io(a, d);
1176-
if ((a & ~0x0f) == 0xa130f0) {
1177-
carthw_ssf2_write8(a + 1, d);
1175+
carthw_ssf2_write16(a, d);
1176+
if (a == 0x130f0)
11781177
bank_switch_rom_68k(Pico32x.regs[4 / 2]);
1179-
}
11801178
}
11811179

11821180
// before ADEN

pico/cart.c

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -797,12 +797,6 @@ int PicoCartLoad(pm_file *f, const unsigned char *rom, unsigned int romsize,
797797

798798
if (!is_sms)
799799
{
800-
// maybe we are loading MegaCD BIOS?
801-
if (!(PicoIn.AHW & PAHW_MCD) && size == 0x20000 && (!strncmp((char *)rom_data+0x124, "BOOT", 4) ||
802-
!strncmp((char *)rom_data+0x128, "BOOT", 4))) {
803-
PicoIn.AHW |= PAHW_MCD;
804-
}
805-
806800
// Check for SMD:
807801
if (size >= 0x4200 && (size&0x3fff) == 0x200 &&
808802
((rom_data[0x2280] == 'S' && rom_data[0x280] == 'E') || (rom_data[0x280] == 'S' && rom_data[0x2281] == 'E'))) {
@@ -859,7 +853,7 @@ int PicoCartInsert(unsigned char *rom, unsigned int romsize, const char *carthw_
859853
PicoLoadStateHook = NULL;
860854
carthw_chunks = NULL;
861855

862-
if (!(PicoIn.AHW & (PAHW_MCD|PAHW_SMS|PAHW_PICO)))
856+
if (!(PicoIn.AHW & (PAHW_SMS|PAHW_PICO)))
863857
PicoCartDetect(carthw_cfg);
864858
if (PicoIn.AHW & PAHW_SMS)
865859
PicoCartDetectMS();
@@ -922,7 +916,7 @@ void PicoCartUnload(void)
922916
static unsigned int rom_crc32(int size)
923917
{
924918
unsigned int crc;
925-
elprintf(EL_STATUS, "caclulating CRC32..");
919+
elprintf(EL_STATUS, "calculating CRC32..");
926920
if (size <= 0 || size > Pico.romsize) size = Pico.romsize;
927921

928922
// have to unbyteswap for calculation..
@@ -932,14 +926,18 @@ static unsigned int rom_crc32(int size)
932926
return crc;
933927
}
934928

935-
static int rom_strcmp(int rom_offset, const char *s1)
929+
int rom_strcmp(void *rom, int size, int offset, const char *s1)
936930
{
937931
int i, len = strlen(s1);
938-
const char *s_rom = (const char *)Pico.rom;
939-
if (rom_offset + len > Pico.romsize)
940-
return 0;
932+
const char *s_rom = (const char *)rom;
933+
if (offset + len > size)
934+
return 1;
935+
936+
if (PicoIn.AHW & PAHW_SMS)
937+
return strncmp(s_rom + offset, s1, strlen(s1));
938+
941939
for (i = 0; i < len; i++)
942-
if (s1[i] != s_rom[MEM_BE2(i + rom_offset)])
940+
if (s1[i] != s_rom[MEM_BE2(i + offset)])
943941
return 1;
944942
return 0;
945943
}
@@ -1063,7 +1061,7 @@ static void parse_carthw(const char *carthw_cfg, int *fill_sram,
10631061
{
10641062
int offs;
10651063
offs = strtoul(p, &r, 0);
1066-
if (offs < 0 || offs > Pico.romsize) {
1064+
if (offs < 0) {
10671065
elprintf(EL_STATUS, "carthw:%d: check_str offs out of range: %d\n", line, offs);
10681066
goto bad;
10691067
}
@@ -1079,7 +1077,7 @@ static void parse_carthw(const char *carthw_cfg, int *fill_sram,
10791077
goto bad;
10801078
*r = 0;
10811079

1082-
if (rom_strcmp(offs, p) == 0)
1080+
if (rom_strcmp(Pico.rom, Pico.romsize, offs, p) == 0)
10831081
any_checks_passed = 1;
10841082
else
10851083
skip_sect = 1;
@@ -1138,8 +1136,12 @@ static void parse_carthw(const char *carthw_cfg, int *fill_sram,
11381136
PicoIn.AHW = PAHW_SVP;
11391137
else if (strcmp(p, "pico") == 0)
11401138
PicoIn.AHW = PAHW_PICO;
1139+
else if (strcmp(p, "j_cart") == 0)
1140+
carthw_jcart_startup();
11411141
else if (strcmp(p, "prot") == 0)
11421142
carthw_sprot_startup();
1143+
else if (strcmp(p, "flash") == 0)
1144+
carthw_flash_startup();
11431145
else if (strcmp(p, "ssf2_mapper") == 0)
11441146
carthw_ssf2_startup();
11451147
else if (strcmp(p, "x_in_1_mapper") == 0)

pico/carthw.cfg

Lines changed: 55 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
# svp - Sega Virtua Processor
33
# pico - Sega Pico (not really cart hw, but convenient to support here)
44
# prot - simple copy protection devices in unlicensed cartridges (see prot. below)
5+
# flash - protection through reading the flash chip ID
6+
# j_cart - 2 additional joypad ports on cart
57
#
68
# cartridge properties (prop = ...):
79
# no_sram - don't emulate sram/EEPROM even if ROM headers tell it's there
@@ -87,15 +89,30 @@ prop = no_sram
8789
check_str = 0x150, "DINO DINI'S SOCCER"
8890
prop = filled_sram
8991

90-
[Micro Machines 2 - Turbo Tournament]
91-
check_str = 0x150, "MICRO MACHINES II"
92-
prop = filled_sram
93-
9492
# bad headers
9593
[HardBall III]
9694
check_str = 0x150, " HardBall III"
9795
sram_range = 0x200000,0x20ffff
9896

97+
# J-Cart
98+
[Super Skidmarks, Micro Machines Military]
99+
check_str = 0x150, " "
100+
check_csum = 0x168b
101+
hw = j_cart
102+
103+
[Pete Sampras Tennis, Micro Machines Turbo Tournament 96]
104+
check_str = 0x150, " "
105+
check_csum = 0x165e
106+
hw = j_cart
107+
108+
[Micro Machines 2 - Turbo Tournament]
109+
check_str = 0x150, "MICRO MACHINES II"
110+
hw = j_cart
111+
112+
[Pete Sampras Tennis 96]
113+
check_str = 0x150, "PETE SAMPRAS TENNIS '96"
114+
hw = j_cart
115+
99116
# The SSF2 mapper
100117
[Mega Everdrive]
101118
check_str = 0x100, "SEGA SSF"
@@ -129,6 +146,11 @@ check_str = 0x150, "STAR ODYSSEY"
129146
hw = sf004_mapper
130147
sram_range = 0x200000,0x207fff
131148

149+
# Escape 2042, reads flash ID for protection
150+
[Escape 2042]
151+
check_str = 0x120, "Escape 2042"
152+
hw = flash
153+
132154
# detect *_in_1 based on first game and if it's larger than it should be,
133155
# as some dumps look like to be incomplete.
134156
# This will also pick overdumps, but those should still work with the mapper applied.
@@ -208,37 +230,50 @@ sram_range = 0x200000,0x200001
208230
eeprom_type = 1
209231
eeprom_lines = 1,0,0
210232

211-
[MICRO MACHINES II]
233+
[Micro Machines 2 - Turbo Tournament]
212234
check_str = 0x150, "MICRO MACHINES II"
213-
sram_range = 0x300000,0x380001
235+
prop = filled_sram
236+
sram_range = 0x300000,0x37ffff
214237
eeprom_type = 2
215238
eeprom_lines = 9,8,7
216239

217240
[Micro Machines - Turbo Tournament '96]
218241
check_str = 0x150, " "
219242
check_csum = 0x165e
220-
sram_range = 0x300000,0x380001
243+
sram_range = 0x300000,0x37ffff
221244
eeprom_type = 2
222245
eeprom_lines = 9,8,7
223246

224247
[Micro Machines - Turbo Tournament '96]
225248
check_str = 0x150, " "
226249
check_csum = 0x2c41
227-
sram_range = 0x300000,0x380001
250+
sram_range = 0x300000,0x37ffff
228251
eeprom_type = 2
229252
eeprom_lines = 9,8,7
230253

231254
[Micro Machines Military]
232255
check_str = 0x150, " "
233256
check_csum = 0x168b
234-
sram_range = 0x300000,0x380001
257+
sram_range = 0x300000,0x37ffff
235258
eeprom_type = 2
236259
eeprom_lines = 9,8,7
237260

238261
[Micro Machines Military]
239262
check_str = 0x150, " "
240263
check_csum = 0xcee0
241-
sram_range = 0x300000,0x380001
264+
sram_range = 0x300000,0x37ffff
265+
eeprom_type = 2
266+
eeprom_lines = 9,8,7
267+
268+
[Brian Lara Cricket]
269+
check_str = 0x150, "BRIAN LARA CRICKET"
270+
sram_range = 0x300000,0x3fffff
271+
eeprom_type = 2
272+
eeprom_lines = 9,8,7
273+
274+
[Brian Lara Cricket 96]
275+
check_str = 0x150, "BRIAN LARA 96"
276+
sram_range = 0x300000,0x3fffff
242277
eeprom_type = 2
243278
eeprom_lines = 9,8,7
244279

@@ -534,13 +569,22 @@ prot_ro_value16 = 0x400002,-2,0x0f00
534569
prot_ro_value16 = 0x400004,-2,0xaa00
535570
prot_ro_value16 = 0x400006,-2,0xf000
536571

537-
[16 Tiles Mahjong 1+2 (Unl)] # Zhang majiang
572+
[16 Tiles Mahjong 1+2 (Unl)] # Shi liu zhang majiang
538573
check_str = 0xfe, "WISEGAME IS TRADE MARKER"
539574
hw = prot
540575
prot_ro_value16 = 0x400002,-2,0xaa00
541576
prot_ro_value16 = 0x400004,-2,0xc900
542577
prot_ro_value16 = 0x400006,-2,0xf000
543578

579+
[13 Tiles Mahjong] # Shi san zhang majiang
580+
check_str = 0x104, " "
581+
check_crc32 = 0x83397760
582+
hw = prot
583+
prot_ro_value16 = 0x400000,-2,0x6300
584+
prot_ro_value16 = 0x400002,-2,0x9800
585+
prot_ro_value16 = 0x400004,-2,0xaa00
586+
prot_ro_value16 = 0x400006,-2,0xf000
587+
544588
[Super Poker (Unl)] # Chaoji puke
545589
check_csum = 0xffff
546590
check_crc32 = 0xdd02797c

0 commit comments

Comments
 (0)