Commit Graph

7638 Commits

Author SHA1 Message Date
Gregory Hainaut 1c8f8a00b8 Merge pull request #894 from ssakash/coverity_fix
Coverity: Prevent NULL dereferences and other stuffs.
2015-10-17 16:00:28 +02:00
Gregory Hainaut eb387e16f4 onepad: fix compilation on SDL1 2015-10-17 14:38:46 +02:00
refractionpcsx2 706bbcf8a9 IOP Counters: Silly error fixed.
-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)
2015-10-17 12:52:49 +01:00
Gregory Hainaut 4f86cca306 common: don't return a boolean for an assert
It might help to fix those 2 coverity reports.

CID 151744 (#1 of 1): Useless call (USELESS_CALL)
side_effect_free: Calling EnumAssert(id) is only useful for its return value, which is ignored

CID 151745 (#1 of 1): Useless call (USELESS_CALL)
side_effect_free: Calling EnumAssert(id) is only useful for its return value, which is ignored.
2015-10-17 11:49:04 +02:00
Gregory Hainaut 9b796d0f27 Merge pull request #892 from 3kinox/rumble_onepad
Implement rumble and isolate SDL code path
2015-10-17 11:00:06 +02:00
Akash fedd07e4a8 gsdx: prevent a potential division by zero
CID 146834 (#2-1 of 2): Division or modulo by zero (DIVIDE_BY_ZERO)9. divide_by_zero: In expression tpf * 10000ULL / ttpf, division by expression ttpf which may be zero has undefined behavior.
2015-10-17 11:26:11 +05:30
Akash b8caab5f3d pcsx2: prevent a potential null deference
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.
2015-10-17 11:26:08 +05:30
Akash 04b765a674 gsdx: check for null deference.
CID 146839 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)11. var_deref_model: Passing null pointer fb_pages to UsePages, which dereferences it.

CID 146840 (#1 of 1): Explicit null dereferenced (FORWARD_NULL)11. var_deref_model: Passing null pointer zb_pages to UsePages, which dereferences it.

* Prevent a potential null pointer deference in ```void GSRendererSW::UsePages()```
2015-10-17 09:14:07 +05:30
3kinox d7155f839f onepad:
+ Implement and activate rumble.
2015-10-16 23:55:18 +02:00
3kinox fb0d7139f2 onepad:
+ Isolate every SDL code paths and replace any call to them by call to a generic class "GamePad" of which JoystickInfo is now a child.
+ Now backends can be added by inheriting GamePad generic class.
+ There is just one function change which is redundant with next commits but otherwise commit will not compile(which is more evil).
2015-10-16 23:53:51 +02:00
3kinox 9ab554af5b onepad:
+ Objectify conf class.
+ Make some members private as they need to have their range checked before being set
+ Change "options" variables into an union contraining bitfield representation of it. Allows to make code more expressive/readable.
2015-10-16 23:47:55 +02:00
Gregory Hainaut 096e5e1fef spu2x: correctly apply the volume to the external source
CID 147046 (#1 of 1): Useless call (USELESS_CALL)
side_effect_free: Calling ApplyVolume(Ext, Cores[1].ExtVol) is only useful for its return value, which is ignored.
2015-10-16 23:17:07 +02:00
Gregory Hainaut 03bc304ecf gsdx-ogl: fix colclip regression when accurate blending is enabled
Fix #865
2015-10-16 22:07:50 +02:00
refractionpcsx2 9a2212c86e IOP Counter/IRQ: Misc Counter and IRQ handling changes based on NoCash documents for PS1. 2015-10-16 00:48:26 +01:00
refractionpcsx2 d01f8f9252 VSync/EE Counters: Fixes for Fatal Fury BA 1 & Legendz Gekitou! Saga Battle
-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
2015-10-16 00:38:04 +01:00
byehi5299 f7e10ed53e Rewrite of CtrlRegisterList class to enable scrolling. 2015-10-14 18:11:22 -04:00
refractionpcsx2 bbd74e5a7e Merge pull request #891 from ssakash/MicroVU_branch_addr
MicroVU: Replace BranchAddr macro with an Inline function
2015-10-13 16:36:35 +01:00
Akash 71dbe3e4c4 MicroVU: Replace BranchAddr macro with an Inline function
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.
2015-10-13 20:25:02 +05:30
Gregory Hainaut 4d680b73dc pcsx2 debugger: don't use erased iterator
CID 146848 (#1 of 1): Using invalid iterator (INVALIDATE_ITERATOR)
8. use_iterator: Using invalid iterator existing.

Directly edit the value through the iterator.
2015-10-13 00:17:28 +02:00
Gregory Hainaut 7c69958c92 i10n: add zh_TW 2015-10-12 23:48:02 +02:00
Gregory Hainaut 3027b4b694 pcsx2: exit function if we can't allocate an xmm register
Allocation must always succeed
2015-10-12 23:45:43 +02:00
refractionpcsx2 4560620210 GS-Wnd: Fix UI to show UI percentage. Set defaults for the title bar. Add a sort of lie mode omodec, which says you are using progressive when Interlace(Field) is active as this most isn't technically interlaced but actually half FPS, see this comment https://github.com/PCSX2/pcsx2/issues/832#issuecomment-141248883 2015-10-12 21:21:46 +01:00
refractionpcsx2 b3d9feb1f2 Merge pull request #880 from PCSX2/coverity-negative-index-array
pcsx2: forbid negative index of array in case of register allocation failure
2015-10-12 20:52:28 +01:00
Gregory Hainaut 90df78c9e0 Merge pull request #874 from pcsx2fan/master
Update GUI Translation for Chinese Traditional aka zh_TW
2015-10-12 21:47:57 +02:00
Gregory Hainaut 63889d3bea pcsx2: replace error message with a dev assert
Code mustn't be reached. Otherwise registers aren't properly freed
2015-10-12 21:38:27 +02:00
Avi Halachmi (:avih) 5379b89dbd gui: kb shortcuts: handle Sys_TakeSnapshot with shift/ctrl better
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).
2015-10-12 04:04:14 +03:00
Avi Halachmi (:avih) 69a978fe05 gui: kb shortcuts: yet another fix for the ini parser
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.
2015-10-12 03:33:50 +03:00
Avi Halachmi (:avih) efeb66c852 gui: kb shortcuts: fix z shortcut 2015-10-12 01:55:45 +03:00
Avi Halachmi (:avih) a76914a4b1 gui: kb shortcuts win: faster VK to WX translation with a table 2015-10-11 20:11:33 +03:00
avih 302bf29b6a Merge pull request #887 from PCSX2/wx-normal-keys
gui: kb shortcuts: fix incorrect wx key codes for "plain" keys
2015-10-11 09:28:35 -07:00
Avi Halachmi (:avih) 68b4d54f18 gui: kb shortcuts: fix key codes for "non-special" keys
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)
2015-10-11 19:25:24 +03:00
refractionpcsx2 31ee576d6a Sif: Limit/Mask transfer size to 1mb-16, thanks to jpd002 (Play!) for the fix!
Fixes #643 Gregory Horror Show, which seems to be playable (from nothing!)
2015-10-08 20:02:15 +01:00
Avi Halachmi (:avih) 9b988ee12d GS window title: use a template system to satisfy everyone
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}
2015-10-08 06:05:45 +03:00
refractionpcsx2 4e22dc4987 3rd Party: Update Soundtouch (Timestretching) to 1.9.2.
2 notable changes which are welcomed.

-Improved SoundTouch::flush() function so that it returns precisely the desired amount of samples for exact output duration control

-Redesigned quickseek algorithm for improved sound quality when using the quickseek mode. The new quickseek algorithm can find 99% as good results as the default full-scan mode, while the quickseek algorithm is remarkably less CPU intensive.
2015-10-08 01:18:15 +01:00
Jonathan Li d3ddf55df1 gui: Remove unused memory card dialog drag and drop code
The code seems to be leftover from a much older implementation.
2015-10-07 21:54:24 +01:00
Jonathan Li 80727aa4cc gui:linux: Fix memory card dialog drag and drop assertion
The assertion is a wxDateTime invalid assertion. But I have no idea why
it happens, and why it only happens on Linux.
2015-10-07 21:54:24 +01:00
Jonathan Li 919bdf05fe gui: Fix/simplify memory card dialog drag and drop
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).
2015-10-07 21:53:32 +01:00
Avi Halachmi (:avih) abdb8266b6 GS window title: change State to Slot, minor limiter simplification 2015-10-07 04:44:05 +03:00
Avi Halachmi (:avih) 31813c29af GS window title info: improve, shorten
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
2015-10-07 04:08:09 +03:00
Avi Halachmi (:avih) 75b2406997 macros: fix pxReleaseCode (was inverted), add pxNonReleaseCode
pxReleaseCode was not used at the code so nothing is affected.
pxNonReleaseCode will be used at the next commit.
2015-10-07 04:08:09 +03:00
Jonathan Li addf3d5331 pcsx2: Throw the exception
Coverity CID 146842: Dereference after null check (FORWARD_NULL)
2015-10-07 00:37:40 +01:00
Jonathan Li 76e61d4ef1 Merge pull request #863 from turtleli/gsdx-dx-select-shader
gsdx:windows: refactor dx9/dx11 compile shader code, allow external
shader selection via GUI, widen and rearrange GUI
2015-10-07 00:18:04 +01:00
Avi Halachmi (:avih) 7d6a73ab27 LilyPad: in PS2 mode - disable configs/hacks which PCSX2 doesn't need
Disable and overrides the following hacks at the config and dialog:
- Disable screensaver
- Safe fullscreen exit on escape
- save state in title

All of those are hacks which PCSX2 doesn't need anymore and therefore are just
confusing if enabled.

Note that we assume PCSX2 is synonym for PS2 mode in LilyPad, and while AFAIK it
is the case now, it might need a more fine grained override system.
2015-10-07 01:22:47 +03:00
Avi Halachmi (:avih) fa04f0970e gui: ESC on fullscreen: better resilience
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.
2015-10-07 01:10:43 +03:00
Avi Halachmi (:avih) 9c1688a39a GS window: try to fix ESC on fullscreen sometimes not exiting correctly
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.
2015-10-06 19:09:45 +03:00
Avi Halachmi (:avih) 4522418890 GSFrame: remove unused style argument at ShowFullScreen 2015-10-06 19:01:24 +03:00
Avi Halachmi (:avih) 2cd0829a8d updated a comment that --noguiprompt also works correctly at fullscreen
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.
2015-10-06 15:31:36 +03:00
Avi Halachmi (:avih) e4d8af0c97 gui: exit prompt for --noguiprompt: suspend while visible
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.
2015-10-06 02:08:28 +03:00
Jonathan Li 5f2e60d751 gui:windows: Scale confirmation dialogs at high DPI
This should scale all the other dialogs that don't have specifics widths
set.
2015-10-05 20:11:20 +01:00
Jonathan Li 31b1e34ae8 gui:windows: Fix memory card dialogs at high DPI
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.
2015-10-05 20:10:40 +01:00