Commit Graph

30697 Commits

Author SHA1 Message Date
fb75ae410f Jit64: Clean up ExtractWithByteOffset
RCOpArg::ExtractWithByteOffset is only used in one place: a special case
of rlwinmx. ExtractWithByteOffset first stores the value of the
specified register into m_ppc_state (unless it's already there), and
then returns an offset into m_ppc_state. Our use of this function has
two undesirable properties (except in the trivial case `offset == 0`):

1. ExtractWithByteOffset calls StoreFromRegister without going through
   any of the usual functions. This violated an assumption I made when
   working on my constant propagation PR and led to a hard-to-find bug.
2. If the specified register is in a host register and is dirty,
   ExtractWithByteOffset will store its value to m_ppc_state even when
   it's unnecessary. In particular, this always happens when rlwinmx
   uses the same register as input and output, since rlwinmx always
   allocates a host register for the output and marks it as dirty.

Since ExtractWithByteOffset is only used in one place, I figure we might
as well inline it there. This commit does that, and also alters
rlwinmx's logic so the special case code is only triggered when the
input is already in m_ppc_state.

Input in `m_ppc_state`, before (11 bytes):

mov         esi, dword ptr [rbp-104]
mov         dword ptr [rbp-104], esi
movzx       esi, byte ptr [rbp-101]

Input in `m_ppc_state`, after (5 bytes):

movzx       esi, byte ptr [rbp-101]

Input in host register, before (8 bytes):

mov         dword ptr [rbp-104], esi
movzx       esi, byte ptr [rbp-101]

Input in host register, after (3 bytes):

shr         edi, 0x18
2024-03-30 22:47:44 +01:00
f30d3c9092 Merge pull request #12662 from JosJuice/jitarm64-imm-rc0-sxtw
JitArm64: Skip SXTW in ComputeRC0(u64)
2024-03-29 15:36:33 +01:00
5f6a054ffc Merge pull request #12661 from Sintendo/arm64divwux
JitArm64: Optimize divwux
2024-03-29 15:36:18 +01:00
6e6b298030 Core::RunOnCPUThread: Avoid Global System Accessor 2024-03-28 10:10:03 -07:00
aea1f64873 Merge pull request #12659 from mitaclaw/qt-debug-font
DolphinQt Settings: Signal Debug Font By Const Reference
2024-03-28 13:04:39 -04:00
aa9601a563 Merge pull request #12658 from mitaclaw/core-global-system-2b
Core: Remove RunAsCPUThread
2024-03-28 13:04:08 -04:00
06329ecfc7 Core: Fix IPL device m_cursor overflow
Not sure if the behavior I'm implementing here is what real hardware
does, but since this is a buffer overflow, I'd like to get it fixed
quickly. Hardware verification can happen later.

https://bugs.dolphin-emu.org/issues/13506
2024-03-25 18:31:36 +01:00
d57c68a625 Core: Get rid of IPL device macros
Having to look up macros that are defined elsewhere makes the code
harder to reason about. The macros don't remove enough repetition to
justify their existence in my opinion.
2024-03-25 17:55:13 +01:00
2580837c60 JitArm64: Optimize divwux
When the divisor is a constant value, we can emit more efficient code.
For powers of two, we can use bit shifts. For other values, we can
instead use a multiplication by magic constant method.

- Example 1 - Division by 16 (power of two)
Before:
mov    w24, #0x10                ; =16
udiv   w27, w25, w24

After:
lsr    w27, w25, #4

- Example 2 - Division by 10 (fast)
Before:
mov    w25, #0xa                 ; =10
udiv   w27, w26, w25

After:
mov    w27, #0xcccd              ; =52429
movk   w27, #0xcccc, lsl #16
umull  x27, w26, w27
lsr    x27, x27, #35

- Example 3 - Division by 127 (slow)
Before:
mov    w26, #0x7f                ; =127
udiv   w27, w27, w26

After:
mov    w26, #0x408               ; =1032
movk   w26, #0x8102, lsl #16
umaddl x27, w27, w26, x26
lsr    x27, x27, #38
2024-03-23 20:13:15 +01:00
749ee2ff5e Jit64: Refactor divwux
Now that we've moved the logic to DivUtils, refactor the Jit64 code to
use it.
2024-03-23 20:13:15 +01:00
825a10616c DivUtils: Add unsigned division magic function
Takes the logic from Jit64 and moves it into DivUtils, so it can be
reused by other backends as well.
2024-03-23 20:13:15 +01:00
9f0a7c9875 JitArm64: Skip SXTW in ComputeRC0(u64)
MOVI2R can set the upper bits to ones for free by using MOVN instead of
MOVZ.
2024-03-23 14:30:00 +01:00
73f9904f2a Core: Remove RunAsCPUThread
It's a fine function, but CPUThreadGuard is more vogue. Also, its potential for being confused with RunOnCPUThread will not be missed.
2024-03-23 03:33:26 -07:00
ae5da02cde DolphinQt Settings: Signal Debug Font By Const Reference 2024-03-22 07:52:52 -07:00
3948ac9513 Merge pull request #12606 from mitaclaw/state-global-system
State: Avoid Global System Accessor
2024-03-22 04:27:12 +01:00
f814dc58b5 Merge pull request #12620 from mitaclaw/jit-interface-cpu-thread-guard
JitInterface::ClearCache: Modernize With CPUThreadGuard
2024-03-22 04:17:33 +01:00
f8fdaf9b94 Merge pull request #12648 from mitaclaw/core-global-system
Core: Avoid (Some) Global System Accessor
2024-03-22 04:13:01 +01:00
4f3b4471f2 Merge pull request #12654 from jordan-woyak/gcadapter-timeout
GCAdapter: Adjust libusb transfer timeout to 100ms.
2024-03-22 02:55:30 +01:00
b510ac89a3 Merge pull request #12355 from fuzziqersoftware/tapserver-modem-adapter
Implement tapserver-based modem adapter
2024-03-22 02:47:06 +01:00
f535b61d5d Merge pull request #12652 from iwubcode/json_util_update
Common: add even more json utility functions
2024-03-22 02:45:58 +01:00
2d5286d2e2 Merge pull request #12642 from jordan-woyak/state-write-osd-errors
Core/State: Display messages on state write failures.
2024-03-21 03:55:05 +01:00
03f2b99ffe Merge pull request #12603 from Sam-Belliveau/oklab_resampling
Add HDR to Metal + Perceptual HDR
2024-03-20 22:45:10 -04:00
b19cf1f962 Merge pull request #12650 from jordan-woyak/balloon-tip-multimon
DolphinQt: Fix BalloonTip positioning on secondary monitors.
2024-03-21 03:33:43 +01:00
7f1e7314de Merge pull request #12649 from mitaclaw/kill-is-running-in-current-thread
Core: Remove Unused IsRunningInCurrentThread Function
2024-03-21 03:32:48 +01:00
f922129255 Core/State: Display messages on state write failures. 2024-03-20 20:38:04 -05:00
76a74daac2 Merge pull request #12641 from jordan-woyak/d3d-before-ogl
VideoCommon: Prefer D3D11/12 over OpenGL on Windows.
2024-03-20 18:21:48 -05:00
719d76ab2e GCAdapter: Adjust libusb transfer timeout to 100ms. 2024-03-20 18:02:06 -05:00
146504d635 Common: add json utility functions 'ReadStringFromJson' and 'ReadBoolFromJson' to match 'ReadNumericFromJson' functionality for other data types, similarly support other data types for 'ToJsonArray' 2024-03-20 17:34:25 -05:00
69694494ce Common: update 'ReadNumericOrDefault' to 'ReadNumericFromJson' and have it return an optional, this provides the caller with more flexibility 2024-03-20 17:34:25 -05:00
647eba36f3 DolphinQt: Fix BalloonTip positioning on secondary monitors. 2024-03-20 03:13:11 -05:00
11b628f250 Core: Remove Unused IsRunningInCurrentThread Function 2024-03-18 07:18:41 -07:00
f09b71582e Core: Avoid (Some) Global System Accessor 2024-03-18 01:35:42 -07:00
f7a0147176 prevent backpressure when m_read_enabled is not set 2024-03-17 18:37:55 -07:00
3e9ac1aaf3 fix tapserver SIGPIPE handling on Linux 2024-03-17 18:37:55 -07:00
5d8a01cba7 respond to further review feedback 2024-03-17 18:37:55 -07:00
7775ea325f close modem socket after joining read thread 2024-03-17 18:37:55 -07:00
9d0d2f0a40 handle ATH0 command 2024-03-17 18:37:55 -07:00
12a7e17a41 fix warnings in windows build 2024-03-17 18:37:55 -07:00
9cf8131b23 respond to review feedback on tapserver implementation 2024-03-17 18:37:55 -07:00
dcb7a72c14 add modem files to windows build 2024-03-17 18:37:55 -07:00
02deaa6748 Implement GC modem adapter
This implements the GameCube modem adapter. This implementation is stable but not perfect; it drops frames if the receive FIFO length is exceeded. This is probably due to the unimplemented interrupt mentioned in the comments. If the tapserver end of the connection is aware of this limitation, it's easily circumvented by lowering the MTU of the link, but ideally this wouldn't be necessary.

This has been tested with a couple of different versions of Phantasy Star Online, including Episodes 1 & 2 Trial Edition. The Trial Edition is the only version of the game that supports the Modem Adapter and not the Broadband Adapter, which is what made this commit necessary in the first place.
2024-03-17 18:37:55 -07:00
083116a89c rewrite tapserver interface for better error handling 2024-03-17 18:37:55 -07:00
a36600ae50 add TAPServer.cpp to Windows build 2024-03-17 18:37:55 -07:00
0c364cbb4c implement tapserver BBA on all platforms
This expands the tapserver BBA interface to be available on all platforms. tapserver itself is still macOS-only, but newserv (the PSO server) is not, and it can directly accept local and remote tapserver connections as well. This makes the tapserver interface potentially useful on all platforms.
2024-03-17 18:37:55 -07:00
85dee300b5 Merge pull request #12644 from jordan-woyak/ar-multi
DolphinQt: Allow Cheat Search to create multiple AR codes.
2024-03-17 16:26:38 +01:00
c964d552c9 Merge pull request #12616 from mitaclaw/dvd-interface-cpu-thread-guard
DVDInterface: Modernize With CPUThreadGuard
2024-03-17 16:14:56 +01:00
c202b55bd4 DolphinQt: Allow Cheat Search to create multiple AR codes when selecting multiple lines. 2024-03-17 01:29:39 -05:00
1ee923fd3d Merge pull request #12630 from mitaclaw/ppc-symbols-global
PPCSymbolDB: Move instance to PowerPCManager
2024-03-17 06:03:05 +01:00
d933e58d9a Cubeb: check correct log level 2024-03-17 01:33:42 +00:00
ac5c2d9bf2 VideoCommon: Prefer D3D11/12 over OpenGL on Windows. 2024-03-15 19:51:04 -05:00