If the entry separator (line of dashes) is found, assume the multiline
section end tag is missing or incorrect and stop parsing so that it
doesn't affect subsequent database entries.
Also improve the error messages so it is slightly more clear what the
error is.
With these changes, saveslots will be labeled as either empty or
with the date that the file was last updated on. The menu items
for loading them are also disabled if the slot is empty.
It's possible if you are very fast to access the menu before the
slots change. It updates when the crc changes. When you save a saveslot,
the menu item also changes to show the time you told it to save until the
file is actually done saving.
Also fix an issue with backup saveslots not working properly from the
gui on first load.
This reverts
93d5b52df3f3e78b826755155ca7f1.
Unfortunately wxString stuff is a PITA to deal with. Breaks FreeBSD
compile, but there are probably more issues that just haven't been
reported yet...
Avoid some function overloads that can accept char*, wxChar* and
wxString as a parameter. wxString can be constructed with either of
those parameters, so the function overloads may actually result in
ambiguity errors. Keep the wxString parameter versions and remove the
rest.
Fixes some compile errors on FreeBSD.
Fixes an issue where the first breakpoint after rebooting a game may
be skipped if the following sequence takes place:
- The first breakpoint after booting the game is triggered once.
- The user hits run to resume the game
- The user reboots the game without any other breakpoint being
triggered.
It doesn't provides much of a performance improvement over directly
using an unordered map. This change also means that if there are
duplicate GameDB entries then they'll be merged together instead of
having only the last entry take effect.
Also increase the unordered map reserve size.
Converting the string to lowercase is unnecessary when the actual entry
is still case sensitive.
Also just use std::hash of std::string and std::wstring instead, which
fixes a FreeBSD compile error (cannot convert to const char*).
There's no need to have a lot of overloads accepting wxChar*, char* cand
const wxString&. Keep only the const wxString& versions and remove the
rest. This fixes an infinite recursion warning on FreeBSD.
Also simplify sectionExists and getSection to avoid unnecessary
conversion to and from wxString.
There's no use for it now that the database editor has been removed.
Also remove the Game_Data POD comment because I don't think it makes
sense and remove an unused variable.
* Enable logging from new source, PS2 system output
* Enable printf formatting with (up to only 7 currently)
* Fix fallthrough bug in SYSCALL switch/case
* Remove unnecessary memread32 call in sysPrintOut case
It has too many issues:
- It's in an incomplete state. The ListView isn't connected up and I'm
not sure what it was supposed to do.
- Comments are stripped from the database when changes are saved.
- Some key value pairs do not show (EE/VU clamp/rounding and
MemCardFilter).
- It doesn't work well on Linux (though this one seems easy to fix).
Fixes empty log and ini directory paths being passed to the plugins on
Windows when the pathnames contain characters not present in the current
system codepage.
Fixes the inability to create snapshots when the pathname contains
non-ASCII characters on Linux (Windows requires more pathname handling
fixes).
In games like ICO where the render and blanks both need to be rounded,
one was prioritized over the other one leading to a truncated value in
the total vsync cycles. This patch fixes it, it's more or less for a
trivial cycle accuracy rather than a signfifcant change which might
influence games. (Not sure, maybe it would?)
Potentially it might be nice to revamp the whole vertical blank
calculation system to make it more readable (discussed about this with
ref), but it's not of much priority right now.
Remove mention of Crash Tag Team Racing from VU I bit gamefix tooltip.
Not needed since the gamefix has been removed for the game as it causes
more issues.
Instead of binding all checkbox events to an event handler, bind only
the master trace log toggle checkbox event and continue processing the
event after it has been handled. This fixes the non-functional apply
button and is also more efficient.
Fixes performance drops and short freezes in adventure mode.
Alas, there is no Crash Tag Team Wrestling, so I replaced it with the
correct title.
Updates Gamefixes Panel entry of VU I bit Hack.
Closes#1785
I guess the intention of the older logic was to get the truncated part
by comparing with the original value, but that went wrong due to using
the pre-normalized value (before the division) for comparison.
Hence let's just do a modulo for rounding the render and blank.
Previously, the DVD variant NTSC/PAL modes used the horizontal blanking
interval calculation algorithm used by digital video modes, which
shouldn't be used and also rounding error check was neglected.
Added the DVD variant modes to the list in analog video mode finder
subroutine. This should impact timing/vertical synchronization in PSX
games significantly.
This adjusts the copy bytes command format from
5aaaaaaa nnnnnnnn
00000000 bbbbbbbb
to
5aaaaaaa nnnnnnnn
bbbbbbbb 00000000
so that it matches the copy bytes command format used by PS2 cheat
devices (GS/CB/XP/AR2).
Switch to using vector for the dump sector table, and also fix a bug
where memory was not allocated when writing to a v2 format block dump,
causing a null pointer dereference.
Also switch to using the v2 block dump format, which generally produces
smaller dump files (the dumps also seem smaller than the ones generated
by cdvdiso, which seems to repeat sectors).
- Adds tooltip for Convert memory card button in the memory card dialog
- Updates several memory card console writes.
- Adds 2018 copyrights to the updated files
Changes the file extension used by PSX memory cards to the common .mcr
instead of using the same (.ps2) extension used by PS2 memory cards.
Updates the extension listed in Create memory card dialog when a PSX or
PS2 memory card is selected.
Replaces the awkward checkbox for a PSX memory card in the bottom left
of the Create Memory Card dialog with a radio button like the other
memory card types.
The workaround was used to prevent macro substitution occuring on paths
containing "linux", but it's no longer necessary since "linux" is not
set as a predefined macro when a "-std=" option is passed to gcc.
Fixes#2268.
I found it might be useful for looking into issues at certain cases
where users provide a screenshot covering the titlebar, so we can easily
identify which video mode is being used.
Especially useful for looking into PCRTC issues.
The assembler was previously assembling instruction "b i" as an alias to "j I".
This caused unexpected behavior when attempting to assemble an
unconditional branch. The previous behavior would cause
position-independent code to fail due to the distinction between
the absolute address of a jump vs. the offset of a branch.
Fixes memcard access in Final Fantasy VIII, and likely in other PSX
games supporting the Pocketstation peripheral. This makes inserted PSX cards show up as PocketStation devices in the PS2 browser, which is okay for now.
doc: Update FAQ document
* Update system requirements to match README.md and remove references to v0.9.6
* Fix formatting issues, add link for DirectX and speed issues
It's not really used, and the OSD uses a different API.
The specified calling convention (stdcall) is also incorrect since
variadic functions are caller-clean, not callee-clean. The compilers
ignore the stdcall and just use cdecl (I think), though it does trigger
a -Wcast-calling-convention on clang.
It seems not all DMA channels have the same set of 32 bit registers. Removed
addresses of registers which aren't actually present in the memory
space.
Example: Channel 0/1/2 have address stack registers but the other
channels lack it. According to documents, the remaining memory space of
the channels seems to be reserved. Which means, write access would be
disregarded and read access would return an unknown value.
Credit goes to Gregory and CK1 for notifying me about it, special mention to ssakash for actually pushing the change to github. Also I wasn't the one who introduced the non-existent registers into the code, these registers were present before under a different name.
The macro for address of channel 9 was wrongly having the address of
channel 8, fixed it. (Luckily MADR and QWC were unused so we should be
safe)
Thanks to Fireboyd78 for notifying us about this. (Closes#2091)
Also fixed some inconsistencies where some of the DMA channel register
addresses weren't defined for all the bitfields.
If emulation is paused and resumed, vsync may become enabled even if the
frame limiter is currently disabled. This state persists until the
settings are changed or the hotkeys are used.
Fix the inconsistent framelimiter/vsync behaviour so that vsync isn't
enabled whenever the framelimiter is disabled, which matches the
behaviour in the rest of the code.
The safest preset should ideally try to provide
the highest accuracy and stability when emulating the
PS2, allowing the manipulation of the MTVU hack could
just destroy both of these things, hence the following patch
force disables the hack on safest preset.
v2: allow all combinations of framelimiter and vsync options
v3:
* disable vsync when the user disable framelimiter with F4
* Use g_Conf->EmuOptions instead of EmuConfig
The scalar limit value was updated only during any turbo/slowmotion
toggle, let's also update it properly after any change in the emulation
settings.
This prevents the need of toggling from turbo/slowmotion to update to
your requested frame rate percentage.
Current behavior - The tilebar isn't updated when the user enters full screen mode and when the user returns back to windowed mode they have the older title bar values for a brief second, this sort of behavior is undesirable just in the cost of saving some overhead for updating title. (which is really negligent)
Hence reverting the code back to how it has been for the past 7 years (Yes, I did my research), I'm doing it only for the windows side at the moment as a code comment describes of some sort of Linux specific issue on wxWidgets side.
The default 12 is rather low and won't suffice for most cases, updating
it to 20 to give some extra space for additional ISOs. Incrementing it
to an even higher value might not be so good as it consumes lots of
vertical space, not a nice idea for people with smaller screens.
Thanks to @colepcsx2 (https://github.com/PCSX2/pcsx2/pull/1896#commitcomment-21858717) for pointing it out!
I also updated the prefix in the inferior video mode detection of GSdx, I'm not even sure why we need the videomode info on the plugin side, might be useful someday.
The title bar will display "progressive" for 1-2 seconds when booting an interlaced game at some cases, it's due to an uninitialized SMODE2 register, so let's wait till the rendering starts to allow time for the
SMODE2 init and get the proper values from games.
My guess is that GCC reports an warning because of the default case.
I don't think we support yet __builtin_unreachable on Linux
Nevertheless it will still be an issue in non-release build
This reverts commit 99180f5afb.
Unfortunately Mint/Arch got segmentation fault in Xlib mutex locking...
Sadly Xlib will be back to thread-unsafe mode.
I'm cooking another solution based on EGL
X11 isn't thread safe by default. It make sense in 1990 but it is ugly nowadays.
The trick is that is must called before any X11 function. So the only
safe place is at the start of the main. Pcsx2App::OnInit() is the
sooner that I've found.
Fixes an issue where the game will either boot the wrong CDVD source or
fail to boot if the current CDVD option doesn't match the option
specified in the command line.
Improved the video mode detection code by also detecting the DVD variant video modes of NTSC & PAL, PSX mode actually make use of these specific variants, as well as the BIOS. Previously, I just had them as a single bios video mode due to laziness. (I know, my bad)
After further research, it seems that these DVD variant modes have their own individual VSync timing values similar to the standard NTSC & PAL video modes, dealing with those timer codes might be essential in getting timing accuracy of the PSX mode games. (I kept it to default NTSC/PAL values for now, interested people can mess with it later)
I had planned to do this before but there some were concerns that two different video modes make use of 0x73 gate in SetGsCrt, which was rather weird (how the heck could two video modes be used in a single param value?)
0x73- DVDPAL ( 720 x 480 @ ??.???Hz)
0x73- DVD480P ( 720 x 480 @ ??.???Hz)
Hence, we had decided to use the CMOD bit from SMODE1 (AKA color subcarrier frequency) to detect whether it's an analog or digital video mode and update the necessary timing values but seems like it's no longer necessary, after further discussions from some PS2 developers, we've come to the conclusion that only DVDPAL is possible via 0x73 in SetGsCrt. (So I assume the DVD480p init possibility was fake info from Blue and those other GSM guys who were reverse engineering the PS2)
Remove full path from every plugin binding and only add it to the
preceding "Loading Plugins..." line.
Instead the revision date and version number are printed for each plugin
to make it easier to identify issues with plugin versions.
Previously, the OSD neglected to mention any sort of message when the savestate load is failed, the following patch now also prints a message on OSD when detecting such cases of loading an incomplete/corrupt savestate.
This prevents the internal state of the objects from becoming
inconsistent, which causes inflate() to fail with recent zlib versions
(1.2.9 and later).
EE interpeter: remove unused argument
rdd is neither used, nor needed. It appears it was there to pass the _Rd_ word to write to, but the writing was moved to PHMSBH() to have one "if (_Rd_)".
Add a note on undefined behavior
The ring buffer is composed of severals read/write by transaction.
Atomic operations are only required at the start/end of the full
transaction. In the middle, you can use normal variable (optimization
opportunity for the compiler)
Use acquire/release semantics on isBusy and vuCycles to remain 100% safe
(relaxed might be doable but better be safe than sorry)
Use dedicated cache line for atomic variable to avoid any conflict between CPU
The struct is copied in various ring buffer (hot path)
We only need the return status of the function so use a reference instead of
a state variable
Side note: if we align the struct to 16B maybe the compiler can use SSE to copy it.
Warning: it breaks save state compatibility
Hopefully this translates well to slower systems :)
Tekken Tag:
Before: 79-81fps
After: 82-84fps
Front Mission 4 intro (as it pans over the roofs)
Before: 158-159fps
After: 165-166fps
Previously, the seconds variable of the RTC was updated on progressive modes after every 50 Vsyncs, which was obviously wrong. The code has been adjusted to update the RTC with respect to the vertical frequencies of various other video modes.
16B alignment is now useless for nVifBlock (no more SSE)
However update the alignment of bucket to 64B. It will reduce cache miss
probability in the find loop
It avoids memory stalls and greatly reduces the overhead of the dVifUnpack function
Here a vtune summary of this branch (done on SotC init)
dVifUnpack<1> was 14.5% of effective VU thread time
dVifUnpack<1> is now 3.8% of effective VU thread time
I hope it will translate to better fps
Delete() deletes the menu item but keeps the sub menu. Remove() doesn't
delete the menu item.
Also use AppendSubMenu - using Append on a submenu is deprecated.
It allow to compare only 8B in the lookup so SSE could be replaced with general instruction
As a bonus, it allow to compute the hash key with a mov rather than modulo (which was an 'and')
Inline the execution part
Add a num parameter to dVifsetVUptr
Use a local variable for the nVifBlock instead of a global struct state
The goal is to ease future update of the nVifBlock struct
Previous implementation saved the both the chain pointer and the chain size
Rational: size is useful to add new element and to detect the end of the chain
Vif cache is rarely miss. So 'add' is barely called and the end of a chain is
barely reached.
New implementation will add a null cell at the end of the chain. As a
cell contains a x86 pointer, if is null you could conclude that you
reach the end of the chain.
The 'add' function will traverse the chain to get the current size. It is
a cold path besides the chain is often short (< 4).
The 'find' function only need to check the startPtr bytes to detect the end
of the loop.
Note: SizeChain was replaced with a std::array
Safety:
* check remaining space before compilation
* clear hash if recompiler is reset
Perf:
* don't research the hash after a miss
* reduce branching in Unpack/ExecuteUnpack
Note: a potential speed optimization for dVifsetVUptr
Precompute the length and store in the cache. However it need 2B on the
nVifBlock struct. Maybe we can compact cl/wl. Or merge aligned with upkType
(if some bits are useless)
I misses some early return in my first tentative. Now VTune shows me
properly the time in VU recompiler.
Note: It seem some block overlap (likely due to the branching mess). But it is still way better than no data
GS_Packet constructor calls memset which is quite slow and useless as data is overwritten
Vtune overhead of Gif_Unit::Execute goes from 5.8% to 3.0% (EE thread)
Several PSX titles lack a backslash in the elf path, which made the disc
serial contain 'cdrom:', this caused savestate issues in those ganes.
Solves: https://github.com/PCSX2/pcsx2/issues/1692
Previously the boot menu items always displayed "Boot CDVD" regardless of the current source medium, this behavior has been fixed to properly adjust the text when source medium is changed. Now it'll display Boot CDVD/ISO/BIOS with respect to the current source medium.
v2: Some instances of "Iso" have been changed to "ISO" for consistency.
v3: Remove the unnecessary "Reboot" on menu item labels, saves some string translations.
v4: Add a new shortcut key for the primary boot menu item.
There is already a dedicated bind event to handle the gray out of the menu item, so let's just gray it out initially and let the bind event handler do it's thing.
The previous behavior would only gray out the menu item when all the plugins are in a non-active state which didn't seem ideal as the plugins were shutdown only when closing PCSX2 (or) switching plugins.
The purpose is to stop vtune profiling in a predictable way. It allows
to compare multiple runs.
ERET is called every syscall/interrupt return so it is proportional to
the EE program execution.
Cons:
* requires ~180MB of physical memory (virtual memory is the same so it
doesn't impact the 4GB limit)
From steam: 98.81% got at least 2GB of RAM. 83.62% got at least 4GB of RAM.
That being said, it might not really increase RAM requirements as OS could put the
new allocation in the swap.
Pro:
* code is much easier
* remove at least half of the signal listener
* last but not least, it is way easier for profiler/debugger
Previously, the code used a lot of "bitwise AND" to get specific bitfields of the interrupt mask control register, which makes the code look a bit hacky, also it's even more hard for normal people to calculate the value when hexadecimal values are used for the bitwise operations where the register is totally binary. Instead of dealing with all those mess, let's just get the bitfield values from the already implemented nice union of the IMR register. FWIW it also makes the code more readable.
Doesn't fully work yet
* Unknown stack frame
* Outside any known module
Potential root cause:
* Nvidia driver
* VU code as ebp is required for emulation so likely no frame
A FreeBSD 10.3 user (meowthink) reported to me that games were not
working properly on their system. After some investigation, it was
discovered that aio was buggy on their setup. There's also bug reports
for other applications that involve aio too.
Workaround the issue by using a normal read and disabling the use of aio
on FreeBSD 10.3 and earlier. It'll remain enabled on FreeBSD 11.0 in the
hope that the aio issue has since been fixed.
Static size is better aligned but it consumes too much space on the GUI
Besides, if a string (translation) is bigger that the static size it will be cut off.
VU/EE min sized are the same to keep a proper alignment
../pcsx2/gui/MessageBoxes.cpp:62:1: warning: base class ‘class pxActionEvent’ should be explicitly initialized in the copy constructor [-Wextra]
BaseMessageBoxEvent::BaseMessageBoxEvent( const BaseMessageBoxEvent& event )
Previously the video mode was initialized using the info fetched from SetGsCrt Syscall though unfortunately, it doesn't seem to work with PSX games as they don't use the SetGsCrt syscall. At such cases, we get the video mode info from the SMODE2 colorburst to properly maintain the timing as per the video mode. Might help some cases on PSX games where PAL/NTSC video mode was improperly set to a wrong limit instead of it's actual vertical frequency limit.
Newer wxWidgets versions call SetThreadUILanguage() on Windows, which
somehow causes our recursive mutex implementation to take ~1ms when
recursive locking occurs. So when a game boots up and the debugger is
loading the symbol map which can easily have 15000+ symbols, the GUI
locks up for 15+ seconds.
Switching to C++11 recursive mutexes seems to work around the issue. It
should be safe here since there's no direct interaction with the GUI.
Note: There is still a 1-2 second GUI lockup when booting a game on
Windows (it has existed for quite a while, and is more noticeable with
fast boot). It doesn't seem to affect Linux (or maybe it's harder to
detect).
- include a small game exe detection so pcsx2 doesn't believe it's running the bios
- cdrom.cpp has a hack to account for pcsx2's wrong iop dma timing when mixing mdec and cdrom dmas. This should be properly fixed for the benefit of all ps2 / psx software!
- dmasif2 is disabled since pgpu already handles it
EE Interpreter: Link Unconditionally on Branch and Link instructions
-Link instructions used to store the return address if the branch was
taken, but the correct behaviour is to store the return address whether
or not the branch is taken.
Warning can be reenabled on GCC
A warning isn't fixed as potentially the code is wrong
../pcsx2/gui/MemoryCardFolder.cpp: In member function ‘void FolderMemoryCard::FlushFileEntries(u32, u32, const wxString&, MemoryCardFileMetadataReference*)’:
../pcsx2/gui/MemoryCardFolder.cpp:1027:10: warning: unused variable ‘filenameCleaned’ [-Wunused-variable]
bool filenameCleaned = FileAccessHelper::CleanMemcardFilename( cleanName );
CID 146985 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)8.
uninit_member: Non-static class member vuxy is not initialized in this
constructor nor in any functions that it calls
CID 168623 (#1 of 1): Missing break in switch
(MISSING_BREAK)unterminated_case: The case for value
GS_VideoMode::Unknown is not terminated by a 'break' statement.
PCSX2: IPU end of video freeze fixes
Fixes end of video freeze in Enthusia - Professional Racing.
Fixes end of video freeze with IPU Normal error in games like Enter The Matrix(#1494), Rygar, Freestyle Metal X, etc. Also fixes The Incredible Hulk and Bolt (thanks to @prafullpcsx2 for testing).
* More accurate to PS2 behavior and avoids an useless SMODE write function, it makes sense to also move this as video mode specific colorburst detection was already moved to SetGsCrt.
If the dev/verbose logging option is enabled and the game requires
automatic gamefixes, the console log will always scroll to the bottom
when the scrollbar is released since a new log message will be output
when emulation unpauses.
This could be quite annoying when checking a log while the game is
running. The behaviour doesn't seem to be all that useful anymore
(previously it was useful to work around a GUI bug where the automatic
gamefixes/widescreen patches/cheats menu options didn't apply
immediately) and only works on Windows, so let's remove it.
MIPSAnalyst.cpp:124:9: warning: ‘takeBranch’ may be used uninitialized in this function [-Wmaybe-uninitialized]
else if (sure && !takeBranch)
False positive as sure will be false but safer this way
Templace is nicer but give a hard time to compiler.
New version compile in both gcc&clang without hack
v2: add an uptr cast too for VS2013 sigh...
v3: use an ugly function pointer cast to please VS2013
It is done too late.
CID 168625 (#1 of 1): Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking this->cpu suggests that it may be null, but it has already been dereferenced on all paths leading to the check.
* Only use dark green color for the default cycle rate. using a different color just for a single value (previously for -1) might be confusing for users.
* Use a constant RGB form of dark sea green color instead of the regular dark green color. these new RGB values have been *tuned* for perf...err perfection!
No functional changes done, the current commit helps us to pass vertical frequency values of individual video modes to GUI code for accurate percentage calculation on titlebar. (which is done on the succeeding commit)
The solution files are unused and for ancient Visual Studio versions -
GSDumpGUI has its own solution file, and bin2cpp is included in the main
solution file.
The property sheets have either fallen out of use or were never used in
the first place.
This is a regression from 6db18446 , which, due to correctly applying
the patches when the bios starts, also updated the console title (which
happens at the same function).
So when updating the settings and loading the patches, only update the
console title if we're already outside of the bios.
If the dev/verbose console source is enabled then there's no change.
If it's not enabled (i.e. most users), then:
- Don't show patch info messages twice on boot (regression from 27e7ecce).
- Show patch info messages when loading a saved state (never worked).
- Don't show patch info messages for the bios.
It still doesn't print the info when patches/fixes/etc are enabled or
disabled while a game is running, because such actions while a game is
running can have unexpected effects regardless (for instance, it's
technically impossible to unapply a patch).
If one really wants to follow the exact timing and info about patch
loading, just enable the dev/verbose console source at the console menu.
Also slightly modify the textual description of the other underclock items.
All previous values available at the slider are still there, but since
the new value is now the mildest (slider == -1), it "pushes" the previous
-1 and -2 values one notch down.
This restores the mildest value to be identical to how it behaved before
90b11b2f , which is measured as about 75% speed.
Because the "balanced" preset uses the -1 slider value, it means this
restored mild value is now also used by the balanced preset.
As a note, while the message for the mildest value was always "reduce by
about 33%", before 90b11b2f it was actually about 25% reduction (75% speed,
like with this commit now), and after that commit it was about 40% reduction
(60% speed).
Also, since we add new value to the slider only on one side, the "0"
(default) slider position is now not at the exact middle. That's fine,
but maybe we could also add a milder overclock value on the other side
to have that symetric again.
The ee cyclerate percentage values at the slider text were inaccurate,
and sometimes wildely so.
Add some code to measure the actual speed at runtime (disabled by default)
and update the (static) slider text values according to the measurements.
Also change the description from increase/reduce "by AA %" to "to BB %".
This makes it slightly easier to grasp. E.g. "reduce speed to 10%" is
easier to grasp than "reduce speed by 90%", and similarly, "increase
speed to 300%" is easier to grasp than "increase speed by 200%".
While c782b62 added much more reliable game game startup detection, the
settings system did not yet gain that knowledge, but typically that's OK.
Typically the settings (and patches) are loaded according to the current
CRC, which happens once on bios boot (with general settings) and then again
when the game starts, which includes game-specific fixes, patches, etc.
However, if the setting are changed (and therefore also applied) after
the game CRC is known but before the game starts, such as if the user
presses Tab to change framelimiter while at the bios, then until now it
was accidentally applying the game's settings while still at the bios.
This commit makes the settings routine know whether or not the game actually
started, and apply the generic/game settings accordingly.
Commit 330704a added code which applies the patches before recompiling the
elf entry block, but because at that stage the patches for the current
CRC were not yet loaded, effectively it did nothing.
Now it actually loads the patches before applying them.
As a result, it should now be possible for patches (with place=0) to be
effective before the elf is executed.
This is a hack, because the emulation loads the patches while it's not
paused. It works, but it's not great. A better way would be to pause the
emulation once the entry point is detected, then make the setting get
applied normally (which also loads the patches normally), and then resume
the emulation.
This _should_ properly fix#627 (the test case works as expected now).
patches and cheats are exactly the same (pnach style patch line) but we
stored two sets of them depending on their source: "patches" for
GameIndex.dbf patches, and "cheats" for all the rest (cheats, widescreen,
etc).
Unify patches and cheats and keep only "patches", cleanup and rename the
public API at Patch.h, and add documentation.
Also: add some console messages on invalid "place" value, and when we skip
searching cheats_ws.zip because a pnach file was found at cheats_ws dir.
Also: removed checks before applying different kinds of patches/cheats
because we don't need them (we didn't have disabled patches loaded anyway).
The checks removal _shouldn't_ have any effect, except that the checks were
wrong and accidentally prevented loading widescreen hacks which have a place
value of 0. No one probably noticed it since all the widescreen patches
which I looked at have a place value of 1. So now ws patches with place=0
would load correctly too. If we'll ever have such.
This commit doesn't change any behavior, but documents the "places" value
of the patch structure ("place" is 1 in patch=1,... and 0 in patch=0,...)
and also uses an enum to make its use explicit.
If cheats are enabled and loaded (pnatch files from the cheats folder, or
from the cheats_ws folder, or from cheats_ws.zip), then they were still
applied for some time while rebooting the emulation after a game is already
loaded (e.g. start pcsx2, boot fast, play, boot full). This could cause
the reboot to fail if some patches were applied (e.g. widescreen patches).
It seems that the offending application of the cheats happens at
SysCoreThread::VsyncInThread(), which possibly runs before the config
change event is handled (and re-load the cheats for the current crc).
So reset/invalidate the cheats when the VM is reset.
This should improve issue #851, but ultimately not fully fix it, since
the patches (from games db) are not reset yet with this commit, and we
don't have a function to do so. For now the non-cheats patches are only
reset/reloaded when a configuration change is being handled.
It would probably be a good thing if we can unify patches/cheats.
==18373== Conditional jump or move depends on uninitialised value(s)
==18373== at 0x825CC9B: CtrlMemView::render(wxDC&) (CtrlMemView.cpp:277)
==18373== by 0x825DA19: CtrlMemView::paintEvent(wxPaintEvent&) (CtrlMemView.cpp:138)
==18373== by 0x81F3A5F: Pcsx2App::HandleEvent(wxEvtHandler*, void (wxEvtHandler::*)(wxEvent&), wxEvent&) (AppMain.cpp:614)
==18373== by 0x40BC50B: wxAppConsoleBase::CallEventHandler(wxEvtHandler*, wxEventFunctor&, wxEvent&) const (in /usr/lib/i386-linux-gnu/libwx_baseu-3.0.so.0.2.0)
==18373== by 0x426C654: wxEvtHandler::ProcessEventIfMatchesId(wxEventTableEntryBase const&, wxEvtHandler*, wxEvent&) (in /usr/lib/i386-linux-gnu/libwx_baseu-3.0.so.0.2.0)
==18373== by 0x426C752: wxEventHashTable::HandleEvent(wxEvent&, wxEvtHandler*) (in /usr/lib/i386-linux-gnu/libwx_baseu-3.0.so.0.2.0)
Reported by gcc too
Fix valgrind issue:
==3560== Conditional jump or move depends on uninitialised value(s)
==3560== at 0x81F7949: CtrlRegisterList::OnDraw(wxDC&) (CtrlRegisterList.cpp:291)
==3560== by 0x47826DE: wxAnyScrollHelperBase::HandleOnPaint(wxPaintEvent&) (in /usr/lib/i386-linux-gnu/libwx_gtk2u_core-3.0.so.0.2.0)
==3560== by 0x4785969: wxScrollHelperEvtHandler::ProcessEvent(wxEvent&) (in /usr/lib/i386-linux-gnu/libwx_gtk2u_core-3.0.so.0.2.0)
==3560== by 0x426CA0E: wxEvtHandler::SafelyProcessEvent(wxEvent&) (in /usr/lib/i386-linux-gnu/libwx_baseu-3.0.so.0.2.0)
==3560== by 0x4710BAE: wxWindowBase::HandleWindowEvent(wxEvent&) const (in /usr/lib/i386-linux-gnu/libwx_gtk2u_core-3.0.so.0.2.0)
==3560== by 0x44EF67D: wxWindow::GTKSendPaintEvents(_GdkRegion const*) (in /usr/lib/i386-linux-gnu/libwx_gtk2u_core-3.0.so.0.2.0)
I'm not sure to understand why Valgrind reports it as we populate the buffer
during the ReadAsync. Maybe Valgrind doesn't like async IO from the kernel.
In doubt, the init will avoid those warnings
==19897== Thread 6 EE Core:
==19897== Conditional jump or move depends on uninitialised value(s)
==19897== at 0x80FE9E1: BlockdumpFileReader::DetectBlockdump(AsyncFileReader*) (BlockdumpFileReader.cpp:40)
==19897== by 0x8109EE5: InputIsoFile::Open(wxString const&, bool) (InputIsoFile.cpp:229)
==19897== by 0x810939E: ISOopen(char const*) (CDVDisoReader.cpp:57)
==19897== by 0x810194E: DoCDVDopen() (CDVDaccess.cpp:359)
==19897== by 0x80B651C: SysCorePlugins::OpenPlugin_CDVD() (PluginManager.cpp:1219)
It is a pseudo leak as it is a global object. Nevertheless it pollutes
the valgrind log.
v2:
* use an array of unique pointer
* use ArraySize instead of a constant
Combine all the different configurations together so the project files
are more generic and maintainable.
Also standardise the layout so all the project files will be similar and
all have the same standard elements (even if empty).
Add 64-bit configurations.
Write pointer can be relaxed-read from the EE thread
Read pointer can be relaxed-read from the VU thread
Warning: AtomicExchange calls were replaced by release-store
However AtomicExchange generates a memory barrier (at least on linux)
So either it is useless and it will be faster, or it will explode ;)
* Avoid the generation of memory barrier (mfence)
* Based on the fact that it used to work on previous code without any
barrier
v2:
* keep basic code in reset path
* use relaxed access for isBusy. The variable doesn't carry load/store
dependency but is instead an hint to optimize semaphore post
Read pointer is only written by the MTGS thread so it can be relaxed-read
by the MTGS thread
Write pointer is only written by the EE thread so it can be relaxed-read
by the EE thread
Remove volatile stuff
* Avoid the generation of memory barrier (mfence)
* Based on the fact that it used to work on previous code without any
barrier
v2:
* keep "slow" and safe atomic on reset path
* use relaxed atomic for m_RingBufferIsBusy
The signal doesn't carry dependency with others load/store. Instead it is used
as an hint to awake the semaphore
As a side, there is a potential thread bug
T1 do
* wait sema
* busy = true;
* while (!queue.empty) do work...
* busy = false;
* go back to wait sema
T2 do
* post sema even if busy is false
If T1 stop after the while queue but before the busy, T2 won't post the
event. When T1 will wake up, it will block on the semaphore
* Fixes a bug where NTSC VideoMode was automatically used when videomode is uninitialized. the bug was only temporary till the SMODE register was written.
Technically there's no term called "RegionMode" and the values obtained through the SMODE1 register is actually used for identifying the video mode of the game not any region modes.
* Convert "GS_VideoMode" into an enum class
Grouping bytes in debugger memory window, following pointers and history
Goto in register view
Printing strings in pointer registers
Memory view can be resized correctly by ctrl+wheel
Improvement in function 5900DebugInterface::isValidAddress
x86emitter : Convert variable type from u8 to bool.
recVTLB: Cast "sign" to bool to prevent a warning.
R5900OpcodeImpl: Cast all the values in array to u64 instead of s64.
Adding shortcuts to all the menu options, that only some of the options
in the Config tab already had.
Also update translations so menus are still localised (well, mostly).
* The detected values using the SMODE registers were for the video modes and not the region of the game, changed the variable naming to video modes to prevent any confusions.
* Fix a bug where 1080I was reported as progressive
* Convert GS_VideMode into an enum class
* Move VideoMode init code from _gsSMODEwrite to SYSCALL
* PCSX2 will now correctly report whether the video mode is NTSC/PAL/VESA/480p/576p/720p/1080i/1080p
-SYNC.L should be called before this command forcing the cache to writeback to memory, but that would be slow to do every time, so we will do it on this command.
find . -name *.vcxproj -exec sed -i -e '/user.props/d' {} \;
Microsoft recommends against using .user files. From
https://msdn.microsoft.com/en-us/library/669zx6zc.aspx :
"The best practice is to delete the reference to them in Property
Manager to ensure that your projects operate independently of any
per-user, per-computer settings. This is important to ensure correct
behaviour in a SCC (source code control) environment."
If you cannot compile SPU2-X after this commit (since that still relies
on the old DirectX SDK), you'll need to fix your build environment.
It's more portable.
Use _mm_shuffle_epi32 instead of _mm_movehl_ps - I think it avoids
data bypass delays going from integer to float domains on older
processors, and Agner's tables indicate that the instruction has the
same latency and occasionally has higher throughput (depending on cpu).
And switch the _mm_xor_si128 and _mm_unpacklo_epi8 around so the same
constant can be used for both C bias and alpha.
Avoid crash on some systems switching HW><SW in fullscreen aspect
ratio's with FMV Software switch.
Replaces previous zoom adjusting fix with a more efficent one.
Squashed a small improvement into commit.
Fixes#1353
DebuggerLists:
Select does not ensure the item is visible if selecting
Went with existing convention of Select and Focus.
CtrlRegisterList:
Added ensureVisible, called whenever the current row selection is
changed
The old config settings were wrongly used when determining whether to
load patches, cheats and widescreen hacks. These settings needed to be
applied twice to actually take effect if they were changed while a game
is running.
Use the incoming settings so the settings only need to be applied once.
On Windows, it seems that if you resize the columns in the size event
handler when the scrollbar disappears, the listview contents may decide
to disappear as well. So let's avoid the resize for this case.
Always show number of loaded widescreen hacks/cheats in console title
if the respective options are enabled (even if none are loaded).
Always print the number of loaded widescreen hacks to the console if
the option is enabled (even if none are loaded).
This prevents desync between what is assumed to be the active filter and
what is actually the active filter, fixing errors like #1179 where the
memory cards are closed and reopened for whatever reason.
The DVD layer 0 sector count is stored in the Volume Space Size field of
the Primary Volume Descriptor on DVD layer 0. This value is the same as
the total sector count for a single layer DVD and the first layer 1 LSN
of a dual layer DVD.
Let's use that to determine the layer 1 start LSN instead of using the
brute force approach. Since this approach is much faster than the
previous approach, the layer break is no longer cached.
Basically I ran
find . -name "*.vcxproj" -exec sed -i -e 's/_xp//' {} \;
This will likely break XP, but it paves the way on Windows for a PCSX2
that does not require the DirectX redistributables to be installed for
Windows 8, 8.1 and 10 users. Windows Vista and 7 users will still require
the DirectX redistributable files for XInput and XAudio, though PCSX2
should still be capable of running if a user does not actually use either
of them.
isBreakpointNeeded returns if breakpoints are needed for any combination
of the current pc and delay slot.
dynarecCheckBreakpoint checks conditions for each breakpoint slot.
v2: use an explicit int type for clang
// multiple conversions from switch condition type
// 'std::atomic<ExecutionMode>' to an integral or enumeration type
v3/v4: use .load to read variable (clang 3.7)
v5: add back 'std::atomic<ExecutionMode>' now that .load is used everywhere
So let's not specify it as a build dependency.
Also remove some unnecessary manual library linkage and remove the
wsWidgets GUI property sheet, which does nothing useful.
Removed some unneeded explicit calls of the enable function and also corrected the placement of braces on a function. ( do note that only the specific function at the file used a different placement of the braces)
Also fix the grayout behavior of SuperVU recompiler option when DISABLE_SVU is defined. (thanks to turtleli)
Fixes an issue where the Enable all/Disable all/Restore Default menu
items in the Console Log Sources menu do not immediately enable/disable
CDVD log output.
Buttons done, configuration initialization done.
Still need to add Gamepad and Joysticks configuration frames.
Require png file for the moment (the embedded picture will be fixed after).
New Onepad GUI based on wxWidget (Main frame almost finish)
Background picture is now embedded
Button binding works
Loading and saving works
Need to add feedback and gamepad, joysticks configuration frame
Modification of the onepad CMakeList.txt
Automatic generation of images headers using perl script
Modification of the test feedback function
Changed the word "Playstation" to the proper "PlayStation" in the About
dialog and the Command Line Options dialog.
Add a space between PlayStation and 2.