2932 Commits
Author SHA1 Message Date
github-actions[bot] 7adbf3caef Fetch translations & Recreate libretro_core_options_intl.h 2026-10-31 01:33:35 +00:00
Joseph MattielloandClaude Opus 5.5 1b63c8a367 dreamcast: Default broadcast follows the region
Broadcast has a Default entry in the settings (value 4), but
fixUpDCFlash() only writes values in range, so Default left the flash
byte alone: NTSC from the factory block on a fresh flash, or whatever
the last explicit choice had written. A PAL game booted in NTSC with
Broadcast on Default.

Region's own Default is resolved from IP.BIN just above; resolve
Broadcast the same way: PAL for Europe, NTSC otherwise. Applied with
override() at load, like the region, so the saved setting stays Default.

Testing: compiles on macOS arm64.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-27 11:48:03 +01:00
Chris Dixon 11ba75f843 libretro: add a Vblank Pacing option (#2562)
Without threaded rendering a run ends when a frame is presented, or
after 50 ms of emulated time without one. Frontends that pace retro_run
by the frame rate instead of blocking on audio, Kodi among them, then
get several vblanks per run through loading screens and have to drop
the extra audio. With the option on, every run ends at the next vblank.
[ci skip]
2026-10-27 11:47:43 +01:00
github-actions[bot] e88b0ced22 Fetch translations & Recreate libretro_core_options_intl.h 2026-10-24 00:37:48 +00:00
Flyinghead 6d81b99816 add pull request template. Fix issue templates. 2026-10-23 11:20:53 +02:00
Flyinghead 53efedbbe7 libretro: don't call the frontend on the emulator thread
Fixes crash with many WinCE games. Issue #2442
2026-10-23 11:20:08 +02:00
Flyinghead fa9d39a355 bba: skip deserialization if device doesn't exist
regression from 5543a95c4f
2026-10-22 12:36:23 +02:00
Flyinghead a9bd1c74fd empty commit 2026-10-21 17:09:21 +02:00
Flyinghead 5543a95c4f bba: start polling only when needed. Increase poll interval to 1 ms 2026-10-21 16:54:14 +02:00
Flyinghead 78d5d09c1e ci: fix sentry-cli on android builds 2026-10-21 15:59:34 +02:00
Joseph MattielloandClaude Fable 5.1 31697241b7 sdl: initialize the axis direction in SDLControllerMappingParser
SDL_GameControllerButtonBind2 is a struct over a union whose first member
is `int button`. `bind{}` zero-initializes that member only, so
value.axis.direction holds whatever was on the stack. getBindForAxis()
assigns it only when the mapping has a '+' or '-' prefix or a '~'
suffix; for a plain "lefttrigger:a4" it is returned as read, and the
full-axis branch at the end tests it too. At -O2 on macOS/arm64 a
lefttrigger lookup came back with direction 1 instead of 0 and
"-lefty:-a1" with 1 instead of -1; SDLControllerMappingTest.split_axis
and .reverse_axis fail there. The value just happened to be 0 on Linux.

Set axis and direction to 0 before parsing the axis.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
2026-10-21 12:09:24 +02:00
Joe Mattiello e9f4020c56 maplelink: keep the link registry alive through static destruction (#2577)
MapleDevices[][] in maple_if.cpp holds shared_ptr<maple_device>s with
static storage, so the VMUs are destroyed when the process exits.
~maple_sega_vmu() clears the LCD on any attached maple link, which goes
through MapleLink::GetMapleLink() and locks MapleLink::Mutex, another
object with static storage, in another translation unit, that may
already be gone. With libc++ locking a destroyed mutex throws
("mutex lock failed: Invalid argument") and the process aborts; the
unit test binary exits with SIGABRT on macOS after every test passed.
On glibc the same lock happens to succeed, which is why Linux never
showed it. The Links table is read in the same state.

Give both to function-local statics that are allocated once and never
destroyed, so they outlive everything that can still reach them.

Co-authored-by: Claude Fable 5.1 <[email protected]>
[ci skip]
2026-10-21 12:08:48 +02:00
Joe MattielloandClaude Fable 5.1 5eb52090ad arm7: keep the V flag across logical ops in the arm64 recompiler (#2576)
On ARMv7, AND, EOR, ORR, BIC, MOV, MVN, TST and TEQ with the S bit set
leave V unchanged. The AArch64 instructions the recompiler uses for them
(ANDS, BICS, TST) clear V, and storeFlags() wrote the host NZCV back as
is, so every flag-setting logical op cleared the guest's V. A signed
conditional branch (BVS, BGE, BLT, BGT, BLE) after such an op then went
the wrong way. The x64 recompiler already preserves V for these ops
(saveFlags(save_v_flag)); the interpreter does too.
[ci skip]

TST and TEQ had a save/restore under STRICT_MODE with a note that nobody
probably relies on it. That path was never built, and it did not cover
ANDS, EORS, ORRS, BICS, MOVS or MVNS.

Restore V after the op from the PSR that loadFlags() loaded before it,
in the same place the shifter carry is merged, for every logical op that
sets flags. Three instructions, only on those ops.

AicaArmTest.LogicOpsTest asserted exactly this (teq with C,V set must
keep V) and failed on arm64; it passes now, with the rest of the suite.

Co-authored-by: Claude Fable 5.1 <[email protected]>
2026-10-21 12:07:57 +02:00
jutler 128e6ce29c addrspace: mask the shift count taken from the tagged pointer (#2574)
readConst, writeConst, readt and writet shift the 32-bit guest address by
the whole tagged memInfo_ptr value (pointer | shift). Shifting a u32 by 32
or more is undefined, and GCC 16 targeting 32-bit ARM uses that: once the
pointer is known to be non-null (iirf > 31) it drops the offset, so
read32/write16 compile to a plain load/store at the region base. Every
memory access then hits offset 0, the BIOS trampoline copied to 8C0000E0
is lost and the console never boots (black screen, no sound).

Mask the shift with HANDLER_MAX, which is what x86 does in hardware and
what the code intends. No change in behaviour where the old code worked.

Co-authored-by: hitenmandalia <[email protected]>
[ci skip]
2026-10-21 12:07:14 +02:00
Rich Stokes 38a3d83c77 bba: hand Ethernet frames over on the threads that own them (#2569)
Received frames were passed to the RTL8139 from the network thread,
raising the ASIC interrupt there and racing SIIDRebuild() on the SH-4
thread. Queue them and deliver them from an SH-4 scheduler callback.

Sent frames were pushed into picoTCP from the SH-4 thread, but picoTCP
is built without PICO_SUPPORT_MUTEX so its device queue is unlocked.
Queue them and feed them to picoTCP from the pico thread before each
stack tick.
[ci skip]
2026-10-21 12:05:47 +02:00
Joe Mattiello 19ed307f74 rend: rotate sorted triangle indices for flat shading instead of copying colors (#2553)
Vulkan without VK_EXT_provoking_vertex, DX9 and DX11 take flat-shaded
colors from the first vertex, while on Dreamcast it's the last. For the
depth-sorted triangle list, setFirstProvokingVertex() copied each
triangle's last vertex colors onto its first vertex. But sortTriangles()
builds these triangles from strips, so neighbors share vertices:
tri0=(P0,P1,P2), tri1=(P2,P1,P3). P2 is tri0's source and tri1's
destination, and the list is processed in depth order, so one
triangle's flat color can overwrite another's before it's read. In
strips of three or more triangles, consecutive triangles even share
their first vertex. Flat-shaded translucent polygons then pick up a
neighbor's color, e.g. the player shadow decals in Tony Hawk's Pro
Skater 2 and Mat Hoffman's Pro BMX turn uniformly dark.

Each sorted triangle has its own three slots in idx, so rotate them
(a,b,c) -> (c,a,b) instead. The winding is unchanged and the provoking
vertex comes first, without touching shared vertices. Strips keep the
color copy, which is safe there.

Adds SorterTest, which fails on the old code and passes with this change.

Co-authored-by: Claude Opus 5.5 <[email protected]>
[ci skip]
2026-10-21 12:04:35 +02:00
Joe Mattiello d207cd9198 addrspace: clear the address map when its backing memory is freed (#2546)
When nvmem is disabled, termMappings() frees main RAM, VRAM, ARAM and
the Elan RAM but leaves memInfo_ptr unchanged. Each entry still holds
the old host base, so any guest access before the next remap returns a
pointer into freed memory.

Zero the table, as init() does. A null entry routes to handler 0,
readMemNotMapped/writeMemNotMapped, which only log.

Co-authored-by: Claude Opus 5.5 <[email protected]>
[ci skip]
2026-10-21 11:19:28 +02:00
Flyinghead 1d356d5e55 android: fix swappyvk crash if activity is null
[ci skip]
2026-10-21 11:06:06 +02:00
scribam 32c2304459 ci: maintenance updates
- Bump action versions
- Improve ccache support
- Reformat files
- Replace chkfung/android-version-actions and mathieu-bour/setup-sentry-cli from android workflow
- Update MoltenVK to use the latest official tag
- Update BSD operating systems
2026-10-21 10:59:14 +02:00
davey 34ad8c8262 libretro: avoid exporting symbols on linux, android and the bsds
Export only retro_* from the core, as the osx build does with
libretro.osx.def. Symbols the core exports bind to same-named ones
the frontend already loaded: RetroArch builds with their builtin
glslang made the Vulkan renderer crash in GlslangToSpv on its first
shader compile, and with a system glslang loaded (ffmpeg ->
libplacebo -> shaderc) 33 glslang entry points, zstd, zlib and
stb_image still went to those copies.
2026-10-20 16:33:04 +02:00
Chris Dixon abfc411392 libretro: report a fixed savestate size for each system (#2561)
A frontend may size its savestate buffer once, as libretro.h allows,
but a state grows and shrinks with the devices plugged in and the
frames being drawn, and states then outgrow the buffer. Report the
system's memory regions plus the allowance GGPO makes for everything
else, which is constant for a game.

System SP gets NAOMI's allowance, plus the game's media if it has one:
the media is loaded into memory-backed RAM, so a state holds all of it.
[ci skip]
2026-10-20 16:32:32 +02:00
github-actions[bot] 6bb0fc3e18 Fetch translations & Recreate libretro_core_options_intl.h 2026-10-17 00:25:56 +00:00
Joseph MattielloandClaude Opus 5.5 08afcbe6b9 rend: clamp xBRZ texture upscale factor to 2..6
xbrz::scale() only implements factors 2 to 6. Any other value hits an
assert that's compiled out in release builds, and scale() returns
without writing the destination buffer. The texture is then uploaded
from uninitialized memory at the requested size.

rend.TextureUpscale2 can be set to 8 or 16 through emu.cfg or Lua.
Clamp the factor once and use it for the buffer size, the scale call
and the upscaled dimensions so they always agree.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-16 20:14:45 +02:00
Joe Mattiello e9dd6187cb cdipsr: make temp_value a local (#2549)
temp_value was a file-scope global shared by every CDI parse. The boxart
scraper opens discs on its own thread, so it can parse a CDI while a
game is loading and corrupt the other parse's reads.

Use a local in each function. It's a uint32_t initialized to 0 because
every read into it is 4 bytes; a local unsigned long would leave the top
half uninitialized on LP64.

Co-authored-by: Claude Opus 5.5 <[email protected]>
[ci skip]
2026-10-16 20:13:29 +02:00
Joe Mattiello a5dc811814 savestate: reject invalid broadcast/cable/region instead of aborting (#2555)
dc_deserialize() read the broadcast, cable and region settings straight
into the config and checked them with verify(), so a corrupt or
incompatible state killed the process, after already writing the bad
values into the settings.

Read them into locals and throw Deserializer::Exception when one is out
of range. dc_loadstate() and the libretro core already catch it and
report the state as unusable. Valid states load exactly as before.

Co-authored-by: Claude Opus 5.5 <[email protected]>
[ci skip]
2026-10-16 20:12:36 +02:00
Joe Mattiello 5c86428c04 input: stop the emulator while saving an in-RAM savestate (#2554)
The in-RAM save hotkey called gui_saveState(false, true), which runs
dc_serialize() without stopping the emulator. With threaded rendering
on (the default), the SH4 and AICA keep running on the emulator thread
while the input thread serializes, so the state can be torn: memory and
registers from different moments.

Stop and restart around the save like the disk save hotkey and the
in-RAM load hotkey already do.

Co-authored-by: Claude Opus 5.5 <[email protected]>
[ci skip]
2026-10-16 20:11:22 +02:00
Chris Dixon 258f5c11d4 libretro: forget the LED callback on deinit (#2560)
The callback was only ever taken once. A frontend that loads a fresh
instance of itself for the next game, as Kodi does, keeps the core
loaded, so the next GD-ROM light change called into the unloaded one.
[ci skip]
2026-10-16 20:09:21 +02:00
Garrett Brown 80471d57b0 libretro: define the unique texture dumping option
Add the missing dump_unique_textures core-option definition beside the
existing texture-dump options. This prevents findDefinition() from
returning null when the frontend supplies a value for this option.

Default to disabled to match the implicit false config default, and use
the existing setting description for skipping video and animated textures.
2026-10-13 11:28:52 +02:00
Chris Dixon ce8689101f libretro: look for the NAOMI BIOS through the frontend VFS (#2542)
findNaomiBios checked for the BIOS archive with access(), so a frontend
watching its VFS never saw it being looked for, unlike findFlash, which
already uses path_is_valid. Kodi uses that to name the file a core is
missing.
[ci skip]
2026-10-13 11:28:29 +02:00
Flyinghead 518c496251 sh4: set Sh4Cntx address on Reset
RAM base and Sh4Cntx address might change on libretro without Init being
called. So set the correct Sh4Cntx address on Reset and propagate to
dynarec, cycle counter and caches.
[ci skip]
2026-10-13 11:25:52 +02:00
Flyinghead 804edb00d7 dx11,gl: fix clear framebuffer and scissor regressions
dx11: don't use scissor rect for final A-buffer render
gl4: clear geom_fbo[1] (color pass) not geom_fbo[0] (depth pass) when
needed
Issue #1197
2026-10-13 11:14:45 +02:00
Flyinghead f03faffd2f libretro: reset disk_index to 0 when loading a game
Don't use the static disk_index in read_m3u()
Issue #2541
2026-10-12 09:46:45 +02:00
Flyinghead fa23eef593 multiboard: avoid crash when raw input is enabled
Fixes MINIDUMP-A9F
2026-10-12 09:44:10 +02:00
Flyinghead 658abb386a maple: don't crash on invalid maple device. Just ignore it
Fixes MINIDUMP-A9C
2026-10-12 09:42:20 +02:00
Jordi Serra fa3c526e4f ggpo: resolve the peer host name (#2514)
GGPO parses the peer address with inet_pton() only, so a host name in
the Peer field silently becomes 0.0.0.0 and the session never syncs,
without any error. Resolve non-numeric addresses with getaddrinfo()
before handing them to GGPO, and fail with a clear message when the
name cannot be resolved.

Co-authored-by: unjordi <[email protected]>
[ci skip]
2026-10-12 09:34:50 +02:00
Jordi Serra e6d3365c0b Fix MD5Sum hashing hostfs::File pointers instead of file contents (#2513)
Since the switch to hostfs::File (#2299), MD5Sum::add(hostfs::File *)
resolved to the generic add(const T&) template, which hashes the pointer
value. The resulting digests depend on the heap address, so they differ
between peers and between runs. This breaks GGPO peer verification when
a .state.net savestate is used (stateMD5), and with CDI, GDI and CUE
images (gameMD5).

Add an MD5Sum::add(hostfs::File *) overload that hashes the whole file
content, like the std::FILE overload, and reject pointer types in the
template with a static_assert so this cannot happen again silently.

Co-authored-by: unjordi <[email protected]>
[ci skip]
2026-10-12 09:33:48 +02:00
github-actions[bot] ed953fcbfd Fetch translations & Recreate libretro_core_options_intl.h 2026-10-10 01:44:50 +00:00
Flyinghead 0d9853df9a dcnet: use ipv4 address to select AP 2026-10-07 13:34:54 +02:00
Flyinghead df7aedf506 cue: recheck track file handle
Fixes MINIDUMP-A8T MINIDUMP-A8V
2026-10-07 13:32:45 +02:00
바닷빛andClaude Opus 5 df5feec55c build: pass /utf-8 to tinygettext so non-UTF-8 locales can build (#2532)
Co-authored-by: Claude Opus 5 (1M context) <[email protected]>

[ci skip]
2026-10-07 13:30:36 +02:00
바닷빛andClaude Opus 5.5 bbdef06a09 sh4: clear the FPSCR cause field when the guest writes FPSCR (#2531)
On the SH4 every FPU instruction clears the FPSCR cause field before it
executes, and sets a cause bit only if it raises an FPU exception.
Flycast doesn't update the cause field in FPU instructions, so a cause
bit that the guest writes back with lds/lds.l stays set forever.

Kita He. White Illumination (T14301M) resets to the BIOS when a karaoke
song starts (issue #1058). TRFDRAW.DLL inverts a 4x4 matrix with an LU
decomposition whose pivot comparison helper saves FPSCR, runs fcmp/gt and
reads FPSCR back: a set cause.V means an unordered (NaN) comparison. With
a stale cause.V every comparison looks unordered, no pivot row is chosen,
and the uninitialized pivot index makes the routine read a wild pointer.
The access violation is caught by the game's __except handler, which
calls ResetToFirmware().

Clearing the cause field whenever FPSCR is written matches what the
hardware shows to code that reads FPSCR after an FPU instruction.

Co-authored-by: Claude Opus 5.5 <[email protected]>

[ci skip]
2026-10-07 13:29:53 +02:00
Rich Stokes b4c38d652e input: rebase absolute mouse motion after relative input (#2528)
[ci skip]
2026-10-07 13:27:42 +02:00
github-actions[bot] 59ed35a7ea Fetch translations & Recreate libretro_core_options_intl.h 2026-10-03 01:09:55 +00:00
scribam 04669ebe41 ci: fix libusb1 installation on netbsd 2026-10-01 11:32:26 +02:00
nixxou 98ce9fb5d7 Keep spaces inside -config section names (#2516)
Game ids can have spaces, like "INITIAL D Ver.2". The parser removed all
spaces in the section name so it became "INITIALDVer.2". Now only the
spaces before and after the name are removed.

Co-authored-by: nixxou <[email protected]>
[ci skip]
2026-10-01 11:31:59 +02:00
Acts1631 2a57c9ffd9 savestate: validate fixed buffer lengths (#2512)
[ci skip]
2026-10-01 11:31:15 +02:00
Acts1631 2ea7920fdc network: bound DCNet Ethernet frame sizes (#2511)
[ci skip]
2026-10-01 11:31:00 +02:00
Acts1631 9d4c337349 network: validate GGPO application data packets (#2510)
[ci skip]
2026-10-01 11:30:37 +02:00
vkedwardli 89b72a8e3e windows: fix HTTP URL parsing race and GET status handling (#2509)
Use per-request URL buffers for GET and POST to prevent concurrent requests from overwriting each other's host and path.

Return the actual HTTP status for GET requests, retaining an error status when sending the request or querying its status fails
[ci skip]
2026-10-01 11:30:16 +02:00
Richard Stokes e36e9df2dc vk oit: fix synchronization hazards between render passes and frames
The OIT color and depth/stencil attachments, a-buffers and pixel counter
are shared by consecutive render passes and by all frames in flight, but
the render pass had no external dependency covering them, and the pixel
counter reset wasn't synchronized with the fragment shaders using it.

With MoltenVK using Metal 3 argument buffers and residency sets (macOS 15+),
Metal no longer tracks hazards on resources accessed through argument
buffers, so input attachment reads and storage buffer accesses of a frame
may race with the attachment clears/loads and a-buffer writes of the next
one. This results in sporadic one-frame glitches with per-pixel alpha
sorting.

Issue #2495
2026-09-28 13:49:06 +02:00
github-actions[bot] ea087b9140 Fetch translations & Recreate libretro_core_options_intl.h 2026-09-26 00:36:31 +00:00
Flyinghead 869038f40a scif: use scheduler only after it has been deserialized
Calling sh4_sched_request before will not use the correct current time.
Fixes barcode reader malfunctioning after loading a state (mushiking,
dinoking, etc.)
Issue #2501
2026-09-23 12:01:56 +02:00
Richard Stokes 628bd3dbb1 macOS: queue document opens with an SDL user event
sdl2-compat (what Homebrew installs as sdl2) doesn't convert the file
name of an SDL_DROPFILE event pushed by the application, then crashes
in strdup(NULL) when converting the event back during window creation.
Carry the path in a registered user event instead.
2026-09-20 20:35:12 +02:00
Flyinghead dd7a5f0620 target android 16. Fix Back invoked handler 2026-09-18 12:12:07 +02:00
Flyinghead 6d73f7191c minor changes (error logging) 2026-09-18 12:09:27 +02:00
Ryan McClelland 215a5af165 vmem: ignore the heap pointer tag when matching a fault address
On arm64 Android, apps targeting API 30 or later get tagged heap pointers:
malloc returns addresses with a tag in the top byte, while the fault address
a signal handler receives has that byte cleared. Without nvmem, RAM, VRAM,
AICA RAM and Elan RAM are malloc'd, so the range checks in bm_getRamOffset(),
getVramOffset() and the memwatch watchers never matched a fault on a
protected page, and the first write to a page holding compiled code killed
the core as an unhandled SIGSEGV.

Compare untagged addresses instead. The vmem branches are unchanged: that
memory is mmap'd and carries no tag.

The libandroid link from 8933f9fe0 is still wanted, since it is what lets
ASharedMemory_create resolve and nvmem work, but its subject blamed the
dynarec; this was the crash.
2026-09-16 16:01:28 +02:00
Rich Stokes c0fb036d60 Fix stalled uploads in the picoTCP proxy (#2497)
[ci skip]
2026-09-16 16:01:05 +02:00
Ryan McClelland 8933f9fe0c libretro: link libandroid, or the dynarec dies on the first memory access
flycast's libretro build has never run on Android 11 or later. It loads,
reaches frame one, and then takes a SIGSEGV its own handler cannot place:

    [VMEM] Virtual memory file allocation failed: errno 13
    [VMEM] Warning! nvmem is DISABLED
    [COMMON] SIGSEGV @ 0x71d0c87618 invalid access to 0x71ce6cba00

errno 13 is EACCES. posix_vmem.cpp asks ASharedMemory_create first and
falls back to opening /dev/ashmem when the symbol is null -- and Android
11 took that device away from apps. So the fallback is refused, nvmem is
disabled, and the dynarec's fastmem accesses have no mapping behind
them. rewrite() cannot place the fault, and the handler falls through to
die("segfault").

The good path was there all along and was dead code, because the symbol
is declared weak:

    extern "C" int __attribute__((weak)) ASharedMemory_create(const char*, size_t);

and nothing in the LIBRETRO branch links libandroid, so it resolved to
null every time. readelf on the built core shows only libm, libdl and
libc in NEEDED, and nm shows ASharedMemory_create as an undefined weak.
The app build links `android log` in its own ANDROID block further down;
the libretro build never did.
2026-09-15 11:29:00 +02:00
Rich Stokes 4509ee903c macOS: defer document loading until emulator initialization finishes (#2492)
Route document opens through SDL's event queue
[ci skip]
2026-09-15 11:28:32 +02:00
Flyinghead 04b74c3a11 gdrom: stop cdda when reading a sector
Revert the revert (9869ea8852) to fix
Hydro Thunder. Also needed for NFL Blitz 2001.
Issue #2488
[ci skip]
2026-09-15 11:24:09 +02:00
Flyinghead 9869ea8852 gdrom: don't stop cdda when reading a sector
Revert dcf5444acc
Issue #2488
2026-09-13 15:12:12 +02:00
chyyran ea22ee8723 lua: expose openGdrom and insertGdrom as lua functions 2026-09-12 13:37:53 +02:00
vkedwardli b777c15fdc docs: restore Homebrew installation via the Flycast tap (#2486)
Document install commands for stable, master, and nightly dev channels.
Link to tap instructions and adjust installation section formatting.
[ci skip]
2026-09-12 13:15:43 +02:00
vkedwardli 93379c489f macOS: backport MoltenVK fixes and verify packaged artifacts (#2485)
[ci skip]
2026-09-12 13:14:52 +02:00
Flyinghead b03335bca9 pvr: swap interval detector improvements
Don't switch to swap interval 2 if actual interval is 3 or more. Fixes
ECCO switching to swap 2 during loading.
Switch to interval 1 when slightly above 30 FPS for too long. Helps
variable refresh rate games (Unreal) and those rendering close to 30 FPS
(ECCO, Armada).
Issue #2467
[ci skip]
2026-09-12 13:14:20 +02:00
github-actions[bot] 604ebd58fe Fetch translations & Recreate libretro_core_options_intl.h 2026-09-12 00:14:46 +00:00
Flyinghead eddf263586 windows: fix http request with path > 256 chars
The path of http requests was limited to 256 chars on Windows, which
isn't enough for some TGDB gets.
Issue #2455
Issue #2470

Only save the database when needed. Better handling of TGDB allowance
limit. Pause if no progress.
2026-09-11 13:37:37 +02:00
Flyinghead 3f70e47adb aica: store last sample and Q at loop start even with ADPCM stream
When reaching LSA, the last sample and Q values should be stored, even
with ADPCM long stream (which doesn't use them). NBA 2K switches a
looping sound from ADPCM long stream to ADPCM and relies on the loop
start values to be restored.
Issue #2469
2026-09-11 10:39:31 +02:00
Romain TISSERANDandClaude Opus 5 0abac3465d chd: MIL-CD support for images with pregaps
CHDs converted from Redump MIL-CD dumps were rejected with "Unsupported
subtype or pre/postgap": the audio tracks of the first session carry their
pregap inside their own .bin file, which chdman records as PREGAP:n
PGTYPE:V<type> in the CDROM_TRACK_METADATA2 entry.

Handle these tracks the way MAME does:
- when PGTYPE is prefixed with 'V', the pregap sectors are part of the track
  data and counted in FRAMES, so INDEX 01 sits `pregap` frames after the
  previous track and the track data starts `pregap` frames into the CHD
- otherwise the pregap only takes up space on the disc
- subcode data doesn't change the sector layout, and postgap sectors are
  never stored: warn about both instead of bailing out

Also:
- audio tracks of CD-ROM CHDs are stored big-endian, just like the ones of
  GD-ROM CHDs using the CHGD metadata tag. Not byte-swapping them was the
  cause of the audio distortion reported with CHD MIL-CDs
- the 11400 frame session gap includes the pregap of the second session's
  first track. Don't count those sectors twice when they're in the image
- only treat a multi-track disc as a MIL-CD when its last track is a data
  track. A mixed mode CD is a single session disc and its data track is the
  first one
- report the lead-out as the first FAD after the last sector, like the CUE
  and GDI loaders do, instead of one frame earlier

Tested on a dozen homebrew MIL-CDs, from 2 to 17 tracks: the CUE and CHD
loaders now return the same tracks, sessions and sector data for each of
them, and they all boot.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01NfFd8rJc9aTQB7au8yLrqG

* cue: don't count the session pregap twice in MIL-CDs

The 11400 frame gap added at REM SESSION 02 is the lead-out of the first
session (01:30:00), the lead-in of the second one (01:00:00) and the pregap
of its first track (00:02:00). When that track has an INDEX 00 of its own,
its pregap sectors are stored in the image and were counted a second time,
placing the data track 150 frames after the session start reported in the
TOC, i.e. after the FAD the boot file is looked up at.

Redump lays MIL-CDs out with no INDEX 00 on the second session's track, so
none of the images I have hits this. It only shows up with images written by
other tools, and is included here because the CHD loader needs the same
adjustment to agree with this one.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Claude-Session: https://claude.ai/code/session_01NfFd8rJc9aTQB7au8yLrqG
2026-09-10 11:14:28 +02:00
Flyinghead a9b451c6f2 ini: check if string empty before accessing 1st element
This is UB with c++11.
[ci skip]
2026-09-10 11:12:12 +02:00
WizzardSK fb286f777c cmake: keep the Switch archive's extracted objects apart
Since #2477 put zstd in the combined archive, the libnx job fails at the
final link with `undefined reference to XXH32` - the symbol went missing
from an archive that extracts xxHash first.

ar names a member after the basename of its object, and zstd builds its
own vendored copy of xxhash.c, namespaced to ZSTD_. Both archives
therefore carry a member called xxhash.c.o, and extracting them into one
directory leaves only the second: zstd's, which defines ZSTD_XXH32 and
nothing the core calls.

Extracting each archive into a directory of its own keeps every object,
whatever it is called. Reproduced and checked with a CMake project of the
same shape, two static libraries whose members collide:

  flat, as now:        core_main, ZSTD_XXH32
  a directory each:    core_main, ZSTD_XXH32, XXH32

Not run on the buildbot - the Switch toolchain is not something I have
here.
2026-09-08 08:46:23 +02:00
WizzardSK fa04b20837 cmake: the Switch archive was missing zstd and tinygettext 2026-09-07 14:46:25 +02:00
WizzardSK 52c8ecef1e gitlab-ci: the libnx image's cmake is too old for this tree 2026-09-06 16:03:29 +02:00
WizzardSK a75d1cff53 gitlab-ci: build the Switch core's combined archive (#2471)
The libnx template builds --target ${CORENAME}_libretro, and on Switch that
target is flycast's own objects and nothing else - 251 members. The
dependencies (xxhash, chdr, zip, elf, the resources) are folded in by the
"combined" target that CMakeLists.txt defines for exactly this case, and
that is the archive RetroArch has to link: 409 members.
[ci skip]
2026-09-05 16:36:55 +02:00
WizzardSK daa46ec63e fix for switch (#2466)
uncomment build-static
[ci skip]
2026-09-05 09:11:55 +02:00
github-actions[bot] 9814e2fe40 Fetch translations & Recreate libretro_core_options_intl.h 2026-09-05 00:01:10 +00:00
Aldo Borrero d8a76809e5 OpenGL: fix per-frame VAO leak in the ImGui GL3 backend
ImGui_ImplOpenGL3_SetupRenderState generated the VAO into its
`vertex_array_object` parameter, which is passed by value, so the name never
reached ImGui_ImplOpenGL3_RenderDrawData. There the local was still 0, the
`if (vertex_array_object != 0)` guard was false, and glDeleteVertexArrays never
ran — a VAO was leaked every frame. The OSD is drawn every frame, so on Mesa
(radeonsi) host memory grows unbounded until OOM; Vulkan is unaffected.

Move the glGenVertexArrays back into RenderDrawData and pass the handle to
SetupRenderState for binding only, so the existing glDeleteVertexArrays runs
and the VAO is recreated each frame (staying valid across GL context changes),
matching the upstream ImGui backend.
2026-09-04 09:48:47 +02:00
WizzardSK fd9d39b127 ci: build the Switch core here, with CMake (#2465)
The libretro Switch core on the buildbot still comes from the old
libretro/flycast tree, because the job here was written against the
Makefile-based libnx-static template and this tree has no Makefile. There
is a CMake version of that template, and the CMakeLists already knows how
to build for Switch (NINTENDO_SWITCH + LIBRETRO produces
flycast_libretro_libnx), so point the job at that instead.
[ci skip]
2026-09-04 09:47:52 +02:00
Flyinghead 8f511f8960 Remove macOS Homebrew from Install section
Issue #2461
[ci skip]
2026-09-03 16:11:23 +02:00
ShinMikite 12bb43652f Fix Monkey Ball minimap depth masking 2026-09-02 18:10:29 +02:00
Flyinghead 71b739faee android: tentative fix for ANR when calling eglDestroyContext
Flush and finish the GL pipeline.
Release the ANativeWindow for both GL and VK.
[ci skip]
2026-09-02 18:09:57 +02:00
Flyinghead 57e33d323a ui: fix regression where dpad won't scroll up/down the game list
Likely caused by an imgui change
Issue #2455
2026-09-02 17:52:39 +02:00
Flyinghead 149e651d24 android: don't start swappy if g_activity is null
Probably not the right fix but should mitigate the issue
2026-08-31 08:17:01 +02:00
Flyinghead c37be698db android: fix start up crash on android <= 8 2026-08-31 08:10:46 +02:00
Flyinghead e2722869ff The Grinch (US) doesn't support RGB output
Issue #2447
2026-08-30 09:24:17 +02:00
Acts1631 180e670605 Reject unterminated quoted disc filenames
CUE and GDI descriptor parsing continued appending after a quoted
filename reached end of input. A malformed descriptor could consume
CPU and memory until Flycast stopped responding.

Treat failed character extraction as an invalid descriptor while
skipping whitespace and while scanning quoted filenames.
2026-08-27 19:05:33 +02:00
Flyinghead c3763d8fc4 sdl: in multiboard mode, handle fullscreen switches locally
Switching to fullscreen and back should be handled by the slave, not
routed to the master like other key presses.
Issue #2439
2026-08-23 13:29:03 +02:00
Flyinghead 9473c0377a android: clear knownDevices when InputDeviceManager starts
Issue #2440
2026-08-23 13:20:05 +02:00
Flyinghead 9c6c8e59d6 atomiswave: reduce bios size to 64KB as the rest is writable
Fixes regression introduced by 8412d3d8a3
that overwrites the loaded .nvmem data with the bios second half.
2026-08-23 13:18:08 +02:00
github-actions[bot] 7fcd6976fa Fetch translations & Recreate libretro_core_options_intl.h 2026-08-21 22:38:44 +00:00
Flyinghead d5e74ad756 vk: fix RTT initial color attachment layout
Fixes Miss Moonlight color attachment layout mismatch error.
2026-08-20 15:18:20 +02:00
Flyinghead 9dbca96328 pvr: tile clipping is used for framebuffer size calculation in RTT
Fixes Miss Moonlight vk exception (width=0, height=0)
2026-08-20 15:14:43 +02:00
flyinghead 44e4c7b50d empty commit to trigger CI builds 2026-08-19 13:56:45 +02:00
github-actions[bot] 5aa091fde6 Fetch translations & Recreate libretro_core_options_intl.h 2026-08-14 22:37:38 +00:00
github-actions[bot] a172e00013 Fetch translations & Recreate libretro_core_options_intl.h 2026-08-07 22:53:01 +00:00
github-actions[bot] d4fc077410 Fetch translations & Recreate libretro_core_options_intl.h 2026-07-31 23:14:13 +00:00
Edward Li 4126f1464f netbsd: bump libusb install to 1.0.30 2026-07-21 12:28:22 +02:00
github-actions[bot] f09d1f22ef Fetch translations & Recreate libretro_core_options_intl.h 2026-07-10 23:12:05 +00:00
Edward Li e9b7fb6510 macOS: prevent F from triggering Fn+F fullscreen shortcut 2026-07-07 18:47:24 +02:00
sonninnos 602da7d447 Libretro updates (#2396)
* Libretro: Use SPG rate in AV info FPS + cleanups
* Libretro: Logging cleanup
* Libretro: Add disc access LED interface
* Libretro: Add coin limit option for arcade
[ci skip]
2026-07-07 18:47:03 +02:00
vkedwardli 8f877e69a2 cmake: pre-seed native macOS Xcode feature checks (#2394)
Speed up macOS Xcode project generation by skipping repeated feature checks, can be disabled with `FLYCAST_PRESEED_DARWIN_XCODE_CHECKS=OFF`
[ci skip]
2026-07-07 18:46:26 +02:00
Flyinghead c8ce4ab57f libretro: poll input with main class IDs
Issue #2393
2026-07-06 13:14:26 +02:00
Flyinghead 1607eb5715 widescreen: disable shenmue 2 cheat on disk 4. Re-enable daytona cheat
Issue #2392
2026-07-05 12:12:13 +02:00
Flyinghead fdbfb0037c libretro ios build fix 2026-07-05 12:09:35 +02:00
Flyinghead 4bc3fde130 aica: fix x86 DSP dynarec
Regression introduced by 8176646c5a
Issue #2249
2026-07-04 17:34:11 +02:00
shinyquagsire23 620ccc4f2a arm7: Implement MSR fully in AICA dynarec
This fixes audio in tip-of-branch KallistiOS versions, due to an FIQ
enable being no-op'd.
2026-07-04 17:34:11 +02:00
Flyinghead 3c99cb3190 ui: show game ID on pause menu
Issue #2389
2026-07-04 17:34:11 +02:00
Edward Li d84c41b349 Fix content grid layout during UI scale changes 2026-07-04 17:34:11 +02:00
Edward Li 347681c5e2 SDL: refresh display metrics on monitor changes 2026-07-04 17:34:11 +02:00
Edward Li 3bc049ed42 Delay OIT PVR resource allocation until game start 2026-07-04 17:34:11 +02:00
jpovixwm a5aabdef69 vk oit: honor maxStorageBufferRange and use BDA if available 2026-07-04 17:34:11 +02:00
Flyinghead 2802e80ab5 alienfnt: online watch support. use original dns name for server
Use original www.alienfrontserver.com domain name in default nvmem
picotcp: Open UDP port 7980 to receive watched game state
2026-07-04 17:34:11 +02:00
Immersion95 8a78914ba0 sh4: end the current timeslice on Stop()
When Stop() is requested, also clear the SH4 cycle counter so the current
timeslice ends as soon as possible.

This prevents execution from continuing past a requested stop point.
2026-07-04 17:34:11 +02:00
david.schkalee 7e7740be64 achievements: retry login when host override is set and login previously failed 2026-07-04 17:34:11 +02:00
David Schkalee 48703f6472 android: allow cleartext HTTP to 127.0.0.1 for local proxy image loading (#2379)
[ci skip]
2026-07-04 17:34:11 +02:00
scribam 9df8866840 vk: use enums from vulkan-hpp (#2376)
[ci skip]
2026-07-04 17:34:11 +02:00
Flyinghead 22c8c46dbd naomi: add clubkrt eeprom. Fix clubkrt network config 2026-07-04 17:34:11 +02:00
flyinghead 0137a91eab Crowdin Translations (#2374)
[ci skip]
2026-07-04 17:34:11 +02:00
Flyinghead 99617be3d3 libretro build fix 2026-07-04 17:34:11 +02:00
Flyinghead 84b57ff6ce i18n: update flycast.pot 2026-07-04 17:34:11 +02:00
Flyinghead b34c4cde8d android: use gamesdk frame-pacing library
Use games-frame-pacing library (aka Swappy) for OpenGL and Vulkan.
Implements proper frame pacing for 30 FPS games and/or 120+ Hz displays.
Don't duplicate Vulkan frames.
2026-07-04 17:34:11 +02:00
Flyinghead 08c63bd39b wsi: get rid of static graphics contexts 2026-07-04 17:34:11 +02:00
Flyinghead 02a335e2dd vk: detect crash when pipeline file is corrupted and ignore on next run
Use emu.cfg flag to detect crash. Ignore pipeline cache if flag remains
set from previous run.
Use assert() instead of verify()
2026-07-04 17:34:11 +02:00
david.schkalee 0e65e6bf5b Add RetroAchievements host override via broadcast 2026-07-04 17:34:11 +02:00
Flyinghead a63c892410 rend: avoid verify() 2026-07-04 17:34:11 +02:00
Flyinghead 624bee9316 naomi: disable audio on sega strike fighter slaves
slave audio is connected to a "bass shaker" and shouldn't be sent to
regular speakers.
Issue #1816
2026-07-04 17:34:11 +02:00
flyinghead 65cdc8f090 Crowdin Translations (#2363) 2026-07-04 17:34:11 +02:00
Flyinghead c941cf094b ui: rename Disabled network mode to Native to avoid confusion
[ci skip]
2026-07-04 17:34:11 +02:00
Flyinghead 3a10f245f8 vk: fix regression on android due to eSuboptimalKHR handling
presentKHR() returns eSuboptimalKHR on Android if not rendering at the
native resolution and orientation of the screen (often vertical).
2026-07-04 17:34:11 +02:00
Flyinghead 5d41d96e39 i18n: update flycast.pot 2026-07-04 17:34:11 +02:00
Flyinghead e698b8a2cb naomi network QoL improvements. fix jvs eeprom regression
Support for satellite nodes (vonot, club kart)
Start network game when known max of nodes is reached.
Add Start Now button to network sync wait window.

Ignore MultiboardSlaves option if not active when loading eeprom. Rely
on game id instead.
2026-07-04 17:34:11 +02:00
Flyinghead 2f7f2fd1cf naomi: derbyoc2 support. fix eeprom mismatch with multiboard slaves.
Save multiboard eeprom under a different name, same as nvmem
derbyoc2 uses the same card reader as WE
Disable M3Comm on slaves
Use non-free play default eeproms with proper DOC coin settings
Slave's eeprom was configured as satellite in some cases
2026-07-04 17:34:11 +02:00
Flyinghead ebfce147ba sdl: ignore hdpi scaling less than 1.2 2026-07-04 17:34:11 +02:00
Flyinghead 8412d3d8a3 naomi: load flash after rom so game id is known (multiboard)
Fixes loading of correct DOC main flash at boot (instead of loading the
satellite one).
2026-07-04 17:34:11 +02:00
scribam 8369fe164d ci: update cross-platform-actions and openbsd (#2358)
[ci skip]
2026-07-04 17:34:11 +02:00
scribam f26a82d262 ios: remove [super dealloc] when using arc (#2356)
[ci skip]
2026-07-04 17:34:11 +02:00
Isaac Marovitz 4b22470a9a Restructure core/rend CMakeLists (#2354)
[ci skip]
2026-07-04 17:34:11 +02:00
Flyinghead d34015b4a4 naomi: support for dinokich and loveber3cn 2026-07-04 17:34:11 +02:00
scribam d79ce95475 rend: rename gl.quad to gl.quadDrawer (#2355)
Prevent confusion with the macro "quad" from newlib (devkitpro, vitasdk)

[ci skip]
2026-07-04 17:34:11 +02:00
mehlis 5400069d3c add HiDPI/scale factor support for Linux (#2326)
Respects GNOME scale settings via:
  1. GDK_SCALE environment variable
  2. GNOME settings (gsettings)
  3. SDL DPI detection fallback

[ci skip]
2026-07-04 17:34:11 +02:00
Joe Mattiello 8b7dad34ee dx9: route renderer teardown on vsync switch through rend_term_renderer (#2325)
Made-with: Cursor

[ci skip]
2026-07-04 17:34:11 +02:00
Joe Mattiello 5201780ec2 vk: enable portability enumeration on Apple platforms (#2324)
Since Vulkan loader 1.3.216 the loader no longer enumerates portability ICDs unless the application
sets VK_INSTANCE_CREATE_ENUMERATE_PORTABILITY_BIT_KHR and enables the
VK_KHR_portability_enumeration instance extension. Without this,
vkCreateInstance returns VK_ERROR_INCOMPATIBLE_DRIVER on macOS / iOS
where MoltenVK is the only available ICD, and Flycast fails to start
the Vulkan renderer entirely.

Made-with: Cursor

[ci skip]
2026-07-04 17:34:11 +02:00
Joe Mattiello fedf54fbb7 vk: recreate swapchain on suboptimal present result (#2323)
vulkan-hpp lists eSuboptimalKHR as a success code for presentKHR, so
the call returns the value rather than throwing. The existing code
ignores it via (void)res and the surface stays stuck in a sub-optimal
configuration until something else triggers a resize.

In practice this shows up across DPI / window-resize / display-mode
changes and on MoltenVK, where the driver more aggressively reports
the swapchain as suboptimal but still presents. Set resized so the
swapchain is rebuilt on the next frame, matching the existing
out-of-date handling that already comes through vk::SystemError.

Made-with: Cursor

[ci skip]
2026-07-04 17:34:11 +02:00
Joe Mattiello f6f5927e1f pvr: bound render-message queue and drain it on renderer term to fix libretro audio drift (#2322)
pvr: bound PvrMessageQueue depth to prevent producer/consumer drift
pvr: drain queue before destroying the renderer in rend_term_renderer

Made-with: Cursor

[ci skip]
2026-07-04 17:34:11 +02:00
Flyinghead 2f84da4966 fix non-multiboard build 2026-07-04 17:34:11 +02:00
Flyinghead baaad2e8b9 naomi: use smart ptrs for multiboard and M3 comm. Refactoring 2026-07-04 17:34:11 +02:00
Flyinghead f0faed63cb win32: escape double quotes in cmd line args with backslash 2026-07-04 17:34:11 +02:00
Flyinghead 938ecb04d2 naomi: fix derbyoc[w] network slots. rename some comm board registers
derbyoc and derbyocw expect the slave count, not the total node count,
when the M3 board connects.
2026-07-04 17:34:11 +02:00
Flyinghead 4ac80670f7 compile warnings
Issue #2347
2026-07-04 17:34:11 +02:00
flyinghead e975526b22 New translations flycast.pot (Spanish) (#2339)
[ci skip]
2026-07-04 17:34:11 +02:00
Flyinghead d2fd5cdfab multiboard: derby owners club support. route keyboard events to master
WIP support for derby owners club (except derbyoc2)
Slaves now send keyboard events to master, which handles them and sets
input focus to its own window, and attempts to raise it.
Half the sync interval for F355 to fix sync regression.
2026-07-04 17:34:11 +02:00
Flyinghead c286463d6b aica: properly align RAM reads/writes from sh4. Avoid crash on last byte 2026-07-04 17:34:11 +02:00
Flyinghead 3b809c8762 jvs: disable eeprom load for slaves. nvmem: fix doc sat/main conflict
Save derby owners club flash file (.nvmem) under a different name for
the main screen.
2026-07-04 17:34:11 +02:00
Flyinghead 3aa2c67782 support quoted config values on command line 2026-07-04 17:34:11 +02:00
Flyinghead c7ef5c6a0a win32 build fix 2026-07-04 17:34:11 +02:00
Flyinghead e2b45eb551 libretro build fix 2026-07-04 17:34:11 +02:00
Flyinghead eb5f74258f naomi: multiboard support for alpilot and sstrkfgt 2026-07-04 17:34:11 +02:00
Flyinghead 5b8a0ae038 naomi: move multiboard code to .cpp. less log 2026-07-04 17:34:11 +02:00
Flyinghead 12d9caff93 maple: create MIE device on multiboard slaves 2026-07-04 17:34:11 +02:00
Flyinghead 10057deebf naomi: reset M3 comm board data when disconnecting 2026-07-04 17:34:10 +02:00
github-actions[bot] 324d9c10bb Fetch translations & Recreate libretro_core_options_intl.h 2026-07-03 22:35:52 +00:00
github-actions[bot] 7ec978e852 Fetch translations & Recreate libretro_core_options_intl.h 2026-06-26 22:39:45 +00:00
Flyinghead 1251a53aed github actions: stick to windows 2022 for now
[ci skip]
2026-06-24 09:20:48 +02:00
Engdyn 59ab660649 docs: fix typo (#2383)
[ci skip]
2026-06-23 09:44:25 +02:00
github-actions[bot] c6fe11017c Fetch translations & Recreate libretro_core_options_intl.h 2026-06-19 22:33:20 +00:00
github-actions[bot] c0f2cf4319 Fetch translations & Recreate libretro_core_options_intl.h 2026-06-12 22:46:27 +00:00
github-actions[bot] 751295151e Fetch translations & Recreate libretro_core_options_intl.h 2026-06-05 22:39:03 +00:00
Flyinghead 619082fe46 android: back to target sdk 35 (android 15)
Until we figure out this fucking android 16 Back key mess.
Revert 7fc81607e3
2026-06-05 12:35:37 +02:00
Flyinghead 7fc81607e3 android: ignore Back key on android 13+ with OnBackInvokedCallback
Since targeting android 16 (6a071668be)
the Back key isn't handled by Flycast anymore on android 16, due to
breaking changes by Google. Install an OnBackInvokedCallback to ignore
default handling of the key and get back to normal.
Tentative fix for
Issue #2369
2026-06-05 08:54:19 +02:00
Flyinghead e4c96293e4 input: unmapping a button shoud make the InputMapping dirty
Fixes mapping not being saved when only unmapping buttons.
Issue #2367
2026-06-04 11:04:25 +02:00
Flyinghead 3ca5099fb0 Revert "libretro: report 60.00 fps for NTSC instead of 59.94 (#2333)"
This reverts commit 2c7c687240.
2026-06-04 10:53:08 +02:00
Craig Carnell 34f2a70a6b webOS: use GLES 3 on 64-bit build 2026-06-01 15:27:19 +02:00
vkedwardli 3d85218f0a Simplify custom texture directory discovery (#2341)
[ci ckip]
2026-06-01 15:26:52 +02:00
2c7c687240 libretro: report 60.00 fps for NTSC instead of 59.94 (#2333)
Aligns the reported core framerate with the typical 60 Hz host display
refresh, eliminating the periodic frame-pacing skip that drift between
59.94 fps content and a 60 Hz monitor produces under strict V-Sync or
Black Frame Insertion (the skip happens roughly every 17 seconds).

PAL (50.0 Hz) is unchanged. The 240p VGA rate is also moved to 60.0
so it benefits from the same alignment. Audio sample rate stays at
44100 Hz; the per-run sample count `sample_rate / fps` adjusts
automatically.

Co-authored-by: jf624708-blip <[email protected]>
Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>

[ci skip]
2026-06-01 15:26:08 +02:00
github-actions[bot] 8492a4e5e2 Fetch translations & Recreate libretro_core_options_intl.h 2026-05-29 22:44:07 +00:00
github-actions[bot] bb304918f8 Fetch translations & Recreate libretro_core_options_intl.h 2026-05-22 22:35:23 +00:00
Flyinghead f3047b2ef1 Virtual-On: Oratorio Tangram (JP) widescreen cheat 2026-05-20 18:00:08 +02:00
github-actions[bot] 3e60beb69e Fetch translations & Recreate libretro_core_options_intl.h 2026-05-15 22:32:59 +00:00
Flyinghead 9310bf4799 7z: the seek method must return the current position
Fixes broken 7z support after 16345dfdd0.
Issue #2346
2026-05-15 13:04:23 +02:00
Flyinghead d39b89bfb3 Merge remote-tracking branch 'origin/dev' 2026-05-15 13:01:33 +02:00
Flyinghead ce5f9d32db dcnet: virtual-on support 2026-05-14 20:57:42 +02:00
Edward Li cf144bcfa7 Warm up C++ exceptions on Switch startup 2026-05-14 17:08:51 +02:00
Flyinghead 22d029ba1e egl: check if eglInitialize is null
Fixes MINIDUMP-93J
[ci ckip]
2026-05-14 17:08:36 +02:00
Flyinghead c00a62c909 imgread: check track count when generating ToC
Fixes MINIDUMP-962
2026-05-14 17:05:55 +02:00
Flyinghead 8acadcb66c aica: sample address bound checking
Avoid crashes when audio RAM mirroring is missing (Switch)
2026-05-14 17:00:34 +02:00
Clownacy 4be8a48466 Libretro: Make m3u files support VFS also. 2026-05-10 17:51:41 +02:00
Flyinghead 07e435c55f Merge remote-tracking branch 'origin/dev' 2026-05-09 18:59:15 +02:00
Flyinghead ead8ab2223 dricas auth cheat for Nettou Golf. various minor changes 2026-05-09 18:23:14 +02:00
Flyinghead be1b7f2fce flash: fix netmask for bomberman BBA 2026-05-09 18:17:30 +02:00
scribam 4f356e846a android: update project 2026-05-09 15:55:56 +02:00
flyinghead 85d6a0125c Crowdin Translations (#2329)
[ci skip]
2026-05-09 15:55:29 +02:00
github-actions[bot] 1b6f880ccf Fetch translations & Recreate libretro_core_options_intl.h 2026-05-08 22:33:10 +00:00
github-actions[bot] 744e9e4aa5 Fetch translations & Recreate libretro_core_options_intl.h 2026-05-01 22:31:35 +00:00
flyinghead 5993a20644 Crowdin Translations (Turkish) 2026-04-25 17:11:52 +02:00
Flyinghead 15ecfcc7e8 i18n: update flycast.pot
[ci skip]
2026-04-25 17:11:16 +02:00
Flyinghead 958517a621 force real BIOS for MIL-CDs
Issue #2321
2026-04-25 17:00:54 +02:00
github-actions[bot] acb4966f54 Fetch translations & Recreate libretro_core_options_intl.h 2026-04-24 22:27:37 +00:00
flyinghead 25b2602751 Crowdin Translations (#2319) 2026-04-22 17:28:12 +02:00
Flyinghead 31d5ddb920 rend: simplify scissor/dimensions handling. reduce code duplication
Fix regression with split-screen multi render in Quake 3. Caused by
aef3d2d337.
Move duplicated code into transform_matrix. Handle framebuffer
dimensions/clipping scaling depending on render mode (Full FB emu, copy
RTT to vram).
Handle RTT and screen render similarly when possible.
[ci skip]
2026-04-22 17:27:26 +02:00
Flyinghead dfbbf8913c win32: init winsock in main() 2026-04-20 14:48:05 +02:00
Flyinghead 4505fc5787 macOS: allow building without vulkan 2026-04-20 14:42:29 +02:00
Marc Gardent e279abd0b5 UI: Add option to discard video and animated textures during dump (#2318)
ui: add option to discard video and animated textures during dump
Implement a filter to prevent flooding the texture dump directory with
thousands of redundant frames from FMVs or procedural effects.
- Add a single 'Discard Video and Animated Textures' option (enabled by default).
- Filter logic: skip dumping if the texture was already updated (Updates > 1)
  or if it uses the YUV format (video).
- Update UI in Advanced settings, French translations, and i18n template.
2026-04-20 13:31:56 +02:00
github-actions[bot] ae5416a5cb Fetch translations & Recreate libretro_core_options_intl.h 2026-04-17 22:24:46 +00:00
Flyinghead aef3d2d337 rend: fix clipping with vscale>1. Get rid of scissor matrix
Fix framebuffer clipping when scale>1 (Stretched PAL). Issue #728
Get rid of ScissorMatrix.
Don't scale framebuffer clipping rect in full FB emu.
Refactor rend_context. Use Rect and ivec2.
2026-04-16 18:15:05 +02:00
Flyinghead 9bc041873a dx9 build fix 2026-04-15 17:56:34 +02:00
Flyinghead ccd7525c0b fix explicit template instantiations 2026-04-15 17:32:18 +02:00
Edward Li ce2f566ef3 docs: clarify download channels and desktop build scripts 2026-04-15 17:14:01 +02:00
vkedwardli a3373af43d Windows: support vanilla bootstrap (#2316)
[ci skip]
2026-04-15 17:13:44 +02:00
Flyinghead cc9f764a64 Merge remote-tracking branch 'origin/master' into dev
[ci skip]
2026-04-15 17:13:22 +02:00
Flyinghead 677dc930f8 rend: make transform_matrix.cpp 2026-04-15 17:07:56 +02:00
Flyinghead 99da46b4cc input: close all gamepads/keyboards/mice when terminating
Failure to do so may cause a static deinit order error on exit.
android: use AKEYCODE_ and AMOTION_EVENT_ system constants
2026-04-14 11:57:53 +02:00
Flyinghead 8c773f5ab0 chd: fix use-after-free crash when chd_open_file fails
chd_open_file (almost) always closes the passed file even in case of
error.
Fixes MINIDUMP-8ZK
2026-04-14 11:25:05 +02:00
Flyinghead 00ec2b15a3 samba: round/clamp/bias analog axis values as needed by the game
Issue #2282
2026-04-13 10:05:11 +02:00
Flyinghead 321bdaf08b Force PAL for Evil Twin - Cyprien's Chronicles
Issue #2048
2026-04-12 15:47:35 +02:00
Flyinghead aef9266d92 imgui: g.Font used instead of g.FontBaked
Fixes MINIDUMP-8WK
2026-04-12 15:42:41 +02:00
ClownacyandClownacy 16345dfdd0 Add support for libretro VFS (and file IO indirection in general). (#2299)
* Use custom file IO callbacks for libraries: libzip, 7zip, libchdr, and stb_image.
* Add file IO indirection.
* Add libretro VFS implementation.

---------

Co-authored-by: Clownacy <[email protected]>
2026-04-11 11:26:51 +02:00
github-actions[bot] ed41f982c1 Fetch translations & Recreate libretro_core_options_intl.h 2026-04-10 22:24:04 +00:00
Edward Li b95e7fc4cc deps: update Vulkan-Headers and VulkanMemoryAllocator 2026-04-10 15:49:29 +02:00
Edward Li d16548fc35 macOS: support vanilla macOS bootstrap and update Vulkan SDK install 2026-04-10 15:49:29 +02:00
vkedwardli ad855bd812 add Pause feature
[ci skip]
2026-04-10 15:49:05 +02:00
flyinghead 3395780fd2 Crowdin Translations: Spanish, Swedish 2026-04-09 19:16:12 +02:00
Flyinghead 602191ebe7 generic dricas auth bypass for WinCE games
Intercept the GetProcAddress call and replace the function with an empty
but successful stub.
[ci skip]
2026-04-09 19:15:31 +02:00
Flyinghead ad03e10c16 i18n: protect tinygettext log info set with mutex
Log functions can be called concurrently by multiple threads (game
loader, main, ...)
Fixes MINIDUMP-8WR
2026-04-07 11:55:42 +02:00
Flyinghead f58c86f030 vk: validation error in single-threaded due to timeout
In single-threaded mode, direct framebuffer writes are handled in
vblank, but the Emulator then assumes a timeout has occurred, and the
frame is rendered but not presented.
Ignore this invalid timeout and present the frame is all cases. The
context won't do anything if no frame has been rendered.
Issue #2302
2026-04-06 12:16:31 +02:00
Immersion95 8f2351b1b7 vk: fix non-threaded freeze on AMD GPUs (#2303)
Reset framebufferRendered after PresentFrame() in the Vulkan
framebuffer presentation path.

This fixes a standalone Vulkan freeze on AMD GPUs in non-threaded
mode, where the emulator could hang after the Sega logo until an
alt-tab.
[ci skip]
2026-04-06 12:09:26 +02:00
github-actions[bot] 4dbe02895e Fetch translations & Recreate libretro_core_options_intl.h 2026-04-03 22:23:33 +00:00
Edward Li 4b4d0b6db2 macOS: Use MAP_JIT from now on 2026-04-03 13:53:54 +02:00
flyinghead 3d81741df6 Crowdin Translations (#2291)
[ci skip]
2026-04-03 13:53:16 +02:00
Flyinghead 2814b11bc3 dricas auth bypass cheat for Rune Jade
[ci skip]
2026-04-03 13:52:52 +02:00
Edward Li a5f4ec6310 rend: use thread-local flip state 2026-03-31 15:10:08 +02:00
Craig bd0bf5e3ba libretro: fix typo in gitlab-ci (#2296)
[ci skip]
2026-03-31 15:09:42 +02:00
Craig 99ab85ffe7 webOS: add to gitlab CI (#2295)
[ci skip]
2026-03-31 11:20:14 +02:00
Eric WarmenhovenandClaude Opus 4.6 69d9fa5332 add linux-aarch64 build (#2290)
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>

[ci skip]
2026-03-30 20:57:46 +02:00
Flyinghead 476ed40c08 dx11 build fix 2026-03-30 20:54:39 +02:00
Flyinghead c3c710ec07 clubk: set correct node type (disabled/master/slave) and car# 2026-03-30 20:41:01 +02:00
Flyinghead bba324169a ui: replace NULL by nullptr. No functional change 2026-03-30 18:43:35 +02:00
Flyinghead cb364c9ed0 pvr: avoid crash on invalid poly params
Fixes MINIDUMP-8PX
2026-03-30 18:27:58 +02:00
Flyinghead 01dc4f6ec9 naomi: hide implementation details. no functional change 2026-03-30 18:14:39 +02:00
Flyinghead 3e96eec972 rend: clamp config::PerPixelLayers to avoid shader compile errors
Make sure shaders/pipelines are reset when config changes.
Fixes MINIDUMP-8SY
2026-03-30 17:41:41 +02:00
Flyinghead c7780ec324 more robust elf loading
Fixes MINIDUMP-8G9 MINIDUMP-8NH
2026-03-30 17:21:23 +02:00
Flyinghead fae9ed63b5 i18n: update flycast.pot 2026-03-30 16:19:00 +02:00
Edward Li 0bf7570db2 Fix Full Screen menu shortcut on newer macOS versions 2026-03-30 15:41:36 +02:00
Edward Li 625fce5d52 Temp fix for C++17 and C++/CX 2026-03-29 18:35:38 +02:00
Edward Li f5cb17bf82 gui_font.cpp 2026-03-29 18:35:38 +02:00
Edward Li 31a69ac5b8 Reject COLRv1 fonts (latest Fedora and possibly some Androids) 2026-03-29 18:35:38 +02:00
Edward Li 1f4a99ae7f Android: 32-bit unicode support 2026-03-29 18:35:38 +02:00
Edward Li 993250403d Replace largeFont with uiLargeFontSize() and/or boldFont 2026-03-29 18:35:38 +02:00
Edward Li c1e0d07e23 refactor font loading system to support weights, better CJK fallback, dynamic font file path from fontconfig for linux 2026-03-29 18:35:38 +02:00
Edward Li b73190bdb5 Add freetype lib 2026-03-29 18:35:38 +02:00
Edward Li 8c13a7d832 imgui: upgrade to 1.92.6 2026-03-29 18:35:38 +02:00
Edward Li 0cf01f83a6 Font weight/size tuning 2026-03-29 18:35:38 +02:00
Edward Li 6a0c4772e8 Load font based on locale priorities: CJK > User Locale > Other Locale, remove all glyph ranges 2026-03-29 18:35:38 +02:00
Edward Li 13a2639f8d Update imgui backends 2026-03-29 18:35:38 +02:00
Flyinghead 3f6928595a ui: don't call i18n in static init. msvc utf-8 source option
Don't call i18n::T in static init to avoid potential static init order
issue. Tentative fix for Issue #2285
Call i18n::init() in i18n::reloadLanguage()

Set source files to utf-8 for MSVC
2026-03-28 13:02:34 +01:00
Flyinghead c43109deeb ui: handle language change for Controls tab
lua update
2026-03-26 16:18:11 +01:00
Flyinghead 42555bcf4b emu: add locale change event. Simplify i18n UI 2026-03-25 18:25:11 +01:00
Edward Li 80683f9670 Language Picker 2026-03-25 17:13:09 +01:00
flyinghead 875156510b New translations strings.xml (Turkish)
New translations for {languageName}
2026-03-24 19:08:58 +01:00
Flyinghead f5da7ffb8d modem: proper support of V.42 RNR
[ci skip]
2026-03-24 19:08:18 +01:00
Flyinghead 63c2be61a4 Merge remote-tracking branch 'origin/master' into dev 2026-03-24 19:00:12 +01:00
Flyinghead 9954019b13 win32 build fix 2026-03-22 17:26:32 +01:00
Flyinghead 97a0396af8 don't allocate memory when logging
Can lead to deadlock if crash happens in malloc/free
2026-03-22 17:15:43 +01:00
Flyinghead f301ad1f4a cheat: segfault accessing config db in destructor 2026-03-22 17:05:31 +01:00
Flyinghead 6d2befc804 http: allow req and resp headers with GET. 30 s timeout. linux tests
Add http::get function with request and response header params.
Set a 30 s connection timeout for all http requests (except on macOS).
Linux tests with postb.in
2026-03-22 15:39:51 +01:00
Flyinghead 7f26348ed8 android: google auto backup support
When enabled, all .cfg and all files in data except savestates are
backed up. Only the direct children of data are considered so boxart,
wwwcache, texdump, etc. are excluded.
2026-03-21 18:36:55 +01:00
flyinghead ecdf05fef8 Crowdin Translations (#2273) 2026-03-21 12:21:24 +01:00
Flyinghead 45c31c149d sdl: test code leftover
[ci skip]
2026-03-21 12:20:59 +01:00
Flyinghead 45e9b720d1 no swap interval support in dx9. Fix rounding of refresh rate on windows
DX9 windowed mode only supports a swap interval of one (and immediate).
Windows reports a refresh rate of 59.94 Hz or 119.98 Hz, which is
rounded down by SDL. This causes the calculated swap interval for 30 FPS
to be less than 2 (for 60 Hz).
Issue #520
2026-03-20 14:09:22 +01:00
PLCodingStuff 05b270f05c Added missing Linux build requirements to README 2026-03-20 13:46:46 +01:00
Flyinghead 1120aa7fa1 ui: make game filter match both filename and game title 2026-03-19 20:36:18 +01:00
Flyinghead 8d58f6a8db i18n: update pot 2026-03-19 19:45:54 +01:00
Flyinghead e31b0cfd79 missing localizable string 2026-03-19 19:44:16 +01:00
Flyinghead 9feee44de7 i18n: update pot 2026-03-17 16:10:15 +01:00
Flyinghead fb69bd8fbc rend: Detect game FPS and adjust gl/dx swap interval
Detect games running at 30 FPS and double the opengl or directx 9/11
swap interval.
Issue #520
2026-03-17 16:01:42 +01:00
Flyinghead 4ef64d1881 Touch screen emulation for Fish Life
Issue #2234
2026-03-17 15:08:35 +01:00
github-actions[bot] b71fb72f0a Fetch translations & Recreate libretro_core_options_intl.h 2026-03-13 22:22:51 +00:00
Flyinghead c887068253 delete dcnet utility for dreampi
Use https://github.com/scrivanidc/dreampi_custom_scripts instead
2026-03-13 14:21:22 +01:00
Flyinghead 23073131ad ooga booga cheat to disable net state check
Fixes network error when playing against real console (using patched
game as well)
2026-03-13 14:18:22 +01:00
Flyinghead 273fc8fbdd force DCNet for Power Smash and Pro Yakyuu Team de Asobou Net! 2026-03-12 11:30:48 +01:00
scribam ade2d1dece android: update project 2026-03-11 19:20:39 +01:00
scribam 48f9db752e readme: add packaging status (#2266)
[ci skip]
2026-03-11 19:20:20 +01:00
github-actions[bot] adabc694e7 Fetch translations & Recreate libretro_core_options_intl.h 2026-03-06 22:23:21 +00:00
github-actions[bot] 94e9b349f9 Fetch translations & Recreate libretro_core_options_intl.h 2026-02-27 22:22:35 +00:00
eadmaster 3eef0196cf added in-ram savestates (#2252) 2026-02-25 09:52:16 +01:00
vkedwardli 55d310be71 i18n: use GetUserPreferredUILanguages on Windows and NSLocale on macOS (#2256) 2026-02-23 20:34:28 +01:00
github-actions[bot] 3339416089 Fetch translations & Recreate libretro_core_options_intl.h 2026-02-20 22:22:51 +00:00
Flyinghead 2c48c0188a input: add null check 2026-02-20 13:08:13 +01:00
Flyinghead d72856c1cc dcnet: ping APs 5 times instead of 3 2026-02-20 13:05:27 +01:00
Flyinghead ba5b3c71ec Merge remote-tracking branch 'origin/dev' 2026-02-16 17:01:44 +01:00
Flyinghead 75feafbbf0 vk: use mailbox present mode if immediate mode isn't available
Fixes fast forward not working on mobile.
Issue #2219
2026-02-11 18:06:25 +01:00
Flyinghead 5b08957655 input: reset button/axis when unmapping
to avoid the button staying pressed or the axis deflected until
remapped.
2026-02-11 17:56:10 +01:00
Flyinghead 788cbfb64b aica: don't let CA get to close to LEA
VC 2K sport games sometimes miss the end of the sound if the last
reported CA is >= LEA-2. This result in a "stuck" audio channel and
leads to a game freeze after a while (NFL) or when exiting the game
(NBA).
Issue #1481
Issue #2226
2026-02-11 14:57:50 +01:00
Flyinghead 30b42a8a74 sh4 dyna: lighter headers
no functional change
2026-02-11 14:41:00 +01:00
Kyuyrii a6dc61f064 Adding StartupWMClass 2026-02-10 16:54:02 +01:00
Edward Li cd6002595e macOS: Improve menu item handling and add traditional fullscreen shortcuts 2026-02-10 16:53:23 +01:00
Flyinghead 45ebe22d40 enable DCNet by default 2026-02-10 15:31:21 +01:00
Flyinghead 805d014b5d pvr: reset the YUV converter on startrender as on real hw
The YUV converter is reset on STARTRENDER on real hardware.
TA_YUV_TEX_CNT is reset when more YUV data is sent, not when block count
is reached.
Fixes skipping image in pl_mpeg
2026-02-10 15:22:11 +01:00
github-actions[bot] c577e29f43 Fetch translations & Recreate libretro_core_options_intl.h 2026-02-06 22:22:08 +00:00
Flyinghead 02ed5fa340 ui: add notification for next/previous state slot 2026-02-05 17:46:31 +01:00
Flyinghead b31f92f8ea sh4: increase timers resolution
Use cycle_counter to increase the precision of timers.
Use 64-bit where needed to handle underflows. Avoid double operations on
32-bit and 64-bit data.
Add timer test.
Fixes lack of randmness in Soul Calibur. Issue #2093
2026-02-05 17:40:06 +01:00
Windsurf7 2a6e109b1d Adds next/previous save state slot hotkeys (#2229) 2026-02-02 13:50:32 +01:00
Flyinghead 821f049a79 f355: remove US and EU timeout cheats. add dricas bypass cheat for JP 2026-01-30 15:34:38 +01:00
Flyinghead fb43c91ab9 vulkan: throw in case of error instead of dying
Fixes MINIDUMP-8EG
2026-01-30 15:30:41 +01:00
Flyinghead 91ea2c8af1 jvs: refactoring. no functional change 2026-01-30 14:58:41 +01:00
Flyinghead d75b0b1810 cue: make md5 digest before track file is closed 2026-01-30 14:56:24 +01:00
Flyinghead da15c3d4a5 mushi: map P2 hit button to P1 button 4 to show on vgamepad
Also map P2 Hit button to P1 button 4 so it's accessible on mobile
devices, to enable hard mode or change game version
2026-01-29 16:40:02 +01:00
flyinghead 27b30acae4 New translations flycast.pot (Swedish)
New translations for {languageName}
2026-01-29 15:49:21 +01:00
Flyinghead cc3ff811e8 maple/jvs: fix RFID card reader regression (mushiking, vf4)
The RFID card reader/writer is an MIE device. Fixes regression uncovered
by a429fba21d.
Also fixes mushikc
[ci skip]
2026-01-29 15:49:03 +01:00
Edward Li 21eb24f86d Refactor CustomTexture lookup to FIFO for clearer priority logic 2026-01-28 10:59:33 +01:00
Flyinghead 976d3bed28 rend: fix division by zero when output fb is 0x0
Often happens with integer scaling.

Fixes MINIDUMP-8BW MINIDUMP-8CT MINIDUMP-8DP MINIDUMP-85Z
[ci skip]
2026-01-28 10:59:20 +01:00
github-actions[bot] 22e28c0a7c Fetch translations & Recreate libretro_core_options_intl.h 2026-01-23 22:21:18 +00:00
flyinghead 9504ab85be Crowdin Translations 2026-01-23 15:51:53 +01:00
Flyinghead 4254c7edf1 power smash: use symmetric modem speed. get rid of game patches
Power Smash needs a symmetric speed to avoid lag. Handle network issues
server-side and get rid of game patches.
Same for Pro Yakyuu Team de Asobou Net
[ci skip]
2026-01-23 15:51:18 +01:00
James a30c27b471 Fix issues relating to multiple MapleLink devices 2026-01-22 14:45:55 +01:00
Flyinghead f142e34973 i18n: update message file
[ci skip]
2026-01-22 14:45:18 +01:00
Flyinghead d0d3661350 maple: make a copy of the maple_device shared_ptr to avoid deletion
If a MapleLink device is disconnected during a maple dma call, the
corresponding MapleLinkVmu will be deleted. Keep it alive until the end
of the RawDma() call.
Fixes MINIDUMP-8C4
2026-01-22 14:44:21 +01:00
DarkOK ea9464f7c3 maple: implement DreamParaPara controller
a device that is very against spec
2026-01-21 16:00:40 +01:00
Flyinghead c4d757635b gdrom: stop CDDA at lead out only. CUE loader CDDA support
Fixes missing menu music in DreamParaPara
[ci skip]
2026-01-21 15:57:37 +01:00
Flyinghead a429fba21d maple: better handling of non-standard messages. some refactoring
maple: ignore the outgoing message header if the device doesn't have expansion ports. Use port and len from the DMA header.
maplelink: add virtual event handlers for game start and term. Use in DreamLink and DreamPicoPort.
2026-01-20 16:51:20 +01:00
Flyinghead 945376a3a6 pvr: correct handling of exception from Process/Render. Vulkan fix
pvr: reset the TA context and let the emu thread continue in case of renderer exception.
vulkan: reset rendering state when recreating swap chain
ui: only pause the game on renderer exception to allow the user to save a state. Disable scrolling buttons on Settings tab bar.
i18n: update source pot
2026-01-20 15:45:35 +01:00
Edward Li f86e195017 Fixes segfaults on Apple Silicon when C++ exceptions propagate through dynarec code 2026-01-19 15:04:35 +01:00
vkedwardli 75aefbb7b8 Support Windows 7 (0x0601) for MinGW builds
[ci skip]
2026-01-19 15:04:19 +01:00
James Smith 4fc65efbf0 Send gameid in dreampicoport when game is started 2026-01-19 13:36:22 +01:00
James Smith fa3c8f2117 Allow a MapleLink device to handle GetLastError commands which are needed by real VMUs 2026-01-19 13:36:22 +01:00
scribam d8ba8e409a bsd: install libusdb and lua
[ci skip]
2026-01-19 13:35:15 +01:00
Flyinghead fcdcc0d37a vk: set rendContext to null in RenderFramebuffer (failfast)
[ci skip]
2026-01-19 13:34:37 +01:00
Flyinghead 8df7e3be41 libretro: dreampotato storage support 2026-01-18 21:45:46 +01:00
Flyinghead 90301d5c31 pvr: get rid of _pvrrc global. Improve exception handling in renderers
New RendererException for fatal renderer errors.
Avoid propagation of vulkan exceptions and throw known ones instead.
Reset graphics API on error.
2026-01-18 19:36:45 +01:00
scribam 6a071668be android: modernize project 2026-01-18 11:13:39 +01:00
Edward Li 94bf208b5b imgui: CJK-aware text wrapping 2026-01-18 11:13:00 +01:00
Flyinghead 7775b3d0d0 maplelink: notify user on the first write to a remote VMU
[ci skip]
2026-01-18 11:11:48 +01:00
Flyinghead 5fa1886fdf maple: individual device reconnect. Check DreamPotato socket state
Only reconnect maple devices that have changed instead of all of them.
Check DreamPotato socket state every second.
Disconnect linked maple device when disconnected from remote device.
dreampicoport: send port when changing bus
2026-01-17 19:11:56 +01:00
Flyinghead fce8b4d6f9 dreampotato: change timeout values. disconnect on receive error
initial RTT timeout is 500 ms then 100 ms
2026-01-17 18:47:13 +01:00
Flyinghead b7bf027645 maplelink: disable savestates. Change some options default. Bug fix
Disable load/save state if at least one MapleLink with storage enabled.
Change UsePhysicalMemory default to false.
Change Per Game VMU A1 default to true.
Fix DreamLink infinite loop on exit.
dreampotato, dreamconn: don't use stringstream for output
dreampotato: libretro support (no VMU storage yet)
2026-01-17 18:47:13 +01:00
Flyinghead b7dba4b7a4 switch: build fix 2026-01-17 18:47:13 +01:00
Flyinghead 39bdd878ff lr: build fix 2026-01-17 18:47:13 +01:00
Flyinghead 16cfce7aed DreamLink refactoring
Introduce MapleLink base interface and DreamPotato implementation.
2026-01-17 18:47:01 +01:00
Flyinghead e0ad9f6125 Merge remote-tracking branch 'origin/master' into dev 2026-01-17 12:26:20 +01:00
vkedwardli 991d90d089 custom texture: Fix incorrect texture state when skipping texture update (#2193)
Disable GPU Palette texture optimization when custom texture is enabled
2026-01-17 10:17:10 +01:00
github-actions[bot] d676dae7b8 Fetch translations & Recreate libretro_core_options_intl.h 2026-01-16 22:22:05 +00:00
Flyinghead f64341d2b7 modem: fix compiler warnings and a mod 128 typo 2026-01-15 15:57:24 +01:00
Rikki Gibson f3ea74fa28 Fix DreamPotato integration (#2199)
* Revert "dreamconn: only build on win32. remove unused code"
This reverts commit 8511d1ad3c.
* Fix for access violation on exit
* Unlisten when freed
2026-01-15 10:11:10 +01:00
Flyinghead d07c09ea16 switch: ignore rumble status from SDL
Fixes rumble on Switch.
Issue #2201
[ci skip]
2026-01-15 10:10:01 +01:00
Stefan Schlosser 1aba1b467e deps: prevent installing DreamPicoPort artifacts
Currently the install-target of the DreamPicoPort-API dependency is
executed when installing flycast. This results in the include file
DreamPicoPortApi.hpp and the static library libdream_pico_port_api.a to
be installed alongside flycast.

Add EXCLUDE_FROM_ALL to add_subdirectory to prevent this.
2026-01-14 12:17:21 +01:00
Flyinghead 5be5eeb905 naomi: more rom crc32
[ci skip]
2026-01-14 12:17:02 +01:00
Flyinghead 2f842238a5 ini: don't save transient values and empty sections 2026-01-14 12:16:23 +01:00
flyinghead 3de74672ce Crowdin Translations: Japanese, Swedish 2026-01-13 11:41:42 +01:00
Flyinghead b76b1c7275 Merge remote-tracking branch 'origin/master' into dev
[ci skip]
2026-01-13 11:39:33 +01:00
Flyinghead 392a429e8b boxart: replace invalid utf-8 chars instead of failing when saving
Open (and truncate) the file only after json serialization.
2026-01-07 14:28:32 +01:00
Flyinghead 0491f2e6a5 reios: check boot file destination ptr before loading
Abort load if ptr is null (size > 0xff0000)
Fixes MINIDUMP-7W9 MINIDUMP-84B MINIDUMP-87V
2026-01-07 09:50:35 +01:00
Flyinghead 33d9a58cf9 emu: don't crash if unexpected state in Emulator::start()
Simply log and ignore. Happens on android under some undetermined
conditions.
Fixes MINIDUMP-2Q MINIDUMP-3SG
2026-01-07 08:52:36 +01:00
Flyinghead 401332d520 sdl: don't run haptic sine effect if rumblePower is 0 2026-01-06 16:23:47 +01:00
Flyinghead 8511d1ad3c dreamconn: only build on win32. remove unused code 2026-01-06 16:21:35 +01:00
Flyinghead 7ce50e5229 mmu: stricter test before enabling on-demand MMU
Visual Concepts games and many naomi and systemsp games create some
bogus mappings at boot. Ignore those

Issue #2184
2026-01-05 11:48:03 +01:00
Flyinghead 99fc194dd0 ini: transient values always hide regular ones regardless of order 2026-01-05 11:42:41 +01:00
Craig d794b53512 webOS: disable OPENMP as not available until webOS 3.9.2 (#2188)
[ci skip]
2026-01-04 21:10:03 +01:00
vkedwardli bd8f7c8a75 Update imgui to v1.92.5 (#2180)
Update ImGui from v1.92.1 to v1.92.5
2026-01-04 10:56:36 +01:00
Craig 594d82b223 add webOS to CMakeLists (#2167)
[ci skip]
2026-01-04 10:55:23 +01:00
Flyinghead fd72eebbe3 mmu: enable full MMU when non-SQ mapping is created
Fixes super mario 64 audio
Issue #2184
[ci skip]
2026-01-04 10:53:12 +01:00
Flyinghead fea8699884 modem: enforce correct tx speed for dissymmetric connections 2026-01-04 10:48:01 +01:00
Flyinghead d00b5d4c17 modem: 56K support, V8 bis protocol 2026-01-03 17:52:43 +01:00
Flyinghead 74cbee908f arm64 rec: proper fix for MINIDUMP-7W0
ModeImmediateHelper can generate code, resulting in the Mov op being
generated twice.
Fixes MINIDUMP-7W0
2026-01-02 11:51:23 +01:00
flyinghead 1652143f5f New translations flycast.pot (Hungarian)
New translations for {languageName}
2025-12-31 18:25:10 +01:00
Flyinghead 4886dcb1c2 enable rtt2vram for Jikkyo Powerful Pro Yakyu
Issue #2182
2025-12-29 20:20:15 +01:00
flyinghead 75bca2a166 Crowdin Translations: Hungarian and Japanese 2025-12-28 17:51:30 +01:00
Flyinghead 13df86c520 modem: V42bis compression support
[ci skip]
2025-12-28 17:51:01 +01:00
Rikki Gibson 16fc172ffc DreamConn: fix compat issue involving slot 2 VMU support (#2172)
* Do not create a shared_ptr from destructor
* Fall back when MDC_DeviceRequest message does not have an expected response
* Assume the device type for physical DreamConn controllers
* DreamConn controllers do not support physical VMU memory
* Do not maple_ReconnectDevices for DreamConn controller
2025-12-27 19:40:13 +01:00
Flyinghead dfb2ae8987 android: touch mouse may be null so check before delivering events
Fixes MINIDUMP-6S6
[ci skip]
2025-12-27 19:36:51 +01:00
Flyinghead 4529a31372 don't save state when game filename is empty
Happens on android apparently due to issues with automatic savestate and
app pausing.
2025-12-27 19:35:30 +01:00
Flyinghead 5a29ac489f sdl: fix DreamPicoPort crash
io_context_thread can be null in the destructor.
Fixes MINIDUMP-83F
2025-12-27 19:31:32 +01:00
github-actions[bot] c4c3c2ae93 Fetch translations & Recreate libretro_core_options_intl.h 2025-12-26 22:21:56 +00:00
flyinghead 8a228e4e16 Crowdin Translations: Swedish 2025-12-24 17:25:38 +01:00
Flyinghead 0a3c68f7cc i18n: delete bogus zh_CH.po. Load correct one
[ci skip]
2025-12-24 17:25:01 +01:00
flyinghead 4905dc21c8 Crowdin Translations: Japanese 2025-12-23 15:30:29 +01:00
Flyinghead 98dfb4c32a modem: implement V14 sync-async mode and V42 protocol
Use modem sync mode when ASYN is reset.
Implement V14 sync-async mode for V42 detection. Also used by Power
Smash and Pro Yakyu Team de Asobou Net!
Switch to V42 protocol for most games.
Set correct modem speed and timing as set by the game.
Get rid of modem speed/automode cheats.
[ci skip]
2025-12-23 15:29:42 +01:00
Flyinghead df2bdfc9bf ui: support for Asian fonts on linux
Fix width of "Filter" field in the game list.
crowdin.yml: fix typo for zh_CN resource files.
2025-12-23 12:00:53 +01:00
flyinghead e86c1c992f Crowdin Translations: Japanese
courtesy of @kihato
2025-12-22 21:23:57 +01:00
Flyinghead 5b6cc33a75 i18n: add Japanese translation
[ci skip]
2025-12-22 21:22:27 +01:00
flyinghead e37518524f Crowdin Translations: Hungarian and Portuguese, Brazilian 2025-12-21 15:04:05 +01:00
Flyinghead 994f72f954 ci: upload symbols to sentry on push only
[ci skip]
2025-12-21 15:03:09 +01:00
Flyinghead 5978b3a058 ui: merge Asian glyphs into large font too
Issue #2169
2025-12-21 15:00:28 +01:00
flyinghead bb12d5c72d Crowdin Translations (#2162) Hungarian
courtesy of oldman63
2025-12-18 15:56:18 +01:00
Flyinghead b127c96cf3 i18n: Add hu.po to resources
[ci skip]
2025-12-18 15:54:19 +01:00
scribam 0d3beb1c6d fix misleading indentation warning 2025-12-17 14:00:11 +01:00
Flyinghead 9bd3179745 i18n: set all stringstreams to classic locale
Fixes dumped texture names being formatted with the thousands separator
of the current locale.
[ci skip]
2025-12-17 13:59:25 +01:00
Flyinghead 5833fb3a47 ui: use imgui touch support and get rid of delay touch hack 2025-12-16 17:20:45 +01:00
Flyinghead 49ec396e24 i18n: delete empty message files. add zh_HK.po 2025-12-16 17:20:45 +01:00
Stefan Schlosser 5607b8eebd libretro: freebsd build fix 2025-12-16 17:18:52 +01:00
scribam 35888406d3 ci: libretro android build fixes (#2156)
Followup to #2151
[ci skip]
2025-12-16 17:18:32 +01:00
scribam 6b3bbd6f85 ci: update actions (#2155)
* ci: update actions
* ci: use freebsd 15 and openbsd 7.8
[ci skip]
2025-12-16 17:18:07 +01:00
James Smith ef689fd35d Minor bug fixes for DreamPicoPort 2025-12-15 18:05:32 +01:00
scribam 6a78f27bef ci: libretro android build fixes (#2151)
[ci skip]
2025-12-15 18:05:11 +01:00
scribam 97de155fd8 ci: enable libretro on bsd systems (#2150)
[ci skip]
2025-12-15 18:01:47 +01:00
scribam f183f30262 dragonflybsd: build fixes (#2149)
[ci skip]
2025-12-15 18:01:08 +01:00
flyinghead 065c91f9ad Crowdin Translations (#2148)
[ci skip]
2025-12-15 18:00:22 +01:00
Edward Li f65907a256 Remove custom_texture.terminate() during TexCache.Clear() 2025-12-15 12:27:57 +01:00
scribam 161d057d4c haiku: build fixes 2025-12-14 14:47:24 +01:00
scribam a7ee2e9a66 libretro: netbsd/openbsd build fixes 2025-12-14 14:46:52 +01:00
flyinghead e08ec86962 Crowdin Translations (#2143)
[ci skip]
2025-12-14 14:46:29 +01:00
Flyinghead 7653b1c811 sh4: don't crash when FIPR is executed with PR=1
[ci skip]
2025-12-14 14:45:53 +01:00
Flyinghead 1475812a94 i18n: localize input devices names, buttons and axes 2025-12-14 14:35:09 +01:00
flyinghead c8a724ad63 Crowdin Translations (#2142)
French, Swedish
2025-12-13 17:25:16 +01:00
Flyinghead 2cfce747c5 ui: better egl init test. display message box on graphics init error
Fail if eglGetDisplay() is null.
Throw exception on initRenderApi/switchRenderApi failure.
Catch in SDL and Android and show error message.
Localize Android java code.

Fixes MINIDUMP-7SD MINIDUMP-2XH MINIDUMP-5KM MINIDUMP-2FF MINIDUMP-4ZP
MINIDUMP-6T1 MINIDUMP-5D3 MINIDUMP-7ME
[ci skip]
2025-12-13 17:23:55 +01:00
github-actions[bot] 37a9077304 Fetch translations & Recreate libretro_core_options_intl.h 2025-12-12 22:21:51 +00:00
Flyinghead f8bdf6c35e crowdin.yml: fix pt_BR typo
[ci skip]
2025-12-12 21:51:46 +01:00
Flyinghead f4c2d001bd crowdin.yml: add android resource
[ci skip]
2025-12-12 20:04:07 +01:00
Flyinghead f3ddec5f1e android: add localizable strings resource
[ci skip]
2025-12-12 19:53:04 +01:00
scribam 13c7ddc6c9 deps: remove core/deps/libusb-cmake 2025-12-12 19:39:50 +01:00
nexus382 c24d7fb0fe Send game id to vmu pro/vm2 (#2126)
[ci skip]
2025-12-12 19:39:28 +01:00
Flyinghead 3ebc79a5ce Merge remote-tracking branch 'origin/master' into dev [ci skip] 2025-12-12 19:32:09 +01:00
Flyinghead 27a913fc02 arm recs: ensure block linking size doesn't depend on mmu mode
Due to d0ec876936 the mmu enabled path may
be taken when the emu is pausing, so make sure block linking uses the
same number of ops in both branches.
Fixes MINIDUMP-82C MINIDUMP-7T2 MINIDUMP-7W0
2025-12-12 16:49:50 +01:00
Flyinghead 97442c0411 terminate game id at first null character
Fixes MINIDUMP-7YW MINIDUMP-800
2025-12-12 16:13:44 +01:00
Flyinghead 5b12f9ca68 boxart: catch-all handler for scraper thread
Fixes MINIDUMP-7YW
2025-12-12 16:07:22 +01:00
Flyinghead 6a298289a9 ice: guard against null icePipe
Fixes MINIDUMP-7ZF
2025-12-12 16:03:44 +01:00
Flyinghead 59ef8579d2 ui: disable imgui debug tools
Fixes MINIDUMP-7RF
2025-12-12 16:01:52 +01:00
Flyinghead 6989a0aa2c test: fneg on odd register in PR=1 mode
Issue #2139
2025-12-11 16:26:37 +01:00
Flyinghead bd24812d0c jvs: return value from RawDma is incorrect for MIE firmware upload
It didn't seem to bother anyone however
2025-12-11 16:25:03 +01:00
Flyinghead 15889616dd add zh_CH and zh_TW messages. delete outdated docs
Issue #1830
2025-12-11 15:15:43 +01:00
Flyinghead e60efed8b5 pvr: limit framebuffer height to 240 when interlacing is disabled
Fixes Confidential Mission PAL Echelon intro
Issue #2062
2025-12-11 15:11:24 +01:00
Flyinghead 11fcadf37e sh4: fneg doesn't depend on FPSCR.PR at all
When PR=1, fneg can also be used on odd registers.
Issue #2139
2025-12-11 15:03:16 +01:00
Flyinghead 88b8a0b51e crowdin.yml: add zh_HK mapping [ci skip] 2025-12-10 17:15:24 +01:00
flyinghead 8e9a0f9c1f Crowdin Translations (#2136) pt_BR
New translations flycast.pot (Portuguese, Brazilian)
2025-12-10 11:42:58 +01:00
Flyinghead dd50fcf81c i18n: include pt_BR.po [ci skip] 2025-12-10 11:41:30 +01:00
Flyinghead 7b8656b944 imgread: more checks when loading GDI and CUE files (fail fast)
Add missing CMakeLists.txt change for new cue and gdi tests
2025-12-10 11:40:41 +01:00
Flyinghead 00ae6c42a2 fix some include paths 2025-12-09 19:41:48 +01:00
Flyinghead 8c4c463c38 add cue and gdi parsing tests. add non-C locale tests
delete old en resource file
libretro doesn't need cfg/ini.cpp/h anymore
2025-12-09 17:31:31 +01:00
Flyinghead 14f759eeb7 ice: fix crash when loading a state without being connected 2025-12-09 14:36:53 +01:00
flyinghead 329b6a1e34 Crowdin Translations (#2134)
New translations: sv, pt, pt_BR
2025-12-09 09:23:08 +01:00
Flyinghead 9c28800384 i18n: std::from/to_chars missing on BSD and macOS
Use stringstream instead

[ci skip]
2025-12-09 09:21:54 +01:00
Flyinghead 602982fb56 add pt_BR crowdin mapping [ci skip] 2025-12-08 23:38:12 +01:00
flyinghead cb830e0bd3 Update Crowdin configuration file 2025-12-08 23:35:08 +01:00
Flyinghead ec3d85a96c remove [ci skip] in crowdin commit messages 2025-12-08 23:26:58 +01:00
Flyinghead d3bc72b0d0 ci: ignore push on l10n_* branches 2025-12-08 22:28:30 +01:00
Flyinghead 4170e783b9 fix GDI and CUE parsing error in non-English locale
IniFile: use locale-independant float conversions functions
Use std::ostringstream and std::istringstream as appropriate.
Use C locale for GDI and CUE parsing.
2025-12-08 22:26:33 +01:00
flyinghead 083ccb984a Crowdin Translations (#2133)
* New translations flycast.pot (French)
New translations for {languageName} [ci skip]
* New translations flycast.pot (Swedish)
New translations for {languageName} [ci skip]
2025-12-08 21:19:31 +01:00
Flyinghead 0220207545 strprintf utility. localize exception messages. add sv.po (Swedish) 2025-12-08 16:22:26 +01:00
flyinghead aee4cd34fc Crowdin Translations (#2132)
* New translations flycast.pot (French)
New translations for {languageName} [ci skip]
* New translations flycast.pot (Swedish)
New translations for {languageName} [ci skip]
* New translations flycast.pot (English, United Kingdom)
New translations for {languageName} [ci skip]
2025-12-08 16:15:17 +01:00
flyinghead a99cce27bb Crowdin Translations (#2131)
* New translations flycast.pot (French)
New translations for {languageName} [ci skip]
2025-12-08 14:11:01 +01:00
Flyinghead b2941a8593 ui: more l10n. add plural and context support. no l10n for debug stuff 2025-12-08 11:50:51 +01:00
flyinghead 3ad072f9aa New translations flycast.pot (French)
New translations for {languageName} [ci skip]
2025-12-08 09:37:39 +01:00
flyinghead 14374084d5 New translations flycast.pot (French)
New translations for {languageName} [ci skip]
2025-12-07 23:18:42 +01:00
Flyinghead 5c7a241897 uwp build fix 2025-12-07 21:39:13 +01:00
Flyinghead 7fcc5fa2f7 ui: update .pot and .po 2025-12-07 20:37:35 +01:00
Flyinghead cf2fe027f7 ci: bsd,switch,uwp build fixes. Better workflow names 2025-12-07 20:33:57 +01:00
Flyinghead b13685f0bb ui: switch to tinygettext for i18n 2025-12-07 19:57:03 +01:00
Flyinghead cf7b6bdcb0 ui: more localization 2025-12-06 17:11:48 +01:00
github-actions[bot] 230d971d4d Fetch translations & Recreate libretro_core_options_intl.h 2025-12-05 22:22:07 +00:00
Flyinghead 894c61ed64 libretro build fix 2025-12-04 21:41:36 +01:00
Flyinghead 82cadfde22 win: use GetLocaleInfoEx and localtime. android: build fix 2025-12-04 21:29:20 +01:00
Flyinghead 1586cbaea9 android: use system getifaddrs if available (api 24+) 2025-12-04 18:21:17 +01:00
Flyinghead 2113e4e249 localization support WIP. rewrite ini file reader/writer and more.
Support for localized dates, collation and messages.
Rewrite ini file reader/writer and command line parser.
Standardize all config stuff in the config namespace.
2025-12-04 18:17:13 +01:00
Flyinghead 5a150f4121 Merge remote-tracking branch 'origin/dev' 2025-12-03 19:23:43 +01:00
vkedwardli f178e5d76e Custom texture preloading (#2116)
* Creating a `CustomTextureSource` interface for subclassing
* `DumpReplacedTextures` option
* `PreloadCustomTextures` option
2025-12-02 17:02:19 +01:00
James 9222fa8442 Fix: DreamPicoPort locks up and causes flycast to hang (#2124)
* Use DreamPicoPort-API 1.0.2 which automatically clears USB stalls
* Getting condition in order to detect controller seems to be problematic
* Use the libusb implementation of DreamPicoPort-API on Windows because WinRT is buggy
2025-12-01 16:50:02 +01:00
Flyinghead 77359cefb2 ui: add char filter for dns names and IP addresses text input 2025-12-01 16:49:13 +01:00
Flyinghead a6dc38a35b switch: use sync keyboard applet for keyboard input 2025-11-30 18:23:15 +01:00
Flyinghead eab952fcbe ui: UWP keyboard fix. Fix DPad nav & scrolling with child windows
Detect UWP on-screen keyboard hiding and validate imgui text edit (code
by @danprice142).
Don't use list boxes for paths in Settings > General since child windows
cause issues with DPad/cursor keys navigation and thumbstick scrolling.
2025-11-29 18:06:21 +01:00
Flyinghead 1666eb0875 android: ignore touchpad axes (dualshock 4)
The touchpad also reports motion events on the same axis numbers, but
the range source is different so ignore them.
Override known axes in mapping when the gamepad is connected.
Issue #2109
2025-11-22 11:34:36 +01:00
Flyinghead 5bce763f66 Merge remote-tracking branch 'origin/dev' 2025-11-21 12:49:47 +01:00
Flyinghead 0f4fca415b ui: set VMUPath and SavePath options a single path instead of a list
Fix naming of arcade flash save files when using a custom path.
Get rid of legacy net:nvmem option.
Issue #2111
2025-11-20 16:43:27 +01:00
Flyinghead f2fe918379 android: Virtual Gamepad and Touch Mouse duplicated after app pause
These devices were recreated every time the app is unpaused.
2025-11-20 09:43:53 +01:00
Flyinghead a9be4d111c Use nowide::remove instead of unlink or std::remove 2025-11-20 09:37:04 +01:00
danprice142 ce07a7fbf5 Add user-defined paths for boxart, mappings & cheats (#2108)
* Add user-configurable paths for boxart, mappings, and cheats

Introduces new configuration options for Boxart path, Mappings path, and Cheat path, allowing users to specify custom folders for box art, controller mappings, and cheat files.
2025-11-19 15:30:30 +01:00
Flyinghead e44c03fa0e ui: reset button state when closing mapping popup and on map/unmap
Fixes button state staying on until app restart.
2025-11-19 15:29:15 +01:00
Flyinghead 1dac3695fd imgui: ImguiStyleVar must be deleted before the end of the window 2025-11-18 18:58:44 +01:00
Flyinghead 997f6179dd android: normalize axis value using min and range. Use event.actionIndex
Normalize analog axis values using InputDevice.MotionRange.min and
InputDevice.MotionRange.range.
Specify Event.actionIndex when getting axis values like SDL does.
Issue #2109
2025-11-18 18:57:02 +01:00
Flyinghead bed524f0d0 imgui: ImguiStyleVar must be deleted before the end of the window 2025-11-17 19:18:55 +01:00
Flyinghead 410b37b041 naomi: add dc microphone to king of route 66. Add cd-mic switch binding
King of route 66 uses a maple microphone for the CB-MIC feature.
Also define the mic switch button binding (button 6).
Don't add VMUs to naomi2 games since no game uses them afaik
2025-11-17 19:13:45 +01:00
Flyinghead ead4b51d6f fix savestate regression due to custom path
Issue #2111
2025-11-16 11:45:23 +01:00
Flyinghead 043bb5ee99 Merge remote-tracking branch 'origin/master' into dev 2025-11-16 11:41:40 +01:00
Flyinghead 4747e61908 vgamepad: enable touch mouse for mouse/rotary encoders arcade games
Issue #2110
2025-11-15 15:49:26 +01:00
github-actions[bot] 548cf6fe2e Fetch translations & Recreate libretro_core_options_intl.h 2025-11-14 22:21:15 +00:00
Edward Li 339d288dfb macOS: update Syphon library 2025-11-14 17:13:35 +01:00
Flyinghead 8f7e4bf2d3 aica: fix ALFO and PLFO random waveform
Fixes skating sound in Jet Set Radio
Issue #2107
2025-11-14 17:12:58 +01:00
Flyinghead 922ca3e54b cue: read pregap length from cue file and adjust track start
Use the INDEX 01 mm:ss:ff tag to determine the pregap size and add it to
the track start FAD.
Remove previous +02:00 hack for audio tracks.
Fixes Sonic Team jingle cut off in ChuChu Rocket redump cue.
Issue #2103
2025-11-14 11:12:44 +01:00
Flyinghead 4b09de2fc1 vulkan: recreate swap chain when the vulkan context becomes invalid
Fixes freeze when switching to fullscreen on gentoo.
Issue #2082
2025-11-14 10:57:14 +01:00
Flyinghead 98db7a6cd5 android: vgamepad LT and RT not set to minimum when released
LT and RT were left to 50% depressed when released.
Regression due to 7b0c106fc2
Issue #2104
2025-11-13 10:06:16 +01:00
Flyinghead 3405b5b2a6 aica: use member functions for ChannelEx instead of static ones
More enums
No functional changes
2025-11-12 20:50:31 +01:00
Flyinghead 4320685ff8 uwp: simplify activation and exit URIs handling
Use http::urlDecode to decode URIs.
Move exit URI handling to dc_exit() so that all exit paths are covered.
2025-11-12 13:40:07 +01:00
Flyinghead cd3fe7393c http: add urlDecode and tests for urlEncode and urlDecode 2025-11-11 20:43:13 +01:00
Flyinghead 2da0d392fd move oslib/directory.h function defs into a .cpp file 2025-11-11 19:24:12 +01:00
Flyinghead 8d1bf3382c android: add customisable bios and texture pack folders 2025-11-11 19:15:59 +01:00
Bobby Smith b1489d665e [Libretro] Update AV info when switching a PAL game to 60Hz 2025-11-10 14:16:02 +01:00
Flyinghead fc56bd283e fix double-nested game folder when dumping textures
Change TextureDumpPath to a single path instead of a list
Issue #305
2025-11-10 14:11:14 +01:00
Flyinghead 807e4a20ed aica: yet another LPF improvement
Use more bits for coefficients and formula closer to original hardware.
2025-11-10 13:52:21 +01:00
Flyinghead 943311752e cheats: increase max code length and input text height 2025-11-10 11:50:40 +01:00
Flyinghead e7ad12b031 rend: convert palette textures for area 1 on cpu
Only one palette is supported in the shader, so convert area 1 palette
textures (2-volume mode) on the cpu and handle them normally in the
shader.
Issue #1528
2025-11-09 15:44:48 +01:00
danprice142 b2bc6251c7 Add configurable paths for BIOS, VMU, saves, textures & dumps (#2097)
* Add configurable paths for BIOS, VMU, saves, textures & dumps

Introduces new options for user-defined folders for BIOS, VMU, savestates, game saves, texture packs, and texture dumps. Updates path resolution logic in oslib.cpp to prioritize user-specified paths before falling back to defaults.

* Add UWP support for directory and file access

Introduces UWP-specific implementations for directory handling and file access in core/oslib, including custom opendir, readdir, and closedir functions, this is so we can see subfolders properly on UWP

* Custom Paths section hidden on Android and iOS
2025-11-08 15:06:47 +01:00
Flyinghead 6f38dc3210 msvc build fix 2025-10-28 12:23:22 +01:00
danprice142 4bb32466bd Add UWP protocol activation support for ROM loading from UWP Frontends (#2095)
Adds UWP protocol activation support for ROM loading from UWP Frontends/Browsers, allows launching ROMs via SDL's `SDL_WinRTGetProtocolActivationURI()` and redirection using the 'launchOnExit' URI parameter from protocol activation in SDL_WinRTApp, Closing a Rom/Game from the quick menu or closing the app will make use of `launchOnExit` and redirect to the specified app

Implements launching a URI via Windows.System.Launcher after the game is stopped from the Exit button in the quick menu, enabling return to sender/redirection on UWP

Update SDL submodule to include SDL_WinRTGetProtocolActivationURI()
2025-10-28 11:37:16 +01:00
Rikki Gibson e26d356265 DreamConn: allow using a VMU in slot 2 (#2094) 2025-10-28 11:34:31 +01:00
Flyinghead 265c5c6c3d aica: fix EG rate and LSA > LEA behaviour from real hw tests
EG rate formula specified in the doc is correct but FRS+OCT is ignored
if negative.
If LSA > LEA, playback continues after LEA until reaching LSA. Then CA
is reset and playback stops (including looping sounds). Get rid of
Legacy of Kain hack.
2025-10-27 17:26:42 +01:00
Flyinghead 2b1eb55daa maple: flush VMU files when unloading a game
destroy maple devices when unloading a game to flush and close VMU
files.
2025-10-24 15:31:22 +02:00
Flyinghead bd136b1856 ice: vonot support
ice::term() ice on emu termination
2025-10-24 15:29:12 +02:00
Flyinghead bd8adf1da1 delete outdated dreampi dcnet binary 2025-10-22 15:35:51 +02:00
Flyinghead 11625176c2 ggpo: catch serialization exception when saving state 2025-10-22 15:33:10 +02:00
Flyinghead c64441a02f pvr: avoid pure blue video border color. change to black
Hides blue vertical bars in dinosaur king.
Issue #1246
2025-10-22 15:29:35 +02:00
Flyinghead 8e9eee246d Merge remote-tracking branch 'origin/master' into dev 2025-10-21 15:26:52 +02:00
Flyinghead d0ec876936 arm32/64 dynarec: fix crash when disabling mmu
With block linking, CpuRunning isn't tested immediately so add a special
case in DynaRBI::Relink()
Issue #893
Fixes MINIDUMP-56 MINIDUMP-6V MINIDUMP-6X MINIDUMP-CA
Fixes MINIDUMP-H8 MINIDUMP-K6 MINIDUMP-QN MINIDUMP-YZ
Fixes MINIDUMP-YM MINIDUMP-148
2025-10-21 15:24:31 +02:00
Flyinghead b19cbcbf29 android: clean up openmp stuff 2025-10-21 15:18:48 +02:00
John Lansing bf2bd7efed Move duplicate Exception class to SerializeBase 2025-10-21 12:48:39 +02:00
John Lansing d15d5be44a libretro: detect and communicate buffer overflow on save state serialization 2025-10-21 12:48:39 +02:00
Flyinghead 70c8d1d22b vk: handle acquireNextImageKHR error when resizing window
Ignoring the error leads to a deadlock since the imageAcquired semaphore
can't be signaled.
Fixes freeze when resizing window.
Issue #1620
2025-10-21 12:47:46 +02:00
JamesandRikki Gibson 3917c0181b DreamPicoPort API Update (#2079)
Co-authored-by: Rikki Gibson <[email protected]>
2025-10-20 10:48:23 +02:00
Flyinghead 6f58d204b6 arm, arm64 dynarecs: check FPU enabled after PC and block checks
Fixes hang/crash in Sega Rally 2 when exiting the Records menu.
Issue #1877
2025-10-20 10:46:30 +02:00
Flyinghead d450c84a14 rend: disable texture upscaling on mobile. hide option on desktop 2025-10-20 10:31:35 +02:00
Flyinghead 3b7036d14a android: fix init crash on 32-bit platforms 2025-10-19 15:45:40 +02:00
Flyinghead 5d628f8167 naomi: default eeprom for clubkprz. default nvmem for smarinef
Use clubk2k3 eeprom for clubk2kp and clubk2kpa.
Issue #2086
2025-10-18 18:09:29 +02:00
github-actions[bot] d1ed878446 Fetch translations & Recreate libretro_core_options_intl.h 2025-10-17 22:20:56 +00:00
Flyinghead 28ea3dc69c arcade: add CRC for all working roms. Fix mushik2k bios
All roms can now be loaded by CRC value.
Issue #1952
Fix mushik2k to use the multi-region hacked bios set to Korean region
2025-10-16 18:11:16 +02:00
Flyinghead 031a645ffc move HideCdromDrives check into ui/game_scanner 2025-10-16 18:07:09 +02:00
Flyinghead 0a526d7c94 gdb: fix race condition when stepping. Improve vCont handling
Work around race condition when stepping (CpuRunning still true in
Sh4Executor::Step() on emu thread since Step() hasn't be called yet in
main thread).
Don't advertise vCont commands that aren't supported.
Range stepping end is exclusive.
2025-10-16 17:56:39 +02:00
Flyinghead 3d594054eb libretro build fix 2025-10-15 20:30:23 +02:00
Flyinghead 3b651463dc New [config]HideCdromDrives setting to ignore physical CD/DVD drives 2025-10-15 20:00:30 +02:00
Flyinghead 4e6b5b270b vk: remove image barrier at end of oit pipeline
It seems to cause issues on snapdragon 8 elite (SM8750-AB). These GPUs
never cease to amaze me....
Partial revert of b4b4b3ab1e
Issue #2083
2025-10-15 19:58:41 +02:00
Flyinghead fd8f2e24b8 android: switch to sdk 35, min 21, ndk 29
Drop support for Android 4.* (kitkat, jelly bean)
Minimum SDK 21 (Android 5.0, lollipop)
Target SDK 35 (Android 15)
Build with NDK 29 for 16KB-page by default. Issue #1864
2025-10-14 16:47:50 +02:00
Flyinghead 82b4c55f09 fix gdb server networking
Issue #2081
2025-10-14 14:43:47 +02:00
Flyinghead 8176646c5a android: don't set section name for dynarec code cache
Use #define to declare platform-specific dynarec code buffers
Don't set section name on android to avoid error "W+E load segments are
not allowed"
2025-10-13 19:19:48 +02:00
Flyinghead 3f0dd626c1 android: update oboe to 1.10.0 2025-10-13 19:11:12 +02:00
Flyinghead 8edd8fc447 Merge remote-tracking branch 'origin/dev' 2025-10-13 16:58:06 +02:00
Flyinghead 0c7dca9cb7 sdl: move mapping parser into its own class. Add tests 2025-10-13 16:20:34 +02:00
Flyinghead 086e8bc20c android: exclude libz.so from apk 2025-10-13 16:06:47 +02:00
Flyinghead 11880bca30 atomiswave: fix lightgun games button labels
Issue #2080
2025-10-13 10:25:30 +02:00
scribam 37187467e7 cmake: lower minimum requirement 2025-10-12 11:55:35 +02:00
Flyinghead 7b0c106fc2 input: axes handling improvements
Range for all axes, including triggers, is now [-32768,32767]
Detect trigger direction when mapping and store in mapping file.
sdl: parse controller bindings string to correctly map axes.
Issue #2014
2025-10-12 11:54:16 +02:00
github-actions[bot] fd654614ae Fetch translations & Recreate libretro_core_options_intl.h 2025-10-10 22:20:45 +00:00
Flyinghead 4ee24ca612 vk: test automation fix 2025-10-10 09:01:31 +02:00
scribam 4b3704953f ci: use freebsd 14.3 2025-10-09 19:24:16 +02:00
Flyinghead 6ea9a34e8a macOS CI: update vulkan sdk version 2025-10-08 17:09:05 +02:00
Flyinghead c018d46d00 atomiswave: reset maple devices register during reset
Reset aw_maple_devs to 0 during reset.
Fixes analog controls not working after playing a mouse/trackball or
lightgun game.
Issue #2072
2025-10-06 19:39:31 +02:00
Flyinghead 400da2bdfe vk: add yet another image barrier for libretro (nvidia 30xx issue)
Also add image barrier in endFrame for libretro
Issue #1631
2025-10-06 15:42:52 +02:00
Flyinghead 3b5536dd43 new system sp games: btlracer, monomedal 2025-10-06 15:39:20 +02:00
Flyinghead 34e2f426ac build fix 2025-10-05 15:53:24 +02:00
Flyinghead a246964a99 fix some warnings 2025-10-05 15:35:52 +02:00
Flyinghead b4b4b3ab1e vk: add image barrier to work around nvidia 30xx issue
Add image barrier in VulkanContext::PresentFrame() for nvidia gpus.
Tentative fix for square glitches on nvidia 30xx series.
Issue #1631
oit: Add dependency from external to subpass 2 since vulkan's implicit
one is too relaxed.
2025-10-05 15:34:18 +02:00
github-actions[bot] af5f67c15d Fetch translations & Recreate libretro_core_options_intl.h 2025-10-03 22:21:01 +00:00
Rikki GibsonandJames 909ea496ac DreamPotato connectivity (#1989)
Co-authored-by: James <[email protected]>
2025-10-03 14:34:25 +02:00
Flyinghead 3347dc1a46 custom textures: reset available flag when initializing
Fixes crash when starting a new game without custom texture after one
that has some.
Fixes MINIDUMP-6C9
2025-10-03 14:28:31 +02:00
Flyinghead dd5e148e2b input: don't handle button input when port is set to none
Fixes physical keyboard usage on android, where the keyboard is also
handled as a gamepad and must be disabled.
2025-10-03 14:12:23 +02:00
Flyinghead 1f818ca750 naomi: fix zombrvn and zombrvne default eeproms
zombrvn: Disable free play, do analog calibration
zombrvne: Select 2-player cab
Issue #1980
2025-10-03 11:10:44 +02:00
Flyinghead ab6b95ff4d naomi: spawn needs the region number in its eeprom
The current region must be set in the eeprom, otherwise the eeprom is
reset to default and network settings are ignored.
Issue #696
2025-09-27 17:28:20 +02:00
github-actions[bot] 760c62a3da Fetch translations & Recreate libretro_core_options_intl.h 2025-09-26 22:20:52 +00:00
Flyinghead b2d8ad633d boxart: use flycast-content github repo for arcade games screenshots 2025-09-26 15:30:01 +02:00
Flyinghead f9b47b6f91 boxart: use correct file extension for images 2025-09-23 15:55:36 +02:00
Flyinghead 372ef91211 opengl: per-pixel support for GLES
Issue #2034
2025-09-23 15:53:14 +02:00
scribam 3375f6c476 deps: update sdl to version 2.32.10 2025-09-22 09:57:07 +02:00
scribam c5396a041e cmake: add windows setupapi lib 2025-09-22 09:56:56 +02:00
github-actions[bot] 851dd22664 Fetch translations & Recreate libretro_core_options_intl.h 2025-09-19 22:21:19 +00:00
github-actions[bot] ac32a80352 Fetch translations & Recreate libretro_core_options_intl.h 2025-09-12 22:20:41 +00:00
Flyinghead eff11d6a07 Merge remote-tracking branch 'origin/master' into dev 2025-09-12 18:15:23 +02:00
scribam b6c135b0c6 macOS: update libomp to version 21.1.1 2025-09-12 13:44:50 +02:00
scribam 0fe7073496 macOS: remove workaround with local/pinned/cmake from openmp formula 2025-09-12 13:44:50 +02:00
Edward Li d5c5839a92 macOS libomp: Use local/pinned/cmake in homebrew formula, update libomp to 21.1 2025-09-09 14:38:25 +02:00
Clownacy 7ac45a7e46 Remove -DCMAKE_BUILD_TYPE=Release from .gitlab-ci.yml.
There is no longer a need to set this explicitly, as libretro's CI templates have been corrected to not leave it undefined.

See this commit: https://git.libretro.com/libretro-infrastructure/ci-templates/-/commit/0241726e188a7c077dcff6cd7c1739039a79a7fb
2025-09-08 10:39:53 +02:00
github-actions[bot] 0243f81c26 Fetch translations & Recreate libretro_core_options_intl.h 2025-08-29 22:20:49 +00:00
Flyinghead 2dfa647445 naomi: cab linking support for sgtetris 2025-08-29 09:12:55 +02:00
Flyinghead 9c5408a6d3 macOS build fix
Work around brew change: https://github.com/Homebrew/brew/pull/20414
2025-08-20 14:55:37 +02:00
Eric Warmenhoven d3dcb13ef9 Update .gitlab-ci.yml 2025-08-18 14:40:14 +02:00
Flyinghead 2cb2ac23e0 force real bios for wsb2k2
Issue #1757
2025-08-18 14:39:39 +02:00
Flyinghead e38b0ac01f naomi: delete some unnecessary eeproms
Issue #2023
Fix some warnings
2025-08-14 14:30:20 +02:00
Flyinghead 09b27ddd5c maple: use PantherDC id for full controller. ui: buttons and axes state
Use actual Panther DC identifier for full controller. Fixes KISS: Psycho
Circus.
Issue #2026
Show current state of mapped gamepad buttons and axes in controller
mapping.
2025-08-13 18:26:26 +02:00
Flyinghead 33833cfd1e vonot: don't disable VM when acting as master
Issue #2037
2025-08-12 17:30:22 +02:00
Edward Li 3c5c1e0b66 Indentation should use <space> in imgui_impl_vulkan.cpp 2025-08-12 15:40:14 +02:00
Edward Li 3f446a5835 Use target_compile_definitions to disable imgui shell functions for Switch 2025-08-12 15:40:14 +02:00
Edward Li df3c676a04 chmod 644 2025-08-12 15:40:14 +02:00
Edward Li 9ff3ab618c Fix OpenGL3 and Vulkan backend 2025-08-12 15:40:14 +02:00
Edward Li ba33b8c3f7 IMGUI_DISABLE_DEFAULT_SHELL_FUNCTIONS for Switch 2025-08-12 15:40:14 +02:00
Edward Li eab13e85bc minor fixes 2025-08-12 15:40:14 +02:00
Edward Li a1f1c9825a Fix EllipsisCharCount
Fonts: Rasterizing ellipsis character from dot as one glyph + avoid preloading if it not needed. https://github.com/ocornut/imgui/commit/4ff1631b316fe849da9a649cf30a79aad752d8bb
2025-08-12 15:40:14 +02:00
Edward Li 43a9c1384a Replace ImFont->FontSize with ImFont->LegacySize 2025-08-12 15:40:14 +02:00
Edward Li b4ab21a768 Reapply ImGuiWindowFlags_DragScrolling 2025-08-12 15:40:14 +02:00
Edward Li 30365d13ef replace with upstream v1.92.1 files 2025-08-12 15:40:14 +02:00
scribam f7eae0ff9e deps: update glslang (#1920) 2025-08-11 17:23:33 +02:00
sonninnos e26f170558 Libretro updates (#2033)
Add -Wno-misleading-indentation
Libretro av_info fps timing correction
Stop forcing audio muting on libretro fast-forward
Allow less strict chd extensions
2025-08-11 09:38:59 +02:00
github-actions[bot] 40e400ab08 Fetch translations & Recreate libretro_core_options_intl.h 2025-08-01 22:21:35 +00:00
github-actions[bot] 5743502cdd Fetch translations & Recreate libretro_core_options_intl.h 2025-07-25 22:21:43 +00:00
Flyinghead 8f33b63153 linux build: fix AppImageTool location 2025-07-22 15:37:54 +02:00
Flyinghead 6fca05f00e sdl: set default axis direction for all axes
Fixes regression with known gamepads.
Only use initial state for unknown controllers.
Issue #2014
2025-07-22 15:24:05 +02:00
Flyinghead 8c07a2e1d6 sdl: detect half-axes using initial state. Fix axis range and direction
Assume that full axes are roughly centered at start up and determine
which axis are half ones, and the axis direction.
Fixes driving wheel pedals range to the expected [0, 32767].
Issue #2014
2025-07-18 11:38:15 +02:00
desyn ffbe266413 bump minimal rcheevos 2025-07-15 15:52:07 +02:00
Flyinghead 5d3b7fae6b libretro: boot dreamcast bios when loading core without content
Get rid of "Boot to BIOS" core setting.
Issue #2007
2025-07-15 15:49:32 +02:00
Flyinghead 738b95d2be miniupnpc: include cstddef before miniupnpc headers
Issue #2010
2025-07-15 15:30:15 +02:00
github-actions[bot] 48c58dbd18 Fetch translations & Recreate libretro_core_options_intl.h 2025-07-11 22:21:51 +00:00
James 54b06a5c34 Recover DreamLink hardware after load state (#2003) 2025-07-10 20:32:00 +02:00
Flyinghead d3a46a1e33 windows: fix crash caused by regression
introduced by 6ea61b9
Issue #2001
2025-07-08 12:36:52 +02:00
Rikki Gibson 4fe2f4760f DreamConn: do not lock mutex multiple times 2025-07-07 11:28:27 +02:00
Flyinghead c0809d771d dcnet: support for Pro Yakyuu Team de Asobou Net!
Delete fakeTCP power smash cheat (not needed)
Add pro yakyuu team cheats
dcnet: Use same port as power smash for pro yakyuu team
2025-07-07 11:26:08 +02:00
Flyinghead 54ed92e2b0 fix ggpo regression
introduced by 4baf529ff7
2025-07-06 22:18:58 +02:00
Flyinghead 6ea61b9084 android: support 4KB and 16KB page sizes on 64-bit platforms 2025-07-06 22:16:06 +02:00
Flyinghead f3e0f09ca9 upgrade oboe and libadrenotools to latest 2025-07-06 18:51:51 +02:00
scribam 301b1a0f00 input: set InputMapping::INVALID_CODE as constexpr 2025-07-06 18:09:23 +02:00
scribam b787427446 android: update gradle and agp 2025-07-06 18:08:54 +02:00
Flyinghead 5df5c70994 dcnet: Power Smash support 2025-07-03 17:18:46 +02:00
Shockblast 75defb590b fix: added missing addrspace inclusion in settings.cpp for GDB_SERVER 2025-07-01 19:29:16 +02:00
scribam fbeaf8ba16 ci: fix switch libretro artifact location 2025-06-30 21:34:41 +02:00
github-actions[bot] 3f79b6baed Fetch translations & Recreate libretro_core_options_intl.h 2025-06-27 22:21:54 +00:00
Flyinghead 34f095a91e mingw build fix 2025-06-24 17:19:12 +02:00
Flyinghead 09247b4503 picotcp: use random local UDP port if already in use
Bind to random local UDP port if requested one is in use.
Log to NETWORK instead of MODEM.
Fix get_last_error name conflict with asio.
2025-06-24 16:54:57 +02:00
scribam 109e084e18 deps: update glslang (#1920) 2025-06-24 16:54:29 +02:00
Isaac Marovitz af043c55cd CMake Refactors (#1979)
Signed-off-by: Isaac Marovitz <[email protected]>
2025-06-24 16:33:12 +02:00
Flyinghead 04999d8969 sh4: fix wince api trace calls 2025-06-21 10:25:52 +02:00
Flyinghead 26b8684e78 serial: don't depend on SerialPTY option on windows
On windows, open serial console window when config::SerialConsole is
enabled. Ignore config::SerialPTY.
2025-06-21 10:23:22 +02:00
Flyinghead eefcb0e05d picotcp: improve ppp dump time resolution 2025-06-21 10:17:09 +02:00
github-actions[bot] 449d256995 Fetch translations & Recreate libretro_core_options_intl.h 2025-06-20 22:21:29 +00:00
Flyinghead 0897f0ed8a ui: split settings into their own files 2025-06-19 23:13:47 +02:00
Flyinghead 9bdb90e605 vk: add missing pp_Texture vertex param (naomi 2) 2025-06-19 17:48:20 +02:00
Flyinghead 5b75975237 naomi: fix zombie revenge analog stick for P2
Issue #1980
2025-06-19 17:29:25 +02:00
Flyinghead c73336a86f boxart: don't save absolute paths for images
Issue #1935
2025-06-17 17:13:27 +02:00
Flyinghead 27318443a7 more atomiswave code into its own files 2025-06-16 22:21:10 +02:00
Flyinghead df93c069f2 sdl: add sdl_gamepad.cpp 2025-06-16 18:50:37 +02:00
Flyinghead 7358f29556 naomi: refactor midiffb into its own file 2025-06-16 18:13:36 +02:00
Flyinghead 8801b2ae16 haptic: add sine effect. implement spring for midi FFB
Add sine effect to haptic api and stop using maple rumble for naomi FFB.
Emulate spring in midi FFB. Thanks to njz3 for his help on decoding the
protocol.
Don't use exponential scale for rumble when using haptic sine effect.

serialize Sh4OCache::writeBack/ThroughBufferCycles
2025-06-16 17:50:36 +02:00
github-actions[bot] b10db5a078 Fetch translations & Recreate libretro_core_options_intl.h 2025-06-13 22:21:19 +00:00
xander-will 71341a27e4 Integer Scaling + Screen-Level Linear Interpolation Options (#1976) 2025-06-13 11:59:15 +02:00
Flyinghead 7e7f645f37 sdl: use SDL_HAPTIC_STEERING_AXIS instead of SDL_HAPTIC_CARTESIAN
tentative fix for Issue #1962
2025-06-13 11:58:19 +02:00
oltolm 146e90dae6 Fix MSYS2 build (#1975)
* fix GCC build
* revert c53a1c42c6
it was fixed in https://sourceforge.net/p/mingw-w64/mingw-w64/ci/251fc7e1c3bd3509e291c1862ee745fce8550360
2025-06-13 09:55:41 +02:00
Flyinghead bb5bd71437 Merge remote-tracking branch 'origin/master' into dev 2025-06-07 16:08:03 +02:00
Flyinghead e8217ca0c5 fix input mapping regressions
Emulator keyboard bindings no longer working when UI is open (Exit).
All-ports mapping not being loaded correctly.
All-ports mapping not working on ports B,C and D.
Restore automatic binding of opposite key/axis.
caused by 64b9e51af0
2025-06-07 16:05:34 +02:00
github-actions[bot] 8f033723a1 Fetch translations & Recreate libretro_core_options_intl.h 2025-06-06 22:21:35 +00:00
Flyinghead b097aa3331 dropping iOS support
well done Gabe!
2025-06-06 09:08:14 +02:00
nexus382andJames Smith 64b9e51af0 button mapping multi binds (#1938)
Add button combination mappping support
- Implement tracking of pressed buttons in GamepadDevice
- Add ability to detect button combinations- Fix mapping system to preserve individual button mappings
- Ensure buttons can work both individually and as part of combinations
- Ensured trigger buttons can be the first button in a combination
- Maintained detection state when binding multiple buttons
- Added special handling to recognize both original and normalized trigger codes

---------

Co-authored-by: James Smith <[email protected]>
2025-06-03 16:28:51 +02:00
nexus382andJames Smith 9b91430513 Flycast UI Themes (#1929)
Added a Theme selection system.
---------
Co-authored-by: James Smith <[email protected]>
2025-06-01 19:03:42 +02:00
Flyinghead d9ec0cb3ab map dinoking P2 rock button to P1 button 4. Show on vgamepad
Remap player 2 Rock button to player 1 button 4 and display on vgamepad
so it's accessible on mobile devices.
Issue #1969
2025-06-01 10:57:59 +02:00
Flyinghead 39d68ec7fa sdl: don't reset haptic gain to 0 on exit
Issue #1963
2025-06-01 10:52:29 +02:00
github-actions[bot] a1a782df38 Fetch translations & Recreate libretro_core_options_intl.h 2025-05-30 22:21:39 +00:00
scribam acc106e988 cmake: disable link option --execute-only on openbsd 2025-05-30 18:45:55 +02:00
Flyinghead 11de0eda13 dx9: half-pixel shift left, not right
Fixes shifting of doom64 screen melt effect
Issue #1939
2025-05-30 18:45:18 +02:00
scribam a7148ad7ae cmake: use c++ extensions for alloca on netbsd/arm64 2025-05-26 19:27:55 +02:00
Flyinghead 27f19a5b54 rend: fix dithering kernel
Use the actual PVR2 dithering kernel (standard 4x4 Bayer matrix) used on
real hardware.
Fixes the screen melt effect of Doom64 (per-pixel only).
Issue #1939
2025-05-26 19:27:02 +02:00
scribam b973453317 ci: build uwp for ARM64 and Win32 2025-05-24 19:24:24 +02:00
github-actions[bot] ffaada9e9d Fetch translations & Recreate libretro_core_options_intl.h 2025-05-23 22:21:23 +00:00
Flyinghead 1953eb0eea outtrigger (US) widescreen cheat. Propeller arena modem string patch 2025-05-22 20:23:23 +02:00
scribam c3275d3c6f ci: update bsd workflows 2025-05-21 23:22:47 +02:00
Flyinghead 5e769d5cd2 Merge remote-tracking branch 'origin/master' into dev 2025-05-21 23:21:49 +02:00
Flyinghead f26e10e44a modem string patch for Mobile Suit Gundam: Federation vs.Zeon
Set minimum tx and rx speed to 0.
2025-05-21 08:28:29 +02:00
Flyinghead 3d60fc8c60 Revert "core/deps/picotcp/modules/pico_tcp.c: More checks for correct header sizes"
This reverts commit ffc32d2d86.
PR #1937
2025-05-21 08:22:35 +02:00
Flyinghead 7adeb53aee arm64 rec: fix typo in FTRC implementation
Issue #1905
2025-05-20 08:52:09 +02:00
James eacadf24a6 DreamPicoPort Mapping Updates (for maraca support) (#1940)
Add rightx and righty for DreamPicoPort (for maraca support)
Add secondary d-pad to dreampicoport mapping
Allow DreamLink device to dictate button/axis name; set custom button names in DreamPicoPort to known codes
2025-05-19 10:37:03 +02:00
Flyinghead 8e14c7f394 Merge remote-tracking branch 'origin/master' into dev 2025-05-18 20:28:41 +02:00
Flyinghead a842edb09e naomi: add mushi2k3 rom 2025-05-18 12:40:49 +02:00
github-actions[bot] e2247e4872 Fetch translations & Recreate libretro_core_options_intl.h 2025-05-16 22:21:04 +00:00
Flyinghead eb662da389 flash: add bba settings if missing. cheats for outtrigger and bomberman
Add bba config information to flash if missing. Fixes outtrigger.
cheat: Enable automode in modem connection string for Bomberman Online
and Outtrigger (US)
cheat: disable dricas auth for outtrigger (JP)
2025-05-15 16:46:54 +02:00
Flyinghead 2b79f93d6b ui: dcnet is no longer experimental 2025-05-14 19:50:14 +02:00
npt-1707 ffc32d2d86 core/deps/picotcp/modules/pico_tcp.c: More checks for correct header sizes 2025-05-10 20:56:59 +02:00
Flyinghead 892cdb7cea x86 dynarec: fix crash
Regression due to e394840344
Fixes MINIDUMP-6RC
2025-05-10 20:56:21 +02:00
Flyinghead 90ed30f70c appimage: fix some missing shared libraries
Issue #1930
2025-05-08 21:43:40 +02:00
Flyinghead 5f4eefab58 naomi: add pjustic (rev b) and pjustica. fix gunsur2 and gunsur2j
Issue #716
2025-05-06 20:04:11 +02:00
scribam 34f8ab292f deps: update sdl to version 2.32.6 2025-05-04 20:57:18 +02:00
Flyinghead 7538424efb cheat to allow The Next Tetris online features
Bypass check of modulation type and rx/tx speeds.
2025-05-04 19:31:09 +02:00
Flyinghead 3976fe1be2 readme: smaller flycast logo 2025-05-04 19:26:21 +02:00
Flyinghead c57b2e1aa7 oit: incorrect color used when src=OTHER_COLOR if dest is 2nd accum
Using src=OTHER_COLOR with destination secondary accumulator should use
the secondary accumulator color, not the final one.
Fixes dark gun in Doom 64 with Ultra graphics (bump mapping).
Issue #1771
2025-05-03 11:05:59 +02:00
Flyinghead 9cc3d1030d vk: (mali) add subpass dependency from subpass 2 to external
Add subpass dependency from the last subpass to external/top of pipe.
Fix glitches in upper left corner when using OIT on Mali GPUs.
Issue #1014
Issue #1234
Issue #1356
Issue #1497
Issue #1852
2025-05-03 11:05:49 +02:00
Flyinghead 48e964235c vk: (mali) add memory barrier in GetLastFrame
Add memory barrier between drawing and transfer.
Fix savestate thumbnail image corruption.
Issue #1922
2025-05-03 11:05:40 +02:00
Flyinghead e148fabeae libretro: don't allow saving states in a background thread
Issue #1903
2025-05-03 11:03:11 +02:00
Flyinghead d3b8a67cba naomi: add missing zombrvne rom 2025-05-03 11:01:05 +02:00
Flyinghead 03f2ef6df0 libretro: fix crash when terminating vulkan context early
Issue #1906
2025-05-03 10:57:34 +02:00
Flyinghead e1ab9af89d oit: incorrect color used when src=OTHER_COLOR if dest is 2nd accum
Using src=OTHER_COLOR with destination secondary accumulator should use
the secondary accumulator color, not the final one.
Fixes dark gun in Doom 64 with Ultra graphics (bump mapping).
Issue #1771
2025-05-02 17:46:29 +02:00
Flyinghead 3330225de4 vk: (mali) add subpass dependency from subpass 2 to external
Add subpass dependency from the last subpass to external/top of pipe.
Fix glitches in upper left corner when using OIT on Mali GPUs.
Issue #1014
Issue #1234
Issue #1356
Issue #1497
Issue #1852
2025-05-02 15:37:29 +02:00
Flyinghead 58ce9a4159 vk: (mali) add memory barrier in GetLastFrame
Add memory barrier between drawing and transfer.
Fix savestate thumbnail image corruption.
Issue #1922
2025-05-02 15:30:45 +02:00
Flyinghead 1b5c8678a4 dreampi: select best access point when connecting 2025-04-30 23:02:41 +02:00
Flyinghead c20ec680a8 Merge remote-tracking branch 'origin/master' into dev 2025-04-30 22:58:14 +02:00
Flyinghead 57cc7b4a60 Fix crash on apple silicon due to cmake 4 change
The test to set TARGET_MAC doesn't work anymore with cmake 4.
Fixes #1918
2025-04-30 16:40:25 +02:00
Flyinghead cdef7f7444 dricas auth cheat for Aero Dancing FSD 2025-04-28 21:10:10 +02:00
nexus382 f62582a4bd Screen position bug fix with multiple monitors (#1916) 2025-04-28 18:58:33 +02:00
github-actions[bot] 30e1a858da Fetch translations & Recreate libretro_core_options_intl.h 2025-04-25 22:21:57 +00:00
kapodamy b04f0eb530 Allow tweak GDB related options and see Virtual memory addresses 2025-04-24 21:32:40 +02:00
Flyinghead ef3d3bd246 iOS: fix crash
due to f3a33642f8
2025-04-23 16:39:16 +02:00
github-actions[bot] 2ca596ae20 Fetch translations & Recreate libretro_core_options_intl.h 2025-04-18 22:21:32 +00:00
James Smith 1273c06d4b Load mapping for sdl_gamepad through loadMapping() and getDefaultMapping() instead of custom implementation 2025-04-16 21:05:40 +02:00
Flyinghead 25a882341d linux AppImage build needs libfuse 2025-04-15 14:30:55 +02:00
Flyinghead 75064f5683 ci: build AppImage with ubuntu 22 2025-04-15 14:30:46 +02:00
Flyinghead 93aaf50b4f Revert "libretro: don't restart the emu in retro_serialize_size"
This reverts commit aff64d43d4.
Issue #1885, #1903
2025-04-15 14:26:57 +02:00
Flyinghead 332be9c8aa linux AppImage build needs libfuse 2025-04-12 09:52:54 +02:00
Flyinghead 77776be20b upgrade xBRZ to 1.8 2025-04-12 09:34:39 +02:00
Flyinghead f7676faa68 ci: build AppImage with ubuntu 22 2025-04-12 09:33:26 +02:00
github-actions[bot] 93f463296d Fetch translations & Recreate libretro_core_options_intl.h 2025-04-11 22:21:32 +00:00
Flyinghead aff64d43d4 libretro: don't restart the emu in retro_serialize_size
Stop the emu in retro_serialize_size and don't restart it until after
the state is saved in retro_serialize. This avoids issues when the
actual state size is greater than what retro_serialize_size returned.
Issue #1885
2025-04-11 12:02:53 +02:00
Xphalnos 240be07bbb Misc: Remove Duplicated Semicolons 2025-04-10 11:30:33 +02:00
Flyinghead 786ccf4139 vulkan: fix crash when fast-forwarding with libretro core
Issue #1901
2025-04-10 11:29:52 +02:00
Flyinghead 10a5ed6cec network: ICE improvements
F355: flush tx buffer every 34 bytes
Flush tx/rx buffers when loading a state
Use moving average for stats
2025-04-08 21:40:26 +02:00
Flyinghead b9ba3f1e63 libretro and switch build fixes 2025-04-07 19:43:12 +02:00
JamesandNexus382 34fda43d9c DreamPicoPort fixes/enhancements (#1892)
* added getFunctionDefinitions
* Set DreamPort device default deadzone to 0% while preserving user customization
* Fixed default dead zone 0% for DreamPicoPort; set UsePhysicalVmuMemory default to true
* Use DisabledScope for UsePhysicalVmuMemory; moved DreamLinkGamepad::getDefaultMapping() to protected scope to match parent
* Set unique ID for DreamPicoPort devices so they enumerate the same way by flycast on every load
* Implement DreamLinkGamepad::resetMappingToDefault() and set C, D, and Z buttons for DreamPicoPort
---------
Co-authored-by: Nexus382 <[email protected]>
2025-04-07 19:23:14 +02:00
Flyinghead b602cc9c57 network: add ice/websocket match code system for battle cable 2025-04-07 19:22:02 +02:00
Flyinghead 63534c5d56 add websocket++ and libjuice as submodules 2025-04-07 18:06:44 +02:00
Flyinghead 0267de4997 upgrade xbyak to 7.23.1. Convert to git submodule 2025-04-07 17:58:21 +02:00
Xphalnos 56c00b0eb5 [GUI] Adding Rounded Borders 2025-04-07 09:06:12 +02:00
Flyinghead 3114394019 Merge remote-tracking branch 'origin/dev' 2025-04-05 22:30:31 +02:00
github-actions[bot] e5f13b6858 Fetch translations & Recreate libretro_core_options_intl.h 2025-04-04 22:21:17 +00:00
Flyinghead 3193d2cf5d quick'n'dirty cmake 4.0 support 2025-04-02 14:20:33 +02:00
scribam 0f18e2e167 deps: update sdl to version 2.32.4 2025-04-01 17:17:22 +02:00
Flyinghead 5908b1a84a picoppp: send UDP data synchronously
Use send_to instead of async_send_to for UDP sockets. Set socket to
non-blocking and discard data if socket full. Tentative fix for
corrupted Speed Devils Online UDP packets.
Fix uncaught exception if dns server name can't be resolved.
Use lambda instead of std::bind.
2025-04-01 17:16:39 +02:00
Flyinghead 4d6168dd0b dcnet: find best access point 2025-04-01 17:07:54 +02:00
scribam 2d1c602a69 ci: remove ninja installation for macos runner 2025-03-30 16:00:45 +02:00
Flyinghead 130675aae3 gles3: use GL_R8 internal format for fog texture
regression due to 3469b7f
Issue #1886
2025-03-28 11:12:30 +01:00
Xphalnos 75d5cc4d63 Use DXGI 1.6 and D3D11_4 2025-03-27 17:42:48 +01:00
Isaac Marovitz 5a110fd666 Replace sprintf with snprintf (#1884)
Signed-off-by: Isaac Marovitz <[email protected]>
2025-03-25 18:47:07 +01:00
Flyinghead 13436a4dda support for (some) encrypted cheats 2025-03-23 18:07:56 +01:00
James 2631706fe2 Enable physical VMU memory access (#1881) 2025-03-22 15:59:42 +01:00
Xphalnos ea6d5f8732 Update xxHash to 0.8.3 + Use faster algorithm 2025-03-22 15:58:22 +01:00
Flyinghead 305cae496f dcnet: don't try to detect ppp frames on output. send data immediately 2025-03-22 15:24:23 +01:00
Flyinghead 416085980f dcnet: empty modem buffer on init. Allow hostname override in emu.cfg 2025-03-19 19:46:16 +01:00
RTA 8b35fb80b4 Reset static device state on core unload to ensure input descriptors refresh 2025-03-17 15:36:18 +01:00
Flyinghead 5c1249c55f ci: another switch build fix attempt
gitsome's gh isn't compatible with the github one. Specify rclone
version to avoid gh use.
2025-03-17 15:00:40 +01:00
Flyinghead fac44e4a2f ci: switch build fix. Filter *.json files on android 2025-03-17 14:41:43 +01:00
Flyinghead 4ea317d51f ci: use rclone for android and switch builds 2025-03-17 13:50:12 +01:00
Flyinghead 310d5e612e ci: use rclone instead of aws cli 2025-03-17 10:26:23 +01:00
Flyinghead 62778b1a68 ci: testing scaleway 2025-03-16 23:33:06 +01:00
Flyinghead 604415b0d2 ci: trying s3 cp instead of sync 2025-03-16 22:05:15 +01:00
Flyinghead 49ea1135ee ci: ditch configure-aws-credentials 2025-03-16 20:56:07 +01:00
Flyinghead 46e2d52b75 store build artifacts on OVH 2025-03-16 20:31:17 +01:00
github-actions[bot] 44f77408e4 Fetch translations & Recreate libretro_core_options_intl.h 2025-03-14 22:21:10 +00:00
scribam 2860aa96f4 deps: update sdl to version 2.32.2 2025-03-12 18:30:06 +01:00
scribam 8b0a5fa480 deps: update oboe to version 1.9.3 2025-03-12 18:30:06 +01:00
scribam b150ba2b62 android: update project 2025-03-12 18:30:06 +01:00
github-actions[bot] 48bce25820 Fetch translations & Recreate libretro_core_options_intl.h 2025-03-07 22:19:55 +00:00
Eric Warmenhoven 562f78cd71 libretro: build osx-x64 build on new builder 2025-03-05 21:25:39 +01:00
github-actions[bot] 9e0573aa98 Fetch translations & Recreate libretro_core_options_intl.h 2025-02-28 22:21:22 +00:00
Flyinghead d23b3b6bc7 rcheevos: include flycast version in user-agent header
Issue #1798
2025-02-27 11:26:52 +01:00
Flyinghead 1d9f8ab438 custom textures: fix static deinit order issue 2025-02-27 11:20:31 +01:00
Flyinghead df3c075fba Force TV composite for Caesar's Palace 2000 and PAL for the EU edition
Issue #1851
2025-02-27 11:00:48 +01:00
Mike Kosek 9cdd0aab9f Rename DreamPort to DreamPicoPort (#1850)
* Renamed DreamPort to DreamPicoPort
* Removed fallback to deprecated config keys
2025-02-22 08:11:05 +01:00
github-actions[bot] e4d9220f3f Fetch translations & Recreate libretro_core_options_intl.h 2025-02-21 22:21:05 +00:00
Flyinghead 0bf9c64b1b Merge remote-tracking branch 'origin/dev' 2025-02-18 09:27:07 +01:00
JamesandMike Kosek 4e74619d9e Harden serial comm interface (#1847)
* Harden serial interface
* Fixed build errors
* Minor tweaks
* Automatically attached A->A, B->B, etc
* Interfaces go in decending order
* Do a modulo in case I decide to move interface numbers
* Do specifically mod 4
* Call SDL_JoystickGetDeviceInstanceID which seems to help with a Windows bug
* Made MapleDevices smart pointers so they can freely be swapped out without leaking
* Fixed issues some issues reported by kosekmi
* Added missing bracket
* Fixed another compile issue
* Fixed a missing else
* If device had no serial number, fall down to checking name
* Use new DreamPort firmware dynamics
* Added missing parens
* Fixed screen blanking issue
* Added const
* Reset VMU Screen on game/emulator exit
* Added gameTermination() hook to hardware gamepad
* Send SW port on game termination
* Added checks so port is only sent if data is valid
* Fixed bug: wait for write to complete in sendCmd
* Fixed bug leading to multiple pointers to VMU and Rumble pack
---------

Co-authored-by: Mike Kosek <[email protected]>
2025-02-16 17:36:57 +01:00
Flyinghead 0414a90500 dcnet: don't use timer for modem. better error reporting. race condition
Use io_context::post() instead of a timer to read from modem.
Notify user if connection to DCNet fails.
Fix race condition/crash with BBA.
Use lambdas instead of std::bind.
2025-02-16 17:33:56 +01:00
github-actions[bot] 5866e97d18 Fetch translations & Recreate libretro_core_options_intl.h 2025-02-14 22:21:01 +00:00
scribam 387e2427b4 deps: update sdl to version 2.32.0 2025-02-10 18:13:12 +01:00
Flyinghead 5187258f4b dcnet: BBA support
Stop network service when bba is reset. Start it on first frame out.
dcnet: close connection on dhcp release
picoppp: close all sockets and acceptors when stopping.
2025-02-10 18:12:24 +01:00
e1da1c3a55 CMake: Change core install location to lib/libretro (#1842)
* CMake: Change core install location to lib/libretro

* fix CI build artifacts location

---------

Co-authored-by: Andrew Wong <[email protected]>
Co-authored-by: Flyinghead <[email protected]>
2025-02-10 13:25:34 +01:00
Flyinghead 84356e3b26 dreampi.py: shake off the modem on first run (from scrivani) 2025-02-08 16:20:47 +01:00
Flyinghead c7499df3a8 cheats for Aero Dancing i & i2 in BBA mode 2025-02-08 16:17:15 +01:00
github-actions[bot] 03f7a0f605 Fetch translations & Recreate libretro_core_options_intl.h 2025-02-07 22:20:30 +00:00
Flyinghead f3c838d19d dricas auth cheat for Aero Dancing i - Jikai Saku Made Matemasen 2025-02-05 18:29:56 +01:00
Flyinghead d6f3ca986d fix from jscrivani to work around the initial failed connection 2025-02-05 18:28:12 +01:00
Flyinghead b9df7d3469 network digital outputs: check config option when game starts
Avoid the need to restart when enabling or disabling this option
Send game name to newly connected sockets
ignore SIGPIPE (telnet)
Log network errors
2025-02-04 17:46:02 +01:00
Flyinghead bf1d4a56ae gdrom: fix savestate compatibility issue
consequence of c860807fef
2025-02-04 17:27:47 +01:00
Flyinghead a682e20bbd modem: modem must hang up as soon as reg20 is written
some games don't do a full reset and the modem would stay connected.
Remove debug file dumps.
2025-02-04 17:20:15 +01:00
Flyinghead 5b9dd96064 option to set the ISP username in flash rom 2025-02-04 17:17:38 +01:00
Flyinghead a99a72589b better cheats for dricas auth 2025-02-04 17:14:01 +01:00
James 77ed9c20de Connect to DreamConn only once registered (#1828) 2025-02-03 18:19:22 +01:00
Flyinghead 7cb0fe53d7 add cheats to bypass dricas authentication
Aero Dancing i
Daytona USA (JP)
Sega Tetris
Golf Shiyou Yo 2
Hundred Swords
2025-02-03 18:18:28 +01:00
Flyinghead 3db0fce9b6 bypass dricas auth in aero dancing i 2025-02-02 17:12:54 +01:00
Flyinghead 6a15e7a3aa rend: LoD0 of VQ YUV textures is invalid. Use LoD1 instead.
Fixes background magenta textures in WSB2K2. Issue #1038
2025-02-02 17:11:22 +01:00
github-actions[bot] 431d71de5e Fetch translations & Recreate libretro_core_options_intl.h 2025-01-31 22:20:31 +00:00
Flyinghead 914fa29d31 gdrom: increase dma delay for small DMA transfers
Fixes WSB 2K2 freezes.
Issue #1038
2025-01-31 18:09:33 +01:00
Flyinghead c143cae09b disable Daytona USA (US) widescreen cheat
breaks online features
2025-01-31 15:32:18 +01:00
James a35e8214df Serial comm update (#1820)
* Broke apart DreamConn and DreamcastControllerUsb implementations; added serial timeouts; process serial in thread; removed crc from DreamcastControllerUsb sdl definition

* Added missing include statements

* Changed INFO_LOG to NOTICE_LOG on a couple of lines

* Clear the read queue once string is pulled off of it
2025-01-28 17:27:26 +01:00
Flyinghead d84108de32 maple: yet another maple timing change
Use 2 Mb/s for console and 740 Kb/s for devices.
Fixes Silent Scope vmu load issue at boot. Issue #1796
D+Vine has issues detecting A and B presses with one controller
connected but it does work eventually. No issue with more than 1
controller. Issue #1279
Power Drift only boots with one controller connected. Crashes with 2 or
more.
2025-01-28 17:26:22 +01:00
Flyinghead 1513c6cab8 msvc build fix 2025-01-27 17:47:22 +01:00
Mike Kosek 34104724a6 Added config file override for DreamcastControllerUsb Serial Device 2025-01-27 17:30:46 +01:00
Flyinghead b70c2791b2 dynarec: proper ftrc implem. (arm32/64) Use double for fipr/ftrv
Use double for canonical FIPR and FTRV on all platforms.
Fix interpreter implementation of FTRC.
Fix canonical implementation of cvt_f2i (FTRC).
arm32: use Vfma instead of Vmla for FMAC. Vfma does not a fused
muliply-add, Vmla doesn't.
arm32: Use canonical implementations of FIPR and FTRV.
arm32,arm64: Correct implemetation of cvt_f2i (FTRC)

Fixes desync with NBA 2k1/2k2 online games.
2025-01-27 17:30:06 +01:00
scribam ccdd53ee0e deps: update sdl to version 2.30.11 2025-01-25 17:02:56 +01:00
scribam 57a3e4ca53 ci: update netbsd version 2025-01-25 17:02:56 +01:00
scribam b92ac1544e android: update project 2025-01-25 17:02:56 +01:00
Mike Kosek 26d386f833 Fixed handling of asio::io_context 2025-01-25 17:02:18 +01:00
Mike Kosek ce0060126e Now adding mappings for Dreamcast Controller USB during input_sdl_init() 2025-01-25 17:02:18 +01:00
Mike Kosek 4389a3ffa6 Reverted Dreamcast Controller USB mapping workaround 2025-01-25 17:02:18 +01:00
Flyinghead b3fa453d75 dreamconn: asio::serial_port isn't defined on all platforms 2025-01-25 17:02:18 +01:00
Mike Kosek 32c274f407 Updated serial device search on Windows to select only matching VID/PID 2025-01-25 17:02:18 +01:00
Mike Kosek cb2d3e3776 Maple Message to Dreamcast Controller USB now prefixed for compatibility with newest version 2025-01-25 17:02:18 +01:00
Mike Kosek 28f5dd983e Now properly setting and checking left/right Trigger 2025-01-25 17:02:18 +01:00
Mike Kosek 160828a4c7 Overrode default mapping for DreamcastControllerUsb on MacOS/Windows 2025-01-25 17:02:18 +01:00
Mike Kosek aee932808e Removed unused function getDreamcastControllerType() 2025-01-25 17:02:18 +01:00
Mike Kosek 77636391fc Enabled the usage of VMUs and Rumble Packs with Original DC Controllers 2025-01-25 17:02:18 +01:00
Flyinghead 944af44c7f naomi: some digital outputs still missing for f355
Lamps use 14 bits of output in f355.
2025-01-25 17:00:48 +01:00
github-actions[bot] 5c27648699 Fetch translations & Recreate libretro_core_options_intl.h 2025-01-24 22:21:08 +00:00
Flyinghead 7ef35eaf68 dreampi: fix paths 2025-01-24 18:26:44 +01:00
Flyinghead bb733323ce dcnet utility for dreampi 2025-01-24 18:13:56 +01:00
Flyinghead 1b6bf25e7a naomi: broadcast digital outputs even when using FFB drive
The first byte is for lamps, the next two are for FFB.
Fixes missing lamp notifications when broadcasting digital outputs
(F355).
2025-01-23 18:40:24 +01:00
Flyinghead aa65b81f89 switch build fix 2025-01-23 18:34:58 +01:00
Wunkolo da9f030a0e vk: Refactor swapchain format selection
Use a series of stable-partitions to sort the list of available formats
to find the best candidate surface-format/color-space that is a non-sRGB
format being presented in an sRGB color-space. Vulkan mandates that all
surface formats that have SRGB forms must also support a UNORM form.

This is basically just RGBA8/BGRA8 on all platforms still, but in a way
that is still capable of falling back to secondary formats in a stable
way in the case that the primary choice is not available.  Mobile
devices especially have a LOT of secondary HDR surface formats and other
weird formats that can be used to present such as RGBA16 or RGBA565.
With stable partitions, if we can't get our best option then there is
always a "next best thing" to fall back on rather than relying on the
driver-order.
2025-01-22 18:28:55 +01:00
Wunkolo a0e1eb0005 vulkan: Allow native RGB8 screenshot framebuffers when available
Some notable devices support native RGB8 color-attachments:
https://vulkan.gpuinfo.org/listdevicescoverage.php?optimaltilingformat=R8G8B8_UNORM&featureflagbit=COLOR_ATTACHMENT

This removes the need to do a manual RGBA->RGB format conversion on the CPU in favor of a direct memcpy from the downloaded texture, when available.
2025-01-22 18:27:20 +01:00
Flyinghead 5cc15429cd Force Native Depth Interpolation on UWP/Xbox. UWP build fix 2025-01-22 18:26:29 +01:00
Flyinghead 18656f5986 picoppp: terminate MiniUPnP in a background thread 2025-01-21 18:21:47 +01:00
Flyinghead 536be34853 dcnet: update emu network state when connected 2025-01-21 18:19:39 +01:00
Flyinghead 5b513cac5b gl: use textureProj for palette texture sampling when possible/available
Fixes UV precision issue when doing the Z-divide manually.
Issue #1804
2025-01-21 18:18:05 +01:00
Flyinghead 5efdf58e85 custom texture: skip updating a texture if its hash hasn't changed
Some textures are frequently updated because of their location in vram,
close to a hotspot. This causes the custom texture to never be loaded.
This change will skip the unneeded texture update, allowing the custom
tex to replace it when available.
Issue #1812
2025-01-21 18:12:10 +01:00
github-actions[bot] a93f3697d6 Fetch translations & Recreate libretro_core_options_intl.h 2025-01-17 22:20:48 +00:00
Flyinghead b98e833c57 uwp: define _WIN32_WINNT to avoid compile issues with asio 2025-01-17 17:46:49 +01:00
github-actions[bot] 2e89848041 Fetch translations & Recreate libretro_core_options_intl.h 2025-01-10 22:20:35 +00:00
Flyinghead bb4ba3ed89 dcnet: libretro support 2025-01-09 19:01:50 +01:00
Flyinghead a5a338d408 experimental DCNet cloud service 2025-01-09 18:48:29 +01:00
Edward Li 3114344414 [macOS] Fix booting game stuck at "Starting..." when Video Routing is enabled with OpenGL 2025-01-09 13:59:54 +01:00
oltolm 20ba79668f fix compiler warnings 2025-01-09 13:59:21 +01:00
oltolm 7a4f9d8667 CMake: fix build on Windows 2025-01-06 19:46:52 +01:00
Wunkolo 22bff1b017 cmake: Use set_target_properties to set C++ standard
This stops dependencies from inheriting a global C++20 standard setting
and instead designates the flycast target alone to be a C++20 project.
2025-01-05 22:06:37 +01:00
Wunkolo 9344856c7e ggpo: Fix malformed template constructor
This form is not needed for a template-class's constructor.
Fix for C++20 builds
2025-01-05 22:06:37 +01:00
Wunkolo b2c1d134e1 deps: Update luabridge to 2.8
From 2.6 to 2.8. Includes some C++20 fixes.
2025-01-05 22:06:37 +01:00
Wunkolo 160d3e7ef3 cmake: C++20 enablement
Enables the C++ 20 standard
2025-01-05 22:06:37 +01:00
Flyinghead 3cf4808033 fix perf regression on macOS and iOS. Add Silent Scope (JP) identifier.
Regression introduced in f3a3364
CopyToVRAM wasn't enabled for Silent Scope (JP). Issue #1796
2025-01-05 22:06:37 +01:00
Flyinghead 1bd894f941 rend: reset scissoring before drawing final modvol quad
See d618abc320
Issue #1797
2025-01-05 22:06:37 +01:00
Edward Li 8dc55721d0 Generate Xcode project which can support both iOS and iOS Simulator 2025-01-05 22:06:37 +01:00
scribam c94deaee9d build: drop unsupported architectures 2025-01-05 22:06:37 +01:00
scribam 95583583ca ci: force ubuntu-22.04 on libretro-x86_64-pc-linux-gnu target 2025-01-05 22:06:37 +01:00
Flyinghead 42752acef5 Fix crash when reading 2448-byte sectors
Fixes MINIDUMP-5J0, MINIDUMP-5M7, MINIDUMP-5M8, MINIDUMP-5MA,
MINIDUMP-5MF
2025-01-05 22:06:37 +01:00
github-actions[bot] 45c700ab60 Fetch translations & Recreate libretro_core_options_intl.h 2025-01-05 22:06:37 +01:00
Flyinghead a3902fc278 sdl: disable rumble when rumble power is set to 0
Issue #1766
Issue #1783
2025-01-05 22:06:37 +01:00
Flyinghead 0606f3e63e ios: make the keyboard remappable 2025-01-05 22:06:37 +01:00
Flyinghead 0558c957e8 libretro: set an SDL hint to keep flycast SIGSEGV handler
Thanks to mrfixit2001 for helping troubleshoot the issue.
2025-01-05 22:06:37 +01:00
github-actions[bot] 2ca9187137 Fetch translations & Recreate libretro_core_options_intl.h 2025-01-05 22:06:37 +01:00
Flyinghead 5add29cbed fix perf regression on macOS and iOS. Add Silent Scope (JP) identifier.
Regression introduced in f3a3364
CopyToVRAM wasn't enabled for Silent Scope (JP). Issue #1796
2025-01-05 10:21:54 +01:00
Flyinghead 5a1c3f80f5 msvc32 build fix 2025-01-02 13:55:39 +01:00
Flyinghead a0e8e9a9df libretro: windows build fix 2025-01-02 12:11:45 +01:00
Flyinghead 45f4378184 network: use asio for modem/bba. DirectPlay4 support
DirectPlay4 support: StarLancer, PBA Bowling
miniupnp: remove unused stuff
2025-01-02 11:27:11 +01:00
Flyinghead c7d030c2e6 uwp: enable vmem. fix dynarec crash. windows: dll loading utility
uwp: Fix crash in x64 dynarec when rewriting due to wrong unprotect
range.
uwp: load MapViewOfFileEx dynamically to map regions at a given address.
dll load and function lookup utility.
2025-01-02 11:13:25 +01:00
Flyinghead 2bee6b1ce4 picotcp: fix msvc build. reduce logging 2025-01-02 11:01:58 +01:00
Flyinghead 522505273e miniupnpc: minissdpc.c: fix memory allocation error
backport
https://github.com/miniupnp/miniupnp/commit/9698973600e639ddf0ceb0ee565d7297598486fe
2025-01-02 10:57:38 +01:00
Flyinghead 0481f5464d misc non-functional changes 2025-01-02 10:54:19 +01:00
Flyinghead 7478476f9c multithreading utilities (periodic, worker thread) 2025-01-02 10:50:46 +01:00
Flyinghead 76c3695f6e log: support udp log server 2025-01-02 10:35:27 +01:00
Flyinghead e18ada7225 rend: reset scissoring before drawing final modvol quad
See d618abc320
Issue #1797
2024-12-31 18:22:07 +01:00
Edward Li f3a33642f8 Generate Xcode project which can support both iOS and iOS Simulator 2024-12-30 12:23:27 +01:00
scribam 2f03c1b147 build: drop unsupported architectures 2024-12-30 12:22:59 +01:00
scribam b7e2f5e489 ci: force ubuntu-22.04 on libretro-x86_64-pc-linux-gnu target 2024-12-30 12:22:28 +01:00
Flyinghead d01cbde41c Fix crash when reading 2448-byte sectors
Fixes MINIDUMP-5J0, MINIDUMP-5M7, MINIDUMP-5M8, MINIDUMP-5MA,
MINIDUMP-5MF
2024-12-30 12:20:29 +01:00
Flyinghead 11068012fe picotcp: support threads with msvc. Fix msvc pragma push issue
Enable threading support with msvc, similar to posix.
Fix missing pragma pop after picotcp include files
2024-12-30 12:15:36 +01:00
Flyinghead a06791780d Merge remote-tracking branch 'origin/dev' 2024-12-29 10:59:49 +01:00
Flyinghead ee1a7167f6 dreamconn: open pause menu when LT+RT+Start is pressed
Issue #1305
2024-12-28 15:39:11 +01:00
Flyinghead 10aaec1619 dreamconn: send data with socket to avoid fragmentation. Build fix
Issue #1305
2024-12-28 12:21:26 +01:00
github-actions[bot] 32d8d9a8c3 Fetch translations & Recreate libretro_core_options_intl.h 2024-12-27 22:20:31 +00:00
Flyinghead 553f77c675 dreamconn: send buzzer messages. Rename controller. Use asio iostream
Issue #1305
2024-12-27 18:47:12 +01:00
Flyinghead 9402981b43 net: add asio. use it for the gdb agent 2024-12-27 18:39:13 +01:00
Flyinghead 9038ef6d8a sdl: disable rumble when rumble power is set to 0
Issue #1766
Issue #1783
2024-12-26 16:31:23 +01:00
Flyinghead 1d290560e0 picotcp: accept PSH flag in SYN+ACK packets
Windows CE adds the PSH flag to SYN+ACK packets, which isn't normally
valid, so just ignore the flag. See dcgamespy filter in dreampi.
2024-12-26 13:04:07 +01:00
Flyinghead 59e844db15 picotcp: Integer Overflow in pico icmp4
upstream
https://github.com/virtualsquare/picotcp/commit/cc923d2a1221d2066dc9270fb86c5c43635ce06e
2024-12-26 12:38:26 +01:00
Flyinghead 6853238c8b picotcp: Discard incoming TCP segments with zero-len options
upstream
https://github.com/virtualsquare/picotcp/commit/7aa288510a033691c3f09e2c43e10f07e24434b7
2024-12-26 12:12:48 +01:00
Flyinghead f0aa1abf89 picotcp: Fixed bug in tcpopt_len_check (rolling back index).
upstream
https://github.com/virtualsquare/picotcp/commit/f569ed8fb66630fa4a4dc59259253767da67b23a
2024-12-26 12:03:09 +01:00
Flyinghead cfd3677746 picotcp: add socket event before socket is deleted
Socket callback is called with PICO_SOCK_EV_DEL just before the socket
is deleted. After returning from the callback, the socket pointer is no
longer valid.
2024-12-26 11:45:58 +01:00
Flyinghead 50a10598e4 picotcp: Resolved memory leak
upstream
https://github.com/tass-belgium/picotcp/commit/83527c69d3f69ba2b049b827c4f80c0633dce390
2024-12-26 11:33:26 +01:00
Flyinghead 9bfd48cf40 ios: make the keyboard remappable 2024-12-21 12:26:16 +01:00
Flyinghead b72750c7d5 libretro: set an SDL hint to keep flycast SIGSEGV handler
Thanks to mrfixit2001 for helping troubleshoot the issue.
2024-12-21 12:25:30 +01:00
Flyinghead b9fdd5070b dreamconn: detect dreamconn+ with VID/PID. Send maple data as text.
Create DreamConn gamepad when detected.
Send/receive maple data in ascii dump form.
Simplify maple device creation.

Issue #1305
2024-12-20 20:02:58 +01:00
Flyinghead 6c3d77b012 more windows build fix 2024-12-16 18:14:21 +01:00
Flyinghead 7fee0d2d29 cheat to work around fur fighters hanging
Root issue seems to be TCNT0 returning the same value twice, which
breaks the game calculation of the game speed/frame rate.
Issue #145
2024-12-16 17:54:02 +01:00
Flyinghead dfd4dbebc4 fix windows build 2024-12-16 17:34:38 +01:00
Flyinghead 34a5e7f47d input: dreamconn+ support prototype
Issue #1305
2024-12-16 17:17:45 +01:00
Flyinghead 3f8d645c42 rend: last frame was sometimes presented after the game is stopped
When the clearLastFrame flag is set, renderers should return false from
Present() and RenderLastFrame() until a new frame is rendered.
2024-12-15 15:55:28 +01:00
Flyinghead ecd0305a60 fix build without dynarec 2024-12-14 19:43:32 +01:00
Flyinghead 667e3906d8 sh4: work around previous SCIF issues when loading a state
Force SCIF_SCBRR2 to 8 bits when loading a state.
See e03e11b8a9 and
6115a918b2.
2024-12-14 19:13:05 +01:00
Flyinghead e5b1d56a7c rend: split texture conversion routines into their own file 2024-12-14 19:07:18 +01:00
Flyinghead d789b57412 rend: get rid of globals for fog/palette updates & tex cache flush
Add state vars to Renderer
Use events to detect loading a state and terminating the game.
Don't present last rendered frame after game terminated.
2024-12-14 17:00:51 +01:00
Flyinghead 825778445a ui: show boxart cover when starting a game 2024-12-14 16:54:18 +01:00
Flyinghead 20517cf0da vgamepad: enable touch mouse when lightgun used
Use unique touch mouse class for iOS and Android.
Enable touch mouse for arcade lightgun games or when maple device A is a
lg. Disable it otherwise.
android: only display controllers that actually send events, including
system mouse and keyboard. Use separate Touch Mouse and System Mouse.
iOS: fix missing button input for touch mouse. Don't bubble up touch
events that hit vgampad buttons or controls.
2024-12-14 16:18:35 +01:00
github-actions[bot] 989d3b1370 Fetch translations & Recreate libretro_core_options_intl.h 2024-12-13 22:21:39 +00:00
Flyinghead 421245aeba lightgun xhair: centralize logic in crosshairNeeded() 2024-12-13 17:21:32 +01:00
Flyinghead 686f08e7dd vgamepad: hide btn0 and map reload to btn1 for lightgun games 2024-12-13 16:49:57 +01:00
Flyinghead 4af1d096de audio: reset buffer on loadstate/term. Fix null audio driver on windows
Eliminate audio clicks when loading a state or starting the next game.
Fix overflow in null audio driver on windows. Detect fast forward and
reset time counter.
2024-12-13 15:58:32 +01:00
Flyinghead 27a0497dd5 win32: fix opening CD drive on command line. libretro build fix 2024-12-12 15:52:07 +01:00
Flyinghead 9ea0563a7a gdrom: stop cdda playback when reaching session lead out
Issue #1654
2024-12-12 14:27:23 +01:00
Flyinghead a46677e64e ui: add cancel button when inserting a disk
Issue #1566
2024-12-12 10:17:45 +01:00
Flyinghead a7f2008763 rend: support planar VQ textures
Fixes gens4all emu in teenage mutant ninja turtle collection.
Issue #868
2024-12-12 10:14:30 +01:00
Flyinghead 53e0f12c22 win32: force libcdio static link
Issue #1654
2024-12-12 09:57:18 +01:00
Flyinghead 34961daaec gdrom: add support for hardware CD-ROM devices
Use libcdio to read CD/DVD/BD drives (linux, windows, bsd)
Get rid of old ioctl win32 driver.
Add detected CDROM devices to game list.
Issue #1654
2024-12-11 11:25:50 +01:00
Flyinghead f5389bcd0b battle cable: notify user when data first received from peer
Document SCIF register bits.
2024-12-11 11:04:44 +01:00
Flyinghead 67eee05c14 lightgun: wiggle the reported lightgun position in a 2x2 square
Fixes claychal not registering shots in menus.
2024-12-11 10:41:53 +01:00
Flyinghead bb1b1059d4 sh4: SCIF DR bit can't be reset if rx fifo isn't empty
Fixes manic panic periodic touchscreen errors.
2024-12-11 10:37:48 +01:00
Flyinghead 94f35ca54f arcade: add input descriptors for most games 2024-12-09 16:09:45 +01:00
Flyinghead 1507097bcd naomi: set offscreen sensor when reloading. fix wldkicks PCB inputs
Most games using analog inputs for lightguns also have an offscreen
sensor (lupinsho, mok, hotd2, confmiss). Activate it when reloading or
shooting offscreen.
Fix World Kicks PCB inputs.
2024-12-09 16:02:30 +01:00
Flyinghead e4599e36ed Merge remote-tracking branch 'origin/master' into dev 2024-12-08 10:47:31 +01:00
Flyinghead 15617c1816 ssa: fix regression
due to fff03f64a3
Issue #1773
2024-12-08 10:40:44 +01:00
scribam fb64fc418e ci: update freebsd and openbsd versions 2024-12-07 21:04:17 +01:00
scribam 5656370388 deps: update sdl to version 2.30.10 2024-12-07 21:03:49 +01:00
Flyinghead 354d649ebd Merge remote-tracking branch 'origin/master' into dev 2024-12-07 20:38:55 +01:00
Johan Mattssonandflyinghead fff03f64a3 ssa: Fix wrong opcode comparison (#1769)
* ssa: Fix wrong opcode comparison

* ssa: handle 32 bits shift case first (shld, shad)

---------

Co-authored-by: flyinghead <[email protected]>
2024-12-07 18:59:14 +01:00
Flyinghead a99aa5217b sdl: don't run null haptic effects. Stop effects instead
Tentative fix for Issue #1766
2024-12-07 18:57:40 +01:00
Flyinghead 89abb7925b Pro Pinball needs copy to vram. remove Nightmare Creatures widescreen
Issue #1763
2024-12-07 10:04:36 +01:00
Flyinghead dea8e74182 better CI job names 2024-12-04 18:19:34 +01:00
Flyinghead 92c5892d4c android: fix scaling when editing vgamepad. vgamepad code clean up 2024-12-04 18:17:11 +01:00
Flyinghead 21f9e9fbc2 android,ios: arcade vgamepad layout. android vgamepad rewrite
Refactor common virtual gamepad code.
Distinct layouts for console and arcade.
Add arcade buttons 5 and 6, insert card button, service mode toggle.
System SP support
2024-12-03 21:04:51 +01:00
Flyinghead 78fa3ee09e vulkan: delay updating imgui texture when driver has just been reset
Fixes crash when selecting a custom gamepad layout .png (android)
2024-12-03 20:42:54 +01:00
Flyinghead de1584d97c systemsp: input remapping. Input desc for mushiking, dinoking, lovebery
Allow input remapping for SystemSP.
Add input descriptors for barcode games: mushiking, dinoking and
love&berry
2024-12-03 20:16:56 +01:00
Flyinghead a40c51e682 gdrom: fix deserialization crash
regression due to c860807fef
Issue #1755
2024-12-03 18:33:58 +01:00
Flyinghead c860807fef gdrom: reduce dma buffer size. reios: schedule dma reads by chunks
Reduce gdrom dma buffer size to 16 sectors from 32.
Limit serialization of dma and pio buffers to actual content.
reios: schedule transfer of dma data in chunks.
Fixes Soul Calibuf audio drop outs at boot with HLE BIOS (RA).
Issue #1755
2024-11-30 16:37:55 +01:00
Flyinghead b91f82c7e5 win32: create screenshots path if needed. Fall back to Pictures folder
Ask Windows to create the Screenshots folder if it doesn't exist.
Fall back to Pictures folder if the Screenshots folder can't be
determined.
Issue #1761
2024-11-30 13:06:53 +01:00
github-actions[bot] d38ce47081 Fetch translations & Recreate libretro_core_options_intl.h 2024-11-29 22:21:28 +00:00
Flyinghead 5f55a9fd3f naomi: fix issue when creating eeprom. Ignore audio disable.
Byte at offset 2 was incorrect.
Ignore disable attract mode audio in BootID.
Remove ikaruga default eeprom.

Issue #1760
2024-11-29 17:11:36 +01:00
Flyinghead a085fd2f6d ui: never disable Up and Down buttons on iOS. rename source files 2024-11-28 17:45:40 +01:00
Flyinghead 36c2f5137c ios, android: load custom vgamepad image. disable unused controls
User can choose a custom vgamepad image or reset to default.
Unused controls are disabled and hidden based on the game (arcade) or
maple device (console).
2024-11-28 17:09:09 +01:00
Flyinghead 5e9c168fc9 android: add BooleanArray to jni util. refactor using templates 2024-11-28 17:01:39 +01:00
Flyinghead 59c2343cad android: add mime-type argument to addStorage() 2024-11-28 16:46:17 +01:00
Flyinghead b42387e929 naomi: vf4 and mazan input descriptors 2024-11-28 16:41:30 +01:00
Flyinghead df78a781ec allow USE_HOST_LIBCHDR with libretro 2024-11-27 10:04:23 +01:00
Flyinghead 974dc2e233 missing iOS app icon source files
Courtesy of @maxtron95
Issue #1731
2024-11-27 10:02:26 +01:00
Flyinghead 6bf38e5085 input: fix potential race condition with analog ramp up/down
Fix a potential race condition on android causing missed inputs with
analog axes bound to buttons.
2024-11-26 19:29:40 +01:00
Flyinghead 792aa38d34 input: implement ramp up/down for analog axes mapped to buttons
Full analog axes now have a ramp up/down of 100 ms when the mapped
button is pressed/released. Works also for keyboards.
Issue #1017
2024-11-26 16:06:13 +01:00
Flyinghead 516982c66c ios: allow virtual gamepad layout customization
Use same display code as android.
Support custom buttons.png.
Allow layout customization as in android.
Save layout in emu.cfg.
Allow transparency setting.
Issue #990
2024-11-26 10:46:02 +01:00
Flyinghead a9fa33c17a gl: test glBlitFramebuffer compliance and disable its use if failing 2024-11-26 10:03:33 +01:00
Flyinghead d0584b8652 vk: defer deleting framebuffers in ScreenDrawer and lr context
Defer deleting framebuffers and attachments in ScreenDrawer and lr
context when resizing.
Fixes crash when starting 240pSuite on the lr core.
2024-11-23 13:47:19 +01:00
github-actions[bot] 58c8a33d11 Fetch translations & Recreate libretro_core_options_intl.h 2024-11-22 22:20:51 +00:00
Flyinghead b4dcc64ef6 android: draw onscreen gamepad with imgui
Get rid of Renderer::DrawOSD.
gl: make a GlQuadDrawer class.
Draw on-screen gamepad using imgui.
Clean up vgamepad interface.
2024-11-22 14:42:51 +01:00
Stefan Schlosser 7531f5df20 oss: cleanup and unification
Audio and record initializations are unified by providing helper functions for
opening the audio device and for setting the device parameters. The ioctl calls
are properly checked for errors and log an appropriate error message. The init
fails if the requested parameters are not supported by the device, i.e. 44.1kHz
16bit stereo for playback. This provides consistent behavior with all the other
audio backends.
2024-11-22 13:06:18 +01:00
Stefan Schlosser c4d77165a6 lua: add build option for Lua support
The added build option USE_LUA (enabled by default) allows to enable/disable Lua
support in the build. This provides more control over the used dependencies, and
is important especially for OpenBSD and FreeBSD i386 builds, where the build
fails with enabled Lua support, see also [1].

[1] https://github.com/vinniefalco/LuaBridge/issues/302
2024-11-20 18:01:06 +01:00
Flyinghead aa95c71ead libretro build fix 2024-11-20 12:06:39 +01:00
Flyinghead 6612e3fef8 gdrom: update settings and more when swapping disks
Set forced and per game settings.
Update game id and save state file name.
Reset cheats and custom textures.
Update game title and window title.
Issue #1748

hle bios: reboot the game when "exit to bios" vector is called
2024-11-20 11:46:34 +01:00
Flyinghead fbd52a72d4 naomi: load and decrypt gd-rom on demand
Shorten load times and avoid ANR on android with libretro when loading a
GD-ROM game. Load and decrypt data by 16 KB chunk when needed.
Issue #1457
Issue #1738
2024-11-17 20:39:30 +01:00
Flyinghead d618abc320 rend: modifier volumes must be clipped
Modifier volumes should also be clipped when needed.
Implement outside clipping for non-OIT renderers.
OIT renderers are less affected since the shadowed polys themselves are
usually also clipped after shadow is applied.
Fixes overflowing shadows in baserunner cams in WSB 2K1.
2024-11-17 12:09:40 +01:00
github-actions[bot] b7163dda83 Fetch translations & Recreate libretro_core_options_intl.h 2024-11-15 22:21:36 +00:00
Stefan Schlosser d259a2e2f5 libchdr: add build option for using system library
The added build option USE_HOST_LIBCHDR allows to build with libchdr provided by
the system. The option is disabled by default.
2024-11-14 13:17:00 +01:00
Stefan Schlosser e2f8de33e8 audio: add build options for audio backend support
The added build options USE_ALSA, USE_LIBAO, USE_OSS and USE_PULSEAUDIO allow to
enable/disable specific audio backends in the build. This provides more control
over the used dependencies.

The OSS backend wasn't enabled in the previous build configuration, consequently
the build option USE_OSS is set to OFF by default.
2024-11-14 13:16:27 +01:00
vkedwardli 42ad5532b2 Update Xcode project generator (#1732)
* Do not build breakpad in Xcode project, fix `PhaseScriptExecution failed` error and fix Flycast cannot be launched from debugger

* NSLog prettyprint for Xcode 16
2024-11-14 13:15:54 +01:00
Flyinghead 1e30f483c2 New iOS app icon
Courtesy of @maxtron95
Issue #1731
2024-11-14 13:13:59 +01:00
Flyinghead bdd2d5af7f naomi: emulate dimm registers for gd cart
Emulate 1.02 dimm board without network so that the bios detects it and
shows the expected GD-ROM SYSTEM boot screen.
Fix rom board serial id issue (error 04) with ikaruga, tetkiwam,
puyofev[j] and sprtjam.
Issue #1735

Add naomigd and naomidev bios definitions (unused).
Use netdimm for mj1 and wccf* series (still not working).
2024-11-14 13:05:48 +01:00
Flyinghead 76638df001 sh4: split xffr array. Fix FPCB_PAD on windows
Split xffr[32] into xf[16] and fr[16].
Set FPCB_PAD size to 64_KB. Issue #1736
Get rid of shil_param::reg_aofs
2024-11-13 10:31:45 +01:00
Flyinghead 3efb87ba6d vk: fix crash when enabling/disabling EmulateFramebuffer
Make sure to end the current render pass with the previous setting.
Fix initial layout of color attachments in OIT.
Fix missing initial transition after Term/Init in !OIT.
Issue #1734
2024-11-11 22:15:57 +01:00
Flyinghead c9f238362d New macOS app icon
courtesy of @maxtron95
Issue #1731
2024-11-11 22:09:52 +01:00
Flyinghead 129673a84b dynarec: use sh4 ctx to get register pointers. prefer offset
Move restoreHostRoundingMode() into Sh4Context
2024-11-09 18:44:51 +01:00
Flyinghead 7c1c5817d3 sh4: move sqWrite func into sh4 context. Simplify usage
Allow passing sh4 context to dynarec canonical implementations
Reduce FPCB padding to PAGE_SIZE except on arm32
2024-11-09 16:54:47 +01:00
Flyinghead e394840344 sh4: pass sh4 context to dynarecs, sh4cycles and caches
Reorder RuntimeBlockInfo members to save space
2024-11-09 13:25:55 +01:00
Flyinghead fc33002284 network: add Golf Shiyouyo 2 ports 2024-11-09 11:44:58 +01:00
Flyinghead dff967f60a ui: notify user when loading a state fails and why 2024-11-09 11:43:10 +01:00
github-actions[bot] a3708a7e95 Fetch translations & Recreate libretro_core_options_intl.h 2024-11-08 22:20:44 +00:00
Flyinghead 1cadeb276e sh4: test fix 2024-11-08 22:01:48 +01:00
Flyinghead 2b28e819e5 sh4: build fix. rounding mode refactoring 2024-11-08 21:34:24 +01:00
Flyinghead db846ca933 sh4: pass context to interpreter funcs. get rid of sh4 regs #define 2024-11-08 18:36:08 +01:00
Flyinghead 9cb7d9e5d5 rec-arm64: fix Store Queue write handlers 2024-11-08 18:27:52 +01:00
Flyinghead 93ae9d0375 sh4: refactor interpreter and recompiler with Sh4Executor interface 2024-11-07 18:14:18 +01:00
Flyinghead e03e11b8a9 arm64: mask value operand when calling a write mem handler
AppleClang doesn't mask the operand in the callee. This must be done in
the dynarec.
See 6115a918b2
Tentative fix for barcode reader not working on macOS/arm
2024-11-07 14:10:02 +01:00
Flyinghead 52df0133f0 sh4: pass sh4 context to sq write handlers 2024-11-06 23:27:20 +01:00
Flyinghead d5aeb482d9 sh4: move sq_buffer into sh4 context 2024-11-06 22:11:27 +01:00
Flyinghead 7eec648690 sh4: move Sh4RegType & GetRegPtr into sh4/dyna
rec-arm: use getRegOffset/reg_nofs instead of GetRegPtr
2024-11-06 20:46:32 +01:00
Flyinghead 897e06b887 sh4: refactor GetDR/SetDR and access to fp registers 2024-11-06 19:26:04 +01:00
Flyinghead aa38771cd0 refactor sh4_sr_GetFull/sh4_sr_SetFull 2024-11-06 18:01:01 +01:00
Flyinghead c77ddba109 get rid of settings.dynarec.disable_nvmem 2024-11-06 17:03:01 +01:00
Flyinghead cd8a88366d get rid of TARGET_NO_EXCEPTIONS 2024-11-06 16:59:16 +01:00
Bobby Smith f892630e4b [Libretro] Add game dir as fall back for arcade BIOSes 2024-11-06 16:46:29 +01:00
Flyinghead 9d4d486524 naomi: add crc32 to GDROM and AW roms 2024-11-06 16:45:42 +01:00
Flyinghead d8a3ee9c3a android: disable openmp affinity on some devices
Disable omp affinity on POCO F5, Redmi Note 12 Turbo, Redmi Note 13 Pro
5G and POCO X6 5G to avoid crashes.
2024-11-06 16:40:11 +01:00
Flyinghead fc6142b332 maple: do a full save of the vmu after loading a state
A partial save might corrupt the vmu file system.
2024-11-04 19:19:31 +01:00
Flyinghead 5fc84acdfb maple: base vmu file name on game ID for multidisk games
Build vmu file name with game ID so that all disks of multidisk games
share the same vmu (A1 only, or all with libretro when enabled).
Rename existing vmu file to new format if none exists.
Issue #1556
2024-11-03 17:14:31 +01:00
Flyinghead 037dc3b4b9 atomiswave: set dma speed to 7 MB/s for all aw games and conversions
AW dma transfer rate seems to be lower than naomi.
Fixes Force Five freeze when starting a game.
Fixes opening sequence animation being truncated in kofxi.
Issue #1724
2024-11-03 16:55:15 +01:00
Flyinghead 96aac66133 naomi: improve performance of M1 and M4 carts dma
Limit buffer size to 1 or 2 KB instead of 32 KB.
Only decrypt right before dma transfer.
Fixes frame drops and audio underruns in vf4evoct attract mode.
Issue #1717
2024-11-02 18:46:49 +01:00
Flyinghead 4d5ced1ce6 maple: add Full Controller with 2 analog sticks and all buttons
add AllStatusReq string for purupuru device.

Issue #1171
2024-11-02 18:13:38 +01:00
scribam da3cfd9d58 deps: update sdl to version 2.30.9 2024-11-02 11:05:35 +01:00
Flyinghead 65aadb9dcb pvr: avoid infinite loop if tile array is invalid
Fixes 240pSuite freeze at boot with the libretro core.
2024-11-02 11:04:56 +01:00
github-actions[bot] cec46990ea Fetch translations & Recreate libretro_core_options_intl.h 2024-11-01 22:21:16 +00:00
Flyinghead 2e5309bfa3 aica: don't batch samples
Batching 32 samples and arm runs causes audio glitches with some wince
games. So run aica 44100 times/sec instead.
Issue #1240
Issue #1605
2024-11-01 14:31:59 +01:00
Flyinghead 742090bb1f rcheevos: disable achievements in naomi slaves 2024-10-29 17:38:52 +01:00
Flyinghead f3a64e5891 android: clean exit when using the exit hotkey
Finish the activity in dc_exit.
Issue #1713
2024-10-29 17:35:25 +01:00
Flyinghead 32ccb754ff libretro: fix translations
Issue #1688
2024-10-29 15:39:17 +01:00
Alexandre Bouvier 32d11dd89c fix missing include 2024-10-26 19:28:20 +02:00
github-actions[bot] 760813e45a Fetch translations & Recreate libretro_core_options_intl.h 2024-10-25 22:20:46 +00:00
Flyinghead e221f6fed2 deadlock when pausing/resuming quickly (android)
Race condition when pausing/resuming is done from a separate thread (android): the renderer gets a result ready status for the previous emu thread, but waits on the newly created one forever.
2024-10-25 08:10:41 +02:00
Flyinghead 8108e63907 rcheevos: race condition in event handlers and async tasks
The data passed to event handlers (achievements in particular) must be
copied if used by an async task. It might be deleted before the async
task runs.
Fixes MINIDUMP-3ZR MINIDUMP-4XJ MINIDUMP-4TB MINIDUMP-4CA MINIDUMP-38H
2024-10-21 16:13:00 +02:00
Flyinghead b0403ed103 imgui: ignore invalid fonts when merging
Avoid crashing in release mode if a merged font is invalid or FontNo
can't be found. The font is simply ignored and the glyph range isn't
loaded.
Fixes MINIDUMP-4TD
2024-10-21 16:03:28 +02:00
Flyinghead c86ed291cf picotcp: use dns.flyca.st as default dns
Use dns.flyca.st as default dns.
Resolve name when pico network starts.
2024-10-19 17:59:24 +02:00
Flyinghead d981c48a75 libretro: fix translations 2024-10-19 12:47:26 +02:00
github-actions[bot] 82925c4e81 Fetch translations & Recreate libretro_core_options_intl.h 2024-10-18 22:20:39 +00:00
Flyinghead 54e8589f63 android: disable import/export home when SAF is disabled. Code clean up
Disable import/export home folder buttons when not using SAF file
picker.
Get rid of unused home migration feature when onboarding.
Android TV screenshots and banner.
2024-10-18 19:23:03 +02:00
Flyinghead 4750ddb646 android: new option to use legacy file picker instead of new SAF one
Android 9 and earlier can use the legacy file browser. This fixes issues
with broken SAF file picker on Android TV 9.
Catch exception when no file picker is installed on the device (Android
TV 12) and instruct the user to install one.
Issue #1657
2024-10-17 16:21:06 +02:00
Flyinghead 894ac54b80 imgui: fix dpad navigation issue on shield tv
Pressing dpad up or down moves the selection 2 lines up or down resp.
Regression due to ca613db70d.
Happens on 1920x1080 screen with 213 dpi.
Relax vertically touching items test.
2024-10-17 16:04:27 +02:00
Flyinghead d4a223656f enable RTT Copy to VRAM for Silent Scope
Fixes VMU display
Issue #1703
2024-10-17 16:00:46 +02:00
Flyinghead b698cc3d10 dx11: reset device context state to fix libretro shaders
Reset device context before each render. Rebind palette and fog textures
every frame.
Fixes corruption with libretro shaders.
Issue #1612
2024-10-15 17:28:54 +02:00
Flyinghead 75af269bb8 rend: ignore inside clipping if rect is default value
Fixes invisible race start countdown in f355 (arcade).
Issue #1698
2024-10-15 15:55:34 +02:00
Flyinghead fd475bdd8e vk: some pipelines don't need the provoking vertex extension
ModVol and OIT Final and Clear pipelines don't need it.
2024-10-14 17:19:41 +02:00
Flyinghead f71dd6d4d8 cdi: better detection of invalid CDI media 2024-10-14 16:45:22 +02:00
Flyinghead 5aec6d05b0 vk: (lr) use one vk::DeviceQueueCreateInfo when possible
Using 2 with the same queue index causes a validation error and crash.
2024-10-14 16:39:33 +02:00
Flyinghead b4937ef271 f355: pass full BIOS path to slaves
if the bios file is located relative to the rom location, slaves won't
be able to find it. Pass the full bios path to avoid the issue.
2024-10-14 16:31:23 +02:00
Flyinghead a50164a91b vk: missing some changes to use VK_FORMAT_R8G8B8A8_UNORM
Fixes Naomi 2 games and android on-screen gamepad.
2024-10-13 14:22:50 +02:00
Wunkolo 595842f606 vk: Remove naomi2 vertex attributes when not needed
Disables the naomi2 vertex input attribute when emitting non-naomi2 pipelines.
This addresses some validation messages involving unused vertex inputs and optimizes the bandwidth of the input assembler a little bit for non-naomi2 games.
2024-10-13 13:26:42 +02:00
Wunkolo 8f74f7883a vk: Use VK_FORMAT_R8G8B8A8_UNORM for vertex colors
Rather than using `VK_FORMAT_R8G8B8A8_UINT` for these vertex attributes and then dividing by `255.0` in each of the shaders, the `VK_FORMAT_R8G8B8A8_UNORM` format will automatically remap byte components into the `0.0-1.0` range and removes the need to do the extra divisions or castings within the shader.
2024-10-13 13:25:40 +02:00
scribam 71dc4c3e39 ci: disable android signing on pull requests 2024-10-13 13:25:02 +02:00
scribam 6edad8eaba android: update gradle and agp 2024-10-13 13:25:02 +02:00
Wunkolo ea1cd9d31b vk: Fix undefined push-constant data
The full push-constant region is 24 bytes(6 floats), but some of these push-constant writes only wrote 20 bytes of data(5 floats).
Causing 4 bytes at the end to be left undefined.
Resolved by pushing an extra zero.
2024-10-13 13:24:27 +02:00
Flyinghead bb7ad07701 extra depth scale for sturmwind
Issue #1691
2024-10-12 17:35:59 +02:00
Flyinghead 9793e54646 avoid deadlock when sh4 cpu is restarted while emu is being stopped
The sh4 cpu is stopped/restarted during a soft reset, and dynarec code
reset (arm64, arm, x86). If the emulator is stopped concurrently, the
call may hang. Use a mutex-protected method to restart the cpu only if
the emu is still running.
2024-10-12 17:31:58 +02:00
Flyinghead 6d2ed417be lr: fix core options to work around translation issue
Adjacent string literals aren't supported.
Fix syntax errors in libretro_core_options_intl.h
Issue #1688
2024-10-12 11:49:12 +02:00
github-actions[bot] d3916f13d7 Fetch translations & Recreate libretro_core_options_intl.h 2024-10-11 22:20:30 +00:00
Flyinghead b2c6159b10 Merge remote-tracking branch 'origin/dev' 2024-10-11 15:28:19 +02:00
Wunk 4d73cc8e13 vk: Add VK_EXT_provoking_vertex optimization (#1681)
* vk: Add `VK_EXT_provoking_vertex` optimization

The dreamcast uses the last vertex as the provoking vertex, while vulkan uses the first vertex.
This requires an additional call to `setFirstProvokingVertex` to reorder the vertices for all incoming geometry.
With `VK_EXT_provoking_vertex`, the pipeline can designate that the provoking vertex is to be the last vertex, which removes the need to re-order incoming geometry on the CPU.

* vk: Propagate physical device API version to VMA

Allows VMA to make assumptions such as using the `*KHR` or non-`KHR` versions of certain function names.

* vk: Refactor libretro device initialization for `VK_EXT_provoking_vertex`

* vk: Top out at vulkan API version to VMA to 1.1

Despite the physical device possibly being 1.2 or 1.3, we only want up to 1.1. Otherwise we will be responsible for other API functions being resolved and loaded when passing to VMA.

* vk: Enable `VK_EXT_provoking_vertex` usage for ModVol and Final(OIT) pipeline

* vk: Enable `VK_EXT_provoking_vertex` for ModVol(OIT) pipeline

Pretty much anything handling dreamcast-geometry should use this extension when available

* vk: Additional `VK_EXT_provoking_vertex` pipeline fixes
2024-10-11 10:23:48 +02:00
Wunkolo 5b343562b9 vk: Add CommandBufferDebugScope utility-type
Adds a new RAII-based utility type for adding diagnostic information to command buffers.
Enabled only when `VK_DEBUG` is set to `1`.
2024-10-09 19:47:14 +02:00
Wunkandflyinghead b20db6a8bb vk: Disable LOD clamping in samplers (#1674)
This addresses the `BestPractices-Arm-vkCreateSampler-lod-clamping` message from ARM:
https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/65b79bac615ec1c47ab61a02d55a3bba871b56b9/layers/best_practices/bp_descriptor.cpp#L103-L110

Rather than clamping the LOD in the samplers, instead rely on the Image-View's `vk::ImageSubresourceRange` to limit the number of sampled LODs.

Currently, only game-textures actually have MipMaps, so this does not introduce any additional mip-map sampling or filtering anywhere. If any code want's to actually limit the number of LODs sampled, then they would allocate an additional ImageView for the range of MipMaps to be sampled.

Co-authored-by: flyinghead <[email protected]>
2024-10-09 19:46:36 +02:00
Wunkolo a8bc1c12f4 vk: Optimize redundant QuadBuffer uploads
Hashes the contents of the `QuadBuffer` vertex-data such that data is only uploaded when the vertices actually change rather than every frame.
2024-10-09 19:40:59 +02:00
Wunkolo b94acb70a6 vk: Use matching u/v/w sampler address-mode when possible
This addresses the `BestPractices-Arm-vkCreateSampler-different-wrapping-modes` message from ARM:
https://github.com/KhronosGroup/Vulkan-ValidationLayers/blob/65b79bac615ec1c47ab61a02d55a3bba871b56b9/layers/best_practices/bp_descriptor.cpp#L95-L100

The `W`-axis for these samplers is always unused, it's never the case that these samplers are going to be used for 3D textures.
ARM suggests trying to keep all of the wrapping-modes the same if possible for performance.

`wRepeat` will be set to the same value as `vRepeat` to try and encourage all three wrapping-modes to be the same.
2024-10-09 19:40:20 +02:00
Wunkolo 0c3f5c7a76 vk: Refactor device/instance extension enablement
* Uses a utility-lambda for repeated extension-adding logic
* Uses an `std::set` for the list of available extensions for quick queries
* `VK_EXT_DEBUG_REPORT` and `VK_EXT_DEBUG_UTILS` aren't device extensions and don't need to be here. They are instance extensions
* Each extension that is tested to be added has a corresponding log message for if it was enabled or if it was unavailable

```
00:00:162 rend\vulkan\vulkan_context.cpp:427 N[RENDERER]: Device extension enabled: VK_KHR_swapchain
00:00:162 rend\vulkan\vulkan_context.cpp:427 N[RENDERER]: Device extension enabled: VK_KHR_get_memory_requirements2
00:00:162 rend\vulkan\vulkan_context.cpp:427 N[RENDERER]: Device extension enabled: VK_KHR_dedicated_allocation
00:00:162 rend\vulkan\vulkan_context.cpp:430 N[RENDERER]: Device extension unavailable: VK_KHR_portability_subset
00:00:162 rend\vulkan\vulkan_context.cpp:430 N[RENDERER]: Device extension unavailable: VK_EXT_debug_marker
```
2024-10-09 19:39:49 +02:00
Flyinghead 03d20f9d5a bug report: ask for flycast version instead of github hash 2024-10-09 19:39:04 +02:00
Flyinghead 01e5cd882c pvr: fix default clipping rectangle
Set default clipping rectangle to max (1280x480).
Fixes Irides: Master of blocks bogus clipping to tile 0,0.
2024-10-09 19:37:42 +02:00
Wunk 556e2ead56 vk: Refactor physical device selection (#1671)
Rather than electing the first physical device it finds, and falling back on the first-listed GPU: a series of stable-partitions are done so that the "least compromising" GPU is selected based on a series of criteria.

It will now maximally try to find a GPU that(in order of priority):
* Is a discrete GPU
* Supports `fragmentStoresAndAtomics`
* Supports `R5G5B5`/`R5G6B5A1`/`R4G4B4A4`

In the case that a system has two dGPUs and one of them supports optimal-formats, the optimal-format one is selected

In the case that a system has an iGPU and the dGPU and they both support optimal formats, the dGPU is selected.

In the case that a system has an iGPU and the dGPU and the dGPU doesn't support optimal formats, the dGPU is still selected.
2024-10-08 17:07:09 +02:00
Wunkolo ff6a3119b0 vk: Determine object type enum when setting object name
Uses compile-time type-information provided by vulkan-hpp to automatically determine a vulkan-object's `objectType` when calling `setObjectName`.
2024-10-08 17:05:32 +02:00
Wunkolo 86657c0c12 Fix {Push,Pop}StyleVar assert
When entering an error or contentpath warning popup, there are two `ImguiStyleVar` on the stack.
Within the pop-up frame, an additional `ImguiStyleVar` is added.
When the popup ends, there is technically one more ImguiStyleVar on the internal stack than when we entered the popup, causing an assert to hit:

```
Program: G:\flycast\out\build\x64-Debug\flycast.exe
File: G:\flycast\core\deps\imgui\imgui.cpp
Line: 10104

Expression: SizeOfStyleVarStack >= g.StyleVarStack.Size && "PushStyleVar/PopStyleVar Mismatch!"
```

These nested imgui RAII objects need to be scoped such that the stack is preserved both upon entry and exit of these popups to avoid these asserts.
2024-10-08 17:05:03 +02:00
Flyinghead d7c168f406 naomi: copy cart dma data in chunks
Copy cart dma data in 1K chunks to avoid transferring all in one shot.
Fixes Soul Surfer and Beach Spiker audio glitches when playing a sample
before it's completely transferred.
Issue #1513
2024-10-08 17:03:00 +02:00
Flyinghead f37e43b26f vk: don't set scissoring in final OIT subpass
If scissoring is enabled, previous framebuffer background isn't drawn
outside of scissor region.
Fixes blinking in Soul Calibur battle loading screen.
Issue #1668
2024-10-08 11:49:34 +02:00
Flyinghead e427c4d5c4 lr: don't set IntOption if overridden
Fixes OIT Max Layers overrides being ignored.
Issue #1610
2024-10-08 11:39:49 +02:00
Wunkolo 56fe3b9c9d Fix arm64_unwind.h include-order
`sh4_core.h` has defines for symbols like `r` and `pr` which conflict with the variable names in `arm64_unwind.h` and cause even deeper errors over in `wingdi.h(4954)` and `wincrypt.h(4741)`.

Swapping the include order avoids this collision.
2024-10-07 18:48:26 +02:00
Flyinghead 30bb864b37 vulkan: check image usage flags if image already exists during RTT
Recreate image if usage flags are incorrect.
Fixes vk validation error in Virtua Tennis player list selection screen.
Issue #1664
2024-10-07 18:47:52 +02:00
nbFlyinghead d689c50e21 naomi: increase dma xfer rate except for force five
Revert 54ac9c6361 but make an exception
for force five. Issue #141
Fixes loud music in beach spikers and soul surfers. Issue #1513
Fixes some menu textures not being loaded in F355.
2024-10-05 13:30:36 +02:00
Flyinghead efd71b3a44 Storage::getParentPath can throw 2024-10-04 16:51:08 +02:00
Flyinghead 5450646b5c android: add virtual gamepad transparency setting
Issue #384
2024-10-04 16:45:28 +02:00
Flyinghead 55e0211a57 android: use ASS to select custom adreno driver 2024-10-04 16:36:56 +02:00
Flyinghead 5d719e0b49 rend: unexpected conversion to unsigned for VO_STARTX/Y with msvc
MSVC converts VO_STARTX and VO_STARTY bit-field values to unsigned int,
leading to an overflow when the result is negative.
Issue #1606
2024-10-03 18:03:55 +02:00
Flyinghead e10a9929da Set OIT max layers for more games
Issue #1610
2024-10-03 17:56:30 +02:00
scribam 3d41e4ea3e deps: update sdl to version 2.30.8 2024-10-02 19:50:37 +02:00
Flyinghead 2dd4cbe33d vk oit: draw transparent polys in the first frame after (re)init
Fixes missing background in progress window in Fighting Force 2
Issue #1652
2024-09-29 16:42:38 +02:00
Flyinghead 2653c5ed73 naomi2: fix modifier volumes clipping
Don't clip modifier volumes but tesselate triangles intersecting the
near plane. Then project clipped vertices onto it in the vertex shader.
Issue #1651
2024-09-29 16:42:38 +02:00
github-actions[bot] 343021a8c5 Fetch translations & Recreate libretro_core_options_intl.h 2024-09-27 22:20:38 +00:00
flyinghead 7907100b9c dx11: wrong texture returned to libretro in some cases
If a render to texture happens before presenting the current frame,
another texture will be bound to shader slot #0 and will be returned to
the libretro frontend.
Issue #1616 and #1619
2024-09-25 21:57:15 +02:00
Flyinghead f179c00bdd gl: fix Delay Frame Swapping pacing issue on android
Partial revert of c83b0e325f.
Fix root issue in OpenGLRenderer::DrawOSD.
2024-09-24 14:50:41 +02:00
Flyinghead c83b0e325f android: fix Delay Frame Swapping sync issue. ANR in single-threaded
Framebuffer swap should only be called when a new frame has been
rendered.
ANR when stopping the emulator in single-threaded mode: race condition
causes stopRequested to not be handled, and Pause event is never sent.
2024-09-24 11:54:15 +02:00
Flyinghead 210e8ca6e3 android: get rid of ouya sdk 2024-09-23 20:46:33 +02:00
Flyinghead a46dc71156 android: target android 14 / sdk 34 2024-09-23 18:01:21 +02:00
Flyinghead 4baf529ff7 race condition when stopping emu thread right after start
In threaded rendering, CpuRunning is set after the emu thread is
started. If calling Emulator::stop() before it is set, the call will
hang.
2024-09-23 17:43:23 +02:00
Flyinghead 63ef3aaab4 android: avoid crash when app is run in restricted mode
App may be run in restricted mode, where the Application object is a
generic android.app.Application. Disallow backup to avoid this. If
Application object isn't of the expected type, restart the app.
2024-09-23 17:21:02 +02:00
Flyinghead abe71409b5 android: race condition with render thread. ANR with auto save state
Race condition when starting then stopping the render thread:
mainui_enabled isn't set until after the thread has started. If stopped
during that time, it will hang.
Auto save state in a background thread to avoid ANR.
2024-09-23 17:17:46 +02:00
Flyinghead f8c12d2835 android: fix getFileInfo for document uri. cheats: limit file size
android: Fix AndroidStorage.getFileInfo for document uri (cheat file)
cheats: limit cheat file size to 1MB to avoid parsing garbage forever. Save file path only if valid.
2024-09-23 17:08:57 +02:00
github-actions[bot] 92555c68c6 Fetch translations & Recreate libretro_core_options_intl.h 2024-09-20 22:20:53 +00:00
Flyinghead 915532f946 vk: don't depend on current clamping values when compiling shader
Fog clamping values may change so the shader shouldn't depend on the
current value when compiling.
Fixes Red Dog Superior Firepower glitch.
Issue #1642
2024-09-18 11:34:35 +02:00
Flyinghead 079180faab Force PAL for Snow Surfer. Increase Max Layers for some games.
Force PAL broadcast for Snow Surfer.
Issue #1643
Increase max layers for Soldier of Fortune, BANG! Gunship Elite and MDK
2.
Issue #1610
2024-09-18 11:30:46 +02:00
Flyinghead 38de2868a0 sgdrvsim: axis 0 is master audio volume, not wheel
Use (unused) axis 4 instead. Wheel position is read with the ffb drive
board, not JVS.
Map clutch to left trigger 2.
Issue #1636
2024-09-16 18:26:13 +02:00
Flyinghead 0e97f97bb7 android: virtual gamepad rumble power wasn't set at app startup
Make sure emu.cfg is loaded before setting rumble power.
Issue #1640
2024-09-16 11:28:25 +02:00
Flyinghead 64d7199107 Merge remote-tracking branch 'origin/master' into dev 2024-09-16 11:16:04 +02:00
scribam 0077b8ecec deps: update sdl to version 2.30.7 2024-09-08 16:24:37 +02:00
Flyinghead 5393235c40 aica: skip remaining step functions when channel is disabled
CA is reset to 0 when channel is disabled due to AEG and this value must
not be changed.
Issue #472 and #1180
2024-09-07 14:55:45 +02:00
Flyinghead a81a02f14b maple: save rfid card after decrementing counter
Issue #1626
2024-09-07 14:50:29 +02:00
github-actions[bot] 480f93e50d Fetch translations & Recreate libretro_core_options_intl.h 2024-09-06 22:21:05 +00:00
Flyinghead 7174ef1194 naomi: full rfid chip emulation for mushiking series
Fixes hang after playing 3 games.
Issue #1626
2024-09-04 09:48:34 +02:00
Flyinghead f039a809da naomi: limit max analog values to avoid overflow
Fixes overflow in wild riders when going full right or full accel/brake.
Follow up to Issue #1627
2024-09-02 17:04:17 +02:00
Flyinghead 1223154665 jvs: fix analog axes values encoding
The least significant byte of analog axis values seems to be handled as
signed.
Fixes crazy taxi going right when turning full left.
Issue #1627
2024-09-01 18:41:37 +02:00
Flyinghead 8cb847940b vk oit: attachment 0 must be loaded too
Issue #1614
2024-09-01 18:41:37 +02:00
github-actions[bot] 9691fe9622 Fetch translations & Recreate libretro_core_options_intl.h 2024-08-30 22:20:34 +00:00
Flyinghead c575eac89b naomi: add mushik4t rom 2024-08-30 17:49:07 +02:00
Flyinghead b468c9bdae aica: reset CA to 0 when disabling channel due to AEG
CA was reset to 0 for non-looping sound when ending, but not for looping
ones when they reach full attenuation. This confuses some games.
Disable the channel when it reaches full attenuation and reset CA to 0.
Revert a7702c622a
Issue #1602
Better fix for
Issues #472, #483, #1180, #1249, #1030 (partial)
2024-08-29 13:09:39 +02:00
Flyinghead 368bd17ae0 vk: use swap_chain_size + 1 semaphores
Fixes validation error VUID-vkAcquireNextImageKHR-semaphore-01779
introduced in vulkan sdk 1.3.275
Issue #1620
2024-08-29 13:01:11 +02:00
Flyinghead 757732d0f8 vk oit: load correct attachment. Only reset pipelines when needed
Fixes partial renders: ECCO initial sequence.
Issue #1614
Don't reset pipelines when resizing framebuffer.
2024-08-29 12:57:10 +02:00
Flyinghead 0ff9caf656 ci: make breakpad optional on all platforms
Issue #739
2024-08-29 12:06:29 +02:00
Flyinghead a93bd9e64e Merge remote-tracking branch 'origin/playstore' into dev 2024-08-24 18:08:59 +02:00
Flyinghead 308d9fc1ac Increase max transparent layers for some games
Issue #1604
Add 96 layers option to libretro core.
Issue #1610
2024-08-24 16:49:16 +02:00
Flyinghead 7a27a43ba4 vulkan: Fix multipass RTT in OIT mode
Use correct temp attachment depending on pass count. Keep attachment
index to bind the correct one before final subpass.
Use correct initial layout for OP+PT attachment 1 (was eUndefined) when
creating the RTT render pass.
Fixes Alone in the Dark cutscenes.
Issue #1609

Recreate RTT attachments if switching CopyToVRAM on/off.
2024-08-24 16:37:52 +02:00
Flyinghead 244bb724c9 naomi: add FFB support for Tokyo Bus Guide
Only rumble seems to be used.
Issue #1601

Add info about awave BIOS
2024-08-24 16:29:29 +02:00
github-actions[bot] 349083030d Fetch translations & Recreate libretro_core_options_intl.h 2024-08-23 22:20:21 +00:00
Flyinghead b99b3450c8 sh4: compute fsrra as 1/sqrt(x) instead of sqrt(1/x)
Fixes invisible chaos emerald in Sonic Adventure cutscene after Emerald
Coast.
Partial revert of ec3ad9b.
Issue #1600
2024-08-20 21:12:05 +02:00
Flyinghead 6061d402bd build fix 2024-08-17 18:08:53 +02:00
Flyinghead 4d06743d9a gdrom: don't crash on unsupported sector size
Fixes MINIDUMP-284
2024-08-17 17:56:35 +02:00
Flyinghead af7353225b pvr: rgb888 needs to be correctly aligned when xclip.min != 0
Fixes glitchy combat opening animation in soul calibur (with full
framebuffer emulation). Use slower but correct method instead.
Issue #1591
2024-08-17 17:29:32 +02:00
Flyinghead cb0b667129 maple: don't assert dma interrupt if using hardware dma trigger
Fixes Virtua Cop 2 pause when shooting. Regression due to ecce915
Issue #474
2024-08-17 17:23:34 +02:00
Flyinghead 00f60a3d62 win32: don't compile clock.c with clang
Issue #1588
2024-08-17 17:08:40 +02:00
github-actions[bot] 5565b79b9e Fetch translations & Recreate libretro_core_options_intl.h 2024-08-16 22:20:19 +00:00
Flyinghead 8ea12443d3 android: fix touchscreen coords when view is scaled
Samsung phones/tablets can scale down the emulator view to improve
performance. In this case, getPointerCoords() returns screen, not view
coordinates. Use MotionEvent.getX/Y() instead.
2024-08-16 13:12:27 +02:00
Flyinghead 6679cb2f31 android: show/hide keyboard in main thread to avoid deadlock
Tentative fix for deadlock when main thread is calling
JNIdc.rendinitNative(null), and render thread is blocked on a lock
trying to hide on-screen keyboard.
2024-08-16 10:17:06 +02:00
Flyinghead f1fd8b12e2 android: do all rumble/haptic on background thread
Haptic effects for the virtual gamepad must be done on a background
thread. Not sure about gamepad rumble but it shouldn't hurt.
Reuse haptic duration for haptic power (0-100).
Fix crash when power is zero (createOneShot needs power >= 1)
2024-08-15 17:25:02 +02:00
Flyinghead ecb468a723 msvc build fix 2024-08-15 13:05:02 +02:00
Flyinghead fbe7cc8fe3 input: crash when setting the keyboard to port None
Issue #1593
2024-08-15 12:28:22 +02:00
Flyinghead aafa9f0bf0 android: intent url ignored unless external storage legacy is enabled
Issue #1584

Accept fileDir (internal storage) as home folder in case it was created
without external storage.
2024-08-15 12:09:27 +02:00
Flyinghead dae3676979 android: NPE in NativeGLView when Emulator.currentActivity is null 2024-08-15 11:58:45 +02:00
Flyinghead 09ab139407 android: deadlock when Emulator::checkStatus is called concurrently
If checkStatus(wait = true) is called, any other thread will be blocked
even when calling with wait = false since the mutex is locked. This
happens on Android when JNIdc.rendinitNative(null) is called by the app
main thread.
Use a shared_future instead and unlock the mutex before waiting.
2024-08-15 11:55:07 +02:00
Flyinghead 138adc28d7 android: ANR when loading cheat file 2024-08-13 17:41:40 +02:00
Flyinghead 9fd80b952a Storage::getSubPath can throw if path doesn't exist (android) 2024-08-13 17:38:23 +02:00
Flyinghead a058481e36 oboe: log record stream buffer capacity, not output stream
Fixes MINIDUMP-43E
2024-08-13 17:18:31 +02:00
scribam 45bf218df4 ci: bump actions/setup-python to v5 2024-07-29 16:45:12 +02:00
scribam 6b3e86619e deps: fix libzip compilation error with gcc 14.1 2024-07-28 20:02:34 +02:00
scribam 56b8bb1245 vk: cleanup
* Use constants for extension names
* Prefer VK_USE_PLATFORM_* constants
* Remove IOS_MVK/MACOS_MVK deprecated code
2024-07-28 20:02:34 +02:00
scribam cea80560db deps: update submodules
* discord-rpc: use upstream repository
* googletest: v1.15.0
* libchdr: master
* oboe: v1.9.0
* rcheevos: v11.5.0
2024-07-28 20:02:34 +02:00
scribam 088c1e6b0d unit: build fix for apple platform when ctest is enabled 2024-07-28 20:02:34 +02:00
scribam bb048dea8f ci: use default xcode version
Currently, it is Xcode 15.4
2024-07-28 20:02:34 +02:00
scribam 588dca2bfd cmake: cleanup
* Set min macos deployment version to 10.13. This is the lowest version supported by Xcode 14.3.1 and 15+
* Prefer target_compile_options to add compilation flags
* Simplify macos custom commands with TARGET_FILE and TARGET_FILE_DIR
* Do not install discord-rpc and libzip files
2024-07-28 20:02:34 +02:00
github-actions[bot] 3afa4322f1 Fetch translations & Recreate libretro_core_options_intl.h 2024-07-26 22:20:39 +00:00
Flyinghead 33d1dafdb7 android: revert changesNotSentForReview param change
Probably due to the current weather conditions at google's HQ
2024-07-20 10:58:26 +02:00
Flyinghead 8b2c1bc5dc android: bug fixes
onInputDeviceAdded may be called with an invalid device id. Avoid NPE
onGenericMotionEvent: event may have a null device. Avoid NPE
getExternalFilesDir may return null if no external storage available.
Use getFilesDir in this case.
Catch exceptions in HomeMover and continue.
addStorage: catch SecurityException and alert user. Graceful failure.
2024-07-20 10:30:27 +02:00
Flyinghead 2b83df86cd boxart: don't save database when pausing (android, uwp)
Avoids ANR on android. Unnecessary since database is now saved
regularly.
2024-07-20 10:07:18 +02:00
github-actions[bot] 0b6b8b3753 Fetch translations & Recreate libretro_core_options_intl.h 2024-07-19 22:21:06 +00:00
Flyinghead 53d092c326 naomi: set SB_GDSTARD and SB_GDLEND when starting dma
Fixes toukon4 fmv freeze
Issue #1582
2024-07-17 10:05:58 +02:00
flyinghead bfba850ee7 Google Play install link 2024-07-16 09:49:29 +02:00
scribam db5a4d1247 ci: add lua54 for freebsd and netbsd 2024-07-14 10:32:33 +02:00
scribam 3ad00596a1 ci: use freebsd 14.1 2024-07-14 10:32:33 +02:00
Flyinghead 39e04b07b8 Merge remote-tracking branch 'origin/dev' 2024-07-11 18:27:44 +02:00
Flyinghead b9cbf3e47f lr: get rid of trash 2024-07-11 18:27:31 +02:00
Flyinghead 72d9ad34dc google play: don't send changes for review automatically 2024-07-08 17:15:42 +02:00
Flyinghead e72a867363 ui: only show dreamcast bios entry if bios present 2024-07-08 16:49:20 +02:00
scribam 2a4356e72c deps: update sdl to version 2.30.5 2024-07-06 14:04:24 +02:00
Flyinghead 136ce267dc aica: apply 6dB attenuation after adding channels in mono
Less saturation with sega bass fishing challenge's default audio
settings.
Issue #1564
2024-07-06 14:03:48 +02:00
github-actions[bot] c6f50fad9d Fetch translations & Recreate libretro_core_options_intl.h 2024-07-05 22:20:32 +00:00
Flyinghead 916afeb5ef Fix Cool Boarders Burrrn game id
Issue #1073
Issue #1265
2024-07-04 09:00:30 +02:00
Flyinghead 81842ccc23 Cool Boarders Burrn and Castle Fantasia fixes
Force HLE Bios for Cool Boarders Burrn.
Issue #1073
Force Copy to VRAM for Cool Boarders Burrn and Castle Fantasia.
Issue #1265
2024-07-03 17:38:23 +02:00
Flyinghead 4fdd28fab7 rend: intersect poly clipping with base clipping
Fixes glitch in FluffMatch split-screen (Fur Fighters)
Issue #145
2024-07-03 11:13:51 +02:00
Flyinghead a01edd22c7 Merge remote-tracking branch 'origin/dev' into playstore 2024-06-30 11:24:46 +02:00
Edward Li c1f5f2e8f9 Do the conversion in Oboe to try to get a low latency stream 2024-06-30 10:36:44 +02:00
scribam f6c1503887 deps: update sdl to version 2.30.4 2024-06-25 14:02:58 +02:00
scribam 71982eda7a miniupnp: add support for api version 18 2024-06-25 14:02:31 +02:00
Flyinghead fefdb6c661 Merge remote-tracking branch 'origin/master' into dev 2024-06-23 16:15:13 +02:00
Flyinghead 4dd490034a android: disable home folder migration 2024-06-23 16:13:28 +02:00
Flyinghead 719fd70860 sdl: always open haptic interface. use default rumble except for wheels
Always open joysticks haptic interface if available and create FFB
effects if supported.
Use default joystick rumble except for racing wheels (sine effect)
Revert 4e3d1caf3f
2024-06-23 16:06:50 +02:00
Flyinghead 49ad2b6864 naomi: save printer output as a screenshot
Use hostfs::saveScreenshot()
2024-06-23 16:00:31 +02:00
scribam 7d645541f8 ci: remove brew zstd 2024-06-23 11:15:34 +02:00
Flyinghead f50d6204dd android: tentative fix for touchscreen not working on android 14
Use more generic source test to detect touch events. Also get rid of
Retroid Pocket 2+ specific test.
Issue #1421
2024-06-23 11:05:40 +02:00
Flyinghead e270621a03 f355: fix gearbox and clutch mappings 2024-06-22 21:40:07 +02:00
Flyinghead 07172416c1 android: tentative fix for touchscreen not working on android 14
Use more generic source test to detect touch events. Also get rid of
Retroid Pocket 2+ specific test.
Issue #1421
2024-06-22 15:07:05 +02:00
github-actions[bot] f9dcd08cf3 Fetch translations & Recreate libretro_core_options_intl.h 2024-06-21 22:20:38 +00:00
Flyinghead 83a27b9125 android: import/export home folder
Use "folder" instead of "directory" in UI.
When game list is empty, show button to easily add a new content path.
Improve folder paths display in settings with middle ellipsis.
android: import/export home folder content
2024-06-21 18:37:34 +02:00
Flyinghead 9976fe10fb android: gamepad rumble support (untested)
Use single thread to handle rumble for virtual and physical gamepads.
Use heavy click effect for vgamepad buttons when available (android 10)
Handle rumble inclination param.
2024-06-21 18:32:25 +02:00
Flyinghead af7edadedb Merge remote-tracking branch 'origin/dev' into playstore 2024-06-21 18:20:40 +02:00
Flyinghead d882c48b4f android screenshots 2024-06-20 18:18:01 +02:00
Flyinghead d92790e69f sh4: incorrect div1 implementation if Rn == Rm 2024-06-20 18:12:11 +02:00
Flyinghead 5eef0309bf Merge remote-tracking branch 'origin/master' into dev 2024-06-20 18:02:36 +02:00
Flyinghead 5f88293fbd discord-rpc: disable clang-format 2024-06-19 15:08:09 +02:00
Flyinghead 245b9043c5 gl: GL_READ_FRAMEBUFFER doesn't exist in GLES2
and glBindFramebuffer isn't needed at this point
2024-06-19 15:06:13 +02:00
Flyinghead e3a1440e25 achievements: don't log token 2024-06-19 15:04:49 +02:00
Flyinghead 0a9eaa6cb8 android: storage fixes
storage: add file update date to FileInfo.
Savestates and custom textures can be loaded from content path / ASS.
Cache last savestate update date to improve perf on android.
android: Don't use scoped storage for android < 5. Optimize listContent.
Fix getSubPath
android: instrumented storage test
2024-06-17 09:53:32 +02:00
Flyinghead e4ca99afba android ci: bump versionCode on each run 2024-06-14 15:36:12 +02:00
Flyinghead e5ccf98693 android ci: set track to internal 2024-06-14 14:31:28 +02:00
Flyinghead e832509175 android ci: missing keystore password 2024-06-14 13:16:15 +02:00
Flyinghead 977d6c6f95 android: upload to google play 2024-06-14 12:59:19 +02:00
Flyinghead 2103dd5a7a storage: add exists() method. load bios from content path. android fix
Add Storage::exists() method
Allow dc and arcade bios to be loaded from content path.
Fix android getSubPath when called on a root uri.
2024-06-14 12:39:32 +02:00
Flyinghead 9df12f950b android: target android 13
disable non-android CI jobs
2024-06-13 20:25:12 +02:00
Flyinghead 272f25ceb3 discord-rpc: disable clang-format 2024-06-13 16:49:34 +02:00
Flyinghead 46340e7e77 ui: add title to select file/folder popups. fix frame padding
android: always do write test in new home folder
2024-06-13 16:05:36 +02:00
Flyinghead aed4d21a4f android: prepare transition to sdk 30+. cache last savestate path
Migrate home folder to externalFilesDir
(/sdcard/Android/data/com.flycast.emulator/files) if running on android
10+.
Use externalFilesDir for home by default. No more onboarding on first
install.
Use content uri instead of hacking out real path since the latter won't
work on higher target sdk.
Cache last readable savestate path in hostfs::getSavestatePath(). All
content folders are scanned when not found, which is very slow with ASS
2024-06-13 15:36:29 +02:00
Flyinghead 9b4667cb38 windows: less log when Storage::getFileInfo fails 2024-06-12 11:08:24 +02:00
Flyinghead ec3ad9b328 sh4: use double for fipr and ftrv. divide before sqrt for fsrra. ssa fix
dynarec: use double to implement fipr and ftrv except on arm32
interpreter: always use double for fipr and ftrv
fsrra: perform division before square root
fmac: use std::fma or native fma op
get rid of unused dynarec op shop_swap
ssa: dead register pass must assume interpreter fallback modifies all
registers
ssa: replace reg+0 address by reg in constant propagation pass
decoder: replace address offset 0 by null param for indexed mem access
2024-06-12 10:54:15 +02:00
Flyinghead ca613db70d ui: better pause menu dpad nav. minor ui fixes
Tweak imgui nav algorithm to improve pause menu nav with dpad.
Imgui widgets name conflicts on network settings tab
2024-06-11 17:31:36 +02:00
Flyinghead 9fd48e7de3 wrong id for capcom vs snk millenium fight 2000 PRO (cvsgd) 2024-06-11 16:49:21 +02:00
Flyinghead 1277a8ff13 fix auto savestate
Automatic save state when unloading the game stopped working
Regression introduced by 6f0581032b
2024-06-11 16:44:42 +02:00
Flyinghead 8adec3f20b achievements: crash when unloading a game with active async task
Async tasks may reference the active game and will crash if it's been
unloaded/freed.
Fixes MINIDUMP-38H
2024-06-11 16:38:30 +02:00
scribam 9aa7371d82 deps: update imgui to version 1.90.8 2024-06-09 15:39:10 +02:00
scribam 0bf1877d96 cmake: use fallback git values 2024-06-09 15:38:39 +02:00
Flyinghead 4cd6278104 rend: force palette update when setting dx order. extra depth for cvs
Force palette update when changing directx color order.
Add 10k extra depth scale to Capcom vs SNK 2000 Pro and cvs.zip to fix
winner character portraits not appearing during ending.
Issue #1546
2024-06-08 16:43:52 +02:00
github-actions[bot] 14b8d4e915 Fetch translations & Recreate libretro_core_options_intl.h 2024-06-07 22:20:06 +00:00
sandboxgamedev123 ddb012bbd2 Add a 32-bit AppImage Script for Linux (#1539) 2024-06-05 15:54:41 +02:00
Flyinghead bfe09667f4 disable native depth interp for mortal kombat. force JP for vonot
Revert (again) forcing native depth interp for AMD gpus
Disable native depth interpolation for Mortal Kombat
Issue #1145
Force Japanese bios for vonot
Issue #1542
2024-06-05 15:53:08 +02:00
Flyinghead 4e3d1caf3f input: temporary logging for failed haptic effects 2024-06-04 13:27:26 +02:00
Flyinghead 6777aa39cb ui: disable dx9 selection if a naomi 2 game is running
Issue #1448
2024-06-03 19:25:22 +02:00
Flyinghead 9bdaa6c40b naomi: drop support for gdi. default to first bios region found
Use the first BIOS region found if the requested one can't be located.
2024-06-03 19:08:19 +02:00
Flyinghead 021249c321 update screenshots (flatpak, AltStore) 2024-06-02 17:33:47 +02:00
Flyinghead e7a4e64a6b android: fix imgui crash when editing virtual gamepad layout
Happens with openGL
Fixes MINIDUMP-374
2024-06-02 17:28:55 +02:00
scribam b840a4f477 windows: fix unit tests 2024-06-01 19:05:23 +02:00
Flyinghead bad55204f2 android: rename packages and activities 2024-06-01 19:03:58 +02:00
Edward Li 70fe47dacf Pretty print for Xcode 15 console 2024-06-01 11:13:24 +02:00
Edward Li 24e579ed99 Fix macOS debug build crash by providing a non empty ID (for the root of a window) 2024-06-01 11:13:24 +02:00
Flyinghead 8ddbe9212a Merge remote-tracking branch 'origin/master' into dev 2024-06-01 11:06:45 +02:00
Flyinghead adeba60ba9 input: ffb support for arcade games. rumble support (f355, 18wheeler)
SDL force feedback for racing wheels.
Support for jvs ffb (f355, 18wheeler), atomiswave (maxspeed, ftspeed)
and midi ffb (initd, clubk, kingrt66, sgdrvsim).
Simple haptic rumble for f355 and 18wheeler.
2024-06-01 11:03:14 +02:00
scribam 95de83431b uwp: fix http ContentLength assignment 2024-05-31 17:34:31 +02:00
scribam 112e05ed5d libzip: enable zstd 2024-05-31 17:34:01 +02:00
Blackbird88 90896368b8 Cheats: Sega GT (USA) - Widescreen cheat 2024-05-27 10:03:55 +02:00
Relwi ce46d1a383 Update README.md
Remove an unnecessary backtick
2024-05-27 10:03:24 +02:00
Flyinghead c1abadb6cd achievements: race condition. pause management. imgui fixes
Race condition when promise is deleted before the future is created
(login)
Require username and password before login.
Disallow pause in hardcore mode when needed.
imgui: fix some failing assertions

Issue #761
Fixes MINIDUMP-35Y, MINIDUMP-34A, MINIDUMP-35K, MINIDUMP-34Y
2024-05-27 10:02:43 +02:00
github-actions[bot] e85fa82101 Fetch translations & Recreate libretro_core_options_intl.h 2024-05-24 22:19:56 +00:00
Flyinghead 0a0d30309b achievements: run all http requests on a background thread
Fixes freeze when unlocking cheevos and other events.
Issue #761
2024-05-24 18:00:28 +02:00
Eric Warmenhoven 30e5466d90 libretro build fix on apple 2024-05-24 08:28:44 +02:00
Blackbird88 48dfab7397 Cheats: Faster Than Speed (Atomiswave) - Widescreen cheat 2024-05-24 08:28:11 +02:00
Flyinghead 4747252187 Merge remote-tracking branch 'origin/dev' 2024-05-23 10:40:57 +02:00
scribam a5608f4f22 android: update project
- Upgrade AGP dependency from 8.3.0 to 8.4.1
- Upgrade Gradle version to 8.6
- Use version catalogs
2024-05-22 16:16:07 +02:00
scribam 20652516e7 deps: update sdl to version 2.30.3 2024-05-22 16:15:40 +02:00
scribam f05e5f3582 deps: update libchdr 2024-05-22 16:15:40 +02:00
scribam 72e892a77e deps: update imgui to version 1.90.6 2024-05-22 16:15:40 +02:00
scribam 0fa3e9a37b cmake: better version conversion for uwp 2024-05-21 10:59:10 +02:00
Flyinghead 1256680a99 lr: Delay Frame Swapping should be enabled by default 2024-05-21 10:45:50 +02:00
Flyinghead 81bebdb900 cheats: fix floigan bros (pal) cheat
this cheat shouldn't be used for the ntsc version.
2024-05-21 10:41:21 +02:00
Flyinghead 6cc64c18dd network: add ports for dee dee planet, floigan bros, IGP and tetris 2024-05-21 10:40:01 +02:00
scribam 6b18ad7e3e cmake: better version conversion for uwp 2024-05-18 13:15:12 +02:00
Edward Li 2797cca5ff Always use BSD sed 2024-05-18 12:37:10 +02:00
Flyinghead b7a2e605f9 dx11: use ALLOW_TEARING flag to disable vsync if available 2024-05-18 12:36:29 +02:00
Flyinghead ec82c7b9ed gl: only display crosshairs when needed
regression due to 4f834610b3
2024-05-18 12:11:08 +02:00
github-actions[bot] 88f23958ac Fetch translations & Recreate libretro_core_options_intl.h 2024-05-17 22:19:56 +00:00
Flyinghead 4f834610b3 gl: refactor vmu and xhair drawing. Blit rendered frame only once
Refactor vmu and xhair drawing to use the same code as libretro.
Fix an issue were each rendered frame was blit twice to the backbuffer.
2024-05-17 17:37:32 +02:00
Flyinghead e2e9a54e0e std::swap is undefined for vector<bool> 2024-05-15 14:20:13 +02:00
Flyinghead cc56b0fbae vk: multi render support
Fixes Quake III split screen vs. and MSR rear view mirror.
Issue #1511
2024-05-15 14:01:58 +02:00
Flyinghead 5755c5b3c6 fix compile warning 2024-05-15 12:33:06 +02:00
Flyinghead 34216f77af naomi: fix marstv freeze
Force JP BIOS version D for this game.
Issue #1508
2024-05-15 11:55:06 +02:00
Flyinghead 21c77adc4d os_notify 2024-05-14 22:43:55 +02:00
Flyinghead 35acb7e62c ui: load savestate thumbnails asynchronously. limit thumbnail size
GetLastFrame can take max width or height.
Limit width of savestate screenshot to 640.
Load savestate thumbnail in async task.
2024-05-14 14:23:40 +02:00
Flyinghead b5f49d6c3a ios build fix 2024-05-13 16:27:31 +02:00
Flyinghead de403a6203 switch, uwp, libretro build fixes 2024-05-13 16:12:32 +02:00
Flyinghead 6f0581032b save screenshot. add screenshot to savestates
Retrieve last frame rgb data (gl, vk, dx9, dx11).
Specific save screenshot code for android, iOS and UWP.
Add Save Screenshot emu key (F12 by default)
vk: defer deletion of in-flight textures when texture cache is cleared.
vk: fix issue when updating imgui textures after a render pass has begun
(achievements)
vk: palette texture not updated after a state has been loaded.
gl: Move opengl-specific stuff into opengl imgui driver.
savestate: Add non compressed header, following by screenshot png data,
before actual savestate.

Issue #842
2024-05-13 15:47:34 +02:00
Blackbird88 f13d7ad2dc Cheats: Tokyo Xtreme Racer 1 (USA) - Widescreen cheat 2024-05-11 17:06:31 +02:00
github-actions[bot] 90b06a688b Fetch translations & Recreate libretro_core_options_intl.h 2024-05-10 22:19:57 +00:00
Blackbird 1b6b61d253 Cheats: Tokyo Xtreme Racer 2 fix
Fixes broken cheat
2024-05-10 11:40:58 +02:00
Flyinghead 83493cc14b achievements: fix size of multiple challenge indicators popup
Issue #761
2024-05-09 18:26:28 +02:00
Flyinghead 9bf60dde3c ui: bug fixes. cheats window changes
Fix boxart list navigation with DPad (regression).
Get rid of several bogus PopStyleVar/PopID.
Better navigation of pause menu buttons.
imgui: tweak NavScoreItem to help pause menu nav.
Allow achievement list navigation with DPad.
Open cheats window fullscreen. Open Add Cheat window as a modal popup.
Add game_scanner.cpp
2024-05-09 10:21:56 +02:00
Flyinghead 24954ec599 work around mingw-w64 init crash
commit https://sourceforge.net/p/mingw-w64/mingw-w64/ci/7b33798917a50cf023f1622eee8eba6d7874b796/
introduces a static initialization order fiasco if a static object is
calling clock_gettime() in its constructor.
2024-05-09 10:19:33 +02:00
Flyinghead c53a1c42c6 work around mingw-w64 init crash
commit https://sourceforge.net/p/mingw-w64/mingw-w64/ci/7b33798917a50cf023f1622eee8eba6d7874b796/
introduces a static initialization order fiasco if a static object is
calling clock_gettime() in its constructor.
2024-05-07 22:33:46 +02:00
Flyinghead 13302b87c8 move ui to its own folder 2024-05-07 22:23:51 +02:00
Flyinghead f76d05a3d5 achievements: leaderboard notifications. detailed toast message
Draw achievement notifications using imgui drawlist api
Fixes for insets
Issue #761
2024-05-07 17:50:36 +02:00
Flyinghead 763d9ce06a ui: split display_settings 2024-05-06 22:26:09 +02:00
Flyinghead 6ab43096a2 ui: use uiScaled() 2024-05-06 21:54:55 +02:00
Flyinghead ceec01ac2e ui: use imgui for vmu on pause menu. toast notifications
Allow nearest sampling with imgui textures (vmu, crosshair)
Use raii for styles and colors
2024-05-06 21:31:04 +02:00
Flyinghead 7327e52e71 ui: crash when loading asian fonts on windows
FontNo must be reset to 0 for Font Awesome.
Issue #1503
Fixes MINIDUMP-314
2024-05-06 14:45:28 +02:00
Flyinghead f04e9d4a65 achievements: better game load message when no achievements
Issue #761
2024-05-06 14:35:00 +02:00
Flyinghead c386f64faa macos: bump minimum macOS version to 10.11 to avoid build error 2024-05-05 16:06:57 +02:00
Flyinghead ff33ff2b88 ui: change pause menu layout. add icons here and there
Always display savestate absolute date.
2024-05-05 16:02:37 +02:00
Edward Li 17db07703e Use Xcode 15.3 2024-05-04 20:53:24 +02:00
Flyinghead 75f64efe93 fix buymeacoffee 'username' 2024-05-04 20:35:11 +02:00
Flyinghead ab8b4f0e54 buymeacoffee funding
stricter deserialize verify for broadcast/cable/region
2024-05-04 20:33:37 +02:00
Flyinghead 43ba8953a2 vk: don't delete the ImGui driver when recreating the swap chain
It might be drawing at this point so just reset it.
2024-05-04 19:24:02 +02:00
Flyinghead 6de2f160a1 achievements: hardcore mode 2024-05-04 17:38:42 +02:00
flyinghead ccc9931de8 achievements: fix crash when loading image cache
Fixes MINIDUMP-312, MINIDUMP-313
Issue #761
2024-05-04 13:51:59 +02:00
github-actions[bot] 0517a4600c Fetch translations & Recreate libretro_core_options_intl.h 2024-05-03 22:19:41 +00:00
Flyinghead fe17d459a5 ui: achievements list, new pause menu
Fix threading issue when hashing disk for RA. Protect cacheMap with
mutex.
Achievement current challenges displayed as small icons.
Embed FontAwesome symbols.
New pause menu.
Issue #761
2024-05-03 20:09:31 +02:00
Edward Li 2d4684a462 Use Xcode 15.3 2024-05-01 18:33:17 +02:00
Flyinghead 300cf0d437 better RetroAchievements UI and threading
Pop ups for authentication, game load, game completed, achievements
unlock and progress.
Handle disk changes.
Issue #761
2024-05-01 18:32:39 +02:00
Flyinghead c96e828c63 move http_client to oslib 2024-04-29 16:17:50 +02:00
Flyinghead 4666ea2fdb macos: bump minimum macOS version to 10.11 to avoid build error 2024-04-29 15:31:21 +02:00
Flyinghead 8f5f2caae6 Merge remote-tracking branch 'origin/master' into dev 2024-04-29 15:27:23 +02:00
Flyinghead 8fdd1dde3d RetroAchievements support
MVP
Issue #761
2024-04-29 14:59:47 +02:00
github-actions[bot] 8e96590065 Fetch translations & Recreate libretro_core_options_intl.h 2024-04-26 22:20:05 +00:00
Flyinghead d46b181084 ui: fix cosmetic issues
Limit Filter fields width to what's available. Issue #1488
Avoid bouncing loop when scrollbar appearance and responsive boxart size
work against each other. Issue #1489
2024-04-25 12:57:34 +02:00
scribam e46815d070 ci: update netbsd and openbsd versions 2024-04-20 09:16:36 +02:00
github-actions[bot] 3c38fc1f16 Fetch translations & Recreate libretro_core_options_intl.h 2024-04-19 22:19:34 +00:00
Díaz Urbaneja Víctor Diego Alejandro (Sodomon) 47b6a90bec Update README.md
edited build instructions
2024-04-18 09:10:50 +02:00
Flyinghead de6a43bd21 savestate: drop support for legacy libretro and <v16 savestates 2024-04-16 09:40:55 +02:00
github-actions[bot] 7438094d7c Fetch translations & Recreate libretro_core_options_intl.h 2024-04-12 22:19:05 +00:00
Flyinghead 336706e728 move most os_* funcs to oslib
add os_DestroyWindow and os_UpdateInputState
2024-04-12 17:37:45 +02:00
C.W. Betts 8f486e71cb Update types.h
Use angle brackets for including pthread.h
2024-04-12 09:24:10 +02:00
Flyinghead b378161837 lr: switch build fix 2024-04-11 18:50:49 +02:00
Flyinghead a136583189 drop dispmanx support. move switch main() to its own file
Dispmanx support is provided by SDL
Enable omx audio and set TARGET_VIDEOCORE when building for RPi3
2024-04-11 16:27:28 +02:00
Flyinghead 06a6e26588 get rid of os_GetSeconds()
replace it with std::chrono-based getTimeMs()
2024-04-11 15:25:25 +02:00
Flyinghead 5541d34a9e lr win32 build fix 2024-04-10 18:10:21 +02:00
Flyinghead 108c8a4b5d vk: move macOS video routing code from context to renderer 2024-04-10 17:31:23 +02:00
Flyinghead 9e916ca1c9 minor input and lua fixes
Make macOS keyboard class with haptic code
Call SDL_JoystickSetPlayerIndex using maple port
Add Network event for LUA
Set proper controller unique id on iOS
rumblePower wasn't copied over new mappings.
2024-04-10 17:24:47 +02:00
Flyinghead 42e98e86d0 set thread names
Name all threads to help debugging and improve crash reports (windows
only)
Add ^C handler for clean exit on linux
2024-04-10 17:08:24 +02:00
Flyinghead 010fba15a8 macOS build fix 2024-04-08 21:26:18 +02:00
Flyinghead bf249061cf thegamedb: ignore common disk ids T0000 and T0000M
These are default disk ids and shouldn't be used to identify media
2024-04-08 19:09:14 +02:00
Flyinghead 24db1422b8 ui: rearrange Settings > Video screen
Issue #665
2024-04-08 19:07:44 +02:00
Flyinghead da6c34b2fd android workflow: fetch submodules recursively (for libadrenotools) 2024-04-07 12:34:34 +02:00
Flyinghead a6c4530e22 vulkan: allow custom GPU driver loading with libadrenotools
Issue #1471
2024-04-07 12:27:54 +02:00
Flyinghead e8340bfa5e maple: implement AllStatusReq for controller and VMU 2024-04-07 11:47:42 +02:00
Flyinghead eaa22a49d1 msvc build fix 2024-04-06 19:07:27 +02:00
Flyinghead 4f87a3556e Fix vmu beep frequency 2024-04-06 17:43:19 +02:00
Flyinghead 41d418ed25 bump libchdr to match master 2024-04-06 17:21:27 +02:00
github-actions[bot] 9d6eab74e1 Fetch translations & Recreate libretro_core_options_intl.h 2024-04-05 22:20:01 +00:00
scribam a0c81d2f2a deps: update sdl to version 2.30.2 2024-04-03 10:50:17 +02:00
flyinghead d6efbc513c win: fix dump textures and box art saves when path contains non-ascii
Texture dumping and local boxart scraper were failing on windows if
image path contains non-ascii chars. nonwide::fopen must be used.
2024-04-03 10:49:40 +02:00
github-actions[bot] ed78eb4d50 Fetch translations & Recreate libretro_core_options_intl.h 2024-03-29 22:19:29 +00:00
Flyinghead 236b747db8 gl: fix GLES2 build
Issue #1470
2024-03-28 17:48:39 +01:00
Flyinghead c9fafa0ed1 widescreen cheats for Surf Rocket Racers (US) and Love & Berry 1 and 3
Courtesy of Goddamn Superhero
2024-03-26 18:43:38 +01:00
Flyinghead 4bd8866164 libretro: don't load overridden settings from frontend
Fixes game specific overrides being ignored.
2024-03-26 18:40:48 +01:00
Flyinghead f346bcd68b elf: only load PT_LOAD sections 2024-03-24 10:16:02 +01:00
github-actions[bot] 187991d71f Fetch translations & Recreate libretro_core_options_intl.h 2024-03-22 22:19:19 +00:00
Alexandre Bouvier 40cdef6c1c cmake: allow system glslang library 2024-03-19 14:16:10 +01:00
Bobby Smith 8252a28e48 [Libretro] Check for per-pixel compatibility and hide the option if not supported 2024-03-17 17:55:23 +01:00
Flyinghead c7ee42f0ba ios: don't use glad
Fixes crash at start up on iOS.
Issue #1461
2024-03-17 17:54:37 +01:00
Flyinghead e27b5dc1aa Merge remote-tracking branch 'origin/master' into dev 2024-03-16 19:40:48 +01:00
github-actions[bot] 966ff3767d Fetch translations & Recreate libretro_core_options_intl.h 2024-03-15 22:19:31 +00:00
Flyinghead 056a02357d Cardcaptor Sakura widescreen cheat 2024-03-14 13:22:44 +01:00
Flyinghead 6115a918b2 arm dynarec: apply mask to mem write8 and write16 value operand
Compilers do not cast the operand, which results in u8 handlers being
called with an u32 value.
2024-03-14 13:21:10 +01:00
Flyinghead 3ffb09ec72 gl: fully recreate opengl texture when loading a custom one
Regenerate texID and call glTexStorage2D when loading a custom texture
(GL 4.2+, GLES3).
rend: missing old_vqtexture_hash in move constructor.
2024-03-14 12:56:11 +01:00
Flyinghead de89d8cfed rend: fix Space Harrier arcade in Shenmue
Use the original tex dimensions and make sure they never change between
updates.
2024-03-12 14:56:13 +01:00
Flyinghead c7d6525c51 force PAL for MTV Sports - Skateboarding (EU) 2024-03-12 14:37:38 +01:00
Flyinghead 5ce1f92e5c naomi: allow mapping of left & right trigger 2
Makes rear brake usable in wild riders
Issue #1450
2024-03-12 14:36:38 +01:00
Flyinghead 464defe0d7 don't force Native Depth Interpolation for AMD GPUs
Some AMD GPUs have issues with this option enabled so let the user
decide.
partial revert of 9f9b29b833 and
cab19ad54b.
Issue #1445

Add BSD CI badge to README
2024-03-10 14:17:21 +01:00
github-actions[bot] d323490d1f Fetch translations & Recreate libretro_core_options_intl.h 2024-03-08 22:20:07 +00:00
scribam d8c15de030 deps: update sdl to version 2.30.1 2024-03-07 15:01:59 +01:00
Flyinghead b55054249f ui: file dropping can start multiple games at once
Happens on macOS, linux and likely others.
Fixes MINIDUMP-2N4
2024-03-07 15:01:28 +01:00
Flyinghead 0aa8910742 ui: update gamepad settings for both console and arcade profiles 2024-03-06 16:53:43 +01:00
Flyinghead 43bb7c83f7 hide P3 and P4 light gun crosshairs for arcade games 2024-03-06 16:42:43 +01:00
Flyinghead 391da7023f sh4: fix SCIF serialization
Fixes MINIDUMP-2M0
Add some diag logging to win_vmem
2024-03-04 17:02:42 +01:00
Flyinghead b0a268b89e richer discord presence using boxart from thegamesdb 2024-03-03 16:03:22 +01:00
scribam 960b8134c1 ci: update mathieu-bour/setup-sentry-cli action 2024-03-02 18:37:52 +01:00
scribam 5a51749daa libretro: fix translation 2024-03-02 18:37:20 +01:00
scribam d2dc60ec00 android: update android gradle plugin to version 8.3.0 2024-03-02 18:36:54 +01:00
github-actions[bot] 33bcf4443f Fetch translations & Recreate libretro_core_options_intl.h 2024-03-01 22:19:09 +00:00
Flyinghead 62d00578af fix compile warnings 2024-03-01 12:58:53 +01:00
Flyinghead dac5c008ab Discord Presence support
Issue #1289
2024-03-01 12:34:49 +01:00
Flyinghead 588035d9eb set currently played game name in the window title
Issue #28
2024-03-01 12:00:24 +01:00
Bobby Smith f63a82afc4 Update libchdr 2024-02-29 19:58:39 +01:00
Flyinghead c052822fd4 jojo's bizarre adventure (US) requires NTSC 2024-02-29 16:45:14 +01:00
Flyinghead 2846b3002b rawinput: append device id to device name
Append device id to friendly name to distinguish between generic
HID-compliant devices.
Issue #664
Issue #835
Better UI for device tables using new imgui table API.
2024-02-29 16:43:53 +01:00
Flyinghead 19a240503d minor clean up 2024-02-29 16:26:49 +01:00
Flyinghead c9d3096e41 android: hid barcode scanner support 2024-02-27 17:39:51 +01:00
Flyinghead d6ae47d0f7 fix FreeBSD x64 segfault context
Issue #1401
2024-02-27 17:39:51 +01:00
Flyinghead 40a7c08d14 isofs: fix long directory listing
Directory entries can't cross a sector boundary, so reading must
continue on the next one.
Add list() method
2024-02-27 17:39:51 +01:00
Flyinghead 6f8a588794 bump depth scale for NHL 2K2
Fixes helmet rendering in team selection menu
Issue #1416
2024-02-27 17:39:51 +01:00
Flyinghead 156aafe95b sh4: fix P4 region mapping and on chip ram addressing
P4 region is normally mapped outside of the sq and system registers
areas (E4-EF, F8-FE).
Fixes NHL 2K2 missing helmet and jersey textures. Issue #1416
Fixes invalid geometry in worldkicks series (using interpreter or 4 GB
vmem space)
Fix On Chip RAM addressing: bit 13 or 25 is used to select the bank.
2024-02-27 17:39:51 +01:00
scribam 1017d3eb95 deps: sync imgui_impl_vulkan.cpp with upstream 2024-02-27 17:39:51 +01:00
scribam 3059b43121 deps: update imgui to version 1.90.4 2024-02-27 17:39:51 +01:00
Flyinghead 93789e2a63 sdl: support multiple mice when allowed by the platform 2024-02-27 17:39:51 +01:00
Flyinghead 6639d6b167 naomi: fix shaktam inputs
Issue #1420
2024-02-27 17:39:51 +01:00
scribam daef33cea5 cmake: improved parallelism in msbuild 2024-02-27 17:39:51 +01:00
scribam a7c89701fe ci: use cross-platform-actions/action to build on bsd systems 2024-02-27 17:39:51 +01:00
scribam 9a119e7646 bsd: update segfault context for arm64 2024-02-27 17:39:51 +01:00
scribam c8462e1f78 deps: update imgui to version 1.90.3 2024-02-27 17:39:51 +01:00
scribam 50944772b7 linux: use egl with x11 instead of glx 2024-02-27 17:39:51 +01:00
scribam 952a785bf0 deps: update libchdr 2024-02-27 17:39:51 +01:00
scribam f9eed1ed3f deps: update libzip to version 1.10.1 2024-02-27 17:39:51 +01:00
scribam b7df183c7c ci: use latest devkitpro docker image 2024-02-27 17:39:51 +01:00
Flyinghead 13edf858e3 init drive when running .elf. Skip special settings for BIOS and .elf. 2024-02-27 17:39:51 +01:00
Flyinghead d45de9e8a9 gladLoader: check return code and log. cheats: light refactoring 2024-02-27 17:39:51 +01:00
Flyinghead 81cbf45bdb samsptk: use cheat instead of extra depth scale
Use a cheat to fix the game bug instead of dealing with ginormous depth
values.
2024-02-27 17:39:51 +01:00
Flyinghead d340b620c3 gdrom: delay "no disk" reporting to let the BIOS play the boot animation
Thanks to kihato for the prototype code.
Issue #587
2024-02-27 17:39:51 +01:00
Flyinghead 443d5a2ba6 pvr: apply a negative bias to background plane depth
Fixes skybox in Xtreme Sports. Issue #1381
Fixes background clipping in Blue Stinger (JP) intro. Issue #721
Fixes Windows CE yuv FMV black screen (4x4 EVO, Armada, Carsear's
Palace, Giant Killers, PBA bowling, Starlancer, Tomr Raider, Wild Metal,
Who wants to beat up...)

Get rid of ForceWindowsCE option
Force PAL for Super Runabout (EU)
2024-02-27 17:39:51 +01:00
Flyinghead 894a38fb71 ui: replace Exit by Close Game. Better format for some UI values.
Issue #1383
2024-02-27 17:39:51 +01:00
Flyinghead aea37b3bd8 gdrom: set correct lead-out FAD of single-density area
Use end FAD +1 of track 2 as start of lead-out for single density area.
gdi: set track end FAD based on track size, not start of next track
chd: ignore pad frames when calculating end FAD
cdi: end FAD was one off
Issue #1386
2024-02-27 17:39:51 +01:00
Flyinghead b5eecb79b8 android: hid barcode scanner support 2024-02-26 16:27:18 +01:00
Flyinghead f629c352e1 fix FreeBSD x64 segfault context
Issue #1401
2024-02-26 11:27:03 +01:00
Flyinghead ff91d1101a isofs: fix long directory listing
Directory entries can't cross a sector boundary, so reading must
continue on the next one.
Add list() method
2024-02-25 15:59:22 +01:00
Flyinghead 4f1512d369 bump depth scale for NHL 2K2
Fixes helmet rendering in team selection menu
Issue #1416
2024-02-25 14:40:37 +01:00
Flyinghead 2dde1d5e7b sh4: fix P4 region mapping and on chip ram addressing
P4 region is normally mapped outside of the sq and system registers
areas (E4-EF, F8-FE).
Fixes NHL 2K2 missing helmet and jersey textures. Issue #1416
Fixes invalid geometry in worldkicks series (using interpreter or 4 GB
vmem space)
Fix On Chip RAM addressing: bit 13 or 25 is used to select the bank.
2024-02-25 14:37:27 +01:00
scribam 3c8769cb5c deps: sync imgui_impl_vulkan.cpp with upstream 2024-02-24 22:08:40 +01:00
scribam ba12c01ab8 deps: update imgui to version 1.90.4 2024-02-24 22:08:40 +01:00
Flyinghead 713739bbc7 sdl: support multiple mice when allowed by the platform 2024-02-24 21:33:40 +01:00
Flyinghead 4667d17d78 naomi: fix shaktam inputs
Issue #1420
2024-02-24 19:42:41 +01:00
github-actions[bot] bc51aefa9c Fetch translations & Recreate libretro_core_options_intl.h 2024-02-23 22:19:36 +00:00
Immersion95 67c4e62c51 Adds option to enable/disable "Fix Upscale Bleeding Edge"
Helps with texture bleeding case when upscaling. Disabling it can help if pixels are warping when upscaling in 2D games (MVC2, CVS, KOF, etc.)
2024-02-22 11:30:26 +01:00
scribam b71541f8dd cmake: improved parallelism in msbuild 2024-02-22 09:21:34 +01:00
scribam 56cad843c9 ci: use cross-platform-actions/action to build on bsd systems 2024-02-21 08:46:27 +01:00
scribam 1b0781c680 bsd: update segfault context for arm64 2024-02-21 08:46:27 +01:00
scribam 0c5e79d618 deps: update imgui to version 1.90.3 2024-02-17 17:40:22 +01:00
scribam 5c8d7021f6 linux: use egl with x11 instead of glx 2024-02-17 17:38:39 +01:00
scribam 8d2bcdf35e deps: update libchdr 2024-02-17 17:37:32 +01:00
scribam eb2826f6d3 deps: update libzip to version 1.10.1 2024-02-15 10:00:56 +01:00
scribam 6cb929953c ci: use latest devkitpro docker image 2024-02-10 12:41:51 +01:00
Flyinghead 232924d88a init drive when running .elf. Skip special settings for BIOS and .elf. 2024-02-10 12:41:17 +01:00
Flyinghead 90b13a40ab gladLoader: check return code and log. cheats: light refactoring 2024-02-10 12:06:48 +01:00
Flyinghead a50f5765da Merge remote-tracking branch 'origin/master' into dev 2024-02-10 11:58:39 +01:00
github-actions[bot] 44fa364f36 Fetch translations & Recreate libretro_core_options_intl.h 2024-02-09 22:19:47 +00:00
Flyinghead 7029e1615a systemsp: lovebery needs Copy to VRAM. Allow space in card codes.
Enable Copy to VRAM for lovebery and lovebero.
Allow space characters in card codes.
Issue #1388
Force HLE BIOS for Suika.
Issue #1278
2024-02-09 13:05:38 +01:00
Flyinghead 3469b7fca7 gl: use red for single channel textures instead of alpha on GLES3
Only GLES2 needs to use the alpha channel. glTexStorage2D only supports
red.
Issue #1391
2024-02-09 12:59:50 +01:00
Flyinghead 434083c716 samsptk: use cheat instead of extra depth scale
Use a cheat to fix the game bug instead of dealing with ginormous depth
values.
2024-02-07 19:41:03 +01:00
Flyinghead d9d91381b5 gdrom: delay "no disk" reporting to let the BIOS play the boot animation
Thanks to kihato for the prototype code.
Issue #587
2024-02-07 16:11:25 +01:00
Flyinghead 531c6f94d5 pvr: apply a negative bias to background plane depth
Fixes skybox in Xtreme Sports. Issue #1381
Fixes background clipping in Blue Stinger (JP) intro. Issue #721
Fixes Windows CE yuv FMV black screen (4x4 EVO, Armada, Carsear's
Palace, Giant Killers, PBA bowling, Starlancer, Tomr Raider, Wild Metal,
Who wants to beat up...)

Get rid of ForceWindowsCE option
Force PAL for Super Runabout (EU)
2024-02-07 16:02:55 +01:00
Flyinghead 9aa9b5bebc ui: replace Exit by Close Game. Better format for some UI values.
Issue #1383
2024-02-07 11:05:09 +01:00
Flyinghead e592650afc gdrom: set correct lead-out FAD of single-density area
Use end FAD +1 of track 2 as start of lead-out for single density area.
gdi: set track end FAD based on track size, not start of next track
chd: ignore pad frames when calculating end FAD
cdi: end FAD was one off
Issue #1386
2024-02-06 11:07:20 +01:00
flyinghead c146a92f83 Merge pull request #1379 from flyinghead/dev
merge dev branch
2024-02-03 18:25:15 +01:00
dakrk d4fa3c441e cheats: fix parsing cheat codes on some platforms
using strtol here instead of strtoul when cheat code values are expected to be unsigned and are above 7fffffff breaks on platforms like Windows where long is 32-bit even on 64-bit platforms, capping out at 2147483647 and causing some cheat codes to break.
2024-02-03 18:19:40 +01:00
scribam 47eeab9985 switch: lock devkipro docker image to known good version 2024-02-03 16:28:57 +01:00
scribam be8c559b2f deps: update sdl to version 2.30.0
vcpkg is no longer required to build sdl for uwp
2024-02-03 16:28:57 +01:00
scribam 51d25bb49b android: update android gradle plugin to version 8.2.2 2024-02-03 16:28:57 +01:00
github-actions[bot] 6d69598800 Fetch translations & Recreate libretro_core_options_intl.h 2024-02-02 22:19:10 +00:00
Flyinghead 36684bf82c vk: share shader code between regular and oit renderers 2024-02-01 18:19:03 +01:00
Flyinghead cdaaeb5b27 naomi: printer fixes
Fix create bitmap DC2 sequence: 4 bytes then data.
Record msb mode at time of image definition as it might change before
the image is printed.
ntvmys uses 64-pixel wide custom characters.
Custom chars must use current bitmap msb setting.
Implement rule line dot fill and pattern fill.

Fixes most ntvmys print out issues.
Issue #1378
2024-02-01 18:15:34 +01:00
Flyinghead 4220c0d64f naomi: reset destination ram if dma xfer from invalid rom offset
Reset destination area to 0 if attempting a dma xfer from an invalid rom
offset. Also update SB_GDSTARD and SB_GDLEND in this case.
Fixes texture corruption in ntvmys.
Issue #1378
2024-02-01 17:51:25 +01:00
Flyinghead e286f98f72 naomi: new rom ntvmys 2024-01-31 16:52:34 +01:00
Flyinghead e714e94510 rend: do bilinear filtering of palette textures on the GPU
All renderers updated.
2024-01-31 16:46:25 +01:00
Flyinghead 8715e5a5e9 gl: use glTexStorage/glTexSubImage to update textures when available 2024-01-31 16:03:07 +01:00
Flyinghead 1153238e2c sdl: (linux) fix window position at startup/recreation
Window decorations dimensions aren't taken into account on linux when
creating a window. So reposition it after it's shown.
2024-01-29 17:08:10 +01:00
Flyinghead 617d82f5a2 libretro: rename Purupuru to Vibration Pack 2024-01-29 11:29:52 +01:00
Flyinghead 471e0a7786 sdl: add timeout for barcode scanner to recover from incomplete reads
Reset barcode buffer after 0.5 s. Allows to recover from a failed read
or the user pressing '*'.
2024-01-29 11:25:55 +01:00
Flyinghead 887e616f76 dx9: load d3d9.dll and d3dx9_??.dll dynamically 2024-01-29 11:15:30 +01:00
Flyinghead aa2fa1f611 ui: rename Purupuru to Vibration Pack 2024-01-29 11:08:17 +01:00
Flyinghead 57c88e07c4 gl: even better test to detect the nouveau driver
Issue #1373
2024-01-29 10:51:48 +01:00
Flyinghead 593b3205bd reios: fix GETSCD and GET_DRV_STAT status during disk swapping
GET_DRV_STAT returns BUSY when disk is being recognized.
GETSCD returns asc and ascq in result 1 on error, does not return unit
attention if drive is busy.
Fixes disk swapping for Shenmue II, Dancing Blade II and Kaen Seibo.
Fixes wrong drive visual in Golf Shiyouyo Course Data Syuu

Issue #1046
2024-01-28 16:00:46 +01:00
Flyinghead ecce9157bd maple: raise interrupt on vblank when maple bus is occupied
Raise a maple interrupt at the next vblank when the host occupies the
maple bus to read the lightgun position. Fixes RevolveR single shot
issue since the game is waiting for the interrupt.
Issue #1369
2024-01-28 15:21:40 +01:00
Flyinghead b2d96d77d7 naomi: support hid barcode scanner. sdl: detect keyboard layout
sdl: Support for HID barcode scanners such as unitech MS146.
Automatically detect keyboard layout at start up.
2024-01-27 16:01:57 +01:00
github-actions[bot] e1537ddbda Fetch translations & Recreate libretro_core_options_intl.h 2024-01-26 22:19:34 +00:00
Flyinghead 4c7e57ebd6 gdrom: revert SPI_TEST_UNIT change
Fixes disk swapping for Alone in the Dark and Resident Evil: Code
Veronica (real BIOS)
Issue #1046
2024-01-26 19:49:01 +01:00
Flyinghead 116dc0e1ed gdrom: don't rely on Status in libGDR_GetDiscType
Status is Busy when disk swapping is in progress so libGDR_GetDiscType
always returns NoDisk/Open. Rely on the scheduler instead so that the
correct type is returned when disk swapping is finished.
Issue #1046
Issue #189
2024-01-25 12:36:04 +01:00
Flyinghead 10d3ffdf09 jvs: fix crackin'dj inputs. serialize coin count
crackin'dj: map vertical mouse axis to right turntable. Invert fader.
Simulate turntable motor. Embed eeproms with calibration done.
Fix coin being inserted after loading a savestate.
2024-01-24 19:39:20 +01:00
Flyinghead cbd01fba38 gdrom: fix disk swapping for some games
Add a 1 s delay when inserting a disk before the drive is ready.
Fixes disk swapping for Skies of Arcadia, Shenmue II (except HLE), Alone
in the Dark, Dancing Blade, First Kiss Story II and Kaen Seibo.
Issue #1046
Issue #189
Fixes BIOS menu disk swapping.
2024-01-24 18:35:23 +01:00
Flyinghead 88fd2641d9 pvr: allow blending for opaque polys of list continuations
Fixes Crackin'DJ invisible background animation and Monkey Ball grey map
background.
2024-01-23 19:20:40 +01:00
Flyinghead 70a69cf48d switch: fastmem/vmem implementation
Only map first writable mirror due to switch limitation.
2024-01-22 15:18:49 +01:00
Flyinghead f8d5517b8e Disable overclocking for ggpo and online games. Always release vmem.
Disable over/underclocking when GGPO is enabled and when online
(modem/bba).
Always release the address space, which releases virtmem.
2024-01-22 09:46:51 +01:00
Flyinghead 16b2f59a47 ui: use flattened navigation where possible. fix sdl on-screen keyboard
Use flattened nav on file select, add cheat and controller mapping
windows and list boxes.
Don't show the SDL on-screen keyboard twice.
Use ImGuiChildFlags_Border instead of the legacy border parameter
(BeginChild)
2024-01-22 09:36:17 +01:00
Flyinghead 07d6ca6c84 gl: better test to detect the nouveau driver
GL_VENDOR=nouveau or GL_RENDERER=NVE4 (case insensitive)
Issue #1373
2024-01-22 09:18:17 +01:00
Flyinghead c9c015976a switch: tentative fix 2 of git security issue affecting version number 2024-01-20 19:39:22 +01:00
Flyinghead 2615cc13f1 Revert "switch: tentative fix of git security issue affecting version number"
This reverts commit 393c3dbfd9.
2024-01-20 19:26:16 +01:00
scribam 599dc92d11 ci: use freebsd 14 2024-01-20 19:24:07 +01:00
scribam e26302ef03 deps: update glad 2024-01-20 19:24:07 +01:00
scribam fd3e74e224 ci: remove ninja-build as it is already installed in devkitpro image 2024-01-20 19:24:07 +01:00
scribam 5b5d7b01eb ci: bump actions/cache and ad-m/github-push-action 2024-01-20 19:24:07 +01:00
scribam f6b01aba0c android: update android gradle plugin to version 8.2.1 2024-01-20 19:24:07 +01:00
Flyinghead 19bb4a6e5d switch: implement rumble with native API 2024-01-20 19:23:09 +01:00
Flyinghead bc70d9118d ui: restore drag scrolling on controller mapping popup
regression introduced by 105ab95efa
2024-01-20 16:20:09 +01:00
Flyinghead 393c3dbfd9 switch: tentative fix of git security issue affecting version number 2024-01-20 16:14:18 +01:00
github-actions[bot] 8fd6fefda7 Fetch translations & Recreate libretro_core_options_intl.h 2024-01-19 22:19:50 +00:00
Flyinghead a620a432c9 boxart: save database regularly when scraping
Issue #1117
2024-01-17 17:54:28 +01:00
Flyinghead 9e37d1e726 switch: restore x15 register when returning from the fault handler
Also restore NZCV and FPU registers.
Fixes crash/glitch with YUV converter.
Fixes SoA crash when rendering to a texture.
Issue #1312
2024-01-17 17:52:26 +01:00
Flyinghead c1b087df83 arm64: notify compiler that x10 is used in setHostRoundingMode
Fixes a crash on switch in single-threaded mode in
setDefaultRoundingMode.
2024-01-17 10:08:44 +01:00
Flyinghead 2add951f70 switch build fix 2024-01-16 11:39:51 +01:00
Bobby Smith 070ac717d3 [Libretro] Add options to manage each expansion slot 2024-01-16 11:22:12 +01:00
Flyinghead cfb7ff3054 switch: use latest devkitpro. touchscreen support. cleaner abort
Use latest devkitpro image.
Call diagAbortWithResult on fatal errors instead of freezing/infinite
loop.
Add Exit button on main content screen.
Touchscreen support.
2024-01-16 11:21:32 +01:00
scribam e03c37b013 deps: update imgui to version v1.90.1 2024-01-13 14:58:33 +01:00
Flyinghead 0b0904cdc5 systemsp: hopper and medal game fixes
hopper: Limit coin sensors to 100 ms to avoid coin chute jam errors.
hopper: Use periodic sensor for hopper to avoid hopper jam errors.
Issue #1365
medal: wire inputs and emulator required sensors. Embed medal games
nvmem to disable comm and all errors.
magicpop, unomedal, puyomedal, ochaken and westdmrg now playable.

kingyoch rom parent is kingyo
2024-01-13 14:52:29 +01:00
github-actions[bot] 195f401044 Fetch translations & Recreate libretro_core_options_intl.h 2024-01-12 22:19:21 +00:00
flyinghead 552e5b7d7a dx9,dx11: only draw lightgun crosshair when necessary
missing check for arcade games
Issue #1363
2024-01-11 22:20:21 +01:00
Flyinghead 2a48049216 systemsp: cart network hle. hopper emulation.
WIP emulation of cart network features.
Hopper emulation.
WIP medal emulation.
Playable games: kingyo, manpuku and shateki
2024-01-10 15:56:21 +01:00
Flyinghead c001240797 move audio drivers to their own folder 2024-01-10 11:45:54 +01:00
github-actions[bot] e7d0a5f2f9 Fetch translations & Recreate libretro_core_options_intl.h 2024-01-05 22:19:42 +00:00
Flyinghead 032cc17659 video routing fixes
dx11: terminate video routing in DX11Renderer::Term. Don't use
DX11Context.
dx11: avoid using local static vars
gl: don't send rendered frame when full FB is on
gl: send rendered framebuffer
gl: terminate video routing in termGLCommon. Don't use GLGraphicsContext

gl: avoid crash on quick exit during test automation
2024-01-05 12:46:39 +01:00
Flyinghead c0c6f206bf f355: fix win32 condition variable implementation
A race condition can happen on condition variables due to
unlock/wait/lock not being atomic. This results in the wrong process
being notified, causing a deadlock.
Happens more frequently in twin mode.
Issue #1361
2024-01-05 12:36:20 +01:00
scribam 6aa59c54a5 Minor misc changes (#1360)
* core: cleanup include headers
* dx11: remove unimplemented function
* core: annotate destructors with override
* aica: use range-based for loop
* bm: use const reference/structured bindings with blkmap
2024-01-02 14:38:16 +01:00
Flyinghead 9c964ac955 refactor embedded resource loading. Use for imgui font and android OSD
Generic embedded resource loading function
Zip bios and printer fonts
Add buttons.png and Roboto-Medium.ttf as embedded resources
2024-01-02 14:37:29 +01:00
Flyinghead 5734556440 naomi: crc32 for asndynmt[o]. Use vfnet.flyca.st domain for netdimm 2024-01-01 16:16:55 +01:00
Flyinghead e76b76dcc4 vk: allow any size for buttons.png on android 2024-01-01 16:07:59 +01:00
Flyinghead cab19ad54b libretro: crash at boot when checking for GPU vendor 2024-01-01 16:06:25 +01:00
Flyinghead a7702c622a aica: don't disable channel when reaching full attenuation
Some games rely on the channel still being processed and CA/LP being
updated. Courtesy of @kihato
Issues #472, #483, #1180, #1249, #1030 (partial)
2023-12-31 12:02:42 +01:00
Flyinghead 9f9b29b833 rend: force Native Depth Interpolation for AMD gpus 2023-12-28 17:48:33 +01:00
Flyinghead 06529b63f7 gl: don't invert y when saving a test screenshot 2023-12-28 17:36:50 +01:00
Flyinghead 0d36154618 hle bios: wince games hang after IP.BIN
regression introduced by 41723a831f
2023-12-28 17:17:11 +01:00
Flyinghead c7b6f22e10 naomi: limit rom dma delay to 1 sec
Fixes crash at boot with jambo safari.
Fix for MINIDUMP-293
2023-12-25 19:07:08 +01:00
Bobby Smith d069b45bff [Libretro] Adds some core options description + minor changes 2023-12-23 20:43:19 +01:00
github-actions[bot] 4a0ace5de2 Fetch translations & Recreate libretro_core_options_intl.h 2023-12-22 22:19:29 +00:00
Bobby Smith 57c2dcd961 [Libretro] Fix VMU scaling for dynamic res games 2023-12-21 14:20:34 +01:00
vkedwardli 790f5b1ad2 Video Routing Revamp (#1323)
* Update Spout2 dep
* Remove all `initVideoRouting` call from `GraphicContext`
* Fix MinGW build error
2023-12-21 14:19:57 +01:00
Flyinghead 54ac9c6361 naomi: lower rom dma transfer speed
Decrease from 20 to 7 MB/s. Fixes various freezes with Force Five aw
conversion.
Issue #141

Don't expose atomiswave A0_006 registers to naomi and other arcade
platforms.
2023-12-21 14:18:53 +01:00
Flyinghead 449b871e0c vk: crash when loading custom texture
Regression due to 939e2bc68f
Issue #1351
2023-12-21 10:04:35 +01:00
scribam e057370e97 core: add missing pragma once to header files 2023-12-17 11:12:20 +01:00
scribam c938f7b0df deps: build breakpad on current compatible systems only 2023-12-17 11:11:51 +01:00
Bobby Smith 99dc278ad2 Broadcast override for South Park Rally 2023-12-17 11:11:23 +01:00
scribam bccdc6600a ci: update github actions 2023-12-17 11:10:56 +01:00
Flyinghead ba1a68a69f vk: fix setObjectName on 32-bit platforms 2023-12-17 11:10:19 +01:00
Flyinghead 363c2c4c3f modem: register flags documentation 2023-12-17 11:07:13 +01:00
Flyinghead fe429ec01e move holly interrupts out of types.h 2023-12-16 23:04:39 +01:00
Flyinghead 192838b9c1 maple: lightgun must return 0 for trigger axes
Fixes Death Crimson 2 fast forwarding in story mode when using a
lightgun.
Issue #646
2023-12-16 16:47:48 +01:00
github-actions[bot] 2a19ccf945 Fetch translations & Recreate libretro_core_options_intl.h 2023-12-15 22:19:48 +00:00
scribam 00954f1b60 egl: make sure display is valid before cleanup 2023-12-13 17:32:40 +01:00
scribam bf4346c849 android: update agp and gradle to version 8.2 2023-12-13 17:31:56 +01:00
scribam 32502e7459 cmake: remove hardcoded path to portlibs/switch 2023-12-13 17:31:17 +01:00
scribam 99031e23d3 windows: cleanup non-sdl code paths 2023-12-13 17:30:29 +01:00
github-actions[bot] f4f087a6ea Fetch translations & Recreate libretro_core_options_intl.h 2023-12-08 22:19:57 +00:00
Flyinghead 0433fd824c naomi: fix handling of dma abort
Fixes hang in f355 twin and twin2
2023-12-08 18:30:12 +01:00
Bobby Smith 9137ff998f Add a hotkey to bypass emulated keyboard 2023-12-07 16:48:31 +01:00
Flyinghead 7cc77b10ed naomi: schedule end of cart dma
Set to 20 MB/s to fix meltyb satsuki vs kouma hang when starting fight
Issue #1255
2023-12-07 16:14:10 +01:00
Flyinghead 07f208d2a2 elan: set dma completion delay to fixed min value
Fixes initdexp hang at race start
Issue #1337
2023-12-07 13:43:52 +01:00
Flyinghead 05cd7ee8d3 naomi2: fix initdv3j boot. avoid end of area crash with initdv2/v3jb
Abort processing and set elan error when invalid draw/dma commands are
executed.
Issue #981
Fixes MINIDUMP-K5 MINIDUMP-JS MINIDUMP-S0 MINIDUMP-98 MINIDUMP-125
MINIDUMP-12D MINIDUMP-22Q

Delay completion of elan dma transfers. Fixes initdv3j boot.
Issue #647

gdrom: some data was serialized twice
2023-12-05 18:25:40 +01:00
scribam d8e61520af windows: map arm/arm64 to host_context_t 2023-12-04 12:00:38 +01:00
Flyinghead e9beea484d Merge remote-tracking branch 'origin/master' into dev 2023-12-04 11:58:12 +01:00
Flyinghead 4aecdbbb25 input: new saturation setting for full analog axes. Gamepad settings UI
Saturation reduces or increases the range of analog axes.
Issue #675
Axes values are re-scaled with dead zone to allow small values.
New Gamepad Settings dialog box to set up dead zone, saturation and
rumble/haptic power.
2023-12-04 11:57:49 +01:00
Flyinghead d7c28a4805 aica: recommpile dsp when loading a state
Fixes bad noise when loading a menu state on tetris from in game.
2023-12-03 20:51:09 +01:00
Flyinghead 939e2bc68f vk: better deferred deletion. fix validation layer issues
Use raii-like mechanism to delete resources when not in use.
Fix several issues reported by validation layers (vtennis rtt, main
buffer size resizing, ...)
2023-12-03 19:18:16 +01:00
Flyinghead ce4a3a7147 scif: always schedule timer when updating baud rate
Old savestates don't have any callback set, and read only devices
(barcode readers) won't schedule any either
UI message when r/w card is ejected
2023-12-03 18:22:52 +01:00
Flyinghead 5fde889d7c builtin cheat for f355 network race. enable builtin cheats when online
Increase the datapump timeout from 500 to 1000 to avoid an error when
posting network race results.
Enable built in cheats when online
2023-12-03 16:44:43 +01:00
github-actions[bot] fd2a87fca2 Fetch translations & Recreate libretro_core_options_intl.h 2023-12-01 22:19:52 +00:00
Bobby Smith 153dbb0c56 [Libretro] Input descriptors fixes (#1330)
* Input descriptors fixes
* Refresh input descriptors w/o having to toggle menu
2023-12-01 15:05:30 +01:00
scribam e53433e6f5 cmake: use glad glx/egl/wgl only when sdl2 is not found 2023-12-01 15:04:41 +01:00
scribam db7895cea5 Some ifdefs to improve builds (#1325)
* mmu: hide some jit and fast mmu functions behind ifdef
* linux: move log to the correct place
2023-12-01 15:03:59 +01:00
scribam f3a774ab4e imgui: use fonts upload code from v1.90 2023-12-01 15:02:43 +01:00
Flyinghead bd25c14cfd libretro: fix manic panic touchscreen buttons 2023-11-29 12:31:30 +01:00
Flyinghead 035ea0b0c0 Force HLE bios for stupid invaders. Don't autosave state if networking
Force HLE bios for stupid invaders
Issue #354

Don't autosave state if GPPO or naomi networking is on
2023-11-29 12:30:16 +01:00
Flyinghead d6593b9c6e maple: race controller has only 3 axes
Reporting 5 axes (with the optional pedals unit) breaks some games:
daytona usa, super speed racing, F1 world grand prix, ...
2023-11-29 12:26:04 +01:00
scribam 105ab95efa deps: update imgui and implot 2023-11-25 17:08:01 +01:00
Edward Li 2c711e46fe Batch script for generating Visual Studio project 2023-11-25 17:07:34 +01:00
Edward Li 923be3899d msvc: update zlib includes, set default startup project 2023-11-25 17:07:34 +01:00
Flyinghead cb518b5481 serial: fix RDF and TDFE status bits
RDF and TDFE can't be reset if tx/rx fifo is below/above trigger
Remove rx overrun check
Proper reset of scif state
Fixes maxspeed, vonot and hell gate battle cable.
Tetris connects but still has input responsiveness issues.

sh4 mmr: use unnamed bitfields
2023-11-25 17:06:45 +01:00
Flyinghead a18e3701c6 Merge remote-tracking branch 'origin/master' into dev 2023-11-25 16:58:59 +01:00
Flyinghead 2ed4b4a984 tentative uwp build fix 2023-11-25 15:55:24 +01:00
Flyinghead f11a5981fe dynarec: increase code cache free space limit from 16 to 32 KB
Windows CE games have huge code blocks. (Tomb Raider - Last Revelation)
Fixes MINIDUMP-21R
2023-11-25 15:53:52 +01:00
github-actions[bot] ea83b08f89 Fetch translations & Recreate libretro_core_options_intl.h 2023-11-24 22:19:21 +00:00
scribam b785944560 cmake: use CMAKE_CXX_EXTENSIONS for Nintendo Switch 2023-11-23 16:51:50 +01:00
Flyinghead 8f3124d14e gdrom: increase gdrom ticks by 10%
Fixes Sakura Taisen 3 broken music
Issue #692
2023-11-23 16:49:05 +01:00
Flyinghead 14f3507b86 naomi: initd card reader fix. card reader refactoring
cardInserted was shadowed by initd card reader
use deque and vector instead of array+indexes
2023-11-23 16:44:03 +01:00
Flyinghead 4efacd7d71 Battle cable support
work in progress
f355 and aero dancing seem to work
vonot and tetris don't
maxspeed is broken
2023-11-23 16:40:20 +01:00
Flyinghead a9d5b77053 Merge remote-tracking branch 'origin/master' into dev 2023-11-20 17:13:51 +01:00
Flyinghead bc28c7ccb3 lr: enabke Insert Card button for all card reader games
Hide naomi f355 series and sgdrvsim on non-desktop platforms
2023-11-20 17:11:27 +01:00
scribam f14c29fd04 android: update android gradle plugin to version 8.1.4 2023-11-18 18:21:45 +01:00
scribam 3303ecbbd1 cmake: create folder hierarchy only for Xcode or Visual Studio generators 2023-11-18 18:21:19 +01:00
Flyinghead c4c4c2fde0 naomi: club kart card reader support 2023-11-18 18:20:41 +01:00
Bobby Smith 78a874d20e Add slider to change crosshair size and a core option for the Libretro core (#1304) 2023-11-18 13:44:57 +01:00
Flyinghead ef321d81a4 ui: customizable UI scale factor. rescan content button 2023-11-15 20:48:00 +01:00
Flyinghead df83ca436c input: use 16 bits of precision for analog axes/triggers 2023-11-15 18:24:30 +01:00
Bobby Smith 665ef86cf0 [Libretro] Change VMUs scaling for GL/D3D11 2023-11-15 11:55:25 +01:00
Flyinghead b9601d26e3 disable per-game settings for video routing options
Enabling video routing in a per-game config causes a crash.
Fixes MINIDUMP-22K
2023-11-15 11:54:33 +01:00
Flyinghead 038df0d923 dx9: half-pixel fix for rtt. disable separate alpha/color blend funcs
The dx9 half-pixel translation fix must use the rtt texture pixel size.
Issue #1299

ImGui enables separate alpha and color blending funcs so it needs to be
disabled in the renderer.
Issue #1301
2023-11-15 11:50:45 +01:00
Flyinghead 73cbd7a183 libretro: crosshair/vmu invisible with gl per-triangle/per-strip
libretro needs ofbo.aspectRatio to be set when drawing crosshairs and
vmus
2023-11-15 11:47:34 +01:00
Flyinghead ab25cc73a9 libretro: fix lightgun crosshair blend func and size
Use upscale factor for lightgun crosshair (opengl, dx11)
Fix crosshair blend function (opengl)
2023-11-14 15:46:44 +01:00
Flyinghead a0014bc810 naomi: allow printing for f355/1 screen. Fix print template
f355 vanilla can print even when running with a single screen.
Fix print template by Ciopy Burns
Repeat print template vertically as needed for longer prints
No networking for f355 vanilla
2023-11-14 15:42:20 +01:00
Flyinghead 6de5879cb4 libretro: enable "Insert Card" button for vf4 and barcode games
Still no way to input barcode code however
2023-11-14 15:37:26 +01:00
Flyinghead 32ecb141df libretro: macos build fix
Some OpenGL functions are missing on macOS
2023-11-13 14:39:20 +01:00
Flyinghead 4cd90d8ebb rend: yet another hash fix of vq textures
The calculated size for vq textures was half the correct value, which
affects the texture hash. Calculate the old hash and use it as fallback
for backward-compatibility.
Issue #1291
Make the texture data start address really point to max mipmap data, no
more codebook skipping.
2023-11-13 14:37:38 +01:00
Flyinghead 46eab502e4 libretro: don't link with OpenGL libs on android, windows and linux
Issue #1221
2023-11-12 13:05:13 +01:00
Flyinghead 535fbe29f8 rend: fix hash of vq textures
Do correct hashing of VQ textures to avoid hash conflicts. Keep previous
hash for backward-compatibility.
Issue #1291
2023-11-11 18:57:16 +01:00
Flyinghead 41723a831f use static init when possible. use unnamed bit-fields. refactor vmuBeep
no functional changes
2023-11-11 18:54:10 +01:00
scribam abe1d4fd27 deps: replace glew with glad (#1290) 2023-11-11 18:29:36 +01:00
github-actions[bot] dda04e63fa Fetch translations & Recreate libretro_core_options_intl.h 2023-11-10 22:19:50 +00:00
Flyinghead e60f30b357 naomi: use background template for f355 printing
template courtesy of Ciopy Burns
2023-11-10 17:58:46 +01:00
Flyinghead f0f27558af initd: network config was overriding difficulty level
same for initd, initdv2 and initdv3
disable networking for club kart prize
2023-11-10 17:54:28 +01:00
Flyinghead 0f6a92caad linux: retrieve page size at build time
Fixes RPi 5 16 KB page size. Will not work if cross-compiling however
Issue #1288
2023-11-09 19:29:00 +01:00
Flyinghead 9a60cd7ded kingrt66: network config was overriding other settings
Auto accel, CB Mic and Motor Power settings share the same config byte
in eeprom, so don't change them when configuring network settings.
2023-11-09 19:25:10 +01:00
Flyinghead 926877397c Merge remote-tracking branch 'origin/master' into dev 2023-11-07 16:32:12 +01:00
vkedwardli b92277ac58 macOS: Register file extensions for openFile (Drag ROM to App Icon), update setupWorkingDirectory, rename SDLMain to SDLApplicationDelegate to avoid confusion with the function SDL_main() (#1287)
Register file extensions for openFile, and supports the following actions
    Drag ROM to Application icon to launch the app
    Drag ROM to the running app's dock icon
    Drag ROM to the running app's window (applicable to all SDL platform by SDL_DROPFILE)
Update setupWorkingDirectory
    macOS default cwd is a nonsense "/" for non-terminal application
Rename SDLMain to SDLApplicationDelegate to avoid confusion with the function SDL_main()
some code cleanup
2023-11-07 16:29:08 +01:00
scribam 9a7bf75e4e deps: update sdl to version 2.28.5
Set minimum version required to 2.0.9 because of SDL_JoystickRumble
2023-11-07 16:27:23 +01:00
Flyinghead 1253e1199d tentative sentry build fix 2023-11-05 19:19:22 +01:00
Edward Li 51508dcdc6 macOS: Indicate slave machines by dock badge label 2023-11-05 18:39:37 +01:00
Edward Li f6b3577de5 Save race result image to writable data folder 2023-11-05 18:39:37 +01:00
Edward Li a4ec706c79 Init ThermalPrinter only when cabinet type is Deluxe.
nvmem: Enable printer by default for `f355twin` and `f355twn2`
2023-11-05 18:39:37 +01:00
Flyinghead cb890c7b6f windows: fix run instance with path containing spaces or non ascii 2023-11-05 18:39:04 +01:00
github-actions[bot] dbfead6a15 Fetch translations & Recreate libretro_core_options_intl.h 2023-11-03 22:19:52 +00:00
Flyinghead fd3f207e45 maple: move arcade input settings into maple init
Get rid of settings.input.JammaSetup
2023-11-02 19:00:29 +01:00
Flyinghead 594b403997 naomi: add some (mostly not working) roms
mazanj
dygolfp
shors2k2m
shors2k2s
shors2k2l
shors2k2
wccf116
wccf1dup
wccf212e
wccf234j
wccf310j
wccf331e
wccf322e
wccf331j
wccf341j
wccf400j
wccf420e
galilfac (systemsp)

Fix hotd2p, virnbap, huhimage
2023-11-02 18:44:52 +01:00
Flyinghead bafe07de85 aica: better sounding LPF
Use 4 bits of exponent instead of 5 for the cut off frequency
Force sample to 0 if cut off freq is 0
Improve BIOS menu sounds
Issue #108
2023-11-02 18:33:14 +01:00
Bobby Smith 3e047a6e03 Create expansion device for "Racing Controller" 2023-11-01 15:43:08 +01:00
Flyinghead 29c0dca0ce naomi: enable printer for all f355 editions
only usable in deluxe mode (f355twin, f355twn2)
2023-11-01 15:41:41 +01:00
flyinghead 5cfd3f0ba3 Merge pull request #1274 from bslenul/lr-invalid-values
[Libretro] Remove some "Invalid value" errors
2023-10-31 13:55:23 +01:00
flyinghead 923dcf10a7 Merge pull request #1271 from notcbw/enable_deadzone
Minor GUI change to add an option that sets the deadzone for analog sticks
2023-10-31 13:55:12 +01:00
Flyinghead 7b71bd319c Android and iOS support. Change dead zone to integer % value in UI
UI: dead zone changes from 0 to 100%. Add % for Rumble too.
Support Android and iOS gamepads.
Assume legacy gamepads have an analog stick (evdev, xinput)
2023-10-30 18:28:29 +01:00
Flyinghead 51089c5e0a aica: always avoid race condition when sh4 interrupt is raised
... even if an SH4 interrupt is already asserted.
Regression introduced by c7d214e55a
Fixes audio freeze in Test Drive Le Mans
Issue #1267
2023-10-30 17:47:19 +01:00
Flyinghead 24944e00a7 force Full Framebuffer Emulation for some games
Eisei Meijin III
Marionette Company
World Neverland Plus
Issue #1266
2023-10-30 17:43:33 +01:00
Bobby Smith 66faf0d330 [Libretro] Remove some "Invalid value" errors 2023-10-30 16:21:26 +01:00
Bowen Cui c0de126b2b Add option to set deadzone for analog sticks 2023-10-30 05:21:36 -04:00
github-actions[bot] c1f0a5a15f Fetch translations & Recreate libretro_core_options_intl.h 2023-10-27 22:19:54 +00:00
Flyinghead f640b32cc9 enable Copy to VRAM for a bunch of games
Worms World Party (US)
Hundred Swords
Musapey's Choco Marker (dreamcast)
Choco Marker (naomi)
Sister Princess Premium Edition
Sentimental Graffiti 1 & 2
Kanon
Aikagi
AIR
Issue #1265
2023-10-27 14:56:28 +02:00
Flyinghead 93e47dd410 aica: don't change LEA for non-looping sounds
Non-looping sounds with LSA=0 and LEA=0 shouldn't be played at all.
Regression introduced by dac5b991e0.
Fixes white noise in Sonic Adventure Emerald Coast action stage.
Issue #1264
2023-10-27 14:52:07 +02:00
Flyinghead 8fb3def2d5 gl oit: fix several issues
Disable blending when rendering a-buffers. Fixes ECW Anarchy Rulz black
title screen and Demolition Racer glitchy end of race screen.

Use palette in the depth pass for punch-through polygons using palette
texture. Fixes shadow issue in Alone in the Dark.

Copy ouput fbo to geom_fbo before drawing. Fixes missing transparent
polygons in subsequent partial renders. Fixes Test Drive Le Mans missing
labels in loading screen.

Issue #1262
2023-10-25 16:59:01 +02:00
Flyinghead 98a0f2b821 gl: frame upside down with GLES 2.0 if video shift is on
drawQuad ignores the swapY param if vertices are provided so swap Y
coords of vertices.
2023-10-25 16:53:25 +02:00
Flyinghead 4fafa91506 gl: disable dithering with GLES 2.0
GLES 2.0 doesn't allow initialization of const arrays.
Fixes MINIDUMP-1YP MINIDUMP-1YQ
2023-10-25 16:51:44 +02:00
Flyinghead 09a1fea40f arm32: fix host rounding mode on android
It looks like setting host rounding stopped working on armv7 android a
while ago (v1.0 already has the issue). Directly setting the host FPSCR
register doesn't work so use the C99 standard functions fegetenv and
fesetenv instead.
Fixes flickering yoshimitsu legs in Soul Calibur.
Fixes rotating objects in Sword of the Berserk.
Issue #556
Issue #1259
2023-10-25 16:48:58 +02:00
Flyinghead e55d70c0e6 dx9,dx11: depth surface and temp render target resize issue with RTT
dx9: resize depth surface to max width and height when RTT
dx11 oit: resize all depth and temp render targets when RTT but keep
current framebuffer.
Fixes Flag to Flag not updating the screen when RTT'ing rear view
mirrors.
Issue #1257
2023-10-23 10:36:41 +02:00
Flyinghead ca45ff3834 default to Vulkan renderer if OpenGL not compiled in
Issue #1258
2023-10-23 10:10:49 +02:00
Flyinghead 35c71ebcfd rend: add hcount and vcount used by meltyb for video shift calc
meltyb (and possibly others) uses hcount=850 (instead of 851) and
vcount=528 (instead of 529)
2023-10-22 12:08:19 +02:00
Flyinghead 33edcca348 texture: expand color data of planar textures
Partial revert of f4835a89d3
Fixes color differences between planar and !planar textures in Sakura
Taisen 2.
Issue #1256
2023-10-22 10:17:01 +02:00
Flyinghead dac5b991e0 aica: ignore LEA if <= LSA
Fixes Legacy of Kain Ash Village music
Issue #1104
2023-10-22 10:12:30 +02:00
Flyinghead 8ba5e05421 android scoped storage: default to hack the uri manually in getParentUri
If DocumentsContract.Path.getPath() fails, try to hack the uri manually
instead of returning null/empty (android 10)
2023-10-21 21:40:13 +02:00
github-actions[bot] 35b7be3905 Fetch translations & Recreate libretro_core_options_intl.h 2023-10-20 22:19:13 +00:00
Flyinghead b7d923e02b maple: clear mapleDmaOut on reset. Other reset issues
mapleDmaOut wasn't reset, causing crashes or freezes in subsequent runs
Issue #1253

reset YUV state, pvr tile clip, MMU sq_remap, sh4 sq_buffer and more
2023-10-20 16:15:42 +02:00
Flyinghead eaf2c0064c enable copy to vram for sakura taisen 1
Issue #1252
2023-10-19 19:58:05 +02:00
Flyinghead a65cd9e5f9 savestate: fix retroarch savestate compatibility
A new RA header must be skipped in standalone
2023-10-19 19:56:43 +02:00
Flyinghead e94b26f1df gdrom: return blank sector if FAD miss
Fixes NBA Hoopz (US) voice samples
Issue #1247
2023-10-17 14:29:05 +02:00
Flyinghead e96b38ff5c rend: support vscalefactor > 1 for RTT
SCALER_CTL.vscalefactor also applies to RTT and values > 1 will increase
the texture height.
dx11: initialize abufferPointers to avoid issues with first frame
rendered.
Fixes pause menu/battle animation with Skies of Arcadia (PAL)
Issue #1127
2023-10-16 14:51:27 +02:00
Flyinghead e894d4df5c sh4: limit penalty cycles to first 3 mem ops
Fixes choppy video in Dynamite Cop! and Resident Evil 2 intros.
Fixes desync between character and background in UFC championship intro.
Fixes Dino Crisis (JP) desync between video and subtitles.
Fixes South Park Rally boot freeze with one controller and 2 vmus.
Add cheats for Dave Mirra BMX to fix main loop timing.
Issue #1034
2023-10-16 14:39:15 +02:00
Flyinghead c58ae4daac vulkan: terminate context if init fails
Avoids crash on exit
2023-10-16 14:19:47 +02:00
github-actions[bot] cb9af7d742 Fetch translations & Recreate libretro_core_options_intl.h 2023-10-13 22:19:51 +00:00
Flyinghead 2a364dee67 dynarec: check null codeBuffer in rewrite() if called before init
Fixes MINIDUMP-1VN, MINIDUMP-1X1, MINIDUMP-1XD
2023-10-13 11:41:18 +02:00
Flyinghead 56107b3667 dx11 oit: missing depth pass for transparent polys when autosort=0
The depth pass with transparent polys must also be done when autosort=0.
Fixes The Grinch pause menu
Issue #1244
2023-10-13 11:00:19 +02:00
Flyinghead 31aab32d95 dx9: unreleased resources make device reset fail
dcfbSurface and vmu texture were leaked when updated, causing the device
reset to fail when maximizing or restoring the app window.
Issue #1243
2023-10-13 10:55:45 +02:00
Flyinghead 0b66409ed2 naomi: default eeprom for pokasuka ghosts
Fixes coin assignments error at boot
Issue #1237
2023-10-13 10:51:07 +02:00
Flyinghead 8ae288d2ca gdb: revert swapping of words
Partial revert of b0a520fe18
Short and ints shouldn't be swapped.
gdb can handle both little and big endian SH4 (set endian big/little).
2023-10-12 09:49:55 +02:00
Flyinghead 4419ff310a naomi: default eeprom for manic panic
Fixes coin assignments error at boot
Issue #1237
2023-10-12 09:36:09 +02:00
Flyinghead 2f524923da set extra depth scale back to 0.1 for Caesars Palace 2000
Fixes pause menu background transparency in video keno game.
Regression introduced by cc1b45b7cc
Issue #1236
2023-10-11 14:42:35 +02:00
Flyinghead 07d761a880 rec x64: move jit_set_exec out of exception scope in rewrite 2023-10-11 14:28:39 +02:00
Flyinghead f6f6637973 naomi: mushikep compatibility 2023-10-11 14:25:11 +02:00
Flyinghead 2cd3ffb33f Revert "vk oit: add sync event between renderer and vk context on Mali
gpu"

This reverts commit abd9219347.
Issue #1234
2023-10-11 14:13:34 +02:00
Flyinghead abd9219347 vk oit: add sync event between renderer and vk context on Mali gpu
Use vk event to wait for renderer pipeline to finish before rendering
the final frame in vk context. This seems to help Mali gpus.
Issue #1234
2023-10-11 09:35:18 +02:00
Flyinghead 417a42ae10 boxart: image mix up due to broken rand() on windows
srand() wasn't called and rand() returns the same number twice on
windows (RAND_MAX is only 32767).
Use c++11 random instead.
Issue #1231
2023-10-10 11:47:50 +02:00
Flyinghead 0e12153c45 libretro: frame is flipped vertically with GLES 2
drawQuad ignores the swapY parameter if vertices are provided.
Reverse the shiftY direction for pvr2 filter.
Issue #1233
2023-10-10 11:37:00 +02:00
Flyinghead cb33387ed6 gdrom: clear DRQ on ATA_NOP
Fixes Sentimental Graffiti 2 hang when switching disk
Issue #1232
2023-10-09 22:39:54 +02:00
Flyinghead 38d4689b63 gl,vk,dx: use nearest filtering for mipmap with PT polys
Interpolating between LoDs produces unexpected alpha values.
dx,vk: add negative LoD bias
Fixes "Press Start" text in Trizeal title screen

dx11: get rid of bogus nearest wrap hack
Can't reproduce original issue with daytona
Fixes Virtua Tennis title screen
Issue #1230
2023-10-09 21:09:03 +02:00
Flyinghead 23d1db9c75 nvmem: add email address to flash ISP config
Issue #1227
2023-10-09 20:44:15 +02:00
Flyinghead 4e079b5d0b missing override keyword 2023-10-08 19:14:33 +02:00
Flyinghead 3fcbdd3fc5 gl: missing precision qualifier for dithering table
Fixes MINIDUMP-1VR MINIDUMP-1W0 MINIDUMP-1W1 MINIDUMP-1WE MINIDUMP-1WF
2023-10-08 19:13:07 +02:00
Flyinghead 78b44919c5 vk, gl: ignore fb_enable and blank_video during normal render
Fixes some screen missing. Already handled in renderFB. Should be
handled at Present time.
gl4: first frame after renderFB was missing

Issue #1217
2023-10-07 15:46:28 +02:00
github-actions[bot] 13a8d49c90 Fetch translations & Recreate libretro_core_options_intl.h 2023-10-06 22:19:36 +00:00
flyinghead 7308f9a704 sh4: dont change host rounding mode in Sh4_int_Reset()
Don't change host rounding mode in Sh4_int_Reset(), which is typically
called from the UI thread.
Set rounding mode to default before calling renderer (single-thread
mode), restore it before returning.
Fixes issues with dx11 shaders compilation: rounding mode affects
inexact literal float values.
Issue #1224
Issue #1207
2023-10-06 18:17:14 +02:00
Flyinghead 18f9b84af6 elf: memory corruption if .elf file is invalid 2023-10-05 11:45:14 +02:00
Flyinghead 56517b027a naomi: fix gdrom searching in rom parent path
OpenDisc() now throws so exceptions must be caught
Never return null from OpenDisc
2023-10-05 11:43:22 +02:00
flyinghead d4a02e3c2b Merge pull request #1219 from scribam/android
android: update android gradle plugin to version 8.1.2
2023-10-04 17:07:39 +02:00
flyinghead 33131e1395 Merge pull request #1214 from scribam/sdl
deps: update sdl to version 2.28.4
2023-10-04 17:06:58 +02:00
flyinghead 73ac46f421 Merge pull request #1213 from scribam/lua
lua: set minimum version required to 5.2
2023-10-04 17:06:08 +02:00
scribam 7fc70ee1f4 android: update android gradle plugin to version 8.1.2 2023-10-03 22:50:35 +02:00
scribam d9b5f27311 deps: update sdl to version 2.28.4 2023-10-02 21:42:47 +02:00
scribam 252838d896 lua: set minimum version required to 5.2 2023-10-02 19:52:33 +02:00
Flyinghead cb91ad3ae0 reset platform to dreamcast after unloading game
so that Language, Broadcast, Cable, etc. are enabled in the UI
2023-10-01 20:07:59 +02:00
Flyinghead 60f3d718ac arm64 rec: fix crash with some naomi games (regression)
Fixes crash with doa2a and doa2m and some atomiswave conversions.
Regression due to b47f4f56ef
Fixes MINIDUMP-1TY, MINIDUMP-1TD, MINIDUMP-16Q, MINIDUMP-1AC
2023-10-01 19:31:18 +02:00
github-actions[bot] e8e382372a Fetch translations & Recreate libretro_core_options_intl.h 2023-09-29 22:19:16 +00:00
flyinghead 205c365b1b Merge pull request #1208 from flyinghead/dev
merge dev branch
2023-09-27 16:59:19 +02:00
Flyinghead 09857008bd rend: guard against NaN depth if z is negative
Fixes prison white background effect in RayMan 2
Issue #1209
2023-09-27 14:55:31 +02:00
Flyinghead 5eddc26850 dx11: work around some float literal precision issue with the compiler
For some reason the directx compiler doesn't convert float literal in a
deterministic way (!). A difference of one ulp can be seen between
different compilation of the same code.
This causes an issue with the rounding of the alpha value for PT polys.
Issue #1207
2023-09-26 17:05:21 +02:00
Flyinghead 496429d6f4 ci: re-enable fail-fast 2023-09-25 23:10:49 +02:00
Flyinghead a915f185f8 Merge remote-tracking branch 'origin/master' into dev 2023-09-25 22:17:29 +02:00
Flyinghead 0f6e1752e3 rend: clear framebuffer when vram address changes
Fixes top and bottom leftovers from BIOS boot in San Francisco Rush
2049.
Issue #1197
2023-09-25 18:23:26 +02:00
Flyinghead e57ccde532 systemsp: pluggable input manager. fix lr. disable isshoni P1 button 1
Delegate input management to game-specific class
Default, card reader/dispenser and isshoni input managers
isshoni: Use button 1 for touchscreen press
libretro: systemsp input mapping
2023-09-25 17:38:41 +02:00
vkedwardli f75a16f40c Ignore Mouse Capture when Left Ctrl or Left ALT is mapped to a Dreamcast Key (#1203) 2023-09-24 16:02:18 +02:00
Flyinghead a869e183db gl: video shift y needs to be inverted too
follow up to 5ffcdb5f1e
Fix crash in pvr2 post processor when rendering the dc framebuffer
2023-09-24 13:09:00 +02:00
Flyinghead c60edb0090 gl: get rid of async copy to vram
Fix issues when games access texture data directly in vram.
Jet Set Radio custom graffiti copy to vmu. Issue #232
Cardcaptor Sakura best shots. Issue #1089
Grandia II battle start effect.

Force Copy to VRAM for Cardcaptor Sakura, Grandia II, Canvas, Sakura
Taisen 3 and more
2023-09-24 11:29:22 +02:00
Flyinghead 84d82f360b dx11: black screen with full fb emu when scaling. dx9: fb render fix
dx11: black screen when full framebuffer emulation is enabled if scaling
is on (480 -> 240p)
Fixes Mr.Driller. Issue #1067
dx9: wrong stretching when rendering the dc framebuffer if aspect ratio
different from 4:3
2023-09-24 11:04:24 +02:00
Flyinghead b002bdff39 ui: color chooser for crosshair was changing on its own
Only change color when needed and use rounding when converting back to
integer.
Issue  #1074
2023-09-24 10:57:50 +02:00
Flyinghead 5ffcdb5f1e gl: flip Y coord when drawing framebuffer to avoid rounding issues
Flip Y again when drawing to final framebuffer
Fixes HUD characters truncated vertically in Test Drive V-Rally
Issue #1088
2023-09-23 14:57:19 +02:00
Flyinghead 79bbd86c2f rend: Fix PT polygons alpha test
Alpha test for PT polys is done after mixing texture and vertex colors
and clamping. Revert db0534d5dd. See
86235bb4a3.
Fixes visible triangle arrows after selecting a character in Langrisser
Millenium.
Issue #1201

vk oit: OP polygons don't support blending
2023-09-23 14:01:26 +02:00
Flyinghead 39a212140a vk: add bumpmap flag to pipeline hash
Fixes disappearing pause menu text and green wooden boxes in Mat
Hoffmann's Pro BMX
Issue #878
2023-09-23 11:13:14 +02:00
github-actions[bot] dddd712f08 Fetch translations & Recreate libretro_core_options_intl.h 2023-09-22 22:19:05 +00:00
Colton Pawielski a7dbbbe578 Add Dreamcast 32MB RAM Mod (#1198) 2023-09-22 11:10:44 +02:00
Flyinghead 2445739c0e arm,arm64 rec: check fault location before attempting to rewrite
Ignore fault if pc isn't in the dynarec code buffer.

Fix for MINIDUMP-1S0, MINIDUMP-1RS
2023-09-20 17:25:09 +02:00
Flyinghead 403f1f635b systemsp: load rom boot id from compact flash volume
Open and decrypt 1STREAD.BIN then the image file to extract the rom boot
id.
Fix boot id for non-encrypted roms (bingogals)
Reset naomi default eeprom when forcing different region and before
reloading the bios.
2023-09-20 17:22:28 +02:00
Flyinghead 879372cb79 rec-x64: use FMA when available
x64 vfmadd is a better implementation of the sh4 FMAC op, so use it if
available. Fall back to mul+add if GGPO is enabled to avoid desyncs
between different cpu models.
Issue #1201
2023-09-20 17:14:50 +02:00
Flyinghead 6b05c0ab01 tex conv: extend alpha channel of planar 4444 textures
The alpha channel needs to be extended for PT polygons to work. Fixes
Langrisser Millenium black title screen and missing textures on
character selection screen.
Issue #1201
2023-09-20 17:06:05 +02:00
Flyinghead 289f264371 systemsp: set correct region for rom games
Override the region when not supported by the game. Only works for rom
games.
2023-09-19 17:59:20 +02:00
Flyinghead 869ddb643d systemsp: initialize media name and default eeprom
Fix failure to load a systemsp rom game after running a compactflash
game.
Fix error 05 if selecting the wrong region then switching to Japan.
2023-09-19 16:13:27 +02:00
Flyinghead c63f1a9997 pvr: background poly vertex order fix
Fix background poly vertices coordinates to form a valid triangle strip

Fixes lovebery bogus background poly on character selection screen.
Issue #1200
2023-09-19 16:08:22 +02:00
Flyinghead 0fc0dc5101 systemsp: rfid management chip emulation
fixes dinoking, dinokior, dinoki25, lovebery, lovebero and loveber3
2023-09-18 11:00:08 +02:00
github-actions[bot] 213bc70e2d Fetch translations & Recreate libretro_core_options_intl.h 2023-09-15 22:19:06 +00:00
Flyinghead c839bc89eb naomi: crash when loading a legacy .bin rom
More fix for MINIDUMP-1DA, MINIDUMP-1D8, MINIDUMP-1EM
2023-09-15 18:50:55 +02:00
Flyinghead 84f2871650 renderer: set render timeout to 20 ms to reduce input lag at 30 FPS
Fixes mouse not responding in 30 fps (Quake 3) or variable fps games
(Unreal)
Issue #949
2023-09-14 15:18:56 +02:00
Flyinghead e1b4d4d703 naomi: crash when loading a legacy .bin rom
Fixes MINIDUMP-1DA, MINIDUMP-1D8, MINIDUMP-1EM
2023-09-14 15:08:56 +02:00
vkedwardli b564b0bf91 Increase L2+ / R2+ trigger sensitivity for digital buttons (#1190) 2023-09-14 09:08:58 +02:00
Flyinghead 7e1dcf9003 maple: move test, coin and trigger buttons into the upper 16-bit range
avoid interfering with regular jvs/maple buttons
2023-09-12 19:13:40 +02:00
Flyinghead 0f4c903fed ios build fix 2023-09-12 19:06:59 +02:00
Flyinghead 0ac483acfc sh4 dynarec refactoring
sh4 code buffer class
dynarec interface and implementations
2023-09-12 16:52:25 +02:00
Flyinghead f4835a89d3 implement dithering in full FB mode
gl, vk, dx11, dx9: implement ordered dithering in GLSL/HLSL
refactor framebuffer and texture writes to vram
don't expand color data when reading planar textures
2023-09-10 16:25:19 +02:00
Nejsplitter 139f248572 libretro: Allow up to 300 MHz overclock (#1193) 2023-09-09 17:00:00 +02:00
flyinghead b23d37f76f lr dx11: set all shaders in Quad to avoid conflicts with RA
RA uses geometry and/or compute shaders, which must be disabled when the
core is drawing.
Issue #1192
2023-09-09 16:22:50 +02:00
flyinghead 56358be542 lr: opengl OIT renderer not enabled at startup
default renderer on windows is now dx11, which confuses the lr opengl
graphics context creation.
Issue #1191
2023-09-09 16:09:59 +02:00
Edward Li 1377e61d03 DX11: Use high performance GPU on Windows 10 (1803 or later) 2023-09-07 09:51:45 +02:00
Flyinghead ce694ba8b5 apple: vulkan sdk 1.3.261.1 2023-09-02 20:36:08 +02:00
Flyinghead 8eae6b97fc ui: keyboard input was ignored when resuming game if no render
When resuming a game, keyboard is ignored until the next frame is
rendered. This is due to ImGUI not updating its WantCaptureKeyboard flag
until the next frame, which is an issue if the game isn't actively
rendering frames (Zombie Revenge pause screen, Giant Killers)
2023-09-02 20:00:07 +02:00
Flyinghead d29645cc49 naomi: derbyoc JP card reader support. security pic for doa, tduno
Derby owner's club (JP) uses a Sanwa CRP-1231LR card reader. World
edition uses a Sanwa CRP-1231BR.
Set x76f100 security pic content for doa2, doa2a, doa2m, tduno
2023-08-27 17:20:43 +02:00
github-actions[bot] f870ccc23c Fetch translations & Recreate libretro_core_options_intl.h 2023-08-25 22:19:13 +00:00
Flyinghead 3aa2f922e7 fix test 2023-08-25 17:13:45 +02:00
Flyinghead 129fff1c2a naomi: x76f100 and at93cxx implementation. naomi2 elan fix
proper emulation of x76f100 security eeprom and at93cxx serial eeprom
elan: don't reset projection matrix at end of frame. Issue #1177
2023-08-25 17:01:40 +02:00
scribam 10b13dfe9c deps: update to match Vulkan SDK 1.3.261.0 2023-08-24 17:33:47 +02:00
scribam d506cc40a2 deps: update CMakeRC.cmake 2023-08-24 17:33:47 +02:00
scribam 358a54152b deps: update imgui to version 1.89.8 and implot 2023-08-24 17:33:47 +02:00
scribam 06e2c455e8 deps: update sdl to version 2.28.2 2023-08-24 17:33:47 +02:00
scribam a1838eee30 deps: update libchdr 2023-08-24 17:33:47 +02:00
scribam 56b082def7 uwp: add support for arm 2023-08-02 09:32:55 +02:00
Shingo INADA 92a10ba0f0 [input] fix LT2/RT2 mapping save 2023-07-31 16:12:13 +02:00
Flyinghead c637ae8281 Merge remote-tracking branch 'origin/master' into dev 2023-07-30 18:05:38 +02:00
scribam 40953b17c4 uwp: add support for arm64 2023-07-30 18:03:32 +02:00
scribam a473154250 sentry: use new syntax for uploading files 2023-07-30 18:02:56 +02:00
scribam 13f3c3e228 android: update cmake and ndk 2023-07-30 18:02:43 +02:00
scribam 817cc87c8c android: update android gradle plugin to version 8.1.0 2023-07-30 18:02:43 +02:00
GABO1423 ab09efa762 (README) Modify Xbox Section 2023-07-28 10:03:31 +02:00
Flyinghead 7061c043d9 naomi: derbyocw card support. serial pipes refactoring. systemsp fixes
common interface for most serial pipes
jvs: MIE RS422 port support
card reader: allow reading/writing of individual tracks
systemsp:  fix interrupt handling. refactor serial ports. isshoni wanwan
puppy touchscreen support
2023-07-26 21:34:03 +02:00
Flyinghead 92a19e9250 hopper fixes. fix kick4cash input
kick4cash encoders are rotated 45° and polling is done twice per frame.
add bet button to shootout pool and club kart (prize)
hopper: load/save config. fix pay out and bet values. proper defaults
based on selected currency.
2023-07-23 17:16:08 +02:00
scribam 4f5fd31d81 archive: replace zip_get_num_files (deprecated) by zip_get_num_entries 2023-07-22 19:04:52 +02:00
scribam 1b565f9879 clang-tidy: run modernize-concat-nested-namespaces 2023-07-22 19:04:52 +02:00
scribam d2b475ae41 boxart: remove redundant call to c_str() 2023-07-22 19:04:52 +02:00
Lucas Azevedo 9c61006941 Fix GUI SDL mouse buttons
Clicks were swapped in GUI as SDL uses 2 for middle and 3 for right and
the GUI expects the opposite (minus 1).
2023-07-18 11:00:58 +02:00
scribam 4db26bc092 spg: fix warning 'vblk_cnt' defined but not used 2023-07-16 19:57:51 +02:00
Flyinghead 8c0f543bc8 naomi: hopper support for kick'4'cash, shootout pool and club kart prize
high level emulation of 837-14438 and naomi SWP hopper boards
2023-07-16 19:57:16 +02:00
Flyinghead 8e3a48eb6f naomi: fix shootout pool inputs
Use button 1 to switch between cue aim and cue roller rotary encoders.
Remap start/mode to start
2023-07-16 19:10:39 +02:00
Flyinghead 7a22318b0f sdl: don't send button up events based on mouse button state
as doing so cancels other inputs bound to the same target
2023-07-16 19:03:07 +02:00
github-actions[bot] a0bf24f7cc Fetch translations & Recreate libretro_core_options_intl.h 2023-07-14 22:20:09 +00:00
Flyinghead 3c6eaa4d34 aica arm: use scratch reg for call/jump if offset if too big (armv7)
Issue #1148
2023-07-14 21:32:49 +02:00
Flyinghead 3bf817aea1 vk: reset semaphore index to 0 when recreating the swap chain
When frame dupe is enabled and switching to fast forward, the current
semaphore index might end up pointing past the end of the semaphore
array, causing a crash.
Issue #1138
2023-07-10 12:41:13 +02:00
scribam a3ebe02f85 vk: modernize device properties retrieval 2023-07-09 18:51:44 +02:00
scribam 4eda9ebffc cmake: exclude nowide tests from unit tests 2023-07-09 18:50:47 +02:00
Edward Li 278f26aadd macOS: Enable clipboard functions and corresponding menu items 2023-07-06 18:42:31 +02:00
Flyinghead 17b82ab5d3 ci: disable fail fast on c-cpp job because of MacOS failures 2023-07-05 10:59:12 +02:00
Flyinghead 30e66d1c17 reios: ignore high order bits for FAD
Mask FAD with ffffff. Apparently the regular BIOS does the same. Fixes
bogus FAD issued by Guilty Gear X when playing CD audio.
Issue  #1124
2023-07-05 10:23:54 +02:00
Edward Li 2089015221 Fix Spout2 MinGW error 2023-07-03 11:38:35 +02:00
Edward Li e19a62aa07 Ignore brew update failure 2023-07-03 11:38:35 +02:00
scribam 42d003597e deps: update sdl to version 2.28.1 2023-07-03 11:38:06 +02:00
scribam f9da57d87f deps: reapply patches to vixl 2023-07-03 11:37:42 +02:00
scribam daf8230cca deps: update vixl 2023-07-03 11:37:42 +02:00
Flyinghead f02265b662 systemsp: fix sram addressing
translate dinoki4 rom name
2023-07-03 11:36:59 +02:00
Flyinghead 5eb893a995 Sega SystemSP support
add naomi roms: anpanman2, anpanman2a, drbyocwt and clubkpzbp
2023-07-01 16:24:51 +02:00
Flyinghead dfd517706a Merge remote-tracking branch 'origin/master' into dev 2023-07-01 16:03:10 +02:00
Flyinghead b47f4f56ef user-defined literals: _KB, _MB, _GB 2023-07-01 14:31:25 +02:00
Edward Li a870fb7f6c deps: update vulkan to 1.3.250.1, fix 404 on macOS 2023-06-30 18:12:53 +02:00
vkedwardli 7cd308fcae Realtime Video Routing (#1126)
* Syphon video routing with OpenGL and Vulkan (MacOS)
* Spout video routing with DX11 and OpenGL (Windows)
* Fix Xcode detection
2023-06-26 11:56:56 +02:00
scribam 6e6f75386b deps: update sdl to version 2.28.0 2023-06-26 11:53:22 +02:00
Flyinghead aad4921e09 picotcp: fix kos ppp nego. modem,bba: fix kos detection
picotcp: ignore conf ack received when lcp layer is up (kos ppp)
picotcp: ignore icmp ping seq and id #
scheduler: add void * arg to callback function. Get rid of static instances when possible
bba: use scheduler to delay link changes (fixes kos bba detection)
modem: fix soft reset. don't reset TDBE during reset (fixes kos modem detection)
2023-06-23 11:40:22 +02:00
Flyinghead 8b8113b482 Merge remote-tracking branch 'origin/master' into dev 2023-06-23 10:12:32 +02:00
Ricardo Mendonça Ferreira 98acd1178d Libretro: support for more controllers, code cleanup
Added support for new controllers in the Libretro interface: 
- Maracas (RETRO_DEVICE_MARACAS)
- Fishing Controller (RETRO_DEVICE_FISHING)
- Pop'n Music (RETRO_DEVICE_POPNMUSIC)
- Race Controller (RETRO_DEVICE_RACING)
- Densha de Go! (RETRO_DEVICE_DENSHA)

Also did a bit of refactoring, mostly for readability, but also moving repeated code into functions.
2023-06-22 22:28:25 +02:00
Flyinghead 0070f9abad network: fix known UDP ports bind regression
introduced by b4e5af6346
Add driving strikers netdemo known port
Issue #1112
2023-06-21 16:31:01 +02:00
Flyinghead dca048981f network: process both inbound and outbound packets for 2k games
DreamPi processes inbound packets on tcp port 5011 (dc2k2) so let's do
both.
Issue #1112
2023-06-18 11:20:40 +02:00
Eric Warmenhoven 74b98d85ed libretro: another apple platforms build fix 2023-06-16 17:27:14 +02:00
Flyinghead 67a7637b9f network: tentative fix for 2k sport games
Fix port 5011 outbound packets instead of incoming ones for original hw
interop.
Issue #1112
2023-06-16 17:26:39 +02:00
Eric Warmenhoven 2511a19d2d libretro: apple platforms build fix 2023-06-15 16:05:36 +02:00
deviato f04ddad94f Update README.md 2023-06-15 16:05:08 +02:00
Flyinghead b4e5af6346 picotcp: bind native udp socket to the same local port as the pico one
The Toy Racer server ignores the source udp port so it must match the
dreamcast one. Will not work if the port is in use or well-known, or if
NAT gets in the way.
Issue #1112
2023-06-15 16:04:32 +02:00
Murad "Gness Erquint" Beybalaev f679fd9ba9 Typo in GUI.
"Covert art" → "cover art".
2023-06-13 14:56:33 +02:00
Flyinghead b6930a2a9e rend: force texture scanorder to 0 if vq and mipmap are set
Fixes crash and corrupted texture in Star Wars Demolition
Issue #1108
2023-06-13 14:55:47 +02:00
scribam 4db7137dbf deps: update miniupnpc to version 2.2.5 2023-06-12 16:07:41 +02:00
scribam bee534922b android: update android gradle plugin to version 8.0.2 2023-06-12 16:06:20 +02:00
Flyinghead d6fe46649c sdl: also use F11 to toggle fullscreen
in addtion to alt+enter
2023-06-12 16:05:34 +02:00
Flyinghead 236539c881 lr: add missing libs object files (elf, resource) for switch
Issue #1098
2023-06-05 17:17:51 +02:00
Flyinghead 2644c2ef47 pvr: more std::vector::operator[] UB
Issue #1100
2023-06-05 17:13:40 +02:00
scribam f590766421 deps: update nowide 2023-06-04 12:49:55 +02:00
Flyinghead fa1c62d11a naomi: fix spawn eeprom network settings 2023-06-04 12:49:35 +02:00
Flyinghead ffc0a42c18 std::vector::operator[index] with index >= size is UB 2023-06-04 12:48:50 +02:00
github-actions[bot] bc3c1ab628 Fetch translations & Recreate libretro_core_options_intl.h 2023-06-02 22:19:35 +00:00
vkedwardli 6c249ee4d2 Set header() and OptionArrowButtons() alpha to 1.0f (#1096)
* Set `header()` alpha to 1.0f

* Do not grey out `OptionArrowButtons()` also
2023-06-02 14:26:04 +02:00
Edward Li 3330f01267 Different config folder for multiple instances 2023-06-02 14:25:20 +02:00
scribam bd946bfbea deps: update imgui to version v1.89.6 2023-06-02 14:24:32 +02:00
Flyinghead bb92e9f7a4 add rfid cheat for mushik2k 2023-06-02 14:23:46 +02:00
Flyinghead 63686eeee1 naomi: add fallback bios files. Proper region names
ui: use proper region names for arcade (export, korea)
naomi: add previous version of BIOS files and fall back if latest ver
not found
fall back to use multiregion bios hack for korea
add CRC for all bios files
2023-06-02 14:23:14 +02:00
scribam c0a286532a deps: update Vulkan-Headers and VulkanMemoryAllocator 2023-05-31 17:03:20 +02:00
Eric Warmenhoven ce0354f294 Fix libretro build on apple platforms 2023-05-31 17:02:49 +02:00
Flyinghead 231a1b624f maple: fishing controller vibration pack, analog to dpad
refactoring to avoid duplicate code
2023-05-31 17:01:54 +02:00
Flyinghead 9b8fd39d12 libelf: make static lib
gentoo builds shared libs by default
2023-05-31 16:54:48 +02:00
Flyinghead 90c4e42c11 naomi: add mushikk, mushikc and mushik2k
cheats for mushikk and mushikc rfid check
mushik2k needs rev.H korean bios and won't boot
2023-05-31 16:53:49 +02:00
flyinghead ee806bc035 Merge pull request #1090 from flyinghead/dev
Merge dev branch: f355 multiboard, manic panic, touch de uno, vf4 netdimm, ...
2023-05-30 15:51:35 +02:00
Flyinghead d76611730e scraper: check for null disc after opening
Fixes MINIDUMP-11H
2023-05-29 17:34:29 +02:00
Flyinghead bdd677d66a ui: disable non-functional Dreameye maple device
Fix for MINIDUMP-127
2023-05-29 17:31:55 +02:00
Flyinghead 2299c9fade gl: detach and delete shaders after linking program
Fix attempt for MINIDUMP-RA, MINIDUMP-RM, MINIDUMP-Y7
2023-05-29 17:28:28 +02:00
885714e883 Support for Maracas & Pop'n Music controllers, WIP for others (#1035)
Racing controller, fishing controller and Densha de Go controller

Co-authored-by: Ricardo <[email protected]>
Co-authored-by: Flyinghead <[email protected]>
2023-05-29 12:45:34 +02:00
Flyinghead f95c7212bf gcc13 build fix 2023-05-28 11:43:58 +02:00
Flyinghead bb0da9488f bump glslang to 12.2.0
Fix gcc13 compile error
2023-05-28 10:56:14 +02:00
Flyinghead 1aeacb0297 android: storage::getSubPath can throw 2023-05-28 10:52:16 +02:00
github-actions[bot] b92b7a3ece Fetch translations & Recreate libretro_core_options_intl.h 2023-05-26 22:19:12 +00:00
Flyinghead 0a1fe0135f lr: default language=EN, region=USA. TrickStyle fix
libretro: set default language to English and default region to USA.
Same as standalone.

Force language to English for TrickStyle (US)
Issue #1082
2023-05-25 13:18:42 +02:00
Flyinghead 4391058563 aica: dma cycles schedule tweak
Increase lower limit to schedule dma callback from 224 to 513
Fixes freeze/crash in Nomad Soul
Issue #1080
2023-05-25 13:02:14 +02:00
Flyinghead ea9bdd03e4 Merge remote-tracking branch 'origin/master' into dev 2023-05-24 10:44:14 +02:00
Flyinghead ed99c96232 mmu: slow mmu build fix 2023-05-24 10:43:20 +02:00
Flyinghead 755e17dc97 rend: fix clipping edge case
Fixes some transitions in Bokomu no Tatsujin
Issue #1072
2023-05-24 10:31:55 +02:00
Edward Li 76af42ae6e Latest Vulkan SDK has a new volume name VulkanSDK 2023-05-23 10:21:40 +02:00
A-w-x e94babe57e update breakpad submodule 2023-05-22 20:37:57 +02:00
Flyinghead 416e4c5366 appimage: AppImageKit-checkrt -> linuxdeploy-plugin-checkrt 2023-05-22 15:55:57 +02:00
Flyinghead 6b9840268f vf4: fix networking on windows (vanilla, evo). Add eeprom and nvmem
connect returns EWOULDBLOCK instead of EINPROGRESS on windows
add eeproms for vf4, vf4evo and vf4tuned (2-player cabinet)
add nvmems for vf4, vf4evob and vf4tuned (network & card readers
enabled, all day card schedule, stage select, ...)
2023-05-20 11:19:26 +02:00
github-actions[bot] 415d8c2ea3 Fetch translations & Recreate libretro_core_options_intl.h 2023-05-19 22:19:19 +00:00
Flyinghead 3f456c6738 vf4: insert card now ejects the card if already inserted
support vf4 card renewal
2023-05-19 17:45:18 +02:00
Flyinghead 59480ea5a6 gdrom: force ADR to 1 for all tracks in TOC. Set lead-out as data
Fixes gdrom check in Eldorado Gate 4 to 7
Issue #1043
2023-05-17 16:30:24 +02:00
Flyinghead 920666bc70 rent a hero 1: hle bios fix
Issue #1070
2023-05-17 16:20:46 +02:00
Flyinghead eebcb322cf vk: imgui crash during start up
font tex id must be nulled when destroying vk objects
2023-05-16 16:36:56 +02:00
scribam 04b0489ff3 deps: update imgui_impl_vulkan.* 2023-05-16 14:51:03 +02:00
scribam dd5f44ff91 deps: update imgui_impl_dx* 2023-05-16 14:51:03 +02:00
Flyinghead a7b89ba06a android: don't get null array region in jni_util
Fixes MINIDUMP-YY
2023-05-16 14:45:31 +02:00
Flyinghead e5344d37d0 gdrom: fix cdda restart. revert previous change. fix hle pause/release
Revert changes from Issue #690
Fixes cdda restart in Mr.Driller, Bust-a-move 4, Wetrix+ and Reel
fishing. Issue #1019
hle: returning current cdda information fixes the pause/release issue
2023-05-16 14:33:33 +02:00
Flyinghead c07f862ef2 ggpo: exchange vf4 cards when starting the session 2023-05-16 09:43:21 +02:00
Flyinghead 8b0add47a2 revolt(jp): scale down depth to avoid menu glitch
This game uses large depth values in the menus (2000000)
Issue #1065
2023-05-14 17:34:30 +02:00
Flyinghead fe9ce46ab1 pvr: don't crash when hblank int mode is invalid or unsupported
Fixes MINIDUMP-ZE
2023-05-14 16:42:14 +02:00
Flyinghead 01c5c98396 pvr: check current ta context index when deserializing
Fixes MINIDUMP-YS
2023-05-14 16:40:36 +02:00
Flyinghead d00f07acb8 naomi: check cart malloc
Fixes MINIDUMP-QW
2023-05-14 16:36:14 +02:00
Flyinghead 83bfa9158d aica: don't crash if AFSEL=1
Fixes MINIDUMP-XW
2023-05-14 16:22:10 +02:00
Flyinghead ac2637286b Merge remote-tracking branch 'origin/master' into dev 2023-05-13 15:55:47 +02:00
flyinghead 541544292a dx11 oit: resize to null width and height when rendering to texture
Regression introduced by d2e8c9465b
Issue #974
2023-05-13 15:09:27 +02:00
github-actions[bot] 97bd3fc082 Fetch translations & Recreate libretro_core_options_intl.h 2023-05-12 22:19:18 +00:00
scribam 71ce2a2415 cmake: use c++17 globally 2023-05-12 10:46:48 +02:00
Flyinghead 4b0d377e66 pvr: don't clip negative depth vertices
Fixes baserunner cams depth in World Series Baseball 2K1
Issue #1027
2023-05-12 10:20:46 +02:00
Flyinghead ae2bc8182f pvr: FB_W_CTRL.fb_alpha_threshold comparison is greater or equal
Fixes black tile under player feet in Izumo.
Force CopyToVRAM.
Issue #1040
2023-05-12 10:13:48 +02:00
Flyinghead d9ec14e048 rend: rtt can also use SCALER_CTL.hscale
Issue #1025
2023-05-09 21:28:22 +02:00
Flyinghead c0f0a758df pvr: treat nan intensity as max. avoid nullptr crash in appendSpriteVtx
Fixes Gaiamaster Kessen! black texture. Issue #1021

Fix for MINIDUMP-RC
2023-05-09 21:07:40 +02:00
Eric Warmenhoven 06270e66c8 Build tvOS libretro core 2023-05-08 20:36:40 +02:00
Flyinghead 75fe707de3 bios font kanji row 66 was incorrect
Issue #1059
2023-05-07 21:58:54 +02:00
Flyinghead 1a5a2f64d4 naomi: insert card button compatibility with ggpo
handle insert card button like standard naomi buttons so it can be used
with ggpo
load card data when it's inserted, not before
2023-05-06 20:54:45 +02:00
scribam 220fd51b27 deps: gather backends under imgui/backends directory
stay consistent with upstream
2023-05-04 09:26:01 +02:00
scribam 29cdc77817 deps: update implot 2023-05-04 09:26:01 +02:00
scribam 483c59f2e4 deps: update imgui to version v1.89.5 2023-05-04 09:26:01 +02:00
scribam 1fdab613fd deps: update glslang and Vulkan-Headers to sdk-1.3.243.0 2023-05-04 09:25:24 +02:00
scribam 539b9e7746 cmake: improve target architecture detection 2023-05-04 09:24:48 +02:00
scribam 045f693eef ci: use freebsd 13.2
remove unused png package
2023-05-02 09:46:28 +02:00
scribam 3192f84576 remove unused iconv.h include 2023-05-02 09:45:54 +02:00
Flyinghead 27038d4cf9 fix test 2023-04-29 18:02:26 +02:00
scribam 4acb670b88 netbsd build fix 2023-04-29 17:51:25 +02:00
Flyinghead 79b9b49218 naomi: netdimm net client and rfid card reader emulation
high-level emulation of netdimm v3.17 net client lib
vf4/mushiking rfid card reader emulation
2023-04-29 17:50:56 +02:00
Eric Warmenhoven 5f161df06b libretro: Don't use Xcode cmake generator for iOS 2023-04-28 19:59:43 +02:00
Eric Warmenhoven fc3b9046d8 Build fix: iOS libretro core using Xcode 12.2 2023-04-27 18:37:44 +02:00
Flyinghead 754d2a53a0 add mazan nvmem with sword calibrated and free play enabled 2023-04-26 20:20:40 +02:00
Flyinghead e913bae9e3 alienfnt: handle +++ modem escape sequences
Allow modem to start when returning from test mode
2023-04-26 20:17:19 +02:00
Flyinghead 22d228c1b0 imgui: don't send X button events to avoid the nav window popping up
Issue #1034
2023-04-26 20:14:18 +02:00
Eric Warmenhoven d3a3cab425 Build iOS libretro core 2023-04-26 14:39:04 +02:00
Eric Warmenhoven 1fe7352ed0 libretro: avoid exporting symbols on osx
On Mac when running a debug build of flycast and retroarch in the
debugger, it gets confused about which glsl to pick. The easiest way
to fix this is to build the flycast core in a way where it's only
exporting symbols that are going to be called by retroarch directly.
2023-04-26 14:39:04 +02:00
Flyinghead 9d1a5cf0d3 ui: allow horizontal screen stretching up to 250%
Issue #1012
Issue #609
2023-04-24 17:41:42 +02:00
Flyinghead c8a45d95a7 dynarec: fix mov64 edge case when registers must be swapped
Handle case where mov64 must swap its operands depending on register
allocation.
Fix canonical call for FSCA when return operands are register-allocated.

Issue #1020
2023-04-24 17:38:49 +02:00
Flyinghead 92a1c1891b alienfnt: support for serial modem and worldwide ranking server
Emulate modem on sh4 serial port.
Use picotcp stack to handle ppp protocol.
Include nvmem with network settings (server at alienfront.duckdns.org,
disabled by default).
2023-04-16 15:41:54 +02:00
Flyinghead 858174791f disable multiboard on openbsd and netbsd
for lack of interprocess mutexes
2023-04-15 15:45:11 +02:00
Flyinghead fb4e653269 lr: crosshair not transparent with vk. Mazan can be played with gamepad
Use transparent quad pipeline to draw crosshairs and vmus
Allow mazan and touchscreen games (manic panic, tduno, ...) to be played
with a gamepad.
2023-04-15 15:45:11 +02:00
scribam 210100a108 naomi: netbsd/openbsd pthread fixes
These systems do not have pthread_condattr_setpshared/pthread_mutexattr_setpshared
2023-04-13 18:10:19 +02:00
Flyinghead edd1487378 gl: powervr2 filter has some uninitialized vecs
Issue #1005
2023-04-13 18:07:17 +02:00
Flyinghead 68f4ce1ec5 naomi: fix multiboard slave not starting
regression due to 87fdd203b5
2023-04-13 18:03:41 +02:00
Flyinghead c3c355a8c5 android: use jni helper. better support for arrays and global refs. 2023-04-12 10:22:38 +02:00
Flyinghead 70d3e221a9 mushiking series support
Emulate barcode reader. UI to input card id.
scif: SCFSR2.DR should also trigger an interrupt. Fixes the partial read
issue with manic panic ghosts touchscreen.
Add default implementations in SerialPipe for read-only and write-only
devices.
Fix card jammed error in mushiking with custom input code.
Add mushi2k61 and mushi2k62 to naomi rom list.
Cheats to skip rfid check.
2023-04-12 10:09:21 +02:00
Flyinghead b556617e1d sh4: only reset serial pipe on hard reset
See d3690b12c6
2023-04-09 20:56:14 +02:00
Flyinghead e327172fd0 sh4: check access length when getting a ram pointer with GetMemPtr
Check access length and return nullptr if overflowing ram.
Fix ch2-dma code accordingly.

Fixes MINIDUMP-GX
2023-04-09 20:47:12 +02:00
Flyinghead c5f82483e6 naomi: fix multiboard windows position
Position slave windows over master.
Support any window width.
2023-04-09 20:28:10 +02:00
Flyinghead a418b05272 ui: make cheat list touch-scrollable 2023-04-09 20:20:07 +02:00
Flyinghead 5c3f66fe05 ui: ignore inaccessible content path when scanning for games 2023-04-09 20:18:56 +02:00
Flyinghead 81ce3f7d10 msvc32 build fix 2023-04-08 19:11:21 +02:00
scribam 64cfba735e deps: update sdl to version 2.26.5 2023-04-08 18:38:35 +02:00
scribam 8828b4fe52 deps: update implot to fix IMGUI_DEFINE_MATH_OPERATORS requirements 2023-04-08 18:38:26 +02:00
Flyinghead 87fdd203b5 android scoped storage (ASS) support
introduce Storage abstraction interfaces
use Storage i/f to load zip and 7z archives, cdi/cue/gdi/chd media,
cheats and to find custom textures.
Use android file picker to add storage. Request persisted access perms.
jni helper classes.

Issue #813
2023-04-08 18:37:50 +02:00
Flyinghead 187674ddac uTip is no more 2023-04-04 22:37:06 +02:00
Flyinghead f94a08f12f mmu: avoid crash due to approximative fast mmu matching
Fixes MINIDUMP-EA (Sonic Shuffle)
2023-04-02 22:06:22 +02:00
Flyinghead 252ad711f1 vk: throw if vmaMapMemory fails
MINIDUMP-PX
2023-04-02 22:02:53 +02:00
github-actions[bot] 9d6bfd4786 Fetch translations & Recreate libretro_core_options_intl.h 2023-03-31 22:19:08 +00:00
Flyinghead d3690b12c6 net: don't reset naomi network on soft reset (maxspeed)
Resetting makes maxspeed crash as the serial pipe isn't reset and
becomes invalid.
Fixes MINIDUMP-PJ
2023-03-31 20:09:33 +02:00
Flyinghead 32e08ca165 modem: don't crash on unexpected register writes
Just log and ignore.
Fixes MINIDUMP-62
2023-03-31 20:03:16 +02:00
Flyinghead bc4f8fbe60 dx11: enable depth writing in oit pass
Make sure both depth attachments are identical at the end of each pass.
Issue #996
2023-03-31 20:01:12 +02:00
scribam fd3deeb318 ci: bump aws-actions/configure-aws-credentials 2023-03-30 17:32:01 +02:00
Flyinghead 7108358ebd Merge remote-tracking branch 'origin/master' into dev 2023-03-30 17:31:22 +02:00
Flyinghead 98daea0e97 bios font: fix row E0 and F0 of the katakana half-width code page 2023-03-30 17:26:28 +02:00
Flyinghead 48acb03b81 underclock/overclock SH4 option
Increase/reduce the dynarec cycle count for each block.
Issue #210
2023-03-30 17:22:24 +02:00
Flyinghead 08ac485eac ui: fix drag scrolling and imgui gl renderer. use imgui events
Missing call to KeepAliveID was preventing drag scrolling in empty
areas. Also check for HoveredIdDisabled to allow scrolling by dragging
disabled items and enable HoveredIdAllowOverlap.
imgui gl renderer: use ImDrawCmd::IdxOffset instead of counting
manually. Use correct alpha blending function.
Use imgui events for all input. Simplify keyboard input by getting rid
of modifiers.
Enable flat navigation in content window.
Add format string to OptionSlider.
2023-03-30 16:54:54 +02:00
Flyinghead c033a81eca get rid of KeyboardDeviceTemplate 2023-03-29 16:48:46 +02:00
Flyinghead 5df9127add vk: enable depth writing in oit pass so
Make sure both depth attachments are the same at the end of each pass.
Get rid of unneeded depth dependency/transition.
Issue #996
2023-03-28 21:20:37 +02:00
Flyinghead b9e9cc534c lr: build fix when USE_OPENGL=OFF
Issue #997
2023-03-28 21:07:50 +02:00
Flyinghead 79be464326 aica: proper write mask on aica dma address registers
Fixes MINIDUMP-P3
2023-03-28 21:05:18 +02:00
Flyinghead f67aad0b2d pvr: don't wait if Present msg is already in the queue
Only Render* msgs are an issue when piling up on slow platforms.
Fixes frame skipping only working when delay frame swap is on
Issue #975
2023-03-28 21:01:56 +02:00
Flyinghead 55b36fe719 dx11: revert 47a33f97f9
Issue #865
2023-03-28 20:55:56 +02:00
scribam 7cce77cccd android: update android gradle plugin to version 7.4.2 2023-03-27 16:59:35 +02:00
scribam 170f794c3a deps: remove imgui obsolete keyio functions
Fix compilation with #define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
2023-03-27 16:59:06 +02:00
scribam ae4bd79ca1 deps: remove imgui obsolete functions
Fix compilation with #define IMGUI_DISABLE_OBSOLETE_FUNCTIONS
2023-03-27 16:59:06 +02:00
Flyinghead d76982bbeb naomi,aw: embed default flash for some games
Needed to configure network on first run.
2023-03-27 16:57:48 +02:00
Flyinghead fb4229c4ae support for daytona usa networking 2023-03-27 16:45:25 +02:00
Flyinghead caec338d25 dx9, dx11: video shift support
Shift the framebuffer according to VO_STARTX and VO_STARTY.
Issue #594
lr: draw overlay and manage shifting in dx11 context
2023-03-27 16:41:59 +02:00
Flyinghead b94200233d vk: video shift support. refactor lr vk context
Shift the framebuffer according to VO_STARTX and VO_STARTY.
Issue #594
lr: draw overlay and manage shifting in vk context
2023-03-27 16:38:15 +02:00
Flyinghead eb3ebe24e8 gl,gl4: video shift support, fix powervr filter, refactor lr osd
Shift the framebuffer according to VO_STARTX and VO_STARTY.
Issue #594
GlVertexArray class to handle vertex arrays (or lack thereof)
lr: Fix PowerVR2 filter including in full fb emu mode. Use quad to draw
vmus and lightgun xhairs.
2023-03-27 16:31:57 +02:00
Flyinghead 4514a4bfcc libretro: lightgun with gamepad fixes. Lightgun with touchscreen support
Lightgun with gamepad: fix reload, fix trigger and buttons on AW
Issue #881

Support for lr pointer device for lightgun with touchscreen.
Issue #604
2023-03-25 11:52:18 +01:00
Flyinghead 5e4e48fffe mmu: don't crash when table full, just ignore
Fixes MINIDUMP-NF
2023-03-25 11:45:03 +01:00
Flyinghead 47a33f97f9 dx11: disable texture support check on uwp/xbox
Tentative fix for Issue #865
2023-03-25 11:43:17 +01:00
Flyinghead b36ef9da1e libretro: use gamepad left analog stick for lightgun coordinates
Issue #881
2023-03-24 11:59:46 +01:00
Flyinghead 068861d0cc pvr: mask low address bits according to 32-bit vram access size
Avoid crash when accessing the very last vram byte with short or int.
Correct behavior should be to raise an sh4 address exception.
Fixes MINIDUMP-N2
2023-03-24 11:53:38 +01:00
Flyinghead f2f8f3ccd2 bump libchdr to latest
commit 8e09bf2b
Fixes MINIDUMP-HD, MINIDUMP-M8
2023-03-24 11:48:52 +01:00
Flyinghead 2d7a1ce71a atomiswave: fix failure to identify the game
regression by 78f80eb7dc
2023-03-23 09:45:25 +01:00
Flyinghead 74d72eb257 imgui: fix gamepad navigation
Issue #986
2023-03-23 09:39:25 +01:00
Flyinghead 9512ee657a Allox f355 deluxe to run with only one screen 2023-03-22 19:01:34 +01:00
Flyinghead 78f80eb7dc naomi: printer support for f355 and tduno[2]. Fix some bios font glyphs
Thermal printer support for f355 (G2 ext bus) and tduno[2] (maple JVS)
Change game id for sgdrvsim and dragntr3 to distinguish them.
Fix cyrillic page in BIOS font.
2023-03-22 19:00:50 +01:00
Flyinghead fa525b4488 Fix hotd2p inputs
Issue #731
2023-03-22 15:36:10 +01:00
Flyinghead ee3e83e09c Fix loading of Sega Yonin Uchi Mahjong MJ (mj1)
gd cart: load first .bin if the specified one isn't found. Fix loading
of main directory for mj1. Don't update progress too often when
decrypting.
chd: allow loading of 1-track CD-ROMs
Use 2 jvs boards for mj1

Issue  #985
2023-03-22 13:00:59 +01:00
Flyinghead ea4354ba2e Shin Nihon Pro Wrestling 4 crashes with RGB component
Force TV Composite instead
2023-03-21 11:36:47 +01:00
Flyinghead 5c5c872afc aica: small dma transfer must be correctly scheduled
Previously transfer taking less than 4096 cycles would be instantly
executed.
Fixes Sports Jam announcer broken audio.
Issue #980
2023-03-21 11:32:21 +01:00
Flyinghead 9f2ffd102c oit: Can't discard pixel in pixel shader when using 2ndary accumulator
When using the secondary accumulator as source or destination, pixel
must not be discarded even if blending results in a nop. Doing so
cancels the transfer to/from the accumulator.
Issue #979

dx11 oit: use FAILED to detect pixel shader creation error. Log error
codes when Buffers::init fails.
2023-03-21 11:22:04 +01:00
scribam 34f8941868 deps: apply drag scrolling custom code to imgui 2023-03-20 16:52:51 +01:00
scribam 07b217d9f8 deps: update imgui to version 1.89.4 2023-03-20 16:52:51 +01:00
Flyinghead cb83d319b9 naomi: 4-player and eeprom fixes
Add 4-player support to Dirty Pigskin Football, WFF Royal Rumble, World
kicks PCB and Beach Spikers.
Fix several bugs in initEeprom and force 4-player cab when needed.
Get rid of pstone, pstone2 and ringout default eeproms.
2023-03-20 12:35:36 +01:00
scribam 23daa3efdf deps: use latest stable release for oboe (1.7.0) 2023-03-18 16:11:41 +01:00
scribam 3a1ffceb58 deps: update glslang and Vulkan-Headers to sdk-1.3.239.0 2023-03-18 16:11:41 +01:00
scribam f3431bd95d deps: update sdl to version 2.26.2 2023-03-18 16:11:41 +01:00
Flyinghead 01c7250be2 hle bios: add latin-1, jis x0201 and jis x0208 glyphs to bios font
Use CMakeRC to embed font binary file
2023-03-18 16:11:03 +01:00
github-actions[bot] e6bc36e110 Fetch translations & Recreate libretro_core_options_intl.h 2023-03-17 22:20:03 +00:00
Flyinghead afc1f5f4e1 Merge remote-tracking branch 'origin/master' into dev 2023-03-15 21:09:47 +01:00
Flyinghead 4a2ad8b145 pvr: SortedTriangle has unsafe pointer to PolyParam
std::vector elements can be reallocated. Use index instead of pointer.
2023-03-15 20:58:12 +01:00
Flyinghead 17ab0aba26 dx11,dx9: Force ignoreTexAlpha if texture doesn't have an alpha channel
The supporting texture might have one if converted but it shouldn't be
used.
Fixes cinematic scenes in Alone in the Dark.
Issue #974
2023-03-13 21:12:39 +01:00
Flyinghead cc1b45b7cc texture corruption after load state regression. wince depth scale change
Texture weren't updated after loading a state. Regression introduced by
942224c685.
Change Windows CE depth scale from 0.1 to 0.01 to fix black screen FMV
on AMD and Intel GPUs. Issue #973
2023-03-13 21:03:16 +01:00
Flyinghead 4d990947de sgdrvsim: display or network broadcast speedometer and tachometer
Display speedometer value, or network broadcast speedo and tacho on port
8002 (slave 2) if option is set
2023-03-13 17:45:12 +01:00
Flyinghead 5542d6db21 picotcp: full deinit when terminating
New pico_stack_deinit() function to fully deinit picotcp. Need to call
pico_stack_init when restarting.
Get rid of dns client

Tentative fix for MINIDUMP-G6, MINIDUMP-J0, MINIDUMP-HY, MINIDUMP-G5,
MINIDUMP-J0, MINIDUMP-HY, MINIDUMP-FP, MINIDUMP-F7, MINIDUMP-9H,
MINIDUMP-CB, MINIDUMP-CE; MINIDUMP-B3, MINIDUMP-1Y, MINIDUMP-A7,
MINIDUMP-9M
2023-03-13 17:36:32 +01:00
Flyinghead 8ca89ead0e Enable RTT Copy to VRAM for Shenmue
Fixes Space Harrier mini arcade game.
Issue #967
2023-03-12 16:06:05 +01:00
Flyinghead ebf5f24487 ui: reduce boxart image size. Avoid crash with invalid option values
Reduce boxart image size from 200 to 150.
Avoid under/overflowing label tables with invalid option values when
using combo boxes.

Fixes MINIDUMP-GK
2023-03-12 16:04:05 +01:00
Flyinghead 90269d5204 vk oit: reset all pipelines on init/reset
Avoid validation errors when switching to/from RTT Copy to VRAM
2023-03-12 16:00:49 +01:00
Flyinghead e4332f6275 tex: ignore stride if 0. renderer: ignore invalid textures
Ignore StrideSel if 0 during texture update and use width instead.
Return false from BaseTextureCacheData::Update() if texture is invalid.
Make sure valid textures have non-null height and size.
gl,vk,dx9,dx11: ignore invalid textures

Fixes MINIDUMP-GP
2023-03-12 15:58:56 +01:00
Flyinghead cd7168772d reios: crash when CDDA play with no disk
Fixes MINIDUMP-HW
2023-03-12 15:51:05 +01:00
Flyinghead 77ded80450 cdi: check each track sector size when opening
Fixes MINIDUMP-J4
2023-03-12 15:48:13 +01:00
github-actions[bot] fbc69b6ae1 Fetch translations & Recreate libretro_core_options_intl.h 2023-03-10 22:20:01 +00:00
Flyinghead ea7dd699b9 only launch sgdrvsim slaves on desktop platforms 2023-03-10 18:10:57 +01:00
Flyinghead 018a852995 network: naomi net was closing stdin. Slaves don't broadcast outputs
naomi network: Initialize socket to -1. Only close if valid.
Multiboard or sgdrvsim slaves don't broadcast digital outputs
Don't save slave windows position
2023-03-10 18:01:49 +01:00
Flyinghead 8a28ddbfe6 jvs: allow p2 buttons to be always on. sgdrvsim improvements
jvs: allow button mapped to jvs P2 to be always on. Don't overflow
button descriptors table
midiffb: invert axis if needed
Launch sgdrvsim network instances automatically. Remap some buttons and
make some always on.
2023-03-10 17:57:27 +01:00
Flyinghead f186046c98 partial support for sega driving simulator 2023-03-09 17:54:57 +01:00
Flyinghead 5644e834fa x86 dynarec: use UpdateSystem_INTC like other recs
get rid of unused rdv_DoInterrupts and rdv_DoInterrupts_pc
2023-03-09 09:37:48 +01:00
Flyinghead 0b1f69bfd2 dynarec: more accurate cycle counting. limit code duplication
arm, arm64, x86: only account for current block cycles if block is
executed. Test cycle_counter before updating it.
arm, arm64: use function for mmu block check (vaddr and FPU ops) to
reduce host code size per block.
2023-03-08 19:24:49 +01:00
Flyinghead 4eb5cd928e nuke rec-cpp 2023-03-08 18:56:26 +01:00
Flyinghead b8d47fe0a8 sh4 dmac: more accurate implementation. Fixes sh4_dmac_demo.elf 2023-03-07 18:38:41 +01:00
Flyinghead abcd9d77d4 set some global to static 2023-03-07 18:36:26 +01:00
Flyinghead 095e5ede81 sh4: more accurate cycle counting
get rid of float ops hack for dead or alive 2
get rid of idle skip option and code block hashing
count cycles for high-level wince functions and handlers (GetTickCount,
QueryPerformanceCounter and TLB_MISS handler)

Fixes Dave Mirra Freestyle BMX time counter running too fast.
More FPS for many wince games. Better wince perf on slow devices.
2023-03-07 18:35:01 +01:00
flyinghead 52754cbbbb win32 lr build fix 2023-03-07 14:26:04 +01:00
Flyinghead ea9d048bc9 appimage: don't run checkrt on SteamOS
when checkrt calls dlmopen("libstdc++.so.6") for the second time, the
call gets stuck in an error loop and never returns.

Issue #929
2023-03-07 13:48:30 +01:00
Flyinghead 942224c685 in single threaded, only defer emu stop on android
on other platforms, render() won't be called => audio not terminated,
rom files not saved, pause event missed

unprotect memory and reset memwatch before loading a state
2023-03-07 13:43:22 +01:00
Flyinghead 670a25b039 dx11: dynamically load d3dcompiler_47/46.dll to avoid old versions
Fixes MINIDUMP-8H, MINIDUMP-CD
2023-03-07 13:35:15 +01:00
Flyinghead cab02c86bc android: only restart if game is running
Fixes MINIDUMP-G1, MINIDUMP-FV, MINIDUMP-FY, MINIDUMP-FD, MINIDUMP-F2,
MINIDUMP-EN
2023-03-06 17:02:01 +01:00
Flyinghead b4a67460e0 cmake switch and bsd fix 2023-03-06 16:23:51 +01:00
Gabriel Morazán b56750df30 (UWP) AppxManifest Tweaks 2023-03-06 10:31:09 +01:00
Flyinghead aa5fd64777 dx11: use FAILED() macro instead of != S_OK
Tentative fix for MINIDUMP-FG
2023-03-06 10:30:33 +01:00
Flyinghead 5a13b4df28 cmake: add option to force use of host sdl library
Issue #928
2023-03-06 10:28:39 +01:00
Flyinghead 67bba95dd1 dmac: set DMAOR.AE and raised interrupt if ch2 address error
Fixes crackin'dj 1 & 2 freeze at boot
Regression introduced by 66eb08f2d1
2023-03-06 10:26:52 +01:00
Flyinghead cd6152b193 per-game vmu A1 option
When enabled, each game has its own A1 vmu file.
Issue #555
2023-03-05 15:32:47 +01:00
Flyinghead 67c070c20f naomi: display crosshair for touchscreen games 2023-03-05 15:13:18 +01:00
Flyinghead 2355bb8bb5 pvr: drop more vertices with large x and y
Fixes Manic Panic Ghosts bogus transparent rectangles in first stage
2023-03-05 15:08:17 +01:00
Flyinghead c4d24254db naomi2: FFB support for Club Kart and King of Route 66 2023-03-04 17:45:53 +01:00
namtsui 27b6bafd0f vendor newest libelf (#955)
* vendor newest libelf

source:
https://github.com/seL4/util_libs/tree/2d5b59c99a93507266c10efe50760f25b7d73728/libelf

* use exec_elf.h from openbsd to define structs

* libelf: build fixes

- do not link against muslc.
- windows and apple use bundled exec_elf.h.
- casts added like the old elf32.h, elf64.h and elf.c so pointer
  arithmetic works. otherwise some compilers complain about void*.
- remove unused bits of exec_elf.h and added typedefs.

* adapt CMakeLists.txt to use libelf's CMakeLists.txt

* adapt reios_loadElf() to new libelf API
2023-03-03 16:05:12 +01:00
Eric Warmenhoven 9cbdcc6260 Only compile x86_64 for osx-x86_64, rather than universal 2023-03-02 08:04:01 +01:00
Flyinghead 192bbb715e input: use gamepad left stick for abs/lightgun coordinates
Issue #881
2023-03-01 21:48:51 +01:00
Flyinghead 014da3a225 naomi: network output FFB for 18 wheeler and f355 2023-02-28 20:23:58 +01:00
Flyinghead 803f4cd298 controller bindings for load and save state
Issue #615
2023-02-28 20:21:29 +01:00
Flyinghead 885a0508c0 Merge remote-tracking branch 'origin/master' into dev
# Conflicts:
#	core/hw/aica/sgc_if.cpp
#	core/hw/naomi/naomi.cpp
#	core/hw/sh4/dyna/driver.cpp
2023-02-28 20:02:23 +01:00
namtsui a1472fb190 OpenBSD 7.2 patches (#953)
* OpenBSD: BSS is immutable so mark it as mutable so that mprotect RWX works

see: mimmutable(1)
https://github.com/google/syzkaller/commit/bc009f82ea71c399f19eef28f115ff5cda7be4ba

* OpenBSD does not have mcontext_t

<signal.h> provides `typedef struct sigcontext ucontext_t;'.
take register names from <machine/signal.h>, which provides struct
sigcontext.

see:
https://github.com/RPCS3/rpcs3/commit/1a13d3ae4e28fc46baef52086c64189f84cf2b9f

* OpenBSD uses major.minor for shared libs, so properly dlopen libGL.so

* OpenBSD remove redefinition of swap16

* OpenBSD: SDL2 controller detection

Use sdl_open_joystick() to open controllers on startup instead of
SDL_JOYDEVICEADDED event, which never gets detected.

* OpenBSD does not have mcontext_t but linux does
2023-02-28 18:22:45 +01:00
Flyinghead b86df7217c sdl: don't add a joystick if its name can't be retrieved
Otherwise it crashes later on during SDL_JoystickClose

Fixes MINIDUMP-9K, MINIDUMP-B4
2023-02-27 17:59:48 +01:00
Flyinghead 26815d042a arcade ouput: send game name before any output
Send the game id before any output to inform clients of the current
running game.
2023-02-27 17:46:00 +01:00
Flyinghead 026f21eddf naomi: report error if rom is invalid instead of crashing
Fixes MINIDUMP-CS
2023-02-27 17:43:08 +01:00
Flyinghead 30501aebb1 Race condition when stopping while emu is failing
Emulator::stop now throws if an error occurred on the emu thread.
Fixes MINIDUMP-5B
2023-02-26 22:01:32 +01:00
Flyinghead 4014b1b574 lr: libchdr win32 build fix 2023-02-24 22:11:41 +01:00
Flyinghead 8d54382b10 aica: apply RAM mask to sample address (SA)
Fixes MINIDUMP-B9
2023-02-24 21:24:56 +01:00
Flyinghead 47dd8241b6 dx11: log error code 2023-02-24 21:14:01 +01:00
Flyinghead 195da2adcc oboe: device lost detection might be triggered while stopping
Fixes MINIDUMP-BD
2023-02-24 21:11:47 +01:00
Flyinghead 2b430eec6f gui: stop game scanner when exiting 2023-02-24 18:44:45 +01:00
Flyinghead d51e36998b bump libchdr to latest. add switch build fix
Issue #895
Fixes MINIDUMP-5C, MINIDUMP-4C, MINIDUMP-3G, MINIDUMP-3H, MINIDUMP-8C,
MINIDUMP-AP, MINIDUMP-AN, MINIDUMP-AM, MINIDUMP-AA
2023-02-24 18:44:06 +01:00
scribam a970a1263c ci: update mathieu-bour/setup-sentry-cli 2023-02-22 18:03:37 +01:00
Flyinghead cf9ccea70b texcache: unprotect vram immediately even if actual Delete is delayed
Fixes MINIDUMP-A5, MINIDUMP-AF
2023-02-22 17:57:31 +01:00
Flyinghead f885cbb4ea reios: don't crash if system settngs can't be read from flash
Log a warning and proceed. This can happen if the flashrom is corrupted.
Fixes MINIDUMP-9W
2023-02-22 17:51:25 +01:00
Flyinghead 97dfabc416 pvr: don't reset TA parser during soft reset
Rendering might be in progress in another thread and this leads to
crashes.
Fixes MINIDUMP-AW and MINIDUMP-AY
2023-02-22 17:49:01 +01:00
Flyinghead 8d2b0749a0 gl: vmu and lightgun xhair not rendered if switching renderer 2023-02-22 17:46:14 +01:00
Flyinghead a3acf4a8cc gl: don't use glIsProgram to avoid Adreno 308 random failures
Adreno 308 randomly return false from glIsProgram on valid programs
Fixes MINIDUMP-A1 and MINIDUMP-AX
2023-02-22 17:44:17 +01:00
scribam e505ab6019 safe usage of std::isalnum/std::print 2023-02-20 22:57:24 +01:00
Flyinghead 9b24984b07 crash when switching to full mmu
The MMU now has a state variable, which must be set before the dynarec
is reset.
Regression in afcb3b7ad8

Fixes MINIDUMP-AZ, MINIDUMP-B7, MINIDUMP-B0
2023-02-20 22:56:23 +01:00
Flyinghead 7ce08ea860 Fix Touch de Uno 1 & 2 inputs
Fix touchscreen touch detection
Default eeproms with calibrated touchscreen and disabled printer
2023-02-20 11:14:02 +01:00
Flyinghead a156edbd73 Merge remote-tracking branch 'origin/master' into dev 2023-02-19 14:10:37 +01:00
Flyinghead 9dae5827cc naomi: touchscreen emulation for manic panic ghosts and touch de zunou 2023-02-19 13:51:23 +01:00
Flyinghead 5da799244f rend: fix regression on YUV texture conversion
std::clamp wrong parameters order in d8137a967c
2023-02-18 22:44:44 +01:00
Flyinghead bf79183bd6 mmu: max alignment requirement is 32-bit
a 64-bit access only needs to be 32-bit aligned.
use enum for mmu errors
2023-02-18 13:33:38 +01:00
Flyinghead afcb3b7ad8 mmu: get rid of FullMMU option. Detect wince with string id in ram
ForceWindowsCE now just sets ExtraDepthScale
2023-02-18 13:33:38 +01:00
Flyinghead 5bfbcb210c dynarec: refactor imm mem r/w and store queue handlers. clean up mmu
Eliminate duplicate code for immediate memory read/write in all dynarecs
Simplify PREF to use do_sqw_nommu even for simple SQ remap
Check for address errors before mmu translation
Get rid of unneeded template params in mmu translation funcs
2023-02-18 13:33:38 +01:00
Flyinghead 4f65d45e55 rend: don't access first poly if list is empty. dx11 oit: resize error
fix crash with dx11 and gl4 when tr poly count is 0
quick exit if nothing to do
2023-02-18 13:33:38 +01:00
scribam 3f8ecfedbb sdl: use _WIN32 2023-02-18 13:25:14 +01:00
scribam d8137a967c C++17 (#926)
* cmake: use c++17

* Use std::size

* Use std::make_unique

* Use std::clamp

* Use structured binding

* Use [[fallthrough]]

* Use enable_if_t/is_enum_v/is_integral_v/is_same_v

* Use if constexpr

* Use try_emplace

* Use auto for iterators

* Use inline variables
2023-02-18 13:24:34 +01:00
github-actions[bot] ffec935e2f Fetch translations & Recreate libretro_core_options_intl.h 2023-02-17 22:20:33 +00:00
Flyinghead 253301ba4f UWP build fix. Readme update 2023-02-16 11:14:01 +01:00
Flyinghead a21b79cfbe builtin cheat to help Extreme Hunting 2 boot 2023-02-15 18:59:44 +01:00
Flyinghead 3f4c24d350 gl4: don't reference two-volumes attributes if not used
The naomi2 vertex shader doesn't set 2-volume attributes (vtx_base1,
vtx_offs1 and vtx_uv1) if they aren't used. But the pixel shader always
references them even though they aren't actually used. This breaks some
gl drivers: "The shader uses varying vtx_uv1, but previous shader does
not write to it."

Fixes MINIDUMP-93
2023-02-15 18:56:12 +01:00
Flyinghead 645f413523 sentry: get the build version from the log file if available
avoid discrepancy between uploading and minidump versions
2023-02-13 20:02:14 +01:00
Flyinghead 08478aa757 bsd build fix 2023-02-12 15:05:02 +01:00
Flyinghead 4aef8667b7 fix AppImage shared libraries list 2023-02-12 15:05:02 +01:00
Flyinghead 9d08da1fc9 build AppImage for linux
Issue #638
2023-02-12 15:05:02 +01:00
Flyinghead 4408aa7dbe force SDL build on linux to include libdecor for wayland 2023-02-12 15:05:02 +01:00
Flyinghead d2e8c9465b dx11 oit: render target and depth texs must have the same dimensions
Fixes missing depth/stencil when changing resolution or
enabling/disabling full framebuffer emulation.
2023-02-12 15:05:02 +01:00
Flyinghead 04df0da7cb pvr: increase index size for wild riders
Index overrun with wild riders
Fixes MINIDUMP-7A
2023-02-12 15:05:02 +01:00
Flyinghead 5eeddecb40 maple: set bus speed back to 2Mbps. Worms Pinball needs FFBE
Power Drift crashes with 1Mbps
partial revert of 2332884d8b
Force Slave Zero to use real bios (still has issues)

Worms Pinball prototype needs full framebuffer emulation
2023-02-12 15:05:02 +01:00
scribam 71aea45811 vulkan: lower shader version requirement 2023-02-11 14:41:41 +01:00
scribam cf690fbb61 cmake: improve compile options for VulkanMemoryAllocator 2023-02-11 14:41:07 +01:00
Flyinghead 85b286ec47 oboe: don't attempt to recover the audio stream suring init
Apparently oboe can call the error callback function during the initial
openStream. Let it fail in this case.
Fixes MINIDUMP-8K
2023-02-11 14:25:41 +01:00
Flyinghead 07d0cf6839 cdi: don't crash if file re-open fails
Not sure how this can happen but it does. Could be a device removed or
corrupted CDI with many tracks.
Fixes MINIDUMP-8F, MINIDUMP-8Q
2023-02-11 14:09:22 +01:00
github-actions[bot] 5e43b603ac Fetch translations & Recreate libretro_core_options_intl.h 2023-02-10 22:20:39 +00:00
Flyinghead 69d2cfd56d read disk MCN and tracks ISRC from .cue files 2023-02-10 15:07:25 +01:00
Flyinghead 0f90293252 dynarec: handle illegal instructions 2023-02-10 14:53:54 +01:00
Flyinghead 0d166e1403 msvc build fix 2023-02-10 14:17:45 +01:00
Flyinghead b5879e6e1d unintended change and merge issue
log: revert change that wasn't supposed to be committed
emulator: fix incorrect merge
2023-02-10 12:56:57 +01:00
Flyinghead 5b169b7f9d naomi: use master pid to make unique multiboard shared mem file on unix 2023-02-10 12:54:20 +01:00
Flyinghead 099a758c94 hw: new hardware register implementation
used for sh4 mm registers and holly
ignore incorrect size reads and writes
separate data and read/write handlers
2023-02-10 12:51:36 +01:00
Flyinghead 638e5d233a gl: fix naomi2 lights regression
regression introduced by e18a4afcbb
2023-02-10 10:15:09 +01:00
Flyinghead a23362cee0 ios: fix virtual gamepad X button in arcade mode
Issue #911
2023-02-08 12:11:41 +01:00
Flyinghead 040db856f8 limit millenium racer widescreen cheat to the correct game
Tentative fix for MINIDUMP-87
2023-02-08 12:08:11 +01:00
Flyinghead 8d0654c323 vk: revert to glslang 11.11.0 (sdk 1.3.224.1)
partial revert of 1c8e558e25
Issue #908
2023-02-08 11:59:37 +01:00
Flyinghead cacfdbad90 Revert "deps: update glslang and vulkan"
This reverts commit 1c8e558e25.
2023-02-07 11:31:58 +01:00
Flyinghead 811bf6f449 Revert "vk oit: tentative workaround for AMD crash"
This reverts commit 084066bde7.
2023-02-07 11:28:14 +01:00
Flyinghead 43f8f3e4ad bsd build fix 2023-02-07 11:27:51 +01:00
Flyinghead a045c52146 sdl: handle joystick and gamepad api errors to avoid crashes
Fixes MINIDUMP-7K
2023-02-06 15:20:21 +01:00
Flyinghead 98531e07ea hle bios: fix SF rush, jeremy mc grath and the grinch
protection checksum and game bugs
2023-02-06 15:15:44 +01:00
Flyinghead 5020a267af pvr: fix unsorted pass triangle count. tr count should accumulate
partial revert of 927db7f189
Fix missing walls in Bust a Move 4 (vs)
2023-02-06 15:09:18 +01:00
Flyinghead debe21de7b Merge remote-tracking branch 'origin/master' into dev 2023-02-05 22:20:28 +01:00
Flyinghead 084066bde7 vk oit: tentative workaround for AMD crash
Issue #908
2023-02-05 21:56:08 +01:00
Flyinghead 46d7dfc750 fix AppImage shared libraries list 2023-02-05 18:37:32 +01:00
Flyinghead 37c17e4300 pvr: re-use TA contexts if not used for 60 frames 2023-02-05 18:32:35 +01:00
Flyinghead 3a21f545d8 cfg: allow non per-game option to be overriden. Remove per-game for some
Allow non per-game options to be overridden with command line args.
Fixes MINIDUMP-7G

Save state slot, box art settings, UploadCrashLogs, UseRawInput and lua
filename shouldn't be settable per-game.
2023-02-05 11:38:21 +01:00
Flyinghead f35167a0de egl: better constants 2023-02-05 11:31:22 +01:00
Flyinghead 0b6c09da02 sdl: don't rely on event to get window size when processing resize event
window size may be different from drawable size if high-dpi is enabled.
Fixes wayland resize with scale factor > 100%.
2023-02-05 11:30:23 +01:00
Flyinghead d9c08bd081 gl: save current framebuffer in RenderLastFrame. get rid of verify (OSD)
Current framebuffer must be saved in gl.ofbo.origFbo when entering
RenderLastFrame and restored on exit.
Tentative fix for MINIDUMP-74

glIsProgram(OSD_SHADER) is strangely failing on Adreno 308 so let's get
rid of it (and pray).
Fix for MINIDUMP-7D, MINIDUMP-7C, MINIDUMP-7B, MINIDUMP-79, MINIDUMP-6J
2023-02-05 11:26:50 +01:00
Flyinghead 927db7f189 pvr: sorted triangle count incorrect with multiple render passes
causes crash in setProvokingVertex

Fix for MINIDUMP-7A, MINIDUMP-7H, MINIDUMP-7J
2023-02-05 11:18:18 +01:00
github-actions[bot] badf36899e Fetch translations & Recreate libretro_core_options_intl.h 2023-02-03 22:20:20 +00:00
Flyinghead d3aed076a6 build AppImage for linux
Issue #638
2023-02-03 18:36:27 +01:00
scribam 962b0bb65c android: update android gradle plugin to version 7.4.1 2023-02-03 11:47:11 +01:00
Flyinghead 6e940e4d08 ggpo: move endOfFrame() call back to start render
Naomi2 TA context geometry for the current frame is lost when
rollbacking during vblank in because it hasn't been queued for render
yet.
Fixes black screen after GGPO rollback for Naomi 2 games
2023-02-03 11:34:58 +01:00
Flyinghead 90e9f70a1a vk: fix resizing on wayland. validation errors with framebuffer render
wayland doesn't return the current surface dimensions in
getSurfaceCapabilities so we defaulted to 640x480. Instead use the
current display dimension as set by SDL.
Issue #648
Issue #898 (partial fix)

Vulkan validation errors when doing direct framebuffer rendering if fb
slots are skipped, since the corresponding fence isn't waited on.
Instead use an independent index to use them in sequential order.
2023-02-03 11:19:41 +01:00
Flyinghead bfdab4db20 pvr: add dummy sorted triangle to signal that per triangle is in use
Avoids crash when sorted triangle list is empty and renderer uses wrong
index values
2023-02-03 11:07:21 +01:00
Flyinghead f0e4574132 aica arm: stop the cpu if setting an illegal mode instead of crashing
Fixes MINIDUMP-70
2023-02-03 11:03:08 +01:00
Flyinghead c461624a67 move khronos to deps. get rid of old controller mappings and pandora 2023-02-03 10:42:43 +01:00
Flyinghead e6060aff6b force SDL build on linux to include libdecor for wayland 2023-02-02 21:16:16 +01:00
Flyinghead d1e6ee9cd7 pvr: add a dummy sorted triangle if list is empty
this signals that sorted triangles are being used otherwise wrong
indexes values lead to a crash
2023-02-02 20:19:52 +01:00
Flyinghead 6480a6e4e5 more fpu tests 2023-02-02 20:15:52 +01:00
Flyinghead 6cfbdf6586 ui: imguiDriver may be null if renderer/context fails to reinit
Force a reinit in this case
Fixes MINIDUMP-6R
2023-02-01 18:05:37 +01:00
Flyinghead 6b2063b06f GGPO fixes
Memwatchers weren't properly reset after a ggpo session.

Race condition when stopping if GGPO restarts the cpu for a new frame.

The emu thread might still run some rollback frames before stopping, so
the emu state must be updated only after ggpo is stopped.
Fixes MINIDUMP-6P

Don't autosavestate when GGPO is on

Really disable renderer during GGPO advance frame

Don't stop the sh4 after render (single threaded) when GGPO is on

android: Don't restart when unpaused if online
2023-02-01 18:04:26 +01:00
Flyinghead 301a7c5dcd savestate: write-only regs value must be deserialized (SB_?DAPRO) 2023-02-01 13:58:29 +01:00
Flyinghead e70a0dcf3d sh4_fpu clean up. tests 2023-02-01 13:53:32 +01:00
Flyinghead d1ab3461a6 savestates: dropping support for old formats
savestates older than 3 years aren't supported anymore
2023-01-31 17:57:54 +01:00
Flyinghead b81a6762bc switch build fix 2023-01-31 17:39:57 +01:00
Flyinghead 5875eda4d0 game id of console games wasn't trimmed
regression introduced by ee84567c17
2023-01-31 12:58:43 +01:00
Flyinghead 04c418d02a serialize: move code out of serialize.cpp and into modules 2023-01-31 10:13:03 +01:00
scribam 02a002d55b sdl: use target SDL2main 2023-01-30 13:54:31 +01:00
Flyinghead 0305904873 force NTSC for some games 2023-01-30 13:40:35 +01:00
Flyinghead ee84567c17 naomi: use gameId instead of naomi_game_id to get current game name
naomi_game_id isn't reset if a console game is loaded.
settings.content.gameId should be used instead.

Issue #901
Fixes MINIDUMP-6G
2023-01-30 13:34:06 +01:00
Flyinghead 528235ce9d jvs: fix kingrt66 instant win with accelerator 2023-01-30 13:28:14 +01:00
Flyinghead 27ea6ca092 aica: rename mem and reg accessors 2023-01-30 13:21:43 +01:00
Flyinghead cb94354099 switch build fix 2023-01-30 12:18:19 +01:00
Flyinghead 53dab29ddb iOS and Switch build fixes 2023-01-30 11:10:14 +01:00
Flyinghead b1479e6e34 aica: use namespaces, simplify api, handle serialization
Rename VArray2 to RamRegion. Add alloc(), free(), setRegion() and
de/serialize()
2023-01-30 10:40:07 +01:00
Flyinghead ea3262f7b0 log: alpha order for categories. update some category names 2023-01-29 21:24:44 +01:00
Flyinghead 143073b61d rename _vmem to addrspace and move platform vmem stuff to virtmem ns
use namespaces
simplify names
no functional changes
2023-01-29 18:48:33 +01:00
Flyinghead c472d60f80 __fastcall goes after return type too 2023-01-29 15:47:47 +01:00
Flyinghead 0c01075ba8 __fastcall goes after return type 2023-01-29 14:07:37 +01:00
Flyinghead 1149d499a8 x86: windows ce support in dynarec
clean up some unused methods and return values
2023-01-28 19:22:36 +01:00
scribam 85a941d6c6 openbsd fixes 2023-01-28 18:25:10 +01:00
Flyinghead 0a27b63584 aica: remove useless verify on reg access sizes
Fixes MINIDUMP-6C
2023-01-28 18:22:39 +01:00
Flyinghead 6f5f91245b windows: use directx 11 by default 2023-01-28 18:21:18 +01:00
github-actions[bot] 234955ac01 Fetch translations & Recreate libretro_core_options_intl.h 2023-01-27 22:20:02 +00:00
Flyinghead 99d5266aa0 Merge remote-tracking branch 'origin/master' into dev
# Conflicts:
#	core/hw/holly/sb_mem.cpp
#	core/hw/naomi/naomi.cpp
#	core/hw/naomi/naomi_flashrom.cpp
#	core/hw/pvr/ta_ctx.h
#	core/rend/gui.cpp
2023-01-27 15:41:45 +01:00
Flyinghead a5967a283f bump breakpad to fix win32 build error 2023-01-27 14:09:35 +01:00
Flyinghead 21a4935ec4 sentry: set release when uploading 2023-01-27 13:12:31 +01:00
Flyinghead 610e3cf968 naomi: avoid crash with M4 carts if M4 key is missing
Fix shorsepr crash at boot
Fixes MINIDUMP-5Z
2023-01-27 13:03:52 +01:00
Flyinghead 45c9d6185b gcc warning on windows 2023-01-27 11:16:54 +01:00
Flyinghead e18a4afcbb vk and pvr fixes. Renderer::Process returns void. N2 light 0 is no-light
pvr: Heap use after free due to PolyParam vector reallocation
vk: fix wrong buffer size calculation
Renderer::Process now returns void since it can't fail anymore
naomi2: light model at index 0 is "no light"
dx9, gles: throw if naomi 2 not supported
2023-01-27 11:16:25 +01:00
Flyinghead 499f86b065 pvr: use std::vector instead of List<> in render context
Remove overrun-related code.
Replace N2 matrix and light model pointers with indices.
2023-01-26 14:13:28 +01:00
scribam 80cf4406a7 cleanup include headers 2023-01-26 10:06:51 +01:00
Flyinghead cc4e3875f3 libretro: expose BBA and UPnP network options 2023-01-26 10:05:58 +01:00
Flyinghead 1c4871acb3 naomi: fix derbyocw rom list
was using drbyocwa roms
2023-01-25 17:16:52 +01:00
Flyinghead 3b683648fa switch build fix 2023-01-24 22:49:46 +01:00
Flyinghead 3923f10277 build fix 2023-01-24 21:44:35 +01:00
Flyinghead 1a681746b5 mmu: fix rte delay slot fetch address error with slow mmu
slow mmu clean up
P4 isn't executable
mmu test
mmu_TranslateSQW: throw exception but don't return status
2023-01-24 21:17:48 +01:00
Flyinghead 5703ef26cf os_DebugBreak is [[noreturn]] 2023-01-24 19:24:26 +01:00
Flyinghead 5096d50d37 move rom/flash stuff to hw/flashrom. nvmem api 2023-01-24 19:17:48 +01:00
Flyinghead f7e227a4aa dx9: don't crash if creating a boxart texture fails. log and skip tex
Fix for MINIDUMP-5Q
2023-01-24 14:52:55 +01:00
Flyinghead bbff377ceb maple: less log on dma error
Fixes GameShark CDX log spam
See MINIDUMP-5R
2023-01-24 14:30:09 +01:00
Flyinghead f8372c51a7 Revert "wip headers"
This reverts commit e3e2c3a0d2.
2023-01-24 14:26:14 +01:00
Flyinghead 31debefbe1 release dynarec mem allocs when terminating, including arm and dsp
Issue #453
2023-01-24 09:21:46 +01:00
Flyinghead c7d214e55a aica: update pending ints when enable mask is changed
Updating interrupts masks SCIEB and MCIEB can enable new interrupts so
check for that.
Only avoid race condition when needed.
2023-01-23 20:04:18 +01:00
scribam e3e2c3a0d2 wip headers 2023-01-23 18:29:04 +01:00
Flyinghead f96ce85365 dx11: attempt to recover if context reinit fails. More checks and logs 2023-01-23 12:20:10 +01:00
Flyinghead aa79196d38 vk: only destroy surface if instance and surface aren't null
Don't request Arm debug layer VK_LAYER_ARM_AGA
Fix for MINIDUMP-5G
2023-01-23 12:11:43 +01:00
Flyinghead 2b14c3e605 Try dx11 if dx9 and opengl both fail
Fix for MINIDUMP-5F
2023-01-23 12:06:26 +01:00
Flyinghead 41ba110ef4 enable RTTI for MSVC builds 2023-01-23 12:04:10 +01:00
Flyinghead ad42a32260 switch build fix 2023-01-22 18:21:55 +01:00
Flyinghead cc408f9688 aica arm7: fallback to interpreter for invalid LDR/STR
Fixes MINIDUMP-4X
2023-01-22 18:11:03 +01:00
Flyinghead 520e96a039 egl: call eglTerminate when closing context 2023-01-22 17:22:47 +01:00
Flyinghead db9fbbaebf custom texture loader must be stopped before the tex cache is cleared
Fix for MINIDUMP-53
2023-01-22 17:22:04 +01:00
Flyinghead 88384ad7d1 dynarec: crash in rdv_BlockCheckFail when current block can't be found
Only when MMU is on and used to compute blockcheck_failures so can be
ignored.
Tentative fix for MINIDUMP-59
2023-01-22 17:13:34 +01:00
Flyinghead 464b459073 modem: don't die when reg11 is written
Fix for MINIDUMP-5A
2023-01-22 17:10:12 +01:00
Flyinghead aea228c3df force real BIOS for Fushigi no Dungeon 2023-01-22 17:07:16 +01:00
scribam 8cdd171ab7 gl,gl4: simplify gl_create_resources calls 2023-01-21 12:12:21 +01:00
Flyinghead 9473c235f2 sh4: Fix CCN_MMUCR register definition
Some reserved bits were missing, which was breaking the (slow) MMU since
the write mask is correct.
2023-01-21 12:11:42 +01:00
Flyinghead b443467770 naomi: relax some eeprom checks based on BOOTID specs 2023-01-21 12:01:22 +01:00
Flyinghead a6bf9dd39c Option to disable VMU sounds. VMU sounds use better waveform. 2023-01-21 11:54:34 +01:00
Flyinghead 8fdcea2e20 maple: delay raising overrun interrupt when dest isn't in RAM
Only raise error when copying data back to RAM.
Fixes Cheats 'N Codes Volume 1
2023-01-21 11:38:58 +01:00
Flyinghead 31bd943d67 gl,vk: don't use linear mipmap filter with nearest
Fixes glitches in Railroad Tycoon II
Partially revert 15b21fff2b and
a9cabdc342
2023-01-21 11:32:28 +01:00
github-actions[bot] ba78a3aa5b Fetch translations & Recreate libretro_core_options_intl.h 2023-01-20 22:19:43 +00:00
warmenhoven 1948c66c11 Reload and vmem fixes for libretro on Mac (#885)
* Try to properly set up vmem on OSX
* Add Mac OSX arm64 libretro buildbot
* Don't term libretro on macOS
* Unload game when loading fails
2023-01-20 20:37:56 +01:00
Flyinghead 3cf7cf0a7f network: Emulate BBA should not be changed once a game is started
Change UI to disable BBA toggle when game is started.
Refactor UI to use DisabledScope helper.
Make sure the network stack deletes the same device it initialized.

Tentative fix for MINIDUMP-4N
2023-01-20 14:52:27 +01:00
Flyinghead a593cddf52 pvr: mvsc2 needs yet more rendering cycles
Fixes texture corruption in the character line up during intro.
Follow up to 976fb99aa3
2023-01-20 14:41:36 +01:00
Flyinghead cecf16e65e dump textures: don't crash if malloc fails
Tentative fix for MINIDUMP-4P
2023-01-20 14:38:23 +01:00
scribam 458b233e16 android: add vibrate compatibility with newer versions 2023-01-18 20:37:10 +01:00
Julien Reichardt cca7ed6bf7 Cleanup metainfo file 2023-01-18 20:36:30 +01:00
Flyinghead f63cf7406a logging changes 2023-01-18 14:03:02 +01:00
Flyinghead e21d666328 reios: allow loading CDIs with ip_meta.wince = 1
For some reason Neo XYX has this flag set. I haven't found any wince CDI
that has this flag set but it shouldn't hurt.
Fix for MINIDUMP-47
2023-01-18 10:12:24 +01:00
Flyinghead ab3f5dbc4c sdl: fix crash in getNativeHwnd() when recreating window
fixes rawinput crash
Fix for MINIDUMP-4B, MINIDUMP-4G, MINIDUMP-4F, MINIDUMP-4E
2023-01-18 09:45:01 +01:00
Flyinghead 528f15f117 win32 build fix 2023-01-17 22:39:22 +01:00
Flyinghead 7c72aa8a80 unintended new files in CMakeLists.txt 2023-01-17 22:10:54 +01:00
Flyinghead 2420c05930 android: implement unwind info for arm32 2023-01-17 22:06:22 +01:00
Flyinghead 3a312f3814 add llvm's libunwind 2023-01-17 21:56:30 +01:00
Flyinghead bac67bd91a missing submodule oboe 2023-01-17 21:29:34 +01:00
Flyinghead 36e67203a4 Merge remote-tracking branch 'origin/master' into dev
# Conflicts:
#	core/deps/oboe
#	core/emulator.cpp
#	core/hw/maple/maple_jvs.cpp
#	core/rend/gui.cpp
2023-01-17 21:20:14 +01:00
Flyinghead a52d1c97ec UWP build fix 2023-01-17 20:55:59 +01:00
Flyinghead 9d3125c546 fix tony hawk's 1 & 2 PAL disk ids 2023-01-17 11:41:50 +01:00
Flyinghead 86a6d7a4f5 widescreen cheat for Biohazard: Code Veronica: Kanzenban (JP)
same cheat as Resident Evil: Code Veronica X Kanzenban (Eng.
translation)
Issue #880
2023-01-17 11:40:35 +01:00
Flyinghead 0f214b1441 reios: fix crash if disc is null at boot
Don't overflow Disc::sessions

Fix for MINIDUMP-41
2023-01-17 11:39:00 +01:00
Flyinghead a0b50cd41d pvr: don't crash on invalid poly list types. log and ignore
Fix for MINIDUMP-3Z
2023-01-17 11:36:00 +01:00
Flyinghead 1d1754dc98 pvr: don't crash on YUV converter error. log and continue
Fix for MINIDUMP-44
2023-01-17 11:25:08 +01:00
Flyinghead b8464ef6c5 widescreen cheat for Resident Evil - Code Veronica X Kanzeban
Courtesy of keefged4
Issue #880
2023-01-16 18:16:05 +01:00
Flyinghead 692ca52182 pvr: fix background poly texture coordinates
V tex coordinates were inverted for Donald Duck Goin Quackers
2023-01-16 17:56:37 +01:00
Flyinghead b4ecaecd45 dynarec: raise sh4 address error if trying to compile unaligned address
Error was only raised when mmu is enabled.
tentative fix for MINIDUMP-3Q
2023-01-16 17:53:01 +01:00
Flyinghead 9954768636 dx11: simplify RenderFramebuffer for libretro and fix black frames
RA uses some shaders that need to be disabled (as in Render()).
Also the framebuffer texture can be returned directly.

might help Issue #865
2023-01-16 17:50:23 +01:00
scribam cbffc5cade android: misc changes (#876)
* android: add appCategory attribute

* android: remove unnecessary @TargetApi

* android: replace 'for' loop with enhanced 'for'

* android: use java-style array declaration
2023-01-15 20:44:47 +01:00
Flyinghead 4bbf5c562e ssa: infinite loop in skipSingleBranchTarget
Fixes Mat Hoffman's Pro BMX freeze when exiting a session.
Issue #878
2023-01-15 20:04:05 +01:00
Flyinghead 329e5ed467 android: allow starting games with intent while a game is running
stops and unload the current game then starts the new one
2023-01-15 20:02:03 +01:00
Flyinghead 19a160695c android: since ndk23 exceptions traversing dynarec blocks cause a crash
NDK 23 switched to clang's unwinder instead of gcc so __register_frame()
takes a single FDE as argument (as in macOS).
Fix for MINIDUMP-3M and MINIDUMP-3N
2023-01-15 19:31:44 +01:00
Flyinghead 1e195b7237 sdl audio: fix crash when decrasing audio buffer size. fix deadlock
sample_count wasn't reset to 0 on init, so it could point past the end
of the audio buffer if buffer size is decreased, leading to a crash.
Fix for MINIDUMP-29

Deadlock if audio buffer size is too small (< 1024 samples)
2023-01-15 12:07:26 +01:00
Flyinghead 2b37a5dc08 sdl audio: use SDL to convert from 44.1 to 48 kHz
Fix crash introduced by 7205068809
Use SDL_ConvertAudio to convert audio when needed.

Fix for MINIDUMP-3K
2023-01-15 11:21:42 +01:00
Flyinghead 8aadf5b097 cheats: don't update the cheat list when adding one fails
The operation should fail or succeed completely.
Issue #871
2023-01-15 11:16:40 +01:00
Flyinghead 13428ba696 allow screen stretching to be overridden when using widescreen cheat
Issue #870
2023-01-15 11:14:21 +01:00
Flyinghead 52f2ca7ff6 windows: convert command line arguments to UTF8
Issue #875
2023-01-15 11:13:07 +01:00
scribam 174ce8786b android: add oboe as a submodule 2023-01-14 13:02:34 +01:00
scribam fc118f295d android: remove oboe 2023-01-14 13:02:34 +01:00
scribam 18cfe2f92f android: update project for Android Studio Eel 2023-01-14 13:02:34 +01:00
scribam 0d4a7dbac9 android: use getDefaultDisplay with android api level < 17 2023-01-14 13:02:04 +01:00
Flyinghead a370851494 dynarec: check stale blocks in rdv_DoInterrupt if block not found
tentative fix for MINIDUMP-36
2023-01-14 12:54:05 +01:00
Flyinghead 7b49cc73ee gl,gl4: use correct framebuffer size for matrix when rtt'ing 2023-01-14 12:52:10 +01:00
Flyinghead a8c5af8425 dx: don't resize main framebuffer when rendering to texture
dx9 and dx11 renderers were wrongly resizing main framebuffer to 0,0
when rendering to a texture.

Fix for MINIDUMP-1W
2023-01-14 12:48:56 +01:00
Flyinghead 3441a9ccf0 pvr: calculate framebuffer size when TA context is dequeued
Config can change after the TA context has been queued (upscaling, full
framebuffer emu, etc.) which can make the calculated framebuffer size
wrong during render, leading to crashes in renderers.
Fix for MINIDUMP-35
2023-01-14 12:39:38 +01:00
Flyinghead 659d21680b android: race condition on Emulator::threadResult
The emu thread can be stopped/started by the app main java thread while
the render thread is running. This can lead to a race condition on the
threadResult future between checkStatus() and start(). So protect
relevant sections with a mutex.

Fix for MINIDUMP-1G, MINIDUMP-1H, MINIDUMP-2G and MINIDUMP-33
2023-01-14 10:52:27 +01:00
Flyinghead 2da833883b pvr: skip triangles with NaN/Inf coordinates when sorting them
Issue #867
2023-01-14 10:46:21 +01:00
Flyinghead c301bf0827 pvr: ignore invalid TA types instead of crashing
Fix for MINIDUMP-32
2023-01-14 10:42:26 +01:00
Flyinghead 1c4303b76d arm dynarec: verify is no longer true
Fix for MINIDUMP-37
2023-01-14 10:29:44 +01:00
github-actions[bot] 170a6ac36e Fetch translations & Recreate libretro_core_options_intl.h 2023-01-13 22:20:05 +00:00
Flyinghead 92fa4c041d gdrom: log invalid size register access but don't crash
Fix for MINIDUMP-1T
2023-01-13 11:34:40 +01:00
Flyinghead f34a9f6eac jvs: serialize drive board output value and more
Issue #864
2023-01-13 11:25:04 +01:00
Flyinghead 9fb69af355 dx9: more error handling. more logging
Handle case where dx context init fails when switching to/from fast
forward.
Log errors.
2023-01-13 11:15:32 +01:00
Flyinghead 59606d8935 naomi: more robust error handling when loading invalid roms
Fix for MINIDUMP-2S
2023-01-13 10:49:52 +01:00
Flyinghead bd7f5ec4c1 disable non-working ikaruga ws cheat
Issue #866
2023-01-13 10:46:51 +01:00
Flyinghead d082993a7a ui: race condition when network times out while pressing start
Fix for MINIDUMP-2Y
2023-01-13 10:06:36 +01:00
Flyinghead 640d4162b6 holly: log invalid pvr register access size but don't crash
Fix for MINIDUMP-2V
2023-01-13 09:52:17 +01:00
Flyinghead 66eb08f2d1 sh4: check that dma-ch2 source address is in ram
Force real BIOS for Force Five dc conversion
Fix for MINIDUMP-2W
2023-01-13 09:28:45 +01:00
Flyinghead 93fbd67a85 dx9: recover after screen lock. reset render state cache on entry
Device is lost for a long time when the screen is locked. Need to
continue calling present() to recover.
Reset render state cache on in RenderFramebuffer and RenderLastFrame
entry points.
More logging in renderer resizing.
2023-01-12 16:09:01 +01:00
Flyinghead cf031717dd chd: skip invalid media with 0 track 2023-01-12 16:05:07 +01:00
Flyinghead 075ec1cf98 log: increase in-memory log to 20 lines 2023-01-12 16:02:15 +01:00
Flyinghead 8f3b6a2371 lr: call set_system_av_info even for dx11
call was disabled due to a crash that doesn't happen anymore
Issue #863
2023-01-12 14:37:05 +01:00
Flyinghead ac24d9be5b preserve savestate compat with sh4 exception changes 2023-01-11 23:01:37 +01:00
Flyinghead a0e800f102 build fix 2023-01-11 22:39:20 +01:00
Flyinghead 7e4572a86a naomi: f355 multiboard support WIP 2023-01-11 22:31:36 +01:00
Flyinghead 4f0d3a958d ui: debug tab with logging and profiling options 2023-01-11 21:15:45 +01:00
Flyinghead 06c5ba7f0e sh4: simplify exceptions 2023-01-11 20:42:33 +01:00
Flyinghead 673fb26d6e android: threading fix. stop vibrator thread. allow screen saver
If the android activity is destroyed and the game unloaded, the gui's
game state wasn't updated, leading to a crash if resuming. Same for the
android game state if pausing, destroying then resuming.
tentative fix for MINIDUMP-27, MINIDUMP-25, MINIDUMP-23
Wait until emu is stopped in single-threaded.
Stop vibrator thread when view is detached
Allow the screen saver when a game isn't running.
2023-01-11 11:44:28 +01:00
Flyinghead 5fa98da17e dx9: stricter device reset failure check. More logging
tentative fix for MINIDUMP-1P
2023-01-11 09:44:00 +01:00
Flyinghead 9b2f33f7bd jvs: fix wrungp CAUTION message regression
due to 53ed006a54
Issue #861
2023-01-11 09:05:47 +01:00
Flyinghead 2b70c73f80 gl: compilation and runtime fixes for GLES 2.0
Fix libretro compile errors with GLES2
Fix black screen at runtime with gles 2.0

Issue #859
2023-01-11 09:02:24 +01:00
Flyinghead 1aec64cbae android: don't close the oboe stream twice on device lost
tentative fix for MINIDUMP-26
2023-01-11 08:58:55 +01:00
Flyinghead 611946559c macos build: fix brew python link error 2023-01-10 12:40:48 +01:00
Flyinghead 2997c6396f downgrade libchdr to before zlib 1.2.12 upgrade 2023-01-10 12:38:17 +01:00
Flyinghead 859d5df056 revert libchdr to before lzma-22 upgrade 2023-01-10 11:56:43 +01:00
Flyinghead 8a1902e5a8 GDI's and gdrom CHD's must have at least 3 tracks 2023-01-10 11:28:42 +01:00
Flyinghead 285655f52d vk: check if vkEnumerateInstanceVersion is null before calling it
vkEnumerateInstanceVersion is only available in vk 1.1 so it might be
null after dynamic loading of entry points.

tentative fix for MINIDUMP-1Z, MINIDUMP-20 and MINIDUMP-21
2023-01-10 09:58:56 +01:00
Flyinghead fceb170a2a picotcp: enable multithreading. protect bba input queue with mutex.
tentative fix for MINIDUMP-1Y
2023-01-10 09:46:28 +01:00
Flyinghead 4376e89149 Bump libchdr to latest 2023-01-09 18:33:44 +01:00
scribam cbd1d3134e deps: update sdl to version 2.26.2 2023-01-09 18:02:30 +01:00
Flyinghead fc479dbcc0 dx9: better handling of device lost. Fix fb not rendered if 1st
Handle case where device reset fails and continue attempting a reset.
tentative fix for MINIDUMP-12 and MINIDUMP-1Q

RenderFramebuffer wasn't working when first render after init
2023-01-09 18:01:44 +01:00
Flyinghead ae47ac19b8 dx11: check supported texture formats. Fix fb render not working if 1st
Check supported texture formats including mipmap and mipmap autogen.
Fall back to 8888 format.
tentative fix for MINIDUMP-17, MINIDUMP-1R and MINIDUMP-1M

RenderFramebuffer wasn't working if first render after init.
2023-01-09 17:50:46 +01:00
Flyinghead 84f6bd3fef libretro build fixes 2023-01-09 17:44:40 +01:00
Flyinghead d3b2da8e3b gui: &ll game scanner game_list updates must be guarded by mutex
arcade_game_list doesn't need to however
tentative fix for MINIDUMP-1S
2023-01-09 09:14:03 +01:00
Flyinghead 493ccc27d1 widescreen cheat for Fire ProWrestling. courtesy of Espirral 2023-01-08 11:35:24 +01:00
Flyinghead b37e6dc28d Merge remote-tracking branch 'origin/master' into dev 2023-01-08 11:19:48 +01:00
Flyinghead 8cd6a94e26 arm dynarec: avoid SIGBUS errors due to unaligned memory access
VSTR and VLDR require a 32-bit alignment in armv7. SH4 alignment
requirement is identical but ignored (no SH4 address error is raised).
So instead of crashing, just align the memory address.

Fix for MINIDUMP-1J
2023-01-08 11:13:01 +01:00
Flyinghead 13df32ba3f vk: check vkGetInstanceProcAddr value before use and report error
Tentative fix for MINIDUMP-1F
2023-01-08 11:06:47 +01:00
Flyinghead 262a39cafb android: avoid UI race condition when stopping or resuming game
Gamepad events aren't delivered to the UI thread in Android. This can
lead to race conditions between the UI thread (calling gui_display_ui())
and the event thread (calling gui_open_settings()).

Issue #852
Fix for MINIDUMP-1D, MINIDUMP-1E, MINIDUMP-1K
2023-01-08 10:59:36 +01:00
Flyinghead 480f2e31b0 widescreen cheats for 102 Dalmatians. courtesy of Espirral 2023-01-07 12:02:35 +01:00
Flyinghead d0bb0aea97 android: defer stopping audio until after current frame is rendered
In android, stop requests are not run in the UI thread so in
single-threaded mode, they must be deferred until after the current
frame is rendered to avoid deadlocking on audio.
2023-01-07 11:51:32 +01:00
Flyinghead bf3f927a99 reios: don't crash on unknown trap vector. log error and ignore 2023-01-07 11:46:59 +01:00
github-actions[bot] 19818e717f Fetch translations & Recreate libretro_core_options_intl.h 2023-01-06 22:20:08 +00:00
Flyinghead b6491a3842 android: REICAST_HOME -> FLYCAST_HOME 2023-01-05 20:21:15 +01:00
Flyinghead c04c696ba6 arm64 dynarec: pad link section with nop to allow full mmu relink
fix literal pool being overwritten
Fix for MINIDUMP-18
2023-01-05 14:36:23 +01:00
Flyinghead 17474bf005 android: log abort message to normal log so it's stored in the minidump 2023-01-05 13:01:49 +01:00
Flyinghead 756ec0e672 arm build fix 2023-01-04 12:27:04 +01:00
Flyinghead 3dfdb60139 arm dynarec: handle immediate operand to fsca 2023-01-04 12:12:24 +01:00
Flyinghead 5a409dbe2c boxart: [] operator with non-existing key on const json is UB
Use json::at() instead.
Don't return pointer to GameBoxart to UI since it can be
replaced/deleted by the scraper thread.
Tentative fix for MINIDUMP-16
2023-01-04 12:09:09 +01:00
Flyinghead 9ef37d9776 arm[64] dynarec: xtrct can have immediate operands
Fixes MINIDUMP-15
Sakura Taisen 2 crash
2023-01-03 15:15:13 +01:00
Flyinghead ba0a357d48 missing change for 12bba31270 2023-01-03 11:32:00 +01:00
Flyinghead 659ffa4406 vk: catch vulkan dyn loader exception when driver can't be loaded
Fixes MINIDUMP-R
2023-01-03 11:08:28 +01:00
Flyinghead 12bba31270 lr: fix incorrect DC framebuffer size 2023-01-03 11:03:31 +01:00
flyinghead dd66e44871 compile warnings 2023-01-02 16:39:34 +01:00
flyinghead c5c87522ca x64 dynarec: wrong op in GenReadMemImmediate
Fixes MINIDUMP-14
2023-01-02 16:06:58 +01:00
flyinghead 5ef80f0a17 dx11: disable scissor test when rendering framebuffer
Issue #847
2023-01-02 16:04:17 +01:00
Flyinghead 7372df3aff android: check if activity is null before using it to show/hide keyboard
tentative fix for MINIDUMP-Z
2022-12-31 16:53:08 +01:00
Flyinghead cf514b0d6b pvr: skip remaining vertices if incomplete after inf vertex
in makePrimRestartIndex
Issue #846
2022-12-31 16:51:35 +01:00
github-actions[bot] b232a10167 Fetch translations & Recreate libretro_core_options_intl.h 2022-12-30 22:19:43 +00:00
Flyinghead 2a465d2f03 ios: check if jit is enabled. attempt to enable it by debugging self
JIT detection and enabling taken from ppsspp
Re-check JIT and restart AltServer discovery every 10 secs until JIT is
enabled.
Attempt to enable JIT by forking a process to debug the parent process.
(jailbroken devices)
2022-12-30 16:22:38 +01:00
Flyinghead 802f70fedd pvr: recover from renderer init failure
issue MINIDUMP-V
fix some warnings
2022-12-29 19:18:19 +01:00
scribam 5acfa7d3d6 vulkan: return an error if no physical devices found 2022-12-29 19:12:53 +01:00
Flyinghead 85188bf137 naomi: fix button labels for hmgeo
Issue #841
2022-12-25 22:09:34 +01:00
Flyinghead bfc44f2b4e scraper: skip invalid textures. invalid CUE crash. memory leak
Sanity check of PVR texture params before converting it to avoid crash
(MINIDUMP-K).
.cue gdrom needs at least 3 tracks.
Delete disc if invalid.
2022-12-25 11:27:48 +01:00
Flyinghead 96aaa8b14a elan: don't map RAM with vmem if not naomi2 game
Issue #839
2022-12-24 13:33:16 +01:00
Flyinghead 53ed006a54 naomi: 18wheeler, soulsurfer and wldrider input improvements
18wheeler: limit wheel range. Issue #693
18wheeler: Implement gear tristate lever with 2 buttons. Fake motor drive board to avoid error messages in deluxe version.
soulsurfer: floormat button/contact is always on
wldriders: unmap rear brake so it doesn't have to be released
2022-12-24 10:48:17 +01:00
github-actions[bot] 171c41df12 Fetch translations & Recreate libretro_core_options_intl.h 2022-12-23 22:20:01 +00:00
Matt Phillips 4b53edb3bd Basic CPU graphs using ImPlot (#838) 2022-12-23 16:07:35 +01:00
Flyinghead 62085539a7 dynarec: reg alloc 64-bit regs. avoid some interpreter fallbacks
Option to reg alloc 64-bit regs in two host regs. Used when FPSCR.SZ ==
1 (64-bit reg and memory transfers.) Enabled for arm, arm64 and x64
(windows only) dynarecs.
Don't fallback to interpreter when FPSCR.PR==1 (double precision) for
FMOV, FLDS and FLTS.
2022-12-23 16:06:54 +01:00
scribam 1c8e558e25 deps: update glslang and vulkan 2022-12-23 10:14:31 +01:00
scribam 568145c247 metainfo: fix wrong category name 2022-12-23 10:14:02 +01:00
Flyinghead 5703bc7df2 ui: arcade games appear twice if the game list is updated 2022-12-23 10:13:26 +01:00
Flyinghead 95a00a165a sentry: upload crashes after reading emu.cfg to comply with user choice
android: get rid of Send Logs button
2022-12-23 10:06:24 +01:00
Flyinghead 599bc8a823 arm64 dynarec: need up to 5 ops for mem accesses
Issue #837
2022-12-22 14:55:42 +01:00
Flyinghead 9578841480 pvr: fix texture bleeding before making indexes
fix crash with sorted triangles.
Issue #836
2022-12-22 13:15:32 +01:00
Flyinghead 5387a6b534 android: minify makes httpclient fail
fixes sentry.io upload
2022-12-22 13:13:23 +01:00
Flyinghead bf09e96e04 android: more logging 2022-12-21 18:02:30 +01:00
Flyinghead b5d8cecd91 android: delay sentry upload to avoid broken pipe. Log more stuff
tentative fix for the broken pipe error when uploading to sentry on
android.
init log and sleep for 5 secs before upload
log git version, gpu name and version, renderer type and game id
2022-12-21 16:49:08 +01:00
Matt Phillips 6d913f42c8 Host-side profiler - initial commit (#834)
* Host-side (Flycast) profiler - initial commit

* Profiler - configurable frame warning time

* Compile fix for !DC_PROFILER
2022-12-21 11:24:11 +01:00
Flyinghead 1e0a875fa3 sentry: various fixes. Upload last log lines with the minidump 2022-12-21 11:23:15 +01:00
Flyinghead 4d77ce5a66 unused function 2022-12-20 22:24:15 +01:00
Flyinghead f3a6fb7d8b sentry.io integration 2022-12-20 21:52:46 +01:00
Flyinghead b6f73d96ca vk,dx: provoking vtx with sorted triangles. No depth write in per-strip
Provoking vertex wasn't set with sorted triangles (dx9, dx11, vulkan)
vk,dx9: No depth write in per-strip as in opengl and dx11.
2022-12-20 21:47:19 +01:00
Matt Phillips 13f3c8281f Fixed single stepping, added support for vCont packets and ranged stepping (faster), initial work to support other breakpoint types 2022-12-18 16:27:38 +01:00
Flyinghead 0107435a73 iOS build fix 2022-12-17 11:25:58 +01:00
Flyinghead ce674a872a dyna: implement missing ops: ldc/stc sr/fpscr, tas, div1
add dynarec implementations for missing ldc and stc ops with sr and
fpscr
add dynarec implementation for tas.b
canonical implementation for div1
delete unused reg_old_sr_status and reg_sr
2022-12-17 11:09:51 +01:00
Flyinghead 51758b965e ggpo: disable full framebuffer emulation. memwatch perf fix
Disable full framebuffer emulation with ggpo if threaded rendering is
enabled. Would require thread synchronization on VRAM page map.
memwatch: do single lookup on page map in hit()
2022-12-17 10:54:01 +01:00
Flyinghead 7fec511463 maple: don't recreate devs on rollback. Raise error if dest is invalid
maple: raise error is maple dest dma address isn't on RAM
maple: don't recreate maple devices when loading a rollback savestate
2022-12-17 10:51:12 +01:00
github-actions[bot] 1dd006d846 Fetch translations & Recreate libretro_core_options_intl.h 2022-12-16 22:19:48 +00:00
Flyinghead 2800927fa1 arm64 dynarec: can't rely on faultAddress with 512 MB vmem
Use x0 instead
2022-12-16 20:40:23 +01:00
Flyinghead f133e3cccb verify() must not call a function with side-effect 2022-12-16 20:40:23 +01:00
Matt Phillips b0a520fe18 Various GDB fixes and improvements (#832)
* Enabled GDB server, compile fix for MSVC, added GDB option to config

* GDB - 'vMustReplyEmpty' should not be explicitly handled, it is a test for how the target responds to unknown vpackets (which was incorrect)

* GDB wait for debugger option to allow debugging from bootstrap, and Event::Resume moved after renderer init so agent.interrupt() can pause the renderer

* Draw "Waiting for debugger", and fixed UI not rendering last frame before a state change

* Fixed GDB regs/mem endianness
2022-12-16 20:34:30 +01:00
Matt Phillips 3f30dd01ad Support for multi-processor compilation with MSVC (/MP option) (#830) 2022-12-15 22:50:38 +01:00
Matt Phillips 0c081a9597 Support for comma separated "-config section:key=value,section:key=value,..." command line syntax
(cherry picked from commit 451997d01e)
2022-12-15 22:49:55 +01:00
Matt Phillips 7176460de3 External windows serial console (#828)
* Open external console for serial output on Windows

(cherry picked from commit e41a1410b9)

* Compile fix for _UNICODE

(cherry picked from commit 4e6927bd27)
2022-12-15 22:49:20 +01:00
Matt Phillips 733a1fa73d Added USE_DX9 and USE_DX11 as configurable options in CMake 2022-12-15 22:48:38 +01:00
Flyinghead e3809ba058 gl: macOS build fix 2022-12-14 23:43:36 +01:00
Flyinghead 4d3de39c64 gl: no GL_PRIMITIVE_RESTART and glPrimitiveRestartIndex in GLES 2022-12-13 23:42:11 +01:00
Flyinghead 1765e50703 lr: missing symbols and functions 2022-12-13 23:33:24 +01:00
Flyinghead f9feaa313b pvr: sort triangles during parse. Use primitive restart
Sort triangles during ta_parse. Use the same index as other polys. Store
results in rend_context.
Use primitive restart if available to avoid too many degenerate
triangles.
Update renderers.
2022-12-13 22:57:57 +01:00
Flyinghead 9781d8971a gl: use static buffers for quad vertices 2022-12-13 20:56:19 +01:00
Flyinghead a0a9b5bbc5 holly: crash when reading a write-only register 2022-12-12 22:15:12 +01:00
Flyinghead c684faf423 naomi widescreen cheats: initd, initdv2, gunsur2, spawn, cspike, jambo
Widescreen cheats for initd, initdv2, gunsur2, spawn, cspike, jambo,
soulsurf.
Courtesy of Goddamn Superhero
Disable ws chear for House of the Dead 2 (wrong gun coordinates)
2022-12-11 16:33:30 +01:00
Flyinghead cdca559d99 ggpo: optimize memwatch, save/load state. endOfFrame on vblank in
ggpo: Optimize memwatch and load/save state. Unprotect memory before restoring a state. Smaller timesync wait. Missing error handling.
pvr: call ggpo::endOfFrame() on vblank in only
ssa: fix warning
2022-12-10 17:19:34 +01:00
Flyinghead d76dff8594 ggpo: don't call exit on assert. clean up logging
Don't call exit when an assertion fails, throw an exception instead. Log
ggpo API errors.
Deleted most ggpo logging methods and use flycast logging.
2022-12-10 13:06:31 +01:00
github-actions[bot] 223504a206 Fetch translations & Recreate libretro_core_options_intl.h 2022-12-09 22:20:25 +00:00
Flyinghead 1ab4eb00c0 tex cache: minor key mask fix. egl: no need for depth/stencil surface
Part of PalSelect was used as cache key for palette textures
PrintTexture fix
egl,wgl,xgl: No need for depth/stencil surface
gl: non-functional refactoring
2022-12-09 17:49:32 +01:00
Flyinghead 32e3e7d9c5 vmem: no more 4GB vmem mode. only map elan RAM in naomi2 mode
Do not attempt to reserve 4GM of virtual space on 64-bit hosts. Use
512MB everywhere.
Don't map elan RAM if not needed and dont protect/unprotect it in
memwatch.
2022-12-09 17:37:49 +01:00
Flyinghead 98123b9215 vk: don't sort triangles in per-strip mode
useless and now crashes since vertices aren't in ascending order anymore
2022-12-08 21:35:51 +01:00
Flyinghead 9069a49145 pvr: take jitter into account in spg sheduler. fix scheduler edge case
Take jitter into account when calculating current scanline
Scheduler would miss the next int if it's on the next scanline
Support for Hblank interrupt mode 2 (every scanline)
2022-12-06 22:04:37 +01:00
Flyinghead d417237e64 Merge remote-tracking branch 'origin/master' into dev
# Conflicts:
#	core/emulator.cpp
2022-12-06 21:47:50 +01:00
Flyinghead 648f33473f test fix 2022-12-06 21:12:41 +01:00
Flyinghead 446619ce85 atomiswave only has 2 MB of aica ram
new savestate version
build.h clean up
2022-12-06 20:51:45 +01:00
Flyinghead f5fa1f6210 holly, sh4: reg access handlers don't need size. SB_FFST constant 0 2022-12-06 20:42:00 +01:00
Flyinghead 976fb99aa3 pvr: naomi mvsc2 needs more rendering cycles
Regression introduced by 0b0e64304e
2022-12-06 19:50:34 +01:00
Flyinghead a0529d1cfc drop support for legacy .reicast config dir (linux, macOS) 2022-12-06 18:09:43 +01:00
Flyinghead 8001af9743 sh4: proper write masks for memory-mapped registers 2022-12-06 17:58:30 +01:00
Flyinghead e48b72a859 race condition causing emu thread exceptions to be ignored
in multithreaded mode, checkStatus() *must* be called to report
exceptions thrown by the emu thread
2022-12-05 21:24:27 +01:00
Flyinghead 71ba018782 widescreen cheatcode for vf3tb US
courtesy of goddamn superhero
2022-12-05 18:36:49 +01:00
Flyinghead 59ff44132b aica: get rid of audio samples batching
Some audio issues are reported because of this option and the now
correctly clocked aica cpu.
2022-12-05 18:34:52 +01:00
scribam 8a0323ec08 deps: update sdl to version 2.26.1 2022-12-04 16:32:08 +01:00
Flyinghead 4c7df6c7f4 pvr: don't merge polys in per-triangle. merge polys in per-strip
Merging polygons in per-triangle can produces a large number of
degenerate triangles (up to x3), which must then be sorted, resulting in
a performance hit. This is useless since the sorted triangles are merged
after being sorted. (Regression introduced by
20d25059bf)
Issue #818

In per-strip mode, polygons are now sorted before creating the index and
merging. So it doesn't have to be done in the renderer anymore.
2022-12-04 16:31:39 +01:00
github-actions[bot] 676cd3104b Fetch translations & Recreate libretro_core_options_intl.h 2022-12-02 22:20:30 +00:00
Flyinghead a40210c55c no aica batching for Tony Hawk's 1 & 2 2022-11-29 17:27:31 +01:00
Flyinghead 034f90c1e0 ggpo: zero-init unused but sent inputs
avoids lots of useless rollbacks
2022-11-29 17:12:15 +01:00
DisasterMo 64223927b8 Fix Crowdin config & workflow
Also add new languages and update translation scripts
2022-11-28 15:00:25 +01:00
tunip3 e2c03255bb make Xbox display scale scale with res instead of just switching between 2 presets for 1080p and 4k 2022-11-25 19:21:10 +01:00
scribam 63495d3a6a deps: update sdl to version 2.26.0 2022-11-22 17:23:32 +01:00
scribam 88466ec352 vulkan: add missing simplification (follow-up from 8426bcad) 2022-11-19 12:53:28 +01:00
Edward Li 1995eb935b Build OpenMP.xcframework 2022-11-19 12:52:58 +01:00
scribam f6532ca27a fix some warnings 2022-11-19 12:52:26 +01:00
Flyinghead 75dd5305c4 Revert "ci: use devkitpro/devkita64:latest (#672)" due to regression
Several games are freezing at start up
Issue #783
This reverts commit 3d00ac338b.
2022-11-15 17:52:12 +01:00
Flyinghead 76cf989455 disable free play for radirgy noa
Issue #527
2022-11-14 16:00:11 +01:00
Flyinghead 5b8e932509 move steam deck hack to sdl/sdl.cpp 2022-11-14 15:59:19 +01:00
scribam 993b705d8b vulkan: use dynamic dispatch loader 2022-11-09 17:20:05 +01:00
Flyinghead 19204882c4 pvr: reschedule spg when SPG_HBLANK_INT is updated
Fixes Triggerheart Exelica input lag
Issue #691
2022-11-04 18:34:43 +01:00
vkedwardli 605dc59f8d Fix Steam Deck's Game Mode also 2022-11-04 16:01:06 +01:00
Flyinghead 2332884d8b maple: lower xfer rate to 1 Mbps. More accurate payload size calculation
Maple bus max xfer rate is 2 Mbps but actual speed is 1 Mbps.
Fixes Slave Zero (PAL) freeze with HLE.
Some improvements on payload size calc. Clean up.
2022-11-04 11:22:50 +01:00
Flyinghead 94f3d80a75 Merge remote-tracking branch 'origin/master' into dev
# Conflicts:
#	CMakeLists.txt
#	core/hw/pvr/Renderer_if.cpp
#	core/oslib/audiobackend_alsa.cpp
#	core/rend/vulkan/desc_set.h
#	core/rend/vulkan/oit/oit_drawer.cpp
2022-11-02 20:12:34 +01:00
Flyinghead 0b0e64304e pvr: adaptive end-of-render interrupt delay
EoR interrupt delay now depends on the TA context size.
Issue #634
Fixes issues with FMV in some WinCE games (Resident Evil 2, Next Tetris,
Nightmare Creatures 2)
2022-11-01 18:29:44 +01:00
Flyinghead 5a1a766bd4 pvr: emu unresponsive if no render. Present when FB_R_SOF = FB_W_SOF
Fix no input polling while waiting for present.
Present frame immediately if FB_R_SOF = FB_W_SOF.
2022-11-01 18:23:54 +01:00
Flyinghead c15f446ffc hle bios: fix pal detection for some pal wince games
Caesar's Palace 2K, The Next Tetris, KISS
2022-10-31 11:31:21 +01:00
Flyinghead c88cdde9ec test fix 2022-10-30 12:47:39 +01:00
Flyinghead 40dbf53792 pvr: use render pass # to read the right tile when marking blocks
Fixes Unreal Tournament flashing/black screen.
gl: mark vram area in rtt to avoid overwriting data (Worms World Party)
Force Worms World Party to use CopyToVRam (regression due to
6a5db32d5d)
Don't calculate precise aspect ratio and use 4/3 instead (or more if
widescreen or stretch).
Fix clipping issue when using SCALER_CTL.vscalefactor. Avoir crash when
clip values are >= width or height.
vulkan: RenderFramebuffer wasn't working at all if !EmulateFramebuffer
2022-10-30 12:10:24 +01:00
vkedwardli 0cbf6f6601 Fixing Steam Deck's wrong dpi caused by incorrect 60mm * 60mm EDID (#796) 2022-10-27 22:00:22 +02:00
bslenul c8fc873cf9 [Game List] Separate DC and arcade games 2022-10-26 15:37:17 +02:00
Flyinghead b935bef906 gl: missing init of width and height in GlFramebuffer
gl,vk,dx9,dx11: always use the TA context copy for TA_GLOB_TILE_CLIP and
SCALER_CTL
2022-10-25 17:50:41 +02:00
Flyinghead c1f0dd81d2 pvr: copy pvr regs at start_render time to avoid concurrent update
copy TA_GLOB_TILE_CLIP and SCALER_CTL to rend context when starting
render. Use rend context copy to calculate framebuffer size.
Fixes framebuffer size glitches in vf4 water stages.
lr: pass aspect ratio when resizing.

dx11: Wrong sizing of rotated games.

gl: test automation fixes.
2022-10-25 15:00:04 +02:00
Flyinghead 5722dc90f0 Full framebuffer emulation. Renderer interface changes
Helps for:
Densha de Go! 2, Issue #171
Vigilante 8, Issue #275
Xtreme Sports
Sonic Shuffle
The Ring of the Nibelungen
2022-10-23 16:32:42 +02:00
Flyinghead e3c260f4ca pvr: don't use op list to mark block if tile pointer is null
Naomi Doom sets the opaque list block to null in the tile, but op size
in TA_ALLOC_CTRL is non-zero. So use the TR list in this case.

Issue #682
2022-10-23 15:49:23 +02:00
Flyinghead d1e48c657e missing overrides 2022-10-23 15:44:12 +02:00
Flyinghead decf70c87c get rid of INLINE, NOINLINE, __forceinline 2022-10-22 22:14:19 +02:00
scribam 4de9076b49 macos: fix cmake post build command with ninja 2022-10-22 14:09:13 +02:00
Flyinghead 922df88cdd msvc build fix 2022-10-22 13:05:11 +02:00
Flyinghead f25aeee756 audio: don't crash if audio init fails. Fall back to auto
Don't crash if an audio backend fails to initialize.
Fall back to auto or run without sound.
Better audio backend framework
2022-10-22 12:08:05 +02:00
Edward Li 2b36953fdc Always fills the window with responsive size 2022-10-21 10:55:34 +02:00
Edward Li 1dcf302665 Add Aspect Fit & Aspect Fill description for Widescreen and Super Widescreen 2022-10-21 10:54:59 +02:00
Flyinghead 1fd95c2886 Roadsters (US) doesn't support RGB cable
Issue #791
Compile warnings
2022-10-21 10:54:26 +02:00
Edward Li 93e1d7fcee rend_resize_renderer_if_needed check for window size changes also 2022-10-20 09:51:04 +02:00
Flyinghead b2b860bb8e gl: vmu not showing and memory corruption
Fix vmu not displayed
Memory corruption when restarting gl driver (android)
2022-10-20 09:49:53 +02:00
Flyinghead 0bd88fc9d9 gui: div by zero crash if window is too small 2022-10-19 10:07:48 +02:00
Flyinghead 20f9450218 ignore start() if emulator already started
can happen on android
2022-10-19 10:06:53 +02:00
flyinghead 401c402afc Revert "cmake: use more system libs (#775)" (#785)
This reverts commit c5c941e928.
2022-10-19 10:04:21 +02:00
Flyinghead 77a105d888 set USE_DX9 in CMakeLists.txt instead of build.h 2022-10-18 10:12:27 +02:00
Flyinghead 257c6b729f rzip: allow multiple writes 2022-10-18 10:08:02 +02:00
Alexandre Bouvier c5c941e928 cmake: use more system libs (#775) 2022-10-18 10:04:15 +02:00
Edward Li 092006fbbe Mark Flycast as a game for Launchpad 2022-10-15 21:33:22 +02:00
Edward Li 6add19fb04 unprotect elan memory during dc_reset hard 2022-10-15 21:32:49 +02:00
Flyinghead 02d4b821d7 naomi: allow eeprom-based settings to be overridden (rotate, region) 2022-10-12 22:59:46 +02:00
scribam 3d00ac338b ci: use devkitpro/devkita64:latest (#672) 2022-10-09 19:08:54 +02:00
scribam 387b9778f3 cmake: remove "-static-openmp" for apple (#773)
Fix warning "clang: warning: argument unused during compilation: '-static-openmp' [-Wunused-command-line-argument]"
2022-10-08 19:18:50 +02:00
scribam 582876b99e libomp.rb: update and set min macosx version to 10.9 2022-10-08 18:34:00 +02:00
scribam 3b3391c0d1 deps: update sdl to version 2.24.1 2022-10-08 18:33:11 +02:00
Alexandre Bouvier df61b1046a cmake: normalize whitespaces 2022-10-08 18:32:36 +02:00
scribam 8426bcad27 vulkan: simplify function calls 2022-10-08 18:32:01 +02:00
GABO1423 d22fa54f7b (Libretro) Enable Per-Pixel Options on DX11 builds 2022-10-05 10:46:10 +02:00
Piotr Jagiełło 2d56dddf7a cmake: execute git commands in the source directory 2022-10-05 10:45:18 +02:00
Flyinghead 7da0549b8c operator [0] on empty vector crashes
Issue #763
2022-10-04 18:21:10 +02:00
Flyinghead b821ece052 alsa: default to 'auto' device if configured one can't be opened
Issue #762
2022-10-02 17:09:13 +02:00
Flyinghead b240da41e0 lr: use VK_API_VERSION_MAJOR/MINOR/PATCH 2022-09-26 11:19:15 +02:00
Flyinghead d85baba1d3 Merge remote-tracking branch 'origin/dev' 2022-09-26 11:07:33 +02:00
Edward Li 8a44b909a4 [Apple] Proper version handling for Info.plist 2022-09-26 11:06:31 +02:00
GABO1423 5362264b18 (UWP) Remove expandedResources 2022-09-26 11:05:54 +02:00
Flyinghead 1858cf3b33 Merge remote-tracking branch 'origin/master' into dev 2022-09-24 19:28:38 +02:00
Flyinghead 1f876cde39 lr: use default button name if naomi inputs name is empty 2022-09-23 16:40:18 +02:00
Flyinghead 7288c7b541 win32: build win app, not console 2022-09-23 16:38:49 +02:00
Edward Li 2b8f5a7b9d Print correct version info for Vulkan and MoltenVK 2022-09-21 14:43:28 +02:00
Edward Li c2e1425209 Stop Apple fanboys from asking where is Metal 2022-09-21 14:43:28 +02:00
scribam c9c1218234 vulkan: add deps as submodules and sync with Vulkan 1.3.224.1 2022-09-18 16:56:56 +02:00
scribam 11d776aea1 vulkan: remove external files 2022-09-18 16:56:56 +02:00
scribam 1386744fe0 .cirrus.yml: update freebsd image to version 13.1 2022-09-17 12:49:42 +02:00
Edward Li da0d012328 Handle Dock menu's Quit action 2022-09-16 16:03:25 +02:00
Flyinghead f88abf9987 extra depth scaling for south park rally
fixes car depth on character selection screen
2022-09-14 17:52:35 +02:00
Flyinghead 4a4fa7792f vk oit: limit drawer swap chain to 2, same as non-oit
Fixes flashing during partial redraws (south park rally)
2022-09-14 17:48:57 +02:00
Flyinghead 73adbc660b win32: build win app, not console 2022-09-14 17:46:14 +02:00
Flyinghead aa97a6d64f pvr: last naomi2 poly was ignored in some cases
Fix the disappearing moustache in wild riders
Fix other potential edge cases in pvr parsing
2022-08-25 19:34:23 +02:00
Flyinghead e0d87eb093 Merge remote-tracking branch 'origin/master' into dev
# Conflicts:
#	core/rend/gui.cpp
2022-08-22 13:09:56 +02:00
Flyinghead 85b8c599c4 pvr: object list is sometimes shared between op and tr modvols
Region tile object list pointers can be identical for op and tr modvols,
in which case tr modvols should be drawn using op modvols geometry.
Used by crazy taxi 1/2, alien front online, daytona usa and probably
many others.
Issue #717
2022-08-22 12:38:04 +02:00
scribam 72136c2bfc deps: update sdl to version 2.24.0 2022-08-22 12:29:34 +02:00
Flyinghead 71e9420929 macOS: std::exception handler not catching FlycastException
Catch std::runtime_error instead
vk: Clear boxart texture cache before shutting down imgui driver
2022-08-14 18:39:09 +02:00
scribam 7457db8bba android: update android gradle plugin to version 7.2.2 2022-08-06 17:30:10 +02:00
GABO1423 69125b490e (UWP) Build Tweaks (#709)
* (UWP) Disable Vulkan Build Flag

* (CI) Remove UWP Build Flag
2022-08-04 17:37:06 +02:00
vkedwardli 3c94cd3194 Fix macOS accent menu (#708)
* `SDL_StartTextInput` only when textfield is focused

* [macOS] "Reveal in Finder" button for Home Directory

* only enable for `USE_SDL`
2022-08-04 17:35:40 +02:00
Flyinghead a6ac753c64 boxart: ignore disks with invalid ip_meta. sanitize disk id chars 2022-07-29 10:48:39 +02:00
Flyinghead 55600c40a9 sdl: use exp scale for rumble power
Better sensitivity for low power values.
Issue #707
2022-07-28 10:47:42 +02:00
Flyinghead 9070c246d4 move iso9660.h 2022-07-28 10:43:44 +02:00
bslenul 75ff5409f4 Switch broadcast region for San Francisco Rush 2049 and Sega Smash Pack - Volume 1 2022-07-25 11:26:12 +02:00
Flyinghead 642fad9a6e cfg: per-game settings must be deleted when changed back to standard
When a per-game setting is the same as the standard one, it is ignored
and not saved to emu.cfg. However the previously saved per-game setting
wasn't deleted, making it impossible to revert.

Issue #653
2022-07-25 11:25:42 +02:00
GABO1423 5ae7ac3eca (UWP) Add Additional Rescap Capabilities 2022-07-22 18:13:11 +02:00
Edward Li 885862a45e Get writable log path for macOS also 2022-07-22 18:12:43 +02:00
Edward Li 9b751fced8 NSLog with UTF-8, better color handling 2022-07-22 18:12:43 +02:00
Flyinghead 19ccc6a38d uwp build fix 2022-07-21 14:51:20 +02:00
Flyinghead ad8b41adb0 boxart: extract 0GDTEX.PVR. Offline scraping
extract iso9660 file system utility out of reios
.pvr limited parser
2022-07-21 10:43:45 +02:00
Flyinghead 807b8dea91 lr: Framebuffer size and aspect ratio. Fix vmu size and position (GL)
gl4: fix lightgun xhair size and position
2022-07-19 20:26:37 +02:00
Flyinghead 8e8935b9c4 pvr: xform matrix 240p support. screen stretching changes
Use FB_R_CTRL.vclk_div to detect progressive mode.
transform_matrix: Support non-4:3 aspect ratio such as 640x240. Don't
expect 480 height. Issue #690
Add black bars at top and bottom if screen aspect ratio is too low.
Issue #584.
Framebuffer size doesn't depend on screen stretching. Stretching is done
when blitting to screen.
lr: correct subsequent stretching when drawing vmus and xhair
2022-07-18 18:21:09 +02:00
Flyinghead 76bf574668 gl,gl4: disable anisotropic filtering if not linear
Issue #695
2022-07-15 20:36:29 +02:00
Flyinghead 9d17fc15a3 gdrom, hle: don't restart cdda if paused or playing
Fix regression due to ab791d1b9c
(unpausing restarts the current track)
Issue #690
2022-07-14 16:49:56 +02:00
Flyinghead 1cadd4e923 gdrom: set sub-q channel flag on audio tracks in TOC (ADDR)
Fixes V-Rally 2 CDDA tracks not playing. Issue #534
2022-07-14 16:43:41 +02:00
Flyinghead ab791d1b9c gdrom: ignore CD_PLAY when already playing, not when paused
Issue #690
2022-07-13 12:52:29 +02:00
Flyinghead 4f206d2773 pvr: set correct framebuffer size in 240p/pixel_double
Some games use 240p and pixel_double resulting in a 320x240 framebuffer.
Renderer should be resized accordingly.
Fixes linear filtering artifact in KoF dream match 1999 (Issue #690)
2022-07-12 15:55:49 +02:00
Flyinghead 7f9d9b81aa gdrom: don't reset current cdda sector on cd_play if already playing
Issue #690
2022-07-12 15:33:11 +02:00
Edward Li c77c3ab015 DRY 2022-07-09 11:46:27 +02:00
Edward Li 8acd81cc43 Add MacPorts as alternative link 2022-07-09 11:46:27 +02:00
Enrique Santos c0e52b9a1a load game: destroy old maple devices before create call 2022-07-08 20:38:16 +02:00
Flyinghead 0840da1bd5 sdl: fix inverted axis detection 2022-07-08 20:36:20 +02:00
vkedwardli 852df89f93 [macOS] Handle Quit menu item properly (#684)
* [macOS] Handle Quit menu item properly

* cleanup
2022-07-05 14:37:28 +02:00
vkedwardli b5eb8694f6 macOS Breakpad (#683)
* Breakpad.framework and dump_syms

* Use ExceptionHandler manually instead of using public methods from the framework

* Change macOS buildType to RelWithDebInfo and enable building Breakpad framework

* Enable symbol upload on GitHub runner

* Compile Breakpad directly instead of embedding the Breakpad.framework

* Print minidump location also

* Ignore `EXC_MASK_BAD_ACCESS` again
2022-07-05 14:36:21 +02:00
Flyinghead f4986008fe jvs: fix 86-request decoding
Fixes kingrt66 inputs when networked
Issue #673
2022-07-05 14:34:57 +02:00
Flyinghead d6644c4935 lr: terminate emu during deinit on android
Issue #566 is for linux only, not android
2022-07-03 18:38:59 +02:00
Flyinghead 19112aecb2 Merge remote-tracking branch 'origin/master' into dev
# Conflicts:
#	core/hw/naomi/naomi_cart.cpp
2022-07-01 12:42:37 +02:00
Flyinghead 5bb8c86903 uwp: force windows sdk version to one compatible with current xbox fw
Fixes error at install: The package requires OS version 10.0.22621.0 or
higher on the Windows.Universal device family. The device is currently
running OS version 10.0.22000.4970.
2022-07-01 12:16:30 +02:00
vkedwardli a659b57e63 Install Vulkan SDK in generate_xcode_project.command (#678) 2022-06-30 14:11:26 +02:00
vkedwardli 44e96c544b Use source_group to create folder hierarchy for Xcode project (#679) 2022-06-30 14:10:15 +02:00
scribam 0a5b8891a8 android: update gradle 2022-06-30 14:09:20 +02:00
Flyinghead 6a5db32d5d don't protect RTT textures vram
Fixes Spikers Battle RTT texture spurious update before use
(transitions)
2022-06-27 13:37:22 +02:00
Flyinghead b0f3e065be ui: wrong scaling after imgui driver reset
ImGuiStyle::ScaleAllSizes() is cumulative so reset style before calling
it
Issue #676
2022-06-27 13:32:30 +02:00
Flyinghead b5b0875203 android keyboard support 2022-06-26 22:04:36 +02:00
Flyinghead 9a557978c4 gamesdb: fix exception when boxart is missing 2022-06-26 21:55:00 +02:00
Flyinghead fe895211c1 ui: reset imgui driver before creating new one
Possible fix for Issue #676
2022-06-26 15:23:30 +02:00
Flyinghead 907131b7f5 allow ForceWindowsCE option to be used in per-game config
Issue #252
2022-06-24 13:27:21 +02:00
Flyinghead 76508146ae cheats: only apply widescreen cheat if current value is expected
Issue  #180
2022-06-24 11:47:24 +02:00
Flyinghead 7f28b767e4 gl: boxart clamp to edge if border not supported 2022-06-24 10:57:48 +02:00
Flyinghead 5f5a748031 boxart: batch uid searches. Bios image. More arcade rom name changes 2022-06-23 22:06:50 +02:00
vkedwardli 867b519a2b [macOS] Fix imagemagick not found on GitHub runners (#674)
disable dep check for brew reinstall
2022-06-21 09:50:05 +02:00
Flyinghead 74852520dc maxspeed: allow use of per-game network settings
Issue #671
2022-06-20 20:56:53 +02:00
Flyinghead faec4d8e50 gl: always use int arithmetic in palette index glsl calculation 2022-06-20 20:52:15 +02:00
Flyinghead d2aca1d621 savestate: overflow crash when serializing 2022-06-20 20:49:09 +02:00
Flyinghead 7bcd8c819a arcade rom names update. non square boxart
Correct handling of non square images
Improve search for arcade game names
Retrieve other images if no boxart (titlescreen, screenshot)
Changed some arcade rom names to more friendly ones
2022-06-20 18:07:06 +02:00
Flyinghead 7209a61583 boxart: race conditions. revert dash in disk id hack
Filter BIOS by name like regular games.
2022-06-18 17:49:37 +02:00
Flyinghead 1523fafce0 vk: fix crash when resizing window in boxart mode 2022-06-17 16:17:58 +02:00
Flyinghead 3915c55251 boxart: skip invalid disks. fix disk id dash issue. save found status 2022-06-17 16:13:58 +02:00
Flyinghead 5259aa20e6 boxart: delete trailing [.*] in game names. Remove extension first 2022-06-16 17:03:14 +02:00
Flyinghead 11ecb473b6 new option to broadcast digital outputs over the network
Similar to MAME's "-output network" option. Should be compatible with
MAME Hooker and the like.

Limit boxart images loaded per frame to 10.
2022-06-16 16:50:26 +02:00
Flyinghead 7982fdac1c switch needs curl 2022-06-15 23:13:01 +02:00
Flyinghead 54d92a11e8 build fixes 2022-06-15 22:38:05 +02:00
Flyinghead 5eb302898f box art fetch and display
Issue #22
2022-06-15 21:22:12 +02:00
Flyinghead 5b3a414987 Merge remote-tracking branch 'origin/master' into dev 2022-06-15 19:25:41 +02:00
Flyinghead 05961ac883 android build fix 2022-06-11 13:41:44 +02:00
flyinghead afd07c25ba pvr: store tex address in render context. texture cache refactoring
Store FT_W_SOF1 and FT_W_CTRL in render context since they can be
modified before render end. New tentative fix for vf4 water reflection
flashing black during netplay.
Refactor texture cache to use constructors. RTT code moved from
renderers.
Partial revert of ddcd3861d3
2022-06-11 13:24:22 +02:00
flyinghead 7ab92d88b1 msvc x86 build fix 2022-06-10 17:57:53 +02:00
flyinghead 3780299803 win32 raw api: user-friendly names for devices
Issue #664
2022-06-10 17:20:29 +02:00
flyinghead d78bb9ed3f don't list hidden folders and files on windows. Better parent dir prompt
Issue #666
2022-06-10 15:29:28 +02:00
Flyinghead b5f1552ed8 elan: don't crash on invalid texture xfer size
Issue #647: fixes initdv3jb area conquered crash
2022-06-06 15:54:25 +02:00
Gabriel Morazán 917cc7f27c Readme Updates. (#659)
* Update Reicast Link
2022-06-05 17:32:59 +02:00
Gabriel Morazán 2327e73ee7 (README) Update Xbox Section 2022-06-02 18:11:49 +02:00
Gabriel Morazán 397ddef68c (Libretro) Actually allow DX11 only cores.
Simple build fix.
2022-06-02 18:11:49 +02:00
Gabriel Morazán 3ec7f293ee (Libretro) Allow a DX11 only core to be built. (#657)
Main use case is Xbox systems.
2022-06-01 22:27:51 +02:00
flyinghead 26c8e8dab8 dx11 oit: naomi2 regression. Tr modvols shader needs divPosZ too 2022-06-01 19:26:56 +02:00
Flyinghead fdcea88519 gl4: wrong depth for transparent polys with native depth interp
Issue #630
2022-06-01 19:26:56 +02:00
flyinghead bf6c73060b native depth interpolation option to help AMD gpus
When enabled, set 1/z in pos.w and use native interpolation for colors,
UV and depth.
Get rid of manual modvol clipping in dx11.
2022-06-01 19:26:56 +02:00
Flyinghead ddcd3861d3 ggpo: don't protect rtt texture vram if ggpo is enabled
tentative fix for flashing water reflection texture in vf4 during
netplay
2022-05-31 17:42:42 +02:00
Flyinghead 971d47eb42 sdl: SDL_QuitSubSystem() on exit
Tentative fix for issue #654
2022-05-31 17:42:42 +02:00
Enrique Santos 13bd42bdab chat: disable window timeout after you respond to message 2022-05-30 16:15:44 +02:00
Flyinghead 71ac212dc7 elan: disable texture for vertices without UV coordinates
Fixes initial D white transparent quad at start of race
2022-05-30 16:15:15 +02:00
Flyinghead 2319a00c4f vk: bump moltenvk to 1.3.211.0 2022-05-29 13:35:22 +02:00
Flyinghead 1268077f6b cheat: missing cheat value in constructor
Fixes vf4tuned dimm check cheat writing random value (SH4 exception,
boot loop)
2022-05-29 13:30:06 +02:00
vkedwardli 5c579de459 Enable Texture Upscaling on macOS (#645)
* Compile a universal libomp
* static linking OpenMP
2022-05-28 13:00:20 +02:00
Flyinghead 167faff1f3 vk: invalid lightgun crosshair if maple device A isn't a lightgun 2022-05-28 12:58:53 +02:00
Flyinghead 22ad95cbfe ios: diagonal DPad buttons. Pan between buttons. Help tip for menu
Add diagonal DPad buttons
Allow switching virtual button without lifting finger.
Display help tip on first startup about pausing/opening menu.
2022-05-27 18:32:55 +02:00
Flyinghead db8508cefc ios: update AltKit 2022-05-27 18:20:16 +02:00
Flyinghead 5ac0772a2a vk oit: out of pool memory with moltenvk during render to texture 2022-05-26 18:06:30 +02:00
Flyinghead e2c2d6606d Fix Dead or Alive 2: Limited Edition (JP) widescreen cheat
Issue #625
2022-05-26 17:54:45 +02:00
Flyinghead 48361f58b6 vk oit: wrong temporary framebuffer dimensions 2022-05-25 16:44:24 +02:00
Enrique Santos dcb439f74a add ggpo chat window timeout 2022-05-23 11:42:11 +02:00
flyinghead 739a27be63 dx11 oit: render target and depth/stencil must have same dimensions
Fixes glitches during doa2 attract mode (depth/stencil missing).
2022-05-23 11:41:37 +02:00
Flyinghead e84cdce398 reios: flashrom read returns 0 on success. system id/timezone flash fix
flashrom read returns 0 on success, not size read.
Fixes Slave Zero (PAL) crash
2022-05-21 15:46:22 +02:00
Flyinghead af2fe242f9 flash: console id is checksummed 2022-05-18 14:58:21 +02:00
Flyinghead 0fb177bf85 reios: fix regression on many games due to 77a2bbbb
Jeremy McGrath
Skies of Arcadia
Speed Devils Online
Sydney 2000
Tech Romancer
Time Stalkers
Virtua Athlete 2000
Quake 3 (EU)
Climax Landers (JP)
Frame Gride
Pop'n'Music 1 & 2
Simple2000 2 & 3
2022-05-18 14:56:14 +02:00
Edward Li baab70c509 Rumble using MacBook's Taptic Engine (take 2) 2022-05-17 16:37:37 +02:00
scribam bc1c70bd1a ci: remove brew install libomp 2022-05-17 16:36:57 +02:00
scribam 12929c4571 openmp: use _OPENMP preprocessor, search openmp pkg unconditionally if enabled 2022-05-17 16:36:57 +02:00
Flyinghead 62522e4eb3 vk: naomi2 crash when lightModel is null
fixes crash at end of tutorial in kingrt66
2022-05-17 16:36:34 +02:00
Flyinghead 221060cc70 widescreen cheat for Dynamite Deka2 (JP), Zombie Revenge (naomi)
Better Dynamite Deka ex (naomi) widescreen cheat.
Courtesy of Goddamn Superhero
2022-05-16 13:06:38 +02:00
Flyinghead 58d1f7cee1 pvr: reset nextContext in Reset(). Use tactx_Alloc for direct fb render
Fix crash with multipass renders
Issue #634
2022-05-16 13:04:38 +02:00
Flyinghead 430256266f pvr: lightModels TA overrun on beach spikers
Better sizing of TA_context lists
2022-05-15 13:41:03 +02:00
Flyinghead f9e38b11d9 pvr: restore TA_context pool
fixes performance regression on android
2022-05-15 13:37:58 +02:00
Flyinghead 78e075546a libretro android build fix 2022-05-15 13:35:23 +02:00
flyinghead 658e111e3c dx11 oit: naomi2 regression. Tr modvols shader needs divPosZ too 2022-05-14 12:01:50 +02:00
jdgleaver 0e23b0bedd (libretro) Add option to detect and notifiy frontend of internal frame rate changes (60 <-> 30 <-> 20 fps, etc.)
Improves frame pacing in games with locked 30 fps and 20 fps frame rates
2022-05-13 17:13:25 +02:00
Flyinghead 903c768f7f vk oit: First frame after init wasn't displayed 2022-05-13 17:12:31 +02:00
Flyinghead d08f0e6599 gl4: wrong depth for transparent polys with native depth interp
Issue #630
2022-05-13 13:03:02 +02:00
Flyinghead cd22ba1a2b android: use WifiManager.MulticastLock to receive broadcast packets
In many cases, broadcast UDP packets can't be received on android unless
a MulticastLock is held.
2022-05-12 17:39:49 +02:00
flyinghead 77a11d2a2e native depth interpolation option to help AMD gpus
When enabled, set 1/z in pos.w and use native interpolation for colors,
UV and depth.
Get rid of manual modvol clipping in dx11.
2022-05-12 13:43:43 +02:00
flyinghead cce8cb8528 dx11 oit: missing TextureFiltering support
Issue #628
2022-05-11 19:16:31 +02:00
jdgleaver 6c6b447ea1 (libretro) Limit maximum number of audio samples that can be uploaded per call of retro_run() 2022-05-05 18:02:40 +02:00
Flyinghead 4554450d1d oit: add max layers and pixel buffer size options 2022-05-05 18:01:05 +02:00
Flyinghead a0d1dbf833 dx11: don't create the device in debug mode 2022-05-04 19:38:43 +02:00
Flyinghead a1a89df17f change vf4ft dimm check cheat. Don't apply cheat if not needed.
Fixes the SH4 exception seen with the previous cheat on some platforms.
Don't write memory if value is unchanged to avoid unnecessary protection
faults.
2022-05-04 10:30:35 +02:00
Flyinghead cf36384481 use nearest/point sampling to draw framebuffer if nearest is forced 2022-05-03 17:55:02 +02:00
flyinghead 9103371362 vk: increase descSet pool size for storage buffers and input attachments
Fixes out of host memory error on macOS
Issue #619
2022-05-03 17:49:46 +02:00
flyinghead 1b5ad34c8e dx11: (oit) use temporary render target for multipass
Render to temporary render target at end of pass and swap with regular
RT.
Fixes Tony Hawk 2 missing transparent geometry and character shadow.
Issue #618
2022-05-03 17:47:43 +02:00
Flyinghead c57e88850c lr: avoid crash when rewind is on
Issue #471
2022-05-01 19:22:22 +02:00
scribam 101a831534 cmake/macos: remove multitouch library 2022-05-01 12:34:43 +02:00
Flyinghead 3cc991fa4f oit: poly number/vertex id overflow
Use 17 bits for vertex id but substract first vtx index
Use 13 bits for poly number instead of 12
Panzer Front uses more than 4095 tr polys.
Issue #616
2022-05-01 12:33:53 +02:00
Flyinghead c348f4ccad allow a core without open gl to be built
Issue #515
2022-04-30 18:05:12 +02:00
Flyinghead 0181685d2f cheats: use software name as additional condition for widescreen
don't enable widescreen cheat for code veronica X
Issue #229
2022-04-30 12:08:36 +02:00
Flyinghead 39bb94dd55 jvs: don't scale ninja assault lightgun coordinates
Fixes reload issues (Issue #610)
2022-04-30 11:50:56 +02:00
Flyinghead 77a2bbbb8d reios: cancel gd dma int in g1_end_dma. drv_stat returns busy when busy
Cancel G1 DMA interrupt in G1_DMA_END (fixes MSR, Psychic Force, Pro
Pinball, Sega Swirl)
GET_DRV_STAT must return busy when drive is busy (fixes Hell Gate, Zero
Gunner)
Better named constants
2022-04-29 15:18:41 +02:00
Flyinghead afb0a80de1 pvr: autosort needs empty passes to be accounted for
Issue #612
2022-04-29 11:37:17 +02:00
Flyinghead 49932e02a6 gdrom: generate raw subcode 2022-04-27 14:32:53 +02:00
Flyinghead 990a4ad583 vk: ignore pipeline cache if loading fails 2022-04-27 14:30:03 +02:00
Flyinghead fc9e1e401b naomi: emulate midi ffb drive board response
needed for driving simulator
2022-04-27 14:28:58 +02:00
scribam 15ca7e82bd ci: fix java-version for actions/setup-java 2022-04-26 10:14:58 +02:00
Flyinghead 3b81bbcae5 naomi2: gmp diffuse/specular flags select vertex or model colors only
These flags shouldn't be used to disable diffuse/specular shading
Fixes road surface glitches in initdv3e (Usui map)
2022-04-21 13:55:09 +02:00
Flyinghead 902fc2cbe8 naomi: override Region settings if current region BIOS isn't found 2022-04-20 14:16:15 +02:00
Flyinghead 50f5dabf4a naomi2: use diffuse/specular color before light routing
fixes lion's jacket color and shun's face glitch (vf4)
2022-04-20 14:13:42 +02:00
scribam aa6c9e2106 msvc: fix linking issues in debug build 2022-04-17 13:24:37 +02:00
scribam 919fdb3594 ci: add distribution input to actions/setup-java@v3 2022-04-17 13:24:11 +02:00
Flyinghead c625cc68bf lr: increase vk descSet pool size. Insert card binding
vk: Use same descriptor set pool sizes for standalone and core
lr: bind "Insert Card" to L button (Naomi button 6)
lr: reset input descriptors when loading a new game
lr: don't reset maple devices in arcade mode: reloading eeprom cancels game settings
2022-04-17 13:23:16 +02:00
flyinghead d732140bf9 Merge pull request #595 from flyinghead/dev
Naomi 2 support
2022-04-16 14:24:49 +02:00
Flyinghead db525bd5db android: fix touchscreen on Retroid Pocket 2+
Unexpected event source for touchscreen events
2022-04-15 18:06:15 +02:00
Flyinghead 039c666247 more types.h clean up. better aica handler templates 2022-04-15 17:03:49 +02:00
Flyinghead ed5c24c281 arm64 build fix 2022-04-15 11:17:22 +02:00
Flyinghead f2f4010203 clean up types.h, refactoring 2022-04-14 11:34:45 +02:00
Flyinghead a9e261d280 simplify TA parsing 2022-04-13 20:36:52 +02:00
Flyinghead a710674cd4 gui: init once. reset ui driver when needed. android 120+ Hz support
ImGui is now initialized once at startup and shutdown before
terminating. graphics initialization is independent.
Move more imgui stuff into imgui drivers.
switch: set scaling on external screen to 1.4, same as xbox
UI scaling refactoring.
2022-04-13 18:06:19 +02:00
Flyinghead ddfc00ed9f Merge remote-tracking branch 'origin/master' into dev 2022-04-13 16:29:41 +02:00
Flyinghead ac71970561 don't save built-in cheats (vf4 dimm check) 2022-04-13 13:10:56 +02:00
Flyinghead fd50529d86 gl: (lr) black screen when vmu display is on
need to call glBindVertexArray(0) to avoid VAO being modified by the
frontend
2022-04-12 18:23:09 +02:00
Flyinghead 52d95e537c lr ci: disable switch build 2022-04-11 15:56:43 +02:00
Flyinghead 15b21fff2b vk: don't use anisotropic with nearest. Use linear mipmap filter
Issue #580
2022-04-11 13:35:48 +02:00
scribam f46bccfecd cmake: reunified dx9 files 2022-04-10 11:28:09 +02:00
Flyinghead 1f55973f72 libretro ci: add switch build 2022-04-10 11:27:37 +02:00
scribam 3d5fd61285 macos: fix size for image icons 2022-04-09 12:06:17 +02:00
scribam 069b501ca3 android: update android gradle plugin to version 7.1.3 2022-04-09 12:05:22 +02:00
flyinghead d035af7ff0 xbox: low resolution (640x480) with recent firmware
Device ids for xbox series s/x returned from
GetGamingDeviceModelInformation() have changed
2022-04-09 12:04:51 +02:00
scribam 20302cd378 cmake: add XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER 2022-04-07 23:09:08 +02:00
scribam 959685e260 ci: use xcode for macos 2022-04-06 14:54:28 +02:00
Flyinghead e0058c17ff lr: don't terminate emu on deinit. gl4: buffer wasn't released on term()
shared libraries containing gnuc unique symbols are never unloaded on
linux, and possibly other platforms. So don't terminate the emulator on
deinit and init it only once.
Issue #566

gl4: buffer not released on term() was causing crashes or black screen when restarted.
2022-04-05 14:53:47 +02:00
Flyinghead bf61f5cfe8 Merge remote-tracking branch 'origin/master' into dev 2022-04-04 12:11:10 +02:00
Flyinghead 8dcc25e1a9 ta: default base/offset color is white, not black
fixes black players in NHL 2K
2022-04-04 11:47:11 +02:00
Flyinghead a428167dc6 naomi network: alienfnt startup crash if not connected 2022-04-04 11:43:54 +02:00
Flyinghead e46d819c46 aws needs bash shell 2022-04-04 11:41:28 +02:00
Flyinghead 48e3a3eb68 aica: double arm clock speed
actual aica arm clock seems to be 22.5792 MHz, which means 512 cycles
per sample at 44.1 KHz (from 256)
fixes vf4 audio hiccup in character selection screen
2022-04-03 20:53:44 +02:00
Flyinghead a635fb3f77 test automation build fix, better exit 2022-04-03 20:46:50 +02:00
scribam 274f2fe10d ci: add ninja, update actions and ccache support 2022-04-03 15:38:49 +02:00
Flyinghead 320f679038 win32 build fix 2022-04-02 16:59:57 +02:00
Flyinghead 94c20ba29f elan: reset TA parser before loading state 2022-04-02 16:43:15 +02:00
Flyinghead 8baebcfb5b maxspeed networking. Store aw force feedback value 2022-04-02 16:41:52 +02:00
flyinghead 2c96d49cf2 dx9, dx11: support for forced point/linear tex sampling and anisotropy 2022-04-02 11:18:48 +02:00
Hugo Locurcio a9cabdc342 Add texture filter override setting, expose anisotropic filtering
The new texture filter option can be set to:

- Default (keeps the game's intended filter mode).
- Force Nearest-Neighbor (crisper appearance).
- Force Linear (smoother appearance).

Additionally, mipmapping can now be enabled on nearest neighbor-filtered
textures (which is used if nearest-neighbor filtering is enabled, including
with anisotropic filtering).

Anisotropic filtering was already implemented in both OpenGL and Vulkan,
but it was not exposed in the GUI.
2022-04-01 16:00:41 +02:00
Hugo Locurcio 90a95b4688 Add 6×, 7×, 8× and 9× options for internal resolution
This can be used to get a smoother image (supersampling) on
1440p and 4K displays. The 9× setting is also suited for native
resolution rendering on 8K displays.
2022-04-01 16:00:28 +02:00
flyinghead 7fcce4a59b naomi network: ignore WSAECONNRESET. Longer timeout for client 2022-03-30 15:48:23 +02:00
Flyinghead 554ffcd08f naomi: use platform-independent network error codes (win32) 2022-03-30 14:13:02 +02:00
scribam 0c46ea13c7 ci: use windows-latest 2022-03-27 18:14:38 +02:00
Flyinghead af0574c04e build fixes for msvc, ios and android 2022-03-27 15:57:01 +02:00
Flyinghead 6c38295d62 new naomi network protocol. vblank event. initd rumble support
new vblank event, used by cheats, lua and naomi net
new udp net protocol for naomi. rx/tx on vblank on emu thread.
input: rumble power configurable (Issue #158)
ui: rumble intensity slider, enable/disable upnp
aica: hook to consume midi out
decode midi out to simulate rumble for initd
upnp can now be disabled
2022-03-27 15:23:21 +02:00
Flyinghead 1e01dbb151 wrong line padding value when copying RTT to vram due to previous commit 2022-03-26 20:51:07 +01:00
Flyinghead be270259ee crash with RTT and copy to VRAM if width > linestride
RTT texture width must not exceed FB_W_LINESTRIDE
fixes Flag to flag crash
2022-03-25 15:41:16 +01:00
Nikos Chantziaras 03f9955f8b libretro: present frames before audio upload
retro_audio_sample_batch_t can block for a long time if the frontend
performs audio sync. This unnecessarily delays frame presentation.
2022-03-23 21:30:03 +01:00
Flyinghead 55e613fae5 widescreen cheats for gun spike, initdv3e, alpilotj, monkey ball
Courtesy of Esppiral
2022-03-21 17:51:31 +01:00
Flyinghead a5bad2b9b7 more naomi widescreen cheats. Fix vathlete 4-player mode
widescreen cheats for asndynmt, doa2m, slashout, spikers battle,
18wheeler, beach spikers. Courtesy of Esppiral
vathlete needs 2 I/O boards for 4-player mode
2022-03-20 17:49:50 +01:00
Flyinghead ebb251d8cf widescreen cheat for vf4tuned
Courtesy of Esppiral
2022-03-19 11:30:45 +01:00
Flyinghead 56768f2d3d naomi2: use TA parser. Use N2light directly with vk, dx11
Use TA parser to handle list type and clipping for Naomi 2 polys.
Pass all pass-throuch TA data to TA parser but stop on naomi2 command.
Set default projection matrix instead of identity (fixes Area conquered
screen invisible in initd).
Change N2Light and N2LightModel so they are usable in GLSL (vulkan) and
HLSL (dx11).
TA parser throws exception for unhandled param.
ta_vtx.cpp refactoring.
Support for subtractive lights (diffuse+specular). Used in some clubk
circuits.
Fix vulkan crash when direct FB render.
2022-03-16 17:28:45 +01:00
Flyinghead 5b3d36e081 naomi2: network support for clubk and initd
clubk: don't reverse handle by default
hotd2 doesn't have a proper game id or standard eeprom
2022-03-15 19:44:24 +01:00
Flyinghead ad08590197 vulkan: cache per-poly desc sets in map
avoid desc set pool exhaustion in per-triangle
2022-03-13 11:39:30 +01:00
Flyinghead 53b5588bda Merge remote-tracking branch 'origin/master' into dev 2022-03-13 11:01:27 +01:00
Flyinghead 1015a8c098 naomi2: vulkan support
oit: use #define instead of functions in GLSL
2022-03-12 17:56:46 +01:00
Flyinghead 27ddc215cc naomi2: boost lights by constant factor. simplify shaders 2022-03-08 17:38:29 +01:00
Flyinghead c11a6cd432 naomi2: partial gles2 compatibility
Issue #553
2022-03-07 20:32:08 +01:00
Flyinghead 514eedbc63 maple: do not raise maple_dma interrupt for light gun
Issue #474 (Virtua Cop 2 momentarily freezes when shot fired)
2022-03-07 19:16:49 +01:00
Flyinghead 1f61f80c92 input: fix naomi rotary encoders
Games with multiple JVS input boards poll inputs more than once,
ignoring some relative mouse movements.

Issue #557
2022-03-06 17:57:16 +01:00
scribam 830ffd0559 deps/picotcp: pico_ipv6_source_dev_find requires PICO_SUPPORT_IPV6
Backport https://github.com/virtualsquare/picotcp/commit/529074aab4f53a87426673548d6793ced666b6ed
2022-02-28 07:24:50 +01:00
scribam ed066df469 deps: update miniupnpc 2022-02-28 07:24:36 +01:00
scribam e6676c7d09 android: update gradle 2022-02-27 08:33:44 +01:00
scribam 33115a39a3 android: use latest cmake from android studio 2022-02-27 08:33:44 +01:00
Flyinghead 6538360fe1 switch: use devkita64:20220128 instead of latest
fixes peformance issue
2022-02-26 08:14:10 +01:00
Flyinghead 3a62e432da switch: revert a92c2899c8
back to .obj instead of .o
2022-02-25 18:35:58 +01:00
Flyinghead 9c3f60c26c CI: windows-2019 for windows. devkita64:20220128 for switch 2022-02-25 18:30:28 +01:00
Flyinghead ed0e5b8c5a remaining references to windows-latest -> windows-2019 2022-02-25 17:47:47 +01:00
Flyinghead c75d94bd90 use windows-2019 for windows builds 2022-02-25 17:36:13 +01:00
Depal1 a8d6374d76 Add installation on MacOS via Homebrew 2022-02-25 17:18:35 +01:00
cmitu 4b10402c5b Disable stencil usage on low end VC4 devices (Pi3)
Make the libretro core boot again when using the legacy VC4 GLES drivers.
Based on https://github.com/libretro/flycast/commit/ee9cd16f

Fixes: https://github.com/flyinghead/flycast/issues/539
2022-02-24 07:17:48 +01:00
Flyinghead e5863920c4 naomi2: fix beach spiker crash
VUR vertices can also have environment mapping
2022-02-22 08:48:51 +01:00
Flyinghead 7f61b44d42 imgui: better drag scrolling code 2022-02-21 19:48:52 +01:00
Flyinghead a5660fa2b4 missing changes from previous commit 2022-02-18 17:40:00 +01:00
Flyinghead ecc03e3ebc naomi: use boot rom id to configure eeprom
Make eeprom from scratch if it doesn't exist based on boot id info.
Override eeprom settings to make game happy
Change region to supported one
Get rid of per-rom region info in rom list
New option to configure Naomi games in free play
2022-02-18 17:35:20 +01:00
Flyinghead a92c2899c8 switch build: cmake is now producing .o instead of .obj 2022-02-18 16:42:05 +01:00
Flyinghead af4638e83f naomi2: fix another initdv2 end of race crash 2022-02-18 16:40:26 +01:00
Flyinghead cecf1a5497 naomi2: fix initdv2 end of race crash 2022-02-17 18:31:20 +01:00
Flyinghead f2374982b8 pvr: don't merge polys with != palette. 2nd pass sometimes ignored
polys with different palette index shouldn't be merged.
If a pass isn't using any opaque, it can't be found. Fall back to using
the transparent or punch-through list in this case.
2022-02-17 18:30:29 +01:00
Flyinghead d736dd027d naomi2: initd card support. lua: fix multi-threading crash
initial d card reader support. insert card button.
lua: use mutex to enforce thread-safety
2022-02-16 19:02:04 +01:00
Flyinghead 214db9e0b1 gl4: depth pass need texture and UV for punch-through polys 2022-02-15 17:18:32 +01:00
Flyinghead 3bbc89afc9 dx11: fix crash with modvols 2022-02-15 17:16:45 +01:00
Flyinghead e35ccbbb18 naomi2: force region for some roms. elan clean up 2022-02-15 17:15:44 +01:00
Flyinghead 20571c5aa1 chd: MIL-CD support
Issue #529
2022-02-15 11:34:11 +01:00
Flyinghead 3872a6b475 libretro: support VMU and lightgun crosshair with dx11 OIT renderer
OIT support was missing
Issue #525
2022-02-15 11:06:51 +01:00
Flyinghead 083a1c85a8 gl: shader compile error on shield tablet
Don't use GL_NV_shader_noperspective_interpolation since it's not really
needed (and wasn't enabled)

Issue #510
2022-02-14 18:54:27 +01:00
Flyinghead 943e0285ac libretro: support VMU and lightgun crosshair with dx11 renderer
Issue #525
2022-02-14 18:47:23 +01:00
Flyinghead d7abfc688c dx11: oit depth pass needs the palette for PT polygons
Punch-through polys may use a palette, which is needed for alpha testing
Issue #467
2022-02-14 18:41:38 +01:00
Flyinghead 8f01ef90cf gl,dx9,dx11: only render frame when Renderer::present() has been called
Issue #511
2022-02-14 18:38:58 +01:00
flyinghead 8d071bf4ea naomi2: dx11 support. fix ambient color. no depth write in per-strip
dx11: naomi2 support
n2: ambient color was swapping red and blue
gl, dx11: don't write depth in per-strip to avoid missing geometry,
prefer wrong depth order/blending for now
optimize naomi2 per-triangle sorting
2022-02-13 21:01:45 +01:00
github-actions[bot] 3929fe64a3 Fetch translations & Recreate libretro_core_options_intl.h 2022-02-11 22:20:12 +00:00
Flyinghead a14086d484 naomi2: shader error in gles. Invert clubkart wheel axis 2022-02-11 19:06:58 +01:00
Flyinghead 20d25059bf naomi2: remove geom shader. Merge transparent polys. bump mapping fix.
elan: Get rid of geometry shader and do geometry clipping manually.
pvr: Aggressively merge transparent polys in per-triangl and OIT mode, duplicating the last vertex to merge opposite cull mode strips.
gl4: reset OIT pointers in final shader. No need for clear pass.
gl4: alternate between 2 buffers for verts.index/tr poly params.
gl4: use gl_VertexID + poly number for poly index.
gl: new GlBuffer class.
2022-02-11 15:54:18 +01:00
Flyinghead ccee7162bc naomi2: soulsurfer inputs, 2-volume UV, wrong TA parser selected
TAParserDX was used for pass-through TA data. Fixes health bar color in
vf4 and dust color in kingrt66.
2-volume missing u1/v1. Fixes clubk shadows.
2022-02-08 10:32:56 +01:00
Flyinghead 4fe8e40569 libretro: fix texupscale and max upscaled texture size settings value 2022-02-06 20:42:41 +01:00
Flyinghead b91b3d5da6 libretro: use correct #ifdef for omp support
enables xBRZ upscaling
2022-02-06 17:52:30 +01:00
Flyinghead debbae6ab1 naomi2: elan v10 emulation. texture dma xfers. 2-volume support
emulate elan v10 (fixes modvol in vf4, initd, beachspiker, wldrider)
wrong color order for model and vtx color
model param override xor support
improved light direction precision. Angle attenuation algo change
get rid of alpha light and modifier volume hacks
texture dma xfer from main and elan ram
gl4: use geometry only vtx and geom shaders for depth pass
2-volume support
2022-02-05 14:50:12 +01:00
Flyinghead 2c6f01ae38 naomi2: kingrt66 wiper button. initd gear up/down
kingrt66: map wiper button, remap shift H and R
initd: map gear up and down
wldrider: remap push and pull
2022-02-05 14:29:01 +01:00
github-actions[bot] 92f81fa054 Fetch translations & Recreate libretro_core_options_intl.h 2022-02-04 22:19:01 +00:00
Flyinghead 0362fd1079 naomi2: disable elan when net rollbacking, optimizations. ggpo: RTT fix
n2: do not process elan commands during ggpo rollbacks.
n2: Cache model colors to avoid unpacking for each vtx
pvr: merge equivalent polys with different culling by duping a vtx
pvr: fix crash during direct FB render
pvr: use correct color ordering for naomi2. Use identify matrix for null matrix pointers
ggpo: do not signal end of frame on a render to texture
2022-02-01 17:37:54 +01:00
Flyinghead 38765dc89a pvr: fix multipass. naomi2: constant color shading.
pvr: link multipass TA contexts. Each pass has its own.
pvr: get rid of context pool
naomi2: constant color shading. Use model diffuse and specular
selection. Don't use vtx color for offset color.
naomi2: pseudo-parallel lights fix
naomi2: pass-through TA data needs forced list type. Terminate with
end-of-list
enable RTT copy to vram for Beach Spikers
2022-01-31 20:40:09 +01:00
Flyinghead 78306b3c12 ggpo: memory leak in free_buffer 2022-01-30 12:39:00 +01:00
Flyinghead e51a291195 ggpo: wrong elan ram offset calculation 2022-01-30 12:39:00 +01:00
flyinghead d551848a9b dummy commit 2022-01-29 19:39:08 +01:00
Flyinghead fe6247dded cheats: iOS build fix 2022-01-29 18:40:19 +01:00
Flyinghead 5fb8b458bb pvr: use TA_OL_BASE instead of PARAM_BASE/TA_ISP_BASE to id TA context
Writes current TA_OL_BASE to all tiles OPB block. Read from region array
at render time to identify context.
Fixes vf4 water reflections RTT
get rid of dump_frame/read_frame
2022-01-29 18:39:38 +01:00
Flyinghead 4e21391f8c ggpo: memory leak in free_buffer 2022-01-29 16:58:28 +01:00
github-actions[bot] 9ab4bb963f Fetch translations & Recreate libretro_core_options_intl.h 2022-01-28 22:20:29 +00:00
Flyinghead 340c55c570 build fix 2022-01-28 22:30:07 +01:00
Flyinghead de1322b928 naomi2: Fix T&L matrix. vmem elan ram support.
Fix T&L matrix (wild riders)
Open GL support for normal/light matrix
handle elan RAM in vmem
2022-01-28 21:24:30 +01:00
Flyinghead 010d257b69 naomi2: vf4tuned cheat/hack to skip DIMM fw version check 2022-01-28 20:02:07 +01:00
Flyinghead 58f05f74cf jvs: set received jvs message trail to zero
fixes sh4 crash during naomi boot
2022-01-28 11:31:30 +01:00
Flyinghead e5d517dad2 use platform.isConsole(), platform.isNaomi(), ... 2022-01-27 17:52:19 +01:00
Flyinghead 965dea5fe6 test fix 2022-01-27 16:44:37 +01:00
Flyinghead 1ffcc75031 naomi2: implement SB_ISTNRM for clxb. serialize elan state 2022-01-27 16:40:12 +01:00
Flyinghead e084cc9a3a jvs: set received jvs message trail to zero
fixes sh4 crash during naomi boot
2022-01-27 15:50:44 +01:00
Flyinghead 6ed78d1202 another GL_CLIP_DISTANCE0 build fix 2022-01-26 22:37:38 +01:00
Flyinghead 270eaa1452 GL_CLIP_DISTANCE1 undefined 2022-01-26 22:19:53 +01:00
Flyinghead e1038ea632 naomi2: fix regressions. 2-volume and bump mapping support WIP
optimize open gl uniforms
2022-01-26 22:15:10 +01:00
Flyinghead 8947100701 libretro: missing new param to gl4GetProgram 2022-01-25 15:43:30 +01:00
Flyinghead cb99e7d920 naomi2: do T&L on the gpu. bypass TA format. env mapping.
fix model/instance/matrix parsing
handle culling reversed model flag
geometry shader for near plane clipping
2022-01-25 15:37:04 +01:00
DisasterMo a4b0a69c45 Enable Indonesian, Swedish and Ukrainian localisations 2022-01-22 19:18:41 +01:00
github-actions[bot] 2a364910c0 Fetch translations & Recreate libretro_core_options_intl.h 2022-01-21 22:20:49 +00:00
Flyinghead 45ba648622 dx11: VersionHelpers.h -> versionhelpers.h
the mingw version is all lowercase
2022-01-19 14:37:49 +01:00
Flyinghead dcd48f4264 ios: on-screen keyboard support 2022-01-19 13:48:16 +01:00
Flyinghead b048921c11 naomi2: fix clipping, parallel light direction, reset state on loadstate 2022-01-18 18:25:40 +01:00
Edward Li 8ee9f1b1d9 Cleanup macOS screen DPI calculation (included in SDL 2.0.20 now) 2022-01-18 11:58:57 +01:00
Edward Li f2c39e4004 Update SDL to 2.0.20 2022-01-18 11:58:57 +01:00
Flyinghead 4335aa563f naomi2 WIP 2022-01-16 22:41:42 +01:00
Flyinghead 62ec3546d6 dx11: uwp doesn't need texture conversions 2022-01-16 10:37:55 +01:00
Flyinghead 8bb0bd05f9 ui: limit scaling further on small low-resolution screens (retroid) 2022-01-16 09:58:33 +01:00
Flyinghead e538242962 dx11: convert 16-bit textures to 32 bits on windows7
1555, 4444 and 565 aren't supported on win7
Issue: https://github.com/libretro/flycast/issues/1123
2022-01-16 09:54:39 +01:00
github-actions[bot] d70d2ad405 Fetch translations & Recreate libretro_core_options_intl.h 2022-01-14 22:21:28 +00:00
Julien Reichardt 4f638f6d77 Use service button instead of coin
The service button can also be used to add coins.
2022-01-11 14:09:54 +01:00
Julien Reichardt 80d78705b0 Add default coin mapping 2022-01-10 12:13:14 +01:00
github-actions[bot] 140cec7c59 Fetch translations & Recreate libretro_core_options_intl.h 2022-01-07 22:20:58 +00:00
scribam 746b3c5a54 sdl: fix joystick rumble 2022-01-06 08:59:39 +01:00
Flyinghead a4788b5b24 zero-init sh4 context when no vmem is available
Issue #439
2022-01-03 18:44:47 +01:00
cmitu 8dcf0f58b5 postprocess: fix GLES2-only build
Added a missing `ifndef` guard for `glBindVertexArray`, useful for GLES2-only builds.
2022-01-02 10:51:03 +01:00
Julien Reichardt a8080c5db3 Fix missing libSDL2.a static library on Linux 2022-01-01 18:29:46 +01:00
github-actions[bot] a52977d1cf Fetch translations & Recreate libretro_core_options_intl.h 2021-12-31 22:20:45 +00:00
Edward Li 0bb6fed822 Remove junk folder when packaging macOS app 2021-12-26 23:20:58 +01:00
Flyinghead d86305a7c3 android: on-screen gamepad not editable in Open GL
Swap wasn't called during editing
Issue #464
2021-12-26 16:03:19 +01:00
Edward Li 5aeef17d09 macOS: Enable "New Instance" in File and Dock menu for SDL 2021-12-25 21:46:19 +01:00
Flyinghead 2d41d993e3 macOS: patch SDL to compile in metal and vulkan
https://github.com/libsdl-org/SDL/issues/5010
2021-12-25 21:45:13 +01:00
github-actions[bot] 503cc7ea97 Fetch translations & Recreate libretro_core_options_intl.h 2021-12-24 22:21:05 +00:00
Flyinghead 7f41847c5c android: bigger on-screen gamepad analog handle. Update project README 2021-12-24 19:46:09 +01:00
scribam fde683a82e ci: cmake install for switch builds 2021-12-23 22:31:39 +01:00
scribam 4feff7d917 ci: add ccache for switch builds 2021-12-23 22:31:39 +01:00
asdf288 e61951a319 Fix typo in GLES2 library name 2021-12-23 22:31:25 +01:00
Flyinghead da81274eb9 lr: gl stencil param isn't obsolete but required
Issue #454
2021-12-23 22:30:44 +01:00
flyinghead 8740141a93 Merge pull request #451 from flyinghead/net-rollback
Merge net-rollback branch
2021-12-23 11:21:29 +01:00
Flyinghead 9223a2b530 readme: link to gamr13's xbox page 2021-12-22 21:41:01 +01:00
Flyinghead 300c74e3fc Merge remote-tracking branch 'origin/master' into net-rollback
# Conflicts:
#	CMakeLists.txt
#	shell/libretro/libretro.cpp
#	shell/libretro/libretro_core_options.h
2021-12-22 21:31:17 +01:00
Flyinghead 3f82c7fb6f iOS: use play and record audio session only when necessary
Change audio session to play and record when a microphone is connected.
Use a play only session otherwise. Issue #360

Hide VSync-related gui option.
2021-12-21 21:36:12 +01:00
Flyinghead 2cb7a1d96c android CI: upload to S3 after dumping symbols 2021-12-21 21:26:31 +01:00
Flyinghead 00562455e0 android CI: choose the openssl flavor of curl 2021-12-20 16:11:54 +01:00
Flyinghead bb88dcfe66 android CI: install libcurl for breakpad. Disable breakpad on macOS 2021-12-20 16:08:22 +01:00
Flyinghead 970e594009 Build with breakpad submodule. Use gcc 11 on windows. 2021-12-20 15:45:46 +01:00
Flyinghead cd5a784277 add breakpad as submodule 2021-12-20 15:23:28 +01:00
Flyinghead 771f653174 delete breakpad 2021-12-20 15:20:26 +01:00
scribam 109cb81ab7 ci: add cmake install and refactor artifact generation 2021-12-20 14:36:48 +01:00
Flyinghead bf87f7ba84 Compilation error on armv7 with gcc 9 2021-12-20 14:27:19 +01:00
scribam 92b8eae2dc ci: cleanup cmake build type 2021-12-19 15:02:05 +01:00
scribam 776f86c7f2 README.md: add badge for Windows UWP CI 2021-12-19 13:29:41 +01:00
cmitu c10c3a1cfe cmake: amend 2b827e43, fix the typo for GLES3_LIBRARIES 2021-12-19 13:28:47 +01:00
scribam 94fccc5112 ci: fix ccache cache key 2021-12-19 11:18:32 +01:00
scribam 73fa0e3efc cmake/deps: update sdl to version 2.0.18 2021-12-19 11:18:24 +01:00
cmitu 2b827e43d7 cmake: add more GLES3 library names
Some systems provide the GLES3 implementation in the same GLESv2 library file, most notably Mesa.
Added the alternative library name when GLES3 is requested.

This makes the build work on the Pi4 - I've only tested it with the libretro core and the GLES 3.1 context is succesfully used.
2021-12-19 10:56:32 +01:00
cmitu e706368225 cmake: add support for legacy RPI GLES2 libs
Raspberry Pi 3 can use the legacy Broadcom GLES2 libraries from /opt/vc/lib.
They are the default GLESv2 libraries on Raspberry PI OS 10 (Buster) and older.
2021-12-19 10:56:32 +01:00
flyinghead 2f5271ab83 yabf4 2021-12-18 13:33:42 +01:00
flyinghead 4e448b23a8 yabf3 2021-12-18 13:25:41 +01:00
flyinghead 38002d4907 yabf2 2021-12-18 13:14:04 +01:00
flyinghead fd81f9b1b4 yabf 2021-12-18 13:11:17 +01:00
flyinghead 77900f5745 ci: env var not replaced 2021-12-18 12:25:02 +01:00
flyinghead 8684aac4f2 yaml parse error 2021-12-18 12:19:09 +01:00
flyinghead b1e0bc90ba uwp: remove angle, upload to S3. windows: don't build SDL 2021-12-18 11:50:03 +01:00
scribam 8e305bfd0f android/vmem: use constant ASHMEM_NAME_DEF 2021-12-18 11:46:04 +01:00
scribam 32716e1480 android: update com.android.tools.build:gradle to version 7.0.4 2021-12-18 11:46:04 +01:00
jdgleaver 833eccb6c4 (libretro) Sanitise core options 2021-12-18 10:16:37 +01:00
github-actions[bot] f64b3618f2 Fetch translations & Recreate libretro_core_options_intl.h 2021-12-17 22:20:56 +00:00
Flyinghead 325cd9a066 DSP crash on apple M1
Issue #415
2021-12-17 13:43:45 +01:00
Flyinghead 544c711fd7 savestate: compatibility between nvmem and !nvmem savestates 2021-12-17 13:41:46 +01:00
Flyinghead e02afb34d1 dx11: wrong shadow scale factor. vk: object leak. Code duplication
dx11: shadow scale factor inverted in per-pixel
vulkan: clear deleted overlay images when terminating
Use color struct for FOG_COL_VERT, FOG_COL_RAM, FOG_CLAMP_MIN,
FOG_CLAMP_MAX and VO_BORDER_COL. Avoid code duplication in renderers.
2021-12-17 13:40:42 +01:00
Flyinghead dc5acd24b2 Merge remote-tracking branch 'origin/master' into net-rollback 2021-12-17 12:40:37 +01:00
Flyinghead 7555263e38 wrungpo had wrong decryption key
Issue https://github.com/libretro/flycast/issues/1108
2021-12-17 11:55:17 +01:00
Flyinghead 71d016722e vulkan: fix various validation errors
oit: skip to new frame even if previous frame was never presented
libretro: quad pipeline used for overlay must use subpass 2 in per-pixel
overlay: delay destruction of VMUs images
libretro: WaitIdle on queue instead of wait_sync_index
2021-12-16 21:26:55 +01:00
jdgleaver 96560e4914 (libretro) Move audio batch callback onto main thread + improve audio sample pacing 2021-12-16 18:21:08 +01:00
Flyinghead 04be40767b android: fallback to /dev/ashmem if ASharedMemory fails. More logs
Issue #439
2021-12-15 23:09:59 +01:00
Flyinghead 5a6197cfc6 libretro: never request a GLES3 context
RA doesn't give us the opportunity to retry if GLES3 isn't supported.
Issue #405
2021-12-15 21:23:35 +01:00
flyinghead 5fca12af49 msvc compilation warnings 2021-12-15 17:58:58 +01:00
flyinghead 853830a446 log errno when failing to open a disk or folder. Better win32 errors
Log errno when failing to open a disk or folder (game scanner)
Better win32 error codes with GetLastError() for opendir, stat, access
2021-12-15 17:55:42 +01:00
flyinghead 2f47f72957 dx11: recreate texture if dimensions or format change. Clear rtt depth
Fixes a crash when switching Copy to VRam on as the RTT texture is no
longer upscaled when updated.
Clear RTT depth/stencil before render.
2021-12-15 11:32:04 +01:00
flyinghead de35cf9840 dx11: fix fullscreen toggling
Prevent DXGI from monitoring Alt+Enter and let SDL handle it
2021-12-15 10:37:52 +01:00
flyinghead 18d8107992 dx11: no color interpolation for flat shading
Fixes Evolution WoSD
refactor setFirstProvokingVertex (dx9, dx11, vk)
Set .1 depth scale for V-Rallye to fix missing background image in menus
(dx11, dx9)
2021-12-15 09:37:58 +01:00
flyinghead 2478b72a3e lr dx11: fix exit crash. Save shader cache where vk cache is 2021-12-14 16:48:23 +01:00
flyinghead 4d60150345 libretro: dx11 crash in single-threaded. Use compiler and feature level
libretro: Null first frame erroneously set as valid causing a crash with dx11 (single-threaded rendering)
libretro: pass dx11 compiler pointer to shaders
dx11: use feature level to check if per-pixel is supported
2021-12-14 10:41:04 +01:00
flyinghead 6a3a8d5578 libretro: dx11 support. dx11 shader cache. dx9 clipping planes
dx11: use 32-bit float depth texture to avoid loss of precision (SA2 into logo)
dx11: cache shader blobs to disk if not provided by OS
dx11: swap interval depends on screen refresh rate (1 for 60 Hz, 2 for 120 Hz, ...)
dx9: use clipping planes to avoid interpolation errors in rasterizer (daytona, mermaid lake)
directsound: use comptr
gui: fix navigation issue with OptionArrowButtons due to missing id
2021-12-13 21:02:44 +01:00
scribam 08828991e7 dx11: msvc x86 build fix 2021-12-12 18:43:36 +01:00
flyinghead 4c14a96888 vk, gl4: out of bound array index when sorting pixels 2021-12-12 18:42:50 +01:00
flyinghead 0478ec9696 dx11: per-pixel renderer 2021-12-11 18:53:35 +01:00
flyinghead 46044c068b cheats: don't rely on cheat count on load. Fix compile warnings 2021-12-11 18:33:28 +01:00
github-actions[bot] c6fe6b83ac Fetch translations & Recreate libretro_core_options_intl.h 2021-12-10 22:20:46 +00:00
flyinghead cc39d4dd7d vmem: close shared mem file descriptor when terminating
Tentative fix for Issue #439
2021-12-10 14:04:45 +01:00
flyinghead b79c049bd4 dx11: wrong shader hash calculation 2021-12-09 09:26:36 +01:00
flyinghead 4cbf19c97e libretro: nvmem not saved when rom path mixes slash and backslash
Issue https://github.com/libretro/flycast/issues/1114
2021-12-07 17:15:35 +01:00
flyinghead 27041cbf59 dx11: better clipping algo. modvol cull mode. win: exception code
dx11: use faster clipping algorithm for modifier volumes
dx11: modifier volumes need cull mode. Fixes Daytona shadows.
win: the fault handler was treating some software exceptions as fatal (msvc)
uwp: remove async hacks and disable MS task wait exception. Fixes error reporting when loading a game.
2021-12-06 17:43:22 +01:00
IlDucci 8e2c72ed1b [Core options text] Typo fixes and minor style changes
- Changes the main category sublabels to match RetroArch's style.
 - Adds a missing period, as reported in Crowdin.
 - Adds an extra minor description to the Language setting.
2021-12-05 12:23:35 +01:00
flyinghead 7820c9bc44 dx9/11: fix rtt2vram crash. dx11: modvol fix and more
dx11: clip modvol triangles before sending them to the gpu
dx9,11: wrong source pointer for rtt to vram
dx11: handle source RowPitch when copy rtt to vram
dx11: crash at reinit
dx11: wrong scissor with direct fb rendering
dx11: blend ops are different for the alpha channel

Fix mingw CI build
2021-12-04 19:16:11 +01:00
github-actions[bot] 92fff9acf5 Fetch translations & Recreate libretro_core_options_intl.h 2021-12-03 22:21:13 +00:00
flyinghead 91da49dc52 mingw: downgrade cmake 2021-12-03 23:08:59 +01:00
flyinghead b5a45417d9 mingw: downgrade gcc to 10.3 2021-12-03 22:29:41 +01:00
Edward Li 3db4993077 Xcode project file (debug friendly) generator with predefined LLDB Init File to bypass SIGBUS error 2021-12-03 15:49:47 +01:00
Edward Li bc1a5fdd8d Make LLDB ignore EXC_BAD_ACCESS for debugging 2021-12-03 15:49:47 +01:00
flyinghead 191f1c38df dx11: scissoring fix. 4K UI scaling
Clearing of side columns in 4:3 uses the quad drawer so it needs to be
called early. Border color was wrong. Fixes GTA2.
Scale UI x2 in 4K mode.
2021-12-03 15:48:42 +01:00
flyinghead adb61259c1 mingw ci: enable dump_syms ouput 2021-12-02 17:20:56 +01:00
DisasterMo ddc2e84e45 Add automatic Crowdin synchronization 2021-12-01 21:28:51 +01:00
flyinghead a050a61f2e ci: install dx9 sdk for mingw 2021-12-01 21:28:21 +01:00
flyinghead 99195c3f4c dx11: set clip planes on X and Y. rend: Force palette update at init
dx11: Set clip planes at X -1/1 and Y -1/1 to avoid rasterizer errors.
Fixes Daytona Mermaid lake depth issues
dx11: fix texture wrap around at UV 1 with nearest filtering
dx9: inside clipping
all renderers: force full palette update at init
2021-12-01 14:54:03 +01:00
flyinghead 280c159078 uwp: fix dirent. Implement access() and stat()
Use UWP version of FindFirstFileEx
Implement basic access() and stat()
Add home dir to list of drives
Allow external storage folders to be added and scanned for games
2021-12-01 14:40:17 +01:00
flyinghead 6a8f1b941e dx11: overlay support. inside clipping. 4K support on xbox. log fix
dx11: support for vmu and lightgun crosshair overlays
dx11: implement inside clipping (fixes 18 wheeler rear view mirror)
dx11: tentative 4K support on xbox
iOS,uwp: save log file in home (iOS)/data(uwp) directory
uwp: don't sign app on pull requests
2021-11-29 18:22:25 +01:00
scribam 8a6ce19e1e input: cleanup virtual function specifier 2021-11-29 18:19:22 +01:00
flyinghead d071adea9a dx11: fix modifier volumes, rotation. sdl: on-screen keyboard support
dx11: Back face stencil ops need to be set
dx11: Rotate CCW instead of CW
dx11: Present with NO_WAIT when fast forwarding
sdl: support for on-screen keyboard. Delay keys up by one frame to allow quick key presses.
ui: better fix to wait for future on UWP
2021-11-28 16:19:03 +01:00
flyinghead 3d7455316f linux build fix 2021-11-27 14:39:28 +01:00
scribam 3f50baa318 picotcp: fix alloca on freebsd 2021-11-27 14:32:04 +01:00
scribam 8164c96379 deps: update libchdr and remove patch 2021-11-27 14:31:22 +01:00
flyinghead 4ab3f01867 uwp: external storage support. enable picotcp 2021-11-27 14:30:36 +01:00
flyinghead dbb277f749 Potential crash when starting game with non-default renderer
Renderer is switched to default and back to the selected one during
reset on the emu thread. The render thread may pick up this change.
2021-11-27 14:13:24 +01:00
flyinghead 0579f2ede6 7z: use fopen on all platforms 2021-11-27 14:08:07 +01:00
orbea ef3af9aad3 cmake: Add an install target (#421)
Don't install glslang or xbyak
2021-11-27 10:42:09 +01:00
flyinghead d5694036fa libretro: don't crash if frontend doesn't implement
RETRO_ENVIRONMENT_GET_CLEAR_ALL_THREAD_WAITS_CB

Issue #418
2021-11-27 10:41:11 +01:00
flyinghead f91847dad0 DX11 renderer WIP 2021-11-26 18:08:41 +01:00
flyinghead c4eaa973f0 picotcp: use strcasecmp 2021-11-24 14:17:00 +01:00
flyinghead 42fa77c81f uwp: the back button (B) shouldn't close the app 2021-11-24 13:42:25 +01:00
flyinghead e4bfeb9e44 picotcp: MSVC support 2021-11-24 13:41:04 +01:00
cglmrfreeman 67f2162fb3 Fix linux breakpad issues when glibc-2.34 is installed
As outlined by [Samuli Piippo in the qtwebengine chromium patch](https://codereview.qt-project.org/c/yocto/meta-qt6/+/378728/2/recipes-qt/qt6/qtwebengine/chromium/0004-breakpad-fix-build-with-glibc-2.34.patch), SIGSTCKZ is no longer being compile time constant in glibc-2.34. The proposed fix compiles on my end and I have not tested on a linux distro with an earlier version of glibc.
2021-11-23 20:23:28 +01:00
flyinghead 465499f6c3 libretro: don't set preferred GLES version when initializing context
Issue #405
2021-11-22 15:28:18 +01:00
flyinghead ea75311a34 uwp: yml typo 2021-11-21 15:34:01 +01:00
flyinghead 33fd8a9ec7 uwp: sign appx package 2021-11-21 15:18:55 +01:00
BornPosthumous 417ffc09f8 Allows override of flycast.lua file (#411) 2021-11-21 15:16:11 +01:00
flyinghead 1057f50f86 uwp CI fix 2021-11-20 19:13:55 +01:00
flyinghead 5b933cde61 uwp: use ccache for CI. gui_util.h typo 2021-11-20 18:24:21 +01:00
flyinghead 47442d1bc9 fix libchdr patch 2021-11-20 17:32:12 +01:00
flyinghead f25c83e006 uwp CI fix 2021-11-20 16:21:27 +01:00
flyinghead bc34024e32 uwp: fix crash when opening menu/canceling load. CI job 2021-11-20 16:18:27 +01:00
flyinghead 628bef9094 libretro: don't set minimum GLES version when initializing context
Issue #405
2021-11-20 14:14:19 +01:00
flyinghead 63598019e1 naomi: rename deathcox to deathcoxj, new deathcox parent rom
MAMESET 0.227 changes
Issue #409
2021-11-20 14:06:19 +01:00
flyinghead 501244ed25 x64 rec: incorrect stack alignment of memory handlers on windows 2021-11-20 12:29:07 +01:00
flyinghead e12912450c missing changes 2021-11-19 23:29:35 +01:00
flyinghead 8262c9ece7 UWP support - WIP 2021-11-19 23:18:45 +01:00
Flyinghead cc208ce451 libretro: arm32 android build must use arm mode, not thumb
Issue #405
2021-11-16 16:46:28 +01:00
scribam c6374a899c win32: build fix when sdl2 is not enabled 2021-11-14 22:56:43 +01:00
Flyinghead 8f80bcb159 New serialize framework. Delay maple dma xfer
New serialize framework. Refactor serialization into modules.
Maple dma xfer must not be executed immediately. Delay until interrupt
is raised.
Fixes Geist Force freeze at start.
2021-11-13 15:56:42 +01:00
Flyinghead e56ecfec40 vk,dx9: black screen/crash in single-threaded on direct fb access
When rendering happens after the render timeout (initial sega copyright
screen and more), the frame is never swapped and never displayed. Causes
a crash in vk since the acquired swapchain image is never
presented/released.
2021-11-11 11:17:39 +01:00
Flyinghead 80cf422a5e dynarec: fix CLRS and SETS ops
Destination reg was missing
Fix crash in OpenTyrian/SDL_DREAMHAL
Issue #403
2021-11-11 10:44:22 +01:00
Flyinghead d788c310ee apple build fix 2021-11-10 21:21:25 +01:00
Flyinghead 7583db3bef vk: option to duplicate frames to simulate swap interval > 1
Issue #293
2021-11-10 20:55:22 +01:00
Flyinghead ac5abd96bb ui: imgui driver, GraphicsContext interface, dx9 swap interval
Refactor imgui backend code into imgui drivers for gl, vk, dx9
Generic GraphicsContext interface for gl/vk/dx9 contexts
Simplify graphics api switching code
dx9, gl(sdl): set swap interval based on monitor refresh rate.
2021-11-10 20:35:30 +01:00
Flyinghead aa944ac5e8 vk: fix vmu transparency in lr core 2021-11-10 18:42:11 +01:00
Flyinghead 35e1fb9ae5 cmake: change default libretro target 2021-11-10 10:17:40 +01:00
twinaphex a15863ae35 (Libretro) CI integration - and necessary fix for compiling Windows
core cross-compiled on Linux
2021-11-09 18:48:55 +01:00
Flyinghead a04fd06e38 gl: iOS doesn't like smooth. More precision needed for vertex colors 2021-11-09 10:38:41 +01:00
scribam f6cc2c7b91 ci: use msys2 only for mingw builds 2021-11-09 10:37:43 +01:00
Flyinghead 99ee526ac5 gles3 doesn't support noperspective. vk needs higher prec for color/uv/z
noperspective not supported in gles 3. Use smooth instead
Vulkan now needs higher precision for colors, UV and z (adreno 630)
2021-11-08 16:53:47 +01:00
scribam d100067e02 cmake: use AltKit default include directory for AltKit-Swift.h 2021-11-08 11:58:42 +01:00
scribam f777c62a66 android: update com.android.tools.build:gradle to version 7.0.3 2021-11-08 11:58:42 +01:00
Flyinghead 06ef0e5fdc vk,gl: use w=1 in shaders. Fix translucent modvols
Use w=1 to avoid multiply/divide of xy as in dx9
Disable rendering when video output disabled
Use original w value in pixel struct to avoid precision loss (samsptk)
vk oit: missing memory barrier was producing Tr modvol glitches (JSR)
gl oit: Tr modvol needs full vertex shader
2021-11-07 18:21:44 +01:00
Flyinghead 5209623064 cue: ignore unrecognized REM entries. parse one line at a time 2021-11-05 19:14:08 +01:00
Flyinghead 7c53413bc5 vk oit: fix depth-only Tr pass
Cosmic smash
2021-11-05 18:36:09 +01:00
Flyinghead 42f92b8dc1 ggpo lib: compile warnings, remove legacy chat 2021-11-05 18:34:23 +01:00
Flyinghead 986baccf83 lr build fix 2021-11-04 13:11:18 +01:00
Flyinghead 32d31e7644 vk: implement TranslucentPolygonDepthMask
Fixes Cosmic Smash
vma: instance is needed at init
Partial vk support for iOS
2021-11-04 09:13:47 +01:00
Flyinghead 03161446b9 can't launch BIOS after playing a game 2021-11-04 08:57:15 +01:00
Flyinghead 17bbb7f145 vk: disable small tex optimization on macOS. Fix libMoltenVK embedding
small textures linear optimization leads to texture corruption with
moltenvk.
Copy libMoltenVk to correct runtime output dir.
2021-11-02 09:44:24 +01:00
Flyinghead 71c4ec34d5 iOS build fix 2021-11-01 13:30:36 +01:00
Flyinghead da3ed74c4e vulkan: moltenvk support on macOS - WIP
sdl: save/restore window position in config
2021-11-01 13:05:22 +01:00
Flyinghead 46ae8f92cc input: per game input mapping 2021-11-01 12:39:50 +01:00
Flyinghead 9b3dec5f70 imgui: fix crash when closing chat with gamepad DPad button down
backport https://github.com/ocornut/imgui/commit/25679a411ee33272d4d047192b30af03e3a384fc
2021-10-27 12:28:31 +02:00
Flyinghead 146bfb28d1 ggpo: always use P1 input in netplay even if playing as P2
fix imgui assert
2021-10-27 12:26:17 +02:00
Flyinghead 46fb331275 look for BIOS files in Content Path folders if not found in data folder 2021-10-27 12:24:30 +02:00
Flyinghead ff39b8b252 macOS: use ~/Library/Application Support/Flycast as home directory
still use ~/.flycast or ~/.reicast if found for backward-compatibility
Issue #336
2021-10-27 12:22:24 +02:00
LaercioMBR 004250ed23 InputDescriptors for radirgyn and mamonoro 2021-10-24 14:07:40 +02:00
Flyinghead 037339f3be ggpo: savestate md5 wasn't computed 2021-10-21 12:03:04 +02:00
Flyinghead e0437ab447 msvc fix 2021-10-20 15:28:34 +02:00
Flyinghead 808a161d39 ggpo: make chat thread-safe. Deadlock on early rollback
Make ggpo_send_message() thread-safe
Deadlock UI/emu threads if rollback happens before first render
Disable rollback wait in single-thread mode
2021-10-20 14:41:18 +02:00
LaercioMBR 6d8e1794a0 Fix Metal Slug 6 inputs (#393) 2021-10-20 14:36:02 +02:00
Flyinghead 89338c0b4b win32 build fix 2021-10-19 17:24:17 +02:00
Flyinghead 7f7cbd5666 missing change 2021-10-19 17:05:00 +02:00
LaercioMBR 846ed76808 InputDescriptors for Dolphin Blue, Demolish Fist and ggx15 2021-10-19 17:02:01 +02:00
Flyinghead ab45b5ec8a ggpo: keyboard/mouse games support. Fix chat when keyboard disabled
ggpo: support for arcade games using keyboard (totd, luptype) and
mouse/rotary encoders (waiwai drive)
Chat and UI now usable when the keyboard is not set to a maple port.
2021-10-19 16:56:46 +02:00
Flyinghead db93a4c4a7 ggpo: in-game chat
use menu key to open/close chat window
disable keyboard/mouse controllers when using chat
disabled controllers can now use emu keys (menu, escape, ff)
2021-10-18 16:40:17 +02:00
Flyinghead 59566eb363 ggpo: support application messages 2021-10-18 16:26:24 +02:00
LaercioMBR 7fb85e5b25 Standardizing InputDescriptors names, added kov7sprt_inputs (#389) 2021-10-18 11:24:38 +02:00
Flyinghead c061912574 android: fix hang when mount returns too much data
Issue #387
2021-10-16 18:16:17 +02:00
Flyinghead 3eeb7e7cae build fix 2021-10-16 18:15:11 +02:00
Flyinghead cf653640b3 ggpo: verify md5 of bios, game and savestate
Verify md5 of flash, eeprom, vmus if no savestate used
Use chd header SHA1 as digest
Load .state.net state file at start

Force real BIOS for some games
2021-10-16 17:56:21 +02:00
Flyinghead 5cfd897298 android: more activity init logs 2021-10-15 13:14:42 +02:00
Flyinghead 7ecb6a6d96 ggpo: Fix udp packet size. Fix verif mismatch due to uninit'ed var 2021-10-15 13:07:21 +02:00
Flyinghead c08f177d3b libretro build fix 2021-10-14 11:51:39 +02:00
Flyinghead 1c6e722961 android: add app external & internal files dir. Race condition at start
Fix crash at startup due to race condition with game scanner
Don't allow selection of non-writable folder during onboarding
Add private internal and external Files folders to list of storage
locations to choose from
Assign first external android gamepad to port A instead of B

ui: Fix layout of controller mapping dialog when port=All
2021-10-14 11:39:27 +02:00
Flyinghead 0d49817f00 fix crash when [config]pvr.rend is invalid for the current platform 2021-10-14 10:52:35 +02:00
Flyinghead 85c21df5e7 Use allocAligned/freeAligned for all aligned allocs 2021-10-14 10:46:44 +02:00
Flyinghead f9d5b8eb74 ui: limit max scaling on small low-res screens (<= 640x480) 2021-10-12 17:34:42 +02:00
Flyinghead bcc3337c58 cheats: support for bit-level RA codes
log start of address space, RAM, VRAM, audio RAM at boot
fix add cheat dialog layout
don't crash on wrong gdrom unlock code
2021-10-12 17:28:01 +02:00
Flyinghead 163888f329 GameShark cheat codes support 2021-10-10 17:24:17 +02:00
Flyinghead 8b986dfab3 vmu beep support 2021-10-10 16:33:37 +02:00
Flyinghead 19bd6d0bca test automation clean up
less #ifdef
force mute audio
don't force vsync
2021-10-10 16:26:36 +02:00
Flyinghead c2caef4ad5 ui: use SDL clipboard functions for imgui
allow cut & paste on linux
2021-10-07 19:14:29 +02:00
Flyinghead 1d9ac4918c pvr: fix SPG_VBLANK_INT reset value 2021-10-07 16:24:00 +02:00
Flyinghead bc3be1029c fix sh4 scheduler. use common cycle counter in sh4 context
scheduler reset and unregister
schedule requests during reset(), not init()
preserve cntx.sh4_sched_next on sh4 reset
Use cntx.cycle_counter in dynarecs and interpreter
Fixes Confidential Mission hang at boot with HLE
2021-10-07 16:18:32 +02:00
Flyinghead bc238de5ce switch: open 4 controllers. android: java7 compatibility 2021-10-06 18:55:04 +02:00
Flyinghead 1072235b1a lua: ui bindings 2021-10-04 19:42:45 +02:00
Flyinghead 3c2c7b379d ggpo: pair with first received sync request if remote IP not specified 2021-10-04 19:38:33 +02:00
Flyinghead 4af194035c win: fix binary s3 upload 2021-10-04 19:21:18 +02:00
Flyinghead 3171cfd381 win: fix binary s3 upload 2021-10-03 21:46:37 +02:00
Flyinghead 8183bf7f95 linux build fix 2021-10-03 20:42:25 +02:00
flyinghead 82bec1e324 lua: build fix for linux and win. dx9: crash on exit 2021-10-03 20:22:52 +02:00
Flyinghead 897cc01f93 some lua bindings 2021-10-03 18:34:27 +02:00
Flyinghead 5bcfa35737 Better background game loader
Pass LoadProgress object to report load progress and cancel
Better UI
Cancel with exception
Fix issues when stopping/exiting in !threaded
dx9: call gui_term on shutdown
2021-10-02 11:30:40 +02:00
Flyinghead c1bcf91dd6 pvr: render timeout when using ggpo or !threaded
will cause ggpo desyncs with previous versions
2021-10-01 16:48:01 +02:00
Flyinghead 621e4d196e crash when enabling bba per-game 2021-10-01 16:14:27 +02:00
Flyinghead 45ebc2239f ggpo: exchange verification data during sync 2021-10-01 16:07:32 +02:00
Flyinghead a6248905a0 ggpo: report UDP bind error. Better error reporting for net init
fix ggpo lib warnings
2021-09-30 17:24:51 +02:00
Flyinghead 699dcdaf5b Merge remote-tracking branch 'origin/master' into net-rollback
# Conflicts:
#	core/hw/maple/maple_if.cpp
#	core/rend/mainui.cpp
#	shell/libretro/libretro.cpp
2021-09-30 15:03:29 +02:00
Flyinghead 23d1f6b507 imgui: bug when drag scrolling in a combo's popup 2021-09-30 14:36:29 +02:00
Flyinghead f72f4c49fb macos: fix freeze in !threaded. input: fix crash when saving mapping
audiostream: delete legacy [audio]disable option
2021-09-30 14:31:51 +02:00
Flyinghead 2803ee8274 imgread.ImagePath clean up. ggpo: poll input late if !thread 2021-09-30 14:24:17 +02:00
Flyinghead 0d2e6f5e98 remove safe mode/div matching option
mismatched delete/free() in TexCache.cpp
2021-09-29 11:57:51 +02:00
Flyinghead 99bf7f77c4 single-threaded mode. refactoring.
single-threaded mode similar to libretro core
stateful Emulator object
disable memory watcher when !gppo
ggpo: poll input as late as possible in !threaded
2021-09-29 10:22:58 +02:00
Flyinghead 7fe2ab720f refactor screen_width/height 2021-09-27 20:29:23 +02:00
Flyinghead 18cecc8d38 gl,vk: use VO_BORDER_COL for clear color 2021-09-27 13:39:08 +02:00
scribam 5d068fc2d4 Update .gitignore 2021-09-27 11:52:18 +02:00
scribam 84d98763f1 README.md: add Nintendo Switch CI badge 2021-09-27 11:52:18 +02:00
scribam 86356c737c Update man page 2021-09-27 11:52:18 +02:00
scribam 1fa233aae7 Remove makefiles and xcode project files 2021-09-27 11:52:18 +02:00
Flyinghead 1dc01314a1 input: don't poll input on emu thread
fixes device reset errors with dx9 on Alt+Enter and other renderer
crashes
2021-09-27 11:51:39 +02:00
Flyinghead fb40bb22df vk: CommandPool size must be 2. Fix lightgun xhair validation error 2021-09-27 11:19:50 +02:00
Flyinghead 1dc22ec76c sdl: null init sdl_controller 2021-09-26 22:02:21 +02:00
Flyinghead 41ac140076 ggpo: lightgun support for arcade games
ui: display button names in arcade mode only
2021-09-26 21:28:31 +02:00
scribam 4e019cc233 Update issue templates 2021-09-25 16:04:23 +02:00
scribam 36007ceb68 android: update com.android.tools.build:gradle to version 7.0.2 2021-09-25 16:04:15 +02:00
scribam 25fdeac697 cmake: iOS minor fixes 2021-09-25 16:04:05 +02:00
Cameron Bates 07d27edb76 Add more keys, gui hotkey 2021-09-22 20:16:11 +02:00
Flyinghead 39fabf39ae naomi: free play eeprom for many games
inputs for ggx, doa2, toyfight, ausfache
don't label common buttons (coin, test, service, start)
2021-09-22 14:26:13 +02:00
Flyinghead 945a483e9b ggpo: less log 2021-09-22 14:20:55 +02:00
Flyinghead 1725dbfa98 input: fix arcade mode for on-screen gamepads.
Use same layout as gamepad arcade for on-screen gamepads (ABXYRL)
map RT and LT to buttons 5 and 6 in arcade
android: Fix non-working fast-forward button
Use maple port in lastAxisValue state
naomi: use default alienfnt buttons: 1-4
2021-09-21 15:56:01 +02:00
Cameron Bates 67790abf0e [iOS] Update AltKit (#366) 2021-09-21 10:12:19 +02:00
scribam 3ec08f6ae1 ci: simplify C/C++ CI workflow 2021-09-21 10:11:56 +02:00
Flyinghead c419654a11 input: don't register multiple button presses when holding axis
keyboard: map left stick and coin button by default
2021-09-20 14:07:42 +02:00
flyinghead 51ad6094e8 input: fix axis bound to emu buttons 2021-09-20 10:05:13 +02:00
flyinghead 5b7d189058 sdl: fix hat button names 2021-09-19 22:35:23 +02:00
Flyinghead 7d57d55414 iOS build fix 2021-09-19 18:55:09 +02:00
Flyinghead 65956dbc8d input: merge buttons and axes
Default mappings for arcade and console
Default mappings for arcade stick/hitbox
Proper handling of inverted axes
ggpo: automatic analog setting for arcade games
2021-09-19 18:27:21 +02:00
Flyinghead d75072362a vk oit: work around adreno 600 driver regression
Android 11 adreno 600 driver v502: PixelBuffer.pixels.length() is
returning 0 in some cases.

Issue #361
2021-09-18 18:08:52 +02:00
Joshua L 22947af854 Sdl gamecontrollerdb.txt fix (#356)
sdl: load gamecontrollerdb.txt before calling SDL_InitSubSystem
2021-09-18 18:07:07 +02:00
Flyinghead 50a67dbd3e build fix 2021-09-16 20:27:57 +02:00
Flyinghead 7fd954e10d rend: apply vscalefactor to scissor in 240p/480p
fixes SF3 3rd strike half-screen in 240p mode
2021-09-16 19:27:59 +02:00
Flyinghead 4c53fcecfa ggpo: detect input size mismatch and abort gracefully 2021-09-16 19:24:49 +02:00
bslenul 17348dae8a [Libretro] Middle mouse fix 2021-09-15 17:26:01 +02:00
Flyinghead 05d495b282 dx9: Fix RenderLastFrame
Fixes black blackground when opening the menu during a game
2021-09-15 17:24:55 +02:00
Flyinghead 3b7a940e9b android: use list of axes for default mapping and axis handling
Issue #338
2021-09-15 14:44:56 +02:00
Cameron Bates 501c6f260a Remove mouse invert option and invert gcmouse by default 2021-09-14 23:43:16 +02:00
Cameron Bates e1fa2b9831 [iOS] GCMouse support (#353) 2021-09-14 11:51:44 +02:00
Edward Li 043175ae4d Rumble using MacBook's Taptic Engine 2021-09-14 11:44:37 +02:00
Flyinghead 8b266b1327 ggpo: force aica.nobatch 2021-09-13 13:01:52 +02:00
flyinghead f7abe3bb34 Merge pull request #351 from flyinghead/libretro
Merge Libretro branch
2021-09-13 10:03:53 +02:00
Flyinghead 480e85f615 ggpo: UI for analog axes settings. Display stats option 2021-09-12 17:42:58 +02:00
Cameron Bates 0182d1ca09 Add dummy value for ALTDeviceID 2021-09-12 15:59:25 +02:00
Flyinghead 99a0dce8cd arm build fix 2021-09-11 19:17:36 +02:00
Flyinghead badcace987 ggpo: analog axes support. Fix right trigger. use miniupnp.
Analog stick X/Y support
Right trigger was ignored
Forward UDP port 19713 with miniupnp before starting ggpo session
Use recursive_mutex for ggpo
2021-09-11 18:50:11 +02:00
Flyinghead e8b73e22b7 Merge remote-tracking branch 'origin/libretro' into net-rollback 2021-09-11 18:11:36 +02:00
Cameron Bates 45f68d59ff iOS Keyboard Support (#347)
PR adds in support for iOS keyboards using GCKeyboard
2021-09-11 13:08:35 +02:00
Flyinghead 1762987aae reios: reset gdrom state at reset
Fixes "Reboot to BIOS" exception when loading another game
2021-09-11 11:22:58 +02:00
Flyinghead ad2e142b01 ui: Show mouse cursor when emu throws an exception. lr: fix vulkan init 2021-09-10 15:32:13 +02:00
Flyinghead 88fa5d5c41 arm64 dsp: don't JitWriteProtect twice. ios: Hide VSync. pvr: fix mutex 2021-09-10 15:26:18 +02:00
Flyinghead e45ec4324f Merge remote-tracking branch 'origin/master' into libretro 2021-09-10 12:19:29 +02:00
Flyinghead d9a8e29a94 missing change 2021-09-09 18:31:08 +02:00
Flyinghead 3ced57a263 network: use interface for startup. avoid deadlock on exit
Use common interface for naomi and ggpo
Simpler ggpo interface
Fix deadlocks on exit with ggpo
2021-09-09 18:17:05 +02:00
Flyinghead 458868a634 ggpo: always save delta ram. Disable ff,cheats,savestates when online
ggpo: always save delta ram on save_game_state as frames may be rerun
and resaved
Global network online status (ggpo, naomi, modem, bba)
Disable fast forward, cheats and savestates when online.
2021-09-08 17:18:01 +02:00
Flyinghead 7ecc0543f4 ggpo: fix common assert() sync.cpp:238 2021-09-08 16:21:54 +02:00
Flyinghead 6d6f3d38d4 libretro build fix 2021-09-07 17:18:56 +02:00
Flyinghead a4e715fa71 serialize modem, aw coin, pvr direct fb state, TA cur context 2021-09-07 16:43:50 +02:00
Flyinghead 8594d11693 maple: refactor usage of rt/lt. zero out joystick values if ggpo active
Fix mouse cursor being invisible when emu throws an exception
2021-09-07 16:30:56 +02:00
Flyinghead a4c14ebef7 Merge remote-tracking branch 'origin/libretro' into net-rollback 2021-09-07 15:02:39 +02:00
Flyinghead 599874c9c1 dx9: VSync option support 2021-09-07 14:16:05 +02:00
Flyinghead 5121b0df93 maple: mutually exclusive btns per controller. better D2A axes
Handle mutually exclusive buttons (U/D, L/R) in each controller.
Track digital X/Y axes state to allow for proper handling of U+D and
L+R. Issue #334
SDL: Ignore key repeat events
2021-09-07 10:54:00 +02:00
Flyinghead e3a2f1cfbe ggpo: transmit RT and LT as digital inputs 2021-09-06 17:16:41 +02:00
Flyinghead 414fb9dba2 ramwatch: protect all ram, not just the bottom half 2021-09-06 16:14:38 +02:00
Flyinghead a402c69c55 ggpo: detect frame rate and use it to pause when ahead 2021-09-05 20:47:37 +02:00
Flyinghead c007165a0f input: naomi btns 5/6 and 7/8 shouldn't be mutually exclusive 2021-09-05 20:12:40 +02:00
Flyinghead a3d50fc197 Merge remote-tracking branch 'origin/libretro' into net-rollback 2021-09-05 20:07:37 +02:00
flyinghead baa0ac44ca paypalme link 2021-09-05 17:30:26 +02:00
Flyinghead 6768901446 allow semicolon in content paths 2021-09-05 10:30:19 +02:00
Flyinghead 35e77976a6 ui: use input from all keyboards
Issue #339
2021-09-05 10:29:12 +02:00
Enrique Santos dba805e8c4 ggpo: static rtc when ggpo is enabled 2021-09-04 18:47:34 +02:00
Enrique Santos e3aca85efd ggpo: add frame delay to settings (#343) 2021-09-04 18:47:21 +02:00
Flyinghead f35a18bb63 ggpo: use bargraphs for net stats 2021-09-04 12:03:29 +02:00
flyinghead a6ad0208db uTip link 2021-09-03 23:54:40 +02:00
Flyinghead e02ccbf32a gl: update fog and texture palette in Process() 2021-09-03 11:12:47 +02:00
Flyinghead b362a55c04 ggpo: rollback glitches. win32 init. switch build. stats
Block net rollbacks until the current frame has been processed to avoid
glitched textures.
Call WSAStartup at init on windows
Display net stats when in game
Switch build fix
2021-09-03 11:11:46 +02:00
Flyinghead 69d0801121 net rollback with ggpo 2021-09-02 17:51:23 +02:00
flyinghead f85bca06d7 dsp: rec crash on windows 2021-09-02 12:34:38 +02:00
scribam 3589e94121 android: update com.android.tools.build:gradle to version 7.0.1 2021-08-31 17:52:51 +02:00
Flyinghead 2baf2cfed6 ci: always install dx2010 2021-08-30 12:13:52 +02:00
Flyinghead 4d5c93adfa ios: add entitlements and sign IPA with ldid 2021-08-29 11:58:05 +02:00
Flyinghead 93eff7fac6 sh4: fix TMU regression
introduced by 05d51cc35c
fixes SA2 running too fast
2021-08-29 11:55:42 +02:00
scribam ce68a9c708 ci: update switch workflow
Checkout submodules non-recursively
Add ninja to speed up compilation
Simplify some steps
2021-08-29 10:45:47 +02:00
scribam 280dad1c07 ci: update android workflow
Checkout submodules non-recursively
Add ccache to speed up compilation
Use ninja and specify target to build only dump_syms
Use official aws-actions/configure-aws-credentials action and awscli to upload artifacts to s3 bucket
2021-08-29 10:45:47 +02:00
Flyinghead c3d954263b gdrom: fix soft reset. ignore slave requests. Unknown ATA cmds handling
Retain currently inserted disk during soft reset
Correct DriveSelect value. Ignore slave drive commands and return 0
status.
Properly handle unknown ATA commands.
Fixes DreamShell boot and CDI boot from BIOS
2021-08-27 18:29:41 +02:00
Flyinghead e058ba5d3b sh4: always perform hard-reset of sh4 and its registers
Fixes infinite loop after reboot
2021-08-27 18:20:40 +02:00
Flyinghead 05d51cc35c sh4: timer underflow lost if TCOR is 0 or very small
Fixes DreamShell boot
2021-08-27 17:55:50 +02:00
vkedwardli a51f310e96 Add volume slider in audio settings (#329)
Use logarithmic volume scale
2021-08-26 13:30:23 +02:00
Flyinghead 89ccdf2814 rend: better fix to force even width rendering 2021-08-26 13:28:13 +02:00
Flyinghead 52af352fcd input: never load mapping file for !remappable controllers
Fixes android on-screen gamepad not working when a (wrong) mapping file
exists for it.

Issue #325
Issue #330
2021-08-26 13:25:18 +02:00
Flyinghead 088287227e x64 msvc build fix 2021-08-26 11:01:44 +02:00
Flyinghead ad1f9527c1 x86 msvc build fix 2021-08-26 10:34:01 +02:00
Flyinghead ca17717af7 dsp: map TEMP/MEMS/MIXS regs to sh4 and aica address space. Clean up 2021-08-26 10:16:07 +02:00
Flyinghead 2a849ccba5 ui: hide dirs on iOS. Fix home on android. force even width rendering
Hide content and home dirs on iOS
Show home dir and allow change on android
Force even width for rendering resolution
2021-08-26 10:08:50 +02:00
Flyinghead 4bf20846bc iOS: output audio to speakers, not the receiver 2021-08-26 10:02:38 +02:00
Flyinghead ad80184e7f missing cmake change 2021-08-24 20:54:17 +02:00
Flyinghead e5ca63db20 aica: arm32 dsp dynarec. Correct dsp level when dsp disabled 2021-08-24 20:49:53 +02:00
vkedwardli 7a33ae35e0 [macOS] Fix DelayFrameSwapping and optimise Vsync logic (#307)
* Support macOS 10.15 and 11
* Enable VSync option on macOS. Use "swapOnVSync" logic from other wsi
* Limit `mainui_rend_frame()` to 5 iterations max: 4 renders and the final swap
2021-08-24 11:43:19 +02:00
Flyinghead ce58ba3472 pvr: detect swap on FB_R_SOF2 too. Force render res. to even width
Fixes Soul Calibur FPS /2 drop with Delay Frame Swapping on
2021-08-24 11:40:53 +02:00
Flyinghead 43ae2ea5f5 macOS: upgrade SDL to 2.0.16
fixes Xbox series X controller support
2021-08-23 17:56:40 +02:00
Flyinghead 2f03922b43 build fix 2021-08-23 14:25:27 +02:00
Flyinghead 5db2856270 missing changes from previous commit 2021-08-23 14:16:52 +02:00
Flyinghead e3e3229612 iOS: multiple controller/rumble support. GL: fix black screen after RTT
iOS:
* multiple controllers support. Rumble support.
* fix audio recording
* declare CHD/GDI/CUE/CDI content types
* start game when opening file URL
* Use safe area for UI and virtual gamepad
* Better icons
2021-08-23 14:02:12 +02:00
Flyinghead 8b2ed736a6 libretro: fix random shutdown when saving/loading state
Issue #326
2021-08-23 11:29:17 +02:00
Flyinghead 27da5f84c4 cmake: fix miniupnpc name warning
Issue #302
2021-08-23 10:23:04 +02:00
Flyinghead 98d04702ae sdl: set vsync swap interval to 2 for 120 Hz displays
Issue #293
2021-08-23 10:11:04 +02:00
Flyinghead a0664a49d2 ci: install awscli 2021-08-22 21:21:32 +02:00
Flyinghead 55fb0a6efb ci: fix switch s3 upload 2021-08-22 21:00:58 +02:00
Flyinghead 7fb83f4f77 libretro: fix content closing when loading or saving state 2021-08-22 20:41:02 +02:00
scribam 3006cd4f60 .cirrus.yml: update to freebsd-13-0 2021-08-22 11:44:34 +02:00
Flyinghead 970f8c6dcd upload iOS and switch builds to S3 2021-08-20 19:57:20 +02:00
Flyinghead c99de2370f build fix 2021-08-20 08:39:37 +02:00
Flyinghead 8c9ff4a66f iOS: DSP fix 2021-08-20 08:32:29 +02:00
Flyinghead 42eeddcbfb iOS: on-screen gamepad layout fix 2021-08-17 10:13:30 +02:00
Flyinghead 8b0f17fb25 iOS: bundle_version must not be null. Add Document Browser support 2021-08-16 13:09:53 +02:00
Flyinghead a3900495d5 iOS: map menu button to Options, start to Menu. Analog triggers 2021-08-16 11:46:45 +02:00
Flyinghead d7bc1f0f77 apple: disable delay frame swapping, libretro: set base_width/height to 640x480, use gl 3.2 on macOS 2021-08-15 10:50:53 +02:00
scribam 281a04837f switch: simplify standalone build 2021-08-13 08:31:32 +02:00
Flyinghead 3ea688be69 iOS: pause/resume based on focus. autosave state on background. VGamepad fix
Get rid of swipe gesture (fixes touch not being delivered)
Use UP+DOWN or LEFT+RIGHT to open menu.
Arcade shortcuts (RT + A/B/X)
Disable system gestures
Monitor network and restart AltKit as needed.
2021-08-12 11:22:22 +02:00
Flyinghead c27180fb32 android: fix navbar background. Add shortcuts for Coin/Service/Test
Fix black navigation bar background.
Shortcuts for virtual gamepad:
RT + A -> D (Coint)
RT + B -> C (Service)
RT + X -> Z (Test)
Issue #137

Don't deliver mouse clicks if analog triggers or stick are used
2021-08-11 12:58:57 +02:00
Flyinghead 1bea7853ef iOS: CI job, JIT status, touch fixes 2021-08-10 17:04:36 +02:00
Flyinghead 104521517c Build fix 2021-08-10 12:00:05 +02:00
Flyinghead bb217e5c49 iOS: AltKit source 2021-08-10 11:34:11 +02:00
Flyinghead 12f302d356 iOS: uv need high precision in fragment shader. cmake build. virtual joystick. AltKit integration 2021-08-10 11:32:22 +02:00
Edward Li 6f233462c1 Add missing JITWriteProtect to DSP 2021-08-09 09:02:59 +02:00
Flyinghead 77e7c25e9c iOS support. Work in progress 2021-08-06 10:30:30 +02:00
Flyinghead b027a6b9a1 android: add missing oboe lib links 2021-08-05 22:06:32 +02:00
Flyinghead 6bb4575c95 Merge remote-tracking branch 'origin/master' into libretro 2021-08-05 18:17:30 +02:00
Flyinghead 37eace9db4 osx: lockup when emulator aborts. Race condition when starting emu 2021-08-05 17:43:26 +02:00
Flyinghead 0414406471 win32 build fix. disable breakpad on BSD 2021-08-03 11:59:19 +02:00
Flyinghead 8c000f327e missing include 2021-08-03 10:08:13 +02:00
Flyinghead 951e70328f Use exception when load content fails. ui: graceful stop on fatal error
libretro: catch/detect fatal errors and shutdown
2021-08-03 10:05:09 +02:00
Flyinghead 2dd7717128 glGetString(GL_EXTENSIONS) may return null in core contexts
xcode project missing update
2021-08-03 09:49:20 +02:00
Flyinghead 9d6c548730 naomi: close cart on reset. sh4: replace some verify by throw
Close naomi/aw cart on reset. Reset input mapping/button names
Get rid of ngen_GetFeatures()
throw exception instead of failing verify if not internal error
catch sh4 exceptions in dynarecs and throw fatal error
2021-08-03 09:47:13 +02:00
Flyinghead 8a46853dfd lr: deadlock on exit with custom textures (win32)
less log
2021-08-02 12:07:40 +02:00
Flyinghead 789fd21bb7 bsd build fix 2021-08-02 12:05:24 +02:00
Flyinghead 3fa97b5ce7 bsd build fix 2021-08-02 10:20:45 +02:00
Flyinghead c8ebbc657a x86 win32 build fix 2021-08-02 10:09:19 +02:00
Flyinghead b59585437c arm32 dynarec: windows ce support 2021-08-01 17:25:48 +02:00
Flyinghead 6f4e1365b1 x86: stack unwind fixes 2021-08-01 17:07:17 +02:00
scribam fcef404f50 android: update gradle and dependencies 2021-07-30 19:35:07 +02:00
Flyinghead aabb492d01 x86 stack unwinding support (android) 2021-07-30 19:13:52 +02:00
Flyinghead cfa21934bb x64: fix stack unwinding issue. don't save xmm regs on stack 2021-07-30 19:10:34 +02:00
Flyinghead 7561ce753a unwind info for arm64. use static c++ lib for android
include oboe static libs
get rid of old regalloc
2021-07-29 17:46:46 +02:00
Flyinghead 5ac0e58886 android: mouse move events missing when btn down. Mouse wheel support
Issue #304
2021-07-27 10:32:22 +02:00
vkedwardli a14fc35e47 Support Fast Forward in macOS (#303) 2021-07-26 20:36:14 +02:00
Flyinghead 5fd00e3063 specify RelWithDebInfo output dir 2021-07-26 00:13:05 +02:00
Flyinghead a46a012c3c tentative fix against .NET stupidity 2021-07-25 22:42:05 +02:00
Flyinghead 3072105efe github: don't upload symbols for linux 2021-07-25 22:27:17 +02:00
Flyinghead 8f09ac2611 github: don't parameterize shell 2021-07-25 22:22:08 +02:00
Flyinghead e12be7cf29 add breakpad support for android, linux and windown 2021-07-25 21:55:29 +02:00
flyinghead 588d79641a msvc x64 build fix 2021-07-25 11:47:14 +02:00
Flyinghead daac6de533 macos build fix 2021-07-24 23:30:12 +02:00
flyinghead c6d7307efe x86 build fix 2021-07-24 23:17:27 +02:00
Flyinghead 710f379bd3 unwind info for x64 dynarecs
delegate to previous signal handler, proper abort for win32
arm32: use builtin gcc __clear_cache
dyna/driver.cpp: no need for a code buffer in win32, cleanup
2021-07-24 22:24:37 +02:00
vkedwardli e4d9be86b4 Fix cmake macOS ARM not building (#301)
set `CMAKE_OSX_ARCHITECTURES` as Cache Entry
2021-07-24 15:52:56 +02:00
vkedwardli 3c483c61e7 Support Apple Silicon (macOS ARM Universal Binary) (#253)
* Add audio arm64 cpp into Xcode project

* Build universal binary for SDL2 also

* Add vixl aarch64 dependency + build arm64 in cmake

* hardcode pagesize for M1 CPU

* Use `MAP_JIT` and toggle between RX and RW

* add pthread.h for cmake

* Disable audio dynarec temporary

* Enable aica arm dynarec

* Supports `br` with condition

* Dynamic linker flag for libSDL2.a since Homebrew path is different on arm (for xcodeproj)

* Fallback path for Intel

* de-dup for arm64, allow cross compilation on both Intel and Apple Silicon Mac

* Rename WriteProtect() to JITWriteProtect(), Move JITWriteProtect from arm7_rec to arm7_rec_arm64

* Remove CodeCache memset

* Remove keyboard_device.cpp from xcodeproj

* Use hard tab

* Update libchdr to support compiling on M1 (thanks @scribam)
2021-07-23 22:34:12 +02:00
Flyinghead c453d14352 libretro: better error handling. fix reset issue with rotated games
compilation warnings, clean up
2021-07-21 16:19:57 +02:00
Flyinghead de060d66ab don't save flash if no game started. libretro: fix notifications
compilation warnings, non-functional changes
2021-07-20 19:21:11 +02:00
Flyinghead c458a8f5e7 os_[Un]InstallFaultHandler. Uninstall fault handler at shutdown 2021-07-20 13:06:08 +02:00
Flyinghead 4a77f847b4 libretro: fix arcade flash files path. ui: stop spamming dc_stop 2021-07-20 10:06:44 +02:00
Flyinghead edc6474f27 save nvmem/flash files when stopping emu 2021-07-19 18:20:58 +02:00
Flyinghead 117f47e3a2 rend: shader builder utility 2021-07-19 12:49:47 +02:00
Flyinghead 4f11ff76a5 input: don't toggle fastforward when game isn't running
it resets the vulkan swapchain and causes random crashes
2021-07-19 12:10:14 +02:00
Flyinghead 10e97b63be jvs: no default mapping if button is remapped to P1 or P2
fixes jambo down-lever pausing the game
2021-07-19 10:15:24 +02:00
Flyinghead af76a09e03 gl: repeat % operator for printf. remove Switch special case 2021-07-18 18:15:35 +02:00
scribam 147bd8341d android: update compileSdkVersion/targetSdkVersion to version 29 2021-07-17 19:35:14 +02:00
scribam 5c0dd67094 android: cleanup jni files 2021-07-17 19:35:14 +02:00
scribam 49688d6523 android: migrate to androidx 2021-07-17 19:35:14 +02:00
scribam 850f23be82 android: update project files 2021-07-17 19:35:14 +02:00
Flyinghead 9e5769912b gl: workaround nouveau bug (oit). Use float palette coords for switch
Don't switch render type before terminating current one.
2021-07-17 15:53:47 +02:00
Flyinghead ab50bc9936 libretro: VGA cable option shown twice. fix arcade/dc option visibility 2021-07-16 17:41:40 +02:00
Flyinghead a604a3904f win: make sure not to call VirtualAlloc with null during jit alloc 2021-07-16 17:35:29 +02:00
Flyinghead e112f2d8af gl: GLES2 build compatibility 2021-07-15 19:24:56 +02:00
Flyinghead 376d2e1433 libretro: fix keyboard input 2021-07-15 18:44:57 +02:00
Flyinghead ed0caa119a Merge remote-tracking branch 'origin/master' into libretro
# Conflicts:
#	CMakeLists.txt
2021-07-15 18:43:29 +02:00
Flyinghead f768146d8e switch: unneeded init functions. needed exit one 2021-07-15 16:50:54 +02:00
Flyinghead 412083d9ea libretro: blank vmus at unload/reset 2021-07-15 15:43:10 +02:00
Flyinghead 07cdb42ff7 switch: set UI scaling factor depending on docking mode 2021-07-15 14:44:39 +02:00
Flyinghead 1e37e8f333 switch: dsp dynarec fix 2021-07-15 12:24:42 +02:00
Flyinghead 4fa89c4a45 switch: build with miniupnp. set correct window size
organize header
remove unneeded switch-specific code
2021-07-15 12:19:11 +02:00
Flyinghead 0d7a2128b6 libretro: fix 32-bit arm build. delete useless #def in pvr2 filter 2021-07-15 12:06:04 +02:00
scribam 9aa3d8b987 android: do not filter abi, allow x86_64 build 2021-07-15 09:54:41 +02:00
scribam eaf44bc18c android: generate release apk with debug keystore, update ci and gradle 2021-07-15 09:54:41 +02:00
Flyinghead ae33c8de18 sdl: increase audio buffer size. libretro: set PIC option 2021-07-15 00:26:00 +02:00
Flyinghead b12e82c344 libretro: add switch lib as artifact 2021-07-14 22:00:05 +02:00
Flyinghead 8dee648d01 arm64 rec: put ngen_FailedToFindBlock at a fixed address
transitioning to MMU will fail it this function's address changes
happens if vmem is disabled (switch)
2021-07-14 21:03:02 +02:00
Flyinghead 8e6dc54b16 switch: add .. entry to folder chooser. start at / 2021-07-14 20:55:22 +02:00
Flyinghead db9c48b085 switch: typo 2021-07-14 17:48:41 +02:00
Flyinghead c0171f5fd1 switch: open sdl joysticks 0 & 1 at init 2021-07-14 17:22:17 +02:00
Flyinghead 9a5a55d074 switch: use /flycast as config folder 2021-07-14 16:38:12 +02:00
Flyinghead 855836d9aa switch: arm rec EntryPoints need rx. fix arm & dsp cache flush 2021-07-14 14:57:43 +02:00
Flyinghead 8a0a0bcdfc switch: use 256x256 jpeg as app icon 2021-07-14 13:57:40 +02:00
Flyinghead 43c00568c6 switch: standalone build 2021-07-14 13:02:57 +02:00
Flyinghead 31be731de0 input: fix atomiswave keyboard bindings 2021-07-14 09:42:13 +02:00
Flyinghead 113ef66e26 libretro: use HAVE_LIBNX in libretro-common 2021-07-13 21:06:03 +02:00
Flyinghead 4d38e69f63 lr switch: enable aica arm and dsp dynarecs. handle rw/rx offset 2021-07-13 20:51:17 +02:00
Flyinghead 8c02345dfd lr switch: use toolchain ar. really disable lto 2021-07-13 19:18:36 +02:00
Flyinghead a2efde1103 libretro: more switch fixes
combine all static libraries into one
save/restore gl state in !threaded mode
patch libchdr
build fixes
2021-07-13 18:51:40 +02:00
Flyinghead eb81583d9f sh4 dyna: support for !vmem 2021-07-13 17:09:26 +02:00
Flyinghead 44213bf830 lr: fix res change for rotated games. display version. vmem: simplify 2021-07-13 13:45:01 +02:00
scribam f187f77e3d Add basic GitHub Actions for Libretro Nintendo Switch 2021-07-12 22:22:07 +02:00
Flyinghead 63a3f02368 libretro: better switch support 2021-07-12 20:14:21 +02:00
Flyinghead 994e6826b4 libretro: option changes (resolution, widescreen, rotation)
Use RETRO_ENVIRONMENT_SET_SYSTEM_AV_INFO or
RETRO_ENVIRONMENT_SET_GEOMETRY to report resolution/aspect ratio
changes.
Handle rotation without restarting.
2021-07-12 09:57:58 +02:00
Flyinghead 97991fd8fc gl: delete libretro vmu and crosshair textures when terminating 2021-07-11 20:43:04 +02:00
Flyinghead 1fdda98d8d libretro: return max savestate size. unprotect ram and vram on reset
fixes random crash when saving state
2021-07-11 17:42:30 +02:00
Flyinghead a73ca94124 savestate: push vmu lcd image when loading 2021-07-11 12:37:21 +02:00
Flyinghead 82d2aa8a47 savestate: fix test 2021-07-10 19:30:13 +02:00
Flyinghead 75af07331a savestate: save gdrom read buffer. other fixes
Issue #294
2021-07-10 19:16:19 +02:00
Flyinghead 4be4ad07f3 libretro: m3u playlists 2021-07-10 18:00:21 +02:00
Flyinghead 57874a9bcb libretro: savestate compatibility. B1/D1 vmus now visible 2021-07-10 17:39:16 +02:00
Flyinghead ec7968b2f4 libretro: Reset. Reso not applied (vk). xhair always displayed (vk).
Fix Content Reset crash
Render resolution not set at startup with vulkan !threaded
vk: Crosshair always displayed (white) even when off
Better handling of multiple render (rend_single_frame returns false)
2021-07-09 18:17:14 +02:00
Flyinghead 81546fe727 libretro: handle ThreadedRendering transition. Fix hang in !threaded 2021-07-09 16:28:28 +02:00
Flyinghead 7948bac6ba libretro: fix per-game VMU A1 option 2021-07-09 16:23:46 +02:00
Flyinghead eceb5ba982 naomi: keyboard needs player number 2021-07-09 14:34:11 +02:00
Flyinghead 345dab9633 libretro: fix nvidia palette issue. request 3.2 to get a core gl ctx 2021-07-09 13:10:30 +02:00
Flyinghead 5c952021b7 libretro: vmu and crosshair display. lightgun fixes 2021-07-08 20:09:09 +02:00
Flyinghead 80a5b44fe9 enable vulkan in lr ci builds 2021-07-08 12:52:00 +02:00
Flyinghead b66e6560ca libretro: vulkan support 2021-07-08 12:47:00 +02:00
Flyinghead 673c2988d6 libretro: backport libnx support. Fix log source paths 2021-07-07 19:01:37 +02:00
Flyinghead 042f2e0224 custom textures: saturate colors when dumping RGBA4444 and RGBA5551 2021-07-07 17:19:13 +02:00
Flyinghead b300bb9f7a libretro: non-threaded rendering 2021-07-07 13:12:16 +02:00
Flyinghead 205f2690d6 gl4: delete fog & palette textures when terminating
fixes fullscreen toggle screen corruption
2021-07-07 10:54:10 +02:00
scribam aeea301ee3 Minor include header changes 2021-07-07 10:37:11 +02:00
Flyinghead 8e6bbed74f libretro: aw coin fix. screen rotation. disable loading notifications 2021-07-07 09:48:10 +02:00
flyinghead ef506d49aa libretro: pvr2 postprocessing filter 2021-07-06 21:37:47 +02:00
flyinghead c205a888a9 options: anisotropic filtering, oit pixel buffer size, fast gdrom load 2021-07-06 16:19:12 +02:00
flyinghead a3b66aec1f libretro: win32 support. build fix. 2021-07-06 13:22:54 +02:00
Flyinghead 68f4c50bd3 missing change 2021-07-05 19:48:49 +02:00
Flyinghead 7dbd79750c WIP libretro core update 2021-07-05 19:44:08 +02:00
Flyinghead fd301186c7 android: avoid duplicates in controllers list 2021-07-05 19:26:57 +02:00
Flyinghead b40328e621 input: don't change mapper if file not found. sdl: fix default bindings 2021-07-05 09:59:46 +02:00
flyinghead 7cd832e914 input: use default mapping if no mapping file is found 2021-07-04 23:27:29 +02:00
flyinghead 44feea4c01 Merge pull request #288 from flyinghead/fh/directx
DirectX9 renderer
2021-07-04 18:35:19 +02:00
flyinghead c5ce475359 Merge remote-tracking branch 'origin/master' into fh/directx
# Conflicts:
#	core/input/gamepad_device.cpp
2021-07-04 17:53:49 +02:00
flyinghead 894a0540b9 sdl: convert keyboard mapping from keycodes to scancode on first load 2021-07-04 17:45:45 +02:00
flyinghead 967f4570ed rawinput: simplify USB device names 2021-07-04 15:51:33 +02:00
Flyinghead 14360beaf7 gdrom: reset registers and state on reset
Issue #281
2021-06-27 12:53:54 +02:00
Enrique Santos 46e3258629 Controller Mapping: System Profiles & Unmap Button (#269)
* add unmap button
* separate controller profiles for dc & arcade games
* loads current system mapping on menu exit
* simplify, use default filename for dc controls
* create blank mapping file for sdl controllers if not found
2021-06-27 12:49:47 +02:00
Flyinghead b3ad0a62c1 gl: fix multiple rendering with GLES 2
fixes split-screen multiplayer for SW1 Racer, Q3, Re-volt
2021-06-19 10:48:32 +02:00
scribam a5edd9c7ff deps: remove crypto folder (unused) 2021-06-19 10:46:22 +02:00
Flyinghead 7f49accc22 Merge remote-tracking branch 'origin/master' into fh/directx 2021-06-07 20:53:31 +02:00
Flyinghead b8c2a695b8 ui: allow drag scrolling anywhere. change some ui elements
allow scrolling by dragging (almost) anywhere
move physical devices before dreamcast ones
hide insets when displaying full screen window
reduce scroll bar size on android
fix controller mapping column sizes
2021-06-07 12:18:05 +02:00
Flyinghead c73bbc85bd savestate: rzip size must be 64-bit on all platforms 2021-06-06 11:18:42 +02:00
scribam d6545b253b Misc cleanup 2021-06-06 11:15:06 +02:00
Flyinghead 293761bdf5 gui: separate auto-load and auto-save options. Fix tool tips on android 2021-06-04 11:11:23 +02:00
scribam d862453956 github actions: authorize aws actions on main repository only 2021-06-04 11:08:30 +02:00
Flyinghead 58974c9305 savestate slots 2021-06-03 13:50:40 +02:00
keita yoshimoto cddb6609f1 Multiple save states (#248) 2021-06-03 13:22:40 +02:00
scribam 4a9c51a6c8 github actions: remove flac installation from macos 2021-05-31 23:24:43 +02:00
scribam 329ae11d2f Remove snap configuration file 2021-05-31 23:24:33 +02:00
Flyinghead c3bc5cfc3b vk oit: use a 2nd depth attachment for subpass 1
subpass 1 needs writable depth buffer (see
9f60c5e854)
2021-05-30 18:20:04 +02:00
scribam 24f9003cd3 cirrus ci: add ccache support 2021-05-29 14:32:06 +02:00
scribam 4c2bf59c46 github actions: extend cache for Android build 2021-05-29 14:32:06 +02:00
scribam 642a89733b ci: remove flac package 2021-05-29 14:13:05 +02:00
scribam 2b3d9427e1 .cirrus.yml: use CIRRUS_CLONE_SUBMODULES to checkout submodules 2021-05-29 14:12:51 +02:00
scribam 6368241b77 cmake: fix compilation on FreeBSD 2021-05-29 14:12:51 +02:00
scribam 57ae9022dd Update Windows resource and version.h.in files 2021-05-28 14:56:04 +02:00
flyinghead 7ed68952ba Merge remote-tracking branch 'origin/master' into fh/directx
# Conflicts:
#	core/deps/patches/SDL.patch
#	core/hw/maple/maple_devs.cpp
#	core/rend/gl4/gles.cpp
#	core/rend/gles/gles.cpp
#	core/rend/gui.cpp
#	core/rend/gui.h
#	shell/apple/emulator-osx/reicast-osx.xcodeproj/project.pbxproj
2021-05-26 22:38:48 +02:00
flyinghead 4696733eb4 dx9: linear filtering for fog texture. swap only when frame rendered 2021-05-26 21:40:43 +02:00
flyinghead 5f5d31730c sdl: hide mouse in fullscreen. fix & refactor mouse devices
support rawinput mouse wheel
simplify mapping load
2021-05-19 18:13:52 +02:00
Flyinghead e07977eea9 mac,x11: propagate win/sdl mouse/keyboard changes 2021-05-10 13:48:12 +02:00
flyinghead 71fb024061 rawinput: proper conversion of abs coordinates
Issue #138
get rid of libPvr_GetRenderTarget() -> getNativeHwnd()
2021-05-04 12:03:09 +02:00
flyinghead 54cfc6e09b build fix for non-windows 2021-04-29 19:15:34 +02:00
Flyinghead 150cfa29e7 Merge remote-tracking branch 'origin/master' into fh/directx 2021-04-29 19:06:38 +02:00
flyinghead b90cdf9588 RawInput driver. Multiple keyboards support
Merge Keyboard and KbGamepad
Always use system mouse for UI
Issue #138

Fix DX9 when not using SDL
2021-04-29 18:58:04 +02:00
flyinghead 6316479930 get rid of unneeded pixel unpacker and use better name 2021-04-29 18:38:58 +02:00
flyinghead f9603dc11a vk: use texture pointers instead of u64 2021-04-17 19:04:00 +02:00
flyinghead 5359e9a09d allow gpu-handled palette textures to be replaced by custom version
Issue #219
Fix incorrect texture size calculation for VQ textures.
Reorder BaseTextureCacheData fields to have hottest on top
2021-04-17 18:40:58 +02:00
flyinghead 28d2c6db73 dx9: rotate 90deg 2021-04-16 21:58:37 +02:00
flyinghead abc8b18b78 dx9: mipmaps. load/dump textures. vmu/crosshair display.
upload all texture mipmaps to gpu
dump textures. load custom textures
vmu and lightgun xhair display
fix dx9 half-pixel offset
fix 565_32 unpacker bug
2021-04-16 18:30:47 +02:00
flyinghead c889bfa6d4 dx9: copy to vram. clipping. fix depth/stencil size. better reset
Coordinate device reset with dxcontext. Keep compiled shaders.
Don't use automatic depth/stencil on backbuffer. Manually handle it.
Implement scissoring/clipping
multipass translucent depth
Render-to-texture copy to vram
2021-04-15 15:17:32 +02:00
flyinghead f2a0098fed build fix 2 2021-04-13 12:22:01 +02:00
flyinghead b549c56b23 build fix. default Delay Frame Swapping to true 2021-04-13 11:20:11 +02:00
flyinghead f107d380b9 WIP directx9 renderer 2021-04-12 22:49:04 +02:00
5106 changed files with 634021 additions and 921902 deletions

No files matched your search

-9
View File
@@ -1,9 +0,0 @@
freebsd_instance:
image_family: freebsd-12-2
task:
install_script: pkg install -y alsa-lib cmake evdev-proto flac git libao libevdev libudev-devd libzip mesa-libs miniupnpc ninja pkgconf png pulseaudio sdl2
script:
- git submodule update --init --recursive
- cmake -B build -DCMAKE_BUILD_TYPE=Release -G Ninja
- cmake --build build --config Release
+2
View File
@@ -0,0 +1,2 @@
buy_me_a_coffee: hhwtpernwq
custom: ['https://www.paypal.com/paypalme/FlycastEmu']
+40
View File
@@ -0,0 +1,40 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---
<!-- Please Note: This form is the minimum required information for submitting bugs. -->
<!-- Removing this form may lead to your issue being closed until it is completed. -->
Platform / OS / Hardware:
Flycast version:
Hardware:
**_Description of the Issue_**
<!-- Add a short, concise description of the issue here -->
**_Debugging Steps Tested_**
<!-- Fill in any steps already tried here -->
<!-- Begin each new line with an asterisk -->
<!-- If no steps are required, please skip -->
**_Logs Gathered_**
```
Please paste the contents of the log / logs here
Delete this field if you have none.
```
**_Screenshots_**
<!-- Replace this line with any issue screenshots -->
+20
View File
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
**Describe the solution you'd like**
<!-- A clear and concise description of what you want to happen. -->
**Describe alternatives you've considered**
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
**Additional context**
<!-- Add any other context or screenshots about the feature request here. -->
+11
View File
@@ -0,0 +1,11 @@
## Description
<!-- Summarize the change and its motivation. -->
<!-- Use "Fixes #123" for an issue this PR closes, or "Related to #123" otherwise. -->
## Checklist
- [ ] This PR targets `dev`, unless it is a critical, low-risk bug fix.
- [ ] I linked the relevant issue or discussion, if one exists.
- [ ] I added or updated tests where appropriate.
- [ ] I tested the change on the relevant platform(s) and noted any limitations.
- [ ] For UI changes, I included screenshots or a recording where helpful.
- [ ] I kept the change focused, followed existing project patterns and avoided code duplication.
+83 -33
View File
@@ -1,51 +1,101 @@
name: Android CI
name: Android
on: [push, pull_request]
on:
push:
branches-ignore:
- 'l10n_**'
pull_request:
jobs:
build:
name: Android
runs-on: ubuntu-latest
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
steps:
- name: Set up build environment
run: echo "y" | sudo ${ANDROID_HOME}/tools/bin/sdkmanager --install "ndk;20.0.5594570"
run: |
sudo apt-get update
sudo apt-get -y install ccache libcurl4-openssl-dev
- uses: actions/checkout@v2
- uses: actions/checkout@v7
with:
fetch-depth: 0
submodules: recursive
- uses: actions/cache@v2
- uses: actions/setup-java@v5
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
java-version: '17'
distribution: 'temurin'
cache: 'gradle'
- uses: actions/cache@v6
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-android-${{ github.sha }}
restore-keys: ccache-android-
- name: Disable release signing
run: sed -i 's/signingConfigs.getByName("release")/signingConfigs.getByName("debug")/' shell/android-studio/flycast/build.gradle.kts
if: github.repository != 'flyinghead/flycast' || github.event_name != 'push'
- name: Bump version code
run: sed -i 's/versionCode = 8/versionCode = ${{ github.run_number }}/' shell/android-studio/flycast/build.gradle.kts
- name: Gradle
working-directory: shell/android-studio
run: ./gradlew assembleDebug --parallel
- uses: actions/upload-artifact@v2
with:
name: flycast-debug.apk
path: shell/android-studio/flycast/build/outputs/apk/debug/flycast-debug.apk
- name: Set up git vars
run: |
echo GIT_BUILD=`git describe --all --always | sed 's/remotes\/origin/heads/'`-$GITHUB_SHA >> $GITHUB_ENV
- name: Clean up
run: rm -f shell/android-studio/flycast/build/outputs/apk/debug/*.json
- uses: jakejarvis/s3-sync-action@master
with:
args: --acl public-read --follow-symlinks
run: ./gradlew assembleRelease bundleRelease --parallel
env:
AWS_S3_BUCKET: flycast-builds
AWS_ACCESS_KEY_ID: AKIAJOZQS4H2PHQWYFCA
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_SECRET_KEY }}
AWS_REGION: 'us-east-2'
SOURCE_DIR: 'shell/android-studio/flycast/build/outputs/apk/debug/'
DEST_DIR: android/${{ env.GIT_BUILD }}
if: ${{ github.event_name == 'push' }}
SENTRY_UPLOAD_URL: ${{ secrets.SENTRY_UPLOAD_URL }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
- uses: actions/upload-artifact@v7
with:
name: flycast-release.apk
path: shell/android-studio/flycast/build/outputs/apk/release/flycast-release.apk
- name: Build dump_syms
working-directory: core/deps/breakpad
run: |
./configure --prefix=$PWD
make -j2
make install
- name: Extract symbols
run: |
DUMP_SYMS=./core/deps/breakpad/bin/dump_syms
SO_DIR=shell/android-studio/flycast/build/intermediates/merged_native_libs/release/mergeReleaseNativeLibs/out/lib
for arch in arm64-v8a armeabi-v7a x86 x86_64 ; do
$DUMP_SYMS $SO_DIR/$arch/libflycast.so > libflycast.so.sym
BUILD_ID=`head -1 libflycast.so.sym | awk '{ print $4 }'`
mkdir -p symbols/libflycast.so/$BUILD_ID
mv libflycast.so.sym symbols/libflycast.so/$BUILD_ID
done
- name: Setup Rclone
uses: AnimMouse/setup-rclone@v1
with:
rclone_config: ${{ secrets.RCLONE_CONFIG }}
- name: Upload to S3
run: |
cp shell/android-studio/flycast/build/outputs/bundle/release/*.aab shell/android-studio/flycast/build/outputs/apk/release/
rclone copy shell/android-studio/flycast/build/outputs/apk/release scaleway:flycast-builds/android/${GITHUB_REF#refs/}-$GITHUB_SHA --exclude '*.json'
if: github.repository == 'flyinghead/flycast' && github.event_name == 'push'
- uses: getsentry/action-setup-cli@v1
- name: Upload symbols to Sentry
run: |
VERSION=$(git describe --tags --always)
sentry-cli releases new "$VERSION"
sentry-cli releases set-commits "$VERSION" --auto
sentry-cli debug-files upload symbols
shell: bash
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_TOKEN }}
SENTRY_ORG: flycast
SENTRY_PROJECT: minidump
if: ${{ env.SENTRY_AUTH_TOKEN != '' && github.event_name == 'push' }}
+60
View File
@@ -0,0 +1,60 @@
name: BSD
on:
push:
branches-ignore:
- 'l10n_**'
pull_request:
jobs:
build:
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
runs-on: ubuntu-latest
strategy:
matrix:
operating_system: [ freebsd, netbsd, openbsd ]
architecture: [ arm64, x86-64 ]
libretro: [ OFF, ON ]
include:
- operating_system: freebsd
version: '15.1'
pkginstall: sudo pkg upgrade -y && sudo pkg install -y alsa-lib ccache cmake evdev-proto git libao libcdio libevdev libudev-devd libzip lua54 miniupnpc ninja pkgconf pulseaudio sdl2
- operating_system: netbsd
version: '11.0'
pkginstall: sudo pkgin update && sudo pkgin -y install alsa-lib ccache clang cmake git libao libcdio libusb1 libzip lua54 miniupnpc ninja-build pkgconf pulseaudio SDL2
- operating_system: openbsd
version: '7.9'
pkginstall: sudo pkg_add -u && sudo pkg_add ccache cmake git libao libcdio libusb1-1.0.29 libzip lua-5.4.8p0 miniupnpc ninja pulseaudio sdl2
exclude:
- architecture: arm64
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
submodules: recursive
- uses: actions/cache@v6
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ matrix.operating_system }}-${{ matrix.architecture }}-${{ matrix.libretro }}-${{ github.sha }}
restore-keys: ccache-${{ matrix.operating_system }}-${{ matrix.architecture }}-${{ matrix.libretro }}-
- name: Start VM
uses: cross-platform-actions/action@v1
with:
operating_system: ${{ matrix.operating_system }}
architecture: ${{ matrix.architecture }}
version: ${{ matrix.version }}
environment_variables: CCACHE_DIR
- name: Set up build environment
run: ${{ matrix.pkginstall }}
shell: cpa.sh {0}
- name: CMake
run: |
cmake -B build -DUSE_LIBCDIO=ON -DCMAKE_BUILD_TYPE=Release -G Ninja -DLIBRETRO=${{ matrix.libretro }}
cmake --build build --config Release
shell: cpa.sh {0}
+168 -60
View File
@@ -1,103 +1,211 @@
name: C/C++ CI
name: Linux, macOS, Windows
on: [push, pull_request]
on:
push:
branches-ignore:
- 'l10n_**'
pull_request:
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
defaults:
run:
shell: ${{ matrix.config.shell }}
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
strategy:
matrix:
config:
- {name: i686-pc-windows-msvc, os: windows-latest, cmakeArgs: -DCMAKE_SYSTEM_VERSION="10.0.18362.0" -G "Visual Studio 16 2019" -A Win32}
- {name: x86_64-apple-darwin, os: macos-latest, cmakeArgs: -G "Xcode", destDir: osx}
- {name: x86_64-pc-linux-gnu, os: ubuntu-latest}
- {name: x86_64-pc-windows-msvc, os: windows-latest, cmakeArgs: -DCMAKE_SYSTEM_VERSION="10.0.18362.0" -G "Visual Studio 16 2019" -A x64}
- {name: x86_64-w64-mingw32, os: windows-latest, cmakeArgs: -G "MinGW Makefiles", destDir: win}
- { name: i686-pc-windows-msvc, os: windows-2022, shell: cmd, arch: x86, cmakeArgs: -G Ninja, buildType: Release }
- { name: apple-darwin, os: macos-latest, shell: sh, cmakeArgs: -G Xcode -DUSE_DISCORD=ON -DMOLTENVK_DYLIB=$MOLTENVK_DYLIB, destDir: osx, buildType: RelWithDebInfo, packagePath: artifact/flycast-apple-darwin.zip }
- { name: x86_64-pc-linux-gnu, os: ubuntu-22.04, shell: sh, cmakeArgs: -G Ninja -DUSE_DISCORD=ON -DUSE_LIBCDIO=ON, destDir: linux, buildType: RelWithDebInfo }
- { name: x86_64-pc-windows-msvc, os: windows-2022, shell: cmd, arch: x64, cmakeArgs: -G Ninja -DUSE_DISCORD=ON, buildType: Release }
- { name: x86_64-w64-mingw32, os: windows-2022, shell: 'msys2 {0}', cmakeArgs: -G Ninja -DUSE_DISCORD=ON -DUSE_LIBCDIO=ON, destDir: win, buildType: RelWithDebInfo, packagePath: artifact/flycast-x86_64-w64-mingw32.zip }
- { name: libretro-x86_64-pc-linux-gnu, os: ubuntu-22.04, shell: sh, cmakeArgs: -DLIBRETRO=ON -DUSE_LIBCDIO=ON -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE -G Ninja, buildType: Release }
- { name: libretro-x86_64-w64-mingw32, os: windows-2022, shell: 'msys2 {0}', cmakeArgs: -DLIBRETRO=ON -DUSE_LIBCDIO=ON -G Ninja, buildType: Release }
steps:
- name: Set up build environment (macos-latest)
- name: Set up build environment (macOS)
run: |
brew install ccache flac libao libomp pulseaudio zlib
echo "/usr/local/opt/ccache/libexec" >> $GITHUB_PATH
echo "CCACHE_DIR=/tmp/ccache" >> $GITHUB_ENV
if: matrix.config.os == 'macos-latest'
# Unlink and re-link to prevent errors when github mac runner images install python outside of brew. See https://github.com/actions/setup-python/issues/577
brew list -1 | grep python | while read formula; do brew unlink $formula; brew link --overwrite $formula; done
brew update || :
brew install libao ldid pulseaudio
brew uninstall --ignore-dependencies zstd
- name: Set up build environment (ubuntu-latest)
moltenvk_tag="v1.4.2"
moltenvk_root="$RUNNER_TEMP/MoltenVK-$moltenvk_tag"
rm -rf "$moltenvk_root"
mkdir -p "$moltenvk_root"
aria2c "https://github.com/KhronosGroup/MoltenVK/releases/download/$moltenvk_tag/MoltenVK-macos.tar" -d "$RUNNER_TEMP" -o "MoltenVK-macos-$moltenvk_tag.tar"
tar -xf "$RUNNER_TEMP/MoltenVK-macos-$moltenvk_tag.tar" -C "$moltenvk_root"
moltenvk_dylib="$(find "$moltenvk_root" -type f -path '*/macOS/*' -name libMoltenVK.dylib | head -n 1)"
if [ -z "$moltenvk_dylib" ]; then
echo "MoltenVK $moltenvk_tag was downloaded, but macOS libMoltenVK.dylib was not found." >&2
exit 1
fi
echo "MOLTENVK_DYLIB=$moltenvk_dylib" >> $GITHUB_ENV
if: runner.os == 'macOS'
- name: Set up build environment (Linux)
run: |
sudo add-apt-repository ppa:christianrauch/libdecoration
sudo apt-get update
sudo apt-get -y install ccache libao-dev libasound2-dev libevdev-dev libflac-dev libgl1-mesa-dev libpulse-dev libsdl2-dev libudev-dev libzip-dev libminiupnpc-dev
echo "CCACHE_DIR=/tmp/ccache" >> $GITHUB_ENV
if: matrix.config.os == 'ubuntu-latest'
sudo apt-get -y install ccache libao-dev libasound2-dev libevdev-dev libgl1-mesa-dev liblua5.3-dev libminiupnpc-dev libpulse-dev libsdl2-dev libudev-dev libzip-dev libcurl4-openssl-dev libcdio-dev libfuse2 locales
sudo apt-get -y install libwayland-dev libdecor-0-dev libaudio-dev libjack-dev libsndio-dev libsamplerate0-dev libx11-dev libxext-dev libxrandr-dev libxcursor-dev libxfixes-dev libxi-dev libxss-dev libxkbcommon-dev libdrm-dev libgbm-dev libgles2-mesa-dev libegl1-mesa-dev libdbus-1-dev libibus-1.0-dev libudev-dev fcitx-libs-dev
sudo sed -i 's/# fr_FR.UTF-8 UTF-8/fr_FR.UTF-8 UTF-8/g' /etc/locale.gen
sudo locale-gen
if: runner.os == 'Linux'
- uses: actions/cache@v2
- name: Set up build environment (Windows, MinGW)
uses: msys2/setup-msys2@v2
with:
path: /tmp/ccache
key: ccache-${{ matrix.config.os }}-${{ github.sha }}
restore-keys: ccache-${{ matrix.config.os }}-
if: matrix.config.os != 'windows-latest'
msystem: MINGW64
install: git make
pacboy: ccache:p cmake:p libcdio:p lua:p ninja:p SDL2:p toolchain:p
if: matrix.config.shell == 'msys2 {0}'
- uses: actions/checkout@v2
- name: Set up build environment (Windows, Visual Studio)
run: |
choco install ccache directx-sdk
echo DXSDK_DIR=C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)>> %GITHUB_ENV%
if: matrix.config.shell == 'cmd'
- uses: ilammy/msvc-dev-cmd@v1
with:
arch: ${{ matrix.config.arch }}
if: matrix.config.shell == 'cmd'
- uses: actions/checkout@v7
with:
fetch-depth: 0
submodules: recursive
- name: Create artifact directory
run: mkdir -p build/artifact
- name: Build SDL (macos-latest)
- name: Compile universal dependencies (macOS)
run: |
cd shell/apple
mkdir artifacts
brew install --build-from-source ./sdl2.rb
if: matrix.config.os == 'macos-latest'
for formula in ./shell/apple/libomp.rb ./shell/apple/libpng-flycast.rb; do
libname=$(basename "$formula" .rb)
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 HOMEBREW_DEVELOPER=1 brew install --build-from-source --formula "$formula" || \
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 HOMEBREW_DEVELOPER=1 brew reinstall --build-from-source --formula "$formula"
prefix=$(brew --prefix $libname)
# Find and verify the static library
libfile=$(find "$prefix/lib" -name "*.a" | head -n1)
lipo -info "$libfile"
# Export prefix for subsequent CMake steps
if [ -z "$CMAKE_PREFIX_PATH" ]; then
CMAKE_PREFIX_PATH="$prefix"
else
CMAKE_PREFIX_PATH="$CMAKE_PREFIX_PATH:$prefix"
fi
done
echo "CMAKE_PREFIX_PATH=$CMAKE_PREFIX_PATH" >> $GITHUB_ENV
if: matrix.config.name == 'apple-darwin'
- uses: actions/cache@v6
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-${{ matrix.config.name }}-${{ github.sha }}
restore-keys: ccache-${{ matrix.config.name }}-
if: runner.os != 'macOS'
- name: CMake
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=artifact ${{ matrix.config.cmakeArgs }}
cmake --build build --config Release --parallel 2
cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.config.buildType }} -DCMAKE_INSTALL_PREFIX=artifact ${{ matrix.config.cmakeArgs }} -DSENTRY_UPLOAD_URL=${{ env.SENTRY_UPLOAD_URL }}
cmake --build build --config ${{ matrix.config.buildType }} --target install
env:
SENTRY_UPLOAD_URL: ${{ secrets.SENTRY_UPLOAD_URL }}
- name: Unit Tests
run: |
mkdir -p build/tests
cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE=tests -DENABLE_CTEST=ON ${{ matrix.config.cmakeArgs }}
cmake --build build --config Release --parallel 2
./build/tests/flycast
cmake -B build -DCMAKE_BUILD_TYPE=${{ matrix.config.buildType }} -DCMAKE_INSTALL_PREFIX=artifact -DENABLE_CTEST=ON ${{ matrix.config.cmakeArgs }}
cmake --build build --config ${{ matrix.config.buildType }}
./build/flycast
if: matrix.config.name == 'x86_64-pc-linux-gnu'
- uses: actions/upload-artifact@v2
with:
name: flycast-${{ matrix.config.name }}
path: build/artifact
- name: Dump symbols
run: |
mkdir -p symbols
core/deps/breakpad/bin/dump_syms artifact/bin/flycast.exe > symbols/flycast.sym 2>/dev/null
strip artifact/bin/flycast.exe
if: matrix.config.name == 'x86_64-w64-mingw32'
- name: Build breakpad (linux)
working-directory: core/deps/breakpad
run: |
./configure
make
sudo make install
if: matrix.config.name == 'x86_64-pc-linux-gnu'
- name: Dump symbols and make AppImage (linux)
run: |
mkdir -p symbols
dump_syms artifact/bin/flycast > symbols/flycast.sym 2>/dev/null
strip artifact/bin/flycast
shell/linux/make-appimage.sh . artifact/bin appimage
mv flycast-x86_64.AppImage artifact/bin
rm artifact/bin/flycast
if: matrix.config.name == 'x86_64-pc-linux-gnu'
- name: Package app (macos)
run: |
cd build/artifact
rm -rf Flycast.swiftmodule
zip -r flycast.app.zip Flycast.app
rm -rf Flycast.app
if: matrix.config.os == 'macos-latest'
cd artifact/bin
codesign --verify --deep --strict --all-architectures --verbose=4 Flycast.app
zip -rm flycast.app.zip Flycast.app
cp flycast.app.zip "../../${{ matrix.config.packagePath }}"
if: matrix.config.name == 'apple-darwin'
- name: Package app (windows)
run: |
powershell Compress-Archive build/artifact/flycast.exe build/artifact/flycast.zip
rm build/artifact/flycast.exe
powershell Compress-Archive artifact/bin/flycast.exe artifact/bin/flycast.zip
rm artifact/bin/flycast.exe
cp artifact/bin/flycast.zip "${{ matrix.config.packagePath }}"
if: matrix.config.name == 'x86_64-w64-mingw32'
- name: Set up git vars
run: |
echo GIT_BUILD=`git describe --all --always | sed 's/remotes\/origin/heads/'`-$GITHUB_SHA >> $GITHUB_ENV
shell: bash
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
- uses: actions/upload-artifact@v7
with:
aws-access-key-id: AKIAJOZQS4H2PHQWYFCA
aws-secret-access-key: ${{ secrets.S3_SECRET_KEY }}
aws-region: us-east-2
if: github.event_name == 'push'
name: flycast-${{ matrix.config.name }}
archive: ${{ !matrix.config.packagePath }}
path: |
${{ matrix.config.packagePath || 'artifact/bin' }}
${{ !matrix.config.packagePath && 'artifact/lib/libretro' || '' }}
- name: Setup Rclone
uses: AnimMouse/setup-rclone@v1
with:
rclone_config: ${{ secrets.RCLONE_CONFIG }}
- name: Upload to S3
run: aws s3 sync build/artifact s3://flycast-builds/${{ matrix.config.destDir }}/${{ env.GIT_BUILD }} --acl public-read --follow-symlinks
if: github.event_name == 'push' && matrix.config.destDir != ''
run: rclone copy artifact/bin scaleway:flycast-builds/${{ matrix.config.destDir }}/${GITHUB_REF#refs/}-$GITHUB_SHA
shell: bash
if: github.repository == 'flyinghead/flycast' && github.event_name == 'push' && matrix.config.destDir != ''
- name: Setup Sentry CLI
uses: mathieu-bour/setup-sentry-cli@v2
env:
SENTRY_TOKEN: ${{ secrets.SENTRY_TOKEN }}
with:
url: https://sentry.io
token: ${{ env.SENTRY_TOKEN }}
organization: flycast
project: minidump
version: 2.21.2
if: ${{ env.SENTRY_TOKEN != '' }}
- name: Upload symbols to Sentry (Windows, macOS, Linux)
run: |
VERSION=$(git describe --tags --always)
sentry-cli releases new "$VERSION"
sentry-cli releases set-commits "$VERSION" --auto
sentry-cli debug-files upload symbols
shell: bash
env:
SENTRY_TOKEN: ${{ secrets.SENTRY_TOKEN }}
if: ${{ env.SENTRY_TOKEN != '' && (matrix.config.name == 'x86_64-w64-mingw32' || matrix.config.name == 'apple-darwin' || matrix.config.name == 'x86_64-pc-linux-gnu') && github.event_name == 'push' }}
+36
View File
@@ -0,0 +1,36 @@
# Prepare source texts & upload them to Crowdin
name: Crowdin Source Texts Upload
# on change to the English texts
on:
push:
branches:
- master
paths:
- 'shell/libretro/libretro_core_options.h'
jobs:
upload_source_file:
runs-on: ubuntu-latest
steps:
- name: Setup Java JDK
uses: actions/setup-java@v5
with:
java-version: 18
distribution: zulu
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Checkout
uses: actions/checkout@v6
- name: Upload Source
shell: bash
env:
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
run: |
python3 intl/upload_workflow.py $CROWDIN_API_KEY "flyinghead-flycast" "shell/libretro/libretro_core_options.h"
+49
View File
@@ -0,0 +1,49 @@
# Download translations form Crowdin & Recreate libretro_core_options_intl.h
name: Crowdin Translation Integration
on:
schedule:
# please choose a random time & weekday to avoid all repos synching at the same time
- cron: '15 22 * * 5' # Fridays at 10:15 PM, UTC
jobs:
create_intl_file:
runs-on: ubuntu-latest
steps:
- name: Setup Java JDK
uses: actions/setup-java@v5
with:
java-version: 18
distribution: zulu
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: '3.10'
- name: Checkout
uses: actions/checkout@v6
with:
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal access token.
fetch-depth: 0 # otherwise, there would be errors pushing refs to the destination repository.
- name: Create intl file
shell: bash
env:
CROWDIN_API_KEY: ${{ secrets.CROWDIN_API_KEY }}
run: |
python3 intl/download_workflow.py $CROWDIN_API_KEY "flyinghead-flycast" "shell/libretro/libretro_core_options_intl.h"
- name: Commit files
run: |
git config --local user.email "[email protected]"
git config --local user.name "github-actions[bot]"
git add intl/*_workflow.py "shell/libretro/libretro_core_options_intl.h"
git commit -m "Fetch translations & Recreate libretro_core_options_intl.h"
- name: GitHub Push
uses: ad-m/github-push-action@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
+67
View File
@@ -0,0 +1,67 @@
name: Nintendo Switch
on:
push:
branches-ignore:
- 'l10n_**'
pull_request:
jobs:
build:
name: Switch ${{ matrix.config.name }}
runs-on: ubuntu-latest
container: devkitpro/devkita64:latest
env:
CCACHE_DIR: ${{ github.workspace }}/.ccache
strategy:
matrix:
config:
- { name: standalone, destDir: switch }
- { name: libretro, cmakeArgs: -DLIBRETRO=ON }
steps:
- name: Set up build environment
run: |
sudo apt-get update
sudo apt-get -y install ccache gh
- uses: actions/checkout@v7
with:
fetch-depth: 0
submodules: recursive
- name: Mark git repository as safe
run: git config --global --add safe.directory $PWD
- uses: actions/cache@v6
with:
path: ${{ env.CCACHE_DIR }}
key: ccache-switch-${{ matrix.config.name }}-${{ github.sha }}
restore-keys: ccache-switch-${{ matrix.config.name }}-
- name: CMake
run: |
$DEVKITPRO/portlibs/switch/bin/aarch64-none-elf-cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=artifact -G Ninja ${{ matrix.config.cmakeArgs }}
cmake --build build --config Release --target install
- uses: actions/upload-artifact@v7
with:
name: flycast-switch-${{ matrix.config.name }}
path: |
artifact/bin
artifact/lib/libretro
- name: Package app
run: zip -m artifact/bin/flycast.nro.zip artifact/bin/flycast.nro
if: hashFiles('artifact/bin/flycast.nro') != ''
- name: Setup Rclone
uses: AnimMouse/setup-rclone@v1
with:
rclone_config: ${{ secrets.RCLONE_CONFIG }}
- name: Upload to S3
run: rclone copy artifact/bin scaleway:flycast-builds/${{ matrix.config.destDir }}/${GITHUB_REF#refs/}-$GITHUB_SHA
if: github.repository == 'flyinghead/flycast' && github.event_name == 'push' && matrix.config.destDir != ''
+59
View File
@@ -0,0 +1,59 @@
name: Xbox, UWP
on:
push:
branches-ignore:
- 'l10n_**'
pull_request:
jobs:
build:
name: UWP
runs-on: windows-2022
strategy:
matrix:
arch: [ Win32, x64, ARM64 ]
steps:
- uses: actions/checkout@v7
with:
fetch-depth: 0
submodules: recursive
- name: CMake
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release -G "Visual Studio 17 2022" -A ${{ matrix.arch }} -DCMAKE_SYSTEM_NAME=WindowsStore -DCMAKE_SYSTEM_VERSION=10.0.22000.0
cmake --build build --config Release -- /m
shell: cmd
- uses: ilammy/msvc-dev-cmd@v1
- name: Package app
run: |
mkdir build\artifact
cd build\AppPackages\flycast\flycast_*_Test
mkdir tmp
ren *.msix flycast.msix
makeappx unpack /p .\flycast.msix /d tmp
copy ..\..\..\Release\*.dll tmp
makeappx pack /d tmp /p ..\..\..\artifact\flycast.appx
- name: Sign app
run: signtool sign /f shell\uwp\sign_cert.pfx /p '${{ secrets.SIGN_CERT_PWD }}' /v /fd SHA256 build\artifact\flycast.appx
if: github.repository == 'flyinghead/flycast' && github.event_name == 'push'
- uses: actions/upload-artifact@v7
with:
name: flycast-uwp-${{ matrix.arch }}
path: build/artifact
- name: Setup Rclone
uses: AnimMouse/setup-rclone@v1
with:
rclone_config: ${{ secrets.RCLONE_CONFIG }}
- name: Upload to S3
run: rclone copy build/artifact scaleway:flycast-builds/xbox/${GITHUB_REF#refs/}-$GITHUB_SHA
shell: bash
if: github.repository == 'flyinghead/flycast' && github.event_name == 'push' && matrix.arch == 'x64'
+14 -58
View File
@@ -1,66 +1,22 @@
.DS_Store
*.class
*.orig
*build_obj
Workdir/data
Workdir/reicast*
Workdir/vmu*
Workdir/webui*
Workdir/emu.cfg
Workdir/lib*ant.properties
build/
artifact/
# iOS General
# macOS
.DS_Store
*/build/*
**/build/*
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3
xcuserdata
profile
*.moved-aside
DerivedData
*.hmap
emulator.xccheckout
reicast.xccheckout
build/*
*.so
*Karen_angelXwind*
local.properties
ant.properties
*build_obj
*.d
Workdir/data
Workdir/reicast*
Workdir/vmu*
Workdir/webui*
Workdir/emu.cfg
Workdir/lib*ant.properties
reicast-ios.xccheckout
# Linux General
shell/linux/.map
shell/linux/flycast.elf.map
shell/linux/nosym-flycast.elf
shell/linux/flycast.elf
shell/linux/dispframe.elf
shell/apple/emulator-ios/OpenMP/OpenMP.xcframework
# Visual Studio
generated
.vs
# Android Studio
*.iml
shell/android-studio/.gradle/
shell/android-studio/flycast/.cxx/
shell/android-studio/flycast/build/
shell/android-studio/flycast/local.properties
.vs/
.vscode/
out/
# JetBrains IDES
.idea/
cmake-build-*/
# Dependencies from .gitmodules
core/deps/breakpad/
core/deps/glslang/
.cache/
compile_commands.json
CMakeUserPresets.json
+229
View File
@@ -0,0 +1,229 @@
# DESCRIPTION: GitLab CI/CD for libRetro (NOT FOR GitLab-proper)
##############################################################################
################################# BOILERPLATE ################################
##############################################################################
# Core definitions
.core-defs:
variables:
GIT_SUBMODULE_STRATEGY: recursive
CORENAME: flycast
CORE_ARGS: -DLIBRETRO=ON -DUSE_LIBCDIO=ON
.core-defs-linux:
extends: .core-defs
variables:
CORE_ARGS: -DLIBRETRO=ON -DUSE_LIBCDIO=ON -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
.core-defs-osx-x64:
extends: .core-defs
variables:
CORE_ARGS: -DLIBRETRO=ON -G Xcode -DCMAKE_OSX_ARCHITECTURES=x86_64
EXTRA_PATH: Release
.core-defs-osx-arm64:
extends: .core-defs
variables:
CORE_ARGS: -DLIBRETRO=ON -G Xcode
EXTRA_PATH: Release
.core-defs-ios-arm64:
extends: .core-defs
variables:
CORE_ARGS: -DLIBRETRO=ON -DUSE_OPENMP=OFF -DCMAKE_OSX_DEPLOYMENT_TARGET=13.0
IOS_MINVER: 13.0
MINVER: 13.0
.core-defs-libnx:
extends: .core-defs
variables:
CORE_ARGS: -DLIBRETRO=ON -DUSE_OPENMP=OFF
.core-defs-android:
extends: .core-defs
script:
- echo y | /android-sdk-linux/cmdline-tools/latest/bin/sdkmanager "ndk;${ANDROID_NDK_VERSION}"
- cmake -DLIBRETRO=ON -DUSE_OPENMP=OFF -DANDROID_PLATFORM=android-$API_LEVEL -DCMAKE_TOOLCHAIN_FILE=$NDK_ROOT/build/cmake/android.toolchain.cmake -DANDROID_STL=c++_static -DANDROID_ABI=$ANDROID_ABI -DANDROID_ARM_MODE=arm -DANDROID_WEAK_API_DEFS=ON "$CMAKE_SOURCE_ROOT" -B$BUILD_DIR
- cmake --build $BUILD_DIR --target ${CORENAME}_libretro --config Release -- -j $NUMPROC
- mv $BUILD_DIR/${CORENAME}_libretro.so $LIBNAME
- if [ $STRIP_CORE_LIB -eq 1 ]; then $NDK_ROOT/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip $LIBNAME; fi
variables:
ANDROID_NDK_VERSION: 29.0.14206865
API_LEVEL: 21
NDK_ROOT: /android-sdk-linux/ndk/$ANDROID_NDK_VERSION
# Inclusion templates, required for the build to work
include:
################################## DESKTOPS ################################
# Windows
- project: 'libretro-infrastructure/ci-templates'
file: '/windows-cmake-mingw.yml'
# MacOS
- project: 'libretro-infrastructure/ci-templates'
file: 'osx-cmake-x86.yml'
# MacOS arm64
- project: 'libretro-infrastructure/ci-templates'
file: 'osx-cmake-arm64.yml'
# Linux
- project: 'libretro-infrastructure/ci-templates'
file: '/linux-cmake.yml'
################################## CELLULAR ################################
# Android
- project: 'libretro-infrastructure/ci-templates'
file: '/android-cmake.yml'
# iOS arm64
- project: 'libretro-infrastructure/ci-templates'
file: '/ios-cmake.yml'
################################## CONSOLES ################################
# Nintendo Switch
- project: 'libretro-infrastructure/ci-templates'
file: '/libnx-static-cmake.yml'
# tvOS arm64
- project: 'libretro-infrastructure/ci-templates'
file: '/tvos-cmake.yml'
#################################### MISC ##################################
# webOS 32-bit (LGTV)
- project: 'libretro-infrastructure/ci-templates'
file: '/webos-cmake.yml'
# Stages for building
stages:
- build-prepare
- build-shared
- build-static
##############################################################################
#################################### STAGES ##################################
##############################################################################
#
################################### DESKTOPS #################################
# Windows 64-bit
libretro-build-windows-x64:
extends:
- .libretro-windows-cmake-x86_64
- .core-defs
# Windows 32-bit
libretro-build-windows-i686:
extends:
- .libretro-windows-cmake-x86
- .core-defs
# Linux 64-bit
libretro-build-linux-x64:
extends:
- .libretro-linux-cmake-x86_64
- .core-defs-linux
image: $CI_SERVER_HOST:5050/libretro-infrastructure/libretro-build-amd64-ubuntu:backports
# Linux 32-bit
libretro-build-linux-i686:
extends:
- .libretro-linux-cmake-x86
- .core-defs-linux
image: $CI_SERVER_HOST:5050/libretro-infrastructure/libretro-build-i386-ubuntu:backports
# Linux 64-bit (ARM)
libretro-build-linux-aarch64:
extends:
- .libretro-linux-cmake-aarch64
- .core-defs-linux
# MacOS 64-bit
libretro-build-osx-x64:
extends:
- .libretro-osx-cmake-x86
- .core-defs-osx-x64
tags:
- mac-apple-silicon
# MacOS arm 64-bit
libretro-build-osx-arm64:
extends:
- .libretro-osx-cmake-arm64
- .core-defs-osx-arm64
################################### CELLULAR #################################
# Android ARMv7a
android-armeabi-v7a:
extends:
- .libretro-android-cmake-armeabi-v7a
- .core-defs-android
# Android ARMv8a
android-arm64-v8a:
extends:
- .libretro-android-cmake-arm64-v8a
- .core-defs-android
# Android 64-bit x86
android-x86_64:
extends:
- .libretro-android-cmake-x86_64
- .core-defs-android
# Android 32-bit x86
android-x86:
extends:
- .libretro-android-cmake-x86
- .core-defs-android
libretro-build-ios-arm64:
extends:
- .libretro-ios-cmake-arm64
- .core-defs-ios-arm64
################################### CONSOLES #################################
# Nintendo Switch
libretro-build-libnx-aarch64:
extends:
- .libretro-libnx-static-cmake-retroarch-master
- .core-defs-libnx
# The libnx image ships CMake 3.18.4 and this tree asks for 3.22.1, so the
# job stops at configure. Put a newer one in front of it - in /tmp, since
# the job does not run as a user who can write /opt.
before_script:
- !reference [.libretro-libnx-static-cmake, before_script]
- |
CMAKE_VER=3.31.6
curl -sSL "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VER}/cmake-${CMAKE_VER}-linux-x86_64.tar.gz" | tar -xz -C /tmp
export PATH="/tmp/cmake-${CMAKE_VER}-linux-x86_64/bin:$PATH"
# The template's script, with one word changed. It builds --target
# ${CORENAME}_libretro, and on Switch that target is flycast's own objects
# and nothing else. `combined` is the target CMakeLists.txt defines for
# exactly this case: it folds in xxhash, chdr, zip, elf and the resources,
# which is what RetroArch links against afterwards.
script:
- cmake $CORE_ARGS "$CMAKE_SOURCE_ROOT" -B$BUILD_DIR -DCMAKE_BUILD_TYPE=Release -DLIBRETRO_STATIC=ON -DLIBRETRO_SUFFIX=_libnx -DCMAKE_TOOLCHAIN_FILE=/opt/devkitpro/cmake/Switch.cmake -DNSWITCH=ON -DCFLAGS=-DHAVE_LIBNX=1 -DCXXFLAGS=-DHAVE_LIBNX=1
- cmake --build $BUILD_DIR --target combined --config Release -- -j $NUMPROC
- mv $BUILD_DIR/$EXTRA_PATH/${CORENAME}_libretro_libnx.a retroarch-precompiled/libretro_libnx.a
- cd retroarch-precompiled/
- make -f Makefile.libnx -j10
- mv retroarch_switch.nro ../${CORENAME}_libretro_libnx.nro
- mv retroarch_switch.elf ../${CORENAME}_libretro_libnx.elf
- cd ../
# tvOS arm64
libretro-build-tvos-arm64:
extends:
- .libretro-tvos-cmake-arm64
- .core-defs-ios-arm64
#################################### MISC ##################################
# webOS 32-bit
libretro-build-webos-armv7a:
extends:
- .libretro-webos-armv7a-cmake
- .core-defs
+62 -1
View File
@@ -3,4 +3,65 @@
url = https://github.com/libsdl-org/SDL.git
[submodule "core/deps/libchdr"]
path = core/deps/libchdr
url = https://github.com/rtissera/libchdr.git
url = https://github.com/flyinghead/libchdr.git
ignore = dirty
[submodule "core/deps/luabridge"]
path = core/deps/luabridge
url = https://github.com/vinniefalco/LuaBridge.git
[submodule "core/deps/breakpad"]
path = core/deps/breakpad
url = https://github.com/flyinghead/mingw-breakpad
[submodule "core/deps/Vulkan-Headers"]
path = core/deps/Vulkan-Headers
url = https://github.com/KhronosGroup/Vulkan-Headers.git
[submodule "core/deps/VulkanMemoryAllocator"]
path = core/deps/VulkanMemoryAllocator
url = https://github.com/GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator.git
[submodule "core/deps/glslang"]
path = core/deps/glslang
url = https://github.com/KhronosGroup/glslang.git
[submodule "core/deps/oboe"]
path = core/deps/oboe
url = https://github.com/google/oboe.git
[submodule "core/deps/Syphon"]
path = core/deps/Syphon
url = https://github.com/vkedwardli/Syphon-Framework.git
[submodule "core/deps/Spout"]
path = core/deps/Spout
url = https://github.com/vkedwardli/Spout2.git
[submodule "core/deps/discord-rpc"]
path = core/deps/discord-rpc
url = https://github.com/harmonytf/discord-rpc
[submodule "core/deps/libadrenotools"]
path = core/deps/libadrenotools
url = https://github.com/bylaws/libadrenotools
[submodule "core/deps/rcheevos"]
path = core/deps/rcheevos
url = https://github.com/RetroAchievements/rcheevos.git
[submodule "core/deps/googletest"]
path = core/deps/googletest
url = https://github.com/google/googletest.git
[submodule "core/deps/asio"]
path = core/deps/asio
url = https://github.com/flyinghead/asio.git
[submodule "core/deps/xbyak"]
path = core/deps/xbyak
url = https://github.com/herumi/xbyak.git
[submodule "core/deps/libjuice"]
path = core/deps/libjuice
url = https://github.com/paullouisageneau/libjuice.git
[submodule "core/deps/websocketpp"]
path = core/deps/websocketpp
url = https://github.com/zaphoyd/websocketpp.git
[submodule "core/deps/DreamPicoPort-API"]
path = core/deps/DreamPicoPort-API
url = https://github.com/OrangeFox86/DreamPicoPort-API.git
[submodule "core/deps/tinygettext"]
path = core/deps/tinygettext
url = https://github.com/flyinghead/tinygettext
[submodule "core/deps/freetype"]
path = core/deps/freetype
url = https://gitlab.freedesktop.org/freetype/freetype.git
[submodule "core/deps/gamesdk"]
path = core/deps/gamesdk
url = https://github.com/flyinghead/gamesdk.git
+1413 -808
View File
File diff suppressed because it is too large. Load diff
+23
View File
@@ -0,0 +1,23 @@
{
"version": 2,
"configurePresets": [
{
"name": "clang",
"generator": "Ninja",
"binaryDir": "build-clang",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
}
},
{
"name": "gcc",
"generator": "Ninja",
"binaryDir": "build-gcc",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON"
}
}
]
}
+86 -15
View File
@@ -1,36 +1,107 @@
# Flycast
[![C/C++ CI](https://github.com/flyinghead/flycast/actions/workflows/c-cpp.yml/badge.svg)](https://github.com/flyinghead/flycast/actions/workflows/c-cpp.yml)
[![Android CI](https://github.com/flyinghead/flycast/actions/workflows/android.yml/badge.svg)](https://github.com/flyinghead/flycast/actions/workflows/android.yml)
[![C/C++ CI](https://github.com/flyinghead/flycast/actions/workflows/c-cpp.yml/badge.svg)](https://github.com/flyinghead/flycast/actions/workflows/c-cpp.yml)
[![Nintendo Switch CI](https://github.com/flyinghead/flycast/actions/workflows/switch.yml/badge.svg)](https://github.com/flyinghead/flycast/actions/workflows/switch.yml)
[![Windows UWP CI](https://github.com/flyinghead/flycast/actions/workflows/uwp.yml/badge.svg)](https://github.com/flyinghead/flycast/actions/workflows/uwp.yml)
[![BSD CI](https://github.com/flyinghead/flycast/actions/workflows/bsd.yml/badge.svg)](https://github.com/flyinghead/flycast/actions/workflows/bsd.yml)
![flycast logo](https://github.com/flyinghead/flycast/raw/master/shell/linux/flycast.png)
<img src="shell/linux/flycast.png" alt="flycast logo" width="150"/>
**Flycast** is a multi-platform Sega Dreamcast, Naomi and Atomiswave emulator derived from [**reicast**](https://reicast.com/).
**Flycast** is a multi-platform Sega Dreamcast, Naomi, Naomi 2, and Atomiswave emulator derived from [**reicast**](https://github.com/skmp/reicast-emulator).
Information about configuration and supported features can be found on [**TheArcadeStriker's flycast wiki**](https://github.com/TheArcadeStriker/flycast-wiki/wiki).
Join us on our [**Discord server**](https://discord.gg/X8YWP8w) for a chat.
Join us on our [**Discord server**](https://discord.gg/X8YWP8w) for a chat.
## Downloads ![android](https://flyinghead.github.io/flycast-builds/android.jpg) ![windows](https://flyinghead.github.io/flycast-builds/windows.png) ![linux](https://flyinghead.github.io/flycast-builds/ubuntu.png) ![apple](https://flyinghead.github.io/flycast-builds/apple.png) ![switch](https://flyinghead.github.io/flycast-builds/switch.png) ![xbox](https://flyinghead.github.io/flycast-builds/xbox.png)
Get builds for your system from the [**builds page**](https://flyinghead.github.io/flycast-builds/) or [**GitHub Releases**](https://github.com/flyinghead/flycast/releases).
- **Latest master builds:** regular builds from the `master` branch with recent fixes and updates.
- **Nightly dev builds:** experimental builds with the latest features and changes.
- **Stable tagged releases:** versioned release builds published on GitHub Releases.
Automated test results are available from the builds page as well.
## Install
### Flatpak
### Android ![android](https://flyinghead.github.io/flycast-builds/android.jpg)
1. [Set up Flatpak](https://www.flatpak.org/setup/)
&emsp;Install Flycast from [**Google Play**](https://play.google.com/store/apps/details?id=com.flycast.emulator).
2. Install Flycast from [Flathub](https://flathub.org/apps/details/org.flycast.Flycast)
### Flatpak (Linux ![ubuntu logo](https://flyinghead.github.io/flycast-builds/ubuntu.png))
`flatpak install -y org.flycast.Flycast`
1. [Set up Flatpak](https://www.flatpak.org/setup/).
3. Run Flycast
2. Install Flycast from [Flathub](https://flathub.org/apps/details/org.flycast.Flycast):
`flatpak run org.flycast.Flycast`
&emsp;`flatpak install -y org.flycast.Flycast`
### Binaries
3. Run Flycast:
Get fresh builds for your system [on the builds page](https://flyinghead.github.io/flycast-builds/).
&emsp;`flatpak run org.flycast.Flycast`
**New:** Now automated test results are available as well.
### Homebrew (macOS ![apple logo](https://flyinghead.github.io/flycast-builds/apple.png))
## Disclaimer
1. [Set up Homebrew](https://brew.sh) or run `brew update` if already installed.
All code contritbuted to this fork is *not* bound by the Individual Contributor License Agreement of the upstream repository (https://github.com/reicast/reicast-emulator) and shall *not* be considered as a contribution to the upstream repository.
2. Choose one channel:
| Channel | Install command |
| -------------------- | ------------------------------------------------------- |
| Master (recommended) | `brew install --cask flyinghead/flycast/flycast@master` |
| Stable | `brew install --cask flyinghead/flycast/flycast` |
| Nightly dev | `brew install --cask flyinghead/flycast/flycast@dev` |
3. Run Flycast from your Application folder
&emsp;See the <a href="https://github.com/flyinghead/homebrew-flycast#readme">Flycast tap</a> for updating, uninstalling, and switching channels.
### iOS
&emsp;Due to persistent harassment from an iOS user, support for this platform has been dropped.
### Xbox One/Series ![xbox logo](https://flyinghead.github.io/flycast-builds/xbox.png)
&emsp;Grab the latest build from [**the builds page**](https://flyinghead.github.io/flycast-builds/), or the [**GitHub Actions**](https://github.com/flyinghead/flycast/actions/workflows/uwp.yml). Then install it using the **Xbox Device Portal**.
## Build from source
### macOS
&emsp;Right-click the bootstrap script and choose **Open**:
&emsp;`shell/apple/generate_xcode_project.command`
### Windows
&emsp;Double-click the bootstrap script:
&emsp;`shell\windows\generate_vs_project.bat`
### Linux
#### Dependencies
- **C/C++ compiler toolchain** (e.g. `gcc`/`g++`)
- **CMake**
- **make**
- **libcurl** (development headers)
- **libudev** (development headers)
- **SDL2** (development headers)
- **Graphics API**: Vulkan, OpenGL
#### Build
```
$ git clone --recursive https://github.com/flyinghead/flycast.git
$ cd flycast
$ mkdir build && cd build
$ cmake ..
$ make
```
## Packaging status
[![Packaging status](https://repology.org/badge/vertical-allrepos/flycast.svg)](https://repology.org/project/flycast/versions)
+1 -3
View File
@@ -7,12 +7,10 @@ Here lies the core of our codebase. Everything that's OS inspecific rests here.
### Some rudimentary categories are:
- hw -- DC Hardware Components Implementation
- nullDC.cpp -- Main entry points
- emitter -- x86 code emitter
- khronos -- OpenGL and Vulkan headers
- oslib -- Audio drivers
- cfg -- Configuration backend structure
- reios -- (Our) Implementation of the DreamCast BIOS
- deps -- External dependencies
- imgread -- Content drivers
- rec-* -- Recompilers
- rend -- OpenGL and Vulkan renderers
- rend -- Graphics renderers and UI
+3
View File
@@ -0,0 +1,3 @@
target_sources(${PROJECT_NAME} PRIVATE
achievements.cpp
achievements.h)
File diff suppressed because it is too large. Load diff
+73
View File
@@ -0,0 +1,73 @@
/*
This file is part of Flycast.
Flycast is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Flycast is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Flycast. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "types.h"
#include <future>
#include <vector>
namespace achievements
{
#ifdef USE_RACHIEVEMENTS
struct Game
{
std::string image;
std::string title;
u32 unlockedAchievements;
u32 totalAchievements;
u32 points;
u32 totalPoints;
};
struct Achievement
{
Achievement() = default;
Achievement(const std::string& image, const std::string& title, const std::string& description, const std::string& category, const std::string& status)
: image(image), title(title), description(description), category(category), status(status) {}
std::string image;
std::string title;
std::string description;
std::string category;
std::string status;
};
bool init();
void term();
std::future<void> login(const char *username, const char *password);
void logout();
bool isLoggedOn();
bool isActive();
Game getCurrentGame();
std::vector<Achievement> getAchievementList();
bool canPause();
void setHostOverride(const std::string& host);
#else
static inline bool isActive() {
return false;
}
static inline bool canPause() {
return true;
}
#endif
void serialize(Serializer& ser);
void deserialize(Deserializer& deser);
}
+33 -23
View File
@@ -19,40 +19,50 @@
along with reicast. If not, see <https://www.gnu.org/licenses/>.
*/
#include "7zArchive.h"
#include "deps/lzma/7z.h"
#include "deps/lzma/7zCrc.h"
#include "deps/lzma/Alloc.h"
#include "lzma/7z.h"
#include "lzma/7zCrc.h"
#include "lzma/Alloc.h"
#include <cstring>
#define kInputBufSize ((size_t)1 << 18)
static bool crc_tables_generated;
bool SzArchive::Open(const char* path)
SRes SzArchive::ArchiveStream::Read(const ISeekInStream *p, void *buf, size_t *size)
{
auto file_archive = CONTAINER_FROM_VTBL(p, ArchiveStream, vt);
*size = file_archive->file->read(buf, 1, *size);
return file_archive->file->error() ? SZ_ERROR_READ : SZ_OK;
}
SRes SzArchive::ArchiveStream::Seek(const ISeekInStream *p, Int64 *pos, ESzSeek origin)
{
auto file_archive = CONTAINER_FROM_VTBL(p, ArchiveStream, vt);
if (file_archive->file->seek(*pos, origin) == 0) {
*pos = file_archive->file->tell();
return SZ_OK;
}
else {
return SZ_ERROR_FAIL;
}
}
bool SzArchive::Open(hostfs::File *file)
{
SzArEx_Init(&szarchive);
File_Close(&archiveStream.file);
File_Construct(&archiveStream.file);
#ifdef USE_WINDOWS_FILE
nowide::wstackstring wpath;
if (!wpath.convert(path))
return false;
archiveStream.file.handle = CreateFileW(wpath.c_str(),
GENERIC_READ, FILE_SHARE_READ, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
if (archiveStream.file.handle == INVALID_HANDLE_VALUE)
return false;
#else
archiveStream.file.file = nowide::fopen(path, "rb");
if (archiveStream.file.file == nullptr)
return false;
#endif
FileInStream_CreateVTable(&archiveStream);
if (archiveStream.file != nullptr)
delete archiveStream.file;
archiveStream.vt.Read = ArchiveStream::Read;
archiveStream.vt.Seek = ArchiveStream::Seek;
archiveStream.file = file;
LookToRead2_CreateVTable(&lookStream, 0);
lookStream.buf = (Byte *)ISzAlloc_Alloc(&g_Alloc, kInputBufSize);
if (lookStream.buf == NULL)
{
File_Close(&archiveStream.file);
delete archiveStream.file;
return false;
}
lookStream.bufSize = kInputBufSize;
@@ -125,7 +135,7 @@ SzArchive::~SzArchive()
{
if (lookStream.buf != NULL)
{
File_Close(&archiveStream.file);
delete archiveStream.file;
ISzAlloc_Free(&g_Alloc, lookStream.buf);
if (out_buffer != NULL)
ISzAlloc_Free(&g_Alloc, out_buffer);
+22 -7
View File
@@ -21,10 +21,10 @@
#pragma once
#include "archive.h"
#include "deps/lzma/7z.h"
#include "deps/lzma/7zFile.h"
#include "lzma/7z.h"
#include <algorithm>
#include <cstring>
class SzArchive : public Archive
{
@@ -38,14 +38,24 @@ public:
ArchiveFile* OpenFile(const char* name) override;
ArchiveFile *OpenFileByCrc(u32 crc) override;
protected:
bool Open(hostfs::File *file) override;
private:
bool Open(const char* path) override;
struct ArchiveStream
{
static SRes Read(const ISeekInStream *p, void *buf, size_t *size);
static SRes Seek(const ISeekInStream *p, Int64 *pos, ESzSeek origin);
ISeekInStream vt;
hostfs::File *file;
};
CSzArEx szarchive;
UInt32 block_idx; /* it can have any value before first call (if outBuffer = 0) */
Byte *out_buffer; /* it must be 0 before first call for each new archive. */
size_t out_buffer_size; /* it can have any value before first call (if outBuffer = 0) */
CFileInStream archiveStream;
ArchiveStream archiveStream;
CLookToRead2 lookStream;
};
@@ -53,16 +63,21 @@ private:
class SzArchiveFile : public ArchiveFile
{
public:
SzArchiveFile(u8 *data, u32 offset, u32 length) : data(data), offset(offset), length(length) {}
SzArchiveFile(u8 *data, u32 offset, u32 length)
: data(data), offset(offset), _length(length) {}
u32 Read(void *buffer, u32 length) override
{
length = std::min(length, this->length);
length = std::min(length, this->_length);
memcpy(buffer, data + offset, length);
return length;
}
size_t length() override {
return _length;
}
private:
u8 *data;
u32 offset;
u32 length;
u32 _length;
};
+9
View File
@@ -0,0 +1,9 @@
target_sources(${PROJECT_NAME} PRIVATE
7zArchive.cpp
7zArchive.h
archive.cpp
archive.h
rzip.cpp
rzip.h
ZipArchive.cpp
ZipArchive.h)
+177 -34
View File
@@ -20,24 +20,136 @@
*/
#include "ZipArchive.h"
#include <array>
ZipArchive::~ZipArchive()
{
zip_close(zip);
}
bool ZipArchive::Open(const char* path)
static zip_int64_t ZipSourceCallback(void *userdata, void *data, zip_uint64_t len, zip_source_cmd_t cmd)
{
using Error = std::array<int, 2>;
static Error error = {ZIP_ER_OK, 0};
auto file = static_cast<hostfs::File*>(userdata);
switch (cmd)
{
case ZIP_SOURCE_OPEN:
return 0;
case ZIP_SOURCE_READ:
{
const auto bytes_read = file->read(data, 1, len);
if (file->error())
{
error = {ZIP_ER_INTERNAL, 0};
return -1;
}
return bytes_read;
}
case ZIP_SOURCE_CLOSE:
return 0;
case ZIP_SOURCE_STAT:
{
auto size = file->size();
if (size == -1)
{
error = {ZIP_ER_INTERNAL, 0};
return -1;
}
auto stat = static_cast<zip_stat_t*>(data);
zip_stat_init(stat);
stat->valid |= ZIP_STAT_SIZE;
stat->size = size;
return sizeof(*stat);
}
case ZIP_SOURCE_ERROR:
{
auto error_out = static_cast<std::array<int, 2>*>(data);
*error_out = error;
return sizeof(*error_out);
}
case ZIP_SOURCE_FREE:
delete file;
return 0;
case ZIP_SOURCE_SEEK:
{
zip_error_t error;
auto seek_info = ZIP_SOURCE_GET_ARGS(zip_source_args_seek, data, len, &error);
if (seek_info == nullptr)
{
error = {ZIP_ER_INTERNAL, 0};
return -1;
}
if (file->seek(seek_info->offset, seek_info->whence) != 0)
{
error = {ZIP_ER_INTERNAL, 0};
return -1;
}
return 0;
}
case ZIP_SOURCE_TELL:
{
const auto position = file->tell();
if (position == -1)
{
error = {ZIP_ER_INTERNAL, 0};
return -1;
}
return position;
}
case ZIP_SOURCE_SUPPORTS:
return zip_source_make_command_bitmap(
ZIP_SOURCE_OPEN,
ZIP_SOURCE_READ,
ZIP_SOURCE_CLOSE,
ZIP_SOURCE_STAT,
ZIP_SOURCE_ERROR,
ZIP_SOURCE_FREE,
ZIP_SOURCE_SEEK,
ZIP_SOURCE_TELL,
ZIP_SOURCE_SUPPORTS,
-1
);
default:
break;
}
// Unsupported command.
error = {ZIP_ER_OPNOTSUPP, 0};
return -1;
}
bool ZipArchive::Open(hostfs::File *file)
{
FILE *file = nowide::fopen(path, "rb");
if (file == nullptr)
return false;
zip_error_t error;
zip_source_t *source = zip_source_filep_create(file, 0, -1, &error);
zip_source_t *source = zip_source_function_create(ZipSourceCallback, file, &error);
if (source == nullptr)
{
std::fclose(file);
delete file;
return false;
}
zip = zip_open_from_source(source, 0, NULL);
zip = zip_open_from_source(source, 0, nullptr);
if (zip == nullptr)
zip_source_free(source);
return zip != nullptr;
@@ -45,46 +157,77 @@ bool ZipArchive::Open(const char* path)
ArchiveFile* ZipArchive::OpenFile(const char* name)
{
zip_file *zip_file = zip_fopen(zip, name, 0);
if (zip_file == NULL)
return NULL;
return new ZipArchiveFile(zip_file);
zip_file_t *zip_file = zip_fopen(zip, name, 0);
if (zip_file == nullptr)
return nullptr;
zip_stat_t stat;
zip_stat(zip, name, 0, &stat);
return new ZipArchiveFile(zip_file, stat.size, stat.name);
}
struct zip_file *zip_fopen_by_crc(struct zip *za, u32 crc, int flags)
static zip_file *zip_fopen_by_crc(zip_t *za, u32 crc, int flags, zip_uint64_t& index)
{
int i, n;
struct zip_stat stat;
if (crc == 0)
return nullptr;
if (crc == 0) {
return NULL;
}
zip_int64_t n = zip_get_num_entries(za, 0);
for (index = 0; index < (zip_uint64_t)n; index++)
{
zip_stat_t stat;
if (zip_stat_index(za, index, flags, &stat) < -1)
return nullptr;
if (stat.crc == crc)
return zip_fopen_index(za, index, flags);
}
n = zip_get_num_files(za);
for (i = 0; i < n; i++) {
if (zip_stat_index(za, i, flags, &stat) < -1) {
return NULL;
}
if (stat.crc == crc) {
return zip_fopen_index(za, i, flags);
}
}
return NULL;
return nullptr;
}
ArchiveFile* ZipArchive::OpenFileByCrc(u32 crc)
{
zip_file *zip_file = zip_fopen_by_crc(zip, crc, 0);
if (zip_file == NULL)
return NULL;
zip_uint64_t index;
zip_file_t *zip_file = zip_fopen_by_crc(zip, crc, 0, index);
if (zip_file == nullptr)
return nullptr;
zip_stat_t stat;
zip_stat_index(zip, index, 0, &stat);
return new ZipArchiveFile(zip_file);
return new ZipArchiveFile(zip_file, stat.size, stat.name);
}
u32 ZipArchiveFile::Read(void* buffer, u32 length)
{
return zip_fread(zip_file, buffer, length);
}
bool ZipArchive::Open(const void *data, size_t size)
{
zip_error_t error;
zip_source_t *source = zip_source_buffer_create(data, size, 0, &error);
if (source == nullptr)
return false;
zip = zip_open_from_source(source, 0, nullptr);
if (zip == nullptr)
zip_source_free(source);
return zip != nullptr;
}
ArchiveFile *ZipArchive::OpenFirstFile()
{
zip_file_t *zipFile = zip_fopen_index(zip, 0, 0);
if (zipFile == nullptr)
return nullptr;
zip_stat_t stat;
zip_stat_index(zip, 0, 0, &stat);
return new ZipArchiveFile(zipFile, stat.size, stat.name);
}
ArchiveFile *ZipArchive::OpenFileByIndex(size_t index)
{
zip_file_t *zipFile = zip_fopen_index(zip, index, 0);
if (zipFile == nullptr)
return nullptr;
zip_stat_t stat;
zip_stat_index(zip, index, 0, &stat);
return new ZipArchiveFile(zipFile, stat.size, stat.name);
}
+21 -7
View File
@@ -26,25 +26,39 @@
class ZipArchive : public Archive
{
public:
ZipArchive() : zip(NULL) {}
~ZipArchive() override;
ArchiveFile* OpenFile(const char* name) override;
ArchiveFile* OpenFileByCrc(u32 crc) override;
private:
bool Open(const char* path) override;
bool Open(hostfs::File *file) override;
bool Open(const void *data, size_t size);
struct zip *zip;
ArchiveFile *OpenFirstFile();
ArchiveFile *OpenFileByIndex(size_t index);
private:
zip_t *zip = nullptr;
};
class ZipArchiveFile : public ArchiveFile
{
public:
ZipArchiveFile(struct zip_file *zip_file) : zip_file(zip_file) {}
~ZipArchiveFile() override { zip_fclose(zip_file); }
ZipArchiveFile(zip_file_t *zip_file, size_t length, const char *name)
: zip_file(zip_file), _length(length), name(name) {}
~ZipArchiveFile() override {
zip_fclose(zip_file);
}
u32 Read(void* buffer, u32 length) override;
size_t length() override {
return _length;
}
const char *getName() override {
return name;
}
private:
struct zip_file *zip_file;
zip_file_t *zip_file;
size_t _length;
const char *name;
};
+49 -12
View File
@@ -22,24 +22,61 @@
#include "archive.h"
#include "7zArchive.h"
#include "ZipArchive.h"
#include "oslib/storage.h"
Archive *OpenArchive(const char *path)
Archive *OpenArchive(const std::string& path)
{
std::string base_path(path);
Archive *sz_archive = new SzArchive();
if (sz_archive->Open(base_path.c_str()) || sz_archive->Open((base_path + ".7z").c_str()) || sz_archive->Open((base_path + ".7Z").c_str()))
return sz_archive;
delete sz_archive;
hostfs::File *file = nullptr;
hostfs::FileInfo fileInfo;
try {
fileInfo = hostfs::storage().getFileInfo(path);
if (!fileInfo.isDirectory)
file = hostfs::storage().openFile(path, "rb");
} catch (const hostfs::StorageException& e) {
}
if (file == nullptr)
{
file = hostfs::storage().openFile(path + ".7z", "rb");
if (file == nullptr)
file = hostfs::storage().openFile(path + ".7Z", "rb");
}
if (file != nullptr)
{
Archive *sz_archive = new SzArchive();
if (sz_archive->Open(file))
return sz_archive;
delete sz_archive;
file = nullptr;
}
// Retry as a zip file
try {
if (!fileInfo.isDirectory)
file = hostfs::storage().openFile(path, "rb");
} catch (const hostfs::StorageException& e) {
}
if (file == nullptr)
{
file = hostfs::storage().openFile(path + ".zip", "rb");
if (file == nullptr)
{
file = hostfs::storage().openFile(path + ".ZIP", "rb");
if (file == nullptr)
return nullptr;
}
}
Archive *zip_archive = new ZipArchive();
if (zip_archive->Open(base_path.c_str()) || zip_archive->Open((base_path + ".zip").c_str()) || zip_archive->Open((base_path + ".ZIP").c_str()))
if (zip_archive->Open(file))
return zip_archive;
delete zip_archive;
return NULL;
return nullptr;
}
bool Archive::Open(const char* path)
{
hostfs::File *file = hostfs::storage().openFile(path, "rb");
if (file == nullptr)
return false;
return Open(file);
}
+9 -3
View File
@@ -21,12 +21,15 @@
#pragma once
#include "types.h"
#include "oslib/storage.h"
class ArchiveFile
{
public:
virtual ~ArchiveFile() = default;
virtual u32 Read(void *buffer, u32 length) = 0;
virtual size_t length() = 0;
virtual const char *getName() { return nullptr; }
};
class Archive
@@ -36,10 +39,13 @@ public:
virtual ArchiveFile *OpenFile(const char *name) = 0;
virtual ArchiveFile *OpenFileByCrc(u32 crc) = 0;
friend Archive *OpenArchive(const char *path);
protected:
virtual bool Open(hostfs::File *file) = 0;
private:
virtual bool Open(const char *name) = 0;
bool Open(const char *name);
friend Archive *OpenArchive(const std::string& path);
};
Archive *OpenArchive(const char *path);
Archive *OpenArchive(const std::string& path);
+54 -22
View File
@@ -19,31 +19,61 @@
#include "rzip.h"
#include <zlib.h>
#include <cstring>
const u8 RZipHeader[8] = { '#', 'R', 'Z', 'I', 'P', 'v', 1, '#' };
bool RZipFile::Open(const std::string& path, bool write)
bool RZipFile::Open(hostfs::File *file, bool write)
{
verify(file == nullptr);
file = nowide::fopen(path.c_str(), write ? "wb" : "rb");
if (file == nullptr)
return false;
verify(this->file == nullptr);
verify(file != nullptr);
startOffset = file->tell();
if (!write)
{
u8 header[sizeof(RZipHeader)];
if (std::fread(header, sizeof(header), 1, file) != 1
if (file->read(header, sizeof(header), 1) != 1
|| memcmp(header, RZipHeader, sizeof(header))
|| std::fread(&maxChunkSize, sizeof(maxChunkSize), 1, file) != 1
|| std::fread(&size, sizeof(size), 1, file) != 1)
|| file->read(&maxChunkSize, sizeof(maxChunkSize), 1) != 1
|| file->read(&size, sizeof(size), 1) != 1)
{
Close();
file->seek(startOffset, SEEK_SET);
return false;
}
// savestates created on 32-bit platforms used to have a 32-bit size
if (size >> 32 != 0)
{
size &= 0xffffffff;
file->seek(-4, SEEK_CUR);
}
chunk = new u8[maxChunkSize];
chunkIndex = 0;
chunkSize = 0;
}
else
{
maxChunkSize = 1_MB;
if (file->write(RZipHeader, sizeof(RZipHeader), 1) != 1
|| file->write(&maxChunkSize, sizeof(maxChunkSize), 1) != 1
|| file->write(&size, sizeof(size), 1) != 1)
{
file->seek(startOffset, SEEK_SET);
return false;
}
}
this->write = write;
this->file = file;
return true;
}
bool RZipFile::Open(const std::string& path, bool write)
{
hostfs::File *f = hostfs::storage().openFile(path.c_str(), write ? "wb" : "rb");
if (f == nullptr)
return false;
if (!Open(f, write)) {
Close();
return false;
}
return true;
}
@@ -51,7 +81,12 @@ void RZipFile::Close()
{
if (file != nullptr)
{
std::fclose(file);
if (write)
{
file->seek(startOffset + sizeof(RZipHeader) + sizeof(maxChunkSize), SEEK_SET);
file->write(&size, sizeof(size), 1);
}
delete file;
file = nullptr;
if (chunk != nullptr)
{
@@ -64,6 +99,7 @@ void RZipFile::Close()
size_t RZipFile::Read(void *data, size_t length)
{
verify(file != nullptr);
verify(!write);
u8 *p = (u8 *)data;
size_t rv = 0;
@@ -74,12 +110,12 @@ size_t RZipFile::Read(void *data, size_t length)
chunkSize = 0;
chunkIndex = 0;
u32 zippedSize;
if (std::fread(&zippedSize, sizeof(zippedSize), 1, file) != 1)
if (file->read(&zippedSize, sizeof(zippedSize), 1) != 1)
break;
if (zippedSize == 0)
continue;
u8 *zipped = new u8[zippedSize];
if (std::fread(zipped, zippedSize, 1, file) != 1)
if (file->read(zipped, zippedSize, 1) != 1)
{
delete [] zipped;
break;
@@ -93,7 +129,7 @@ size_t RZipFile::Read(void *data, size_t length)
delete [] zipped;
chunkSize = (u32)tl;
}
u32 l = std::min(chunkSize - chunkIndex, (u32)length);
u32 l = std::min(chunkSize - chunkIndex, (u32)(length - rv));
memcpy(p, chunk + chunkIndex, l);
p += l;
chunkIndex += l;
@@ -106,13 +142,9 @@ size_t RZipFile::Read(void *data, size_t length)
size_t RZipFile::Write(const void *data, size_t length)
{
verify(file != nullptr);
verify(std::ftell(file) == 0);
verify(write);
maxChunkSize = 1024 * 1024;
if (std::fwrite(RZipHeader, sizeof(RZipHeader), 1, file) != 1
|| std::fwrite(&maxChunkSize, sizeof(maxChunkSize), 1, file) != 1
|| std::fwrite(&length, sizeof(length), 1, file) != 1)
return 0;
size += length;
const u8 *p = (const u8 *)data;
// compression output buffer must be 0.1% larger + 12 bytes
uLongf maxZippedSize = maxChunkSize + maxChunkSize / 1000 + 12;
@@ -129,8 +161,8 @@ size_t RZipFile::Write(const void *data, size_t length)
break;
}
u32 sz = (u32)zippedSize;
if (std::fwrite(&sz, sizeof(sz), 1, file) != 1
|| std::fwrite(zipped, zippedSize, 1, file) != 1)
if (file->write(&sz, sizeof(sz), 1) != 1
|| file->write(zipped, zippedSize, 1) != 1)
{
rv = 0;
break;
+7 -2
View File
@@ -21,6 +21,7 @@
#pragma once
#include "types.h"
#include "oslib/storage.h"
class RZipFile
{
@@ -28,16 +29,20 @@ public:
~RZipFile() { Close(); }
bool Open(const std::string& path, bool write);
bool Open(hostfs::File *file, bool write);
void Close();
size_t Size() const { return size; }
size_t Read(void *data, size_t length);
size_t Write(const void *data, size_t length);
hostfs::File *rawFile() const { return file; }
private:
FILE *file = nullptr;
size_t size = 0;
hostfs::File *file = nullptr;
u64 size = 0;
u32 maxChunkSize = 0;
u8 *chunk = nullptr;
u32 chunkSize = 0;
u32 chunkIndex = 0;
bool write = false;
long startOffset = 0;
};
+17
View File
@@ -0,0 +1,17 @@
target_sources(${PROJECT_NAME} PRIVATE
audiostream.h)
if(NOT LIBRETRO)
target_sources(${PROJECT_NAME} PRIVATE
audiobackend_alsa.cpp
audiobackend_coreaudio.cpp
audiobackend_directsound.cpp
audiobackend_libao.cpp
audiobackend_null.cpp
audiobackend_oboe.cpp
audiobackend_omx.cpp
audiobackend_oss.cpp
audiobackend_pulseaudio.cpp
audiobackend_sdl2.cpp
audiostream.cpp)
endif()
+358
View File
@@ -0,0 +1,358 @@
#if USE_ALSA
#include "audiostream.h"
#include <alsa/asoundlib.h>
#include "cfg/cfg.h"
#include "cfg/option.h"
class AlsaAudioBackend : public AudioBackend
{
snd_pcm_t *handle = nullptr;
bool pcm_blocking = true;
snd_pcm_uframes_t buffer_size = 0;
snd_pcm_uframes_t period_size = 0;
snd_pcm_t *handle_record = nullptr;
public:
AlsaAudioBackend()
: AudioBackend("alsa", "Advanced Linux Sound Architecture") {}
bool init() override
{
snd_pcm_hw_params_t *params;
std::string device = config::loadStr("alsa", "device");
int rc = -1;
if (!device.empty() && device != "auto") {
rc = snd_pcm_open(&handle, device.c_str(), SND_PCM_STREAM_PLAYBACK, 0);
if (rc < 0)
WARN_LOG(AUDIO, "ALSA: Cannot open device %s. Trying auto", device.c_str());
}
if (rc < 0)
{
INFO_LOG(AUDIO, "ALSA: trying to determine audio device");
// trying default device
device = "default";
rc = snd_pcm_open(&handle, device.c_str(), SND_PCM_STREAM_PLAYBACK, 0);
// "default" didn't work, try first device
if (rc < 0)
{
device = "plughw:0,0,0";
rc = snd_pcm_open(&handle, device.c_str(), SND_PCM_STREAM_PLAYBACK, 0);
if (rc < 0)
{
device = "plughw:0,0";
rc = snd_pcm_open(&handle, device.c_str(), SND_PCM_STREAM_PLAYBACK, 0);
}
}
// first didn't work, try second
if (rc < 0)
{
device = "plughw:1,0";
rc = snd_pcm_open(&handle, device.c_str(), SND_PCM_STREAM_PLAYBACK, 0);
}
// try pulse audio backend
if (rc < 0)
{
device = "pulse";
rc = snd_pcm_open(&handle, device.c_str(), SND_PCM_STREAM_PLAYBACK, 0);
}
if (rc < 0)
INFO_LOG(AUDIO, "ALSA: unable to automatically determine audio device.");
}
if (rc < 0)
{
ERROR_LOG(AUDIO, "ALSA: unable to open PCM device %s: %s", device.c_str(), snd_strerror(rc));
return false;
}
INFO_LOG(AUDIO, "ALSA: Successfully initialized \"%s\"", device.c_str());
/* Allocate a hardware parameters object. */
snd_pcm_hw_params_alloca(&params);
/* Fill it in with default values. */
rc=snd_pcm_hw_params_any(handle, params);
if (rc < 0)
{
ERROR_LOG(AUDIO, "ALSA: Error:snd_pcm_hw_params_any %s", snd_strerror(rc));
term();
return false;
}
/* Set the desired hardware parameters. */
/* Interleaved mode */
rc=snd_pcm_hw_params_set_access(handle, params, SND_PCM_ACCESS_RW_INTERLEAVED);
if (rc < 0)
{
ERROR_LOG(AUDIO, "ALSA: Error:snd_pcm_hw_params_set_access %s", snd_strerror(rc));
term();
return false;
}
/* Signed 16-bit little-endian format */
rc=snd_pcm_hw_params_set_format(handle, params, SND_PCM_FORMAT_S16_LE);
if (rc < 0)
{
ERROR_LOG(AUDIO, "ALSA: Error:snd_pcm_hw_params_set_format %s", snd_strerror(rc));
term();
return false;
}
/* Two channels (stereo) */
rc=snd_pcm_hw_params_set_channels(handle, params, 2);
if (rc < 0)
{
ERROR_LOG(AUDIO, "ALSA: Error:snd_pcm_hw_params_set_channels %s", snd_strerror(rc));
term();
return false;
}
// 44100 samples/second
rc = snd_pcm_hw_params_set_rate(handle, params, 44100, 0);
if (rc < 0)
{
ERROR_LOG(AUDIO, "ALSA: Error:snd_pcm_hw_params_set_rate %s", snd_strerror(rc));
term();
return false;
}
// Period size (512)
period_size = std::min(SAMPLE_COUNT, (u32)config::AudioBufferSize / 4);
rc = snd_pcm_hw_params_set_period_size_near(handle, params, &period_size, nullptr);
if (rc < 0)
{
ERROR_LOG(AUDIO, "ALSA: Error:snd_pcm_hw_params_set_periods_near %s", snd_strerror(rc));
term();
return false;
}
INFO_LOG(AUDIO, "ALSA: period size set to %zd", (size_t)period_size);
// Sample buffer size
buffer_size = config::AudioBufferSize;
rc = snd_pcm_hw_params_set_buffer_size_near(handle, params, &buffer_size);
if (rc < 0)
{
ERROR_LOG(AUDIO, "ALSA: Error:snd_pcm_hw_params_set_buffer_size_near %s", snd_strerror(rc));
term();
return false;
}
INFO_LOG(AUDIO, "ALSA: buffer size set to %ld", buffer_size);
/* Write the parameters to the driver */
rc = snd_pcm_hw_params(handle, params);
if (rc < 0)
{
ERROR_LOG(AUDIO, "ALSA: Unable to set hw parameters: %s", snd_strerror(rc));
term();
return false;
}
return true;
}
bool initRecord(u32 sampling_freq) override
{
int err;
if ((err = snd_pcm_open(&handle_record, "default", SND_PCM_STREAM_CAPTURE, 0)) < 0)
{
ERROR_LOG(AUDIO, "ALSA: Cannot open default audio capture device: %s", snd_strerror(err));
return false;
}
snd_pcm_hw_params_t *hw_params;
if ((err = snd_pcm_hw_params_malloc(&hw_params)) < 0)
{
ERROR_LOG(AUDIO, "ALSA: Cannot allocate hardware parameter structure: %s", snd_strerror(err));
snd_pcm_close(handle_record);
return false;
}
if ((err = snd_pcm_hw_params_any(handle_record, hw_params)) < 0)
{
ERROR_LOG(AUDIO, "ALSA: Cannot initialize hardware parameter structure: %s", snd_strerror(err));
snd_pcm_hw_params_free(hw_params);
snd_pcm_close(handle_record);
return false;
}
if ((err = snd_pcm_hw_params_set_access(handle_record, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED)) < 0)
{
ERROR_LOG(AUDIO, "ALSA: Cannot set access type: %s\n", snd_strerror(err));
snd_pcm_hw_params_free(hw_params);
snd_pcm_close(handle_record);
return false;
}
if ((err = snd_pcm_hw_params_set_format(handle_record, hw_params, SND_PCM_FORMAT_S16_LE)) < 0)
{
ERROR_LOG(AUDIO, "ALSA: Cannot set sample format: %s", snd_strerror(err));
snd_pcm_hw_params_free(hw_params);
snd_pcm_close(handle_record);
return false;
}
if ((err = snd_pcm_hw_params_set_rate(handle_record, hw_params, sampling_freq, 0)) < 0)
{
ERROR_LOG(AUDIO, "ALSA: Cannot set sample rate to %d Hz: %s", sampling_freq, snd_strerror(err));
snd_pcm_hw_params_free(hw_params);
snd_pcm_close(handle_record);
return false;
}
if ((err = snd_pcm_hw_params_set_channels(handle_record, hw_params, 1)) < 0)
{
ERROR_LOG(AUDIO, "ALSA: Cannot set channel count: %s", snd_strerror(err));
snd_pcm_hw_params_free(hw_params);
snd_pcm_close(handle_record);
return false;
}
if ((err = snd_pcm_hw_params(handle_record, hw_params)) < 0)
{
ERROR_LOG(AUDIO, "ALSA: Cannot set parameters: %s", snd_strerror(err));
snd_pcm_hw_params_free(hw_params);
snd_pcm_close(handle_record);
return false;
}
snd_pcm_hw_params_free(hw_params);
snd_pcm_nonblock(handle_record, 1);
if ((err = snd_pcm_prepare(handle_record)) < 0)
{
ERROR_LOG(AUDIO, "ALSA: Cannot prepare device: %s", snd_strerror(err));
snd_pcm_close(handle_record);
return false;
}
INFO_LOG(AUDIO, "ALSA: Successfully initialized capture device");
return true;
}
void termRecord() override
{
snd_pcm_close(handle_record);
}
u32 record(void* frame, u32 samples) override
{
int err = snd_pcm_readi(handle_record, frame, samples);
if (err < (int)samples)
{
if (err < 0)
{
DEBUG_LOG(AUDIO, "ALSA: Recording error: %s", snd_strerror(err));
err = 0;
err = snd_pcm_prepare(handle_record);
}
u8 *buffer = (u8 *)frame + err;
memset(buffer, 0, (samples - err) * 2);
}
return err;
}
u32 push(const void* frame, u32 samples, bool wait) override
{
if (wait != pcm_blocking) {
snd_pcm_nonblock(handle, wait ? 0 : 1);
pcm_blocking = wait;
}
int rc = snd_pcm_writei(handle, frame, samples);
if (rc < 0)
{
snd_pcm_recover(handle, rc, 1);
if (rc == -EPIPE)
{
// EPIPE means underrun
// Write some silence then our samples
const size_t silence_size = buffer_size - samples;
void *silence = alloca(silence_size * 4);
memset(silence, 0, silence_size * 4);
snd_pcm_writei(handle, silence, silence_size);
snd_pcm_writei(handle, frame, samples);
}
}
return 1;
}
void term() override
{
snd_pcm_drop(handle);
snd_pcm_close(handle);
}
std::vector<std::string> getDeviceList()
{
std::vector<std::string> result;
char **hints;
int err = snd_device_name_hint(-1, "pcm", (void***)&hints);
// Error initializing ALSA
if (err != 0)
return result;
// special value to automatically detect on initialization
result.emplace_back("auto");
char** n = hints;
while (*n != NULL)
{
// Get the type (NULL/Input/Output)
char *type = snd_device_name_get_hint(*n, "IOID");
char *name = snd_device_name_get_hint(*n, "NAME");
if (name != NULL)
{
// We only want output or special devices (like "default" or "pulse")
// TODO Only those with type == NULL?
if (type == NULL || strcmp(type, "Output") == 0)
{
// TODO Check if device works (however we need to hash the resulting list then)
/*snd_pcm_t *handle;
int rc = snd_pcm_open(&handle, name, SND_PCM_STREAM_PLAYBACK, 0);
if (rc == 0)
{
result.push_back(name);
snd_pcm_close(handle);
}
*/
result.emplace_back(name);
}
}
if (type != NULL)
free(type);
if (name != NULL)
free(name);
n++;
}
snd_device_name_free_hint((void**)hints);
return result;
}
Option* getOptions(int *count) override
{
*count = 1;
static Option result;
result.name = "device";
result.caption = "Device";
result.type = Option::list;
result.values = getDeviceList();
return &result;
}
};
static AlsaAudioBackend alsaBackend;
#endif
+308
View File
@@ -0,0 +1,308 @@
/*
Simple Core Audio backend for osx (and maybe ios?)
Based off various audio core samples and dolphin's code
This is part of the Reicast project, please consult the
LICENSE file for licensing & related information
This could do with some locking logic to avoid
race conditions, and some variable length buffer
logic to support chunk sizes other than 512 bytes
It does work on my macmini though
*/
#if defined(__APPLE__)
#include "audiostream.h"
#include "cfg/option.h"
#include "stdclass.h"
#include <atomic>
#include <AudioUnit/AudioUnit.h>
#include <AudioToolbox/AudioQueue.h>
class CoreAudioBackend : public AudioBackend
{
AudioUnit audioUnit;
u32 BUFSIZE = 0;
u8 *samples_temp = nullptr;
std::atomic<int> samples_wptr;
std::atomic<int> samples_rptr;
cResetEvent bufferEmpty;
// input buffer and indexes
u8 samples_input[2400];
static constexpr size_t InputBufSize = sizeof(samples_input);
std::atomic<int> input_wptr;
std::atomic<int> input_rptr;
AudioQueueRef recordQueue;
static OSStatus renderCallback(void* ctx, AudioUnitRenderActionFlags* flags, const AudioTimeStamp* ts,
UInt32 bus, UInt32 frames, AudioBufferList* abl)
{
CoreAudioBackend *backend = (CoreAudioBackend *)ctx;
for (int i = 0; i < abl->mNumberBuffers; i++)
{
int size = abl->mBuffers[i].mDataByteSize;
u8 *outBuffer = (u8 *)abl->mBuffers[i].mData;
while (size != 0)
{
int avail = (backend->samples_wptr - backend->samples_rptr + backend->BUFSIZE) % backend->BUFSIZE;
if (avail == 0)
{
//printf("Core Audio: buffer underrun %d bytes (%d)", size, abl->mBuffers[i].mDataByteSize);
memset(outBuffer, '\0', size);
return noErr;
}
avail = std::min(avail, size);
avail = std::min(avail, (int)backend->BUFSIZE - backend->samples_rptr);
memcpy(outBuffer, backend->samples_temp + backend->samples_rptr, avail);
backend->samples_rptr = (backend->samples_rptr + avail) % backend->BUFSIZE;
size -= avail;
outBuffer += avail;
// Set the mutex to allow writing
backend->bufferEmpty.Set();
}
}
return noErr;
}
public:
CoreAudioBackend()
: AudioBackend("coreaudio", "Core Audio") {}
bool init() override
{
OSStatus err;
AURenderCallbackStruct callback_struct;
AudioStreamBasicDescription format;
AudioComponentDescription desc;
AudioComponent component;
desc.componentType = kAudioUnitType_Output;
#if !defined(TARGET_IPHONE)
desc.componentSubType = kAudioUnitSubType_DefaultOutput;
#else
desc.componentSubType = kAudioUnitSubType_RemoteIO;
#endif
desc.componentFlags = 0;
desc.componentFlagsMask = 0;
desc.componentManufacturer = kAudioUnitManufacturer_Apple;
component = AudioComponentFindNext(nullptr, &desc);
if (component == nullptr) {
ERROR_LOG(AUDIO, "coreaudio: AudioComponentFindNext failed");
return false;
}
err = AudioComponentInstanceNew(component, &audioUnit);
if (err != noErr) {
ERROR_LOG(AUDIO, "coreaudio: AudioComponentInstanceNew failed");
return false;
}
FillOutASBDForLPCM(format, 44100,
2, 16, 16, false, false, false);
err = AudioUnitSetProperty(audioUnit,
kAudioUnitProperty_StreamFormat,
kAudioUnitScope_Input, 0, &format,
sizeof(AudioStreamBasicDescription));
if (err != noErr)
{
ERROR_LOG(AUDIO, "coreaudio: AudioUnitSetProperty(kAudioUnitProperty_StreamFormat) failed");
AudioComponentInstanceDispose(audioUnit);
return false;
}
callback_struct.inputProc = renderCallback;
callback_struct.inputProcRefCon = this;
err = AudioUnitSetProperty(audioUnit,
kAudioUnitProperty_SetRenderCallback,
kAudioUnitScope_Input, 0, &callback_struct,
sizeof callback_struct);
if (err != noErr)
{
ERROR_LOG(AUDIO, "coreaudio: AudioUnitSetProperty(kAudioUnitProperty_SetRenderCallback) failed");
AudioComponentInstanceDispose(audioUnit);
return false;
}
/*
err = AudioUnitSetParameter(audioUnit,
kHALOutputParam_Volume,
kAudioUnitParameterFlag_Output, 0,
1, 0);
verify(err == noErr);
*/
err = AudioUnitInitialize(audioUnit);
if (err != noErr)
{
ERROR_LOG(AUDIO, "coreaudio: AudioUnitInitialize failed");
AudioComponentInstanceDispose(audioUnit);
return false;
}
BUFSIZE = config::AudioBufferSize * 4;
samples_temp = new u8[BUFSIZE]();
samples_rptr = 0;
samples_wptr = 0;
err = AudioOutputUnitStart(audioUnit);
if (err != noErr)
{
ERROR_LOG(AUDIO, "coreaudio: AudioOutputUnitStart failed");
AudioUnitUninitialize(audioUnit);
AudioComponentInstanceDispose(audioUnit);
return false;
}
bufferEmpty.Set();
return true;
}
u32 push(const void* frame, u32 samples, bool wait) override
{
int size = samples * 4;
while (size != 0)
{
int avail = (samples_rptr - samples_wptr - 4 + BUFSIZE) % BUFSIZE;
if (avail == 0)
{
if (!wait)
break;
bufferEmpty.Wait();
continue;
}
avail = std::min(avail, size);
avail = std::min(avail, (int)BUFSIZE - samples_wptr);
memcpy(&samples_temp[samples_wptr], frame, avail);
samples_wptr = (samples_wptr + avail) % BUFSIZE;
frame = (u8 *)frame + avail;
size -= avail;
}
return 1;
}
void term() override
{
AudioOutputUnitStop(audioUnit);
AudioUnitUninitialize(audioUnit);
AudioComponentInstanceDispose(audioUnit);
bufferEmpty.Set();
delete [] samples_temp;
samples_temp = nullptr;
}
static void recordCallback(void *inUserData, AudioQueueRef inAQ, AudioQueueBufferRef inBuffer,
const AudioTimeStamp *inStartTime, UInt32 frameSize, const AudioStreamPacketDescription *dataFormat)
{
//DEBUG_LOG(AUDIO, "AudioQueue callback: wptr %d rptr %d bytes %d", (int)input_wptr, (int)input_rptr, inBuffer->mAudioDataByteSize);
CoreAudioBackend *backend = (CoreAudioBackend *)inUserData;
UInt32 size = inBuffer->mAudioDataByteSize;
UInt32 freeSpace = (backend->input_rptr - backend->input_wptr - 2 + InputBufSize) % InputBufSize;
if (size > freeSpace)
{
DEBUG_LOG(AUDIO, "coreaudio: record overrun %d bytes", size - freeSpace);
size = freeSpace;
}
while (size != 0)
{
UInt32 chunk = std::min(size, (UInt32)(InputBufSize - backend->input_wptr));
memcpy(backend->samples_input + backend->input_wptr, inBuffer->mAudioData, chunk);
backend->input_wptr = (backend->input_wptr + chunk) % InputBufSize;
size -= chunk;
}
AudioQueueEnqueueBuffer(backend->recordQueue, inBuffer, 0, nullptr);
}
void termRecord() override
{
if (recordQueue != nullptr)
{
AudioQueueStop(recordQueue, true);
AudioQueueDispose(recordQueue, true);
recordQueue = nullptr;
}
}
bool initRecord(u32 sampling_freq) override
{
AudioStreamBasicDescription desc{};
desc.mFormatID = kAudioFormatLinearPCM;
desc.mSampleRate = (double)sampling_freq;
desc.mChannelsPerFrame = 1;
desc.mBitsPerChannel = 16;
desc.mBytesPerPacket = desc.mBytesPerFrame = 2;
desc.mFramesPerPacket = 1;
desc.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | kLinearPCMFormatFlagIsPacked;
desc.mReserved = 0;
OSStatus err = AudioQueueNewInput(&desc,
recordCallback,
this,
nullptr,
kCFRunLoopCommonModes,
0,
&recordQueue);
if (err != noErr)
{
ERROR_LOG(AUDIO, "AudioQueueNewInput failed: %d", err);
return false;
}
AudioQueueBufferRef buffers[2];
for (UInt32 i = 0; i < std::size(buffers) && err == noErr; i++)
{
err = AudioQueueAllocateBuffer(recordQueue, 480, &buffers[i]);
if (err == noErr)
err = AudioQueueEnqueueBuffer(recordQueue, buffers[i], 0, nullptr);
}
input_wptr = 0;
input_rptr = 0;
if (err == noErr)
err = AudioQueueStart(recordQueue, nullptr);
if (err != noErr)
{
ERROR_LOG(AUDIO, "AudioQueue init failed: %d", err);
termRecord();
return false;
}
INFO_LOG(AUDIO, "AudioQueue initialized - sample rate %f", desc.mSampleRate);
return true;
}
u32 record(void* frame, u32 samples) override
{
// DEBUG_LOG(AUDIO, "coreaudio_record: wptr %d rptr %d", (int)input_wptr, (int)input_rptr);
u32 size = samples * 2;
while (size != 0)
{
u32 avail = (input_wptr - input_rptr + InputBufSize) % InputBufSize;
if (avail == 0)
{
DEBUG_LOG(AUDIO, "coreaudio: record underrun %d bytes", size);
break;
}
avail = std::min(avail, size);
avail = std::min(avail, (u32)(InputBufSize - input_rptr));
memcpy(frame, &samples_input[input_rptr], avail);
frame = (u8 *)frame + avail;
input_rptr = (input_rptr + avail) % InputBufSize;
size -= avail;
}
return samples - size / 2;
}
};
static CoreAudioBackend coreAudioBackend;
#endif
+242
View File
@@ -0,0 +1,242 @@
#include "build.h"
#if defined(_WIN32) && !defined(TARGET_UWP)
#include "audiostream.h"
#include "cfg/option.h"
#include <initguid.h>
#include <dsound.h>
#include <vector>
#include <atomic>
#include <thread>
#include "stdclass.h"
#include "windows/comptr.h"
#include "oslib/oslib.h"
HWND getNativeHwnd();
#define verifyc(x) verify(!FAILED(x))
#ifdef __CRT_UUID_DECL
__CRT_UUID_DECL(IDirectSoundBuffer8, 0x6825A449,0x7524,0x4D82,0x92,0x0F,0x50,0xE3,0x6A,0xB3,0xAB,0x1E);
__CRT_UUID_DECL(IDirectSoundNotify, 0xB0210783,0x89cd,0x11d0,0xAF,0x08,0x00,0xA0,0xC9,0x25,0xCD,0x16);
__CRT_UUID_DECL(IDirectSoundCaptureBuffer8, 0x00990DF4,0x0DBB,0x4872,0x83,0x3E,0x6D,0x30,0x3E,0x80,0xAE,0xB6);
#else
struct __declspec(uuid("{6825A449-7524-4D82-920F-50E36AB3AB1E}")) IDirectSoundBuffer8;
struct __declspec(uuid("{B0210783-89cd-11d0-AF08-00A0C925CD16}")) IDirectSoundNotify;
struct __declspec(uuid("{00990DF4-0DBB-4872-833E-6D303E80AEB6}")) IDirectSoundCaptureBuffer8;
#endif
class DirectSoundBackend : public AudioBackend
{
ComPtr<IDirectSound8> dsound;
ComPtr<IDirectSoundBuffer8> buffer;
std::vector<HANDLE> notificationEvents;
ComPtr<IDirectSoundCapture8> dcapture;
ComPtr<IDirectSoundCaptureBuffer8> capture_buffer;
std::atomic_bool audioThreadRunning;
std::thread audioThread;
cResetEvent pushWait;
static constexpr u32 SAMPLE_BYTES = SAMPLE_COUNT * 4;
RingBuffer ringBuffer;
u32 notificationOffset(int index) {
return index * SAMPLE_BYTES;
}
void audioThreadMain()
{
ThreadName _("FlyDirectSound");
audioThreadRunning = true;
while (true)
{
u32 rv = WaitForMultipleObjects(notificationEvents.size(), &notificationEvents[0], false, 100);
if (!audioThreadRunning)
break;
if (rv == WAIT_TIMEOUT || rv == WAIT_FAILED)
continue;
rv -= WAIT_OBJECT_0;
void *p1, *p2;
DWORD sz1, sz2;
if (SUCCEEDED(buffer->Lock(notificationOffset(rv), SAMPLE_BYTES, &p1, &sz1, &p2, &sz2, 0)))
{
if (!ringBuffer.read((u8*)p1, sz1))
memset(p1, 0, sz1);
if (sz2 != 0)
{
if (!ringBuffer.read((u8*)p2, sz2))
memset(p2, 0, sz2);
}
buffer->Unlock(p1, sz1, p2, sz2);
pushWait.Set();
}
}
}
public:
DirectSoundBackend()
: AudioBackend("directsound", "Microsoft DirectSound") {}
bool init() override
{
if (FAILED(DirectSoundCreate8(NULL, &dsound.get(), NULL))) {
ERROR_LOG(AUDIO, "DirectSound8 initialization failed");
return false;
}
if (FAILED(dsound->SetCooperativeLevel(getNativeHwnd(), DSSCL_PRIORITY))) {
ERROR_LOG(AUDIO, "DirectSound8 SetCooperativeLevel failed");
dsound.reset();
return false;
}
// Set up WAV format structure.
WAVEFORMATEX wfx;
memset(&wfx, 0, sizeof(WAVEFORMATEX));
wfx.wFormatTag = WAVE_FORMAT_PCM;
wfx.nChannels = 2;
wfx.nSamplesPerSec = 44100;
wfx.nBlockAlign = 4;
wfx.nAvgBytesPerSec = wfx.nSamplesPerSec * wfx.nBlockAlign;
wfx.wBitsPerSample = 16;
// Set up DSBUFFERDESC structure.
DSBUFFERDESC desc;
memset(&desc, 0, sizeof(DSBUFFERDESC));
desc.dwSize = sizeof(DSBUFFERDESC);
desc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLPOSITIONNOTIFY | DSBCAPS_GLOBALFOCUS;
desc.dwBufferBytes = SAMPLE_BYTES * 2;
desc.lpwfxFormat = &wfx;
// Create the buffer
ComPtr<IDirectSoundBuffer> buffer_;
if (FAILED(dsound->CreateSoundBuffer(&desc, &buffer_.get(), 0))
|| FAILED(buffer_.as(buffer)))
{
ERROR_LOG(AUDIO, "DirectSound8 CreateSoundBuffer failed");
dsound.reset();
return false;
}
// Set up notifications
ComPtr<IDirectSoundNotify> bufferNotify;
verifyc(buffer.as(bufferNotify));
notificationEvents.clear();
std::vector<DSBPOSITIONNOTIFY> posNotify;
for (int i = 0; notificationOffset(i) < desc.dwBufferBytes; i++)
{
notificationEvents.push_back(CreateEvent(nullptr, false, false, nullptr));
posNotify.push_back({ notificationOffset(i), notificationEvents.back() });
}
bufferNotify->SetNotificationPositions(posNotify.size(), &posNotify[0]);
// Clear the buffers
void *p1, *p2;
DWORD sz1, sz2;
verifyc(buffer->Lock(0, desc.dwBufferBytes, &p1, &sz1, &p2, &sz2, 0));
verify(p2 == nullptr);
memset(p1, 0, sz1);
verifyc(buffer->Unlock(p1, sz1, p2, sz2));
ringBuffer.setCapacity(config::AudioBufferSize * 4);
// Start the thread
audioThread = std::thread(&DirectSoundBackend::audioThreadMain, this);
// Play the buffer !
if (FAILED(buffer->Play(0, 0, DSBPLAY_LOOPING)))
{
ERROR_LOG(AUDIO, "DirectSound8 Play failed");
term();
return false;
}
INFO_LOG(AUDIO, "DirectSound playback started");
return true;
}
u32 push(const void* frame, u32 samples, bool wait) override
{
while (!ringBuffer.write((const u8 *)frame, samples * 4) && wait)
pushWait.Wait();
return 1;
}
void term() override
{
audioThreadRunning = false;
audioThread.join();
buffer->Stop();
for (HANDLE event : notificationEvents)
CloseHandle(event);
buffer.reset();
dsound.reset();
INFO_LOG(AUDIO, "DirectSound playback stopped");
}
bool initRecord(u32 sampling_freq) override
{
if (FAILED(DirectSoundCaptureCreate8(&DSDEVID_DefaultVoiceCapture, &dcapture.get(), NULL)))
{
ERROR_LOG(AUDIO, "DirectSound capture device creation failed");
return false;
}
HRESULT hr;
WAVEFORMATEX wfx =
{ WAVE_FORMAT_PCM, 1, sampling_freq, sampling_freq * 2, 2, 16, 0 };
// wFormatTag, nChannels, nSamplesPerSec, nAvgBytesPerSec,
// nBlockAlign, wBitsPerSample, cbSize
DSCBUFFERDESC dscbd;
dscbd.dwSize = sizeof(DSCBUFFERDESC);
dscbd.dwFlags = 0;
dscbd.dwBufferBytes = 480 * 2;
dscbd.dwReserved = 0;
dscbd.lpwfxFormat = &wfx;
dscbd.dwFXCount = 0;
dscbd.lpDSCFXDesc = NULL;
ComPtr<IDirectSoundCaptureBuffer> pDSCB;
if (FAILED(hr = dcapture->CreateCaptureBuffer(&dscbd, &pDSCB.get(), NULL)))
{
ERROR_LOG(AUDIO, "DirectSound capture buffer creation failed");
dcapture.reset();
return false;
}
pDSCB.as(capture_buffer);
capture_buffer->Start(DSCBSTART_LOOPING);
INFO_LOG(AUDIO, "DirectSound capture device and buffer created");
return true;
}
u32 record(void *buffer, u32 samples) override
{
DWORD readPos;
capture_buffer->GetCurrentPosition(NULL, &readPos);
void *p1, *p2;
DWORD p1bytes, p2bytes;
capture_buffer->Lock(readPos, samples * 2, &p1, &p1bytes, &p2, &p2bytes, 0);
memcpy(buffer, p1, p1bytes);
if (p2bytes > 0)
memcpy((u8 *)buffer + p1bytes, p2, p2bytes);
capture_buffer->Unlock(p1, p1bytes, p2, p2bytes);
return (p1bytes + p2bytes) / 2;
}
void termRecord() override
{
if (!dcapture)
return;
capture_buffer->Stop();
capture_buffer.reset();
dcapture.reset();
}
};
static DirectSoundBackend directSoundBackend;
#endif
+54
View File
@@ -0,0 +1,54 @@
#ifdef USE_LIBAO
#include "audiostream.h"
#include <ao/ao.h>
class LibAOBackend : public AudioBackend
{
ao_device *aodevice = nullptr;
public:
LibAOBackend()
: AudioBackend("libao", "libao") {}
bool init() override
{
ao_initialize();
ao_sample_format aoformat {};
aoformat.bits = 16;
aoformat.channels = 2;
aoformat.rate = 44100;
aoformat.byte_format = AO_FMT_LITTLE;
aodevice = ao_open_live(ao_default_driver_id(), &aoformat, NULL); // Live output
if (aodevice == nullptr)
aodevice = ao_open_live(ao_driver_id("null"), &aoformat, NULL);
if (aodevice == nullptr) {
ERROR_LOG(AUDIO, "Cannot open libao driver");
ao_shutdown();
}
return aodevice != nullptr;
}
u32 push(const void* frame, u32 samples, bool wait) override
{
if (aodevice != nullptr)
ao_play(aodevice, (char*)frame, samples * 4);
return 1;
}
void term() override
{
if (aodevice != nullptr)
{
ao_close(aodevice);
aodevice = nullptr;
ao_shutdown();
}
}
};
static LibAOBackend libAOBackend;
#endif
+58
View File
@@ -0,0 +1,58 @@
#include "audiostream.h"
#include "oslib/i18n.h"
#include <chrono>
#include <thread>
class NullAudioBackend : public AudioBackend
{
using the_clock = std::chrono::high_resolution_clock;
public:
NullAudioBackend()
: AudioBackend("null", Tnop("No Audio")) {}
bool init() override
{
last_time = the_clock::time_point();
return true;
}
u32 push(const void* frame, u32 samples, bool wait) override
{
if (wait && last_time.time_since_epoch() != the_clock::duration::zero())
{
auto fduration = std::chrono::nanoseconds(1'000'000'000LL * samples / 44100);
auto duration = fduration - (the_clock::now() - last_time);
if (duration > std::chrono::nanoseconds::zero())
std::this_thread::sleep_for(duration);
if (duration < -std::chrono::milliseconds(67))
// if ~4 frames ahead, reset time (fast forward detection)
last_time = the_clock::now();
else
last_time += fduration;
}
else {
last_time = the_clock::now();
}
return 1;
}
bool initRecord(u32 sampling_freq) override
{
return true;
}
u32 record(void *buffer, u32 samples) override
{
memset(buffer, 0, samples * 2);
return samples;
}
std::string getName() const override {
return i18n::Ts(name);
}
private:
the_clock::time_point last_time;
};
static NullAudioBackend nullBackend;
+207
View File
@@ -0,0 +1,207 @@
/*
Copyright 2021 flyinghead
This file is part of Flycast.
Flycast is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Flycast is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Flycast. If not, see <https://www.gnu.org/licenses/>.
*/
#ifdef USE_OBOE
#include "audiostream.h"
#include "cfg/option.h"
#include "stdclass.h"
#include "oslib/i18n.h"
#include <oboe/Oboe.h>
#include <vector>
#include <algorithm>
#include <atomic>
#include <memory>
class OboeBackend : AudioBackend
{
RingBuffer ringBuffer;
cResetEvent pushWait;
std::shared_ptr<oboe::AudioStream> stream;
std::shared_ptr<oboe::AudioStream> recordStream;
class AudioCallback : public oboe::AudioStreamDataCallback
{
public:
AudioCallback(OboeBackend *backend) : backend(backend) {}
oboe::DataCallbackResult onAudioReady(oboe::AudioStream *audioStream, void *audioData, int32_t numFrames) override
{
if (!backend->ringBuffer.read((u8 *)audioData, numFrames * 4))
// underrun
memset(audioData, 0, numFrames * 4);
backend->pushWait.Set();
return oboe::DataCallbackResult::Continue;
}
OboeBackend *backend;
};
AudioCallback audioCallback;
class AudioErrorCallback : public oboe::AudioStreamErrorCallback
{
public:
AudioErrorCallback(OboeBackend *backend) : backend(backend) {}
void onErrorAfterClose(oboe::AudioStream *stream, oboe::Result error) override
{
// Only attempt to recover if init was successful
if (backend->stream != nullptr)
{
WARN_LOG(AUDIO, "Audio device lost. Attempting to reopen the audio stream");
// the oboe stream is already closed so make sure we don't close it twice
backend->stream.reset();
backend->term();
backend->init();
}
}
OboeBackend *backend;
};
AudioErrorCallback errorCallback;
public:
OboeBackend()
: AudioBackend("Oboe", Tnop("Automatic AAudio / OpenSL selection")), audioCallback(this), errorCallback(this) {}
bool init() override
{
// Actual capacity is size-1 to avoid overrun so add one buffer
ringBuffer.setCapacity((config::AudioBufferSize + SAMPLE_COUNT) * 4);
oboe::AudioStreamBuilder builder;
oboe::Result result = builder.setDirection(oboe::Direction::Output)
->setPerformanceMode(oboe::PerformanceMode::LowLatency)
->setSharingMode(oboe::SharingMode::Exclusive)
->setFormat(oboe::AudioFormat::I16)
->setChannelCount(oboe::ChannelCount::Stereo)
->setSampleRate(44100)
->setSampleRateConversionQuality(oboe::SampleRateConversionQuality::High)
->setFramesPerCallback(SAMPLE_COUNT)
->setDataCallback(&audioCallback)
->setErrorCallback(&errorCallback)
->setUsage(oboe::Usage::Game)
->openStream(stream);
if (result != oboe::Result::OK)
{
ERROR_LOG(AUDIO, "Oboe open stream failed: %s", oboe::convertToText(result));
return false;
}
if (stream->getAudioApi() == oboe::AudioApi::AAudio && config::AudioBufferSize < 1764)
{
// Reduce internal buffer for low latency (< 40 ms)
int bufSize = stream->getBufferSizeInFrames();
int burst = stream->getFramesPerBurst();
if (bufSize - burst > SAMPLE_COUNT)
{
while (bufSize - burst > SAMPLE_COUNT)
bufSize -= burst;
stream->setBufferSizeInFrames(bufSize);
}
}
stream->requestStart();
NOTICE_LOG(AUDIO, "Oboe driver started. stream capacity: %d frames, size: %d frames, frames/callback: %d, frames/burst: %d",
stream->getBufferCapacityInFrames(), stream->getBufferSizeInFrames(),
stream->getFramesPerCallback(), stream->getFramesPerBurst());
return true;
}
void term() override
{
NOTICE_LOG(AUDIO, "Oboe driver stopping");
if (stream != nullptr)
{
// Don't let the AudioErrorCallback term/reinit while we are stopping
// This won't prevent shit to hit the fan if it's already in the process
// of doing so but this is a pretty rare event and happens on devices
// that have audio issues already.
auto localStream = stream;
stream.reset();
localStream->stop();
localStream->close();
}
}
u32 push(const void* frame, u32 samples, bool wait) override
{
while (!ringBuffer.write((const u8 *)frame, samples * 4) && wait)
pushWait.Wait();
return 1;
}
void termRecord() override
{
if (recordStream != nullptr)
{
recordStream->stop();
recordStream->close();
recordStream.reset();
}
NOTICE_LOG(AUDIO, "Oboe recorder stopped");
}
bool initRecord(u32 sampling_freq) override
{
oboe::AudioStreamBuilder builder;
oboe::Result result = builder.setDirection(oboe::Direction::Input)
->setPerformanceMode(oboe::PerformanceMode::None)
->setSharingMode(oboe::SharingMode::Exclusive)
->setFormat(oboe::AudioFormat::I16)
->setChannelCount(oboe::ChannelCount::Mono)
->setSampleRate(sampling_freq)
->openStream(recordStream);
if (result != oboe::Result::OK)
{
ERROR_LOG(AUDIO, "Oboe open record stream failed: %s", oboe::convertToText(result));
return false;
}
recordStream->requestStart();
NOTICE_LOG(AUDIO, "Oboe recorder started. stream capacity: %d frames",
recordStream->getBufferCapacityInFrames());
return true;
}
u32 record(void *data, u32 samples) override
{
if (recordStream == nullptr)
return 0;
oboe::ResultWithValue<int32_t> result = recordStream->read(data, samples, 0);
if (result == oboe::Result::ErrorDisconnected)
{
WARN_LOG(AUDIO, "Recording device lost. Attempting to reopen the audio stream");
u32 sampleRate = recordStream->getSampleRate();
termRecord();
initRecord(sampleRate);
}
return std::max(0, result.value());
}
std::string getName() const override {
return i18n::Ts(name);
}
};
static OboeBackend oboeBackend;
#endif
+337
View File
@@ -0,0 +1,337 @@
#if USE_OMX
#include "audiostream.h"
#include "cfg/option.h"
#include <IL/OMX_Broadcom.h>
#include <unistd.h>
#define PORT_INDEX 100
#define OUTPUT_FREQ 44100
class OMXAudioBackend : public AudioBackend
{
OMX_HANDLETYPE omx_handle = nullptr;
OMX_STATETYPE omx_state = OMX_StateInvalid;
size_t audio_buffer_idx = 0;
OMX_BUFFERHEADERTYPE** audio_buffers = nullptr;
u32 latency_max = 0;
u32 buffer_count = 0;
u32 buffer_size = 0;
u32 buffer_length = 0;
pthread_mutex_t audio_lock;
pthread_cond_t omx_state_cond;
static OMX_ERRORTYPE eventHandler(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_PTR pAppData,
OMX_IN OMX_EVENTTYPE eEvent,
OMX_IN OMX_U32 nData1,
OMX_IN OMX_U32 nData2,
OMX_IN OMX_PTR pEventData)
{
OMXAudioBackend *backend = (OMXAudioBackend *)pAddData;
pthread_mutex_lock(&backend->audio_lock);
if(eEvent == OMX_EventCmdComplete && nData1 == OMX_CommandStateSet)
{
backend->omx_state = (OMX_STATETYPE)nData2;
pthread_cond_signal(&backend->omx_state_cond);
}
pthread_mutex_unlock(&backend->audio_lock);
return OMX_ErrorNone;
}
static OMX_ERRORTYPE emptyBufferDone(
OMX_IN OMX_HANDLETYPE hComponent,
OMX_IN OMX_PTR pAppData,
OMX_IN OMX_BUFFERHEADERTYPE* pBuffer)
{
return OMX_ErrorNone;
}
static OMX_ERRORTYPE fillBufferDone(
OMX_OUT OMX_HANDLETYPE hComponent,
OMX_OUT OMX_PTR pAppData,
OMX_OUT OMX_BUFFERHEADERTYPE* pBuffer)
{
return OMX_ErrorNone;
}
void waitForState(OMX_STATETYPE state)
{
pthread_mutex_lock(&audio_lock);
while(omx_state != state)
pthread_cond_wait(&omx_state_cond, &audio_lock);
pthread_mutex_unlock(&audio_lock);
}
u32 getLatency()
{
OMX_PARAM_U32TYPE param;
memset(&param, 0, sizeof(OMX_PARAM_U32TYPE));
param.nSize = sizeof(OMX_PARAM_U32TYPE);
param.nVersion.nVersion = OMX_VERSION;
param.nPortIndex = PORT_INDEX;
OMX_ERRORTYPE error = OMX_GetConfig(omx_handle, OMX_IndexConfigAudioRenderingLatency, &param);
if(error != OMX_ErrorNone)
WARN_LOG(AUDIO, "OMX: failed to get OMX configuration (OMX_IndexConfigAudioRenderingLatency). Error 0x%X", error);
return param.nU32 * 1000 / OUTPUT_FREQ;
}
public:
OMXAudioBackend()
: AudioBackend("omx", "OpenMAX IL") {}
bool init() override
{
OMX_ERRORTYPE error;
error = OMX_Init();
if (error != OMX_ErrorNone)
{
WARN_LOG(AUDIO, "OMX: OMX_Init() failed. Error 0x%X", error);
return false;
}
// Initialize settings
latency_max = config::OmxAudioLatency;
buffer_size = config::AudioBufferSize * 4;
buffer_count = 2 + OUTPUT_FREQ * latency_max / (buffer_size * 1000);
OMX_CALLBACKTYPE callbacks;
callbacks.EventHandler = eventHandler;
callbacks.EmptyBufferDone = emptyBufferDone;
callbacks.FillBufferDone = fillBufferDone;
error = OMX_GetHandle(&omx_handle, (OMX_STRING)"OMX.broadcom.audio_render", this, &callbacks);
if (error != OMX_ErrorNone)
{
WARN_LOG(AUDIO, "OMX: OMX_GetHandle() failed. Error 0x%X", error);
OMX_Deinit();
return false;
}
OMX_PARAM_PORTDEFINITIONTYPE param;
memset(&param, 0, sizeof(OMX_PARAM_PORTDEFINITIONTYPE));
param.nSize = sizeof(OMX_PARAM_PORTDEFINITIONTYPE);
param.nVersion.nVersion = OMX_VERSION;
param.nPortIndex = PORT_INDEX;
param.nBufferSize = buffer_size;
param.nBufferCountActual = buffer_count;
param.format.audio.eEncoding = OMX_AUDIO_CodingPCM;
error = OMX_SetParameter(omx_handle, OMX_IndexParamPortDefinition, &param);
if (error != OMX_ErrorNone)
{
WARN_LOG(AUDIO, "OMX: failed to set OMX_IndexParamPortDefinition. Error 0x%X", error);
OMX_Deinit();
return false;
}
OMX_AUDIO_PARAM_PCMMODETYPE pcm;
memset(&pcm, 0, sizeof(OMX_AUDIO_PARAM_PCMMODETYPE));
pcm.nSize = sizeof(OMX_AUDIO_PARAM_PCMMODETYPE);
pcm.nVersion.nVersion = OMX_VERSION;
pcm.nPortIndex = PORT_INDEX;
pcm.nChannels = 2;
pcm.eNumData = OMX_NumericalDataSigned;
pcm.eEndian = OMX_EndianLittle;
pcm.nSamplingRate = OUTPUT_FREQ;
pcm.bInterleaved = OMX_TRUE;
pcm.nBitPerSample = 16;
pcm.ePCMMode = OMX_AUDIO_PCMModeLinear;
pcm.eChannelMapping[1] = OMX_AUDIO_ChannelRF;
pcm.eChannelMapping[0] = OMX_AUDIO_ChannelLF;
error = OMX_SetParameter(omx_handle, OMX_IndexParamAudioPcm, &pcm);
if (error != OMX_ErrorNone)
{
WARN_LOG(AUDIO, "OMX: failed to set OMX_IndexParamAudioPcm. Error 0x%X", error);
OMX_Deinit();
return false;
}
// Disable all ports
error = OMX_SendCommand(omx_handle, OMX_CommandPortDisable, PORT_INDEX, NULL);
if (error != OMX_ErrorNone)
WARN_LOG(AUDIO, "OMX: failed to do OMX_CommandPortDisable. Error 0x%X", error);
OMX_PORT_PARAM_TYPE param2;
memset(&param2, 0, sizeof(OMX_PORT_PARAM_TYPE));
param2.nSize = sizeof(OMX_PORT_PARAM_TYPE);
param2.nVersion.nVersion = OMX_VERSION;
error = OMX_GetParameter(omx_handle, OMX_IndexParamOtherInit, &param2);
if (error != OMX_ErrorNone)
{
WARN_LOG(AUDIO, "OMX: failed to get OMX_IndexParamOtherInit. Error 0x%X", error);
}
else
{
for(u32 i = 0; i < param2.nPorts; i++)
{
u32 port = param2.nStartPortNumber + i;
error = OMX_SendCommand(omx_handle, OMX_CommandPortDisable, port, NULL);
if(error != OMX_ErrorNone)
WARN_LOG(AUDIO, "OMX: failed to do OMX_CommandPortDisable on port %u. Error 0x%X", port, error);
}
}
// Go into idle state
error = OMX_SendCommand(omx_handle, OMX_CommandStateSet, OMX_StateIdle, NULL);
if (error != OMX_ErrorNone)
{
WARN_LOG(AUDIO, "OMX: failed to set OMX_CommandStateSet. Error 0x%X", error);
OMX_Deinit();
return false;
}
waitForState(OMX_StateIdle);
// Check if we're in a state able to recieve buffers
OMX_STATETYPE state;
error = OMX_GetState(omx_handle, &state);
if (error != OMX_ErrorNone || !(state == OMX_StateIdle || state == OMX_StateExecuting || state == OMX_StatePause))
{
WARN_LOG(AUDIO, "OMX: state is incorrect. State 0x%X; Error 0x%X", state, error);
OMX_Deinit();
return false;
}
// Create audio buffers
INFO_LOG(AUDIO, "OMX: creating %u buffers", buffer_count);
// Enable port
error = OMX_SendCommand(omx_handle, OMX_CommandPortEnable, PORT_INDEX, NULL);
if (error != OMX_ErrorNone)
WARN_LOG(AUDIO, "OMX: failed to do OMX_CommandPortEnable. Error 0x%X", error);
// Free audio buffers if they're allocated
if (audio_buffers != NULL)
delete[] audio_buffers;
// Allocate buffers
audio_buffers = new OMX_BUFFERHEADERTYPE*[buffer_count];
for (size_t i = 0; i < buffer_count; i++)
{
error = OMX_AllocateBuffer(omx_handle, &audio_buffers[i], PORT_INDEX, NULL, buffer_size);
if (error != OMX_ErrorNone)
{
WARN_LOG(AUDIO, "OMX: failed to allocate buffer[%u]. Error 0x%X", i, error);
OMX_Deinit();
return false;
}
}
// Set state to executing
error = OMX_SendCommand(omx_handle, OMX_CommandStateSet, OMX_StateExecuting, NULL);
if (error != OMX_ErrorNone)
{
WARN_LOG(AUDIO, "OMX: failed to do OMX_CommandStateSet. Error 0x%X", error);
OMX_Deinit();
return false;
}
waitForState(OMX_StateExecuting);
// Empty buffers
for (size_t i = 0; i < buffer_count; i++)
{
memset(audio_buffers[i]->pBuffer, 0, buffer_size);
audio_buffers[i]->nOffset = 0;
audio_buffers[i]->nFilledLen = buffer_size;
error = OMX_EmptyThisBuffer(omx_handle, audio_buffers[i]);
if(error != OMX_ErrorNone)
WARN_LOG(AUDIO, "OMX: failed to empty buffer[%u]. Error 0x%X", i, error);
}
const char* output_device = "local";
if (config::OmxAudioHdmi)
output_device = (const char*)"hdmi";
// Set audio destination
OMX_CONFIG_BRCMAUDIODESTINATIONTYPE ar_dest;
memset(&ar_dest, 0, sizeof(ar_dest));
ar_dest.nSize = sizeof(OMX_CONFIG_BRCMAUDIODESTINATIONTYPE);
ar_dest.nVersion.nVersion = OMX_VERSION;
strcpy((char *)ar_dest.sName, output_device);
error = OMX_SetConfig(omx_handle, OMX_IndexConfigBrcmAudioDestination, &ar_dest);
if (error != OMX_ErrorNone)
{
WARN_LOG(AUDIO, "OMX: failed to set OMX configuration (OMX_IndexConfigBrcmAudioDestination). Error 0x%X", error);
OMX_Deinit();
return false;
}
audio_buffer_idx = 0;
buffer_length = 0;
INFO_LOG(AUDIO, "OMX: audio output to '%s'", ar_dest.sName);
return true;
}
u32 push(const void* frame, u32 samples, bool wait) override
{
if(audio_buffers == NULL)
return 1;
size_t data_size = samples * 4;
while(data_size > 0)
{
size_t copy_size = std::min(buffer_size - buffer_length, data_size);
// Don't have more than maximum audio latency
u32 latency = getLatency();
if(latency > latency_max)
{
usleep((latency - latency_max) * 1000);
}
else if(latency == 0)
{
INFO_LOG(AUDIO, "OMX: underrun occurred");
}
memcpy(audio_buffers[audio_buffer_idx]->pBuffer + buffer_length, frame, copy_size);
buffer_length += copy_size;
frame = (char *)frame + copy_size;
// Flush buffer and swap
if(buffer_length >= buffer_size)
{
audio_buffers[audio_buffer_idx]->nOffset = 0;
audio_buffers[audio_buffer_idx]->nFilledLen = buffer_size;
OMX_ERRORTYPE error = OMX_EmptyThisBuffer(omx_handle, audio_buffers[audio_buffer_idx]);
if(error != OMX_ErrorNone)
INFO_LOG(AUDIO, "OMX: failed to empty buffer[%u]. Error 0x%X", audio_buffer_idx, error);
audio_buffer_idx = (audio_buffer_idx + 1) % buffer_count;
buffer_length = 0;
}
data_size -= copy_size;
}
return 1;
}
void term() override
{
OMX_ERRORTYPE error;
// Is there anything else that needs to be done for omx?
error = OMX_Deinit();
if(error != OMX_ErrorNone)
WARN_LOG(AUDIO, "OMX: OMX_Deinit() failed. Error 0x%X", error);
if(audio_buffers != NULL)
{
delete[] audio_buffers;
audio_buffers = NULL;
}
}
};
static OMXAudioBackend omxAudioBackend;
#endif
+151
View File
@@ -0,0 +1,151 @@
#ifdef USE_OSS
#include "audiostream.h"
#include <fcntl.h>
#include <sys/ioctl.h>
#include <sys/soundcard.h>
#include <unistd.h>
class OSSAudioBackend : public AudioBackend
{
int audioFD = -1;
int recordFD = -1;
static int openDevice(int flags)
{
const char* path = "/dev/dsp";
int fd = open(path, flags);
if (fd < 0)
ERROR_LOG(AUDIO, "OSS: open(%s) failed: %s", path, strerror(errno));
return fd;
}
static bool setRate(int fd, int rate)
{
int tmp = rate;
if (ioctl(fd, SNDCTL_DSP_SPEED, &tmp) < 0)
{
ERROR_LOG(AUDIO, "OSS: ioctl(SNDCTL_DSP_SPEED) failed: %s", strerror(errno));
return false;
}
if (tmp != rate)
{
ERROR_LOG(AUDIO, "OSS: sample rate unsupported: %d => %d", rate, tmp);
return false;
}
return true;
}
static bool setChannels(int fd, int channels)
{
int tmp = channels;
if (ioctl(fd, SNDCTL_DSP_CHANNELS, &tmp) < 0)
{
ERROR_LOG(AUDIO, "OSS: ioctl(SNDCTL_DSP_CHANNELS) failed: %s", strerror(errno));
return false;
}
if (tmp != channels)
{
ERROR_LOG(AUDIO, "OSS: channels unsupported: %d => %d", channels, tmp);
return false;
}
return true;
}
static bool setFormat(int fd, int format)
{
int tmp = format;
if (ioctl(fd, SNDCTL_DSP_SETFMT, &tmp) < 0)
{
ERROR_LOG(AUDIO, "OSS: ioctl(SNDCTL_DSP_SETFMT) failed: %s", strerror(errno));
return false;
}
if (tmp != format)
{
ERROR_LOG(AUDIO, "OSS: sample format unsupported: %#.8x => %#.8x", format, tmp);
return false;
}
return true;
}
public:
OSSAudioBackend()
: AudioBackend("oss", "Open Sound System") {}
bool init() override
{
audioFD = openDevice(O_WRONLY);
if (audioFD < 0 || !setRate(audioFD, 44100) || !setChannels(audioFD, 2) || !setFormat(audioFD, AFMT_S16_LE))
{
term();
return false;
}
return true;
}
u32 push(const void* frame, u32 samples, bool wait) override
{
write(audioFD, frame, samples * 4);
return 1;
}
void term() override
{
if (audioFD >= 0)
close(audioFD);
audioFD = -1;
}
// recording untested
bool initRecord(u32 sampling_freq) override
{
recordFD = openDevice(O_RDONLY);
if (recordFD < 0 || !setRate(recordFD, sampling_freq) || !setChannels(recordFD, 1) || !setFormat(recordFD, AFMT_S16_NE /* Native 16 bits */ ))
{
termRecord();
return false;
}
return true;
}
void termRecord() override
{
if (recordFD >= 0)
close(recordFD);
recordFD = -1;
}
u32 record(void *buffer, u32 samples) override
{
samples *= 2;
int l = read(recordFD, buffer, samples);
if (l < (int)samples)
{
if (l < 0)
{
INFO_LOG(AUDIO, "OSS: Recording error");
l = 0;
}
memset((u8 *)buffer + l, 0, samples - l);
}
return l / 2;
}
};
static OSSAudioBackend ossAudioBackend;
#endif
+252
View File
@@ -0,0 +1,252 @@
#ifdef USE_PULSEAUDIO
#include "audiostream.h"
#include "cfg/option.h"
#include <pulse/pulseaudio.h>
class PulseAudioBackend : public AudioBackend
{
pa_threaded_mainloop *mainloop = nullptr;
pa_context *context = nullptr;
pa_stream *stream = nullptr;
pa_stream *record_stream = nullptr;
static void context_state_cb(pa_context *c, void *userdata)
{
PulseAudioBackend *backend = (PulseAudioBackend *)userdata;
switch (pa_context_get_state(c))
{
case PA_CONTEXT_READY:
case PA_CONTEXT_TERMINATED:
case PA_CONTEXT_FAILED:
pa_threaded_mainloop_signal(backend->mainloop, 0);
break;
default:
break;
}
}
static void stream_request_cb(pa_stream *s, size_t length, void *userdata)
{
PulseAudioBackend *backend = (PulseAudioBackend *)userdata;
pa_threaded_mainloop_signal(backend->mainloop, 0);
}
public:
PulseAudioBackend()
: AudioBackend("pulse", "PulseAudio") {}
bool init() override
{
mainloop = pa_threaded_mainloop_new();
if (!mainloop)
{
WARN_LOG(AUDIO, "PulseAudio: pa_threaded_mainloop_new failed");
return false;
}
context = pa_context_new(pa_threaded_mainloop_get_api(mainloop), "flycast");
if (!context)
{
WARN_LOG(AUDIO, "PulseAudio: pa_context_new failed");
term();
return false;
}
pa_context_set_state_callback(context, context_state_cb, this);
if (pa_context_connect(context, nullptr, PA_CONTEXT_NOFLAGS, nullptr) < 0)
{
WARN_LOG(AUDIO, "PulseAudio: pa_context_connect failed");
term();
return false;
}
pa_threaded_mainloop_lock(mainloop);
if (pa_threaded_mainloop_start(mainloop) < 0)
{
WARN_LOG(AUDIO, "PulseAudio: pa_threaded_mainloop_start failed");
pa_threaded_mainloop_unlock(mainloop);
term();
return false;
}
pa_threaded_mainloop_wait(mainloop);
if (pa_context_get_state(context) != PA_CONTEXT_READY)
{
WARN_LOG(AUDIO, "PulseAudio: context isn't ready");
pa_threaded_mainloop_unlock(mainloop);
term();
return false;
}
pa_sample_spec spec{ PA_SAMPLE_S16LE, 44100, 2 };
stream = pa_stream_new(context, "audio", &spec, NULL);
if (!stream)
{
WARN_LOG(AUDIO, "PulseAudio: pa_stream_new failed");
pa_threaded_mainloop_unlock(mainloop);
term();
return false;
}
//pa_stream_set_state_callback(stream, stream_state_cb, this);
pa_stream_set_write_callback(stream, stream_request_cb, this);
//pa_stream_set_latency_update_callback(stream, stream_latency_update_cb, this);
//pa_stream_set_underflow_callback(stream, underrun_update_cb, this);
//pa_stream_set_buffer_attr_callback(stream, buffer_attr_cb, this);
pa_buffer_attr buffer_attr;
buffer_attr.maxlength = -1;
buffer_attr.tlength = pa_usec_to_bytes(config::AudioBufferSize * PA_USEC_PER_SEC / 44100, &spec);
buffer_attr.prebuf = -1;
buffer_attr.minreq = -1;
buffer_attr.fragsize = -1;
if (pa_stream_connect_playback(stream, nullptr, &buffer_attr, PA_STREAM_ADJUST_LATENCY, nullptr, nullptr) < 0)
{
WARN_LOG(AUDIO, "PulseAudio: pa_stream_connect_playback failed");
pa_threaded_mainloop_unlock(mainloop);
term();
return false;
}
pa_threaded_mainloop_wait(mainloop);
if (pa_stream_get_state(stream) != PA_STREAM_READY)
{
WARN_LOG(AUDIO, "PulseAudio: stream isn't ready");
pa_threaded_mainloop_unlock(mainloop);
term();
return false;
}
const pa_buffer_attr *server_attr = pa_stream_get_buffer_attr(stream);
if (server_attr)
DEBUG_LOG(AUDIO, "PulseAudio: requested %d samples buffer, got %d", buffer_attr.tlength / 4, server_attr->tlength / 4);
pa_threaded_mainloop_unlock(mainloop);
return true;
}
u32 push(const void* frame, u32 samples, bool wait) override
{
const u8 *buf = (const u8 *)frame;
size_t size = samples * 4;
pa_threaded_mainloop_lock(mainloop);
while (size)
{
size_t writable = std::min(size, pa_stream_writable_size(stream));
if (writable)
{
pa_stream_write(stream, buf, writable, NULL, 0, PA_SEEK_RELATIVE);
buf += writable;
size -= writable;
}
else if (wait)
pa_threaded_mainloop_wait(mainloop);
else
break;
}
pa_threaded_mainloop_unlock(mainloop);
return 0;
}
void term() override
{
if (mainloop)
pa_threaded_mainloop_stop(mainloop);
if (stream)
{
pa_stream_disconnect(stream);
pa_stream_unref(stream);
stream = nullptr;
}
if (context)
{
pa_context_disconnect(context);
pa_context_unref(context);
context = nullptr;
}
if (mainloop)
pa_threaded_mainloop_free(mainloop);
mainloop = nullptr;
}
bool initRecord(u32 sampling_freq) override
{
pa_sample_spec spec{ PA_SAMPLE_S16LE, sampling_freq, 1 };
record_stream = pa_stream_new(context, "record", &spec, NULL);
if (!record_stream)
{
INFO_LOG(AUDIO, "PulseAudio: pa_stream_new failed");
return false;
}
pa_threaded_mainloop_lock(mainloop);
pa_buffer_attr buffer_attr;
buffer_attr.fragsize = 240 * 2;
buffer_attr.maxlength = buffer_attr.fragsize * 2;
if (pa_stream_connect_record(record_stream, nullptr, &buffer_attr, PA_STREAM_NOFLAGS) < 0)
{
INFO_LOG(AUDIO, "PulseAudio: pa_stream_connect_record failed");
pa_stream_unref(record_stream);
record_stream = nullptr;
return false;
}
pa_threaded_mainloop_unlock(mainloop);
INFO_LOG(AUDIO, "PulseAudio: Successfully initialized capture device");
return true;
}
void termRecord() override
{
if (record_stream != nullptr)
{
pa_threaded_mainloop_lock(mainloop);
pa_stream_disconnect(record_stream);
pa_stream_unref(record_stream);
record_stream = nullptr;
pa_threaded_mainloop_unlock(mainloop);
}
}
u32 record(void *buffer, u32 samples) override
{
if (record_stream == nullptr)
return 0;
pa_threaded_mainloop_lock(mainloop);
const void *data;
size_t size;
if (pa_stream_peek(record_stream, &data, &size) < 0)
{
pa_threaded_mainloop_unlock(mainloop);
DEBUG_LOG(AUDIO, "PulseAudio: pa_stream_peek error");
return 0;
}
if (size == 0)
{
pa_threaded_mainloop_unlock(mainloop);
return 0;
}
size = std::min((size_t)samples * 2, size);
if (data != nullptr)
memcpy(buffer, data, size);
else
memset(buffer, 0, size);
pa_stream_drop(record_stream);
pa_threaded_mainloop_unlock(mainloop);
return size / 2;
}
};
static PulseAudioBackend pulseAudioBackend;
#endif
+243
View File
@@ -0,0 +1,243 @@
#if defined(USE_SDL_AUDIO)
#include <SDL.h>
#include "audiostream.h"
#include "cfg/option.h"
#include "stdclass.h"
#include <algorithm>
#include <atomic>
#include <mutex>
class SDLAudioBackend : AudioBackend
{
SDL_AudioDeviceID audiodev {};
bool needs_resampling = false;
cResetEvent read_wait;
std::mutex stream_mutex;
uint32_t *sample_buffer;
unsigned sample_buffer_size = 0;
unsigned sample_count = 0;
SDL_AudioCVT audioCvt;
SDL_AudioDeviceID recorddev {};
u8 recordbuf[480 * 4];
std::atomic<size_t> rec_read;
std::atomic<size_t> rec_write;
static void audioCallback(void* userdata, Uint8* stream, int len)
{
SDLAudioBackend *backend = (SDLAudioBackend *)userdata;
backend->stream_mutex.lock();
// Wait until there's enough samples to feed the kraken
unsigned oslen = len / sizeof(uint32_t);
unsigned islen = backend->needs_resampling ? std::ceil(oslen / backend->audioCvt.len_ratio) : oslen;
if (backend->sample_count < islen)
{
// No data, just output a bit of silence for the underrun
memset(stream, 0, len);
backend->stream_mutex.unlock();
backend->read_wait.Set();
return;
}
if (!backend->needs_resampling) {
// Just copy bytes for this case.
memcpy(stream, &backend->sample_buffer[0], len);
}
else
{
SDL_AudioCVT& cvt = backend->audioCvt;
cvt.len = islen * sizeof(uint32_t);
memcpy(cvt.buf, &backend->sample_buffer[0], cvt.len);
SDL_ConvertAudio(&cvt);
memcpy(stream, cvt.buf, cvt.len_cvt);
}
// Move samples in the buffer and consume them
memmove(&backend->sample_buffer[0], &backend->sample_buffer[islen], (backend->sample_count - islen) * sizeof(uint32_t));
backend->sample_count -= islen;
backend->stream_mutex.unlock();
backend->read_wait.Set();
}
public:
SDLAudioBackend()
: AudioBackend("sdl2", "Simple DirectMedia Layer 2") {}
bool init() override
{
if (!SDL_WasInit(SDL_INIT_AUDIO))
{
if (SDL_InitSubSystem(SDL_INIT_AUDIO)) {
ERROR_LOG(AUDIO, "SDL2 error initializing audio subsystem: %s", SDL_GetError());
return false;
}
}
sample_buffer_size = std::max<u32>(SAMPLE_COUNT * 2, config::AudioBufferSize);
sample_buffer = new uint32_t[sample_buffer_size]();
sample_count = 0;
// Support 44.1KHz (native) but also upsampling to 48KHz
SDL_AudioSpec wav_spec, out_spec;
memset(&wav_spec, 0, sizeof(wav_spec));
wav_spec.freq = 44100;
wav_spec.format = AUDIO_S16;
wav_spec.channels = 2;
wav_spec.samples = SAMPLE_COUNT * 2; // Must be power of two
wav_spec.callback = audioCallback;
wav_spec.userdata = this;
needs_resampling = false;
// Try 44.1KHz which should be faster since it's native.
audiodev = SDL_OpenAudioDevice(NULL, 0, &wav_spec, &out_spec, 0);
if (audiodev == 0)
{
INFO_LOG(AUDIO, "SDL2: SDL_OpenAudioDevice failed: %s", SDL_GetError());
needs_resampling = true;
wav_spec.freq = 48000;
audiodev = SDL_OpenAudioDevice(NULL, 0, &wav_spec, &out_spec, 0);
if (audiodev == 0)
ERROR_LOG(AUDIO, "SDL2: SDL_OpenAudioDevice failed: %s", SDL_GetError());
else
{
INFO_LOG(AUDIO, "SDL2: Using resampling to 48 KHz");
int ret = SDL_BuildAudioCVT(&audioCvt, AUDIO_S16, 2, 44100, AUDIO_S16, 2, 48000);
if (ret != 1 || audioCvt.needed == 0)
{
ERROR_LOG(AUDIO, "SDL2: can't build audio converter: %s", SDL_GetError());
SDL_CloseAudioDevice(audiodev);
audiodev = 0;
}
else
{
audioCvt.buf = new u8[SAMPLE_COUNT * 2 * sizeof(uint32_t) * audioCvt.len_mult];
}
}
}
return audiodev != 0;
}
u32 push(const void* frame, u32 samples, bool wait) override
{
// Unpause the device shall it be paused.
if (SDL_GetAudioDeviceStatus(audiodev) != SDL_AUDIO_PLAYING)
SDL_PauseAudioDevice(audiodev, 0);
// If wait, then wait for the buffer to be smaller than a certain size.
stream_mutex.lock();
if (wait) {
while (sample_count + samples > sample_buffer_size) {
stream_mutex.unlock();
read_wait.Wait();
stream_mutex.lock();
}
}
// Copy as many samples as possible, drop any remaining (this should not happen usually)
unsigned free_samples = sample_buffer_size - sample_count;
unsigned tocopy = samples < free_samples ? samples : free_samples;
memcpy(&sample_buffer[sample_count], frame, tocopy * sizeof(uint32_t));
sample_count += tocopy;
stream_mutex.unlock();
return 1;
}
void term() override
{
if (audiodev)
{
// Stop audio playback.
SDL_PauseAudioDevice(audiodev, 1);
read_wait.Set();
SDL_CloseAudioDevice(audiodev);
audiodev = SDL_AudioDeviceID();
}
delete [] sample_buffer;
sample_buffer = nullptr;
if (needs_resampling)
{
delete [] audioCvt.buf;
audioCvt.buf = nullptr;
}
}
static void recordCallback(void *userdata, u8 *stream, int len)
{
SDLAudioBackend *backend = (SDLAudioBackend *)userdata;
DEBUG_LOG(AUDIO, "SDL2: sdl2_record_cb len %d write %zd read %zd", len, (size_t)backend->rec_write, (size_t)backend->rec_read);
while (len > 0)
{
size_t plen = std::min((size_t)len, sizeof(backend->recordbuf) - backend->rec_write);
memcpy(&backend->recordbuf[backend->rec_write], stream, plen);
len -= plen;
backend->rec_write = (backend->rec_write + plen) % sizeof(backend->recordbuf);
stream += plen;
}
}
bool initRecord(u32 sampling_freq) override
{
rec_write = 0;
rec_read = 0;
SDL_AudioSpec wav_spec, out_spec;
memset(&wav_spec, 0, sizeof(wav_spec));
wav_spec.freq = sampling_freq;
wav_spec.format = AUDIO_S16;
wav_spec.channels = 1;
wav_spec.samples = 256; // Must be power of two
wav_spec.callback = recordCallback;
wav_spec.userdata = this;
recorddev = SDL_OpenAudioDevice(NULL, 1, &wav_spec, &out_spec, 0);
if (recorddev == 0)
{
ERROR_LOG(AUDIO, "SDL2: Cannot open audio capture device: %s", SDL_GetError());
return false;
}
SDL_PauseAudioDevice(recorddev, 0);
INFO_LOG(AUDIO, "SDL2: opened audio capture device");
return true;
}
void termRecord() override
{
if (recorddev != 0)
{
SDL_PauseAudioDevice(recorddev, 1);
SDL_CloseAudioDevice(recorddev);
recorddev = 0;
}
}
u32 record(void* frame, u32 samples) override
{
u32 count = 0;
samples *= 2;
while (samples > 0)
{
u32 avail = std::min(rec_write - rec_read, sizeof(recordbuf) - rec_read);
if (avail == 0)
break;
avail = std::min(avail, samples);
memcpy((u8 *)frame + count, &recordbuf[rec_read], avail);
rec_read = (rec_read + avail) % sizeof(recordbuf);
samples -= avail;
count += avail;
}
DEBUG_LOG(AUDIO, "SDL2: sdl2_record len %d ret %d write %zd read %zd", samples * 2, count, (size_t)rec_write, (size_t)rec_read);
return count / 2;
}
};
static SDLAudioBackend sdlAudioBackend;
#endif
+160
View File
@@ -0,0 +1,160 @@
#include "audiostream.h"
#include "cfg/option.h"
#include "emulator.h"
static void registerForEvents();
struct SoundFrame { s16 l; s16 r; };
static SoundFrame Buffer[SAMPLE_COUNT];
static u32 writePtr; // next sample index
static AudioBackend *currentBackend;
std::vector<AudioBackend *> *AudioBackend::backends;
static bool audio_recording_started;
static bool eight_khz;
AudioBackend *AudioBackend::getBackend(const std::string& slug)
{
if (backends == nullptr)
return nullptr;
if (slug == "auto")
{
// Prefer sdl2 if available and avoid the null driver
AudioBackend *sdlBackend = nullptr;
AudioBackend *autoBackend = nullptr;
for (auto backend : *backends)
{
if (backend->slug == "sdl2")
sdlBackend = backend;
if (backend->slug != "null" && autoBackend == nullptr)
autoBackend = backend;
}
if (sdlBackend != nullptr)
autoBackend = sdlBackend;
if (autoBackend == nullptr)
autoBackend = backends->front();
INFO_LOG(AUDIO, "Auto-selected audio backend \"%s\" (%s).", autoBackend->slug.c_str(), autoBackend->getName().c_str());
return autoBackend;
}
for (auto backend : *backends)
{
if (backend->slug == slug)
return backend;
}
WARN_LOG(AUDIO, "WARNING: Audio backend \"%s\" not found!", slug.c_str());
return nullptr;
}
void WriteSample(s16 r, s16 l)
{
Buffer[writePtr].r = r * config::AudioVolume.dbPower();
Buffer[writePtr].l = l * config::AudioVolume.dbPower();
if (++writePtr == SAMPLE_COUNT)
{
if (currentBackend != nullptr)
currentBackend->push(Buffer, SAMPLE_COUNT, config::LimitFPS);
writePtr = 0;
}
}
void InitAudio()
{
registerForEvents();
TermAudio();
std::string slug = config::AudioBackend;
currentBackend = AudioBackend::getBackend(slug);
if (currentBackend == nullptr && slug != "auto")
{
slug = "auto";
currentBackend = AudioBackend::getBackend(slug);
}
if (currentBackend != nullptr)
{
INFO_LOG(AUDIO, "Initializing audio backend \"%s\" (%s)...", currentBackend->slug.c_str(), currentBackend->getName().c_str());
if (!currentBackend->init())
{
currentBackend = nullptr;
if (slug != "auto")
{
WARN_LOG(AUDIO, "Audio driver %s failed to initialize. Defaulting to 'auto'", slug.c_str());
slug = "auto";
currentBackend = AudioBackend::getBackend(slug);
if (!currentBackend->init())
currentBackend = nullptr;
}
}
}
if (currentBackend == nullptr)
{
WARN_LOG(AUDIO, "Running without audio!");
return;
}
if (audio_recording_started)
{
// Restart recording
audio_recording_started = false;
StartAudioRecording(eight_khz);
}
}
void TermAudio()
{
if (currentBackend == nullptr)
return;
// Save recording state before stopping
bool rec_started = audio_recording_started;
StopAudioRecording();
audio_recording_started = rec_started;
currentBackend->term();
INFO_LOG(AUDIO, "Terminating audio backend \"%s\" (%s)...", currentBackend->slug.c_str(), currentBackend->getName().c_str());
currentBackend = nullptr;
}
void StartAudioRecording(bool eight_khz)
{
::eight_khz = eight_khz;
if (currentBackend != nullptr)
audio_recording_started = currentBackend->initRecord(eight_khz ? 8000 : 11025);
else
// might be called between TermAudio/InitAudio
audio_recording_started = true;
}
u32 RecordAudio(void *buffer, u32 samples)
{
if (!audio_recording_started || currentBackend == nullptr)
return 0;
return currentBackend->record(buffer, samples);
}
void StopAudioRecording()
{
// might be called between TermAudio/InitAudio
if (audio_recording_started && currentBackend != nullptr)
currentBackend->termRecord();
audio_recording_started = false;
}
static void registerForEvents()
{
static bool done;
if (done)
return;
done = true;
// Empty the audio buffer when loading a state or terminating the game
const auto& callback = [](Event, void *) {
writePtr = 0;
};
EventManager::listen(Event::Terminate, callback);
EventManager::listen(Event::LoadState, callback);
}
+132
View File
@@ -0,0 +1,132 @@
#pragma once
#include "types.h"
#include <algorithm>
#include <atomic>
#include <cstring>
#include <string>
#include <vector>
class AudioBackend
{
public:
virtual ~AudioBackend() = default;
virtual bool init() = 0;
virtual u32 push(const void *data, u32 frames, bool wait) = 0;
virtual void term() {}
struct Option {
std::string name;
std::string caption;
enum { integer, checkbox, list } type;
int minValue;
int maxValue;
std::vector<std::string> values;
};
virtual const Option *getOptions(int *count) {
*count = 0;
return nullptr;
}
virtual bool initRecord(u32 sampling_freq) { return false; }
virtual u32 record(void *, u32) { return 0; }
virtual void termRecord() {}
std::string slug;
virtual std::string getName() const { return name; }
static size_t getCount() { return backends == nullptr ? 0 : backends->size(); }
static AudioBackend *getBackend(size_t index) { return backends == nullptr ? nullptr : (*backends)[index]; }
static AudioBackend *getBackend(const std::string& slug);
protected:
AudioBackend(const std::string& slug, const std::string& name)
: slug(slug), name(name) {
registerAudioBackend(this);
}
std::string name;
private:
static void registerAudioBackend(AudioBackend *backend)
{
if (backends == nullptr)
backends = new std::vector<AudioBackend *>();
backends->push_back(backend);
std::sort(backends->begin(), backends->end(), [](AudioBackend *b1, AudioBackend *b2) { return b1->slug < b2->slug; });
}
static std::vector<AudioBackend *> *backends;
};
void InitAudio();
void TermAudio();
void WriteSample(s16 right, s16 left);
void StartAudioRecording(bool eight_khz);
u32 RecordAudio(void *buffer, u32 samples);
void StopAudioRecording();
constexpr u32 SAMPLE_COUNT = 512; // AudioBackend::push() is always called with that many frames
class RingBuffer
{
std::vector<u8> buffer;
std::atomic_int readCursor { 0 };
std::atomic_int writeCursor { 0 };
u32 readSize() {
return (u32)((writeCursor - readCursor + buffer.size()) % buffer.size());
}
u32 writeSize() {
return (u32)((readCursor - writeCursor + buffer.size() - 1) % buffer.size());
}
public:
bool write(const u8 *data, u32 size)
{
if (size > writeSize())
return false;
u32 wc = writeCursor;
u32 chunkSize = std::min<u32>(size, (u32)buffer.size() - wc);
memcpy(&buffer[wc], data, chunkSize);
wc = (wc + chunkSize) % buffer.size();
size -= chunkSize;
if (size > 0)
{
data += chunkSize;
memcpy(&buffer[wc], data, size);
wc = (wc + size) % buffer.size();
}
writeCursor = wc;
return true;
}
bool read(u8 *data, u32 size)
{
if (size > readSize())
return false;
u32 rc = readCursor;
u32 chunkSize = std::min<u32>(size, (u32)buffer.size() - rc);
memcpy(data, &buffer[rc], chunkSize);
rc = (rc + chunkSize) % buffer.size();
size -= chunkSize;
if (size > 0)
{
data += chunkSize;
memcpy(data, &buffer[rc], size);
rc = (rc + size) % buffer.size();
}
readCursor = rc;
return true;
}
void setCapacity(size_t size)
{
std::fill(buffer.begin(), buffer.end(), 0);
buffer.resize(size);
readCursor = 0;
writeCursor = 0;
}
};
+48 -175
View File
@@ -1,151 +1,26 @@
/*
reicast build options
Reicast can support a lot of stuff, and this is an attempt
to organize the build time options
Option categories
BUILD_* - BUILD_COMPILER, etc...
definitions about the build machine
HOST_*
definitions about the host machine
FEAT_*
definitions about the features that this build targets
This is higly related to HOST_*, but it's for options that might
or might not be avaiable depending on the target host, or that
features that are irrelevant of the host
Eg, Alsa, Pulse Audio and OSS might sense as HOST dedinitions
but it usually makes more sense to detect them as runtime. In
that context, HOST_ALSA makes no sense because the host might
or might not have alsa installed/ running
MMU makes no sense as a HOST definition at all, so it should
be FEAT_HAS_MMU
TARGET_*
A preconfigured default. Eg TARGET_WIN86.
Naming of options, option values, and how to use them
for options that makes sense to have a list of values
{CATEGORY}_{OPTION}
{OPTION}_{VALUE}
eg.
BUILD_COMPILER == COMPILER_GCC, HOST_CPU != CPU_X64, ...
for options that are boolean
{CATEGORY}_IS_{OPTION} or {CATEGORY}_HAS_{OPTION}
Evaluates to 0 or 1
If an configuration cannot be neatly split into a set of
of orthogonal options, then it makes sense to break things
to "sets" or have a hierarchy of options.
Example
-------
In the beggining it made sense to have an audio backend
per operating system. It made sense to have it depend
on HOST_OS and seleect DirectSound or alsa.
// no option needed
Then, as android was introduced, which also uses OS_LINUX
atm, the audio could have been made an option. It could be
a HOST_* option, or FEAT_* one. I'd prefer FEAT_*.
FEAT_* makes more sense as future wise we might want
to support multiple backends.
FEAT_AUDIO_BACKEND
AUDIO_BACKEND_NONE
AUDIO_BACKEND_DS
AUDIO_BACKEND_ALSA
AUDIO_BACKEND_ANDROID
Used like
#if FEAT_AUDIO_BACKEND == AUDIO_BACKEND_DS ....
At some point, we might have multiple audio backends that
can be compiled in and autodetected/selected at runtime.
In that case, it might make sense to have the options like
FEAT_HAS_ALSA
FEAT_HAS_DIRECTSOUND
FEAT_HAS_ANDROID_AUDIO
or
FEAT_HAS_AUDIO_ALSA
FEAT_HAS_AUDIO_DS
FEAT_HAS_AUDIO_ANDROID
The none option might or might not make sense. In this
case it can be removed, as it should always be avaiable.
Guidelines
----------
General rule of thumb, don't overcomplicate things. Start
with a simple option, and then make it more complicated
as new uses apply (see the example above)
Don't use too long names, don't use too cryptic names.
Most team developers should be able to understand or
figure out most of the acronyms used.
Try to be consistent on the acronyms across all definitions
Code shouldn't depend on build level options whenever possible
Generally, the file should compile even if the option/module is
disabled. This makes makefiles etc much easier to write
TARGET_* options should generally only be used in this file
The current source is *not* good example of these guidelines
We'll try to be smart and figure out some options/defaults on this file
but this shouldn't get too complicated
*/
#pragma once
//#define STRICT_MODE
#ifndef STRICT_MODE
#define FAST_MMU
#define USE_WINCE_HACK
#endif
#define DC_PLATFORM_MASK 7
#define DC_PLATFORM_DREAMCAST 0 /* Works, for the most part */
#define DC_PLATFORM_DEV_UNIT 1 /* This is missing hardware */
#define DC_PLATFORM_NAOMI 2 /* Works, for the most part */
#define DC_PLATFORM_NAOMI2 3 /* Needs to be done, 2xsh4 + 2xpvr + custom TNL */
#define DC_PLATFORM_ATOMISWAVE 4 /* Works, for the most part */
#define DC_PLATFORM_HIKARU 5 /* Needs to be done, 2xsh4, 2x aica , custom vpu */
#define DC_PLATFORM_AURORA 6 /* Needs to be done, Uses newer 300 mhz sh4 + 150 mhz pvr mbx SoC */
#define DC_PLATFORM_DREAMCAST 0
#define DC_PLATFORM_DEV_UNIT 1
#define DC_PLATFORM_NAOMI 2
#define DC_PLATFORM_NAOMI2 3
#define DC_PLATFORM_ATOMISWAVE 4
#define DC_PLATFORM_SYSTEMSP 5
//HOST_CPU
#define CPU_X86 0x20000001
#define CPU_ARM 0x20000002
#define CPU_MIPS 0x20000003
#define CPU_ARM64 0x20000003
#define CPU_X64 0x20000004
#define CPU_GENERIC 0x20000005 //used for pnacl, emscripten, etc
#define CPU_PPC 0x20000006
#define CPU_PPC64 0x20000007
#define CPU_ARM64 0x20000008
#define CPU_MIPS64 0x20000009
//FEAT_SHREC, FEAT_AREC, FEAT_DSPREC
#define DYNAREC_NONE 0x40000001
#define DYNAREC_JIT 0x40000002
#define DYNAREC_CPP 0x40000003
//automatic
@@ -157,10 +32,19 @@
#define HOST_CPU CPU_ARM
#elif defined(__aarch64__) || defined(_M_ARM64)
#define HOST_CPU CPU_ARM64
#elif defined(__mips__)
#define HOST_CPU CPU_MIPS
#else
#define HOST_CPU CPU_GENERIC
#error Unsupported architecture
#endif
#if defined(__APPLE__)
#include "TargetConditionals.h"
#if TARGET_OS_SIMULATOR
// iOS simulator
#define TARGET_NO_REC
#endif
#if defined(TARGET_MAC) && HOST_CPU == CPU_ARM64
#define TARGET_ARM_MAC
#endif
#endif
#if defined(TARGET_NO_REC)
@@ -175,19 +59,17 @@
#define FEAT_DSPREC DYNAREC_NONE
#endif
#if defined(TARGET_NO_JIT)
#define FEAT_SHREC DYNAREC_CPP
#define FEAT_AREC DYNAREC_NONE
#define FEAT_DSPREC DYNAREC_NONE
#ifdef __SWITCH__
#define FEAT_NO_RWX_PAGES
#endif
//defaults
#ifndef FEAT_SHREC
#if HOST_CPU == CPU_MIPS
#define FEAT_SHREC DYNAREC_NONE
#else
#if HOST_CPU == CPU_ARM || HOST_CPU == CPU_ARM64 || HOST_CPU == CPU_X86 || HOST_CPU == CPU_X64
#define FEAT_SHREC DYNAREC_JIT
#else
#define FEAT_SHREC DYNAREC_NONE
#endif
#endif
@@ -200,30 +82,13 @@
#endif
#ifndef FEAT_DSPREC
#if HOST_CPU == CPU_X86 || HOST_CPU == CPU_ARM64 || HOST_CPU == CPU_X64
#if HOST_CPU == CPU_ARM || HOST_CPU == CPU_ARM64 || HOST_CPU == CPU_X86 || HOST_CPU == CPU_X64
#define FEAT_DSPREC DYNAREC_JIT
#else
#define FEAT_DSPREC DYNAREC_NONE
#endif
#endif
#if HOST_CPU == CPU_X64 || HOST_CPU == CPU_ARM64
#define HOST_64BIT_CPU
#endif
#define USE_MINIUPNPC
// Compiler Related
#ifndef _MSC_VER
#define ATTR_USED __attribute__((used))
#define ATTR_UNUSED __attribute__((used))
#else
#define ATTR_USED
#define ATTR_UNUSED
#endif
// Some restrictions on FEAT_NO_RWX_PAGES
#if defined(FEAT_NO_RWX_PAGES) && FEAT_SHREC == DYNAREC_JIT
#if HOST_CPU != CPU_X64 && HOST_CPU != CPU_ARM64
@@ -231,22 +96,30 @@
#endif
#endif
#ifdef _WIN32
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
#define TARGET_UWP 1
#endif
#ifdef HAVE_D3D11
#define USE_DX11
#endif
#endif
#if !defined(LIBRETRO)
#define USE_GGPO
#endif
#if !defined(__ANDROID__) && !defined(TARGET_IPHONE) && !defined(TARGET_UWP) \
&& !defined(__SWITCH__) && !defined(LIBRETRO) && !defined(__NetBSD__) && !defined(__OpenBSD__)
#define NAOMI_MULTIBOARD
#endif
// TARGET PLATFORM
#define RAM_SIZE_MAX (32*1024*1024)
#define VRAM_SIZE_MAX (16*1024*1024)
#define ARAM_SIZE_MAX (8*1024*1024)
#define GD_CLOCK 33868800 //GDROM XTAL -- 768fs
#define AICA_CORE_CLOCK (GD_CLOCK*4/3) //[45158400] GD->PLL 3:4 -> AICA CORE -- 1024fs
#define ADAC_CLOCK (AICA_CORE_CLOCK/4) //[11289600] 44100*256, AICA CORE -> PLL 4:1 -> ADAC -- 256fs
#define AICA_ARM_CLOCK (AICA_CORE_CLOCK/2) //[22579200] AICA CORE -> PLL 2:1 -> ARM
#define AICA_SDRAM_CLOCK (GD_CLOCK*2) //[67737600] GD-> PLL 2 -> SDRAM
#define SH4_MAIN_CLOCK (200*1000*1000) //[200000000] XTal(13.5) -> PLL (33.3) -> PLL 1:6 (200)
#define SH4_RAM_CLOCK (100*1000*1000) //[100000000] XTal(13.5) -> PLL (33.3) -> PLL 1:3 (100) , also suplied to HOLLY chip
#define G2_BUS_CLOCK (25*1000*1000) //[25000000] from Holly, from SH4_RAM_CLOCK w/ 2 2:1 plls
#define GD_CLOCK 33868800 //GDROM XTAL -- 768fs
#define AICA_CORE_CLOCK (GD_CLOCK * 4 / 3) //[45158400] GD->PLL 3:4 -> AICA CORE -- 1024fs
#define AICA_ARM_CLOCK (AICA_CORE_CLOCK / 2) //[22579200] AICA CORE -> PLL 2:1 -> ARM
#define SH4_MAIN_CLOCK (200 * 1000 * 1000) //[200000000] XTal(13.5) -> PLL (33.3) -> PLL 1:6 (200)
#define G2_BUS_CLOCK (25 * 1000 * 1000) //[25000000] from Holly, from SH4_RAM_CLOCK w/ 2 2:1 plls
#if defined(GLES) && !defined(GLES3) && !defined(GLES2)
// Only use GL ES 2.0 API functions
+12
View File
@@ -0,0 +1,12 @@
target_sources(${PROJECT_NAME} PRIVATE
option.h)
if(NOT LIBRETRO)
target_sources(${PROJECT_NAME} PRIVATE
cfg.cpp
cfg.h
cl.cpp
ini.cpp
ini.h
option.cpp)
endif()
+76 -61
View File
@@ -1,37 +1,33 @@
#include "cfg.h"
#include "ini.h"
#include "stdclass.h"
#include <cerrno>
static std::string cfgPath;
static bool save_config = true;
static bool autoSave = true;
static emucfg::ConfigFile cfgdb;
static void saveConfigFile()
namespace config
{
FILE* cfgfile = nowide::fopen(cfgPath.c_str(), "wt");
if (!cfgfile)
{
static std::string cfgPath;
static bool autoSaving = true;
static IniFile cfgdb;
static void saveFile()
{
hostfs::File* cfgfile = hostfs::storage().openFile(cfgPath.c_str(), "wt");
if (!cfgfile) {
WARN_LOG(COMMON, "Error: Unable to open file '%s' for saving", cfgPath.c_str());
}
else
{
else {
cfgdb.save(cfgfile);
std::fclose(cfgfile);
delete cfgfile;
}
}
void cfgSaveStr(const std::string& section, const std::string& key, const std::string& value)
{
cfgdb.set(section, key, value);
if (save_config && autoSave)
saveConfigFile();
static void autoSave() {
if (autoSaving)
saveFile();
}
bool cfgOpen()
bool open()
{
if (get_writable_config_path("").empty())
// Config dir not set (android onboarding)
@@ -41,10 +37,10 @@ bool cfgOpen()
std::string config_path_read = get_readonly_config_path(filename);
cfgPath = get_writable_config_path(filename);
FILE* cfgfile = nowide::fopen(config_path_read.c_str(), "r");
if(cfgfile != NULL) {
cfgdb.parse(cfgfile);
std::fclose(cfgfile);
hostfs::File* cfgfile = hostfs::storage().openFile(config_path_read.c_str(), "rt");
if (cfgfile != nullptr) {
cfgdb.load(cfgfile);
delete cfgfile;
}
else
{
@@ -55,66 +51,85 @@ bool cfgOpen()
{
// Config file didn't exist
INFO_LOG(COMMON, "Creating new empty config file at '%s'", cfgPath.c_str());
saveConfigFile();
}
else
{
// There was some other error (may be a permissions problem or something like that)
save_config = false;
saveFile();
}
}
return true;
}
std::string cfgLoadStr(const std::string& section, const std::string& key, const std::string& def)
{
return cfgdb.get(section, key, def);
void saveStr(const std::string& section, const std::string& key, const std::string& value) {
cfgdb.set(section, key, value);
autoSave();
}
void cfgSaveInt(const std::string& section, const std::string& key, s32 value)
{
cfgSaveStr(section, key, std::to_string(value));
std::string loadStr(const std::string& section, const std::string& key, const std::string& def) {
return cfgdb.getString(section, key, def);
}
s32 cfgLoadInt(const std::string& section, const std::string& key, s32 def)
{
return cfgdb.get_int(section, key, def);
void saveInt(const std::string& section, const std::string& key, int value) {
cfgdb.set(section, key, value);
autoSave();
}
void cfgSaveBool(const std::string& section, const std::string& key, bool value)
{
cfgSaveStr(section, key, value ? "yes" : "no");
int loadInt(const std::string& section, const std::string& key, int def) {
return cfgdb.getInt(section, key, def);
}
bool cfgLoadBool(const std::string& section, const std::string& key, bool def)
{
return cfgdb.get_bool(section, key, def);
int64_t loadInt64(const std::string& section, const std::string& key, int64_t def) {
return cfgdb.getInt64(section, key, def);
}
void saveInt64(const std::string& section, const std::string& key, int64_t value) {
cfgdb.set(section, key, value);
autoSave();
}
void cfgSetVirtual(const std::string& section, const std::string& key, const std::string& value)
{
void saveBool(const std::string& section, const std::string& key, bool value) {
cfgdb.set(section, key, value);
autoSave();
}
bool loadBool(const std::string& section, const std::string& key, bool def) {
return cfgdb.getBool(section, key, def);
}
void setTransient(const std::string& section, const std::string& key, const std::string& value) {
cfgdb.set(section, key, value, true);
}
bool cfgIsVirtual(const std::string& section, const std::string& key)
{
return cfgdb.is_virtual(section, key);
bool isTransient(const std::string& section, const std::string& key) {
return cfgdb.isTransient(section, key);
}
bool cfgHasSection(const std::string& section)
{
return cfgdb.has_section(section);
bool hasSection(const std::string& section) {
return cfgdb.hasSection(section);
}
void cfgDeleteSection(const std::string& section)
{
cfgdb.delete_section(section);
void deleteSection(const std::string& section) {
cfgdb.deleteSection(section);
}
void cfgSetAutoSave(bool autoSave)
{
::autoSave = autoSave;
if (autoSave)
saveConfigFile();
void deleteEntry(const std::string& section, const std::string& key) {
cfgdb.deleteEntry(section, key);
}
void setAutoSave(bool autoSaving)
{
config::autoSaving = autoSaving;
if (autoSaving)
saveFile();
}
void saveFloat(const std::string& section, const std::string& key, float value) {
cfgdb.set(section, key, value);
autoSave();
}
float loadFloat(const std::string& section, const std::string& key, float def) {
return cfgdb.getFloat(section, key, def);
}
std::vector<std::string> getEntries(const std::string& section) {
return cfgdb.getEntryNames(section);
}
} // namespace config
+26 -14
View File
@@ -1,19 +1,31 @@
#pragma once
#include <stdint.h>
#include <string>
#include <vector>
#include "types.h"
namespace config
{
bool cfgOpen();
s32 cfgLoadInt(const std::string& section, const std::string& key, s32 def);
void cfgSaveInt(const std::string& section, const std::string& key, s32 value);
std::string cfgLoadStr(const std::string& section, const std::string& key, const std::string& def);
void cfgSaveStr(const std::string& section, const std::string& key, const std::string& value);
void cfgSaveBool(const std::string& section, const std::string& key, bool value);
bool cfgLoadBool(const std::string& section, const std::string& key, bool def);
void cfgSetVirtual(const std::string& section, const std::string& key, const std::string& value);
bool cfgIsVirtual(const std::string& section, const std::string& key);
bool open();
int loadInt(const std::string& section, const std::string& key, int def = 0);
void saveInt(const std::string& section, const std::string& key, int value);
int64_t loadInt64(const std::string& section, const std::string& key, int64_t def = 0);
void saveInt64(const std::string& section, const std::string& key, int64_t value);
std::string loadStr(const std::string& section, const std::string& key, const std::string& def = {});
void saveStr(const std::string& section, const std::string& key, const std::string& value);
bool loadBool(const std::string& section, const std::string& key, bool def = false);
void saveBool(const std::string& section, const std::string& key, bool value);
float loadFloat(const std::string& section, const std::string& key, float def = 0.f);
void saveFloat(const std::string& section, const std::string& key, float value);
void setTransient(const std::string& section, const std::string& key, const std::string& value);
bool isTransient(const std::string& section, const std::string& key);
bool ParseCommandLine(int argc, char *argv[]);
void parseCommandLine(int argc, const char * const argv[]);
void cfgSetAutoSave(bool autoSave);
bool cfgHasSection(const std::string& section);
void cfgDeleteSection(const std::string& section);
void setAutoSave(bool autoSave);
bool hasSection(const std::string& section);
void deleteSection(const std::string& section);
void deleteEntry(const std::string& section, const std::string& key);
std::vector<std::string> getEntries(const std::string& section);
}
+196 -136
View File
@@ -1,166 +1,226 @@
/*
Command line parsing
~yay~
Copyright 2025 flyinghead
Nothing too interesting here, really
This file is part of Flycast.
Flycast is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Flycast is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Flycast. If not, see <https://www.gnu.org/licenses/>.
*/
#include "cfg/cfg.h"
#include "stdclass.h"
#include <cstdio>
#include <cctype>
#include <cstring>
#include "cfg/cfg.h"
char* trim_ws(char* str)
namespace config
{
if (str==0 || strlen(str)==0)
return 0;
while(*str)
{
if (!isspace(*str))
break;
str++;
}
size_t l=strlen(str);
if (l==0)
return 0;
while(l>0)
{
if (!isspace(str[l-1]))
break;
str[l-1]=0;
l--;
}
if (l==0)
return 0;
return str;
static void usage(const char *exe)
{
fprintf(stderr, "Usage: %s [option]... [<rom path>]\n", exe);
fprintf(stderr, "Options:\n");
fprintf(stderr, "-config section:key=value,... set a transient config value.\n");
fprintf(stderr, " Transient config values won't be saved to emu.cfg.\n");
fprintf(stderr, "-help display this help\n");
}
int setconfig(char** arg,int cl)
static void parseConfigOption(const std::string& str)
{
int rv=0;
for(;;)
char inQuote = '\0';
std::string section, key, value;
int step = 0; // section, key, value
for (char c : str)
{
if (cl<1)
if (inQuote != '\0' && c == inQuote)
{
WARN_LOG(COMMON, "-config : invalid number of parameters, format is section:key=value");
return rv;
}
char* sep=strstr(arg[1],":");
if (sep==0)
{
WARN_LOG(COMMON, "-config : invalid parameter %s, format is section:key=value", arg[1]);
return rv;
}
char* value=strstr(sep+1,"=");
if (value==0)
{
WARN_LOG(COMMON, "-config : invalid parameter %s, format is section:key=value", arg[1]);
return rv;
}
*sep++=0;
*value++=0;
char* sect=trim_ws(arg[1]);
char* key=trim_ws(sep);
value=trim_ws(value);
if (sect==0 || key==0)
{
WARN_LOG(COMMON, "-config : invalid parameter, format is section:key=value");
return rv;
}
const char* constval = value;
if (constval==0)
constval="";
INFO_LOG(COMMON, "Virtual cfg %s:%s=%s", sect, key, value);
cfgSetVirtual(sect,key,value);
rv++;
if (cl>=3 && stricmp(arg[2],",")==0)
{
cl-=2;
arg+=2;
rv++;
inQuote = false;
step = 0;
setTransient(section, key, value);
DEBUG_LOG(COMMON, "-config [%s] %s = %s", section.c_str(), key.c_str(), value.c_str());
section.clear();
key.clear();
value.clear();
continue;
}
else
switch (c)
{
case ':':
switch (step)
{
case 0:
section = trim_trailing_ws(section);
if (section.empty()) {
WARN_LOG(COMMON, "Invalid -config option '%s'. Format is: -config section:key=value,...", str.c_str());
return;
}
step = 1;
break;
case 1:
key += c;
break;
case 2:
value += c;
break;
}
break;
case '=':
switch (step)
{
case 0:
WARN_LOG(COMMON, "Invalid -config option '%s'. Format is: -config section:key=value,...", str.c_str());
return;
case 1:
key = trim_trailing_ws(key);
if (key.empty()) {
WARN_LOG(COMMON, "Invalid -config option '%s'. Format is: -config section:key=value,...", str.c_str());
return;
}
step = 2;
break;
case 2:
value += c;
break;
}
break;
case '\'':
case '"':
switch (step)
{
case 0:
section += c;
break;
case 1:
key += c;
break;
case 2:
if (inQuote == '\0') {
inQuote = c;
value.clear();
}
else
value += c;
break;
}
break;
case ',':
switch (step)
{
case 0:
// ignore consecutive commas
break;
case 1:
key += c;
break;
case 2:
if (inQuote != '\0') {
value += c;
}
else
{
step = 0;
setTransient(section, key, value);
DEBUG_LOG(COMMON, "-config [%s] %s = %s", section.c_str(), key.c_str(), value.c_str());
section.clear();
key.clear();
value.clear();
}
break;
}
break;
case ' ':
switch (step)
{
case 0:
// Ignore leading spaces. Inner spaces are kept (game ids such as "INITIAL D Ver.2")
// and trailing ones are trimmed at the ':' and '=' separators
if (!section.empty())
section += c;
break;
case 1:
if (!key.empty())
key += c;
break;
case 2:
value += c;
break;
}
break;
default:
switch (step)
{
case 0:
section += c;
break;
case 1:
key += c;
break;
case 2:
value += c;
break;
}
}
}
if (step == 2) {
setTransient(section, key, value);
DEBUG_LOG(COMMON, "-config [%s] %s = %s", section.c_str(), key.c_str(), value.c_str());
}
return rv;
}
static int showhelp()
void parseCommandLine(int argc, const char * const argv[])
{
printf("Usage: flycast [OPTION]... [CONTENT]\n\n");
printf("Options:\n");
printf("-config section:key=value add a virtual config value;\n");
printf(" virtual config values won't be saved to the .cfg file\n");
printf(" unless a different value is written to them\n");
printf("-help display this help\n");
exit(0);
return 0;
}
bool ParseCommandLine(int argc,char* argv[])
{
settings.imgread.ImagePath[0] = '\0';
int cl=argc-2;
char** arg=argv+1;
while(cl>=0)
settings.content.path.clear();
const char *exe = argv[0];
for (int i = 1; i < argc; i++)
{
if (stricmp(*arg,"-help")==0 || stricmp(*arg,"--help")==0)
{
showhelp();
if (!strcmp(argv[i], "-help") || !strcmp(argv[i], "--help")) {
usage(exe);
exit(0);
}
else if (stricmp(*arg,"-config")==0 || stricmp(*arg,"--config")==0)
if (!strcmp(argv[i], "-config") || !strcmp(argv[i], "--config"))
{
int as=setconfig(arg,cl);
cl-=as;
arg+=as;
if (i < argc - 1)
parseConfigOption(argv[++i]);
continue;
}
#if defined(__APPLE__)
else if (!strncmp(*arg, "-NSDocumentRevisions", 20))
// macOS
if (!strncmp(argv[i], "-NSDocumentRevisions", 20)) {
i++;
continue;
}
if (argv[i][0] == '-') {
WARN_LOG(COMMON, "Ignoring unknown command line option '%s'", argv[i]);
continue;
}
std::string extension = get_file_extension(argv[i]);
if (extension == "cdi" || extension == "chd"
|| extension == "gdi"|| extension == "cue")
{
arg++;
cl--;
INFO_LOG(COMMON, "Using '%s' as CD image", argv[i]);
settings.content.path = argv[i];
}
#endif
else
else if (extension == "elf")
{
char* extension = strrchr(*arg, '.');
if (extension
&& (stricmp(extension, ".cdi") == 0 || stricmp(extension, ".chd") == 0
|| stricmp(extension, ".gdi") == 0 || stricmp(extension, ".cue") == 0))
{
INFO_LOG(COMMON, "Using '%s' as cd image", *arg);
strcpy(settings.imgread.ImagePath, *arg);
}
else if (extension && stricmp(extension, ".elf") == 0)
{
INFO_LOG(COMMON, "Using '%s' as reios elf file", *arg);
cfgSetVirtual("config", "bios.UseReios", "yes");
strcpy(settings.imgread.ImagePath, *arg);
}
else
{
INFO_LOG(COMMON, "Using '%s' as rom", *arg);
strcpy(settings.imgread.ImagePath, *arg);
}
INFO_LOG(COMMON, "Using '%s' as reios elf file", argv[i]);
setTransient("config", "bios.UseReios", "yes");
settings.content.path = argv[i];
}
arg++;
cl--;
else {
INFO_LOG(COMMON, "Using '%s' as rom", argv[i]);
settings.content.path = argv[i];
}
if (i < argc - 1)
WARN_LOG(COMMON, "Rest of command line ignored: '%s'...", argv[i + 1]);
break;
}
return false;
}
} // namespace config
+268 -257
View File
@@ -1,311 +1,322 @@
/*
Copyright 2025 flyinghead
This file is part of Flycast.
Flycast is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Flycast is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Flycast. If not, see <https://www.gnu.org/licenses/>.
*/
#include "ini.h"
#include <sstream>
#include "types.h"
#include "stdclass.h"
char* trim_ws(char* str);
namespace config {
namespace emucfg {
/* ConfigEntry */
const std::string& ConfigEntry::get_string() const
const IniFile::Entry *IniFile::getEntry(const std::string& sectionName, const std::string& name) const
{
return this->value;
auto it = sections.find(sectionName);
if (it == sections.end())
return nullptr;
const Section& section = it->second;
auto it2 = section.entries.find(name);
if (it2 == section.entries.end())
return nullptr;
return &it2->second;
}
int ConfigEntry::get_int()
const std::string *IniFile::getRaw(const std::string& section, const std::string& name) const
{
if (strstr(this->value.c_str(), "0x") != NULL)
{
return (int)strtoul(this->value.c_str(), NULL, 16);
}
const Entry *entry = getEntry(section, name);
if (entry == nullptr)
return nullptr;
if (entry->transient)
return &entry->transientValue;
else
{
return atoi(this->value.c_str());
}
return &entry->value;
}
bool ConfigEntry::get_bool()
const std::string& IniFile::getString(const std::string& section, const std::string& entry, const std::string& defaultValue) const
{
if (stricmp(this->value.c_str(), "yes") == 0 ||
stricmp(this->value.c_str(), "true") == 0 ||
stricmp(this->value.c_str(), "on") == 0 ||
stricmp(this->value.c_str(), "1") == 0)
{
const std::string *pValue = getRaw(section, entry);
if (pValue == nullptr)
return defaultValue;
else
return *pValue;
}
bool IniFile::getBool(const std::string& section, const std::string& entry, bool defaultValue) const
{
const std::string *pValue = getRaw(section, entry);
if (pValue == nullptr)
return defaultValue;
if (!stricmp("yes", pValue->c_str())
|| !stricmp("true", pValue->c_str())
|| !stricmp("on", pValue->c_str())
|| !stricmp("1", pValue->c_str()))
return true;
}
else
{
return false;
}
static bool hasHexPrefix(const std::string& s)
{
size_t pos = 0;
while (pos < s.length() - 1 && std::isspace((int8_t)s[pos]))
pos++;
if (pos + 1 >= s.length())
return false;
return (s[pos] == '0' && (s[pos + 1] == 'x' || s[pos + 1] == 'X'));
}
int IniFile::getInt(const std::string& section, const std::string& entry, int defaultValue) const
{
const std::string *pValue = getRaw(section, entry);
if (pValue == nullptr)
return defaultValue;
std::istringstream ss(*pValue);
ss.imbue(std::locale::classic());
if (hasHexPrefix(*pValue))
ss.setf(std::ios_base::hex, std::ios_base::basefield);
else
ss.setf(std::ios_base::dec, std::ios_base::basefield);
unsigned value = defaultValue;
ss >> value;
return (int)value;
}
int64_t IniFile::getInt64(const std::string& section, const std::string& entry, int64_t defaultValue) const
{
const std::string *pValue = getRaw(section, entry);
if (pValue == nullptr)
return defaultValue;
std::istringstream ss(*pValue);
ss.imbue(std::locale::classic());
if (hasHexPrefix(*pValue))
ss.setf(std::ios_base::hex, std::ios_base::basefield);
else
ss.setf(std::ios_base::dec, std::ios_base::basefield);
int64_t value = defaultValue;
ss >> value;
return value;
}
float IniFile::getFloat(const std::string& section, const std::string& entry, float defaultValue) const
{
const std::string *pValue = getRaw(section, entry);
if (pValue == nullptr || pValue->empty())
return defaultValue;
std::istringstream ss(*pValue);
ss.imbue(std::locale::classic());
float value = defaultValue;
ss >> value;
return value;
}
void IniFile::setRaw(const std::string& sectionName, const std::string& entryName, const std::string& value, bool transient)
{
Section& section = sections[sectionName];
Entry& entry = section.entries[entryName];
if (entry.name.empty())
entry.name = entryName;
if (transient) {
entry.transientValue = value;
entry.transient = true;
}
else {
entry.value = value;
}
}
/* ConfigSection */
bool ConfigSection::has_entry(const std::string& name)
static std::string handleEscapeSeq(const std::string& s)
{
return (this->entries.count(name) == 1);
}
ConfigEntry* ConfigSection::get_entry(const std::string& name)
{
if(this->has_entry(name))
std::string ret;
ret.reserve(s.length());
for (size_t i = 0; i < s.length(); i++)
{
return &this->entries[name];
}
return NULL;
}
void ConfigSection::set(const std::string& name, const std::string& value)
{
ConfigEntry new_entry = { value };
this->entries[name] = new_entry;
}
void ConfigSection::delete_entry(const std::string& name)
{
this->entries.erase(name);
}
/* ConfigFile */
ConfigSection* ConfigFile::add_section(const std::string& name, bool is_virtual)
{
ConfigSection new_section;
if (is_virtual)
{
this->virtual_sections.insert(std::make_pair(name, new_section));
return &this->virtual_sections[name];
}
this->sections.insert(std::make_pair(name, new_section));
return &this->sections[name];
}
bool ConfigFile::has_section(const std::string& name)
{
return (this->virtual_sections.count(name) == 1 || this->sections.count(name) == 1);
}
bool ConfigFile::has_entry(const std::string& section_name, const std::string& entry_name)
{
ConfigSection* section = this->get_section(section_name, true);
if ((section != NULL) && section->has_entry(entry_name))
{
return true;
}
section = this->get_section(section_name, false);
return ((section != NULL) && section->has_entry(entry_name));
}
ConfigSection* ConfigFile::get_section(const std::string& name, bool is_virtual)
{
if(is_virtual)
{
if (this->virtual_sections.count(name) == 1)
char c = s[i];
if (c == '\\' && i < s.length() - 1)
{
return &this->virtual_sections[name];
switch (s[++i])
{
case 'n':
ret += '\n';
break;
case 't':
ret += '\t';
break;
case 'r':
ret += '\r';
break;
case 'f':
ret += '\f';
break;
case '\\':
ret += '\\';
break;
default:
WARN_LOG(COMMON, "Unrecognized escape sequence [\\%c] in [%s]", s[i], s.c_str());
ret += '\\';
--i;
break;
}
}
else {
ret += c;
}
}
else
{
if (this->sections.count(name) == 1)
{
return &this->sections[name];
}
}
return NULL;
return ret;
}
ConfigEntry* ConfigFile::get_entry(const std::string& section_name, const std::string& entry_name)
void IniFile::load(const std::string& data, bool cEscape)
{
ConfigSection* section = this->get_section(section_name, true);
if(section != NULL && section->has_entry(entry_name))
std::istringstream fss(data);
int cline = 1;
std::string curSection;
for (std::string line; std::getline(fss, line); cline++)
{
return section->get_entry(entry_name);
}
section = this->get_section(section_name, false);
if(section != NULL)
{
return section->get_entry(entry_name);
}
return NULL;
}
std::string ConfigFile::get(const std::string& section_name, const std::string& entry_name, const std::string& default_value)
{
ConfigEntry* entry = this->get_entry(section_name, entry_name);
if (entry == NULL)
{
return default_value;
}
else
{
return entry->get_string();
}
}
int ConfigFile::get_int(const std::string& section_name, const std::string& entry_name, int default_value)
{
ConfigEntry* entry = this->get_entry(section_name, entry_name);
if (entry == NULL)
{
return default_value;
}
else
{
return entry->get_int();
}
}
bool ConfigFile::get_bool(const std::string& section_name, const std::string& entry_name, bool default_value)
{
ConfigEntry* entry = this->get_entry(section_name, entry_name);
if (entry == NULL)
{
return default_value;
}
else
{
return entry->get_bool();
}
}
void ConfigFile::set(const std::string& section_name, const std::string& entry_name, const std::string& value, bool is_virtual)
{
ConfigSection* section = this->get_section(section_name, is_virtual);
if(section == NULL)
{
section = this->add_section(section_name, is_virtual);
}
section->set(entry_name, value);
}
void ConfigFile::set_int(const std::string& section_name, const std::string& entry_name, int value, bool is_virtual)
{
std::stringstream str_value;
str_value << value;
this->set(section_name, entry_name, str_value.str(), is_virtual);
}
void ConfigFile::set_bool(const std::string& section_name, const std::string& entry_name, bool value, bool is_virtual)
{
std::string str_value = (value ? "yes" : "no");
this->set(section_name, entry_name, str_value, is_virtual);
}
void ConfigFile::parse(FILE* file)
{
if(file == NULL)
{
return;
}
char line[512];
char current_section[512] = { '\0' };
int cline = 0;
while(file && !feof(file))
{
if (std::fgets(line, 512, file) == NULL || std::feof(file))
{
break;
}
cline++;
if (strlen(line) < 3)
{
size_t pos = 0;
while (pos < line.length() && std::isspace((int8_t)line[pos]))
pos++;
if (pos == line.length() || line[pos] == ';')
// Ignore empty lines and comments
continue;
}
if (line[strlen(line)-1] == '\r' ||
line[strlen(line)-1] == '\n')
if (line[pos] == '[')
{
line[strlen(line)-1] = '\0';
}
char* tl = trim_ws(line);
if (tl[0] == '[' && tl[strlen(tl)-1] == ']')
{
tl[strlen(tl)-1] = '\0';
// FIXME: Data loss if buffer is too small
strncpy(current_section, tl+1, sizeof(current_section));
current_section[sizeof(current_section) - 1] = '\0';
trim_ws(current_section);
// Section
size_t end = line.find(']', ++pos);
if (end == line.npos) {
WARN_LOG(COMMON, "Missing ']' character - ignoring line %d: %s", cline, line.c_str());
continue;
}
curSection = line.substr(pos, end - pos);
if (cEscape)
curSection = handleEscapeSeq(curSection);
}
else
{
if (strlen(current_section) == 0)
{
continue; //no open section
}
char* separator = strstr(tl, "=");
if (!separator)
{
WARN_LOG(COMMON, "Malformed entry on config - ignoring @ %d(%s)", cline, tl);
// Entry
pos = line.find('=', pos);
if (pos == line.npos) {
WARN_LOG(COMMON, "Malformed entry - ignoring line %d: %s", cline, line.c_str());
continue;
}
*separator = '\0';
char* name = trim_ws(tl);
char* value = trim_ws(separator + 1);
if (name == NULL || value == NULL)
{
//printf("Malformed entry on config - ignoring @ %d(%s)\n",cline, tl);
std::string entry = trim_ws(line.substr(0, pos), " \t");
if (entry.empty()) {
WARN_LOG(COMMON, "Invalid empty entry name - ignoring line %d: %s", cline, line.c_str());
continue;
}
else
std::string value = line.substr(pos + 1);
// Space characters before and after the equal sign are for readability, and not part of the entry name or value
if (!value.empty() && value[0] == ' ')
value = value.substr(1);
if (!value.empty() && value[0] == '"')
{
this->set(std::string(current_section), std::string(name), std::string(value));
// quoted value
size_t end = value.rfind('"');
if (end == value.npos || end == 0)
end = value.length();
value = value.substr(1, end - 1);
}
if (cEscape) {
entry = handleEscapeSeq(entry);
value = handleEscapeSeq(value);
}
set(curSection, entry, value);
}
}
}
void ConfigFile::save(FILE* file)
void IniFile::load(hostfs::File *file, bool cEscape)
{
for (const auto& section_it : this->sections)
std::string data;
for (;;)
{
const std::string& section_name = section_it.first;
const ConfigSection& section = section_it.second;
std::fprintf(file, "[%s]\n", section_name.c_str());
for (const auto& entry_it : section.entries)
{
const std::string& entry_name = entry_it.first;
const ConfigEntry& entry = entry_it.second;
std::fprintf(file, "%s = %s\n", entry_name.c_str(), entry.get_string().c_str());
}
std::fputs("\n", file);
char buffer[4096];
int n = file->read(buffer, 1, sizeof(buffer));
if (n <= 0)
break;
data += std::string(buffer, buffer + n);
}
load(data, cEscape);
}
void ConfigFile::delete_section(const std::string& section_name) {
sections.erase(section_name);
virtual_sections.erase(section_name);
}
void ConfigFile::delete_entry(const std::string& section_name, const std::string& entry_name)
void IniFile::save(std::string& data) const
{
ConfigSection *section = get_section(section_name, false);
if (section != NULL)
section->delete_entry(entry_name);
std::ostringstream ss;
for (const auto& [sectionName, section] : sections)
{
bool sectionSaved = sectionName.empty();
for (const auto& [name, entry] : section.entries)
{
if (entry.transient && entry.value.empty())
// Don't save transient-only values
continue;
if (!sectionSaved) {
ss << '[' << sectionName << ']' << std::endl;
sectionSaved = true;
}
ss << name << " = " << entry.value << std::endl;
}
ss << std::endl;
}
data = ss.str();
}
bool ConfigFile::is_virtual(const std::string& section_name, const std::string& entry_name)
void IniFile::save(hostfs::File *file) const
{
ConfigSection *section = get_section(section_name, true);
if (section == nullptr)
std::string data;
save(data);
file->write(data.c_str(), 1, data.length());
}
bool IniFile::hasSection(const std::string& section) const {
return sections.count(section) != 0;
}
bool IniFile::hasEntry(const std::string& section, const std::string& name) const {
return getEntry(section, name) != nullptr;
}
bool IniFile::isTransient(const std::string& section, const std::string& name) const
{
const Entry *entry = getEntry(section, name);
if (entry == nullptr)
return false;
return section->has_entry(entry_name);
else
return entry->transient;
}
} // namespace emucfg
void IniFile::deleteSection(const std::string& section) {
sections.erase(section);
}
void IniFile::deleteEntry(const std::string& sectionName, const std::string& entry)
{
auto it = sections.find(sectionName);
if (it == sections.end())
return;
Section& section = it->second;
section.entries.erase(entry);
}
std::vector<std::string> IniFile::getEntryNames(const std::string& sectionName) const
{
std::vector<std::string> v;
auto it = sections.find(sectionName);
if (it != sections.end())
{
const Section& section = it->second;
for (const auto& [name, entry] : section.entries)
v.push_back(name);
}
return v;
}
} // namespace config
+99 -46
View File
@@ -1,53 +1,106 @@
/*
Copyright 2025 flyinghead
This file is part of Flycast.
Flycast is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 2 of the License, or
(at your option) any later version.
Flycast is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with Flycast. If not, see <https://www.gnu.org/licenses/>.
*/
#pragma once
#include "types.h"
#include "oslib/storage.h"
#include <cstdio>
#include <map>
#include <string>
#include <cstdint>
#include <vector>
#include <locale>
#include <sstream>
namespace emucfg {
namespace config {
struct ConfigEntry {
std::string value;
const std::string& get_string() const;
int get_int();
bool get_bool();
class IniFile
{
public:
void load(hostfs::File *file, bool cEscape = false);
void load(const std::string& data, bool cEscape = false);
void save(hostfs::File *file) const;
void save(std::string& data) const;
bool hasSection(const std::string& section) const;
bool hasEntry(const std::string& section, const std::string& name) const;
bool isTransient(const std::string& section, const std::string& name) const;
void deleteSection(const std::string& section);
void deleteEntry(const std::string& section, const std::string& name);
template<typename T>
void set(const std::string& section, const std::string& entry, T value, bool transient = false) {
setRaw(section, entry, std::to_string(value), transient);
}
const std::string& getString(const std::string& section, const std::string& entry, const std::string& defaultValue = {}) const;
const std::string& get(const std::string& section, const std::string& entry, const std::string& defaultValue = {}) const {
return getString(section, entry, defaultValue);
}
bool getBool(const std::string& section, const std::string& entry, bool defaultValue = false) const;
int getInt(const std::string& section, const std::string& entry, int defaultValue = 0) const;
int64_t getInt64(const std::string& section, const std::string& entry, int64_t defaultValue = 0ll) const;
float getFloat(const std::string& section, const std::string& entry, float defaultValue = 0.f) const;
std::vector<std::string> getEntryNames(const std::string& section) const;
private:
struct Entry
{
std::string name;
std::string value;
std::string transientValue;
bool transient = false;
};
struct Section
{
std::string name;
std::map<std::string, Entry> entries;
};
const Entry *getEntry(const std::string& section, const std::string& entry) const;
const std::string *getRaw(const std::string& section, const std::string& name) const;
void setRaw(const std::string& section, const std::string& name, const std::string& value, bool transient);
std::map<std::string, Section> sections;
};
struct ConfigSection {
std::map<std::string, ConfigEntry> entries;
bool has_entry(const std::string& name);
void set(const std::string& name, const std::string& value);
void delete_entry(const std::string& name);
ConfigEntry* get_entry(const std::string& name);
};
struct ConfigFile {
private:
std::map<std::string, ConfigSection> sections;
std::map<std::string, ConfigSection> virtual_sections;
ConfigSection* add_section(const std::string& name, bool is_virtual);
ConfigSection* get_section(const std::string& name, bool is_virtual);
ConfigEntry* get_entry(const std::string& section_name, const std::string& entry_name);
public:
bool has_section(const std::string& name);
bool has_entry(const std::string& section_name, const std::string& entry_name);
bool is_virtual(const std::string& section_name, const std::string& entry_name);
void parse(FILE* file);
void save(FILE* file);
/* getting values */
std::string get(const std::string& section_name, const std::string& entry_name, const std::string& default_value = "");
int get_int(const std::string& section_name, const std::string& entry_name, int default_value = 0);
bool get_bool(const std::string& section_name, const std::string& entry_name, bool default_value = false);
/* setting values */
void set(const std::string& section_name, const std::string& entry_name, const std::string& value, bool is_virtual = false);
void set_int(const std::string& section_name, const std::string& entry_name, int value, bool is_virtual = false);
void set_bool(const std::string& section_name, const std::string& entry_name, bool value, bool is_virtual = false);
void delete_section(const std::string& section_name);
void delete_entry(const std::string& section_name, const std::string& entry_name);
};
} // namespace emucfg
template<>
inline void IniFile::set(const std::string& section, const std::string& entry, const std::string& value, bool transient) {
setRaw(section, entry, value, transient);
}
template<>
inline void IniFile::set(const std::string& section, const std::string& entry, std::string value, bool transient) {
setRaw(section, entry, value, transient);
}
template<>
inline void IniFile::set(const std::string& section, const std::string& entry, const char *value, bool transient) {
setRaw(section, entry, value, transient);
}
template<>
inline void IniFile::set(const std::string& section, const std::string& entry, bool value, bool transient) {
setRaw(section, entry, value ? "yes" : "no", transient);
}
template<>
inline void IniFile::set(const std::string& section, const std::string& entry, float value, bool transient)
{
std::ostringstream ss;
ss.imbue(std::locale::classic());
ss.precision(7);
ss << value;
setRaw(section, entry, ss.str(), transient);
}
} // namespace config
+131 -23
View File
@@ -17,14 +17,15 @@
along with Flycast. If not, see <https://www.gnu.org/licenses/>.
*/
#include "option.h"
#include "network/net_handshake.h"
#include "debug/gdb_server.h"
namespace config {
// Dynarec
Option<bool> DynarecEnabled("Dynarec.Enabled", true);
Option<bool> DynarecIdleSkip("Dynarec.idleskip", true);
Option<bool> DynarecSafeMode("Dynarec.safe-mode");
Option<int> Sh4Clock("Sh4Clock", 200);
// General
@@ -32,14 +33,19 @@ Option<int> Cable("Dreamcast.Cable", 3); // TV Composite
Option<int> Region("Dreamcast.Region", 1); // USA
Option<int> Broadcast("Dreamcast.Broadcast", 0); // NTSC
Option<int> Language("Dreamcast.Language", 1); // English
Option<bool> FullMMU("Dreamcast.FullMMU");
Option<bool> ForceWindowsCE("Dreamcast.ForceWindowsCE");
Option<bool> AutoSavestate("Dreamcast.AutoSavestate");
OptionString UILanguage("UILanguage", "");
Option<bool> AutoLoadState("Dreamcast.AutoLoadState");
Option<bool> AutoSaveState("Dreamcast.AutoSaveState");
Option<int, false> SavestateSlot("Dreamcast.SavestateSlot");
Option<bool> ForceFreePlay("ForceFreePlay", true);
Option<bool, false> FetchBoxart("FetchBoxart", true);
Option<bool, false> BoxartDisplayMode("BoxartDisplayMode", true);
Option<int, false> UIScaling("UIScaling", 100);
Option<int, false> UITheme("UITheme", 0);
// Sound
Option<bool> DSPEnabled("aica.DSPEnabled", false);
Option<bool> DisableSound("aica.NoSound");
#if HOST_CPU == CPU_ARM
Option<int> AudioBufferSize("aica.BufferSize", 5644); // 128 ms
#else
@@ -54,6 +60,8 @@ Option<bool> AutoLatency("aica.AutoLatency",
);
OptionString AudioBackend("backend", "auto", "audio");
AudioVolumeOption AudioVolume;
Option<bool> VmuSound("VmuSound", false, "audio");
// Rendering
@@ -65,17 +73,24 @@ Option<bool> ShowFPS("rend.ShowFPS");
Option<bool> RenderToTextureBuffer("rend.RenderToTextureBuffer");
Option<bool> TranslucentPolygonDepthMask("rend.TranslucentPolygonDepthMask");
Option<bool> ModifierVolumes("rend.ModifierVolumes", true);
Option<int> TextureUpscale("rend.TextureUpscale", 1);
Option<int> TextureUpscale("rend.TextureUpscale2", 1);
Option<int> MaxFilteredTextureSize("rend.MaxFilteredTextureSize", 256);
Option<float> ExtraDepthScale("rend.ExtraDepthScale", 1.f);
Option<bool> CustomTextures("rend.CustomTextures");
Option<bool> PreloadCustomTextures("rend.PreloadCustomTextures");
Option<bool> DumpTextures("rend.DumpTextures");
Option<bool> DumpUniqueTextures("rend.DumpUniqueTextures");
Option<bool> DumpReplacedTextures("rend.DumpReplacedTextures");
Option<int> ScreenStretching("rend.ScreenStretching", 100);
Option<bool> Fog("rend.Fog", true);
Option<bool> FloatVMUs("rend.FloatVMUs");
Option<bool> Rotate90("rend.Rotate90");
Option<bool> PerStripSorting("rend.PerStripSorting");
Option<bool> DelayFrameSwapping("rend.DelayFrameSwapping");
#ifdef __APPLE__
Option<bool> DelayFrameSwapping("rend.DelayFrameSwapping", false);
#else
Option<bool> DelayFrameSwapping("rend.DelayFrameSwapping", true);
#endif
Option<bool> WidescreenGameHacks("rend.WidescreenGameHacks");
std::array<Option<int>, 4> CrosshairColor {
Option<int>("rend.CrossHairColor1"),
@@ -83,34 +98,95 @@ std::array<Option<int>, 4> CrosshairColor {
Option<int>("rend.CrossHairColor3"),
Option<int>("rend.CrossHairColor4"),
};
Option<int> CrosshairSize("rend.CrosshairSize", 40);
Option<int> SkipFrame("ta.skip");
Option<int> MaxThreads("pvr.MaxThreads", 3);
Option<int> AutoSkipFrame("pvr.AutoSkipFrame", 0);
Option<int> RenderResolution("rend.Resolution", 480);
Option<bool> IntegerScale("rend.IntegerScale", false);
Option<bool> LinearInterpolation("rend.LinearInterpolation", true);
Option<bool> VSync("rend.vsync", true);
Option<int64_t> PixelBufferSize("rend.PixelBufferSize", 512_MB);
Option<int> AnisotropicFiltering("rend.AnisotropicFiltering", 1);
Option<int> TextureFiltering("rend.TextureFiltering", 0); // Default
Option<bool> ThreadedRendering("rend.ThreadedRendering", true);
Option<bool> VblankPacing("");
Option<bool> DupeFrames("rend.DupeFrames", false);
Option<int> PerPixelLayers("rend.PerPixelLayers", 32);
#ifdef TARGET_UWP
Option<bool> NativeDepthInterpolation("rend.NativeDepthInterpolation", true);
#else
Option<bool> NativeDepthInterpolation("rend.NativeDepthInterpolation", false);
#endif
Option<bool> EmulateFramebuffer("rend.EmulateFramebuffer", false);
Option<bool> FixUpscaleBleedingEdge("rend.FixUpscaleBleedingEdge", true);
Option<bool> CustomGpuDriver("rend.CustomGpuDriver", false);
Option<bool> FramePacing("rend.FramePacing", true);
#ifdef VIDEO_ROUTING
Option<bool, false> VideoRouting("rend.VideoRouting", false);
Option<bool, false> VideoRoutingScale("rend.VideoRoutingScale", false);
Option<int, false> VideoRoutingVRes("rend.VideoRoutingVRes", 720);
#endif
// Misc
Option<bool> SerialConsole("Debug.SerialConsoleEnabled");
Option<bool> SerialPTY("Debug.SerialPTY");
Option<bool> GDB("Debug.GDBEnabled");
Option<int> GDBPort("Debug.GDBPort", debugger::DEFAULT_PORT);
Option<bool> GDBWaitForConnection("Debug.GDBWaitForConnection");
Option<bool> UseReios("UseReios");
Option<bool> FastGDRomLoad("FastGDRomLoad", false);
Option<bool> RamMod32MB("Dreamcast.RamMod32MB", false);
Option<bool> OpenGlChecks("OpenGlChecks", false, "validate");
Option<std::vector<std::string>, false> ContentPath("Dreamcast.ContentPath");
Option<std::vector<std::string>, false> BiosPath("Dreamcast.BiosPath");
Option<std::string, false> VMUPath("Dreamcast.VMUPath");
Option<std::vector<std::string>, false> SavestatePath("Dreamcast.SavestatePath");
Option<std::string, false> SavePath("Dreamcast.SavePath");
Option<std::vector<std::string>, false> TexturePath("Dreamcast.TexturePath");
Option<std::string, false> TextureDumpPath("Dreamcast.TextureDumpPath");
Option<std::string, false> BoxartPath("Dreamcast.BoxartPath");
Option<std::vector<std::string>, false> MappingsPath("Dreamcast.MappingsPath");
Option<std::vector<std::string>, false> CheatPath("Dreamcast.CheatPath");
Option<bool, false> HideLegacyNaomiRoms("Dreamcast.HideLegacyNaomiRoms", true);
Option<bool, false> UploadCrashLogs("UploadCrashLogs", true);
Option<bool, false> DiscordPresence("DiscordPresence", true);
#if defined(__ANDROID__) && !defined(LIBRETRO)
Option<bool, false> UseSafFilePicker("UseSafFilePicker", true);
#endif
OptionString LogServer("LogServer", "", "log");
// Profiler
Option<bool> ProfilerEnabled("Profiler.Enabled");
Option<bool> ProfilerDrawToGUI("Profiler.DrawGUI");
Option<bool> ProfilerOutputTTY("Profiler.OutputTTY");
Option<float> ProfilerFrameWarningTime("Profiler.FrameWarningTime", 1.0f / 55.0f);
// Network
Option<bool> NetworkEnable("Enable", false, "network");
Option<bool> ActAsServer("ActAsServer", false, "network");
OptionString DNS("DNS", "46.101.91.123", "network");
Option<bool> NaomiSatellite("NaomiSatellite", false, "network");
OptionString DNS("DNS", "dns.flyca.st", "network");
OptionString NetworkServer("server", "", "network");
Option<int> LocalPort("LocalPort", defaultNaomiServerPort(), "network");
Option<bool> EmulateBBA("EmulateBBA", false, "network");
#ifdef SUPPORT_DISPMANX
Option<bool> DispmanxMaintainAspect("maintain_aspect", true, "dispmanx");
#endif
Option<bool> EnableUPnP("EnableUPnP", true, "network");
Option<bool> GGPOEnable("GGPO", false, "network");
Option<int> GGPODelay("GGPODelay", 0, "network");
Option<bool> NetworkStats("Stats", true, "network");
Option<int> GGPOAnalogAxes("GGPOAnalogAxes", 0, "network");
Option<bool> GGPOChat("GGPOChat", true, "network");
Option<bool> GGPOChatTimeoutToggle("GGPOChatTimeoutToggle", true, "network");
Option<int> GGPOChatTimeout("GGPOChatTimeout", 10, "network");
Option<bool> NetworkOutput("NetworkOutput", false, "network");
Option<int> MultiboardSlaves("MultiboardSlaves", 1, "network");
Option<bool> BattleCableEnable("BattleCable", false, "network");
Option<bool> UseDCNet("DCNet", true, "network");
OptionString ISPUsername("ISPUsername", "flycast1", "network");
#ifdef USE_OMX
Option<int> OmxAudioLatency("audio_latency", 100, "omx");
@@ -121,6 +197,7 @@ Option<bool> OmxAudioHdmi("audio_hdmi", true, "omx");
Option<int> MouseSensitivity("MouseSensitivity", 100, "input");
Option<int> VirtualGamepadVibration("VirtualGamepadVibration", 20, "input");
Option<int> VirtualGamepadTransparency("VirtualGamepadTransparency", 37, "input");
std::array<Option<MapleDeviceType>, 4> MapleMainDevices {
Option<MapleDeviceType>("device1", MDT_SegaController, "input"),
@@ -128,18 +205,49 @@ std::array<Option<MapleDeviceType>, 4> MapleMainDevices {
Option<MapleDeviceType>("device3", MDT_None, "input"),
Option<MapleDeviceType>("device4", MDT_None, "input"),
};
std::array<std::array<Option<MapleDeviceType>, 2>, 4> MapleExpansionDevices {
Option<MapleDeviceType>("device1.1", MDT_SegaVMU, "input"),
Option<MapleDeviceType>("device1.2", MDT_SegaVMU, "input"),
std::array<std::array<Option<MapleDeviceType>, 2>, 4> MapleExpansionDevices {{
{{Option<MapleDeviceType>("device1.1", MDT_SegaVMU, "input"),
Option<MapleDeviceType>("device1.2", MDT_SegaVMU, "input")}},
Option<MapleDeviceType>("device2.1", MDT_None, "input"),
Option<MapleDeviceType>("device2.2", MDT_None, "input"),
{{Option<MapleDeviceType>("device2.1", MDT_None, "input"),
Option<MapleDeviceType>("device2.2", MDT_None, "input")}},
Option<MapleDeviceType>("device3.1", MDT_None, "input"),
Option<MapleDeviceType>("device3.2", MDT_None, "input"),
{{Option<MapleDeviceType>("device3.1", MDT_None, "input"),
Option<MapleDeviceType>("device3.2", MDT_None, "input")}},
Option<MapleDeviceType>("device4.1", MDT_None, "input"),
Option<MapleDeviceType>("device4.2", MDT_None, "input"),
};
{{Option<MapleDeviceType>("device4.1", MDT_None, "input"),
Option<MapleDeviceType>("device4.2", MDT_None, "input")}},
}};
std::array<std::array<Option<int>, 2>, 4> NetworkExpansionDevices{{
{{Option<int>("device1.1.net", 0, "input"),
Option<int>("device1.2.net", 0, "input")}},
{{Option<int>("device2.1.net", 0, "input"),
Option<int>("device2.2.net", 0, "input")}},
{{Option<int>("device3.1.net", 0, "input"),
Option<int>("device3.2.net", 0, "input")}},
{{Option<int>("device4.1.net", 0, "input"),
Option<int>("device4.2.net", 0, "input")}},
}};
Option<bool> PerGameVmu("PerGameVmu", true, "config");
#ifdef _WIN32
Option<bool, false> UseRawInput("RawInput", false, "input");
#endif
Option<bool> UsePhysicalVmuMemory("UsePhysicalVmuMemory", false);
#ifdef USE_LUA
Option<std::string, false> LuaFileName("LuaFileName", "flycast.lua");
#endif
// RetroAchievements
Option<bool> EnableAchievements("Enabled", false, "achievements");
Option<bool> AchievementsHardcoreMode("HardcoreMode", false, "achievements");
OptionString AchievementsUserName("UserName", "", "achievements");
OptionString AchievementsToken("Token", "", "achievements");
OptionString AchievementsHostUrl("HostUrl", "", "achievements");
} // namespace config
+269 -103
View File
@@ -20,8 +20,13 @@
#include <string>
#include <vector>
#include <array>
#include <cmath>
#include <type_traits>
#include "cfg.h"
#include "hw/maple/maple_cfg.h"
#ifdef LIBRETRO
#include <libretro.h>
#endif
namespace config {
@@ -33,6 +38,10 @@ public:
virtual void reset() = 0;
};
#ifdef LIBRETRO
#include "option_lr.h"
#else
class Settings {
public:
void reset() {
@@ -47,7 +56,7 @@ public:
{
if (gameId.empty())
return;
if (!cfgHasSection(gameId))
if (!hasSection(gameId))
return;
perGameConfig = true;
}
@@ -56,14 +65,10 @@ public:
}
void save() {
cfgSetAutoSave(false);
setAutoSave(false);
for (const auto& o : options)
o->save();
cfgSetAutoSave(true);
}
const std::string& getGameId() const {
return gameId;
setAutoSave(true);
}
void setGameId(const std::string& gameId) {
@@ -77,7 +82,7 @@ public:
this->perGameConfig = perGameConfig;
if (!perGameConfig) {
if (!gameId.empty())
cfgDeleteSection(gameId);
deleteSection(gameId);
reset();
}
}
@@ -96,10 +101,6 @@ private:
friend class Option;
};
// Missing in C++11
template <bool B, typename T = void>
using enable_if_t = typename std::enable_if<B, T>::type;
template<typename T, bool PerGameOption = true>
class Option : public BaseOption {
public:
@@ -117,11 +118,11 @@ public:
void load() override {
if (PerGameOption && settings.hasPerGameConfig())
set(doLoad(settings.getGameId(), section + "." + name));
set(doLoad(settings.gameId, section + "." + name));
else
{
set(doLoad(section, name));
if (cfgIsVirtual(section, name))
if (isTransient(section, name))
override(value);
}
}
@@ -138,10 +139,14 @@ public:
else if (PerGameOption && settings.hasPerGameConfig())
{
if (value == doLoad(section, name))
{
// delete existing per-game option if any
deleteEntry(settings.gameId, section + "." + name);
return;
}
}
if (PerGameOption && settings.hasPerGameConfig())
doSave(settings.getGameId(), section + "." + name);
doSave(settings.gameId, section + "." + name);
else
doSave(section, name);
}
@@ -149,8 +154,8 @@ public:
T& get() { return value; }
void set(T v) { value = v; }
void override(T v) {
verify(PerGameOption);
void override(T v)
{
overriddenDefault = v;
overridden = true;
value = v;
@@ -165,105 +170,169 @@ public:
protected:
template <typename U = T>
enable_if_t<std::is_same<U, bool>::value, T>
std::enable_if_t<std::is_same_v<U, bool>, T>
doLoad(const std::string& section, const std::string& name) const
{
return cfgLoadBool(section, name, value);
return loadBool(section, name, value);
}
template <typename U = T>
enable_if_t<(std::is_integral<U>::value || std::is_enum<U>::value)
&& !std::is_same<U, bool>::value, T>
std::enable_if_t<std::is_same<U, int64_t>::value, T>
doLoad(const std::string& section, const std::string& name) const
{
return (T)cfgLoadInt(section, name, (int)value);
return loadInt64(section, name, value);
}
template <typename U = T>
enable_if_t<std::is_same<U, std::string>::value, T>
std::enable_if_t<(std::is_integral_v<U> || std::is_enum_v<U>)
&& !std::is_same_v<U, bool> && !std::is_same_v<U, int64_t>, T>
doLoad(const std::string& section, const std::string& name) const
{
return cfgLoadStr(section, name, value);
return (T)loadInt(section, name, (int)value);
}
template <typename U = T>
enable_if_t<std::is_same<float, U>::value, T>
std::enable_if_t<std::is_same_v<U, std::string>, T>
doLoad(const std::string& section, const std::string& name) const
{
std::string strValue = cfgLoadStr(section, name, "");
if (strValue.empty())
return value;
else
return atof(strValue.c_str());
return loadStr(section, name, value);
}
template <typename U = T>
enable_if_t<std::is_same<std::vector<std::string>, U>::value, T>
std::enable_if_t<std::is_same_v<float, U>, T>
doLoad(const std::string& section, const std::string& name) const
{
std::string paths = cfgLoadStr(section, name, "");
return loadFloat(section, name, value);
}
template <typename U = T>
std::enable_if_t<std::is_same_v<std::vector<std::string>, U>, T>
doLoad(const std::string& section, const std::string& name) const
{
std::string paths = loadStr(section, name);
if (paths.empty())
return value;
std::string::size_type start = 0;
std::vector<std::string> newValue;
while (true)
{
std::string::size_type end = paths.find(';', start);
if (end == std::string::npos)
end = paths.size();
if (start != end)
newValue.push_back(paths.substr(start, end - start));
if (end == paths.size())
break;
start = end + 1;
if (paths[start] == '"')
{
std::string v;
start++;
while (true)
{
if (paths[start] == '"')
{
if (start + 1 >= paths.size())
{
newValue.push_back(v);
return newValue;
}
if (paths[start + 1] == '"')
{
v += paths[start++];
start++;
}
else if (paths[start + 1] == ';')
{
newValue.push_back(v);
start += 2;
break;
}
else
{
v += paths[start++];
}
}
else
v += paths[start++];
}
}
else
{
std::string::size_type end = paths.find(';', start);
if (end == std::string::npos)
end = paths.size();
if (start != end)
newValue.push_back(paths.substr(start, end - start));
if (end == paths.size())
break;
start = end + 1;
}
}
return newValue;
}
template <typename U = T>
enable_if_t<std::is_same<U, bool>::value>
std::enable_if_t<std::is_same_v<U, bool>>
doSave(const std::string& section, const std::string& name) const
{
cfgSaveBool(section, name, value);
saveBool(section, name, value);
}
template <typename U = T>
enable_if_t<(std::is_integral<U>::value || std::is_enum<U>::value)
&& !std::is_same<U, bool>::value>
std::enable_if_t<std::is_same<U, int64_t>::value>
doSave(const std::string& section, const std::string& name) const
{
cfgSaveInt(section, name, (int)value);
saveInt64(section, name, value);
}
template <typename U = T>
enable_if_t<std::is_same<U, std::string>::value>
std::enable_if_t<(std::is_integral_v<U> || std::is_enum_v<U>)
&& !std::is_same_v<U, bool> && !std::is_same_v<U, int64_t>>
doSave(const std::string& section, const std::string& name) const
{
cfgSaveStr(section, name, value);
saveInt(section, name, (int)value);
}
template <typename U = T>
enable_if_t<std::is_same<float, U>::value>
std::enable_if_t<std::is_same_v<U, std::string>>
doSave(const std::string& section, const std::string& name) const
{
char buf[64];
snprintf(buf, sizeof(buf), "%f", value);
cfgSaveStr(section, name, buf);
saveStr(section, name, value);
}
template <typename U = T>
enable_if_t<std::is_same<std::vector<std::string>, U>::value>
std::enable_if_t<std::is_same_v<float, U>>
doSave(const std::string& section, const std::string& name) const
{
saveFloat(section, name, value);
}
template <typename U = T>
std::enable_if_t<std::is_same_v<std::vector<std::string>, U>>
doSave(const std::string& section, const std::string& name) const
{
std::string s;
for (auto& v : value)
for (const auto& v : value)
{
if (s.empty())
s = v;
if (!s.empty())
s += ';';
if (v.find(';') != std::string::npos || (!v.empty() && v[0] == '"'))
{
s += '"';
std::string v2 = v;
while (true)
{
auto pos = v2.find('"');
if (pos != std::string::npos)
{
s += v2.substr(0, pos + 1) + '"';
v2 = v2.substr(pos + 1);
}
else
{
s += v2;
break;
}
}
s += '"';
}
else
s += ";" + v;
s += v;
}
cfgSaveStr(section, name, s);
saveStr(section, name, s);
}
std::string section;
@@ -274,20 +343,16 @@ protected:
bool overridden = false;
Settings& settings;
};
#endif
using OptionString = Option<std::string>;
template<typename T, T value = T()>
class ConstOption {
public:
operator T() const { return value; }
};
// Dynarec
extern Option<bool> DynarecEnabled;
extern Option<bool> DynarecIdleSkip;
extern Option<bool> DynarecSafeMode;
#ifndef LIBRETRO
extern Option<int> Sh4Clock;
#endif
// General
@@ -295,57 +360,76 @@ extern Option<int> Cable; // 0 -> VGA, 1 -> VGA, 2 -> RGB, 3 -> TV Composite
extern Option<int> Region; // 0 -> JP, 1 -> USA, 2 -> EU, 3 -> default
extern Option<int> Broadcast; // 0 -> NTSC, 1 -> PAL, 2 -> PAL/M, 3 -> PAL/N, 4 -> default
extern Option<int> Language; // 0 -> JP, 1 -> EN, 2 -> DE, 3 -> FR, 4 -> SP, 5 -> IT, 6 -> default
extern Option<bool> FullMMU;
extern Option<bool> ForceWindowsCE;
extern Option<bool> AutoSavestate;
extern OptionString UILanguage;
extern Option<bool> AutoLoadState;
extern Option<bool> AutoSaveState;
extern Option<int, false> SavestateSlot;
extern Option<bool> ForceFreePlay;
extern Option<bool, false> FetchBoxart;
extern Option<bool, false> BoxartDisplayMode;
extern Option<int, false> UIScaling;
extern Option<int, false> UITheme; // 0 -> Dark, 1 -> Light, 2 -> Dreamcast, 3 -> High Contrast, 4 -> Nintendo, 5 -> Aqua Chill
// Sound
constexpr ConstOption<bool, true> LimitFPS;
constexpr bool LimitFPS = true;
extern Option<bool> DSPEnabled;
extern Option<bool> DisableSound;
extern Option<int> AudioBufferSize; //In samples ,*4 for bytes
extern Option<bool> AutoLatency;
extern OptionString AudioBackend;
class AudioVolumeOption : public Option<int> {
public:
AudioVolumeOption() : Option<int>("aica.Volume", 100) {};
float logarithmic_volume_scale = 1.0;
void load() override {
Option<int>::load();
calcDbPower();
}
float dbPower()
{
return logarithmic_volume_scale;
}
void calcDbPower()
{
// dB scaling calculation: https://www.dr-lex.be/info-stuff/volumecontrols.html
logarithmic_volume_scale = std::min(std::exp(4.605f * float(value) / 100.f) / 100.f, 1.f);
if (value < 10)
logarithmic_volume_scale *= value / 10.f;
}
};
extern AudioVolumeOption AudioVolume;
extern Option<bool> VmuSound;
// Rendering
class RendererOption : public Option<RenderType> {
public:
RendererOption()
: Option<RenderType>("pvr.rend", RenderType::OpenGL) {}
#ifdef LIBRETRO
RendererOption() : Option<RenderType>("",
#else
RendererOption() : Option<RenderType>("pvr.rend",
#endif
#if defined(USE_DX11)
RenderType::DirectX11
#elif defined(USE_DX9)
RenderType::DirectX9
#elif !defined(USE_OPENGL)
RenderType::Vulkan
#else
RenderType::OpenGL
#endif
) {}
bool isOpenGL() const {
return value == RenderType::OpenGL || value == RenderType::OpenGL_OIT;
}
void set(RenderType v)
{
newValue = v;
}
RenderType& operator=(const RenderType& v) { set(v); return value; }
void load() override {
RenderType current = value;
Option<RenderType>::load();
newValue = value;
value = current;
}
void reset() override {
// don't reset the value to avoid vk -> gl -> vk quick switching
// don't reset the value to avoid quick switching when starting a game
overridden = false;
}
bool pendingChange() {
return newValue != value;
}
void commit() {
value = newValue;
}
private:
RenderType newValue = RenderType();
};
extern RendererOption RendererType;
extern Option<bool> UseMipmaps;
@@ -355,12 +439,18 @@ extern Option<bool> ShowFPS;
extern Option<bool> RenderToTextureBuffer;
extern Option<bool> TranslucentPolygonDepthMask;
extern Option<bool> ModifierVolumes;
constexpr ConstOption<bool, true> Clipping;
constexpr bool Clipping = true;
#ifndef LIBRETRO
extern Option<int> TextureUpscale;
extern Option<int> MaxFilteredTextureSize;
extern Option<int> PerPixelLayers;
#endif
extern Option<float> ExtraDepthScale;
extern Option<bool> CustomTextures;
extern Option<bool> PreloadCustomTextures;
extern Option<bool> DumpTextures;
extern Option<bool> DumpUniqueTextures;
extern Option<bool> DumpReplacedTextures;
extern Option<int> ScreenStretching; // in percent. 150 means stretch from 4/3 to 6/3
extern Option<bool> Fog;
extern Option<bool> FloatVMUs;
@@ -369,34 +459,90 @@ extern Option<bool> PerStripSorting;
extern Option<bool> DelayFrameSwapping; // Delay swapping frame until FB_R_SOF matches FB_W_SOF
extern Option<bool> WidescreenGameHacks;
extern std::array<Option<int>, 4> CrosshairColor;
extern Option<int> CrosshairSize;
extern Option<int> SkipFrame;
extern Option<int> MaxThreads;
extern Option<int> AutoSkipFrame; // 0: none, 1: some, 2: more
extern Option<int> RenderResolution;
extern Option<bool> IntegerScale;
extern Option<bool> LinearInterpolation;
extern Option<bool> VSync;
extern Option<int64_t> PixelBufferSize;
extern Option<int> AnisotropicFiltering;
extern Option<int> TextureFiltering; // 0: default, 1: force nearest, 2: force linear
extern Option<bool> ThreadedRendering;
extern Option<bool> VblankPacing;
extern Option<bool> DupeFrames;
extern Option<bool> NativeDepthInterpolation;
extern Option<bool> EmulateFramebuffer;
extern Option<bool> FixUpscaleBleedingEdge;
extern Option<bool> CustomGpuDriver;
extern Option<bool> FramePacing;
#ifdef VIDEO_ROUTING
extern Option<bool, false> VideoRouting;
extern Option<bool, false> VideoRoutingScale;
extern Option<int, false> VideoRoutingVRes;
#endif
// Misc
extern Option<bool> SerialConsole;
extern Option<bool> SerialPTY;
extern Option<bool> GDB;
extern Option<int> GDBPort;
extern Option<bool> GDBWaitForConnection;
extern Option<bool> UseReios;
extern Option<bool> FastGDRomLoad;
extern Option<bool> RamMod32MB;
extern Option<bool> OpenGlChecks;
extern Option<std::vector<std::string>, false> ContentPath;
extern Option<std::vector<std::string>, false> BiosPath;
extern Option<std::string, false> VMUPath;
extern Option<std::vector<std::string>, false> SavestatePath;
extern Option<std::string, false> SavePath;
extern Option<std::vector<std::string>, false> TexturePath;
extern Option<std::string, false> TextureDumpPath;
extern Option<std::string, false> BoxartPath;
extern Option<std::vector<std::string>, false> MappingsPath;
extern Option<std::vector<std::string>, false> CheatPath;
extern Option<bool, false> HideLegacyNaomiRoms;
extern Option<bool, false> UploadCrashLogs;
extern Option<bool, false> DiscordPresence;
#if defined(__ANDROID__) && !defined(LIBRETRO)
extern Option<bool, false> UseSafFilePicker;
#endif
extern OptionString LogServer;
// Profiling
extern Option<bool> ProfilerEnabled;
extern Option<bool> ProfilerDrawToGUI;
extern Option<bool> ProfilerOutputTTY;
extern Option<float> ProfilerFrameWarningTime;
// Network
extern Option<bool> NetworkEnable;
extern Option<bool> ActAsServer;
extern Option<bool> NaomiSatellite;
extern OptionString DNS;
extern OptionString NetworkServer;
extern Option<int> LocalPort;
extern Option<bool> EmulateBBA;
#ifdef SUPPORT_DISPMANX
extern Option<bool> DispmanxMaintainAspect;
#endif
extern Option<bool> EnableUPnP;
extern Option<bool> GGPOEnable;
extern Option<int> GGPODelay;
extern Option<bool> NetworkStats;
extern Option<int> GGPOAnalogAxes;
extern Option<bool> GGPOChat;
extern Option<bool> GGPOChatTimeoutToggle;
extern Option<int> GGPOChatTimeout;
extern Option<bool> NetworkOutput;
extern Option<int> MultiboardSlaves;
extern Option<bool> BattleCableEnable;
extern Option<bool> UseDCNet;
extern OptionString ISPUsername;
#ifdef USE_OMX
extern Option<int> OmxAudioLatency;
@@ -407,8 +553,28 @@ extern Option<bool> OmxAudioHdmi;
extern Option<int> MouseSensitivity;
extern Option<int> VirtualGamepadVibration;
extern Option<int> VirtualGamepadTransparency;
extern std::array<Option<MapleDeviceType>, 4> MapleMainDevices;
extern std::array<std::array<Option<MapleDeviceType>, 2>, 4> MapleExpansionDevices;
extern std::array<std::array<Option<int>, 2>, 4> NetworkExpansionDevices;
extern Option<bool> PerGameVmu;
#ifdef _WIN32
extern Option<bool, false> UseRawInput;
#else
constexpr bool UseRawInput = false;
#endif
extern Option<bool> UsePhysicalVmuMemory;
#ifdef USE_LUA
extern Option<std::string, false> LuaFileName;
#endif
// RetroAchievements
extern Option<bool> EnableAchievements;
extern Option<bool> AchievementsHardcoreMode;
extern OptionString AchievementsUserName;
extern OptionString AchievementsToken;
extern OptionString AchievementsHostUrl;
} // namespace config
+54
View File
@@ -0,0 +1,54 @@
#pragma once
#include <utility>
#include <libchdr/chd.h>
#include "oslib/storage.h"
namespace CHD
{
namespace Callbacks
{
// Moved out here to avoid being duplicated by the template.
inline uint64_t fsize(struct chd_core_file *core_file)
{
auto file = static_cast<hostfs::File*>(core_file->argp);
return file->size();
}
inline size_t fread(void* buffer, size_t size, size_t count, struct chd_core_file *core_file)
{
auto file = static_cast<hostfs::File*>(core_file->argp);
return file->read(buffer, size, count);
}
inline int fclose(struct chd_core_file *core_file)
{
auto file = static_cast<hostfs::File*>(core_file->argp);
delete file;
delete core_file;
return 0;
}
inline int fseek(struct chd_core_file *core_file, int64_t offset, int whence)
{
auto file = static_cast<hostfs::File*>(core_file->argp);
return file->seek(offset, whence);
}
}
}
template<typename... Ts>
inline auto chd_open_file(hostfs::File *file, Ts &&...args)
{
auto core_file = new struct chd_core_file();
core_file->argp = file;
core_file->fsize = CHD::Callbacks::fsize;
core_file->fread = CHD::Callbacks::fread;
core_file->fclose = CHD::Callbacks::fclose;
core_file->fseek = CHD::Callbacks::fseek;
return chd_open_core_file(core_file, std::forward<Ts>(args)...);
}
+911 -314
View File
File diff suppressed because it is too large. Load diff
+30 -6
View File
@@ -21,12 +21,15 @@
#pragma once
#include "types.h"
#include <vector>
struct WidescreenCheat
{
const char *game_id;
const char *area_or_version;
u32 addresses[16];
u32 values[16];
u32 origValues[16];
};
struct Cheat
@@ -39,22 +42,36 @@ struct Cheat
runNextIfEq,
runNextIfNeq,
runNextIfGt,
runNextIfLt
runNextIfLt,
copy
};
Type type = Type::disabled;
Type type;
std::string description;
bool enabled = false;
u32 size = 0;
u32 address = 0;
u32 value = 0;
bool enabled;
u32 size;
u32 address;
u32 value;
u8 valueMask = 0;
u32 repeatCount = 1;
u32 repeatValueIncrement = 0;
u32 repeatAddressIncrement = 0;
u32 destAddress = 0;
bool builtIn;
Cheat(Type type = Type::disabled, const std::string& description = "", bool enabled = false,
u32 size = 0, u32 address = 0, u32 value = 0, bool builtIn = false)
: type(type), description(description), enabled(enabled),
size(size), address(address), value(value), builtIn(builtIn)
{
}
};
class CheatManager
{
public:
~CheatManager() {
reset("");
}
void reset(const std::string& gameId);
void apply();
size_t cheatCount() const { return cheats.size(); }
@@ -62,12 +79,15 @@ public:
bool cheatEnabled(size_t index) const { return cheats[index].enabled; }
void enableCheat(size_t index, bool enabled) { cheats[index].enabled = enabled; }
void loadCheatFile(const std::string& filename);
void saveCheatFile(const std::string& filename);
// Returns true if using 16:9 anamorphic screen ratio
bool isWidescreen() const { return widescreen_cheat != nullptr; }
void addGameSharkCheat(const std::string& name, const std::string& s);
private:
u32 readRam(u32 addr, u32 bits);
void writeRam(u32 addr, u32 value, u32 bits);
void setActive(bool active);
static const WidescreenCheat widescreen_cheats[];
static const WidescreenCheat naomi_widescreen_cheats[];
@@ -75,6 +95,10 @@ private:
bool active = false;
std::vector<Cheat> cheats;
std::string gameId;
friend class CheatManagerTest_TestLoad_Test;
friend class CheatManagerTest_TestGameShark_Test;
friend class CheatManagerTest_TestSave_Test;
};
extern CheatManager cheatManager;
-260
View File
@@ -1,260 +0,0 @@
RZDCY_FILES :=
RZDCY_SRC_DIR ?= $(call my-dir)
VERSION_HEADER := $(RZDCY_SRC_DIR)/version.h
RZDCY_MODULES := cfg/ hw/arm7/ hw/aica/ hw/holly/ hw/ hw/gdrom/ hw/maple/ \
hw/mem/ hw/pvr/ hw/sh4/ hw/sh4/interpr/ hw/sh4/modules/ profiler/ oslib/ \
hw/naomi/ imgread/ ./ deps/libchdr/src/ deps/libchdr/deps/zlib-1.2.11/ \
deps/libelf/ deps/chdpsr/ rend/ reios/ deps/xbrz/ \
deps/imgui/ archive/ input/ log/ wsi/ network/ hw/bba/ debug/ \
hw/modem/ deps/picotcp/modules/ deps/picotcp/stack/
ifndef NO_REC
ifndef NOT_ARM
RZDCY_MODULES += rec-ARM/ deps/vixl/ deps/vixl/aarch32/
endif
ifdef X86_REC
RZDCY_MODULES += rec-x86/
endif
ifdef X64_REC
RZDCY_MODULES += rec-x64/
endif
ifdef CPP_REC
RZDCY_MODULES += rec-cpp/
endif
ifdef ARM64_REC
RZDCY_MODULES += rec-ARM64/ deps/vixl/ deps/vixl/aarch64/
endif
endif
ifndef NO_REND
RZDCY_MODULES += rend/gles/
ifndef USE_GLES
ifndef USE_DISPMANX
RZDCY_MODULES += rend/gl4/
endif
endif
ifdef USE_VULKAN
RZDCY_MODULES += rend/vulkan/ rend/vulkan/oit/ deps/volk/ \
deps/glslang/glslang/MachineIndependent/ \
deps/glslang/glslang/MachineIndependent/preprocessor/ \
deps/glslang/glslang/GenericCodeGen/ \
deps/glslang/OGLCompilersDLL/ \
deps/glslang/SPIRV/
ifdef FOR_WINDOWS
RZDCY_FILES += $(RZDCY_SRC_DIR)/deps/glslang/glslang/OSDependent/Windows/ossource.cpp
else
RZDCY_FILES += $(RZDCY_SRC_DIR)/deps/glslang/glslang/OSDependent/Unix/ossource.cpp
endif
endif
else
RZDCY_MODULES += rend/norend/
endif
ifdef USE_SDL
RZDCY_MODULES += sdl/
endif
ifdef FOR_LINUX
ifndef UNIT_TESTS
RZDCY_MODULES += linux-dist/
endif
RZDCY_MODULES += linux/
endif
ifdef FOR_WINDOWS
ifndef UNIT_TESTS
RZDCY_FILES += $(RZDCY_SRC_DIR)/windows/winmain.cpp
endif
RZDCY_FILES += $(RZDCY_SRC_DIR)/windows/win_vmem.cpp
RZDCY_CFLAGS += -I$(RZDCY_SRC_DIR)/deps/dirent
endif
ifdef USE_VULKAN
ifdef FOR_WINDOWS
RZDCY_CFLAGS += -DVK_USE_PLATFORM_WIN32_KHR
else
RZDCY_CFLAGS += -DVK_USE_PLATFORM_XLIB_KHR
endif
RZDCY_CFLAGS += -D USE_VULKAN
endif
RZDCY_CFLAGS += -I$(RZDCY_SRC_DIR) -I$(RZDCY_SRC_DIR)/rend/gles -I$(RZDCY_SRC_DIR)/deps \
-I$(RZDCY_SRC_DIR)/deps/vixl -I$(RZDCY_SRC_DIR)/khronos -I$(RZDCY_SRC_DIR)/deps/glslang \
-I$(RZDCY_SRC_DIR)/deps/glm -I$(RZDCY_SRC_DIR)/deps/xbyak -I$(RZDCY_SRC_DIR)/deps/nowide/include \
-I$(RZDCY_SRC_DIR)/deps/picotcp/include -I$(RZDCY_SRC_DIR)/deps/picotcp/modules \
-I$(RZDCY_SRC_DIR)/deps/libchdr/include -I$(RZDCY_SRC_DIR)/deps/libchdr/deps/zlib-1.2.11/ \
-I$(RZDCY_SRC_DIR)/deps/libchdr/deps/lzma-19.00 -I$(RZDCY_SRC_DIR)/deps/libchdr/deps/lzma-19.00/include
ifdef USE_SYSTEM_MINIUPNPC
RZDCY_CFLAGS += -I/usr/include/miniupnpc
else
RZDCY_CFLAGS += -I$(RZDCY_SRC_DIR)/deps/miniupnpc
endif
ifdef NO_REC
RZDCY_CFLAGS += -DTARGET_NO_REC
else
RZDCY_MODULES += hw/sh4/dyna/
endif
ifdef USE_GLES
RZDCY_CFLAGS += -DGLES -fPIC
endif
ifdef CHD5_FLAC
RZDCY_CFLAGS += -DCHD5_FLAC -I$(RZDCY_SRC_DIR)/deps/flac/src/libFLAC/include/ -I$(RZDCY_SRC_DIR)/deps/flac/include
RZDCY_CFLAGS += -DHAVE_CONFIG_H
RZDCY_MODULES += deps/flac/src/libFLAC/
endif
# 7-Zip/LZMA settings (CHDv5)
ifdef CHD5_LZMA
RZDCY_MODULES += deps/lzma/
RZDCY_CFLAGS += -D_7ZIP_ST -DCHD5_LZMA
endif
RZDCY_CFLAGS += -DXXH_INLINE_ALL -I$(RZDCY_SRC_DIR)/deps/xxHash -I$(RZDCY_SRC_DIR)/deps/stb
RZDCY_FILES += $(foreach dir,$(addprefix $(RZDCY_SRC_DIR)/,$(RZDCY_MODULES)),$(wildcard $(dir)*.cpp))
RZDCY_FILES += $(foreach dir,$(addprefix $(RZDCY_SRC_DIR)/,$(RZDCY_MODULES)),$(wildcard $(dir)*.cc))
RZDCY_FILES += $(foreach dir,$(addprefix $(RZDCY_SRC_DIR)/,$(RZDCY_MODULES)),$(wildcard $(dir)*.c))
RZDCY_FILES += $(foreach dir,$(addprefix $(RZDCY_SRC_DIR)/,$(RZDCY_MODULES)),$(wildcard $(dir)*.S))
ifdef STATIC_LIBZIP
RZDCY_CFLAGS += -I$(RZDCY_SRC_DIR)/deps/libzip/lib
LIBZIP_DIR = $(RZDCY_SRC_DIR)/deps/libzip/lib
RZDCY_FILES += $(LIBZIP_DIR)/zip_add.c \
$(LIBZIP_DIR)/zip_add_dir.c \
$(LIBZIP_DIR)/zip_add_entry.c \
$(LIBZIP_DIR)/zip_algorithm_deflate.c \
$(LIBZIP_DIR)/zip_buffer.c \
$(LIBZIP_DIR)/zip_close.c \
$(LIBZIP_DIR)/zip_delete.c \
$(LIBZIP_DIR)/zip_dir_add.c \
$(LIBZIP_DIR)/zip_dirent.c \
$(LIBZIP_DIR)/zip_discard.c \
$(LIBZIP_DIR)/zip_entry.c \
$(LIBZIP_DIR)/zip_error.c \
$(LIBZIP_DIR)/zip_error_clear.c \
$(LIBZIP_DIR)/zip_error_get.c \
$(LIBZIP_DIR)/zip_error_get_sys_type.c \
$(LIBZIP_DIR)/zip_error_strerror.c \
$(LIBZIP_DIR)/zip_error_to_str.c \
$(LIBZIP_DIR)/zip_extra_field.c \
$(LIBZIP_DIR)/zip_extra_field_api.c \
$(LIBZIP_DIR)/zip_fclose.c \
$(LIBZIP_DIR)/zip_fdopen.c \
$(LIBZIP_DIR)/zip_file_add.c \
$(LIBZIP_DIR)/zip_file_error_clear.c \
$(LIBZIP_DIR)/zip_file_error_get.c \
$(LIBZIP_DIR)/zip_file_get_comment.c \
$(LIBZIP_DIR)/zip_file_get_external_attributes.c \
$(LIBZIP_DIR)/zip_file_get_offset.c \
$(LIBZIP_DIR)/zip_file_rename.c \
$(LIBZIP_DIR)/zip_file_replace.c \
$(LIBZIP_DIR)/zip_file_set_comment.c \
$(LIBZIP_DIR)/zip_file_set_encryption.c \
$(LIBZIP_DIR)/zip_file_set_external_attributes.c \
$(LIBZIP_DIR)/zip_file_set_mtime.c \
$(LIBZIP_DIR)/zip_file_strerror.c \
$(LIBZIP_DIR)/zip_fopen.c \
$(LIBZIP_DIR)/zip_fopen_encrypted.c \
$(LIBZIP_DIR)/zip_fopen_index.c \
$(LIBZIP_DIR)/zip_fopen_index_encrypted.c \
$(LIBZIP_DIR)/zip_fread.c \
$(LIBZIP_DIR)/zip_fseek.c \
$(LIBZIP_DIR)/zip_ftell.c \
$(LIBZIP_DIR)/zip_get_archive_comment.c \
$(LIBZIP_DIR)/zip_get_archive_flag.c \
$(LIBZIP_DIR)/zip_get_encryption_implementation.c \
$(LIBZIP_DIR)/zip_get_file_comment.c \
$(LIBZIP_DIR)/zip_get_name.c \
$(LIBZIP_DIR)/zip_get_num_entries.c \
$(LIBZIP_DIR)/zip_get_num_files.c \
$(LIBZIP_DIR)/zip_hash.c \
$(LIBZIP_DIR)/zip_io_util.c \
$(LIBZIP_DIR)/zip_libzip_version.c \
$(LIBZIP_DIR)/zip_memdup.c \
$(LIBZIP_DIR)/zip_name_locate.c \
$(LIBZIP_DIR)/zip_new.c \
$(LIBZIP_DIR)/zip_open.c \
$(LIBZIP_DIR)/zip_pkware.c \
$(LIBZIP_DIR)/zip_progress.c \
$(LIBZIP_DIR)/zip_rename.c \
$(LIBZIP_DIR)/zip_replace.c \
$(LIBZIP_DIR)/zip_set_archive_comment.c \
$(LIBZIP_DIR)/zip_set_archive_flag.c \
$(LIBZIP_DIR)/zip_set_default_password.c \
$(LIBZIP_DIR)/zip_set_file_comment.c \
$(LIBZIP_DIR)/zip_set_file_compression.c \
$(LIBZIP_DIR)/zip_set_name.c \
$(LIBZIP_DIR)/zip_source_accept_empty.c \
$(LIBZIP_DIR)/zip_source_begin_write.c \
$(LIBZIP_DIR)/zip_source_begin_write_cloning.c \
$(LIBZIP_DIR)/zip_source_buffer.c \
$(LIBZIP_DIR)/zip_source_call.c \
$(LIBZIP_DIR)/zip_source_close.c \
$(LIBZIP_DIR)/zip_source_commit_write.c \
$(LIBZIP_DIR)/zip_source_compress.c \
$(LIBZIP_DIR)/zip_source_crc.c \
$(LIBZIP_DIR)/zip_source_error.c \
$(LIBZIP_DIR)/zip_source_file_common.c \
$(LIBZIP_DIR)/zip_source_file_stdio.c \
$(LIBZIP_DIR)/zip_source_free.c \
$(LIBZIP_DIR)/zip_source_function.c \
$(LIBZIP_DIR)/zip_source_get_file_attributes.c \
$(LIBZIP_DIR)/zip_source_is_deleted.c \
$(LIBZIP_DIR)/zip_source_layered.c \
$(LIBZIP_DIR)/zip_source_open.c \
$(LIBZIP_DIR)/zip_source_pkware_decode.c \
$(LIBZIP_DIR)/zip_source_pkware_encode.c \
$(LIBZIP_DIR)/zip_source_read.c \
$(LIBZIP_DIR)/zip_source_remove.c \
$(LIBZIP_DIR)/zip_source_rollback_write.c \
$(LIBZIP_DIR)/zip_source_seek.c \
$(LIBZIP_DIR)/zip_source_seek_write.c \
$(LIBZIP_DIR)/zip_source_stat.c \
$(LIBZIP_DIR)/zip_source_supports.c \
$(LIBZIP_DIR)/zip_source_tell.c \
$(LIBZIP_DIR)/zip_source_tell_write.c \
$(LIBZIP_DIR)/zip_source_window.c \
$(LIBZIP_DIR)/zip_source_write.c \
$(LIBZIP_DIR)/zip_source_zip.c \
$(LIBZIP_DIR)/zip_source_zip_new.c \
$(LIBZIP_DIR)/zip_stat.c \
$(LIBZIP_DIR)/zip_stat_index.c \
$(LIBZIP_DIR)/zip_stat_init.c \
$(LIBZIP_DIR)/zip_strerror.c \
$(LIBZIP_DIR)/zip_string.c \
$(LIBZIP_DIR)/zip_unchange.c \
$(LIBZIP_DIR)/zip_unchange_all.c \
$(LIBZIP_DIR)/zip_unchange_archive.c \
$(LIBZIP_DIR)/zip_unchange_data.c \
$(LIBZIP_DIR)/zip_utf-8.c \
$(LIBZIP_DIR)/zip_err_str.c
ifdef FOR_WINDOWS
RZDCY_FILES += $(LIBZIP_DIR)/zip_source_file_win32.c \
$(LIBZIP_DIR)/zip_source_file_win32_named.c \
$(LIBZIP_DIR)/zip_source_file_win32_utf16.c \
$(LIBZIP_DIR)/zip_source_file_win32_utf8.c \
$(LIBZIP_DIR)/zip_source_file_win32_ansi.c \
$(LIBZIP_DIR)/zip_random_win32.c
else
RZDCY_FILES += $(LIBZIP_DIR)/zip_mkstempm.c \
$(LIBZIP_DIR)/zip_source_file_stdio_named.c \
$(LIBZIP_DIR)/zip_random_unix.c
endif
endif
$(VERSION_HEADER):
echo "#define REICAST_VERSION \"`git describe --tags --always`\"" > $(VERSION_HEADER)
echo "#define GIT_HASH \"`git rev-parse --short HEAD`\"" >> $(VERSION_HEADER)
echo "#define BUILD_DATE \"`date '+%Y-%m-%d %H:%M:%S %Z'`\"" >> $(VERSION_HEADER)
+60 -37
View File
@@ -21,7 +21,7 @@
#include "emulator.h"
#include "hw/sh4/sh4_if.h"
#include "hw/sh4/sh4_mem.h"
#include "hw/sh4/sh4_interpreter.h"
#include "hw/sh4/dyna/shil.h"
#include "cfg/option.h"
#include <array>
#include <signal.h>
@@ -73,20 +73,47 @@ const std::array<Sh4RegType, 59> Sh4RegList {
class DebugAgent
{
public:
struct Breakpoint {
enum Type
{
BP_TYPE_SOFTWARE_BREAK,
BP_TYPE_HARDWARE_BREAK,
BP_TYPE_WRITE_WATCHPOINT,
BP_TYPE_READ_WATCHPOINT,
BP_TYPE_ACCESS_WATCHPOINT,
BP_TYPE_COUNT
};
Breakpoint() = default;
Breakpoint(u16 type, u32 addr) : addr(addr), type(type) { }
u32 addr = 0;
u16 type = 0;
u16 savedOp = 0;
};
void doContinue(u32 pc = 1)
{
if (pc != 1)
Sh4cntx.pc = pc;
dc_resume();
emu.start();
}
void step()
{
bool restoreBreakpoint = removeMatchpoint(0, Sh4cntx.pc, 2);
bool restoreBreakpoint = removeMatchpoint(Breakpoint::BP_TYPE_SOFTWARE_BREAK, Sh4cntx.pc, 2);
u32 savedPc = Sh4cntx.pc;
dc_step();
emu.step();
if (restoreBreakpoint)
insertMatchpoint(0, savedPc, 2);
insertMatchpoint(Breakpoint::BP_TYPE_SOFTWARE_BREAK, savedPc, 2);
}
void stepRange(u32 from, u32 to)
{
bool restoreBreakpoint = removeMatchpoint(Breakpoint::BP_TYPE_SOFTWARE_BREAK, Sh4cntx.pc, 2);
u32 savedPc = Sh4cntx.pc;
emu.stepRange(from, to);
if (restoreBreakpoint)
insertMatchpoint(Breakpoint::BP_TYPE_SOFTWARE_BREAK, savedPc, 2);
}
int readAllRegs(u32 **regs)
@@ -95,9 +122,9 @@ public:
for (u32 i = 0; i < Sh4RegList.size(); i++)
{
if (Sh4RegList[i] == reg_sr_status)
allregs[i] = sh4_sr_GetFull();
allregs[i] = Sh4cntx.sr.getFull();
else if (Sh4RegList[i] != NoReg)
allregs[i] = *GetRegPtr(Sh4RegList[i]);
allregs[i] = *GetRegPtr(Sh4cntx, Sh4RegList[i]);
}
*regs = &allregs[0];
return allregs.size();
@@ -107,7 +134,7 @@ public:
{
for (u32 i = 0; i < Sh4RegList.size(); i++)
if (Sh4RegList[i] != NoReg)
*GetRegPtr(Sh4RegList[i]) = regs[i];
*GetRegPtr(Sh4cntx, Sh4RegList[i]) = regs[i];
}
u32 readReg(u32 regNum)
@@ -116,9 +143,9 @@ public:
return 0;
Sh4RegType reg = Sh4RegList[regNum];
if (reg == reg_sr_status)
return sh4_sr_GetFull();
return Sh4cntx.sr.getFull();
if (reg != NoReg)
return *GetRegPtr(reg);
return *GetRegPtr(Sh4cntx, reg);
return 0;
}
void writeReg(u32 regNum, u32 value)
@@ -127,9 +154,9 @@ public:
return;
Sh4RegType reg = Sh4RegList[regNum];
if (reg == reg_sr_status)
sh4_sr_SetFull(value);
Sh4cntx.sr.setFull(value);
else if (reg != NoReg)
*GetRegPtr(reg) = value;
*GetRegPtr(Sh4cntx, reg) = value;
}
const u8 *readMem(u32 addr, u32 len)
@@ -190,31 +217,31 @@ public:
}
}
}
bool insertMatchpoint(char type, u32 addr, u32 len)
bool insertMatchpoint(Breakpoint::Type type, u32 addr, u32 len)
{
if (type == 0 && len != 2) {
if (type == Breakpoint::BP_TYPE_SOFTWARE_BREAK && len != 2) {
WARN_LOG(COMMON, "insertMatchpoint: length != 2: %d", len);
return false;
}
// TODO other matchpoint types
if (breakpoints.find(addr) != breakpoints.end())
if (breakpoints[type].find(addr) != breakpoints[type].end())
return true;
breakpoints[addr] = Breakpoint(type, addr);
breakpoints[addr].savedOp = ReadMem16_nommu(addr);
breakpoints[type][addr] = Breakpoint(type, addr);
breakpoints[type][addr].savedOp = ReadMem16_nommu(addr);
WriteMem16_nommu(addr, 0xC308); // trapa #0x20
return true;
}
bool removeMatchpoint(char type, u32 addr, u32 len)
bool removeMatchpoint(Breakpoint::Type type, u32 addr, u32 len)
{
if (type == 0 && len != 2) {
if (type == Breakpoint::BP_TYPE_SOFTWARE_BREAK && len != 2) {
WARN_LOG(COMMON, "removeMatchpoint: length != 2: %d", len);
return false;
}
auto it = breakpoints.find(addr);
if (it == breakpoints.end())
auto it = breakpoints[type].find(addr);
if (it == breakpoints[type].end())
return false;
WriteMem16_nommu(addr, it->second.savedOp);
breakpoints.erase(it);
breakpoints[type].erase(it);
return true;
}
@@ -222,7 +249,7 @@ public:
{
config::DynarecEnabled = false;
exception = SIGINT;
dc_stop();
emu.stop();
return exception;
}
@@ -236,7 +263,7 @@ public:
void postDebugTrap()
{
// needed to join the emu thread since debugTrap() is called by it
dc_stop();
emu.stop();
}
u32 currentException()
@@ -246,14 +273,14 @@ public:
void restart()
{
dc_stop();
dc_reset(true);
dc_resume();
emu.unloadGame();
emu.loadGame(settings.content.path.c_str());
emu.start();
}
void detach()
{
dc_resume();
emu.start();
}
void kill()
@@ -295,7 +322,10 @@ public:
{
verify(!Sh4cntx.CpuRunning);
size = stack.size() * 8;
return (const u32 *)&stack[0];
if (!stack.empty())
return (const u32 *)&stack[0];
else
return nullptr;
}
void subroutineCall()
@@ -312,13 +342,6 @@ public:
u32 exception = 0;
struct Breakpoint {
Breakpoint() = default;
Breakpoint(u16 type, u32 addr) : addr(addr), type(type) { }
u32 addr = 0;
u16 type = 0;
u16 savedOp = 0;
};
std::map<u32, Breakpoint> breakpoints;
std::map<u32, Breakpoint> breakpoints[Breakpoint::Type::BP_TYPE_COUNT];
std::vector<std::pair<u32, u32>> stack;
};
+478 -372
View File
File diff suppressed because it is too large. Load diff
+4 -2
View File
@@ -23,9 +23,11 @@ namespace debugger {
// exception thrown in response to trap
struct Stop { };
static const int DEFAULT_PORT = 3263;
#ifdef GDB_SERVER
void init();
void init(int port);
void term();
void run();
void debugTrap(u32 event);
@@ -33,7 +35,7 @@ struct Stop { };
void subroutineReturn();
#else
static inline void init() {}
static inline void init(int port) {}
static inline void term() {}
static inline void run() {}
static inline void debugTrap(u32 event) {}
+1
Submodule core/deps/Spout added at 2110a918e7.
+1
Submodule core/deps/Syphon added at 53ec412a78.
+1
Submodule core/deps/asio added at d3402006e8.
Submodule core/deps/breakpad added at 1ab24bcc81.
+78 -69
View File
@@ -4,33 +4,29 @@
#include <errno.h>
#include "cdipsr.h"
// Global variables
unsigned long temp_value;
/////////////////////////////////////////////////////////////////////////////
unsigned long ask_type(FILE *fsource, long header_position)
unsigned long ask_type(hostfs::File *fsource, long header_position)
{
unsigned char filename_length;
unsigned long track_mode;
uint32_t temp_value = 0;
fseek(fsource, header_position, SEEK_SET);
fread(&temp_value, 4, 1, fsource);
fsource->seek(header_position, SEEK_SET);
fsource->read(&temp_value, 4, 1);
if (temp_value != 0)
fseek(fsource, 8, SEEK_CUR); // extra data (DJ 3.00.780 and up)
fseek(fsource, 24, SEEK_CUR);
fread(&filename_length, 1, 1, fsource);
fseek(fsource, filename_length, SEEK_CUR);
fseek(fsource, 19, SEEK_CUR);
fread(&temp_value, 4, 1, fsource);
fsource->seek(8, SEEK_CUR); // extra data (DJ 3.00.780 and up)
fsource->seek(24, SEEK_CUR);
fsource->read(&filename_length, 1, 1);
fsource->seek(filename_length, SEEK_CUR);
fsource->seek(19, SEEK_CUR);
fsource->read(&temp_value, 4, 1);
if (temp_value == 0x80000000)
fseek(fsource, 8, SEEK_CUR); // DJ4
fseek(fsource, 16, SEEK_CUR);
fread(&track_mode, 4, 1, fsource);
fseek(fsource, header_position, SEEK_SET);
fsource->seek(8, SEEK_CUR); // DJ4
fsource->seek(16, SEEK_CUR);
fsource->read(&track_mode, 4, 1);
fsource->seek(header_position, SEEK_SET);
return (track_mode);
}
@@ -38,41 +34,48 @@ unsigned long track_mode;
/////////////////////////////////////////////////////////////////////////////
void CDI_read_track (FILE *fsource, image_s *image, track_s *track)
bool CDI_read_track (hostfs::File *fsource, image_s *image, track_s *track)
{
unsigned char TRACK_START_MARK[10] = { 0, 0, 0x01, 0, 0, 0, 0xFF, 0xFF, 0xFF, 0xFF };
unsigned char current_start_mark[10];
uint32_t temp_value = 0;
fread(&temp_value, 4, 1, fsource);
fsource->read(&temp_value, 4, 1);
if (temp_value != 0)
fseek(fsource, 8, SEEK_CUR); // extra data (DJ 3.00.780 and up)
fsource->seek(8, SEEK_CUR); // extra data (DJ 3.00.780 and up)
fread(&current_start_mark, 10, 1, fsource);
if (memcmp(TRACK_START_MARK, current_start_mark, 10)) printf( "Unsupported format: Could not find the track start mark");
fsource->read(&current_start_mark, 10, 1);
if (memcmp(TRACK_START_MARK, current_start_mark, 10)) {
printf("CDI_read_track: Unsupported format: Could not find the track start mark\n");
return false;
}
fread(&current_start_mark, 10, 1, fsource);
if (memcmp(TRACK_START_MARK, current_start_mark, 10)) printf( "Unsupported format: Could not find the track start mark");
fsource->read(&current_start_mark, 10, 1);
if (memcmp(TRACK_START_MARK, current_start_mark, 10)) {
printf("CDI_read_track: Unsupported format: Could not find the track start mark\n");
return false;
}
fseek(fsource, 4, SEEK_CUR);
fread(&track->filename_length, 1, 1, fsource);
fseek(fsource, track->filename_length, SEEK_CUR);
fseek(fsource, 11, SEEK_CUR);
fseek(fsource, 4, SEEK_CUR);
fseek(fsource, 4, SEEK_CUR);
fread(&temp_value, 4, 1, fsource);
fsource->seek(4, SEEK_CUR);
fsource->read(&track->filename_length, 1, 1);
fsource->seek(track->filename_length, SEEK_CUR);
fsource->seek(11, SEEK_CUR);
fsource->seek(4, SEEK_CUR);
fsource->seek(4, SEEK_CUR);
fsource->read(&temp_value, 4, 1);
if (temp_value == 0x80000000)
fseek(fsource, 8, SEEK_CUR); // DJ4
fseek(fsource, 2, SEEK_CUR);
fread(&track->pregap_length, 4, 1, fsource);
fread(&track->length, 4, 1, fsource);
fseek(fsource, 6, SEEK_CUR);
fread(&track->mode, 4, 1, fsource);
fseek(fsource, 12, SEEK_CUR);
fread(&track->start_lba, 4, 1, fsource);
fread(&track->total_length, 4, 1, fsource);
fseek(fsource, 16, SEEK_CUR);
fread(&track->sector_size_value, 4, 1, fsource);
fsource->seek(8, SEEK_CUR); // DJ4
fsource->seek(2, SEEK_CUR);
fsource->read(&track->pregap_length, 4, 1);
fsource->read(&track->length, 4, 1);
fsource->seek(6, SEEK_CUR);
fsource->read(&track->mode, 4, 1);
fsource->seek(12, SEEK_CUR);
fsource->read(&track->start_lba, 4, 1);
fsource->read(&track->total_length, 4, 1);
fsource->seek(16, SEEK_CUR);
fsource->read(&track->sector_size_value, 4, 1);
switch(track->sector_size_value)
{
@@ -80,39 +83,44 @@ void CDI_read_track (FILE *fsource, image_s *image, track_s *track)
case 1 : track->sector_size = 2336; break;
case 2 : track->sector_size = 2352; break;
case 4 : track->sector_size = 2448; break;
default: printf("Unsupported sector size. value %ld\n", track->sector_size_value);
break;
default:
printf("CDI_read_track: Unsupported sector size. value %ld\n", track->sector_size_value);
return false;
}
if (track->mode > 2) printf( "Unsupported format: Track mode not supported");
if (track->mode > 2) {
printf("CDI_read_track: Unsupported format: Track mode not supported\n");
return false;
}
fseek(fsource, 29, SEEK_CUR);
fsource->seek(29, SEEK_CUR);
if (image->version != CDI_V2)
{
fseek(fsource, 5, SEEK_CUR);
fread(&temp_value, 4, 1, fsource);
{
fsource->seek(5, SEEK_CUR);
fsource->read(&temp_value, 4, 1);
if (temp_value == 0xffffffff)
fseek(fsource, 78, SEEK_CUR); // extra data (DJ 3.00.780 and up)
}
fsource->seek(78, SEEK_CUR); // extra data (DJ 3.00.780 and up)
}
return true;
}
void CDI_skip_next_session (FILE *fsource, image_s *image)
void CDI_skip_next_session (hostfs::File *fsource, image_s *image)
{
fseek(fsource, 4, SEEK_CUR);
fseek(fsource, 8, SEEK_CUR);
if (image->version != CDI_V2) fseek(fsource, 1, SEEK_CUR);
fsource->seek(4, SEEK_CUR);
fsource->seek(8, SEEK_CUR);
if (image->version != CDI_V2) fsource->seek(1, SEEK_CUR);
}
void CDI_get_tracks (FILE *fsource, image_s *image)
bool CDI_get_tracks (hostfs::File *fsource, image_s *image)
{
fread(&image->tracks, 2, 1, fsource);
return fsource->read(&image->tracks, 2, 1) == 1;
}
bool CDI_init (FILE *fsource, image_s *image, const char *fsourcename)
bool CDI_init (hostfs::File *fsource, image_s *image, const char *fsourcename)
{
fseek(fsource, 0, SEEK_END);
image->length = ftell(fsource);
fsource->seek(0, SEEK_END);
image->length = fsource->tell();
if (image->length < 8)
{
@@ -120,9 +128,10 @@ bool CDI_init (FILE *fsource, image_s *image, const char *fsourcename)
return false;
}
fseek(fsource, image->length-8, SEEK_SET);
fread(&image->version, 4, 1, fsource);
fread(&image->header_offset, 4, 1, fsource);
fsource->seek(image->length-8, SEEK_SET);
if (fsource->read(&image->version, 4, 1) != 1
|| fsource->read(&image->header_offset, 4, 1) != 1)
return false;
if ((image->version != CDI_V2 && image->version != CDI_V3 && image->version != CDI_V35)
|| image->header_offset == 0)
@@ -133,17 +142,17 @@ bool CDI_init (FILE *fsource, image_s *image, const char *fsourcename)
return true;
}
void CDI_get_sessions (FILE *fsource, image_s *image)
bool CDI_get_sessions (hostfs::File *fsource, image_s *image)
{
#ifndef DEBUG_CDI
if (image->version == CDI_V35)
fseek(fsource, (image->length - image->header_offset), SEEK_SET);
fsource->seek((image->length - image->header_offset), SEEK_SET);
else
fseek(fsource, image->header_offset, SEEK_SET);
fsource->seek(image->header_offset, SEEK_SET);
#else
fseek(fsource, 0L, SEEK_SET);
fsource->seek(0L, SEEK_SET);
#endif
fread(&image->sessions, 2, 1, fsource);
return fsource->read(&image->sessions, 2, 1) == 1;
}
+8 -6
View File
@@ -1,6 +1,8 @@
#ifndef __CDI_H__
#define __CDI_H__
#include "../../oslib/storage.h"
/* Basic structures */
typedef struct image_s
@@ -36,11 +38,11 @@ typedef struct track_s
#define CDI_V3 0x80000005
#define CDI_V35 0x80000006
unsigned long ask_type(FILE *fsource, long header_position);
bool CDI_init(FILE *fsource, image_s *image, const char *fsourcename);
void CDI_get_sessions(FILE *fsource, image_s *image);
void CDI_get_tracks(FILE *fsource, image_s *image);
void CDI_read_track(FILE *fsource, image_s *image, track_s *track);
void CDI_skip_next_session(FILE *fsource, image_s *image);
unsigned long ask_type(hostfs::File *fsource, long header_position);
bool CDI_init(hostfs::File *fsource, image_s *image, const char *fsourcename);
bool CDI_get_sessions(hostfs::File *fsource, image_s *image);
bool CDI_get_tracks(hostfs::File *fsource, image_s *image);
bool CDI_read_track(hostfs::File *fsource, image_s *image, track_s *track);
void CDI_skip_next_session(hostfs::File *fsource, image_s *image);
#endif
-239
View File
@@ -1,239 +0,0 @@
/*
* This code implements the MD5 message-digest algorithm.
* The algorithm is due to Ron Rivest. This code was
* written by Colin Plumb in 1993, no copyright is claimed.
* This code is in the public domain; do with it what you wish.
*
* Equivalent code is available from RSA Data Security, Inc.
* This code has been tested against that, and is equivalent,
* except that you don't need to include two pages of legalese
* with every copy.
*
* To compute the message digest of a chunk of bytes, declare an
* MD5Context structure, pass it to MD5Init, call MD5Update as
* needed on buffers full of bytes, and then call MD5Final, which
* will fill a supplied 16-byte array with the digest.
*
* Changed so as no longer to depend on Colin Plumb's `usual.h' header
* definitions; now uses stuff from dpkg's config.h.
* - Ian Jackson <[email protected]>.
* Still in the public domain.
*/
#include <string.h> /* for memcpy() */
#include "md5.h"
#ifndef LSB_FIRST
void
byteSwap(UWORD32 *buf, unsigned words)
{
md5byte *p = (md5byte *)buf;
do {
*buf++ = (UWORD32)((unsigned)p[3] << 8 | p[2]) << 16 |
((unsigned)p[1] << 8 | p[0]);
p += 4;
} while (--words);
}
#else
#define byteSwap(buf,words)
#endif
/*
* Start MD5 accumulation. Set bit count to 0 and buffer to mysterious
* initialization constants.
*/
void
MD5Init(struct MD5Context *ctx)
{
ctx->buf[0] = 0x67452301;
ctx->buf[1] = 0xefcdab89;
ctx->buf[2] = 0x98badcfe;
ctx->buf[3] = 0x10325476;
ctx->bytes[0] = 0;
ctx->bytes[1] = 0;
}
/*
* Update context to reflect the concatenation of another buffer full
* of bytes.
*/
void
MD5Update(struct MD5Context *ctx, md5byte const *buf, unsigned len)
{
UWORD32 t;
/* Update byte count */
t = ctx->bytes[0];
if ((ctx->bytes[0] = t + len) < t)
ctx->bytes[1]++; /* Carry from low to high */
t = 64 - (t & 0x3f); /* Space available in ctx->in (at least 1) */
if (t > len) {
memcpy((md5byte *)ctx->in + 64 - t, buf, len);
return;
}
/* First chunk is an odd size */
memcpy((md5byte *)ctx->in + 64 - t, buf, t);
byteSwap(ctx->in, 16);
MD5Transform(ctx->buf, ctx->in);
buf += t;
len -= t;
/* Process data in 64-byte chunks */
while (len >= 64) {
memcpy(ctx->in, buf, 64);
byteSwap(ctx->in, 16);
MD5Transform(ctx->buf, ctx->in);
buf += 64;
len -= 64;
}
/* Handle any remaining bytes of data. */
memcpy(ctx->in, buf, len);
}
/*
* Final wrapup - pad to 64-byte boundary with the bit pattern
* 1 0* (64-bit count of bits processed, MSB-first)
*/
void
MD5Final(md5byte digest[16], struct MD5Context *ctx)
{
int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */
md5byte *p = (md5byte *)ctx->in + count;
/* Set the first char of padding to 0x80. There is always room. */
*p++ = 0x80;
/* Bytes of padding needed to make 56 bytes (-8..55) */
count = 56 - 1 - count;
if (count < 0) { /* Padding forces an extra block */
memset(p, 0, count + 8);
byteSwap(ctx->in, 16);
MD5Transform(ctx->buf, ctx->in);
p = (md5byte *)ctx->in;
count = 56;
}
memset(p, 0, count);
byteSwap(ctx->in, 14);
/* Append length in bits and transform */
ctx->in[14] = ctx->bytes[0] << 3;
ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29;
MD5Transform(ctx->buf, ctx->in);
byteSwap(ctx->buf, 4);
memcpy(digest, ctx->buf, 16);
memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
}
#ifndef ASM_MD5
/* The four core functions - F1 is optimized somewhat */
/* #define F1(x, y, z) (x & y | ~x & z) */
#define F1(x, y, z) (z ^ (x & (y ^ z)))
#define F2(x, y, z) F1(z, x, y)
#define F3(x, y, z) (x ^ y ^ z)
#define F4(x, y, z) (y ^ (x | ~z))
/* This is the central step in the MD5 algorithm. */
#define MD5STEP(f,w,x,y,z,in,s) \
(w += f(x,y,z) + in, w = (w<<s | w>>(32-s)) + x)
/*
* The core of the MD5 algorithm, this alters an existing MD5 hash to
* reflect the addition of 16 longwords of new data. MD5Update blocks
* the data and converts bytes into longwords for this routine.
*/
void
MD5Transform(UWORD32 buf[4], UWORD32 const in[16])
{
register UWORD32 a, b, c, d;
a = buf[0];
b = buf[1];
c = buf[2];
d = buf[3];
MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7);
MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12);
MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17);
MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22);
MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7);
MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12);
MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17);
MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22);
MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7);
MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12);
MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17);
MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22);
MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7);
MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12);
MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17);
MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22);
MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5);
MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9);
MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14);
MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20);
MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5);
MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9);
MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14);
MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20);
MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5);
MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9);
MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14);
MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20);
MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5);
MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9);
MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14);
MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20);
MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4);
MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11);
MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16);
MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23);
MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4);
MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11);
MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16);
MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23);
MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4);
MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11);
MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16);
MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23);
MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4);
MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11);
MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16);
MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23);
MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6);
MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10);
MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15);
MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21);
MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6);
MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10);
MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15);
MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21);
MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6);
MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10);
MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15);
MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21);
MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6);
MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10);
MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15);
MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21);
buf[0] += a;
buf[1] += b;
buf[2] += c;
buf[3] += d;
}
#endif
-42
View File
@@ -1,42 +0,0 @@
/*
* This is the header file for the MD5 message-digest algorithm.
* The algorithm is due to Ron Rivest. This code was
* written by Colin Plumb in 1993, no copyright is claimed.
* This code is in the public domain; do with it what you wish.
*
* Equivalent code is available from RSA Data Security, Inc.
* This code has been tested against that, and is equivalent,
* except that you don't need to include two pages of legalese
* with every copy.
*
* To compute the message digest of a chunk of bytes, declare an
* MD5Context structure, pass it to MD5Init, call MD5Update as
* needed on buffers full of bytes, and then call MD5Final, which
* will fill a supplied 16-byte array with the digest.
*
* Changed so as no longer to depend on Colin Plumb's `usual.h'
* header definitions; now uses stuff from dpkg's config.h
* - Ian Jackson <[email protected]>.
* Still in the public domain.
*/
#ifndef MD5_H
#define MD5_H
typedef unsigned int UWORD32;
#define md5byte unsigned char
struct MD5Context {
UWORD32 buf[4];
UWORD32 bytes[2];
UWORD32 in[16];
};
void MD5Init(struct MD5Context *context);
void MD5Update(struct MD5Context *context, md5byte const *buf, unsigned len);
void MD5Final(unsigned char digest[16], struct MD5Context *context);
void MD5Transform(UWORD32 buf[4], UWORD32 const in[16]);
#endif /* !MD5_H */
-387
View File
@@ -1,387 +0,0 @@
/* sha1.h
*
* The sha1 hash function.
*/
/* nettle, low-level cryptographics library
*
* Copyright 2001 Peter Gutmann, Andrew Kuchling, Niels Moeller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at your
* option) any later version.
*
* The nettle library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with the nettle library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
#include "sha1.h"
#include <assert.h>
#include <stdlib.h>
#include <string.h>
static unsigned int READ_UINT32(const UINT8* data)
{
return ((UINT32)data[0] << 24) |
((UINT32)data[1] << 16) |
((UINT32)data[2] << 8) |
((UINT32)data[3]);
}
static void WRITE_UINT32(unsigned char* data, UINT32 val)
{
data[0] = (val >> 24) & 0xFF;
data[1] = (val >> 16) & 0xFF;
data[2] = (val >> 8) & 0xFF;
data[3] = (val >> 0) & 0xFF;
}
/* A block, treated as a sequence of 32-bit words. */
#define SHA1_DATA_LENGTH 16
/* The SHA f()-functions. The f1 and f3 functions can be optimized to
save one boolean operation each - thanks to Rich Schroeppel,
[email protected] for discovering this */
/* #define f1(x,y,z) ( ( x & y ) | ( ~x & z ) ) Rounds 0-19 */
#define f1(x,y,z) ( z ^ ( x & ( y ^ z ) ) ) /* Rounds 0-19 */
#define f2(x,y,z) ( x ^ y ^ z ) /* Rounds 20-39 */
/* #define f3(x,y,z) ( ( x & y ) | ( x & z ) | ( y & z ) ) Rounds 40-59 */
#define f3(x,y,z) ( ( x & y ) | ( z & ( x | y ) ) ) /* Rounds 40-59 */
#define f4(x,y,z) ( x ^ y ^ z ) /* Rounds 60-79 */
/* The SHA Mysterious Constants */
#define K1 0x5A827999L /* Rounds 0-19 */
#define K2 0x6ED9EBA1L /* Rounds 20-39 */
#define K3 0x8F1BBCDCL /* Rounds 40-59 */
#define K4 0xCA62C1D6L /* Rounds 60-79 */
/* SHA initial values */
#define h0init 0x67452301L
#define h1init 0xEFCDAB89L
#define h2init 0x98BADCFEL
#define h3init 0x10325476L
#define h4init 0xC3D2E1F0L
/* 32-bit rotate left - kludged with shifts */
#ifdef _MSC_VER
#define ROTL(n,X) _lrotl(X, n)
#else
#define ROTL(n,X) ( ( (X) << (n) ) | ( (X) >> ( 32 - (n) ) ) )
#endif
/* The initial expanding function. The hash function is defined over an
80-word expanded input array W, where the first 16 are copies of the input
data, and the remaining 64 are defined by
W[ i ] = W[ i - 16 ] ^ W[ i - 14 ] ^ W[ i - 8 ] ^ W[ i - 3 ]
This implementation generates these values on the fly in a circular
buffer - thanks to Colin Plumb, [email protected] for this
optimization.
The updated SHA changes the expanding function by adding a rotate of 1
bit. Thanks to Jim Gillogly, [email protected], and an anonymous contributor
for this information */
#define expand(W,i) ( W[ i & 15 ] = \
ROTL( 1, ( W[ i & 15 ] ^ W[ (i - 14) & 15 ] ^ \
W[ (i - 8) & 15 ] ^ W[ (i - 3) & 15 ] ) ) )
/* The prototype SHA sub-round. The fundamental sub-round is:
a' = e + ROTL( 5, a ) + f( b, c, d ) + k + data;
b' = a;
c' = ROTL( 30, b );
d' = c;
e' = d;
but this is implemented by unrolling the loop 5 times and renaming the
variables ( e, a, b, c, d ) = ( a', b', c', d', e' ) each iteration.
This code is then replicated 20 times for each of the 4 functions, using
the next 20 values from the W[] array each time */
#define subRound(a, b, c, d, e, f, k, data) \
( e += ROTL( 5, a ) + f( b, c, d ) + k + data, b = ROTL( 30, b ) )
/* Initialize the SHA values */
void
sha1_init(struct sha1_ctx *ctx)
{
/* Set the h-vars to their initial values */
ctx->digest[ 0 ] = h0init;
ctx->digest[ 1 ] = h1init;
ctx->digest[ 2 ] = h2init;
ctx->digest[ 3 ] = h3init;
ctx->digest[ 4 ] = h4init;
/* Initialize bit count */
ctx->count_low = ctx->count_high = 0;
/* Initialize buffer */
ctx->index = 0;
}
/* Perform the SHA transformation. Note that this code, like MD5, seems to
break some optimizing compilers due to the complexity of the expressions
and the size of the basic block. It may be necessary to split it into
sections, e.g. based on the four subrounds
Note that this function destroys the data area */
static void
sha1_transform(UINT32 *state, UINT32 *data)
{
UINT32 A, B, C, D, E; /* Local vars */
/* Set up first buffer and local data buffer */
A = state[0];
B = state[1];
C = state[2];
D = state[3];
E = state[4];
/* Heavy mangling, in 4 sub-rounds of 20 interations each. */
subRound( A, B, C, D, E, f1, K1, data[ 0] );
subRound( E, A, B, C, D, f1, K1, data[ 1] );
subRound( D, E, A, B, C, f1, K1, data[ 2] );
subRound( C, D, E, A, B, f1, K1, data[ 3] );
subRound( B, C, D, E, A, f1, K1, data[ 4] );
subRound( A, B, C, D, E, f1, K1, data[ 5] );
subRound( E, A, B, C, D, f1, K1, data[ 6] );
subRound( D, E, A, B, C, f1, K1, data[ 7] );
subRound( C, D, E, A, B, f1, K1, data[ 8] );
subRound( B, C, D, E, A, f1, K1, data[ 9] );
subRound( A, B, C, D, E, f1, K1, data[10] );
subRound( E, A, B, C, D, f1, K1, data[11] );
subRound( D, E, A, B, C, f1, K1, data[12] );
subRound( C, D, E, A, B, f1, K1, data[13] );
subRound( B, C, D, E, A, f1, K1, data[14] );
subRound( A, B, C, D, E, f1, K1, data[15] );
subRound( E, A, B, C, D, f1, K1, expand( data, 16 ) );
subRound( D, E, A, B, C, f1, K1, expand( data, 17 ) );
subRound( C, D, E, A, B, f1, K1, expand( data, 18 ) );
subRound( B, C, D, E, A, f1, K1, expand( data, 19 ) );
subRound( A, B, C, D, E, f2, K2, expand( data, 20 ) );
subRound( E, A, B, C, D, f2, K2, expand( data, 21 ) );
subRound( D, E, A, B, C, f2, K2, expand( data, 22 ) );
subRound( C, D, E, A, B, f2, K2, expand( data, 23 ) );
subRound( B, C, D, E, A, f2, K2, expand( data, 24 ) );
subRound( A, B, C, D, E, f2, K2, expand( data, 25 ) );
subRound( E, A, B, C, D, f2, K2, expand( data, 26 ) );
subRound( D, E, A, B, C, f2, K2, expand( data, 27 ) );
subRound( C, D, E, A, B, f2, K2, expand( data, 28 ) );
subRound( B, C, D, E, A, f2, K2, expand( data, 29 ) );
subRound( A, B, C, D, E, f2, K2, expand( data, 30 ) );
subRound( E, A, B, C, D, f2, K2, expand( data, 31 ) );
subRound( D, E, A, B, C, f2, K2, expand( data, 32 ) );
subRound( C, D, E, A, B, f2, K2, expand( data, 33 ) );
subRound( B, C, D, E, A, f2, K2, expand( data, 34 ) );
subRound( A, B, C, D, E, f2, K2, expand( data, 35 ) );
subRound( E, A, B, C, D, f2, K2, expand( data, 36 ) );
subRound( D, E, A, B, C, f2, K2, expand( data, 37 ) );
subRound( C, D, E, A, B, f2, K2, expand( data, 38 ) );
subRound( B, C, D, E, A, f2, K2, expand( data, 39 ) );
subRound( A, B, C, D, E, f3, K3, expand( data, 40 ) );
subRound( E, A, B, C, D, f3, K3, expand( data, 41 ) );
subRound( D, E, A, B, C, f3, K3, expand( data, 42 ) );
subRound( C, D, E, A, B, f3, K3, expand( data, 43 ) );
subRound( B, C, D, E, A, f3, K3, expand( data, 44 ) );
subRound( A, B, C, D, E, f3, K3, expand( data, 45 ) );
subRound( E, A, B, C, D, f3, K3, expand( data, 46 ) );
subRound( D, E, A, B, C, f3, K3, expand( data, 47 ) );
subRound( C, D, E, A, B, f3, K3, expand( data, 48 ) );
subRound( B, C, D, E, A, f3, K3, expand( data, 49 ) );
subRound( A, B, C, D, E, f3, K3, expand( data, 50 ) );
subRound( E, A, B, C, D, f3, K3, expand( data, 51 ) );
subRound( D, E, A, B, C, f3, K3, expand( data, 52 ) );
subRound( C, D, E, A, B, f3, K3, expand( data, 53 ) );
subRound( B, C, D, E, A, f3, K3, expand( data, 54 ) );
subRound( A, B, C, D, E, f3, K3, expand( data, 55 ) );
subRound( E, A, B, C, D, f3, K3, expand( data, 56 ) );
subRound( D, E, A, B, C, f3, K3, expand( data, 57 ) );
subRound( C, D, E, A, B, f3, K3, expand( data, 58 ) );
subRound( B, C, D, E, A, f3, K3, expand( data, 59 ) );
subRound( A, B, C, D, E, f4, K4, expand( data, 60 ) );
subRound( E, A, B, C, D, f4, K4, expand( data, 61 ) );
subRound( D, E, A, B, C, f4, K4, expand( data, 62 ) );
subRound( C, D, E, A, B, f4, K4, expand( data, 63 ) );
subRound( B, C, D, E, A, f4, K4, expand( data, 64 ) );
subRound( A, B, C, D, E, f4, K4, expand( data, 65 ) );
subRound( E, A, B, C, D, f4, K4, expand( data, 66 ) );
subRound( D, E, A, B, C, f4, K4, expand( data, 67 ) );
subRound( C, D, E, A, B, f4, K4, expand( data, 68 ) );
subRound( B, C, D, E, A, f4, K4, expand( data, 69 ) );
subRound( A, B, C, D, E, f4, K4, expand( data, 70 ) );
subRound( E, A, B, C, D, f4, K4, expand( data, 71 ) );
subRound( D, E, A, B, C, f4, K4, expand( data, 72 ) );
subRound( C, D, E, A, B, f4, K4, expand( data, 73 ) );
subRound( B, C, D, E, A, f4, K4, expand( data, 74 ) );
subRound( A, B, C, D, E, f4, K4, expand( data, 75 ) );
subRound( E, A, B, C, D, f4, K4, expand( data, 76 ) );
subRound( D, E, A, B, C, f4, K4, expand( data, 77 ) );
subRound( C, D, E, A, B, f4, K4, expand( data, 78 ) );
subRound( B, C, D, E, A, f4, K4, expand( data, 79 ) );
/* Build message digest */
state[0] += A;
state[1] += B;
state[2] += C;
state[3] += D;
state[4] += E;
}
static void
sha1_block(struct sha1_ctx *ctx, const UINT8 *block)
{
UINT32 data[SHA1_DATA_LENGTH];
int i;
/* Update block count */
if (!++ctx->count_low)
++ctx->count_high;
/* Endian independent conversion */
for (i = 0; i<SHA1_DATA_LENGTH; i++, block += 4)
data[i] = READ_UINT32(block);
sha1_transform(ctx->digest, data);
}
void
sha1_update(struct sha1_ctx *ctx,
unsigned length, const UINT8 *buffer)
{
if (ctx->index)
{ /* Try to fill partial block */
unsigned left = SHA1_DATA_SIZE - ctx->index;
if (length < left)
{
memcpy(ctx->block + ctx->index, buffer, length);
ctx->index += length;
return; /* Finished */
}
else
{
memcpy(ctx->block + ctx->index, buffer, left);
sha1_block(ctx, ctx->block);
buffer += left;
length -= left;
}
}
while (length >= SHA1_DATA_SIZE)
{
sha1_block(ctx, buffer);
buffer += SHA1_DATA_SIZE;
length -= SHA1_DATA_SIZE;
}
ctx->index = length;
if (length)
/* Buffer leftovers */
memcpy(ctx->block, buffer, length);
}
/* Final wrapup - pad to SHA1_DATA_SIZE-byte boundary with the bit pattern
1 0* (64-bit count of bits processed, MSB-first) */
void
sha1_final(struct sha1_ctx *ctx)
{
UINT32 data[SHA1_DATA_LENGTH];
int i;
int words;
i = ctx->index;
/* Set the first char of padding to 0x80. This is safe since there is
always at least one byte free */
assert(i < SHA1_DATA_SIZE);
ctx->block[i++] = 0x80;
/* Fill rest of word */
for( ; i & 3; i++)
ctx->block[i] = 0;
/* i is now a multiple of the word size 4 */
words = i >> 2;
for (i = 0; i < words; i++)
data[i] = READ_UINT32(ctx->block + 4*i);
if (words > (SHA1_DATA_LENGTH-2))
{ /* No room for length in this block. Process it and
* pad with another one */
for (i = words ; i < SHA1_DATA_LENGTH; i++)
data[i] = 0;
sha1_transform(ctx->digest, data);
for (i = 0; i < (SHA1_DATA_LENGTH-2); i++)
data[i] = 0;
}
else
for (i = words ; i < SHA1_DATA_LENGTH - 2; i++)
data[i] = 0;
/* There are 512 = 2^9 bits in one block */
data[SHA1_DATA_LENGTH-2] = (ctx->count_high << 9) | (ctx->count_low >> 23);
data[SHA1_DATA_LENGTH-1] = (ctx->count_low << 9) | (ctx->index << 3);
sha1_transform(ctx->digest, data);
}
void
sha1_digest(const struct sha1_ctx *ctx,
unsigned length,
UINT8 *digest)
{
unsigned i;
unsigned words;
unsigned leftover;
assert(length <= SHA1_DIGEST_SIZE);
words = length / 4;
leftover = length % 4;
for (i = 0; i < words; i++, digest += 4)
WRITE_UINT32(digest, ctx->digest[i]);
if (leftover)
{
UINT32 word;
unsigned j = leftover;
assert(i < _SHA1_DIGEST_LENGTH);
word = ctx->digest[i];
switch (leftover)
{
default:
/* this is just here to keep the compiler happy; it can never happen */
case 3:
digest[--j] = (word >> 8) & 0xff;
/* Fall through */
case 2:
digest[--j] = (word >> 16) & 0xff;
/* Fall through */
case 1:
digest[--j] = (word >> 24) & 0xff;
}
}
}
-63
View File
@@ -1,63 +0,0 @@
/* sha1.h
*
* The sha1 hash function.
*/
/* nettle, low-level cryptographics library
*
* Copyright 2001 Niels Moeller
*
* The nettle library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 of the License, or (at your
* option) any later version.
*
* The nettle library is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
* License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with the nettle library; see the file COPYING.LIB. If not, write to
* the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
* MA 02111-1307, USA.
*/
#ifndef NETTLE_SHA1_H_INCLUDED
#define NETTLE_SHA1_H_INCLUDED
#include "../chdr/coretypes.h"
#define SHA1_DIGEST_SIZE 20
#define SHA1_DATA_SIZE 64
/* Digest is kept internally as 4 32-bit words. */
#define _SHA1_DIGEST_LENGTH 5
struct sha1_ctx
{
UINT32 digest[_SHA1_DIGEST_LENGTH]; /* Message digest */
UINT32 count_low, count_high; /* 64-bit block count */
UINT8 block[SHA1_DATA_SIZE]; /* SHA1 data buffer */
unsigned int index; /* index into buffer */
};
void
sha1_init(struct sha1_ctx *ctx);
void
sha1_update(struct sha1_ctx *ctx,
unsigned length,
const UINT8 *data);
void
sha1_final(struct sha1_ctx *ctx);
void
sha1_digest(const struct sha1_ctx *ctx,
unsigned length,
UINT8 *digest);
#endif /* NETTLE_SHA1_H_INCLUDED */
-161
View File
@@ -1,161 +0,0 @@
/*********************************************************************
* Filename: sha256.c
* Author: Brad Conte (brad AT bradconte.com)
* Copyright:
* Disclaimer: This code is presented "as is" without any guarantees.
* Details: Implementation of the SHA-256 hashing algorithm.
SHA-256 is one of the three algorithms in the SHA2
specification. The others, SHA-384 and SHA-512, are not
offered in this implementation.
Algorithm specification can be found here:
* http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf
This implementation uses little endian byte order.
*********************************************************************/
/*************************** HEADER FILES ***************************/
#include <stdlib.h>
#include <string.h>
#include "sha256.h"
#define WORD uint32_t
#define BYTE uint8_t
/****************************** MACROS ******************************/
#define ROTLEFT(a,b) (((a) << (b)) | ((a) >> (32-(b))))
#define ROTRIGHT(a,b) (((a) >> (b)) | ((a) << (32-(b))))
#define CH(x,y,z) (((x) & (y)) ^ (~(x) & (z)))
#define MAJ(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
#define EP0(x) (ROTRIGHT(x,2) ^ ROTRIGHT(x,13) ^ ROTRIGHT(x,22))
#define EP1(x) (ROTRIGHT(x,6) ^ ROTRIGHT(x,11) ^ ROTRIGHT(x,25))
#define SIG0(x) (ROTRIGHT(x,7) ^ ROTRIGHT(x,18) ^ ((x) >> 3))
#define SIG1(x) (ROTRIGHT(x,17) ^ ROTRIGHT(x,19) ^ ((x) >> 10))
/**************************** VARIABLES *****************************/
static const WORD k[64] = {
0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,
0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,
0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,
0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967,
0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,
0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,
0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,
0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
};
/*********************** FUNCTION DEFINITIONS ***********************/
void sha256_transform(SHA256_CTX *ctx, const BYTE data[])
{
WORD a, b, c, d, e, f, g, h, i, j, t1, t2, m[64];
for (i = 0, j = 0; i < 16; ++i, j += 4)
m[i] = (data[j] << 24) | (data[j + 1] << 16) | (data[j + 2] << 8) | (data[j + 3]);
for ( ; i < 64; ++i)
m[i] = SIG1(m[i - 2]) + m[i - 7] + SIG0(m[i - 15]) + m[i - 16];
a = ctx->state[0];
b = ctx->state[1];
c = ctx->state[2];
d = ctx->state[3];
e = ctx->state[4];
f = ctx->state[5];
g = ctx->state[6];
h = ctx->state[7];
for (i = 0; i < 64; ++i) {
t1 = h + EP1(e) + CH(e,f,g) + k[i] + m[i];
t2 = EP0(a) + MAJ(a,b,c);
h = g;
g = f;
f = e;
e = d + t1;
d = c;
c = b;
b = a;
a = t1 + t2;
}
ctx->state[0] += a;
ctx->state[1] += b;
ctx->state[2] += c;
ctx->state[3] += d;
ctx->state[4] += e;
ctx->state[5] += f;
ctx->state[6] += g;
ctx->state[7] += h;
}
void sha256_init(SHA256_CTX *ctx)
{
ctx->datalen = 0;
ctx->bitlen = 0;
ctx->state[0] = 0x6a09e667;
ctx->state[1] = 0xbb67ae85;
ctx->state[2] = 0x3c6ef372;
ctx->state[3] = 0xa54ff53a;
ctx->state[4] = 0x510e527f;
ctx->state[5] = 0x9b05688c;
ctx->state[6] = 0x1f83d9ab;
ctx->state[7] = 0x5be0cd19;
}
void sha256_update(SHA256_CTX *ctx, const BYTE data[], size_t len)
{
WORD i;
for (i = 0; i < len; ++i) {
ctx->data[ctx->datalen] = data[i];
ctx->datalen++;
if (ctx->datalen == 64) {
sha256_transform(ctx, ctx->data);
ctx->bitlen += 512;
ctx->datalen = 0;
}
}
}
void sha256_final(SHA256_CTX *ctx, BYTE hash[])
{
WORD i;
i = ctx->datalen;
// Pad whatever data is left in the buffer.
if (ctx->datalen < 56) {
ctx->data[i++] = 0x80;
while (i < 56)
ctx->data[i++] = 0x00;
}
else {
ctx->data[i++] = 0x80;
while (i < 64)
ctx->data[i++] = 0x00;
sha256_transform(ctx, ctx->data);
memset(ctx->data, 0, 56);
}
// Append to the padding the total message's length in bits and transform.
ctx->bitlen += ctx->datalen * 8;
ctx->data[63] = (BYTE)(ctx->bitlen);
ctx->data[62] = (BYTE)(ctx->bitlen >> 8);
ctx->data[61] = (BYTE)(ctx->bitlen >> 16);
ctx->data[60] = (BYTE)(ctx->bitlen >> 24);
ctx->data[59] = (BYTE)(ctx->bitlen >> 32);
ctx->data[58] = (BYTE)(ctx->bitlen >> 40);
ctx->data[57] = (BYTE)(ctx->bitlen >> 48);
ctx->data[56] = (BYTE)(ctx->bitlen >> 56);
sha256_transform(ctx, ctx->data);
// Since this implementation uses little endian byte ordering and SHA uses big endian,
// reverse all the bytes when copying the final state to the output hash.
for (i = 0; i < 4; ++i) {
hash[i] = (ctx->state[0] >> (24 - i * 8)) & 0x000000ff;
hash[i + 4] = (ctx->state[1] >> (24 - i * 8)) & 0x000000ff;
hash[i + 8] = (ctx->state[2] >> (24 - i * 8)) & 0x000000ff;
hash[i + 12] = (ctx->state[3] >> (24 - i * 8)) & 0x000000ff;
hash[i + 16] = (ctx->state[4] >> (24 - i * 8)) & 0x000000ff;
hash[i + 20] = (ctx->state[5] >> (24 - i * 8)) & 0x000000ff;
hash[i + 24] = (ctx->state[6] >> (24 - i * 8)) & 0x000000ff;
hash[i + 28] = (ctx->state[7] >> (24 - i * 8)) & 0x000000ff;
}
}
-37
View File
@@ -1,37 +0,0 @@
/*********************************************************************
* Filename: sha256.h
* Author: Brad Conte (brad AT bradconte.com)
* Copyright:
* Disclaimer: This code is presented "as is" without any guarantees.
* Details: Defines the API for the corresponding SHA1 implementation.
*********************************************************************/
#ifndef SHA256_H
#define SHA256_H
/*************************** HEADER FILES ***************************/
#include <stddef.h>
#include <stdint.h>
/****************************** MACROS ******************************/
#define SHA256_BLOCK_SIZE 32 // SHA256 outputs a 32 byte digest
/**************************** DATA TYPES ****************************/
/*
typedef uint8_t BYTE; // 8-bit byte
typedef uint32_t WORD; // 32-bit word, change to "long" for 16-bit machines
*/
typedef struct {
uint8_t data[64];
uint32_t datalen;
uint64_t bitlen;
uint32_t state[8];
} SHA256_CTX;
/*********************** FUNCTION DECLARATIONS **********************/
void sha256_init(SHA256_CTX *ctx);
void sha256_update(SHA256_CTX *ctx, const uint8_t data[], size_t len);
void sha256_final(SHA256_CTX *ctx, uint8_t hash[]);
#endif // SHA256_H
+7 -1
View File
@@ -29,6 +29,10 @@
#include <sys/stat.h>
#include <errno.h>
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP || WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
#define FindFirstFileExW FindFirstFileExFromAppW
#endif
/* Indicates that d_type field is available in dirent structure */
#define _DIRENT_HAVE_D_TYPE
@@ -613,7 +617,7 @@ dirent_first(
/* Failed to re-open directory: no directory entry in memory */
dirp->cached = 0;
datap = NULL;
dirent_set_errno(GetLastError()); /* Not a valid errno but better than nothing */
}
return datap;
}
@@ -647,6 +651,8 @@ dirent_next(
FindClose (dirp->handle);
dirp->handle = INVALID_HANDLE_VALUE;
p = NULL;
if (GetLastError() != ERROR_NO_MORE_FILES)
dirent_set_errno(GetLastError());
}
} else {
Submodule core/deps/freetype added at 0a0221a134.
+1
Submodule core/deps/gamesdk added at 4ac9952e6a.
+598
View File
@@ -0,0 +1,598 @@
/* -----------------------------------------------------------------------
* GGPO.net (http://ggpo.net) - Copyright 2009 GroundStorm Studios, LLC.
*
* Use of this software is governed by the MIT license that can be found
* in the LICENSE file.
*/
#ifndef _GGPONET_H_
#define _GGPONET_H_
#ifdef __cplusplus
extern "C" {
#endif
#include <stdarg.h>
// On windows, export at build time and import at runtime.
// ELF systems don't need an explicit export/import.
#ifdef _WIN32
# if defined(GGPO_SHARED_LIB)
# ifdef GGPO_SDK_EXPORT
# define GGPO_API __declspec(dllexport)
# else
# define GGPO_API __declspec(dllimport)
# endif
# else
# define GGPO_API
# endif
#else
# define GGPO_API
#endif
#ifdef __GNUC__
#if defined(_WIN32) && !defined(_WIN64)
#define __cdecl __attribute__((cdecl))
#elif !defined(__cdecl)
#define __cdecl
#endif
#endif
#define GGPO_MAX_PLAYERS 4
#define GGPO_MAX_PREDICTION_FRAMES 8
#define GGPO_MAX_SPECTATORS 32
#define GGPO_SPECTATOR_INPUT_INTERVAL 4
typedef struct GGPOSession GGPOSession;
typedef int GGPOPlayerHandle;
typedef enum {
GGPO_PLAYERTYPE_LOCAL,
GGPO_PLAYERTYPE_REMOTE,
GGPO_PLAYERTYPE_SPECTATOR,
} GGPOPlayerType;
/*
* The GGPOPlayer structure used to describe players in ggpo_add_player
*
* size: Should be set to the sizeof(GGPOPlayer)
*
* type: One of the GGPOPlayerType values describing how inputs should be handled
* Local players must have their inputs updated every frame via
* ggpo_add_local_inputs. Remote players values will come over the
* network.
*
* player_num: The player number. Should be between 1 and the number of players
* In the game (e.g. in a 2 player game, either 1 or 2).
*
* If type == GGPO_PLAYERTYPE_REMOTE:
*
* u.remote.ip_address: The ip address of the ggpo session which will host this
* player.
*
* u.remote.port: The port where udp packets should be sent to reach this player.
* All the local inputs for this session will be sent to this player at
* ip_address:port.
*
*/
typedef struct GGPOPlayer {
int size;
GGPOPlayerType type;
int player_num;
union {
struct {
bool _unused;
} local;
struct {
char ip_address[32];
unsigned short port;
} remote;
} u;
} GGPOPlayer;
typedef struct GGPOLocalEndpoint {
int player_num;
} GGPOLocalEndpoint;
#define GGPO_ERRORLIST \
GGPO_ERRORLIST_ENTRY(GGPO_OK, 0) \
GGPO_ERRORLIST_ENTRY(GGPO_ERRORCODE_SUCCESS, 0) \
GGPO_ERRORLIST_ENTRY(GGPO_ERRORCODE_GENERAL_FAILURE, -1) \
GGPO_ERRORLIST_ENTRY(GGPO_ERRORCODE_INVALID_SESSION, 1) \
GGPO_ERRORLIST_ENTRY(GGPO_ERRORCODE_INVALID_PLAYER_HANDLE, 2) \
GGPO_ERRORLIST_ENTRY(GGPO_ERRORCODE_PLAYER_OUT_OF_RANGE, 3) \
GGPO_ERRORLIST_ENTRY(GGPO_ERRORCODE_PREDICTION_THRESHOLD, 4) \
GGPO_ERRORLIST_ENTRY(GGPO_ERRORCODE_UNSUPPORTED, 5) \
GGPO_ERRORLIST_ENTRY(GGPO_ERRORCODE_NOT_SYNCHRONIZED, 6) \
GGPO_ERRORLIST_ENTRY(GGPO_ERRORCODE_IN_ROLLBACK, 7) \
GGPO_ERRORLIST_ENTRY(GGPO_ERRORCODE_INPUT_DROPPED, 8) \
GGPO_ERRORLIST_ENTRY(GGPO_ERRORCODE_PLAYER_DISCONNECTED, 9) \
GGPO_ERRORLIST_ENTRY(GGPO_ERRORCODE_TOO_MANY_SPECTATORS, 10) \
GGPO_ERRORLIST_ENTRY(GGPO_ERRORCODE_INVALID_REQUEST, 11) \
GGPO_ERRORLIST_ENTRY(GGPO_ERRORCODE_INPUT_SIZE_DIFF, 12) \
GGPO_ERRORLIST_ENTRY(GGPO_ERRORCODE_NETWORK_ERROR, 13) \
GGPO_ERRORLIST_ENTRY(GGPO_ERRORCODE_VERIFICATION_ERROR, 14)
#define GGPO_ERRORLIST_ENTRY(name, value) name = value,
typedef enum {
GGPO_ERRORLIST
} GGPOErrorCode;
#undef GGPO_ERRORLIST_ENTRY
#define GGPO_SUCCEEDED(result) ((result) == GGPO_ERRORCODE_SUCCESS)
#define GGPO_INVALID_HANDLE (-1)
/*
* The GGPOEventCode enumeration describes what type of event just happened.
*
* GGPO_EVENTCODE_CONNECTED_TO_PEER - Handshake with the game running on the
* other side of the network has been completed.
*
* GGPO_EVENTCODE_SYNCHRONIZING_WITH_PEER - Beginning the synchronization
* process with the client on the other end of the networking. The count
* and total fields in the u.synchronizing struct of the GGPOEvent
* object indicate progress.
*
* GGPO_EVENTCODE_SYNCHRONIZED_WITH_PEER - The synchronziation with this
* peer has finished.
*
* GGPO_EVENTCODE_RUNNING - All the clients have synchronized. You may begin
* sending inputs with ggpo_synchronize_inputs.
*
* GGPO_EVENTCODE_DISCONNECTED_FROM_PEER - The network connection on
* the other end of the network has closed.
*
* GGPO_EVENTCODE_TIMESYNC - The time synchronziation code has determined
* that this client is too far ahead of the other one and should slow
* down to ensure fairness. The u.timesync.frames_ahead parameter in
* the GGPOEvent object indicates how many frames the client is.
*
*/
typedef enum {
GGPO_EVENTCODE_CONNECTED_TO_PEER = 1000,
GGPO_EVENTCODE_SYNCHRONIZING_WITH_PEER = 1001,
GGPO_EVENTCODE_SYNCHRONIZED_WITH_PEER = 1002,
GGPO_EVENTCODE_RUNNING = 1003,
GGPO_EVENTCODE_DISCONNECTED_FROM_PEER = 1004,
GGPO_EVENTCODE_TIMESYNC = 1005,
GGPO_EVENTCODE_CONNECTION_INTERRUPTED = 1006,
GGPO_EVENTCODE_CONNECTION_RESUMED = 1007,
} GGPOEventCode;
/*
* The GGPOEvent structure contains an asynchronous event notification sent
* by the on_event callback. See GGPOEventCode, above, for a detailed
* explanation of each event.
*/
typedef struct {
GGPOEventCode code;
union {
struct {
GGPOPlayerHandle player;
} connected;
struct {
GGPOPlayerHandle player;
int count;
int total;
} synchronizing;
struct {
GGPOPlayerHandle player;
} synchronized;
struct {
GGPOPlayerHandle player;
} disconnected;
struct {
int frames_ahead;
} timesync;
struct {
GGPOPlayerHandle player;
int disconnect_timeout;
} connection_interrupted;
struct {
GGPOPlayerHandle player;
} connection_resumed;
} u;
} GGPOEvent;
/*
* The GGPOSessionCallbacks structure contains the callback functions that
* your application must implement. GGPO.net will periodically call these
* functions during the game. All callback functions must be implemented.
*/
typedef struct {
/*
* begin_game callback - This callback has been deprecated. You must
* implement it, but should ignore the 'game' parameter.
*/
bool (__cdecl *begin_game)(const char *game);
/*
* save_game_state - The client should allocate a buffer, copy the
* entire contents of the current game state into it, and copy the
* length into the *len parameter. Optionally, the client can compute
* a checksum of the data and store it in the *checksum argument.
*/
bool (__cdecl *save_game_state)(unsigned char **buffer, int *len, int *checksum, int frame);
/*
* load_game_state - GGPO.net will call this function at the beginning
* of a rollback. The buffer and len parameters contain a previously
* saved state returned from the save_game_state function. The client
* should make the current game state match the state contained in the
* buffer.
*/
bool (__cdecl *load_game_state)(unsigned char *buffer, int len);
/*
* log_game_state - Used in diagnostic testing. The client should use
* the ggpo_log function to write the contents of the specified save
* state in a human readible form.
*/
bool (__cdecl *log_game_state)(char *filename, unsigned char *buffer, int len);
/*
* free_buffer - Frees a game state allocated in save_game_state. You
* should deallocate the memory contained in the buffer.
*/
void (__cdecl *free_buffer)(void *buffer);
/*
* advance_frame - Called during a rollback. You should advance your game
* state by exactly one frame. Before each frame, call ggpo_synchronize_input
* to retrieve the inputs you should use for that frame. After each frame,
* you should call ggpo_advance_frame to notify GGPO.net that you're
* finished.
*
* The flags parameter is reserved. It can safely be ignored at this time.
*/
bool (__cdecl *advance_frame)(int flags);
/*
* on_event - Notification that something has happened. See the GGPOEventCode
* structure above for more information.
*/
bool (__cdecl *on_event)(GGPOEvent *info);
/*
* on_message - Delivers an application message. Allows arbitrary data to be
* exchanged with peers. This callback is optional.
*/
void (__cdecl *on_message)(unsigned char *msg, int len);
} GGPOSessionCallbacks;
/*
* The GGPONetworkStats function contains some statistics about the current
* session.
*
* network.send_queue_len - The length of the queue containing UDP packets
* which have not yet been acknowledged by the end client. The length of
* the send queue is a rough indication of the quality of the connection.
* The longer the send queue, the higher the round-trip time between the
* clients. The send queue will also be longer than usual during high
* packet loss situations.
*
* network.recv_queue_len - The number of inputs currently buffered by the
* GGPO.net network layer which have yet to be validated. The length of
* the prediction queue is roughly equal to the current frame number
* minus the frame number of the last packet in the remote queue.
*
* network.ping - The roundtrip packet transmission time as calcuated
* by GGPO.net. This will be roughly equal to the actual round trip
* packet transmission time + 2 the interval at which you call ggpo_idle
* or ggpo_advance_frame.
*
* network.kbps_sent - The estimated bandwidth used between the two
* clients, in kilobits per second.
*
* timesync.local_frames_behind - The number of frames GGPO.net calculates
* that the local client is behind the remote client at this instant in
* time. For example, if at this instant the current game client is running
* frame 1002 and the remote game client is running frame 1009, this value
* will mostly likely roughly equal 7.
*
* timesync.remote_frames_behind - The same as local_frames_behind, but
* calculated from the perspective of the remote player.
*
*/
typedef struct GGPONetworkStats {
struct {
int send_queue_len;
int recv_queue_len;
int ping;
int kbps_sent;
} network;
struct {
int local_frames_behind;
int remote_frames_behind;
} timesync;
struct {
int predicted_frames;
} sync;
} GGPONetworkStats;
/*
* ggpo_start_session --
*
* Used to being a new GGPO.net session. The ggpo object returned by ggpo_start_session
* uniquely identifies the state for this session and should be passed to all other
* functions.
*
* session - An out parameter to the new ggpo session object.
*
* cb - A GGPOSessionCallbacks structure which contains the callbacks you implement
* to help GGPO.net synchronize the two games. You must implement all functions in
* cb, even if they do nothing but 'return true';
*
* game - The name of the game. This is used internally for GGPO for logging purposes only.
*
* num_players - The number of players which will be in this game. The number of players
* per session is fixed. If you need to change the number of players or any player
* disconnects, you must start a new session.
*
* input_size - The size of the game inputs which will be passsed to ggpo_add_local_input.
*
* local_port - The port GGPO should bind to for UDP traffic.
*
* verification - Some optional data that will be matched with the peers during initial sync.
* Can be set to null if verification_size is zero. This can be used to check that all peers are
* running the same version of the application and of the game, are using the same settings, etc.
*
* verification_size - Size of the verification data. Can be set to zero to not exchange verification data.
* Maximum size is 256 bytes.
*/
GGPO_API GGPOErrorCode __cdecl ggpo_start_session(GGPOSession **session,
GGPOSessionCallbacks *cb,
const char *game,
int num_players,
int input_size,
unsigned short localport,
const void *verification,
int verification_size);
/*
* ggpo_add_player --
*
* Must be called for each player in the session (e.g. in a 3 player session, must
* be called 3 times).
*
* player - A GGPOPlayer struct used to describe the player.
*
* handle - An out parameter to a handle used to identify this player in the future.
* (e.g. in the on_event callbacks).
*/
GGPO_API GGPOErrorCode __cdecl ggpo_add_player(GGPOSession *session,
GGPOPlayer *player,
GGPOPlayerHandle *handle);
/*
* ggpo_start_synctest --
*
* Used to being a new GGPO.net sync test session. During a sync test, every
* frame of execution is run twice: once in prediction mode and once again to
* verify the result of the prediction. If the checksums of your save states
* do not match, the test is aborted.
*
* cb - A GGPOSessionCallbacks structure which contains the callbacks you implement
* to help GGPO.net synchronize the two games. You must implement all functions in
* cb, even if they do nothing but 'return true';
*
* game - The name of the game. This is used internally for GGPO for logging purposes only.
*
* num_players - The number of players which will be in this game. The number of players
* per session is fixed. If you need to change the number of players or any player
* disconnects, you must start a new session.
*
* input_size - The size of the game inputs which will be passsed to ggpo_add_local_input.
*
* frames - The number of frames to run before verifying the prediction. The
* recommended value is 1.
*
*/
GGPO_API GGPOErrorCode __cdecl ggpo_start_synctest(GGPOSession **session,
GGPOSessionCallbacks *cb,
const char *game,
int num_players,
int input_size,
int frames);
/*
* ggpo_start_spectating --
*
* Start a spectator session.
*
* cb - A GGPOSessionCallbacks structure which contains the callbacks you implement
* to help GGPO.net synchronize the two games. You must implement all functions in
* cb, even if they do nothing but 'return true';
*
* game - The name of the game. This is used internally for GGPO for logging purposes only.
*
* num_players - The number of players which will be in this game. The number of players
* per session is fixed. If you need to change the number of players or any player
* disconnects, you must start a new session.
*
* input_size - The size of the game inputs which will be passsed to ggpo_add_local_input.
*
* local_port - The port GGPO should bind to for UDP traffic.
*
* host_ip - The IP address of the host who will serve you the inputs for the game. Any
* player partcipating in the session can serve as a host.
*
* host_port - The port of the session on the host
*
* verification - Some optional data that will be matched with the peers during initial sync.
* Can be set to null if verification_size is zero. This can be used to check that all peers are
* running the same version of the application and of the game, are using the same settings, etc.
*
* verification_size - Size of the verification data. Can be set to zero to not exchange verification data.
* Maximum size is 256 bytes.
*/
GGPO_API GGPOErrorCode __cdecl ggpo_start_spectating(GGPOSession **session,
GGPOSessionCallbacks *cb,
const char *game,
int num_players,
int input_size,
unsigned short local_port,
char *host_ip,
unsigned short host_port,
const void *verification,
int verification_size);
/*
* ggpo_close_session --
* Used to close a session. You must call ggpo_close_session to
* free the resources allocated in ggpo_start_session.
*/
GGPO_API GGPOErrorCode __cdecl ggpo_close_session(GGPOSession *);
/*
* ggpo_set_frame_delay --
*
* Change the amount of frames ggpo will delay local input. Must be called
* before the first call to ggpo_synchronize_input.
*/
GGPO_API GGPOErrorCode __cdecl ggpo_set_frame_delay(GGPOSession *,
GGPOPlayerHandle player,
int frame_delay);
/*
* ggpo_idle --
* Should be called periodically by your application to give GGPO.net
* a chance to do some work. Most packet transmissions and rollbacks occur
* in ggpo_idle.
*
* timeout - The amount of time GGPO.net is allowed to spend in this function,
* in milliseconds.
*/
GGPO_API GGPOErrorCode __cdecl ggpo_idle(GGPOSession *,
int timeout);
/*
* ggpo_add_local_input --
*
* Used to notify GGPO.net of inputs that should be trasmitted to remote
* players. ggpo_add_local_input must be called once every frame for
* all player of type GGPO_PLAYERTYPE_LOCAL.
*
* player - The player handle returned for this player when you called
* ggpo_add_local_player.
*
* values - The controller inputs for this player.
*
* size - The size of the controller inputs. This must be exactly equal to the
* size passed into ggpo_start_session.
*/
GGPO_API GGPOErrorCode __cdecl ggpo_add_local_input(GGPOSession *,
GGPOPlayerHandle player,
void *values,
int size);
/*
* ggpo_synchronize_input --
*
* You should call ggpo_synchronize_input before every frame of execution,
* including those frames which happen during rollback.
*
* values - When the function returns, the values parameter will contain
* inputs for this frame for all players. The values array must be at
* least (size * players) large.
*
* size - The size of the values array.
*
* disconnect_flags - Indicated whether the input in slot (1 << flag) is
* valid. If a player has disconnected, the input in the values array for
* that player will be zeroed and the i-th flag will be set. For example,
* if only player 3 has disconnected, disconnect flags will be 8 (i.e. 1 << 3).
*/
GGPO_API GGPOErrorCode __cdecl ggpo_synchronize_input(GGPOSession *,
void *values,
int size,
int *disconnect_flags);
/*
* ggpo_disconnect_player --
*
* Disconnects a remote player from a game. Will return GGPO_ERRORCODE_PLAYER_DISCONNECTED
* if you try to disconnect a player who has already been disconnected.
*/
GGPO_API GGPOErrorCode __cdecl ggpo_disconnect_player(GGPOSession *,
GGPOPlayerHandle player);
/*
* ggpo_advance_frame --
*
* You should call ggpo_advance_frame to notify GGPO.net that you have
* advanced your gamestate by a single frame. You should call this everytime
* you advance the gamestate by a frame, even during rollbacks. GGPO.net
* may call your save_state callback before this function returns.
*/
GGPO_API GGPOErrorCode __cdecl ggpo_advance_frame(GGPOSession *);
/*
* ggpo_get_network_stats --
*
* Used to fetch some statistics about the quality of the network connection.
*
* player - The player handle returned from the ggpo_add_player function you used
* to add the remote player.
*
* stats - Out parameter to the network statistics.
*/
GGPO_API GGPOErrorCode __cdecl ggpo_get_network_stats(GGPOSession *,
GGPOPlayerHandle player,
GGPONetworkStats *stats);
/*
* ggpo_set_disconnect_timeout --
*
* Sets the disconnect timeout. The session will automatically disconnect
* from a remote peer if it has not received a packet in the timeout window.
* You will be notified of the disconnect via a GGPO_EVENTCODE_DISCONNECTED_FROM_PEER
* event.
*
* Setting a timeout value of 0 will disable automatic disconnects.
*
* timeout - The time in milliseconds to wait before disconnecting a peer.
*/
GGPO_API GGPOErrorCode __cdecl ggpo_set_disconnect_timeout(GGPOSession *,
int timeout);
/*
* ggpo_set_disconnect_notify_start --
*
* The time to wait before the first GGPO_EVENTCODE_NETWORK_INTERRUPTED timeout
* will be sent.
*
* timeout - The amount of time which needs to elapse without receiving a packet
* before the GGPO_EVENTCODE_NETWORK_INTERRUPTED event is sent.
*/
GGPO_API GGPOErrorCode __cdecl ggpo_set_disconnect_notify_start(GGPOSession *,
int timeout);
/*
* ggpo_send_message --
*
* Sends application-specific data to other peers. The message is
* delivered by the on_user_message callback.
* If spectators is true, the message is also sent to spectators.
*/
GGPO_API GGPOErrorCode __cdecl ggpo_send_message(GGPOSession *,
const void *msg,
int len,
bool spectators);
#ifdef __cplusplus
};
#endif
#endif
@@ -0,0 +1,33 @@
/* -----------------------------------------------------------------------
* GGPO.net (http://ggpo.net) - Copyright 2009 GroundStorm Studios, LLC.
*
* Use of this software is governed by the MIT license that can be found
* in the LICENSE file.
*/
#ifndef _BACKEND_H
#define _BACKEND_H
#include "../ggpo_types.h"
#include "ggponet.h"
struct GGPOSession {
virtual ~GGPOSession() { }
virtual GGPOErrorCode DoPoll(int timeout) { return GGPO_OK; }
virtual GGPOErrorCode AddPlayer(GGPOPlayer *player, GGPOPlayerHandle *handle) = 0;
virtual GGPOErrorCode AddLocalInput(GGPOPlayerHandle player, void *values, int size) = 0;
virtual GGPOErrorCode SyncInput(void *values, int size, int *disconnect_flags) = 0;
virtual GGPOErrorCode IncrementFrame(void) { return GGPO_OK; }
virtual GGPOErrorCode DisconnectPlayer(GGPOPlayerHandle handle) { return GGPO_OK; }
virtual GGPOErrorCode GetNetworkStats(GGPONetworkStats *stats, GGPOPlayerHandle handle) { return GGPO_OK; }
virtual GGPOErrorCode SetFrameDelay(GGPOPlayerHandle player, int delay) { return GGPO_ERRORCODE_UNSUPPORTED; }
virtual GGPOErrorCode SetDisconnectTimeout(int timeout) { return GGPO_ERRORCODE_UNSUPPORTED; }
virtual GGPOErrorCode SetDisconnectNotifyStart(int timeout) { return GGPO_ERRORCODE_UNSUPPORTED; }
virtual GGPOErrorCode SendMessage(const void *msg, int len, bool spectators) { return GGPO_ERRORCODE_UNSUPPORTED; }
};
typedef struct GGPOSession Quark, IQuarkBackend; /* XXX: nuke this */
#endif
+664
View File
@@ -0,0 +1,664 @@
/* -----------------------------------------------------------------------
* GGPO.net (http://ggpo.net) - Copyright 2009 GroundStorm Studios, LLC.
*
* Use of this software is governed by the MIT license that can be found
* in the LICENSE file.
*/
#include "p2p.h"
#include <chrono>
#include <thread>
static const int RECOMMENDATION_INTERVAL = 240;
static const int DEFAULT_DISCONNECT_TIMEOUT = 5000;
static const int DEFAULT_DISCONNECT_NOTIFY_START = 750;
Peer2PeerBackend::Peer2PeerBackend(GGPOSessionCallbacks *cb,
const char *gamename,
uint16 localport,
int num_players,
int input_size,
const void *verification,
int verification_size) :
_sync(_local_connect_status),
_endpoints(nullptr),
_num_spectators(0),
_input_size(input_size),
_num_players(num_players),
_next_spectator_frame(0),
_disconnect_timeout(DEFAULT_DISCONNECT_TIMEOUT),
_disconnect_notify_start(DEFAULT_DISCONNECT_NOTIFY_START)
{
_callbacks = *cb;
_synchronizing = true;
_next_recommended_sleep = 0;
/*
* Initialize the synchronziation layer
*/
Sync::Config config = { 0 };
config.num_players = num_players;
config.input_size = input_size;
config.callbacks = _callbacks;
config.num_prediction_frames = MAX_PREDICTION_FRAMES;
_sync.Init(config);
/*
* Initialize the UDP port
*/
_udp.Init(localport, &_poll, this);
_endpoints = new UdpProtocol[_num_players];
for (int i = 0; i < _num_players; i++)
_endpoints[i].SetVerificationData(verification, verification_size);
memset(_local_connect_status, 0, sizeof(_local_connect_status));
for (unsigned i = 0; i < ARRAY_SIZE(_local_connect_status); i++) {
_local_connect_status[i].last_frame = -1;
}
/*
* Preload the ROM
*/
_callbacks.begin_game(gamename);
}
Peer2PeerBackend::~Peer2PeerBackend()
{
delete [] _endpoints;
}
void
Peer2PeerBackend::AddRemotePlayer(char *ip,
uint16 port,
int queue)
{
/*
* Start the state machine (xxx: no)
*/
_synchronizing = true;
_endpoints[queue].Init(&_udp, _poll, queue, ip, port, _local_connect_status);
_endpoints[queue].SetDisconnectTimeout(_disconnect_timeout);
_endpoints[queue].SetDisconnectNotifyStart(_disconnect_notify_start);
_endpoints[queue].Synchronize();
}
GGPOErrorCode Peer2PeerBackend::AddSpectator(char *ip,
uint16 port)
{
if (_num_spectators == GGPO_MAX_SPECTATORS) {
return GGPO_ERRORCODE_TOO_MANY_SPECTATORS;
}
/*
* Currently, we can only add spectators before the game starts.
*/
if (!_synchronizing) {
return GGPO_ERRORCODE_INVALID_REQUEST;
}
int queue = _num_spectators++;
_spectators[queue].Init(&_udp, _poll, queue + 1000, ip, port, _local_connect_status);
_spectators[queue].SetDisconnectTimeout(_disconnect_timeout);
_spectators[queue].SetDisconnectNotifyStart(_disconnect_notify_start);
_spectators[queue].Synchronize();
return GGPO_OK;
}
GGPOErrorCode
Peer2PeerBackend::DoPoll(int timeout)
{
if (!_sync.InRollback()) {
_poll.Pump(0);
PollUdpProtocolEvents();
if (!_synchronizing) {
_sync.CheckSimulation(timeout);
// notify all of our endpoints of their local frame number for their
// next connection quality report
int current_frame = _sync.GetFrameCount();
for (int i = 0; i < _num_players; i++) {
_endpoints[i].SetLocalFrameNumber(current_frame);
}
int total_min_confirmed;
if (_num_players <= 2) {
total_min_confirmed = Poll2Players(current_frame);
} else {
total_min_confirmed = PollNPlayers(current_frame);
}
Log("last confirmed frame in p2p backend is %d.", total_min_confirmed);
if (total_min_confirmed >= 0) {
ASSERT(total_min_confirmed != INT_MAX);
if (_num_spectators > 0) {
while (_next_spectator_frame <= total_min_confirmed) {
Log("pushing frame %d to spectators.", _next_spectator_frame);
GameInput input;
input.frame = _next_spectator_frame;
input.size = _input_size * _num_players;
_sync.GetConfirmedInputs(input.bits, _input_size * _num_players, _next_spectator_frame);
for (int i = 0; i < _num_spectators; i++) {
_spectators[i].SendInput(input);
}
_next_spectator_frame++;
}
}
Log("setting confirmed frame in sync to %d.", total_min_confirmed);
_sync.SetLastConfirmedFrame(total_min_confirmed);
}
// send timesync notifications if now is the proper time
if (current_frame > _next_recommended_sleep) {
int interval = 0;
for (int i = 0; i < _num_players; i++) {
interval = MAX(interval, _endpoints[i].RecommendFrameDelay());
}
if (interval > 0) {
GGPOEvent info;
info.code = GGPO_EVENTCODE_TIMESYNC;
info.u.timesync.frames_ahead = interval;
_callbacks.on_event(&info);
_next_recommended_sleep = current_frame + RECOMMENDATION_INTERVAL;
}
}
// XXX: this is obviously a farce...
if (timeout)
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
}
return GGPO_OK;
}
int Peer2PeerBackend::Poll2Players(int current_frame)
{
int i;
// discard confirmed frames as appropriate
int total_min_confirmed = MAX_INT;
for (i = 0; i < _num_players; i++) {
bool queue_connected = true;
if (_endpoints[i].IsRunning()) {
int ignore;
queue_connected = _endpoints[i].GetPeerConnectStatus(i, &ignore);
}
if (!_local_connect_status[i].disconnected) {
total_min_confirmed = MIN(_local_connect_status[i].last_frame, total_min_confirmed);
}
Log(" local endp: connected = %d, last_received = %d, total_min_confirmed = %d.", !_local_connect_status[i].disconnected, _local_connect_status[i].last_frame, total_min_confirmed);
if (!queue_connected && !_local_connect_status[i].disconnected) {
Log("disconnecting i %d by remote request.", i);
DisconnectPlayerQueue(i, total_min_confirmed);
}
Log(" total_min_confirmed = %d.", total_min_confirmed);
}
return total_min_confirmed;
}
int Peer2PeerBackend::PollNPlayers(int current_frame)
{
int i, queue, last_received;
// discard confirmed frames as appropriate
int total_min_confirmed = MAX_INT;
for (queue = 0; queue < _num_players; queue++) {
bool queue_connected = true;
int queue_min_confirmed = MAX_INT;
Log("considering queue %d.", queue);
for (i = 0; i < _num_players; i++) {
// we're going to do a lot of logic here in consideration of endpoint i.
// keep accumulating the minimum confirmed point for all n*n packets and
// throw away the rest.
if (_endpoints[i].IsRunning()) {
bool connected = _endpoints[i].GetPeerConnectStatus(queue, &last_received);
queue_connected = queue_connected && connected;
queue_min_confirmed = MIN(last_received, queue_min_confirmed);
Log(" endpoint %d: connected = %d, last_received = %d, queue_min_confirmed = %d.", i, connected, last_received, queue_min_confirmed);
} else {
Log(" endpoint %d: ignoring... not running.", i);
}
}
// merge in our local status only if we're still connected!
if (!_local_connect_status[queue].disconnected) {
queue_min_confirmed = MIN(_local_connect_status[queue].last_frame, queue_min_confirmed);
}
Log(" local endp: connected = %d, last_received = %d, queue_min_confirmed = %d.", !_local_connect_status[queue].disconnected, _local_connect_status[queue].last_frame, queue_min_confirmed);
if (queue_connected) {
total_min_confirmed = MIN(queue_min_confirmed, total_min_confirmed);
} else {
// check to see if this disconnect notification is further back than we've been before. If
// so, we need to re-adjust. This can happen when we detect our own disconnect at frame n
// and later receive a disconnect notification for frame n-1.
if (!_local_connect_status[queue].disconnected || _local_connect_status[queue].last_frame > queue_min_confirmed) {
Log("disconnecting queue %d by remote request.", queue);
DisconnectPlayerQueue(queue, queue_min_confirmed);
}
}
Log(" total_min_confirmed = %d.", total_min_confirmed);
}
return total_min_confirmed;
}
GGPOErrorCode
Peer2PeerBackend::AddPlayer(GGPOPlayer *player,
GGPOPlayerHandle *handle)
{
if (player->type == GGPO_PLAYERTYPE_SPECTATOR) {
return AddSpectator(player->u.remote.ip_address, player->u.remote.port);
}
int queue = player->player_num - 1;
if (player->player_num < 1 || player->player_num > _num_players) {
return GGPO_ERRORCODE_PLAYER_OUT_OF_RANGE;
}
*handle = QueueToPlayerHandle(queue);
if (player->type == GGPO_PLAYERTYPE_REMOTE) {
AddRemotePlayer(player->u.remote.ip_address, player->u.remote.port, queue);
}
return GGPO_OK;
}
GGPOErrorCode
Peer2PeerBackend::AddLocalInput(GGPOPlayerHandle player,
void *values,
int size)
{
int queue;
GameInput input;
GGPOErrorCode result;
if (_sync.InRollback()) {
return GGPO_ERRORCODE_IN_ROLLBACK;
}
if (_synchronizing) {
return GGPO_ERRORCODE_NOT_SYNCHRONIZED;
}
result = PlayerHandleToQueue(player, &queue);
if (!GGPO_SUCCEEDED(result)) {
return result;
}
input.init(-1, (char *)values, size);
// Feed the input for the current frame into the synchronzation layer.
if (!_sync.AddLocalInput(queue, input)) {
return GGPO_ERRORCODE_PREDICTION_THRESHOLD;
}
if (input.frame != GameInput::NullFrame) { // xxx: <- comment why this is the case
// Update the local connect status state to indicate that we've got a
// confirmed local frame for this player. this must come first so it
// gets incorporated into the next packet we send.
Log("setting local connect status for local queue %d to %d", queue, input.frame);
_local_connect_status[queue].last_frame = input.frame;
// Send the input to all the remote players.
for (int i = 0; i < _num_players; i++) {
if (_endpoints[i].IsInitialized()) {
_endpoints[i].SendInput(input);
}
}
}
return GGPO_OK;
}
GGPOErrorCode
Peer2PeerBackend::SyncInput(void *values,
int size,
int *disconnect_flags)
{
int flags;
// Wait until we've started to return inputs.
if (_synchronizing) {
return GGPO_ERRORCODE_NOT_SYNCHRONIZED;
}
flags = _sync.SynchronizeInputs(values, size);
if (disconnect_flags) {
*disconnect_flags = flags;
}
return GGPO_OK;
}
GGPOErrorCode
Peer2PeerBackend::IncrementFrame(void)
{
Log("End of frame (%d)...", _sync.GetFrameCount());
_sync.IncrementFrame();
DoPoll(0);
PollSyncEvents();
return GGPO_OK;
}
void
Peer2PeerBackend::PollSyncEvents(void)
{
Sync::Event e;
while (_sync.GetEvent(e)) {
OnSyncEvent(e);
}
return;
}
void
Peer2PeerBackend::PollUdpProtocolEvents(void)
{
UdpProtocol::Event evt;
for (int i = 0; i < _num_players; i++) {
while (_endpoints[i].GetEvent(evt)) {
OnUdpProtocolPeerEvent(evt, i);
}
}
for (int i = 0; i < _num_spectators; i++) {
while (_spectators[i].GetEvent(evt)) {
OnUdpProtocolSpectatorEvent(evt, i);
}
}
}
void
Peer2PeerBackend::OnUdpProtocolPeerEvent(UdpProtocol::Event &evt, int queue)
{
OnUdpProtocolEvent(evt, QueueToPlayerHandle(queue));
switch (evt.type) {
case UdpProtocol::Event::Input:
if (!_local_connect_status[queue].disconnected) {
int current_remote_frame = _local_connect_status[queue].last_frame;
int new_remote_frame = evt.u.input.input.frame;
ASSERT(current_remote_frame == -1 || new_remote_frame == (current_remote_frame + 1));
_sync.AddRemoteInput(queue, evt.u.input.input);
// Notify the other endpoints which frame we received from a peer
Log("setting remote connect status for queue %d to %d", queue, evt.u.input.input.frame);
_local_connect_status[queue].last_frame = evt.u.input.input.frame;
}
break;
case UdpProtocol::Event::Disconnected:
DisconnectPlayer(QueueToPlayerHandle(queue));
break;
case UdpProtocol::Event::AppData:
if (evt.u.app_data.spectators)
for (int i = 0; i < _num_spectators; i++)
if (_spectators[i].IsInitialized())
_spectators[i].SendAppData(evt.u.app_data.data, evt.u.app_data.size, true);
Log("calling on_message callback with %d bytes", evt.u.app_data.size);
if (_callbacks.on_message != nullptr)
_callbacks.on_message(evt.u.app_data.data, evt.u.app_data.size);
break;
default:
break;
}
}
void
Peer2PeerBackend::OnUdpProtocolSpectatorEvent(UdpProtocol::Event &evt, int queue)
{
GGPOPlayerHandle handle = QueueToSpectatorHandle(queue);
OnUdpProtocolEvent(evt, handle);
if (evt.type == UdpProtocol::Event::Disconnected)
{
_spectators[queue].Disconnect();
GGPOEvent info;
info.code = GGPO_EVENTCODE_DISCONNECTED_FROM_PEER;
info.u.disconnected.player = handle;
_callbacks.on_event(&info);
}
}
void
Peer2PeerBackend::OnUdpProtocolEvent(UdpProtocol::Event &evt, GGPOPlayerHandle handle)
{
GGPOEvent info;
switch (evt.type) {
case UdpProtocol::Event::Connected:
info.code = GGPO_EVENTCODE_CONNECTED_TO_PEER;
info.u.connected.player = handle;
_callbacks.on_event(&info);
break;
case UdpProtocol::Event::Synchronizing:
info.code = GGPO_EVENTCODE_SYNCHRONIZING_WITH_PEER;
info.u.synchronizing.player = handle;
info.u.synchronizing.count = evt.u.synchronizing.count;
info.u.synchronizing.total = evt.u.synchronizing.total;
_callbacks.on_event(&info);
break;
case UdpProtocol::Event::Synchronzied:
info.code = GGPO_EVENTCODE_SYNCHRONIZED_WITH_PEER;
info.u.synchronized.player = handle;
_callbacks.on_event(&info);
CheckInitialSync();
break;
case UdpProtocol::Event::NetworkInterrupted:
info.code = GGPO_EVENTCODE_CONNECTION_INTERRUPTED;
info.u.connection_interrupted.player = handle;
info.u.connection_interrupted.disconnect_timeout = evt.u.network_interrupted.disconnect_timeout;
_callbacks.on_event(&info);
break;
case UdpProtocol::Event::NetworkResumed:
info.code = GGPO_EVENTCODE_CONNECTION_RESUMED;
info.u.connection_resumed.player = handle;
_callbacks.on_event(&info);
break;
default:
break;
}
}
/*
* Called only as the result of a local decision to disconnect. The remote
* decisions to disconnect are a result of us parsing the peer_connect_settings
* blob in every endpoint periodically.
*/
GGPOErrorCode
Peer2PeerBackend::DisconnectPlayer(GGPOPlayerHandle player)
{
int queue;
GGPOErrorCode result;
result = PlayerHandleToQueue(player, &queue);
if (!GGPO_SUCCEEDED(result)) {
return result;
}
if (_local_connect_status[queue].disconnected) {
return GGPO_ERRORCODE_PLAYER_DISCONNECTED;
}
if (!_endpoints[queue].IsInitialized()) {
int current_frame = _sync.GetFrameCount();
// xxx: we should be tracking who the local player is, but for now assume
// that if the endpoint is not initalized, this must be the local player.
Log("Disconnecting local player %d at frame %d by user request.", queue, _local_connect_status[queue].last_frame);
for (int i = 0; i < _num_players; i++) {
if (_endpoints[i].IsInitialized()) {
DisconnectPlayerQueue(i, current_frame);
}
}
} else {
Log("Disconnecting queue %d at frame %d by user request.", queue, _local_connect_status[queue].last_frame);
DisconnectPlayerQueue(queue, _local_connect_status[queue].last_frame);
}
return GGPO_OK;
}
void
Peer2PeerBackend::DisconnectPlayerQueue(int queue, int syncto)
{
GGPOEvent info;
int framecount = _sync.GetFrameCount();
_endpoints[queue].Disconnect();
Log("Changing queue %d local connect status for last frame from %d to %d on disconnect request (current: %d).",
queue, _local_connect_status[queue].last_frame, syncto, framecount);
_local_connect_status[queue].disconnected = 1;
_local_connect_status[queue].last_frame = syncto;
if (syncto != GameInput::NullFrame && syncto < framecount) {
Log("adjusting simulation to account for the fact that %d disconnected @ %d.", queue, syncto);
_sync.AdjustSimulation(syncto);
Log("finished adjusting simulation.");
}
info.code = GGPO_EVENTCODE_DISCONNECTED_FROM_PEER;
info.u.disconnected.player = QueueToPlayerHandle(queue);
_callbacks.on_event(&info);
CheckInitialSync();
}
GGPOErrorCode
Peer2PeerBackend::GetNetworkStats(GGPONetworkStats *stats, GGPOPlayerHandle player)
{
int queue;
GGPOErrorCode result;
result = PlayerHandleToQueue(player, &queue);
if (!GGPO_SUCCEEDED(result)) {
return result;
}
memset(stats, 0, sizeof *stats);
_endpoints[queue].GetNetworkStats(stats);
stats->sync.predicted_frames = _sync.GetPredictedFrames();
return GGPO_OK;
}
GGPOErrorCode
Peer2PeerBackend::SetFrameDelay(GGPOPlayerHandle player, int delay)
{
int queue;
GGPOErrorCode result;
result = PlayerHandleToQueue(player, &queue);
if (!GGPO_SUCCEEDED(result)) {
return result;
}
_sync.SetFrameDelay(queue, delay);
return GGPO_OK;
}
GGPOErrorCode
Peer2PeerBackend::SetDisconnectTimeout(int timeout)
{
_disconnect_timeout = timeout;
for (int i = 0; i < _num_players; i++) {
if (_endpoints[i].IsInitialized()) {
_endpoints[i].SetDisconnectTimeout(_disconnect_timeout);
}
}
return GGPO_OK;
}
GGPOErrorCode
Peer2PeerBackend::SetDisconnectNotifyStart(int timeout)
{
_disconnect_notify_start = timeout;
for (int i = 0; i < _num_players; i++) {
if (_endpoints[i].IsInitialized()) {
_endpoints[i].SetDisconnectNotifyStart(_disconnect_notify_start);
}
}
return GGPO_OK;
}
GGPOErrorCode
Peer2PeerBackend::PlayerHandleToQueue(GGPOPlayerHandle player, int *queue)
{
int offset = ((int)player - 1);
if (offset < 0 || offset >= _num_players) {
return GGPO_ERRORCODE_INVALID_PLAYER_HANDLE;
}
*queue = offset;
return GGPO_OK;
}
void
Peer2PeerBackend::OnMsg(sockaddr_in &from, UdpMsg *msg, int len)
{
for (int i = 0; i < _num_players; i++) {
if (_endpoints[i].HandlesMsg(from, msg)) {
_endpoints[i].OnMsg(msg, len);
return;
}
}
for (int i = 0; i < _num_spectators; i++) {
if (_spectators[i].HandlesMsg(from, msg)) {
_spectators[i].OnMsg(msg, len);
return;
}
}
}
void
Peer2PeerBackend::CheckInitialSync()
{
int i;
if (_synchronizing) {
// Check to see if everyone is now synchronized. If so,
// go ahead and tell the client that we're ok to accept input.
for (i = 0; i < _num_players; i++) {
// xxx: IsInitialized() must go... we're actually using it as a proxy for "represents the local player"
if (_endpoints[i].IsInitialized() && !_endpoints[i].IsSynchronized() && !_local_connect_status[i].disconnected) {
return;
}
}
for (i = 0; i < _num_spectators; i++) {
if (_spectators[i].IsInitialized() && !_spectators[i].IsSynchronized()) {
return;
}
}
GGPOEvent info;
info.code = GGPO_EVENTCODE_RUNNING;
_callbacks.on_event(&info);
_synchronizing = false;
}
}
GGPOErrorCode Peer2PeerBackend::SendMessage(const void *msg, int len, bool spectators)
{
if (_synchronizing)
return GGPO_ERRORCODE_NOT_SYNCHRONIZED;
if (len > MAX_APPDATA_SIZE)
return GGPO_ERRORCODE_INVALID_REQUEST;
for (int i = 0; i < _num_players; i++)
if (_endpoints[i].IsInitialized())
_endpoints[i].SendAppData(msg, len, spectators);
if (spectators)
for (int i = 0; i < _num_spectators; i++)
if (_spectators[i].IsInitialized())
_spectators[i].SendAppData(msg, len, spectators);
return GGPO_ERRORCODE_SUCCESS;
}
+79
View File
@@ -0,0 +1,79 @@
/* -----------------------------------------------------------------------
* GGPO.net (http://ggpo.net) - Copyright 2009 GroundStorm Studios, LLC.
*
* Use of this software is governed by the MIT license that can be found
* in the LICENSE file.
*/
#ifndef _P2P_H
#define _P2P_H
#include "ggpo_types.h"
#include "ggpo_poll.h"
#include "sync.h"
#include "backend.h"
#include "timesync.h"
#include "network/udp_proto.h"
class Peer2PeerBackend : public IQuarkBackend, IPollSink, Udp::Callbacks {
public:
Peer2PeerBackend(GGPOSessionCallbacks *cb, const char *gamename, uint16 localport, int num_players, int input_size,
const void *verification, int verification_size);
virtual ~Peer2PeerBackend();
public:
GGPOErrorCode DoPoll(int timeout) override;
GGPOErrorCode AddPlayer(GGPOPlayer *player, GGPOPlayerHandle *handle) override;
GGPOErrorCode AddLocalInput(GGPOPlayerHandle player, void *values, int size) override;
GGPOErrorCode SyncInput(void *values, int size, int *disconnect_flags) override;
GGPOErrorCode IncrementFrame(void) override;
GGPOErrorCode DisconnectPlayer(GGPOPlayerHandle handle) override;
GGPOErrorCode GetNetworkStats(GGPONetworkStats *stats, GGPOPlayerHandle handle) override;
GGPOErrorCode SetFrameDelay(GGPOPlayerHandle player, int delay) override;
GGPOErrorCode SetDisconnectTimeout(int timeout) override;
GGPOErrorCode SetDisconnectNotifyStart(int timeout) override;
GGPOErrorCode SendMessage(const void *msg, int len, bool spectators) override;
public:
void OnMsg(sockaddr_in &from, UdpMsg *msg, int len) override;
protected:
GGPOErrorCode PlayerHandleToQueue(GGPOPlayerHandle player, int *queue);
GGPOPlayerHandle QueueToPlayerHandle(int queue) { return (GGPOPlayerHandle)(queue + 1); }
GGPOPlayerHandle QueueToSpectatorHandle(int queue) { return (GGPOPlayerHandle)(queue + 1000); } /* out of range of the player array, basically */
void DisconnectPlayerQueue(int queue, int syncto);
void PollSyncEvents(void);
void PollUdpProtocolEvents(void);
void CheckInitialSync(void);
int Poll2Players(int current_frame);
int PollNPlayers(int current_frame);
void AddRemotePlayer(char *remoteip, uint16 reportport, int queue);
GGPOErrorCode AddSpectator(char *remoteip, uint16 reportport);
virtual void OnSyncEvent(Sync::Event &e) { }
virtual void OnUdpProtocolEvent(UdpProtocol::Event &e, GGPOPlayerHandle handle);
virtual void OnUdpProtocolPeerEvent(UdpProtocol::Event &e, int queue);
virtual void OnUdpProtocolSpectatorEvent(UdpProtocol::Event &e, int queue);
protected:
GGPOSessionCallbacks _callbacks;
Poll _poll;
Sync _sync;
Udp _udp;
UdpProtocol *_endpoints;
UdpProtocol _spectators[GGPO_MAX_SPECTATORS];
int _num_spectators;
int _input_size;
bool _synchronizing;
int _num_players;
int _next_recommended_sleep;
int _next_spectator_frame;
int _disconnect_timeout;
int _disconnect_notify_start;
UdpMsg::connect_status _local_connect_status[UDP_MSG_MAX_PLAYERS];
};
#endif
@@ -0,0 +1,189 @@
/* -----------------------------------------------------------------------
* GGPO.net (http://ggpo.net) - Copyright 2009 GroundStorm Studios, LLC.
*
* Use of this software is governed by the MIT license that can be found
* in the LICENSE file.
*/
#include "spectator.h"
SpectatorBackend::SpectatorBackend(GGPOSessionCallbacks *cb,
const char* gamename,
uint16 localport,
int num_players,
int input_size,
char *hostip,
u_short hostport,
const void *verification,
int verification_size) :
_input_size(input_size),
_num_players(num_players),
_next_input_to_send(0)
{
_callbacks = *cb;
_synchronizing = true;
for (size_t i = 0; i < ARRAY_SIZE(_inputs); i++) {
_inputs[i].frame = -1;
}
/*
* Initialize the UDP port
*/
_udp.Init(localport, &_poll, this);
/*
* Init the host endpoint
*/
_host.SetVerificationData(verification, verification_size);
_host.Init(&_udp, _poll, 0, hostip, hostport, NULL);
_host.Synchronize();
/*
* Preload the ROM
*/
_callbacks.begin_game(gamename);
}
SpectatorBackend::~SpectatorBackend()
{
}
GGPOErrorCode
SpectatorBackend::DoPoll(int timeout)
{
_poll.Pump(0);
PollUdpProtocolEvents();
return GGPO_OK;
}
GGPOErrorCode
SpectatorBackend::SyncInput(void *values,
int size,
int *disconnect_flags)
{
// Wait until we've started to return inputs.
if (_synchronizing) {
return GGPO_ERRORCODE_NOT_SYNCHRONIZED;
}
GameInput &input = _inputs[_next_input_to_send % SPECTATOR_FRAME_BUFFER_SIZE];
if (input.frame < _next_input_to_send) {
// Haven't received the input from the host yet. Wait
return GGPO_ERRORCODE_PREDICTION_THRESHOLD;
}
if (input.frame > _next_input_to_send) {
// The host is way way way far ahead of the spectator. How'd this
// happen? Anyway, the input we need is gone forever.
return GGPO_ERRORCODE_GENERAL_FAILURE;
}
ASSERT(size >= _input_size * _num_players);
memcpy(values, input.bits, _input_size * _num_players);
if (disconnect_flags) {
*disconnect_flags = 0; // xxx: should get them from the host!
}
_next_input_to_send++;
return GGPO_OK;
}
GGPOErrorCode
SpectatorBackend::IncrementFrame(void)
{
Log("End of frame (%d)...", _next_input_to_send - 1);
DoPoll(0);
PollUdpProtocolEvents();
return GGPO_OK;
}
void
SpectatorBackend::PollUdpProtocolEvents(void)
{
UdpProtocol::Event evt;
while (_host.GetEvent(evt)) {
OnUdpProtocolEvent(evt);
}
}
void
SpectatorBackend::OnUdpProtocolEvent(UdpProtocol::Event &evt)
{
GGPOEvent info;
switch (evt.type) {
case UdpProtocol::Event::Connected:
info.code = GGPO_EVENTCODE_CONNECTED_TO_PEER;
info.u.connected.player = 0;
_callbacks.on_event(&info);
break;
case UdpProtocol::Event::Synchronizing:
info.code = GGPO_EVENTCODE_SYNCHRONIZING_WITH_PEER;
info.u.synchronizing.player = 0;
info.u.synchronizing.count = evt.u.synchronizing.count;
info.u.synchronizing.total = evt.u.synchronizing.total;
_callbacks.on_event(&info);
break;
case UdpProtocol::Event::Synchronzied:
if (_synchronizing) {
info.code = GGPO_EVENTCODE_SYNCHRONIZED_WITH_PEER;
info.u.synchronized.player = 0;
_callbacks.on_event(&info);
info.code = GGPO_EVENTCODE_RUNNING;
_callbacks.on_event(&info);
_synchronizing = false;
}
break;
case UdpProtocol::Event::NetworkInterrupted:
info.code = GGPO_EVENTCODE_CONNECTION_INTERRUPTED;
info.u.connection_interrupted.player = 0;
info.u.connection_interrupted.disconnect_timeout = evt.u.network_interrupted.disconnect_timeout;
_callbacks.on_event(&info);
break;
case UdpProtocol::Event::NetworkResumed:
info.code = GGPO_EVENTCODE_CONNECTION_RESUMED;
info.u.connection_resumed.player = 0;
_callbacks.on_event(&info);
break;
case UdpProtocol::Event::Disconnected:
info.code = GGPO_EVENTCODE_DISCONNECTED_FROM_PEER;
info.u.disconnected.player = 0;
_callbacks.on_event(&info);
break;
case UdpProtocol::Event::Input:
{
GameInput& input = evt.u.input.input;
_host.SetLocalFrameNumber(input.frame);
_host.SendInputAck();
_inputs[input.frame % SPECTATOR_FRAME_BUFFER_SIZE] = input;
}
break;
case UdpProtocol::Event::AppData:
Log("calling on_message callback with %d bytes", evt.u.app_data.size);
if (_callbacks.on_message != nullptr)
_callbacks.on_message(evt.u.app_data.data, evt.u.app_data.size);
break;
default:
break;
}
}
void
SpectatorBackend::OnMsg(sockaddr_in &from, UdpMsg *msg, int len)
{
if (_host.HandlesMsg(from, msg)) {
_host.OnMsg(msg, len);
}
}
@@ -0,0 +1,60 @@
/* -----------------------------------------------------------------------
* GGPO.net (http://ggpo.net) - Copyright 2009 GroundStorm Studios, LLC.
*
* Use of this software is governed by the MIT license that can be found
* in the LICENSE file.
*/
#ifndef _SPECTATOR_H
#define _SPECTATOR_H
#include "../ggpo_poll.h"
#include "../ggpo_types.h"
#include "sync.h"
#include "backend.h"
#include "timesync.h"
#include "network/udp_proto.h"
#define SPECTATOR_FRAME_BUFFER_SIZE 64
class SpectatorBackend : public IQuarkBackend, IPollSink, Udp::Callbacks {
public:
SpectatorBackend(GGPOSessionCallbacks *cb, const char *gamename, uint16 localport, int num_players, int input_size, char *hostip, u_short hostport,
const void *verification, int verification_size);
virtual ~SpectatorBackend();
public:
GGPOErrorCode DoPoll(int timeout) override;
GGPOErrorCode AddPlayer(GGPOPlayer *player, GGPOPlayerHandle *handle) override { return GGPO_ERRORCODE_UNSUPPORTED; }
GGPOErrorCode AddLocalInput(GGPOPlayerHandle player, void *values, int size) override { return GGPO_OK; }
GGPOErrorCode SyncInput(void *values, int size, int *disconnect_flags) override;
GGPOErrorCode IncrementFrame(void) override;
GGPOErrorCode DisconnectPlayer(GGPOPlayerHandle handle) override { return GGPO_ERRORCODE_UNSUPPORTED; }
GGPOErrorCode GetNetworkStats(GGPONetworkStats *stats, GGPOPlayerHandle handle) override { return GGPO_ERRORCODE_UNSUPPORTED; }
GGPOErrorCode SetFrameDelay(GGPOPlayerHandle player, int delay) override { return GGPO_ERRORCODE_UNSUPPORTED; }
GGPOErrorCode SetDisconnectTimeout(int timeout) override { return GGPO_ERRORCODE_UNSUPPORTED; }
GGPOErrorCode SetDisconnectNotifyStart(int timeout) override { return GGPO_ERRORCODE_UNSUPPORTED; }
public:
void OnMsg(sockaddr_in &from, UdpMsg *msg, int len) override;
protected:
void PollUdpProtocolEvents(void);
void CheckInitialSync(void);
void OnUdpProtocolEvent(UdpProtocol::Event &e);
protected:
GGPOSessionCallbacks _callbacks;
Poll _poll;
Udp _udp;
UdpProtocol _host;
bool _synchronizing;
int _input_size;
int _num_players;
int _next_input_to_send;
GameInput _inputs[SPECTATOR_FRAME_BUFFER_SIZE];
};
#endif
@@ -0,0 +1,184 @@
/* -----------------------------------------------------------------------
* GGPO.net (http://ggpo.net) - Copyright 2009 GroundStorm Studios, LLC.
*
* Use of this software is governed by the MIT license that can be found
* in the LICENSE file.
*/
#include "synctest.h"
SyncTestBackend::SyncTestBackend(GGPOSessionCallbacks *cb,
const char *gamename,
int frames,
int num_players) :
_sync(NULL)
{
_callbacks = *cb;
_num_players = num_players;
_check_distance = frames;
_last_verified = 0;
_rollingback = false;
_running = false;
_logfp = NULL;
_current_input.erase();
strcpy(_game, gamename);
/*
* Initialize the synchronziation layer
*/
Sync::Config config = { 0 };
config.callbacks = _callbacks;
config.num_prediction_frames = MAX_PREDICTION_FRAMES;
_sync.Init(config);
/*
* Preload the ROM
*/
_callbacks.begin_game(gamename);
}
SyncTestBackend::~SyncTestBackend()
{
}
GGPOErrorCode
SyncTestBackend::DoPoll(int timeout)
{
if (!_running) {
GGPOEvent info;
info.code = GGPO_EVENTCODE_RUNNING;
_callbacks.on_event(&info);
_running = true;
}
return GGPO_OK;
}
GGPOErrorCode
SyncTestBackend::AddPlayer(GGPOPlayer *player, GGPOPlayerHandle *handle)
{
if (player->player_num < 1 || player->player_num > _num_players) {
return GGPO_ERRORCODE_PLAYER_OUT_OF_RANGE;
}
*handle = (GGPOPlayerHandle)(player->player_num - 1);
return GGPO_OK;
}
GGPOErrorCode
SyncTestBackend::AddLocalInput(GGPOPlayerHandle player, void *values, int size)
{
if (!_running) {
return GGPO_ERRORCODE_NOT_SYNCHRONIZED;
}
int index = (int)player;
for (int i = 0; i < size; i++) {
_current_input.bits[(index * size) + i] |= ((char *)values)[i];
}
return GGPO_OK;
}
GGPOErrorCode
SyncTestBackend::SyncInput(void *values,
int size,
int *disconnect_flags)
{
if (_rollingback) {
_last_input = _saved_frames.front().input;
} else {
if (_sync.GetFrameCount() == 0 && _sync.GetLastSavedFrame().buf == nullptr) {
_sync.SaveCurrentFrame();
}
_last_input = _current_input;
}
memcpy(values, _last_input.bits, size);
if (disconnect_flags) {
*disconnect_flags = 0;
}
return GGPO_OK;
}
GGPOErrorCode
SyncTestBackend::IncrementFrame(void)
{
_sync.IncrementFrame();
_current_input.erase();
DEBUG_LOG(NETWORK, "End of frame(%d)...", _sync.GetFrameCount());
if (_rollingback) {
return GGPO_OK;
}
int frame = _sync.GetFrameCount();
// Hold onto the current frame in our queue of saved states. We'll need
// the checksum later to verify that our replay of the same frame got the
// same results.
SavedInfo info;
info.frame = frame;
info.input = _last_input;
info.cbuf = _sync.GetLastSavedFrame().cbuf;
info.buf = (char *)malloc(info.cbuf);
memcpy(info.buf, _sync.GetLastSavedFrame().buf, info.cbuf);
info.checksum = _sync.GetLastSavedFrame().checksum;
_saved_frames.push(info);
if (frame - _last_verified == _check_distance) {
// We've gone far enough ahead and should now start replaying frames.
// Load the last verified frame and set the rollback flag to true.
_sync.LoadFrame(_last_verified);
_rollingback = true;
while(!_saved_frames.empty()) {
_callbacks.advance_frame(0);
// Verify that the checksumn of this frame is the same as the one in our
// list.
info = _saved_frames.front();
_saved_frames.pop();
if (info.frame != _sync.GetFrameCount()) {
RaiseSyncError("Frame number %d does not match saved frame number %d", info.frame, frame);
}
int checksum = _sync.GetLastSavedFrame().checksum;
if (info.checksum != checksum) {
LogSaveStates(info);
RaiseSyncError("Checksum for frame %d does not match saved (%d != %d)", frame, checksum, info.checksum);
}
else
printf("Checksum %08d for frame %d matches.\n", checksum, info.frame);
free(info.buf);
}
_last_verified = frame;
_rollingback = false;
}
return GGPO_OK;
}
void
SyncTestBackend::RaiseSyncError(const char *fmt, ...)
{
char buf[1024];
va_list args;
va_start(args, fmt);
vsnprintf(buf, ARRAY_SIZE(buf), fmt, args);
va_end(args);
puts(buf);
#ifdef _WIN32
OutputDebugStringA(buf);
#endif
// DebugBreak();
}
void
SyncTestBackend::LogSaveStates(SavedInfo &info)
{
char filename[MAX_PATH];
snprintf(filename, ARRAY_SIZE(filename), "synclogs/state-%04d-original.log", _sync.GetFrameCount());
_callbacks.log_game_state(filename, (unsigned char *)info.buf, info.cbuf);
snprintf(filename, ARRAY_SIZE(filename), "synclogs/state-%04d-replay.log", _sync.GetFrameCount());
_callbacks.log_game_state(filename, _sync.GetLastSavedFrame().buf, _sync.GetLastSavedFrame().cbuf);
}
@@ -0,0 +1,57 @@
/* -----------------------------------------------------------------------
* GGPO.net (http://ggpo.net) - Copyright 2009 GroundStorm Studios, LLC.
*
* Use of this software is governed by the MIT license that can be found
* in the LICENSE file.
*/
#ifndef _SYNCTEST_H
#define _SYNCTEST_H
#include "ggpo_types.h"
#include "backend.h"
#include "sync.h"
#include "ring_buffer.h"
class SyncTestBackend : public IQuarkBackend {
public:
SyncTestBackend(GGPOSessionCallbacks *cb, const char *gamename, int frames, int num_players);
virtual ~SyncTestBackend();
virtual GGPOErrorCode DoPoll(int timeout);
virtual GGPOErrorCode AddPlayer(GGPOPlayer *player, GGPOPlayerHandle *handle);
virtual GGPOErrorCode AddLocalInput(GGPOPlayerHandle player, void *values, int size);
virtual GGPOErrorCode SyncInput(void *values, int size, int *disconnect_flags);
virtual GGPOErrorCode IncrementFrame(void);
protected:
struct SavedInfo {
int frame;
int checksum;
char *buf;
int cbuf;
GameInput input;
};
void RaiseSyncError(const char *fmt, ...);
void LogSaveStates(SavedInfo &info);
protected:
GGPOSessionCallbacks _callbacks;
Sync _sync;
int _num_players;
int _check_distance;
int _last_verified;
bool _rollingback;
bool _running;
FILE *_logfp;
char _game[128];
GameInput _current_input;
GameInput _last_input;
RingBuffer<SavedInfo, 32> _saved_frames;
};
#endif
+55
View File
@@ -0,0 +1,55 @@
/* -----------------------------------------------------------------------
* GGPO.net (http://ggpo.net) - Copyright 2009 GroundStorm Studios, LLC.
*
* Use of this software is governed by the MIT license that can be found
* in the LICENSE file.
*/
#include "ggpo_types.h"
#include "bitvector.h"
void
BitVector_SetBit(uint8 *vector, int *offset)
{
vector[(*offset) / 8] |= (1 << ((*offset) % 8));
*offset += 1;
}
void
BitVector_ClearBit(uint8 *vector, int *offset)
{
vector[(*offset) / 8] &= ~(1 << ((*offset) % 8));
*offset += 1;
}
void
BitVector_WriteNibblet(uint8 *vector, int nibble, int *offset)
{
ASSERT(nibble < (1 << BITVECTOR_NIBBLE_SIZE));
for (int i = 0; i < BITVECTOR_NIBBLE_SIZE; i++) {
if (nibble & (1 << i)) {
BitVector_SetBit(vector, offset);
} else {
BitVector_ClearBit(vector, offset);
}
}
}
int
BitVector_ReadBit(uint8 *vector, int *offset)
{
int retval = !!(vector[(*offset) / 8] & (1 << ((*offset) % 8)));
*offset += 1;
return retval;
}
int
BitVector_ReadNibblet(uint8 *vector, int *offset)
{
int nibblet = 0;
for (int i = 0; i < BITVECTOR_NIBBLE_SIZE; i++) {
nibblet |= (BitVector_ReadBit(vector, offset) << i);
}
return nibblet;
}
+19
View File
@@ -0,0 +1,19 @@
/* -----------------------------------------------------------------------
* GGPO.net (http://ggpo.net) - Copyright 2009 GroundStorm Studios, LLC.
*
* Use of this software is governed by the MIT license that can be found
* in the LICENSE file.
*/
#ifndef _BITVECTOR_H
#define _BITVECTOR_H
#define BITVECTOR_NIBBLE_SIZE 8
void BitVector_SetBit(uint8 *vector, int *offset);
void BitVector_ClearBit(uint8 *vector, int *offset);
void BitVector_WriteNibblet(uint8 *vector, int nibble, int *offset);
int BitVector_ReadBit(uint8 *vector, int *offset);
int BitVector_ReadNibblet(uint8 *vector, int *offset);
#endif // _BITVECTOR_H
+86
View File
@@ -0,0 +1,86 @@
/* -----------------------------------------------------------------------
* GGPO.net (http://ggpo.net) - Copyright 2009 GroundStorm Studios, LLC.
*
* Use of this software is governed by the MIT license that can be found
* in the LICENSE file.
*/
#include "game_input.h"
#include "ggpo_types.h"
void
GameInput::init(int iframe, char *ibits, int isize, int offset)
{
ASSERT(isize);
ASSERT(isize <= GAMEINPUT_MAX_BYTES);
frame = iframe;
size = isize;
memset(bits, 0, sizeof(bits));
if (ibits) {
memcpy(bits + (offset * isize), ibits, isize);
}
}
void
GameInput::init(int iframe, char *ibits, int isize)
{
ASSERT(isize);
ASSERT(isize <= GAMEINPUT_MAX_BYTES * GAMEINPUT_MAX_PLAYERS);
frame = iframe;
size = isize;
memset(bits, 0, sizeof(bits));
if (ibits) {
memcpy(bits, ibits, isize);
}
}
void
GameInput::desc(char *buf, size_t buf_size, bool show_frame) const
{
ASSERT(size);
size_t remaining = buf_size;
if (show_frame) {
remaining -= snprintf(buf, buf_size, "(frame:%d size:%d ", frame, size);
} else {
remaining -= snprintf(buf, buf_size, "(size:%d ", size);
}
for (int i = 0; i < size * 8; i++) {
char buf2[16];
if (value(i)) {
int c = snprintf(buf2, ARRAY_SIZE(buf2), "%2d ", i);
strncat(buf, buf2, ARRAY_SIZE(buf2));
remaining -= c;
}
}
strcat(buf, ")");
}
void
GameInput::log(char *prefix, bool show_frame) const
{
char buf[1024];
size_t c = strlen(prefix);
strcpy(buf, prefix);
desc(buf + c, ARRAY_SIZE(buf) - c, show_frame);
Log("%s", buf);
}
bool
GameInput::equal(GameInput &other, bool bitsonly)
{
if (!bitsonly && frame != other.frame) {
Log("frames don't match: %d, %d", frame, other.frame);
}
if (size != other.size) {
Log("sizes don't match: %d, %d", size, other.size);
}
bool match = memcmp(bits, other.bits, size) == 0;
if (!match)
Log("bits don't match");
ASSERT(size && other.size);
return (bitsonly || frame == other.frame) &&
size == other.size && match;
}
+40
View File
@@ -0,0 +1,40 @@
/* -----------------------------------------------------------------------
* GGPO.net (http://ggpo.net) - Copyright 2009 GroundStorm Studios, LLC.
*
* Use of this software is governed by the MIT license that can be found
* in the LICENSE file.
*/
#ifndef _GAMEINPUT_H
#define _GAMEINPUT_H
#include <stdio.h>
#include <memory.h>
// GAMEINPUT_MAX_BYTES * GAMEINPUT_MAX_PLAYERS * 8 must be less than
// 2^BITVECTOR_NIBBLE_SIZE (see bitvector.h)
#define GAMEINPUT_MAX_BYTES 9
#define GAMEINPUT_MAX_PLAYERS 2
struct GameInput {
enum Constants {
NullFrame = -1
};
int frame;
int size; /* size in bytes of the entire input for all players */
char bits[GAMEINPUT_MAX_BYTES * GAMEINPUT_MAX_PLAYERS];
bool is_null() { return frame == NullFrame; }
void init(int frame, char *bits, int size, int offset);
void init(int frame, char *bits, int size);
bool value(int i) const { return (bits[i/8] & (1 << (i%8))) != 0; }
void set(int i) { bits[i/8] |= (1 << (i%8)); }
void clear(int i) { bits[i/8] &= ~(1 << (i%8)); }
void erase() { memset(bits, 0, sizeof(bits)); }
void desc(char *buf, size_t buf_size, bool show_frame = true) const;
void log(char *prefix, bool show_frame = true) const;
bool equal(GameInput &input, bool bitsonly = false);
};
#endif
+66
View File
@@ -0,0 +1,66 @@
/* -----------------------------------------------------------------------
* GGPO.net (http://ggpo.net) - Copyright 2009 GroundStorm Studios, LLC.
*
* Use of this software is governed by the MIT license that can be found
* in the LICENSE file.
*/
#ifndef _POLL_H
#define _POLL_H
#include "static_buffer.h"
#define MAX_POLLABLE_HANDLES 64
class IPollSink {
public:
virtual ~IPollSink() { }
virtual bool OnHandlePoll(void *) { return true; }
virtual bool OnMsgPoll(void *) { return true; }
virtual bool OnPeriodicPoll(void *, int ) { return true; }
virtual bool OnLoopPoll(void *) { return true; }
};
class Poll {
public:
Poll(void);
// void RegisterHandle(IPollSink *sink, HANDLE h, void *cookie = NULL);
void RegisterMsgLoop(IPollSink *sink, void *cookie = NULL);
void RegisterPeriodic(IPollSink *sink, int interval, void *cookie = NULL);
void RegisterLoop(IPollSink *sink, void *cookie = NULL);
void Run();
bool Pump(int timeout);
protected:
int ComputeWaitTime(int elapsed);
struct PollSinkCb {
IPollSink *sink;
void *cookie;
PollSinkCb() : sink(NULL), cookie(NULL) { }
PollSinkCb(IPollSink *s, void *c) : sink(s), cookie(c) { }
};
struct PollPeriodicSinkCb : public PollSinkCb {
int interval;
int last_fired;
PollPeriodicSinkCb() : PollSinkCb(NULL, NULL), interval(0), last_fired(0) { }
PollPeriodicSinkCb(IPollSink *s, void *c, int i) :
PollSinkCb(s, c), interval(i), last_fired(0) { }
};
int _start_time;
int _handle_count;
#ifdef _WIN32
HANDLE _handles[MAX_POLLABLE_HANDLES];
#endif
PollSinkCb _handle_sinks[MAX_POLLABLE_HANDLES];
StaticBuffer<PollSinkCb, 16> _msg_sinks;
StaticBuffer<PollSinkCb, 16> _loop_sinks;
StaticBuffer<PollPeriodicSinkCb, 16> _periodic_sinks;
};
#endif
+96
View File
@@ -0,0 +1,96 @@
/* -----------------------------------------------------------------------
* GGPO.net (http://ggpo.net) - Copyright 2009 GroundStorm Studios, LLC.
*
* Use of this software is governed by the MIT license that can be found
* in the LICENSE file.
*/
#ifndef _TYPES_H
#define _TYPES_H
/*
* Keep the compiler happy
*/
#ifdef _MSC_VER
/*
* Disable specific compiler warnings
* 4018 - '<' : signed/unsigned mismatch
* 4100 - 'xxx' : unreferenced formal parameter
* 4127 - conditional expression is constant
* 4201 - nonstandard extension used : nameless struct/union
* 4389 - '!=' : signed/unsigned mismatch
* 4800 - 'int' : forcing value to bool 'true' or 'false' (performance warning)
*/
#pragma warning(disable: 4018 4100 4127 4201 4389 4800)
#endif
#if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP)
#define TARGET_UWP
#endif
/*
* Simple types
*/
typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned char byte;
typedef char int8;
typedef short int16;
typedef int int32;
#include "ggponet.h"
#include "log/Log.h"
#include <stdexcept>
class GGPOException : public std::runtime_error {
public:
GGPOException(const char *what, GGPOErrorCode ggpoError)
: std::runtime_error(what), ggpoError(ggpoError) {}
GGPOErrorCode ggpoError;
};
/*
* Additional headers
*/
#if defined(_WIN32)
# include "platform_windows.h"
#elif defined(__unix__) || defined(__APPLE__) || defined(__SWITCH__) || defined(__HAIKU__)
# include "platform_linux.h"
#else
# error Unsupported platform
#endif
/*
* Macros
*/
#define ASSERT(x) \
do { \
if (!(x)) { \
char assert_buf[1024]; \
snprintf(assert_buf, sizeof(assert_buf) - 1, "Assertion: %s @ %s:%d", #x, __FILE__, __LINE__); \
GGPOPlatform::AssertFailed(assert_buf); \
throw GGPOException(assert_buf, GGPO_ERRORCODE_GENERAL_FAILURE); \
} \
} while (false)
#define Log(...) DEBUG_LOG(NETWORK, __VA_ARGS__)
#ifndef ARRAY_SIZE
# define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#endif
#ifndef MAX_INT
# define MAX_INT 0xEFFFFFF
#endif
#ifndef MAX
# define MAX(x, y) (((x) > (y)) ? (x) : (y))
#endif
#ifndef MIN
# define MIN(x, y) (((x) < (y)) ? (x) : (y))
#endif
#endif // _TYPES_H
+305
View File
@@ -0,0 +1,305 @@
/* -----------------------------------------------------------------------
* GGPO.net (http://ggpo.net) - Copyright 2009 GroundStorm Studios, LLC.
*
* Use of this software is governed by the MIT license that can be found
* in the LICENSE file.
*/
#include "input_queue.h"
#include "ggpo_types.h"
#define PREVIOUS_FRAME(offset) (((offset) == 0) ? (INPUT_QUEUE_LENGTH - 1) : ((offset) - 1))
InputQueue::InputQueue(int input_size)
{
Init(-1, input_size);
}
InputQueue::~InputQueue()
{
}
void
InputQueue::Init(int id, int input_size)
{
_id = id;
_head = 0;
_tail = 0;
_length = 0;
_frame_delay = 0;
_first_frame = true;
_last_user_added_frame = GameInput::NullFrame;
_first_incorrect_frame = GameInput::NullFrame;
_last_frame_requested = GameInput::NullFrame;
_last_added_frame = GameInput::NullFrame;
_prediction.init(GameInput::NullFrame, NULL, input_size);
/*
* This is safe because we know the GameInput is a proper structure (as in,
* no virtual methods, no contained classes, etc.).
*/
memset(_inputs, 0, sizeof _inputs);
for (size_t i = 0; i < ARRAY_SIZE(_inputs); i++) {
_inputs[i].size = input_size;
}
}
int
InputQueue::GetLastConfirmedFrame()
{
Log("input q%d | returning last confirmed frame %d.", _id, _last_added_frame);
return _last_added_frame;
}
int
InputQueue::GetFirstIncorrectFrame()
{
return _first_incorrect_frame;
}
void
InputQueue::DiscardConfirmedFrames(int frame)
{
ASSERT(frame >= 0);
if (_last_frame_requested != GameInput::NullFrame) {
frame = MIN(frame, _last_frame_requested);
}
Log("input q%d | discarding confirmed frames up to %d (last_added:%d length:%d [head:%d tail:%d]).", _id,
frame, _last_added_frame, _length, _head, _tail);
if (frame >= _last_added_frame) {
_tail = _head;
} else {
int offset = frame - _inputs[_tail].frame + 1;
Log("input q%d | difference of %d frames.", _id, offset);
ASSERT(offset >= 0);
_tail = (_tail + offset) % INPUT_QUEUE_LENGTH;
_length -= offset;
}
Log("input q%d | after discarding, new tail is %d (frame:%d).", _id, _tail, _inputs[_tail].frame);
ASSERT(_length >= 0);
}
void
InputQueue::ResetPrediction(int frame)
{
ASSERT(_first_incorrect_frame == GameInput::NullFrame || frame <= _first_incorrect_frame);
Log("input q%d | resetting all prediction errors back to frame %d.", _id, frame);
/*
* There's nothing really to do other than reset our prediction
* state and the incorrect frame counter...
*/
_prediction.frame = GameInput::NullFrame;
_first_incorrect_frame = GameInput::NullFrame;
_last_frame_requested = GameInput::NullFrame;
}
bool
InputQueue::GetConfirmedInput(int requested_frame, GameInput *input)
{
ASSERT(_first_incorrect_frame == GameInput::NullFrame || requested_frame < _first_incorrect_frame);
int offset = requested_frame % INPUT_QUEUE_LENGTH;
if (_inputs[offset].frame != requested_frame) {
return false;
}
*input = _inputs[offset];
return true;
}
bool
InputQueue::GetInput(int requested_frame, GameInput *input)
{
Log("input q%d | requesting input frame %d.", _id, requested_frame);
/*
* No one should ever try to grab any input when we have a prediction
* error. Doing so means that we're just going further down the wrong
* path. ASSERT this to verify that it's true.
*/
ASSERT(_first_incorrect_frame == GameInput::NullFrame);
/*
* Remember the last requested frame number for later. We'll need
* this in AddInput() to drop out of prediction mode.
*/
_last_frame_requested = requested_frame;
ASSERT(requested_frame >= _inputs[_tail].frame);
if (_prediction.frame == GameInput::NullFrame) {
/*
* If the frame requested is in our range, fetch it out of the queue and
* return it.
*/
int offset = requested_frame - _inputs[_tail].frame;
if (offset < _length) {
offset = (offset + _tail) % INPUT_QUEUE_LENGTH;
ASSERT(_inputs[offset].frame == requested_frame);
*input = _inputs[offset];
Log("input q%d | returning confirmed frame number %d.", _id, input->frame);
return true;
}
/*
* The requested frame isn't in the queue. Bummer. This means we need
* to return a prediction frame. Predict that the user will do the
* same thing they did last time.
*/
if (requested_frame == 0) {
Log("input q%d | basing new prediction frame from nothing, you're client wants frame 0.", _id);
_prediction.erase();
} else if (_last_added_frame == GameInput::NullFrame) {
Log("input q%d | basing new prediction frame from nothing, since we have no frames yet.", _id);
_prediction.erase();
} else {
Log("input q%d | basing new prediction frame from previously added frame (queue entry:%d, frame:%d).", _id,
PREVIOUS_FRAME(_head), _inputs[PREVIOUS_FRAME(_head)].frame);
_prediction = _inputs[PREVIOUS_FRAME(_head)];
}
_prediction.frame++;
}
ASSERT(_prediction.frame >= 0);
/*
* If we've made it this far, we must be predicting. Go ahead and
* forward the prediction frame contents. Be sure to return the
* frame number requested by the client, though.
*/
*input = _prediction;
input->frame = requested_frame;
Log("input q%d | returning prediction frame number %d (%d).", _id, input->frame, _prediction.frame);
return false;
}
void
InputQueue::AddInput(GameInput &input)
{
int new_frame;
Log("input q%d | adding input frame number %d to queue.", _id, input.frame);
/*
* These next two lines simply verify that inputs are passed in
* sequentially by the user, regardless of frame delay.
*/
ASSERT(_last_user_added_frame == GameInput::NullFrame ||
input.frame == _last_user_added_frame + 1);
_last_user_added_frame = input.frame;
/*
* Move the queue head to the correct point in preparation to
* input the frame into the queue.
*/
new_frame = AdvanceQueueHead(input.frame);
if (new_frame != GameInput::NullFrame) {
AddDelayedInputToQueue(input, new_frame);
}
/*
* Update the frame number for the input. This will also set the
* frame to GameInput::NullFrame for frames that get dropped (by
* design).
*/
input.frame = new_frame;
}
void
InputQueue::AddDelayedInputToQueue(GameInput &input, int frame_number)
{
Log("input q%d | adding delayed input frame number %d to queue.", _id, frame_number);
if (input.size != _prediction.size)
throw GGPOException("Input size differs from peer", GGPO_ERRORCODE_INPUT_SIZE_DIFF);
ASSERT(_last_added_frame == GameInput::NullFrame || frame_number == _last_added_frame + 1);
ASSERT(frame_number == 0 || _inputs[PREVIOUS_FRAME(_head)].frame == frame_number - 1);
/*
* Add the frame to the back of the queue
*/
_inputs[_head] = input;
_inputs[_head].frame = frame_number;
_head = (_head + 1) % INPUT_QUEUE_LENGTH;
_length++;
_first_frame = false;
_last_added_frame = frame_number;
if (_prediction.frame != GameInput::NullFrame) {
ASSERT(frame_number == _prediction.frame);
/*
* We've been predicting... See if the inputs we've gotten match
* what we've been predicting. If so, don't worry about it. If not,
* remember the first input which was incorrect so we can report it
* in GetFirstIncorrectFrame()
*/
if (_first_incorrect_frame == GameInput::NullFrame && !_prediction.equal(input, true)) {
Log("input q%d | frame %d does not match prediction. marking error.", _id, frame_number);
_first_incorrect_frame = frame_number;
}
/*
* If this input is the same frame as the last one requested and we
* still haven't found any mis-predicted inputs, we can dump out
* of predition mode entirely! Otherwise, advance the prediction frame
* count up.
*/
if (_prediction.frame == _last_frame_requested && _first_incorrect_frame == GameInput::NullFrame) {
Log("input q%d | prediction is correct! dumping out of prediction mode.", _id);
_prediction.frame = GameInput::NullFrame;
} else {
_prediction.frame++;
}
}
ASSERT(_length <= INPUT_QUEUE_LENGTH);
}
int
InputQueue::AdvanceQueueHead(int frame)
{
Log("input q%d | advancing queue head to frame %d.", _id, frame);
int expected_frame = _first_frame ? 0 : _inputs[PREVIOUS_FRAME(_head)].frame + 1;
frame += _frame_delay;
if (expected_frame > frame) {
/*
* This can occur when the frame delay has dropped since the last
* time we shoved a frame into the system. In this case, there's
* no room on the queue. Toss it.
*/
Log("input q%d | Dropping input frame %d (expected next frame to be %d).", _id,
frame, expected_frame);
return GameInput::NullFrame;
}
while (expected_frame < frame) {
/*
* This can occur when the frame delay has been increased since the last
* time we shoved a frame into the system. We need to replicate the
* last frame in the queue several times in order to fill the space
* left.
*/
Log("input q%d | Adding padding frame %d to account for change in frame delay.", _id,
expected_frame);
GameInput &last_frame = _inputs[PREVIOUS_FRAME(_head)];
AddDelayedInputToQueue(last_frame, expected_frame);
expected_frame++;
}
ASSERT(frame == 0 || frame == _inputs[PREVIOUS_FRAME(_head)].frame + 1);
return frame;
}
+59
View File
@@ -0,0 +1,59 @@
/* -----------------------------------------------------------------------
* GGPO.net (http://ggpo.net) - Copyright 2009 GroundStorm Studios, LLC.
*
* Use of this software is governed by the MIT license that can be found
* in the LICENSE file.
*/
#ifndef _INPUT_QUEUE_H
#define _INPUT_QUEUE_H
#include "game_input.h"
#define INPUT_QUEUE_LENGTH 128
#define DEFAULT_INPUT_SIZE 4
class InputQueue {
public:
InputQueue(int input_size = DEFAULT_INPUT_SIZE);
~InputQueue();
public:
void Init(int id, int input_size);
int GetLastConfirmedFrame();
int GetFirstIncorrectFrame();
int GetLength() { return _length; }
void SetFrameDelay(int delay) { _frame_delay = delay; }
void ResetPrediction(int frame);
void DiscardConfirmedFrames(int frame);
bool GetConfirmedInput(int frame, GameInput *input);
bool GetInput(int frame, GameInput *input);
void AddInput(GameInput &input);
protected:
int AdvanceQueueHead(int frame);
void AddDelayedInputToQueue(GameInput &input, int i);
protected:
int _id;
int _head;
int _tail;
int _length;
bool _first_frame;
int _last_user_added_frame;
int _last_added_frame;
int _first_incorrect_frame;
int _last_frame_requested;
int _frame_delay;
GameInput _inputs[INPUT_QUEUE_LENGTH];
GameInput _prediction;
};
#endif
+260
View File
@@ -0,0 +1,260 @@
/* -----------------------------------------------------------------------
* GGPO.net (http://ggpo.net) - Copyright 2009 GroundStorm Studios, LLC.
*
* Use of this software is governed by the MIT license that can be found
* in the LICENSE file.
*/
#include "backends/p2p.h"
#include "backends/synctest.h"
#include "backends/spectator.h"
#include "ggpo_types.h"
#include "ggponet.h"
struct Init
{
Init() {
srand(GGPOPlatform::GetCurrentTimeMS() + GGPOPlatform::GetProcessID());
#ifdef _WIN32
WSADATA wsaData;
WSAStartup(MAKEWORD(2, 0), &wsaData);
#endif
}
};
static Init init;
GGPOErrorCode
ggpo_start_session(GGPOSession **session,
GGPOSessionCallbacks *cb,
const char *game,
int num_players,
int input_size,
unsigned short localport,
const void *verification,
int verification_size)
{
try {
*session= (GGPOSession *)new Peer2PeerBackend(cb,
game,
localport,
num_players,
input_size,
verification,
verification_size);
return GGPO_OK;
} catch (const GGPOException& e) {
ERROR_LOG(NETWORK, "GGPOException in ggpo_start_session: %s", e.what());
return e.ggpoError;
}
}
GGPOErrorCode
ggpo_add_player(GGPOSession *ggpo,
GGPOPlayer *player,
GGPOPlayerHandle *handle)
{
if (!ggpo)
return GGPO_ERRORCODE_INVALID_SESSION;
try {
return ggpo->AddPlayer(player, handle);
} catch (const GGPOException& e) {
ERROR_LOG(NETWORK, "GGPOException in ggpo_add_player: %s", e.what());
return e.ggpoError;
}
}
GGPOErrorCode
ggpo_start_synctest(GGPOSession **ggpo,
GGPOSessionCallbacks *cb,
const char *game,
int num_players,
int input_size,
int frames)
{
try {
*ggpo = (GGPOSession *)new SyncTestBackend(cb, game, frames, num_players);
return GGPO_OK;
} catch (const GGPOException& e) {
ERROR_LOG(NETWORK, "GGPOException in ggpo_start_synctest: %s", e.what());
return e.ggpoError;
}
}
GGPOErrorCode
ggpo_set_frame_delay(GGPOSession *ggpo,
GGPOPlayerHandle player,
int frame_delay)
{
if (!ggpo)
return GGPO_ERRORCODE_INVALID_SESSION;
try {
return ggpo->SetFrameDelay(player, frame_delay);
} catch (const GGPOException& e) {
ERROR_LOG(NETWORK, "GGPOException in ggpo_set_frame_delay: %s", e.what());
return e.ggpoError;
}
}
GGPOErrorCode
ggpo_idle(GGPOSession *ggpo, int timeout)
{
if (!ggpo)
return GGPO_ERRORCODE_INVALID_SESSION;
try {
return ggpo->DoPoll(timeout);
} catch (const GGPOException& e) {
ERROR_LOG(NETWORK, "GGPOException in ggpo_idle: %s", e.what());
return e.ggpoError;
}
}
GGPOErrorCode
ggpo_add_local_input(GGPOSession *ggpo,
GGPOPlayerHandle player,
void *values,
int size)
{
if (!ggpo)
return GGPO_ERRORCODE_INVALID_SESSION;
try {
return ggpo->AddLocalInput(player, values, size);
} catch (const GGPOException& e) {
ERROR_LOG(NETWORK, "GGPOException in ggpo_add_local_input: %s", e.what());
return e.ggpoError;
}
}
GGPOErrorCode
ggpo_synchronize_input(GGPOSession *ggpo,
void *values,
int size,
int *disconnect_flags)
{
if (!ggpo)
return GGPO_ERRORCODE_INVALID_SESSION;
try {
return ggpo->SyncInput(values, size, disconnect_flags);
} catch (const GGPOException& e) {
ERROR_LOG(NETWORK, "GGPOException in ggpo_synchronize_input: %s", e.what());
return e.ggpoError;
}
}
GGPOErrorCode ggpo_disconnect_player(GGPOSession *ggpo,
GGPOPlayerHandle player)
{
if (!ggpo)
return GGPO_ERRORCODE_INVALID_SESSION;
try {
return ggpo->DisconnectPlayer(player);
} catch (const GGPOException& e) {
ERROR_LOG(NETWORK, "GGPOException in ggpo_disconnect_player: %s", e.what());
return e.ggpoError;
}
}
GGPOErrorCode
ggpo_advance_frame(GGPOSession *ggpo)
{
if (!ggpo)
return GGPO_ERRORCODE_INVALID_SESSION;
try {
return ggpo->IncrementFrame();
} catch (const GGPOException& e) {
ERROR_LOG(NETWORK, "GGPOException in ggpo_advance_frame: %s", e.what());
return e.ggpoError;
}
}
GGPOErrorCode
ggpo_get_network_stats(GGPOSession *ggpo,
GGPOPlayerHandle player,
GGPONetworkStats *stats)
{
if (!ggpo)
return GGPO_ERRORCODE_INVALID_SESSION;
try {
return ggpo->GetNetworkStats(stats, player);
} catch (const GGPOException& e) {
ERROR_LOG(NETWORK, "GGPOException in ggpo_get_network_stats: %s", e.what());
return e.ggpoError;
}
}
GGPOErrorCode
ggpo_close_session(GGPOSession *ggpo)
{
if (!ggpo) {
return GGPO_ERRORCODE_INVALID_SESSION;
}
delete ggpo;
return GGPO_OK;
}
GGPOErrorCode
ggpo_set_disconnect_timeout(GGPOSession *ggpo, int timeout)
{
if (!ggpo)
return GGPO_ERRORCODE_INVALID_SESSION;
try {
return ggpo->SetDisconnectTimeout(timeout);
} catch (const GGPOException& e) {
ERROR_LOG(NETWORK, "GGPOException in ggpo_set_disconnect_timeout: %s", e.what());
return e.ggpoError;
}
}
GGPOErrorCode
ggpo_set_disconnect_notify_start(GGPOSession *ggpo, int timeout)
{
if (!ggpo)
return GGPO_ERRORCODE_INVALID_SESSION;
try {
return ggpo->SetDisconnectNotifyStart(timeout);
} catch (const GGPOException& e) {
ERROR_LOG(NETWORK, "GGPOException in ggpo_set_disconnect_notify_start: %s", e.what());
return e.ggpoError;
}
}
GGPOErrorCode ggpo_start_spectating(GGPOSession **session,
GGPOSessionCallbacks *cb,
const char *game,
int num_players,
int input_size,
unsigned short local_port,
char *host_ip,
unsigned short host_port,
const void *verification,
int verification_size)
{
try {
*session= (GGPOSession *)new SpectatorBackend(cb,
game,
local_port,
num_players,
input_size,
host_ip,
host_port,
verification,
verification_size);
return GGPO_OK;
} catch (const GGPOException& e) {
ERROR_LOG(NETWORK, "GGPOException in ggpo_start_spectating: %s", e.what());
return e.ggpoError;
}
}
GGPOErrorCode ggpo_send_message(GGPOSession *ggpo,
const void *msg,
int len,
bool spectators)
{
if (ggpo == nullptr)
return GGPO_ERRORCODE_INVALID_SESSION;
return ggpo->SendMessage(msg, len, spectators);
}
+113
View File
@@ -0,0 +1,113 @@
/* -----------------------------------------------------------------------
* GGPO.net (http://ggpo.net) - Copyright 2009 GroundStorm Studios, LLC.
*
* Use of this software is governed by the MIT license that can be found
* in the LICENSE file.
*/
#include "ggpo_types.h"
#include "udp.h"
SOCKET
CreateSocket(uint16 bind_port, int retries)
{
SOCKET s;
sockaddr_in sin;
uint16 port;
int optval = 1;
s = socket(AF_INET, SOCK_DGRAM, 0);
setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (const char *)&optval, sizeof optval);
optval = 0;
setsockopt(s, SOL_SOCKET, SO_LINGER, (const char *)&optval, sizeof optval);
// non-blocking...
#ifndef _WIN32
fcntl(s, F_SETFL, O_NONBLOCK);
#else
u_long iMode = 1;
ioctlsocket(s, FIONBIO, &iMode);
#endif
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = htonl(INADDR_ANY);
for (port = bind_port; port <= bind_port + retries; port++) {
sin.sin_port = htons(port);
if (bind(s, (sockaddr *)&sin, sizeof sin) == 0) {
Log("Udp bound to port: %d.", port);
return s;
}
}
closesocket(s);
return INVALID_SOCKET;
}
Udp::Udp() :
_socket(INVALID_SOCKET),
_callbacks(NULL)
{
}
Udp::~Udp(void)
{
if (_socket != INVALID_SOCKET) {
closesocket(_socket);
_socket = INVALID_SOCKET;
}
}
void
Udp::Init(uint16 port, Poll *poll, Callbacks *callbacks)
{
_callbacks = callbacks;
poll->RegisterLoop(this);
Log("binding udp socket to port %d.", port);
_socket = CreateSocket(port, 0);
if (_socket == INVALID_SOCKET)
throw GGPOException("Socket creation or bind failed", GGPO_ERRORCODE_NETWORK_ERROR);
}
void
Udp::SendTo(char *buffer, int len, int flags, struct sockaddr *dst, int destlen)
{
struct sockaddr_in *to = (struct sockaddr_in *)dst;
int res = sendto(_socket, buffer, len, flags, dst, destlen);
if (res == SOCKET_ERROR) {
int err = WSAGetLastError();
Log("unknown error in sendto (erro: %d wsaerr: %d).", res, err);
ASSERT(false && "Unknown error in sendto");
}
char dst_ip[1024];
Log("sent packet length %d to %s:%d (ret:%d).", len, inet_ntop(AF_INET, (void *)&to->sin_addr, dst_ip, ARRAY_SIZE(dst_ip)), ntohs(to->sin_port), res);
}
bool
Udp::OnLoopPoll(void *cookie)
{
uint8 recv_buf[MAX_UDP_PACKET_SIZE];
sockaddr_in recv_addr;
socklen_t recv_addr_len;
for (;;) {
recv_addr_len = sizeof(recv_addr);
int len = recvfrom(_socket, (char *)recv_buf, MAX_UDP_PACKET_SIZE, 0, (struct sockaddr *)&recv_addr, &recv_addr_len);
// TODO: handle len == 0... indicates a disconnect.
if (len == -1) {
int error = WSAGetLastError();
if (error != WSAEWOULDBLOCK) {
Log("recvfrom WSAGetLastError returned %d (%x).", error, error);
}
break;
} else if (len > 0) {
char src_ip[1024];
Log("recvfrom returned (len:%d from:%s:%d).", len, inet_ntop(AF_INET, (void*)&recv_addr.sin_addr, src_ip, ARRAY_SIZE(src_ip)), ntohs(recv_addr.sin_port) );
UdpMsg *msg = (UdpMsg *)recv_buf;
_callbacks->OnMsg(recv_addr, msg, len);
}
}
return true;
}
+53
View File
@@ -0,0 +1,53 @@
/* -----------------------------------------------------------------------
* GGPO.net (http://ggpo.net) - Copyright 2009 GroundStorm Studios, LLC.
*
* Use of this software is governed by the MIT license that can be found
* in the LICENSE file.
*/
#ifndef _UDP_H
#define _UDP_H
#include "ggpo_poll.h"
#include "udp_msg.h"
#include "ggponet.h"
#include "ring_buffer.h"
#define MAX_UDP_ENDPOINTS 16
constexpr size_t MAX_UDP_PACKET_SIZE = sizeof(UdpMsg);
class Udp : public IPollSink
{
public:
struct Stats {
int bytes_sent;
int packets_sent;
float kbps_sent;
};
struct Callbacks {
virtual ~Callbacks() { }
virtual void OnMsg(sockaddr_in &from, UdpMsg *msg, int len) = 0;
};
Udp();
void Init(uint16 port, Poll *p, Callbacks *callbacks);
void SendTo(char *buffer, int len, int flags, struct sockaddr *dst, int destlen);
virtual bool OnLoopPoll(void *cookie);
public:
~Udp(void);
protected:
// Network transmission information
SOCKET _socket;
// state management
Callbacks *_callbacks;
};
#endif
+121
View File
@@ -0,0 +1,121 @@
/* -----------------------------------------------------------------------
* GGPO.net (http://ggpo.net) - Copyright 2009 GroundStorm Studios, LLC.
*
* Use of this software is governed by the MIT license that can be found
* in the LICENSE file.
*/
#ifndef _UDP_MSG_H
#define _UDP_MSG_H
#define MAX_COMPRESSED_BITS 4096
#define UDP_MSG_MAX_PLAYERS 4
#define MAX_VERIFICATION_SIZE 256
#define MAX_APPDATA_SIZE 512
#pragma pack(push, 1)
struct UdpMsg
{
enum MsgType {
Invalid = 0,
SyncRequest = 1,
SyncReply = 2,
Input = 3,
QualityReport = 4,
QualityReply = 5,
KeepAlive = 6,
InputAck = 7,
AppData = 8
};
struct connect_status {
unsigned int disconnected:1;
int last_frame:31;
};
struct {
uint16 magic;
uint16 sequence_number;
uint8 type; /* packet type */
} hdr;
union {
struct {
uint32 random_request; /* please reply back with this random data */
uint16 remote_magic;
uint8 remote_endpoint;
uint8 verification[MAX_VERIFICATION_SIZE];
} sync_request;
struct {
uint32 random_reply; /* OK, here's your random data back */
uint8 verification_failure; /* set to one by peer if verification failed */
} sync_reply;
struct {
int8 frame_advantage; /* what's the other guy's frame advantage? */
uint32 ping;
} quality_report;
struct {
uint32 pong;
} quality_reply;
struct {
connect_status peer_connect_status[UDP_MSG_MAX_PLAYERS];
uint32 start_frame;
int disconnect_requested:1;
int ack_frame:31;
uint16 num_bits;
uint8 input_size; // XXX: shouldn't be in every single packet!
uint8 bits[MAX_COMPRESSED_BITS / 8]; /* must be last */
} input;
struct {
int ack_frame:31;
} input_ack;
struct {
uint16 size;
uint8 spectators;
uint8 data[MAX_APPDATA_SIZE];
} app_data;
} u;
int verification_size = 0;
public:
int PacketSize() {
return sizeof(hdr) + PayloadSize();
}
int PayloadSize() {
switch (hdr.type) {
case SyncRequest: return (int)(&u.sync_request.verification[0] - (uint8 *)&u) + verification_size;
case SyncReply: return sizeof(u.sync_reply);
case QualityReport: return sizeof(u.quality_report);
case QualityReply: return sizeof(u.quality_reply);
case InputAck: return sizeof(u.input_ack);
case KeepAlive: return 0;
case Input:
{
int size = (int)((char *)&u.input.bits - (char *)&u.input);
size += (u.input.num_bits + 7) / 8;
return size;
}
case AppData: return sizeof(u.app_data) - sizeof(u.app_data.data) + u.app_data.size;
}
ASSERT(false);
return 0;
}
UdpMsg(MsgType t) { hdr.type = (uint8)t; }
};
#pragma pack(pop)
#endif
Loaded 100 of 5106 files, more files were not shown because too many files have changed in this diff. Show more