Commit Graph

483 Commits

Author SHA1 Message Date
Gregory Hainaut 74db92bee4 Merge pull request #978 from juhalaukkanen/apple_osx_master_merge
OSX 32bit build
2016-01-08 20:09:37 +01:00
Gregory Hainaut 4f28403c03 Merge pull request #972 from PCSX2/clean-gcc-opt-cmake
cmake: reenable a couple of missing gcc optimization
2016-01-08 19:32:18 +01:00
Gregory Hainaut 21445fe0d0 x86emitter: Add several architecture dependant wrapper
* A nice object to create the stack frame
* Various xStdCall/xFastCall to emulate standard & fast call
2015-12-02 19:06:52 +01:00
Juha Laukkanen 7edf747e84 Darwin/OSX Mutex & MAP_ANON vs. MAP_ANONYMOUS.
OSX compilation fix: mutex: Windows
2015-12-02 05:00:23 +02:00
Jonathan Li 57ad97d212 x86emitter: Remove bool_to_char
It was unused.
2015-11-29 10:58:32 +00:00
Jonathan Li 4d97089990 x86emitter: Fix Windows AVX2 detection
Technically it did work, but it was undefined behaviour. Use __cpuidex,
which allows setting ecx as well.

Also fix the _xgetbv intrinsic - I have no idea how PCSX2 even
compiled on Windows.
2015-11-29 10:57:51 +00:00
Gregory Hainaut 9aec4229d5 x86emitter: support AVX2 (linux only?)
Nah kidding, it is only the cpu detection for the log

x86 Features Detected:
	SSE2.. SSE3.. SSSE3.. SSE4.1.. SSE4.2.. AVX.. AVX2.. FMA
2015-11-28 23:40:15 +01:00
Gregory Hainaut 02186d5a54 x86emitter: always use fxsave intrinsic/asm 2015-11-28 22:19:42 +01:00
Gregory Hainaut d5efd6eacb x86emitter: remove the never called SIMD_ExceptionTest function 2015-11-28 22:02:08 +01:00
Juha Laukkanen f813b9e25b Darwin/OSX semaphore & thread & os backend. 2015-11-17 19:30:20 +02:00
Gregory Hainaut 21857ec12d Merge pull request #967 from PCSX2/remove-lazy-allocation
Reduce lazy allocation
2015-11-15 00:12:07 +01:00
Gregory Hainaut d5830ef708 cmake: reenable a couple of missing gcc optimization 2015-11-14 09:54:09 +01:00
Gregory Hainaut 4bfb60865c common: ifdef x64 specific code
gcc warning:  set but unused
2015-11-12 12:10:49 +01:00
Gregory Hainaut 7565bcc789 ee: drop SpatialArrayReserve allocator
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.
2015-11-12 10:35:10 +01:00
Gregory Hainaut 870e799baa memcpy: remove AMD copyright
memcmp comes from zerofrog (him or external) but likely not AMD

https://www.cs.virginia.edu/stream/FTP/Contrib/AMD/memcpy_amd.asm
2015-11-07 15:57:34 +01:00
Jonathan Li 08dfa20da1 utilities:linux: Add function to change stdout stream
stdout is not necessarily at stdout - at least not after I'm done with it.
2015-10-31 13:50:02 +00:00
Jonathan Li 618ef8b549 pcsx2:linux: Use narrow characters for stdout
Things seem to break when you mix wide and narrow characters.

Plugins messages sent to stdout are now viewable.
2015-10-29 19:09:49 +00:00
Gregory Hainaut 2eb73644e9 pcsx2|common: use DESTRUCTOR_CATCHALL to catch exception in various destructor
Allow to print a nice error message instead of a brutal abort in case of
massive failure
2015-09-23 09:47:27 +02:00
Gregory Hainaut 8083b2c754 common: init values in the constructors of SpatialArrayReserve and pxStaticText 2015-09-23 09:47:27 +02:00
Gregory Hainaut b60dd9d1fe Merge pull request #814 from PCSX2/coverity-qa-high
Fix a bunches of coverity warning/errors.
2015-09-20 22:18:03 +02:00
Jonathan Li 67dc65ea91 linux: Fix _aligned_realloc implementation
Out-of-bounds memory is no longer accessed if the realloc size is larger.
If reallocation fails, the old memory will not be freed and a memcpy
will not take place.

This should match the Windows _aligned_realloc behaviour, except that an
extra parameter is used.
2015-09-13 21:05:33 +01:00
Miguel A. Colón Vélez f1cb2cfa35 Fix segmentation fault with the new libstdc++ ABI.
Local variable goes out of scope and everything goes boom.
2015-09-12 17:35:45 -04:00
Jonathan Li 5c6915f633 utilities: Simplify _aligned_malloc wrapper
Windows doesn't actually use it at all, so let's exclude it from the
VS build. Also include ScopedAlloc.h into the VS project file.
2015-09-12 10:01:04 +01:00
Jonathan Li 8312e21f00 utilities: Cleanup unused memcpy defines
All refer to memcpy, and only memcpy_fast is used, so there's no point
keeping them.

Also remove the _memset16_unaligned function prototype since there's no
function definition for it.
2015-09-12 10:00:49 +01:00
Jonathan Li 239306e9a2 pcsx2|gsdx:linux: Fix posix_memalign
The AddressSanitizer can be used on Linux again. Well, PCSX2 doesn't get
very far when it's used though.
2015-09-12 09:58:00 +01:00
Gregory Hainaut 0260c9119e common: suspicious missing comma 2015-09-11 08:54:29 +02:00
Jonathan Li e2f1bafeef gui:windows: Fix tooltip wrapping
wxWidgets 3.0 now wraps tooltips automatically on Windows, so the custom
tooltip wrapping functionality is no longer necessary.
2015-09-04 22:54:11 +01:00
Jonathan Li cc1d50a06c gui:windows: Show tooltips for as long as possible.
It'll show for 32.767s. Windows unfortunately doesn't have an infinite
value, and also uses a signed 16-bit integer for the delay.
2015-09-01 18:14:03 +01:00
Miguel A. Colón Vélez f29dd8b927 Fix Windows XP Home vs Pro detection.
VER_SUITE_PERSONAL is set for XP Home therefore the check was backwards.
2015-08-26 16:02:26 -04:00
Miguel A. Colón Vélez 45fc9603e3 Recognize Win 8, 8.1 and 10.
https://msdn.microsoft.com/en-us/library/windows/desktop/dn481241(v=vs.85).aspx
Windows 8.1 and 10 require a manifest file or they will be reported as
6.2 which is Windows 8.
.
Also add the information for Win 8, 8.1 and 10 in the WinMisc.cpp file.
2015-08-25 21:30:27 -04:00
nE0sIghT e1272dc2f9 Use global compiler optimization flags instead of defining them for every plugin/binary 2015-08-08 16:25:17 +03:00
Avi Halachmi (:avih) d38d046f7a gui: EE and VU panels: restore defaults programatically
The code was restoring the defaults with hardcoded values. This patch
restores the values however they're defined as defaults for AppConfig.

The code still uses hardcode values to set the highlights (bold) of the
default radio button text - using SetDefaultItem.

Note that other than these two panels, the speedhacks panel is the only other
which has a restore-defaults button, and it already does so programatically.

It's probably not worth trying to unify these three restore-defaults button
into a single system.
2015-08-06 00:38:13 +03:00
Gregory Hainaut f4c22ce932 Merge pull request #612 from turtleli/ui-event-handling-fixes
gui: Dialog handling fixes and cleanup
2015-06-26 15:23:50 +02:00
Jonathan Li 2a4bd85f53 gui: Fix looping dialog event handling
The dialog event handling is a bit messed up. An ok/cancel event sends a
close event, which sends a cancel event and repeats. This would actually
be an infinite loop if wxWidgets didn't detect a loop.

Rework the event handling to avoid the loop and to remember the
positions of modal dialogs as well.
2015-06-25 16:46:20 +01:00
Jonathan Li d9447de492 linux: Fix close button on minimisable modal dialogs
Keep Windows platform specific fixes ifdef'd to Windows only.
2015-06-25 15:45:45 +01:00
Jonathan Li 8de94a3714 Fix string handling on Windows wxWidgets 3.0 2015-06-19 22:14:49 +01:00
Gregory Hainaut ce2b87343b fix linux compilation sigh... 2015-06-06 00:25:26 +02:00
Jonathan Li 467e40fa81 Fix AlignedMalloc on Windows 2015-06-05 21:55:17 +01:00
Gregory Hainaut a2a9b6252a common: fix compilation 2015-06-05 21:18:21 +02:00
Gregory Hainaut 4feeaac7d1 Merge branch 'alignment' of git://github.com/xsacha/pcsx2 into xsacha-alignment
Gregory: Get all changes but keep C11 code path which will be the future
 (if someone can find info on Visual Studio support)
* Keep the old posix api to use address sanitizer on gcc 4.9

Conflicts:
	common/build/Utilities/utilities.vcxproj.filters
	common/build/Utilities/utilities_vs2012.vcxproj.filters
	common/build/Utilities/utilities_vs2013.vcxproj.filters
	common/include/Utilities/MemcpyFast.h
	common/include/Utilities/StringHelpers.h
	common/src/Utilities/AlignedMalloc.cpp
	common/src/Utilities/vssprintf.cpp
	plugins/GSdx/stdafx.cpp
2015-06-05 20:31:14 +02:00
Gregory Hainaut b49d65295f Merge pull request #457 from PCSX2/clean-gcc-flags
cmake: use O2 instead of every compiler flags
2015-06-05 16:26:42 +02:00
Gregory Hainaut 87bcb465c6 common: fix gcc 5.0 issue
Don't use const for variable object

Close issue #560
2015-05-27 18:20:06 +02:00
Gregory Hainaut 18a6403852 common-wx3: fix nasty bug between overload function of pxOnAssert 2015-05-19 17:40:38 +02:00
Gregory Hainaut 781c1df5d0 Merge pull request #486 from PCSX2/c++11-vssappendf
C++11 vssappendf
2015-04-11 13:15:25 +02:00
Avi Halachmi (:avih) 8a5c8ab91c fix: disable screen saver (pcsx2_ui.ini - DisableScreenSaver)
there was already code for this, but it was broken due to:
- the message is WM_SYSCOMMAND and wParam is SC_SCREENSAVE etc.
- GSPanel doesn't get WM_SYSCOMMAND - GSFrame does.
- also disabled screen saver while paused if not set to hide the GS window.
- it's an ugly hack where windows keeps trying to activate the screen saver
  every few seconds but such code prevents it (Lilypad has the same hack).

the new code uses windows API which was designed for this.

the screen saver is now disabled while the window is focused and the emulation
is running. it's on by defauly and without GUI - the same as with normal games.

this patch addresses Windows only, but adds a placeholder for future
implementations for other platforms.
2015-04-05 19:50:31 +03:00
Gregory Hainaut fd71fc4fc9 common: drop useless printf function + reimplement vssappend with C++11
Performance is not important here. I'm not sure Windows could handle VLA
* new/delete can still be used otherwise.
* Put an assert(0) because debugger surely don't use string bigger than
  128 bytes.

code is much more compact 20 lines vs 700 lines ...
2015-03-23 23:14:54 +01:00
3kinox 4211d51f07 64 bits: solve various of type problems 2015-02-27 22:07:13 +01:00
Sacha b2738fdd5b Remove 3dnow (unused, obsolete).
Greg: merge the removal of EMMS stuff
2015-02-27 21:12:34 +01:00
Gregory Hainaut a9430bb25e cmake: use O2 instead of every compiler flags
It was done to avoid issue with specific compiler flags. I think it is safe to reenable it now.

There are some flags that are still disabled that potentially could be re-enabled:
-fno-guess-branch-probability
-fno-dse
-fno-tree-dse

But it will be for another PR
2015-02-20 19:47:54 +01:00
Gregory Hainaut 29ef99d2d1 windows build take3: revert previous commit
Use back _Interlocked* function
Use vol_t type for all variables that uses _Interlocked* function
    (so it is compatible with 64 bits)
2015-01-18 19:25:46 +01:00
Gregory Hainaut 6d4039cc85 More fix for windows (extend previous commit) 2015-01-18 13:08:47 +01:00
Gregory Hainaut 4cf1b6068f common: fix windows build (hopefully)
* Use threading wrapper for Mutex.cpp/wxHelpers.cpp
* Cast s32 to long on window

(not tested on windows ;) ping me if it still doesn't work)
2015-01-17 20:39:38 +01:00
Johannes Obermayr 149940ffda common: gcc can't inline a couple of function
=> "can never be inlined because it uses variable argument lists"
2015-01-16 20:57:09 +01:00
Gregory Hainaut 04ca7f4a2b common: 64 bits intrinsic fixes
long is 8B on linux. Replace it with s32
long long is always 8B but let's replace it with s64 so we are sure
2015-01-05 23:46:18 +01:00
Gregory Hainaut aba0a09816 pcsx2 64b: fix crash on string formating function
Call to vsnprintf update the gp_offset of the varargs (at least on x86_64 linux).
Therefore the 2nd call (because buffer was too small) uses out-of-memory arguments

We need to keep a local copy otherwise you will get an awful SIGSEV

Note: I'm sure we have same issue on plugins
2015-01-05 23:38:30 +01:00
Gregory Hainaut 0b77f93154 console: improve readability on consoles that have black backgrounds
Thanks Micove for the patch.

Close issue #383
2014-12-21 12:41:01 +01:00
Gregory Hainaut 66d7aa75e2 cmake: move -DNDEBUG to global option 2014-12-20 13:43:25 +01:00
Gregory Hainaut 768362852e pscx2: s/wxTrap/pxTrap/
wxTrap is only enabled on wxDebug build. pxTrap is always available. It is much nicer for debug on linux
2014-12-13 12:28:37 +01:00
Miguel A. Colón Vélez c7c8b70b22 Don't buffer the changes to the console colors.
After a Console.Write/Writeln that uses colors a call to
ConsoleColorScope::LeaveScope() is made to restore m_old_color. This
restoration command stays buffered until a full line is printed. In the
meantime any console message that happens will use the old coloring
and if the program happens to crash the console would keep using the
color of the last colored text that was printed.
2014-12-12 19:44:45 -05:00
Gregory Hainaut a52f598369 spu2x:zzogl: disable TLS
builds an Utilies_NO_TLS.a archive of the common Utilities code. It replaces native TLS by a slower reimplementation

Rational: number of TLS slot is very limited by the GLIBc on linux. I hope it doesn't impact performance.
* Zzogl don't requires TLS AFAIK
* spu2x will likely use it for assertions only.

TLS exhaustion creates issue to dlopen plugins
    issue #384 : https://github.com/PCSX2/pcsx2/issues/384

But also for profiled build (-fprofile-generate)
    http://forums.pcsx2.net/Thread-WORKAROUND-build-with-fprofile-generate

If someone have a better idea, please raise your hand!
2014-12-08 22:26:46 +01:00
Gregory Hainaut 070dce4c83 Merge pull request #356 from PCSX2/issue-fixes
various bug-tracker fixes
2014-12-06 19:48:13 +01:00
Nicolas Hillegeer b259a46ab7 linux/threads: simplify timer code
Possibly also changes the semantics. According to the docs, it should now be
equal to the Windows code (up to accuracy issues, of course).

v2: done by gregory38

Fix miscalculation of time. Unit must be in 1s/GetThreadTicksPerSeconds(). (now us)

Factorize a bit GetCpuTime/GetThreadCpuTime

Note: results seems reasonables and mostly equivalent as before.
2014-11-24 23:31:32 +01:00
Gregory Hainaut 5d89454d25 wx: properly overwrite trait creation
The fix move the Pcsx2AppTraits definition from core to common part.
It allows to use it in wxAppWithHelpers::CreateTraits

fix issue #352
2014-11-22 18:51:05 +01:00
Gregory Hainaut 69e88ffed0 common: remove old memcpy implementation
PCSX2 used standard memcpy now (thanks to xsacha)
2014-11-04 09:20:47 +01:00
Gregory Hainaut 5b3f031654 cmake: fix commit f3a50a01a7
* link common with c lib (required for gold linker)
* fix the macro to properly set the library variable
  => use the variable instead to hardcoded value
2014-09-24 09:02:56 +02:00
Sacha bf7c29e4cd Disable memcmp_mmx for non-msvc compilers and 64-bit. Remove MemcpyFast.S (Linux). 2014-09-16 17:53:54 +10:00
ramapcsx2 98d22f8b2e Merge pull request #215 from xsacha/memcpy
Remove some slow, redundant memcpy implementations: memcpy_const/memcpy_...
2014-09-12 19:57:57 +02:00
Gregory Hainaut b9e6024fe9 Merge pull request #282 from xsacha/emitter-cleanup
common: Remove two unused files in emitter, inlines.inl and macros.h
2014-09-12 19:30:34 +02:00
uyjulian f3a50a01a7 cmake: Use previous macros in CMakeLists.txt files
Gregory: add a c lib for zzogl-pg-cg replayer
2014-09-05 20:16:23 +02:00
Sacha 378556c0c2 Remove two unused files in emitter, inlines.inl and macros.h 2014-08-27 22:40:26 +10:00
Sacha b47a4da81f Use 64-bit compatible rdtsc for Linux. Remove some more intrin_x86 functions. 2014-08-27 18:49:44 +10:00
Sacha ad3b76c4d8 Remove all custom memcpy usage from core pcsx2 and remove memcpy_fast from plugins. 2014-08-27 13:45:23 +10:00
Sacha 999eb83de8 Remove unused _InterlockeD* functions. 2014-08-25 04:57:03 +10:00
Sacha 2ba0b1b76b Use posix_memalign and _aligned_malloc for alignment. Remove unused code. 2014-08-17 21:03:43 +10:00
Ryan Houdek 3d37a6ce27 Removes the usage of __LINUX__ define
This is defined and set it a ton of different places.
It's checked in a whole lot more
Instead just use __linux__ like a real project should
2014-08-03 13:20:36 -05:00
Gregory Hainaut 82c7bcd761 wx3.0: compilation fix for arch linux
* Manually cast WxGetTranslation
* Accept string as format parameter of pxWindowTextWriter
* Manually convert wxString to wide string

Note: Wx setup.h is not the same between Debian and Arch. Unfortunately it
generated various compilations errors on wx code.

Close issue #172
2014-08-03 14:54:44 +02:00
Gregory Hainaut e99540554a wx3.0: clang complains about support of reference in varargs 2014-08-03 14:43:08 +02:00
Pseudonym 3e65c1d0a3 Just killing a couple of latin-1 characters my editor was complaining about. 2014-07-31 16:17:37 +01:00
Pseudonym e25ad9759a Merge pull request #178 from Sonicadvance1:x86_64-cpudetect
Support grabbing the MXCSR mask on x86_64.
2014-07-31 16:14:49 +01:00
Ryan Houdek 06ccc0121f Support grabbing the MXCSR mask on x86_64.
Instead of using some dynamic code to grab the FXSave information, use an intrinsic if on at least MSVC 2012.
With GCC just use a bit of ASM, and if on MSVC 2010 or older, use the old crappy method.

This method can be removed once MSVC 2010 support is dropped and mandate at least MSVC 2012 minimum.
2014-07-31 10:11:25 -05:00
Ryan Houdek b4771030d3 Fix a couple issues in the x86emitter on x86_64.
This won't fix the billions of errors that will happen at runtime of using the x86 emitter, but chooses to make some better coding practice choices
that enables it to compile on x86_64.

in the xIndirectVoid class, instead of using s32 for the offset, use sptr which will be 32bit or 64bit depending on architecture.
This also fixes a few alignment issues in xAddressVoid's constructors.

In EmitSibMagic we are casting a void* to s32, which won't work on x86_64, so first do a cast from sptr to s32.
Won't work on x86_64, but gets us compiling.
2014-07-31 09:01:56 -05:00
Gregory Hainaut 6485bd89d9 common: drop remaining of HashMap
Ryan Houdek removes all use of this code.

Let's remove the left-overs too, beside it will removes the sparsehash depencency
2014-07-29 21:06:31 +02:00
Gregory Hainaut 76237955c7 wx3.0: fix various string printing on linux
wide-char must use %ls format on linux. Don't rely on non standard %s/%S
2014-07-29 20:45:44 +02:00
Gregory Hainaut d5d19acb3f wx3.0: lots of cast...
Various string as still wrong but at least it can be compiled now.

I think the remaining issue are w_char with %s format (at least on linux)
2014-07-29 20:45:44 +02:00
Gregory Hainaut fded22e1b3 wx3.0: extend logger to support wxString as input
Note: only enabled it on 2.8 for windows (because of UTF8 linux is fine)
2014-07-29 20:45:44 +02:00
Gregory Hainaut 91afc2079c wx3.0: force wide char as expected
Note: on linux it would be better to force everythings to use UTF8
2014-07-29 20:45:43 +02:00
Forrest McDonald 81458912f9 pcsx2: remove template and pointer on overload function from wxGuiTools
Fixed clang build.

Note from Gregory:
C++ requests that at least 1 parameters is a class, an enumeration, or a
reference to those objects. Probably to avoid to screw basic type operation.
For example: *p += 4;

The realy buggy code was this one because T could be an int!
template T
f(*ptr, T)

To avoid any issue in the future the Team decide to drop all overload that use pointers.
2014-07-18 19:20:53 +02:00
Ryan Houdek 5114b37bfa Change the x86emitter jmp emitter from using s32 to sptr.
This doesn't change anything on x86_32, but it is required on x86_64 so we don't lose precision.
Also adds an assert to see if the distance is greater than the maximum 32bit jump, which can't be hit on x86_32, but can be on x86_64.
2014-07-15 15:16:30 -05:00
Forrest McDonald b24d4cce8d Clang doesn't support some flags that GCC does, so conditionally check the compiler and add them if we are doing a GCC build 2014-07-14 13:54:31 +02:00
Gregory Hainaut c60fefa1a6 gcc: support address sanitizer 2014-07-12 19:57:26 +02:00
Gregory Hainaut d4a76b979c ooups a very bad typo 2014-07-12 13:33:24 +02:00
Gregory Hainaut 79f6aacc85 common: various warning fix
* Use c++11 static assert
* Properly cast to parameter template to u32 (help clang)
* Remove lots of useless ASM. Memset it only used with a size of 4096.
* check pthread_mutex_init status
2014-07-12 12:59:23 +02:00
Gregory Hainaut a1ac59a48a pcsx2: add various default case statement
Note: add a note on some case note handled properly not sure how to fix them.
Actually there are potentially invalid case.
2014-07-12 12:59:23 +02:00
Gregory Hainaut f401f817ed cmake: sdl opt typo + clean warning management
Add back a lots of warning in the core!
2014-07-12 12:59:23 +02:00
Ryan Houdek 182e826dc5 Fix SpatialArrayReserve::SetBlockSize function declaration to match definition.
The function was defined to use uptr, but the declaration was using uint.
2014-07-05 04:59:31 -05:00
Ryan Houdek 08ef4bfbff Wipe the clusterfsck that was the get16bits define in HashTools.
This define takes a pointer(s8* in this case) and grabs 16bits of data from the array it points to.
This can be done the generic way on all compilers, no need for specifying it another way.
2014-07-05 04:39:55 -05:00
Ryan Houdek 1bc3f346b1 Fix HostSys::Munmap function declaration.
It's arguments are defined to be (void*, size_t) but with the function declaration they were (void*, u32).
2014-07-05 04:36:48 -05:00
Gregory Hainaut eb947dc325 pcsx2:gsdx: support of cross-platform (C11) aligned_malloc 2014-06-13 23:04:21 +02:00
Gregory Hainaut c37d9c10f7 cmake: git compilation issue + useless warning message
* avoid compilation failure when git -C isn't supported
* don't print missing dependency when EXTRA_PLUGINS isn't activated
* sed /endif(.*)/endif/ because I don't like it
2014-04-17 20:26:16 +02:00
gregory.hainaut e24f3585d4 pcsx2: fix window compilation + a couple of extra ;)
* Fix some issue with the new debugger on linux
* Enable the previous tlb miss fix on the interpreter
* disable the building of po by default. It pollute too much my env.



git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5914 96395faa-99c1-11dd-bbfe-3dabce05a288
2014-02-23 16:00:55 +00:00