Math is correct but a shift of 64 bits is illegal in x86 because the cl register is masked
From the x86 spec:
The destination operand can be a register or a memory location. The count operand can be an immediate value or
the CL register. The count is masked to 5 bits (or 6 bits if in 64-bit mode and REX.W is used). The count range is
limited to 0 to 31 (or 63 if 64-bit mode and REX.W is used). A special opcode encoding is provided for a count of 1.
SuperVU wasn't converted (unlikely to be ported to 64 bits)
A couple of calls weren't converted because they require extra work
but there are not mandatory (debug/MTVU/...)
* Rework a bit MVU to support xScopedStackFrame. Potentially
stack frame can be optimized (save 5 instructions)
* I removed the recompiler stack check. Address sanitizer is more efficient anyway
Give both EE and x86 code.
Don't rely on global variable. The dump still dump the content of the register.
Of course value will be wrong if you don't dump it at the start of the block.
It help to detect register/memory access
the cpu struct address is also printed to easily postprocess the x86 memory pointer
(see next commit)
It misses jump & FPU. Jump need to be handled manually.
Syntax isn't perfect yet because of various casts. But it will allow to have a
single emitter syntax and rely on type safety on the future.
Conflicts:
pcsx2/x86/iR3000Atables.cpp
pcsx2/x86/ix86-32/iR5900-32.cpp
Mostly relevant if the GS window is set to not hide while paused, but also shows
when the emulation is paused due to plugin config etc.
The string <PAUSED> is configurable via the template at PCSX2_ui.ini (including
making it empty) but currently it always appear at the begining of the title.
It's now possible to press ESC once to pause, and ESC again to resume (or assign
any other key via PCSX2_keys.ini, e.g. to SPACE).
Note that resume only works if the GS window is NOT set to hide on pause (Emu
options -> GS Window), and if the key is pressed while the GS window is focused.
This includes two related changes:
- The command name at PCSX2_keys.ini is now changed to Sys_SuspendResume.
- If the GS window is NOT set to hide on pause, then it stays focused on pause.
--nogui also gains this behavior, so it's now possible to launch without a GUI
and still suspend/resume if the GS window is not set to hide on pause. If it is
set to hide on pause, then the behavior remains as it was: exit PCSX2 on pause,
or prompt to exit/resume if --noguiprompt is provided.
Only relevant if the GS window is set to NOT hide when paused. At this case
there were two issues on Windows:
- Commands were invoked twice.
- Non-special-keys (e.g. plain 'q') were not handled at all.
Not terribly important now, but it prepares for the next commit.
Also rename a function to have a more meaningful name.
Regression introduced in 81891ac1097f28fc97c0bd4226b0b72394c2ef69;
assigning "" to a wxString results in an ambiguity error when building
with wxWidgets 2.8 (this could well be a bug in wxWidgets). The default
wxString constructor creates an empty string anyway, so these assignments
are unnecessary.
Previously Interlaced (Field) was displayed as Progressive which was wrong since the tested games didn't even support Progressive mode and it misleaded most of the users so let's just display Interlaced during Field mode.
The EE/IOP and VUs panels were disabled completely when presets are enabled,
which apparently also means disabling (graying out) the static texts, however,
re-enabling them (when disabling presets) didn't un-gray-out the static text.
This is likely a wxWidgets bug, but we can avoid it by just enabling/disabling
all items explicitly (and keeping the panels themselves always enabled).
For these panels, this means adding explicit enable/disable of the he EE-cache
checkbox and the Restore-Defaults buttons.
The issue doesn't seem to happen on other panels (though some earlier revisions
apparently also had this issue for the static text at the game fixes panel, but
apparently it's not an issue now).
Use close() instead of some dodgy read unblocking and thread cancelling
sequence - it fixes a race condition when closing PCSX2.
Move most of the setup/cleanup into LinuxPipeThread. In addition to
simplifying things, it should also mean that no messages to
stdout/stderr are lost - in the previous code there was a small period
of time where messages would disappear.
No one knows how any games even started in the broken state and we prefer code being sane('ish) over one game miraculously working. The change is pretty big so it needs some good testing!
There are 2 pages that contains a register context to handle Syscall/Interrupt.
Write protection is useless here.
The only purpose is to reduce the number of useless SIGSEGV at the start of a game
VIF recompilers: full size
EE/MVU/IOP: 1/4th of the size
Lazy allocation is still enabled but it will less triggered.
Next step is to always commit the first block
Let's the kernel manage the memory either with builtin lazy allocation or
swapped memory.
Avoid to handle SIGSEGV manually (nicer for debug) and removes 250 lines of code.
The window is redrawn when Layout() is used (I think), so the text is
repainted with the correct colour.
This fixes the gray/ungray behaviour in the Emulation Settings dialog.
(Specifically, it affected the GS, Speedhacks, and Game Fixes Panel).
From the comment, it used to be bad to gcc alignment issue.
Recent gcc align the stack on 16B boundary. Maybe it solved the issue.
I play severals minutes without any crashes but it requires more tests.
The current redirection code doesn't work on VS2015:
- It relies on undefined behaviour (*stdout/*stderr = *fp)
- stdin/stdout/stderr are not pre-opened when compiled with the v140*
toolkits
- It seems to be the reason PCSX2 fails to terminate properly.
Use a combination of named pipes and freopen to redirect stdout/stderr.
Note: The redirect stuff doesn't seem to work in debug builds, both
before and after the change.
CID 147025 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)8. uninit_member: Non-static class member m_current_count is not initialized in this constructor nor in any functions that it calls.
CID 147005 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)2. uninit_member: Non-static class member PrePrefix is not initialized in this constructor nor in any functions that it calls.
CID 146995 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)member_not_init_in_gen_ctor: The compiler-generated constructor for this class does not initialize cpu
CID 146990 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)6. uninit_member: Non-static class member PluginId is not initialized in this constructor nor in any functions that it calls.
CID 146984 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)6. uninit_member: Non-static class member m_performFileWrites is not initialized in this constructor nor in any functions that it calls.
CID 146980 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)2. uninit_member: Non-static class member m_panel is not initialized in this constructor nor in any functions that it calls.
CID 146979 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)2. uninit_member: Non-static class member m_miscGroup is not initialized in this constructor nor in any functions that it calls.
CID 146978 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)4. uninit_member: Non-static class member s_rightside_buttons is not initialized in this constructor nor in any functions that it calls.
CID 146977 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)6. uninit_member: Non-static class member SizeInMB is not initialized in this constructor nor in any functions that it calls.
-Fixes other Chessmaster hang.
-having it say it has data really quickly if the data incoming was huge seemed to throw it off. I suspect it may actually be the time it takes to fill 16qw (or whatever is incoming if lower) is the wait time but it seems rather happy with the incoming data size.
On linux, it breaks the 16B stack alignment requirement.
2 dispatchers were added to handle the call to the function. It avoid
any performance impact and remove the extra inlined asm
Fix#506
It changes nothing but it is more consistent
CID 146916 (#1 of 1): Arguments in wrong order i
(SWAPPED_ARGUMENTS)swapped_arguments: The positions of arguments in the call to disBranch do not match the ordering of the parameters:
rt is passed to rs
rs is passed to rt
Bind doesn't work on wx2.8. Replace with event tables and Connect.
wxString::Format also requires the format string to be L"something".
const char* requires an explicit conversion to wxString.
The show 128/64/32 bit menu column stuff doesn't have a direct wx2.8
replacement so just omit it - I'm not sure it's useful functionality
anyway.
-Coverity CID 152835 & 152834: The expression's value does not depend on the operands; often, this represents an inadvertent logic error.
In psxRcntWcount32(int, unsigned int): An operation with non-constant operands that computes a result with constant value (CWE-569)
CID 146889 (#1 of 1): Dereference null return value (NULL_RETURNS)4. dereference: Dereferencing a pointer that might be null wxGetApp()->GetDisassemblyPtr() when calling update
FindWindowById returns NULL if the Window with the given id is not found, no need to do a extra check for validation of the id. also do a check for wxGetApp()->GetDisassemblyPtr() to prevent a null deference.
-Fix up Vsync again, broken back in google code days, broke Fatal Fury, matches PS2 test again.
-Corrected the Vsync Gate 0, which was the wrong way around, Causing Legendz Gekitou not to work unless Vsync was wrong
Coverity seems to not like the assert trick and only considers the macro as a single statement, so let's rework branchAddr and branchAddrN to satisfy coverity and improve the code quality. The following patch fixes 8 coverity issues with the same problem , CID 151736 - 151743.
(#1 of 1): Misused comma operator (NO_EFFECT)extra_comma: Part !!((mVU.prog.IRinfo.curPC & 1U) == 0U) of statement (!!((mVU.prog.IRinfo.curPC & 1U) == 0U)) , ((mVU.prog.IRinfo.curPC + 2U + (s32)((mVU.code & 0x400U) ? 0xfffffc00U | (mVU.code & 0x3ffU) : (mVU.code & 0x3ffU)) * 2 & mVU.progMemMask) * 4U) has no effect due to the comma.
CID 146848 (#1 of 1): Using invalid iterator (INVALIDATE_ITERATOR)
8. use_iterator: Using invalid iterator existing.
Directly edit the value through the iterator.
There's only one plugin api for this, but GSdx also checks whether shift/ctrl
are held down, so PCSX2 needs to map those too to the same API.
Make this more systematic by only mapping one shortcut to this API, and then
deriving the other two from it amd mapping them too automatically.
This also makes it possible to override it at PCSX2_keys.ini since now it
doesn't need to handle different shortcuts for the same function (which it still
can't handle, but now it also doesn't need to for this function).
Apparently I logged the values incorrectly previously. I said
that shift-q gets parsed as Q without shift, but actually the shift flag
is set correctly on such case (though the letter is still upper case for shift-q
and it's still lower case for plain q)
So I retested all the 8 modifiers combination, and noticed that the modifiers
are always parsed and set correctly, but the letter ends up upper case if any
modifiers are used, but lower case if no modifiers are used.
We still need to make lower if it's upper, but don't need to add the shift flag.
This patch fixes 3 different issues for wx event key codes and the ini parser.
- The ini parser (for PCSX2_keys.ini) parses symbols and letters correctly,
but parsed `shift-q` as `Q` without shift. Now it's parsed as `q` with shift.
- the wx event keycode has the shift flag set correctly, but always has the
upper case code for letters (e.g. `Q` when `q` was pressed, and `Q` with shift
flag when shift-q is pressed). Now uses lower case for letters.
- For symbol-only keys (e.g. `-` or `=`), the keycode is the MS VK_.. thingy,
e.g. for `=` it passed 187 instead of 61, or for `.` it had 190 instead of 46.
Now returns the ascii code where possible (assuming US KB layout).
Also, when the DevCon is enabled, all key presses are printed to the console in
a format which could be copied to pcsx2_keys.ini, so this should allow also
non-US KBs to be set up for arbitrary symbols.
It should now be possible to use letters and symbols at PCSX2_keys.ini or as
default accelerators definitions within the code.
Note: this should have supposedly been fixed at r4918 ( 851bfba ), but neither
that build from the buildbot archive, nor the official 1.2.1 release (r5875),
nor the current builds have this working, which is really weird (tested on win8)
This allows to choose which items appear at the title and at which order, as
well as the text and some of the textual values (at PCSX2_ui.ini).
The template's variables (include % if relevant but not the surrounding text):
${slot}, ${limiter}, ${speed}, ${vfps}, ${cpuusage}, ${omodef}, ${omodei}, ${gsdx}
The system treats the GSdx info as a single unit, as well as the CPU usage info.
The UI section (at the CPU usage section) is only visible in devel/debug builds.
The current template values which also demonstrate all the configurable values:
[UiTemplates]
LimiterUnlimited=-unlimited
LimiterTurbo=-turbo
LimiterSlowmo=-slowmo
LimiterNormal=
OutputFrame=frame
OutputField=field
OutputProgressive=p
OutputInterlaced=i
TitleTemplate=Slot: ${slot} | Speed${limiter}: ${speed} (${vfps}) | ${cpuusage} | ${omodef}-${omodei} | ${gsdx}
The previous longer template values:
[UiTemplates]
LimiterUnlimited=None
LimiterTurbo=Turbo
LimiterSlowmo=Slomo
LimiterNormal=Normal
OutputFrame=Frame
OutputField=Field
OutputProgressive=Progressive
OutputInterlaced=Interlaced
TitleTemplate=${gsdx} | Limiter: ${limiter} | ${omodei} (${omodef}) | Speed: ${speed} (${vfps}) | ${cpuusage} | State: ${slot}
wxDataObjectSimple derived classes do not use a wxDataFormatId
parameter (only the wxDF_INVALID, wxDF_TEXT, wxDF_BITMAP, wxDF_METAFILE,
wxDF_FILENAME, and wxDF_HTML wxDataFormatIds are allowed because they
are implicitly converted). So drag and drop probably should have been
broken on Windows, but wasn't for whatever reason.
Let's fix and simplify the code by just using the built in
wxCustomDataObject. Also make move the default drag behaviour on both
Windows and Linux (previously default on Windows only).
It now works on Windows and Linux wx2.8/wx3.0 (previously only working
on Windows).
The goal here is to reduce clutter and to make it more useful by putting the
important values at the begining, and the less used values at the end. The GSdx
string is unmodified, and maybe we could simplify it too in the future.
Previously, the tile displayed the following items in this order:
<GSdx string> - (e.g. GSdx OGL HW | 514x224 | None)
<output mode> - Progressive/Interlaced (Frame/Field)
<limiter mode> - Limiter: None/Turbo/Slomo/Normal
<speed info> - Speed: <100-based-percentage> (<vfps>)
<CPU usage> - EE: <%> | GS: <%> | VU <%> | UI: <%>
<save state> - State: <slot-number>
This patch changes the following to this order and format:
- Move the save state value to the front since it's actually useful.
- The speed value, which now includes the limiter value if not "Normal".
- Then the CPU usage parts, but the UI value only shows on debug/devel builds.
- The output mode, shortened to Frame/Field-i/p
- the GSdx string same as before only at the end
So all the info is still there as before (except UI), but more readable format.
E.g. before (normal limiter and turbo limiter):
GSdx D3D11 HW | 640x512 | None | Interlaced (frame) | Limiter: Normal | Speed: 100% (50.01) | EE: 43% | GS: 4% | UI: 0% | State 0
GSdx D3D11 HW | 640x512 | None | Interlaced (frame) | Limiter: Turbo | Speed: 443% (221.31) | EE: 99% | GS: 16% | UI: 0% | State 0
E.g. after (normal limiter and turbo limiter) for the same values as above:
State 0 | Speed: 100% (50.01) | EE: 43% | GS: 4% | frame-i | GSdx D3D11 HW | 640x512 | None
State 0 | Speed (Turbo): 443% (221.31) | EE: 99% | GS: 16% | frame-i | GSdx D3D11 HW | 640x512 | None
Make sure we exit fullscreen only if the GS window is visible and in fullscreen.
While we don't currently have such cases, it's possible that the Sys_Suspend
command is called while it's already suspended (and the GS window is hidden)
but the code without this patch would have incorrectly made it visible again.
This tries to emulate LilyPad's "Safe fullscreen exit on escape" hack, and
hopefully also makes this LilyPad hack redundant, such that it would fix the
issue also with other input plugins.
The issue that fullscreen was not restored if the --noguiprompt confirmation
was aborted was already fixed implicitly via e4d8af0, therefore the comment
ended up incorrect. Also explain why it was broken when emulation was not
suspended before this commit, and how it could have been fixed.
When using --nogui and --noguiprompt and the user presses ESC, a prompt is
displayed asking the user to confirm exiting/closing PCSX2. This patch suspends
the emulation while this prompt is displayed.
Also updated the comment that if LilyPad has "safe fullscreen exit on ESC", then
full screen is not restored automatically if this prompt is canceled.
Specifying a minimum size for the filename text controls seems to mess
up the size calculations at higher DPIs and causes usability issues.
Use sizers and proportions instead.
Also scale the dialog widths with the DPI.
Retry and abort don't have default labels, so you end up with blank
buttons on both Windows and Linux. Fix it.
Retry is used by the portable mode settings dialog. I'm not sure if
abort is used anywhere.