Commit Graph

28924 Commits

Author SHA1 Message Date
JosJuice 366cfd0f8c Core: Allow overriding the enabling of a code
If we want to enable codes in the default game INIs,
we should have some way for users to disable them.
This commit accomplishes that by adding a *_Disabled
section corresponding to each *_Enabled section.
2020-12-11 10:02:14 +01:00
Léo Lam 2e63cc8313
Merge pull request #9307 from Dentomologist/add-deleted-file-missing-warning-flag
Add File::Delete and File::DeleteDir warning flags
2020-12-11 02:06:28 +01:00
JMC47 75899b0e11
Merge pull request #9221 from JosJuice/android-saf-sd-card
Android: Use storage access framework for custom SD card paths
2020-12-10 16:32:43 -05:00
Dentomologist 760e7e664a Add File::Delete and File::DeleteDir tests 2020-12-10 09:48:30 -08:00
Ryan Meredith bd02caba4b Android: Expand WiimoteProfileSetting to more setting types 2020-12-10 11:55:24 -05:00
JosJuice c9e83867a1
Merge pull request #9089 from JosJuice/android-orientation-setting
Android: Move orientation setting to main settings screen
2020-12-10 16:17:44 +01:00
Léo Lam 19324e6ed9
Merge pull request #9313 from leoetlino/check-content-hashes
WiiUtils: Check hashes to determine if a title is installed and up-to-date
2020-12-08 15:45:12 +01:00
Markus Wick 3328eb4523
Merge pull request #9293 from JosJuice/jitarm64-stack-pointer
JitArm64: Properly set m_stack_pointer
2020-12-08 07:56:30 +01:00
JosJuice 9f3ad58588 JitArm64: Properly set m_stack_pointer
In order to reach the middle guard (at m_stack_base + GUARD_OFFSET)
before the bottom guard (at m_stack_base), the stack pointer
must start at an address which is higher than the middle guard.
It also didn't make sense that we were allocating memory
and then not using the top part of it.
2020-12-08 01:05:23 +01:00
Markus Wick 1827a0738b
Merge pull request #9299 from JosJuice/jitarm64-downcount
JitArm64: Do downcount immediately before jumping to dispatcher
2020-12-08 00:14:32 +01:00
JosJuice 0cebbb590e JitArm64: Call dispatcher_no_check after CompileExceptionCheck
The flags are not set correctly for a call to the version
of the dispatcher which does have a check. Jit64 uses
dispatcher_no_check here.
2020-12-07 15:08:09 +01:00
Léo Lam f7d7bbf55f
WiiUtils: Check hashes to determine if a title is installed and up-to-date
Nintendo's official title installation code and ES both only look at
content IDs but we should probably check for content hashes in addition
to checking for IDs for at least two reasons:

1. Some of the installed contents could be corrupted -- this cannot be
   easily detected without checking hashes.

2. Some mod distributors do not bother to update content IDs, which
   means that installing updates from the UI would not actually
   update the installed game. This is confusing for users.

To keep the existing semantic (for IOS especially), the new content
hash checks are opt-in for callers of GetStoredContentsFromTMD.

This commit changes WiiUtils's WAD installation logic to enable
the content hash checks.
2020-12-06 01:53:55 +01:00
Dentomologist 4a55511e18 Add warning flags to File deletion functions
Adds a flag to File::Delete and File::DeleteDir functions to control
whether a console warning is emitted when the file or directory doesn't
exist. The flag is optional and true by default to match current behavior.
2020-12-05 16:13:46 -08:00
Léo Lam 2952f99f69
Merge pull request #9312 from iwubcode/dynamic-input-textures-fix
InputCommon: fix dynamic input textures when host key isn't mapped
2020-12-06 00:46:06 +01:00
iwubcode 39e78ce873 InputCommon: fix dynamic input textures being not generated when the key or device isn't mapped 2020-12-05 17:22:57 -06:00
Léo Lam c8cb330df0
Merge pull request #9310 from leoetlino/compile-time-errors-format
Turn format string issues into compile-time errors
2020-12-05 23:58:04 +01:00
Léo Lam d8b9a040ed
Merge pull request #9275 from JosJuice/framedump-boot-time
FrameDump: Start timing at 0 ticks when starting from boot
2020-12-05 23:57:41 +01:00
Léo Lam 585899dba3
Turn format string issues into compile-time errors
If the compiler can detect an issue with a format string at compile
time, then we should take advantage of that and turn the issue into a
hard compile-time error as such problems almost always lead to UB.

This helps with catching logging or assertion messages that have been
converted over to fmt but are still using the old, non-fmt variants
of the logging macros.

This commit also fixes all incorrect usages that I could find.
2020-12-04 18:06:02 +01:00
Dentomologist c434eefe94 Change File::DeleteDir return value
Makes File::DeleteDir return true when attempting to delete a
nonexistent path.

The purpose of DeleteDir is to ensure the path doesn't exist after the
call, which is better reflected by the new return value. Additionally,
none of the current callers actually check the return value so this
won't break any existing code.
2020-12-03 13:31:53 -08:00
LC a34823df61
Merge pull request #9306 from JosJuice/recursive-extract
DiscIO: Fix recursive directory extraction
2020-12-03 15:31:00 -05:00
JosJuice b43f7c85cc DiscIO: Fix recursive directory extraction
https://bugs.dolphin-emu.org/issues/12331
2020-12-03 21:13:53 +01:00
Léo Lam b148b56fba
Merge pull request #9304 from lioncash/panic
General: Convert PanicAlerts over to fmt equivalent
2020-12-02 20:45:27 +01:00
Lioncash 139d4fc76e General: Convert PanicAlerts over to fmt equivalent
Converts lingering panic alert calls over to the fmt-capable ones.
2020-12-02 13:38:33 -05:00
Ryan Meredith aaafb9ba04 Android: Add "Generate a New Statistics Identity" 2020-11-30 13:20:58 -05:00
LC ea2ec64ab4
Merge pull request #9298 from Ebola16/AClearLog
Android: Clear Log file
2020-11-30 09:34:57 -05:00
LC 558ba19314
Merge pull request #9301 from Ebola16/ADebug
Android: Add "Disable Fastmem" debug setting
2020-11-30 09:33:59 -05:00
Léo Lam a5880fa402
Qt: Add missing tr calls for tooltip descriptions 2020-11-30 14:04:08 +01:00
Ryan Meredith 777da89830 Android: Add "Disable Fastmem" debug setting 2020-11-29 17:41:10 -05:00
JosJuice 2863b3ff5b JitArm64: Do downcount immediately before jumping to dispatcher
Fixes https://bugs.dolphin-emu.org/issues/12327.

When we started using fmt in CheckExternalExceptions, JitArm64
mysteriously stopped working even though the code path where
fmt was used never was reached. This is because the compiler
added a function prologue and epilogue to set up the stack,
since the code path that used fmt required the use of the stack.

However, the breakage didn't actually have anything to do
with the usage of the stack in itself, but rather with the
compiler's insertion of a stack canary. In the function
epilogue, a cmp instruction was inserted to check that the
stack canary had not been overwritten during the execution
of the function. This cmp instruction overwriting the status
flags ended up having a disastrous side effect once execution
returned to code emitted by JitArm64::WriteExceptionExit.

JitArm64's dispatcher contains a branch to the "do_timing"
code which is intended to be taken if the PPC downcount is
negative. However, the dispatcher doesn't update the status
flags on its own before this conditional branch, but rather
expects the calling code to have set them as a side effect
of DoDownCount. The root cause of our bug was that
JitArm64::WriteExceptionExit was calling DoDownCount before
Check(External)Exceptions instead of after.
2020-11-29 14:01:14 +01:00
Léo Lam d043c5f81d
Merge pull request #9153 from iwubcode/qt_custom_tooltip
Remove description box in graphics tabs and use custom tooltips instead
2020-11-29 12:37:31 +01:00
Ryan Meredith f18cd9e288 Android: Clear Log file 2020-11-29 02:37:22 -05:00
Léo Lam 361bf25cf8
Merge pull request #9254 from flagrama/fallback-region-selection
Fallback Region Option
2020-11-29 00:19:15 +01:00
Léo Lam 738e1a6dbb
Merge pull request #9297 from JosJuice/movie-game-id-comparison
Movie: Fix 83b9fef regressions
2020-11-29 00:09:30 +01:00
JosJuice 5642772ec4 Movie: Fix 83b9fef regressions
1. Comparing string_views does not behave the same as strncmp
   in the case where SConfig's game ID is longer than 6 chars.
2. DTMHeader::GetGameID wasn't excluding null bytes for game IDs
   shorter than 6 chars.
3. == was accidentally used instead of !=.
2020-11-28 23:35:55 +01:00
Léo Lam cf32c4d479
Merge pull request #9296 from JosJuice/issue-12327-workaround
JitArm64: Add a workaround for issue 12327
2020-11-28 22:44:37 +01:00
JosJuice d2a34fdab7 JitArm64: Add a workaround for issue 12327
This issue is both severe and surprisingly difficult to find
the root cause of, so I think it would make sense to add a simple
hotfix for now. https://bugs.dolphin-emu.org/issues/12327
2020-11-28 22:35:49 +01:00
Vincent Cunningham db5aec019c
Add Fallback Region to configuration menu
Fallback Region
A user-selected fallback to use instead of the default PAL

This is used for unknown region or region free titles to give them
the ability to force region to use. This replaces the current fallback region
of PAL. This can be useful if a user is trying to play a region free
tilte that is originally NTSC and expects to be run at NTSC speeds. This
may be done when a user attempts to dump a WAD of their own without
understanding the settings they have chosen, or could be an intentional
decision by a developer of a ROM hack that can be injected into a
Virtual Console WAD.

Remove using System Menu region being checked in GetFallbackRegion

Use DiscIO::Region instead of std::String for fallback

Add explanation text for Fallback Region
2020-11-28 15:40:21 -05:00
Léo Lam c0f7f91507
Core: Fix an assertion that mistakenly uses a fmt format string
Unfortunately, adding a DEBUG_ASSERT_MSG_FMT isn't actually possible
right now because of compiler bugs:
https://github.com/dolphin-emu/dolphin/pull/9284

We could require a newer version of GCC (10) but that would require
updating GCC on the build machines.

For what it's worth, older versions of GCC (8, 9) are broken in
many ways: adding constexpr to some Matrix functions causes GCC 8
to generate bugged code that causes the Wii IR pointer to disappear,
which means that the generated builds are already unusable
(see https://dolp.in/i12324).

Additionally,  we've already had to add workarounds for those versions
in the format macros to fix compilation bugs. This time, it looks like
workarounds won't cut it; even applying the workaround
described in https://github.com/fmtlib/fmt/pull/1580 does not help.
2020-11-28 21:11:27 +01:00
iwubcode cc837a59d6 Core / DolphinQt: Add ini only option to force low-contrast tooltips 2020-11-28 11:49:14 -06:00
iwubcode 9c204428fe DolphinQt: Add tooltip support to Software Renderer Graphics tab 2020-11-28 11:49:14 -06:00
iwubcode 2bfb8ebf96 DolphinQt: Add tooltip support to Hacks Graphics tab 2020-11-28 11:49:14 -06:00
iwubcode 1673442794 DolphinQt: Add tooltip support to Advanced Graphics tab 2020-11-28 11:49:14 -06:00
iwubcode d083dae7fd DolphinQt: Add tooltip support to Enhancements Graphics tab 2020-11-28 11:49:14 -06:00
iwubcode b9eae86704 DolphinQt: Add tooltip support to General Graphics tab 2020-11-28 11:49:14 -06:00
iwubcode a9271aa167 DolphinQt: Add the ability to show a tooltip for custom graphics controls 2020-11-28 11:49:14 -06:00
iwubcode af0161cafd DolphinQt: Add generic tooltip controls 2020-11-28 11:49:14 -06:00
iwubcode 613d8b1cba DolphinQt: Remove description box handling from graphics widget and window 2020-11-28 11:49:14 -06:00
iwubcode c754b02aae DolphinQt: Add BalloonTip which is built off of an internal Qt class. It gives the ability to show a tooltip with an arrow! 2020-11-28 11:49:14 -06:00
Léo Lam a9845e0a3d
Merge pull request #9191 from sepalani/net-interface
IP/Top: Add Android network interface
2020-11-28 18:22:33 +01:00
Léo Lam a34f19cb96
Merge pull request #9291 from lioncash/alert-audio
AudioCommon: Convert alerts over to fmt-based variants
2020-11-28 16:33:50 +01:00
JosJuice d69f243c32 FrameDump: Start timing at 0 ticks when starting from boot 2020-11-27 17:54:08 +01:00
Sepalani 20ebed51bb IP/Top: Add Android network interface 2020-11-27 19:10:28 +04:00
Lioncash 56d233c47c AudioCommon: Convert alerts over to fmt-based variants
Continues the migration over to fmt

Converts two panic alerts into error logs, since they aren't really
things a user can do anything about.
2020-11-27 10:10:11 -05:00
Markus Wick 26302c2257
Merge pull request #9280 from blaahaj/OpenGL-ES-3.1-ARB_shader_storage_buffer_object
Fix bounding box incorrectly disabled on OpenGL ES 3.1, 3.2
2020-11-27 15:56:50 +01:00
Léo Lam 9b03cdf93e
Merge pull request #9101 from sepalani/fix-ip-fallback
IP/Top: Fix fallback IP address
2020-11-27 02:39:15 +01:00
Léo Lam 2a85534805
Merge pull request #9283 from JosJuice/config-get-speedup
Common: Optimize Config::Get
2020-11-27 02:36:33 +01:00
Admiral H. Curtiss 324de7fa02 VideoCommon: Use Common::SavePNG() to write textures. 2020-11-26 23:55:05 +01:00
Admiral H. Curtiss 33c1a5b941 InputCommon: Use Common::SavePNG() to write images. 2020-11-26 23:55:05 +01:00
Admiral H. Curtiss 2de3b12e9d Common: Add SavePNG() function that writes PNGs using the simplified libpng API. 2020-11-26 23:55:05 +01:00
Lioncash 978e5469af Core: Remove commented out logs
Commented out logs shouldn't be kept around, since it makes performing
renames and migrations harder, as tooling generally doesn't inspect
comments.
2020-11-26 07:49:37 -05:00
Lioncash ffbf3d71f0 Frontends: Migrate logs over to fmt 2020-11-25 21:19:08 -05:00
Léo Lam 4c9ffb58fa
Merge pull request #9250 from Dentomologist/fix-fst-error
Fix file rename errors on Windows
2020-11-26 02:09:30 +01:00
Léo Lam e00572dd07
Merge pull request #9282 from lioncash/core-log5
Core: Convert logging over to fmt pt.5
2020-11-26 02:06:41 +01:00
Léo Lam d573ce34d7
Merge pull request #9281 from AdmiralCurtiss/iofile-write-string
IOFile: Replace fprintf with WriteString/fmt.
2020-11-26 01:39:56 +01:00
Léo Lam 3891ac2682
Merge pull request #9232 from AdmiralCurtiss/show-result-value-in-expression-editor
Qt/IOWindow: Show result value in expression editor.
2020-11-26 01:30:12 +01:00
Dentomologist 1734cf55d8 Fix file rename errors on Windows
On Windows, when the Rename function fails to replace an existing file
it will now retry the operation multiple times with increasingly long
delays between attempts.  This fixes transient rename failures.

I've been getting sporadic yet annoyingly frequent errors saying:
'IOS_FS: Failed to rename temporary FST file'
These typically appear on startup but I've also gotten them randomly.

Investigation shows this happens when the Windows ReplaceFile function
returns the error ERROR_UNABLE_TO_REMOVE_REPLACED.  That happens in the
context of using ReplaceFile to perform an atomic file overwrite, which
is required when saving updates to a file to avoid corruption.  The
error mainly happens with the /Wii/fst.bin file but I've seen it
happen with multiple other files as well.

I haven't been able to definitively pin down why the error occurs,
though online discussions suggest antivirus scanning may be a major
culprit.  That said, I've excluded the Dolphin folder from Windows
Defender scans to no avail and don't have any other antivirus running,
so this is likely to be a problem others are experiencing as well.

The number and duration of retry delays is arbitrary but I feel like a
combined second or so in the worst case is an acceptable tradeoff for
the reduction (actually elimination in my experience) of those errors.
This is even more true when you consider the time it takes to read and
dismiss the error dialogs.
2020-11-25 16:12:58 -08:00
Admiral H. Curtiss 11e226a91a Qt/IOWindow: Remove Apply button. 2020-11-26 00:47:37 +01:00
Admiral H. Curtiss 334100509b Qt/IOWindow: Show the current value of the expression. 2020-11-26 00:46:51 +01:00
Admiral H. Curtiss ddfb8fa404 Qt/IOWindow: Apply expressions immediately so we can query the current value of the expression. 2020-11-26 00:45:31 +01:00
Admiral H. Curtiss 45d4746a5d IOFile: Replace all fprintf string writing with calls to WriteString. 2020-11-25 22:11:21 +01:00
Lioncash ef75e9acd8 Core: Convert logging over to fmt pt.5
Converts the remaining PowerPC code over to fmt-capable logging.

Now, all that's left to convert over are the lingering remnants within
the frontend code.
2020-11-25 13:23:48 -05:00
JosJuice 2f264c6448 Common: Optimize Config::Get
The way Config::Get works in master, it first calls
Config::GetActiveLayerForConfig which searches for the
setting in all layers, and then calls Config::Layer::Get
which searches for the same setting again within the given
layer. We can remove this second search by combining the
logic of Config::GetActiveLayerForConfig and
Config::Layer::Get into one function.
2020-11-25 16:26:13 +01:00
Admiral H. Curtiss 9c590e215f IOFile: Add WriteString() method to replace fprintf string writing. 2020-11-25 15:41:25 +01:00
Léo Lam e2a019ae9a
Merge pull request #9276 from lioncash/core-log4
Core: Convert logging over to fmt pt.4
2020-11-25 13:21:23 +01:00
Léo Lam 140daf5960
Merge pull request #9268 from leoetlino/devicememcard-minor-cleanup
EXI_DeviceMemoryCard: Medium cleanup
2020-11-25 10:07:44 +01:00
Léo Lam 12a215c232
Merge pull request #9277 from JosJuice/gles-vertex-uber
Fix vertex ubershader GLES compile errors
2020-11-25 10:04:45 +01:00
Léo Lam 4a21be5d77
Merge pull request #9278 from lioncash/latent
Core: Convert missed log calls over to fmt
2020-11-25 09:58:40 +01:00
blåhaj bf0fe0281a Fix bounding box incorrectly disabled on OpenGL ES 3.1, 3.2 2020-11-24 21:22:39 +01:00
JosJuice d01f85cfd8 Add Rock Band 3 MIDI PRO Adapter to known Wii peripherals
Based on info from https://forums.dolphin-emu.org/Thread-emulate-midi-pro-adapter
2020-11-24 14:25:19 +01:00
Lioncash eedfe2abf1 Core: Convert missed log calls over to fmt 2020-11-23 12:20:02 -05:00
Lioncash 6cd718163f Core: Convert logging over to fmt pt.4
Continues the migration of logging in the Core library. This part
finishes up the remaining log calls within the IOS code.
2020-11-23 11:53:21 -05:00
JosJuice 28c696fa74 Fix vertex ubershader GLES compile errors
Regression from 51724c1.
2020-11-23 11:42:41 +01:00
Léo Lam 17b11cf4a4
Merge pull request #9095 from JosJuice/android-reset-setting
Android: Long press a setting to reset it
2020-11-23 02:50:40 +01:00
Léo Lam b555f0fb93
Merge pull request #9265 from lioncash/core-log3
Core: Convert logging over to fmt pt.3
2020-11-23 02:46:58 +01:00
JosJuice b53127a1fa
Merge pull request #9274 from JosJuice/av-register-all
FrameDump: Re-add call to av_register_all
2020-11-22 12:45:59 +01:00
Sepalani 79f50cd4fd IP/Top: Fix fallback IP address 2020-11-22 15:34:27 +04:00
Léo Lam 5d9eb8f6ce
Merge pull request #9271 from leoetlino/warnings
Fix several warnings and only enable extra warnings for our own code
2020-11-22 02:04:53 +01:00
JosJuice 118d056410 FrameDump: Re-add call to av_register_all
This was removed in 4902146329.
We still need this for the ffmpeg version we're using on Windows.
2020-11-22 00:11:23 +01:00
Lioncash cbbf044064 Core: Convert logging over to fmt pt.3
Continues the migration over to fmt up to IOS' ES module.
2020-11-21 05:56:37 -05:00
LC 41b79a66c7
Merge pull request #9270 from leoetlino/dtm-gameid-null
Core/Movie: Fix a likely out-of-bounds read for PanicAlertT
2020-11-21 01:53:15 -05:00
Léo Lam 9efc81ae98
Fix variable shadowing warnings 2020-11-21 02:08:09 +01:00
Léo Lam 7840f61524
Silence "missing switch cases" warnings 2020-11-21 02:08:09 +01:00
Léo Lam 6ab1ab1f12
Fix -Wmaybe-uninitialized warnings 2020-11-21 02:08:09 +01:00
Léo Lam 82f1e6204d
Fix -Wsign-compare warnings 2020-11-21 02:08:09 +01:00
Léo Lam 4b7f784d1b
Disable -Wstringop-truncation warnings
Disable -Wstringop-truncation warnings as they result in many false
positives.

In most (all?) cases where std::strncpy is used, we want to fill the
entire buffer or match emulated code that also ignores the null
terminator, so the warnings are not useful.

Given that Dolphin itself mostly uses std::string, they do not
really help catch any bugs.
2020-11-21 02:08:08 +01:00
Léo Lam 83b9feff90
Core/Movie: Fix a likely out-of-bounds read for PanicAlertT
gameID isn't null terminated since it is just an std::array<char, 6>
and .data() returns a char* so {fmt} would go way beyond the bounds of
the array when it attempts to determine the length of the string.

The fix is to pass a std::string_view to {fmt}. This commit adds
a GetGameID() function that can also be used to simplify
string comparisons.
2020-11-21 01:30:02 +01:00
Léo Lam ade9f92a63
Enable extra warnings in Source CMakeLists, not in root CMakeLists
Having extra warnings enabled for everything including external
libraries produces an overwhelming amount of warnings in code that
isn't even part of our codebase.

Move the various warning flags to Source/CMakeLists.txt to get rid
of those useless warnings.

Note that the Source CMakeLists.txt is already where the MSVC warnings
are defined, so this commit improves consistency as well.
2020-11-21 00:59:17 +01:00
Stenzek d6ce8eef36 Software: Use same logic for colors as hardware backends 2020-11-20 15:54:06 -08:00
Stenzek 51724c1ccd LightingShaderGen: Always calculate lighting for both color channels
Cel-damage depends on lighting being calculated for the first channel
even though there is no color in the vertex format (defaults to the
material color). If lighting for the channel is not enabled, the vertex
will use the default color as before.

The default value of the color is determined by the number of elements in
the vertex format. This fixes the grey cubes in Super Mario Sunshine.

If the color channel count is zero, we set the color to black before the
end of the vertex shader. It's possible that this would be undefined
behavior on hardware if a vertex color index that was greater than the
channel count was used within TEV.
2020-11-20 15:54:04 -08:00
Léo Lam fa73b1a23f
Merge pull request #9269 from JosJuice/fmt-positional-checks
Common: Assert that translatable strings use positional arguments
2020-11-21 00:29:43 +01:00