Commit Graph

644 Commits

Author SHA1 Message Date
Gregory Hainaut 3c528f0fdd common define _32kb and _4kb 2016-01-11 18:00:25 +01:00
Gregory Hainaut 6e66bea152 x86emitter: improve the various abi wrapper
V2:
* Add various option to handle the different frame
* Basic x86-64 port (untested so likely completely broken)

v3:
Create an templated xImpl_FastCall object

v4:
clang compilation fix
2016-01-11 09:21:32 +01:00
Gregory Hainaut a6eb871b42 pcsx2: use a common general intrin include
Avoid issue with various compiler conversion
Fix build with GCC4.8
2016-01-11 09:13:52 +01:00
Gregory Hainaut afdf5cdfe2 x86emitter: remove old unused macro
Add some notes for a GCC "bug"
2016-01-10 16:49:50 +01:00
Gregory Hainaut 92d7639267 profiler: add functions to plug linux Perf Event on JIT
Basically it creates a /tmp/perf-`pid`.map file which will contains
a mapping of the x86 code with the EE/IOP/VU code

* You need to enable the profiler with a define
* You can split the profiling by block (inside a recomp buffer)

v2: add new file to VS xml files
v3: remove useless include
2016-01-10 13:42:59 +01:00
Gregory Hainaut 50c7cb1717 x86emitter: implement some BMI instructions
Only a couple of one to do some memory profiling
2016-01-09 23:29:01 +01:00
Gregory Hainaut 9e13a7bdaa x86emitter: add support for the VEX opcode 2016-01-09 22:59:31 +01:00
Gregory Hainaut 29b0b17f50 x86emitter: add BMI1 & BMI2 instruction detection 2016-01-09 22:59:31 +01:00
Gregory Hainaut fd56195b2d x86emitter: drop old register define 2016-01-09 21:28:10 +01:00
Gregory Hainaut 834cc3f2c5 core|x86emitter: port basic jump instruction 2016-01-09 21:26:25 +01:00
Gregory Hainaut 743e615224 core: overload _freeX86reg with xRegister32 2016-01-09 21:15:25 +01:00
Gregory Hainaut 60a9463e7a x86emitter: remove unused legacy function
And mark the remaining one as deprecated

Clang only as it relies on C++14
2016-01-09 21:13:29 +01:00
Gregory Hainaut de2b97c640 linux compilation fix 2016-01-08 22:35:55 +01:00
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 fb1a19f157 x86emitter: clean unused legacy type
Note: no need to check -1 on register allocation failure (a exception will be fired)
2015-12-02 19:09:43 +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 fc3ff48777 Darwin/OSX SysMessage stub & __POSIX__ define. 2015-11-30 12:18:44 +02:00
Jonathan Li 52be531b8e utilities:windows: Use standard memset for memset_8
aka commit 2194685 for Windows
2015-11-29 11:46:59 +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 d5efd6eacb x86emitter: remove the never called SIMD_ExceptionTest function 2015-11-28 22:02:08 +01:00
Jonathan Li a59a90c734 common:windows: Add unicode compatible functions
It's not great, but it will work.
2015-11-25 20:03:44 +00: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 abb4cb4810 plugin API: use const char* insead of char*
I hope it doesn't change the ABI

v2: fix GSnull/zzogl/zerogs
v3: duplicated code on windows...
2015-11-12 12:11:42 +01:00
Gregory Hainaut 26774a2fe0 recompilers: always allocate the first block
Avoid several annoying SIGSEGV at startup
2015-11-12 10:35:10 +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
Jonathan Li 44d89308c9 Revert "Revert "gsdx|spu2-x: Use atlcomcli.h for CComPtr definition""
This reverts commit 9bb990e9ed.

Fight! Ahem...
2015-11-09 20:55:07 +00:00
Jonathan Li 9bb990e9ed Revert "gsdx|spu2-x: Use atlcomcli.h for CComPtr definition"
This reverts commit 0eb771c2a6.

The buildbot apparently cannot find atlcomcli.h. Oh joy.
2015-11-08 20:46:41 +00:00
Jonathan Li 0eb771c2a6 gsdx|spu2-x: Use atlcomcli.h for CComPtr definition
VS2013/VS2015 community includes it, so everything will still compile
for everyone.

Also delete common/include/comptr.h.
2015-11-06 18:52:33 +00: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
Gregory Hainaut 2194685d76 memset-linux: use std memset for memset_8
This memset is only used in the init (to clear the page that will
contains the dynarec dispatcher
2015-10-28 14:25:12 +01:00
Akash cfd02bff53 Utilities: Initialize all class members
CID 147010 (#1 of 1): Uninitialized pointer field (UNINIT_CTOR)4. uninit_member: Non-static class member Enabled is not initialized in this constructor nor in any functions that it calls.
2015-10-25 14:11:34 +05:30
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
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
Gregory Hainaut 927dd827ce common: make DESTRUCTOR_CATCHALL macro really exception safe
Console.Error() can trigger some exceptions (like out of memory)

v2:
Add a default fallback catch(...) in case someone badly add a new
exception in the codebase
2015-09-25 18:41:19 +02:00
Gregory Hainaut 2c914b9b8f common:FastFormatString: remove unimplemented m_Length 2015-09-23 09:47:27 +02:00
Gregory Hainaut a6c29a5061 common: always set a default color in trace log 2015-09-23 09:47:27 +02:00
Gregory Hainaut 3064d0c300 common: init m_handled in the SrcType_PageFault constructor
Coverity:
CID 147021 (#1 of 1): Uninitialized scalar field (UNINIT_CTOR)i
2. uninit_member: Non-static class member m_handled is not initialized in this constructor nor in any functions that it calls.
2015-09-23 09:47:27 +02:00
Avi Halachmi (:avih) d10bbb73f7 FixedInt - round instead of truncate on construction
This could have caused issues where e.g. Fixed100(59.94) differed from
Fixed100::fromString("59.94") due to precision compilation flags
(the former could, and did on Devel builds, end up with Raw == 5993, which
differs from the value constructed from the string at the ini file,
and then it would be incorrectly identified as a custom rate).

Rounding seems the more likely intention when effectively decreasing the
precision of a value.

Unlikely that we have code which depends on truncating behavior, though not
impossible.
2015-09-17 00:30:08 +03: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
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 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
Miguel A. Colón Vélez 51bd9fe40e Fix compilation errors of the old plugins.
- zerospu2: include stdint.h in Windows. (VC2012+)
- CDVDolio: Remove hash_map (not used, VC2015+)
- zerogs: Fix extern and link to utilities. (VC2012+)
- zzogl: Port windows part to wx30. (VC2012+)
2015-08-18 00:45:03 -04:00
Gregory Hainaut 92dae56ff8 common: fix gcc warning
Macro is already declared in intrin header file
2015-08-16 14:04:30 +02:00
Jonathan Li 0a0008cf97 Rename Utilities/Math.h to Utilities/MathUtils.h
Math.h conflicts with <math.h> on Visual Studio and causes the utilities
project to fail. Rename it to MathUtils.h instead.
2015-08-09 22:41:18 +01:00
Miguel A. Colón Vélez 1cb47f3c80 Fix the messy revert.
Because someone had to do it.
2015-08-09 10:01:56 -04:00
Miguel A. Colón Vélez 6462393aaf Introduce end-of-line normalization
Signed-off-by: Gregory Hainaut <gregory.hainaut@gmail.com>
2015-08-04 23:52:48 +02:00
Admiral H. Curtiss 880be6f602 FolderMemoryCard: Only load data relevant to game. Please read commit description!
Essentially, I'm telling the memory card to re-index itself with a
filter based on the game's disc serial every time a new executable boots
in the emulator.

This currently works for a lot of games, but fails in edge cases where
the game disc's serial does not match the game serial that is written to
the memory card as part of the save file's directory name. This affects
mostly (only?) games that have multiple discs. We could circumvent this
by adding a "save game serial" or something into the GameDatabase which
tells us what we should filter by for those cases.

Apart from this edge case, this appears to work surprisingly well. Try
it and see if you can find other issues!
2015-07-12 14:37:51 +02:00
Admiral H. Curtiss 1d46800888 MemoryCard: Full initial implementation of the FolderMemoryCard.
FileMemoryCard: Log reads and writes so I know what kind of commands I have to deal with.

FolderMemoryCard: Create basic class/method outline based on FileMemoryCard.

FolderMemoryCard: Add a FolderMemoryCardAggregator so I don't have to write every method in a way that has to handle more than one memory ca

Also shuffle around the location of code because C++ cares about stuff
needing to be defined before they're usable.

FolderMemoryCard: Implement Open().

FolderMemoryCard: Implement GetSizeInfo().

FolderMemoryCard: Implement some basic structure of Read()

FolderMemoryCard: Implement parts of Read() and Save().

Shouldn't it be Write() or Load()? Anyway, this doesn't work yet, but it
gets part of the formatting procedure done which is at least something!

FolderMemoryCard: Add method to calculate ECC.

FolderMemoryCard: Start implementing the FAT.

MemoryCard: More logging.

FolderMemoryCard: Formatting works now!

Formatted memory card isn't actually recognized as formatted yet because I don't store folder metadata yet, but we're getting there!

FolderMemoryCard: Recognize when it's trying to access a data cluster.

FolderMemoryCard: Add directory/file entry support.

On further inspection this might not a be a good way to handle erasing.

FolderMemoryCard: Method to get a file entry and file path from a file's data cluster.

FolderMemoryCard: wxDirName is garbage, let's just use wxFileName for the folder too...

FolderMemoryCard: Fix Erase method.

FolderMemoryCard: Start implementing file writes.

This is still quite broken but we're getting somewhere here!

FolderMemoryCard: Load the data from the host file system into the memory card on emulation start.

Also store superblock to host file system on end.

FolderMemoryCard: Fix a few warnings.

FolderMemoryCard: Implement file reads.

FolderMemoryCard: Proper ECC reads.

FolderMemoryCard: Reads to unmapped locations should return all 0xFF.

FolderMemoryCard: Some sort of working WriteToFile.

(Note: Doesn't always work depending on what order data gets written...)

FolderMemoryCard: Forgot a 'b' for reading files in binary mode. Whoops.

FolderMemoryCard: Load timestamps from the host filesystem.

FolderMemoryCard: r+b needs the file to exist so create if it doesn't.

FolderMemoryCard: Failsafe to allow non-sequential writes.

FolderMemoryCard: Use a cache for writes. Does not flush to host FS yet!

FolderMemoryCard: Flush the data written to the cache to the host file system on exit.

FolderMemoryCard: Since we have a cache now, remove code related to formatting, it's no longer needed.

FolderMemoryCard: More binary file mode mistakes...

FolderMemoryCard: Make it actually possible to disable/eject cards.

FileMemoryCard: Revert changes made for logging data.

FolderMemoryCard: Remove excessive logging.

MemoryCard: Note that the superblock struct is no longer unused.

FolderMemoryCard: A disabled card shouldn't try writing data on exit.

FolderMemoryCard: Log when flushing data.

FolderMemoryCard: Replace plain constants with const variables.

Should make it easier in the future to change the memory card size, if
needed.

FolderMemoryCard: Sort of handle the case when the total size of files in the memory card folder exceed the size of the card.

Not elegant but prevents ugly errors. The file that caused the card to
"overflow" will be seen as corrupted data by the PS2 browser.

FolderMemoryCard: Some sanity checks.

FolderMemoryCard: superBlock member really should have that m_ too to be consistent.

MemoryCard: Switch back to FileMemoryCard for merging.

FolderMemoryCard: Implement GetCRC() via a timestamp of the last memory card write.

Reasoning:
Regarding auto-ejecting on save load, I see that the current
implementation checks that by comparing memory card CRC and reinserting
if it mismatches. Since it's actually just about seeing if the memory
card state of the savestate and the current state match, my GetCRC() now
returns a millisecond timestamp of the last time the card was written
to. This should work out to the intended result, though I had to use
wxGetLocalTimeMillis() instead of wxGetUTCTimeMillis() since the latter
isn't available for some reason.

Fix GCC warnings and error.

MemoryCard: Switch implementations via a #define.

FolderMemoryCard: Add a NextFrame() method that should be called once per frame. Flushes written data to the host file system after a certain amout of frames have passed without any writes (currently 60).

MemoryCard: Add the NextFrame() method to the plugin API.

Counters: If the FolderMemoryCard is selected, inform it every frame in VSyncEnd() that a frame has passed.

VSyncEnd: Probably better to inform the memory card before the frame limiting.

Fix error when using wxWidgets >= 3.0.

FolderMemoryCard: Extract into its own .h/.cpp files.

FolderMemoryCard: Change cache to a map to reduce memory usage.

FolderMemoryCard: More gracefully handle lack of space when adding files.
2015-07-12 14:37:49 +02: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 8de94a3714 Fix string handling on Windows wxWidgets 3.0 2015-06-19 22:14:49 +01:00
Jonathan Li 5cab4f8b35 Fix includes for Windows wxWidgets 3.0 build
wxWidgets 3.0 and w32pthreads both define mode_t on Windows, causing a
redefinition error. The w32pthreads mode_t doesn't get used, so I've
chosen the wxWidgets definition.

Also add <algorithm> (required by min and max) which is no longer
implicitly included on Windows, and wx/crt.h, required by wxVsnprintf in
wxWidgets 3.0
2015-06-12 18:29:09 +01:00
Jonathan Li b6375686ff Use standard allocator for pxEventList/wxEventList
wxWidgets3.0 does not have the WXObjectAllocator anymore, so remove it.
2015-06-12 18:29:09 +01:00
refractionpcsx2 809ccc2479 Revert "Merge branch 'master' of https://github.com/PCSX2/pcsx2"
This reverts commit bbf4b58306, reversing
changes made to 5f201e21ee.
2015-06-09 23:55:46 +01:00
Gregory Hainaut d608d97ab7 common: add new file in project and fix condition ordering 2015-06-09 19:56:05 +02:00
Gregory Hainaut ed9dbd9fae Merge branch 'clz' of git://github.com/xsacha/pcsx2 into xsacha-clz 2015-06-09 19:51:58 +02:00
Gregory Hainaut c3dc51826f Merge pull request #541 from TheLastRar/master
DEV9ghzdrk - thread safer calls to DEV9irq
2015-06-06 10:47:32 +02: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 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
TheLastRar a0ec633c46 Provide a DEV9async and use it to call irq 2015-05-13 10:04:04 +01:00
Gregory Hainaut 1cb047687f common: use stdcall convention too
(Likely used by others null plugins)
2015-04-17 18:33:26 +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
Sacha b2738fdd5b Remove 3dnow (unused, obsolete).
Greg: merge the removal of EMMS stuff
2015-02-27 21:12:34 +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 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 b24c76f12a SafeArray: add a null pointer check
Thanks @ghost for the report.

Close issue #327
2014-12-21 12:49:02 +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
Gregory Hainaut 35f26f00bc Merge pull request #386 from PCSX2/remove-tls
spu2x:zzogl: disable TLS
2014-12-11 09:55:17 +01:00
Gregory Hainaut cdd09a2616 gtk2: use a pointer as argument instead of g variable
Easier and compliant with gtk3
2014-12-10 22:09:21 +01: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 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 fd7b692d00 Merge pull request #251 from xsacha/memzero_ptr
Remove redundant memzero_ptr. All compilers use SSE implementation
2014-09-21 17:15:54 +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
Gregory Hainaut 27992b16c2 common: fix std type define on windows 2014-09-12 20:41:28 +02: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
Gregory Hainaut 2d4b6273f0 Merge pull request #276 from xsacha/defs-cleanup
pcsx2: require C99 standard for stdint
2014-09-12 19:24:08 +02:00
Gregory Hainaut 80df352711 Merge pull request #211 from xsacha/intrinsics
Remove pre-gcc4.1.0 code and a bunch of functions that were never used.
2014-08-28 20:23:55 +02:00
Sacha 5287de930b Create a Math.h utility. Use it for count leading sign bits, used in MMI. 2014-08-28 00:42:53 +10: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
ramapcsx2 9168c344b1 Use generic memcpy from now on. Tests show generics are good enough now.
It should be a speedup even on modern CPUs.
2014-08-26 01:02:23 +02:00
Sacha 90e59b2704 Clean up the type defines in pcsx2.
The non-stdint fallback was not even working which shows that it was never used. No supported platform would not have stdint anyway.
Remove unused code and do not restrict types to Linux and MSVC. Was there a reason for this?
2014-08-25 16:16:34 +10:00
Sacha 999eb83de8 Remove unused _InterlockeD* functions. 2014-08-25 04:57:03 +10:00
Sacha 7a260c9885 Remove redundant memzero_ptr. All compilers use SSE implementation anyway. 2014-08-17 23:23:55 +10:00
Sacha 2ba0b1b76b Use posix_memalign and _aligned_malloc for alignment. Remove unused code. 2014-08-17 21:03:43 +10:00
Sacha f542c7232e Use __builtin_unreachable where possible for non-msvc 2014-08-15 14:43:52 +10:00
Sacha a3bc6a73a3 Remove some horrible old code.
Remove an assert define and instead use the static_assert that all compilers provide.
As an added bonus, assert messages\!
2014-08-13 13:55:32 +10:00
Sacha f0af6460a1 Remove pre-gcc4.1.0 code and a bunch of functions that were never used. 2014-08-13 13:08:19 +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 03bfffea23 Merge pulled request #174 from Sonicadvance1/x86_64-emitter-fixes
Fix a couple issues in the x86emitter on x86_64.
2014-07-31 15:43:35 +01: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
Lioncash ac558afc8a Remove 'elif' define from Pcsx2Defs and microvu_misc.h 2014-07-30 23:44:04 -04:00
sudonim1 904f5de1ea Merge pull request #144 from Sonicadvance1/fix-BitScanFoward
Fix the BitScanForward implementations for x86_64.
2014-07-30 18:19:19 +01: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 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
Pseudonym 28227ea4c4 Merge pull request #123 from Sonicadvance1/fix_interlockedbittestandresetset
Fixes interlockedbittestandreset/set in intrin_x86.h
2014-07-29 14:20:13 +01: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 0c1087a2e5 Remove HashTools::IHashable/CommonComparisonClass
These are no longer used.
2014-07-15 22:08:11 -05:00
Ryan Houdek abd605a066 Remove HashTools::HashSet.
This is no longer used.
2014-07-15 22:07:03 -05:00
Ryan Houdek 5bd06d3a02 Remove HashTools::HashMap/SpecializedHashMap
These are no longer used. Wipe them out.
2014-07-15 22:05:36 -05:00
Ryan Houdek 264cce2003 Also remove UnicodeDictionary.
This class isn't used anywhere and we should promote usage of std::unordered_map instead of this class
2014-07-15 21:01:30 -05:00
Ryan Houdek 79dd0958d0 Remove the pxDictionary class since it is no longer needed.
This was only used by the game database, which has now been changed to an unordered_map
2014-07-15 20:58:25 -05:00
Ryan Houdek 2a6656050c Fix the BitScanForward implementations for x86_64. 2014-07-15 18:13:32 -05:00
sudonim1 6f0f7ce948 Merge pull request #110 from Sonicadvance1/hashmap_64bit
Support 64bit address hashing in the CommonHashClass.
2014-07-15 23:15:03 +01:00
Ryan Houdek 8c746302a2 Fix NOT32M function declaration.
Use uptr as the argument since it is either u32 or u64 depending on architecture.
2014-07-15 15:05:46 -05:00
Ryan Houdek 48d178886e Fixes interlockedbittestandreset/set in intrin_x86.h
This doesn't update the file to the latest version from mingw32 since this is already a custom header stripped from mingw32.

This also fixes the functions for x86_64(verified that it still works for both architectures) and also updates the version inside of GSdx.
Also removes a comment in the GSdx header saying that these functions are broken since they no longer are.
2014-07-14 21:20:31 -05:00
Gregory Hainaut c6c6171841 pcsx2: don't hide base function
As far as I understand you can't mix virtual (select at runtime) and
overloading (select at compile time).
2014-07-12 16:01:21 +02:00
Gregory Hainaut 4fdfd04d3c partially revert c5d2343f51
Parameter name can help to understand the code so let's keep them.
Clang warning was disabled in previous commit
2014-07-12 13:30:34 +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
Ryan Houdek d132e6bce4 Support 64bit address hashing in the CommonHashClass.
The class already supports hashing 64bit values, just break it out to support it in this particular case.
From the 64bit version of the hash, this hash favours values that aren't on the extreme end.
Consdering that hashing is only really used by the class itself it isn't too big of an issue.
2014-07-11 17:16:58 -05:00
Gregory Hainaut c5d2343f51 pcsx2/common: fix tons of warning spamming on clang
* Don't use parameter name to avoid unused parameter
* Set a default for various case
2014-07-05 00:08:48 +02:00
ramapcsx2 ecb42cad9b Thanks Bluefire101 for reporting this (eventually) undefined behavior (depending on who you ask).
Even if there was no problem, code should always be clear on what it does.
2014-07-01 15:43:26 +02:00
Gregory Hainaut 0bf7a35a53 pcsx2: improve the GS read fifo API
1/ initReadFifo will be first called on the GS thread
    (openGL can only be done on the GS thread)

2/ readFifo will be called on the EE thread. It is not safe too access eeMem from GS
 because of memory is virtual

Fix "recent" regression (crash) on Kingdom heart and others game too.

v2: add a len check on GSState::InitReadFIFO
2014-05-06 20:28:18 +02:00
Gregory Hainaut 58077c63a7 gcc-warning: check c function return. Print error when bad.
v2: properly check return code of fread/getcwd function
2014-05-03 10:32:05 +02:00
gigaherz f7c1b6e060 Git-based versioning. 2014-03-25 13:31:36 +01: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
gregory.hainaut 220f55d760 linux compilation fix:
* use c++11 for pcsx2
* rename __rdtsc so I won't conflict with gnu version
* add a bunch of .data() method to get string data



git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5913 96395faa-99c1-11dd-bbfe-3dabce05a288
2014-02-23 09:57:01 +00:00
avihal@gmail.com 92487e2618 (Patch by KrossX): Fixed multitap - Part 2 - (e.g. Timesplitters), New: support raw PSX
memcards (mcd/mcr), Fixed issues with pad 2 (e.g. issue 1326).

These are changes which were left out at r5622, updated to pach v9 by KrossX from http://forums.pcsx2.net/Thread-Multitap-PCSX2 .

- Please report any issues with memcards corruption/incompatibilities here.
- Please feedback on multitap improvements here.

Thanks, KrossX! :)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5703 96395faa-99c1-11dd-bbfe-3dabce05a288
2013-07-19 13:43:33 +00:00
gregory.hainaut ba2ec6fe59 all: gcc warning clean round 4
* remove unused variable
* move static function from h into cpp
* Initialized hw_by_page to 0xFFFFFFFF instead of -1 (number must be a positive integer)
* Use a s32 fore m_current_lsn instead of u32 (use -1 as error code)
Bonus: a couple of fix for clang compiler (doesn't mean that it fully compile with clang)
* remove useless __debugbreak on linux
* use short for 16bits atomic function


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5695 96395faa-99c1-11dd-bbfe-3dabce05a288
2013-07-03 18:42:05 +00:00
gabest11 811a3d96cc Fix for the v110_xp toolset in vs2012. Removed winuser.h from afxresmw.h, nothing seems to be using it, but it breaks something in string.h. I did not change the projects to use v110_xp by default, to get an xp compatible binary, you have to call it from command line like this: msbuild pcsx2_suite_2012.sln /t:Build "/p:Configuration=Release AVX2" /p:PlatformToolset=v110_xp /m. Change Configuration=... as needed.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5694 96395faa-99c1-11dd-bbfe-3dabce05a288
2013-07-02 16:01:06 +00:00
gabest11@gmail.com c3ceac83f9 Missing file
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5693 96395faa-99c1-11dd-bbfe-3dabce05a288
2013-07-01 21:32:44 +00:00
avihal@gmail.com 6bfcf433db (Patch by KrossX): Fixed multitap (e.g. Timesplitters), New: support raw PSX memcards (mcd/mcr), Fixed issues with pad 2 (e.g. issue 1326).
- Also, I slightly modified the default column widths at the memory card config panel.
- Tip: If the column widths are resized, the new widths will get saved after clicking OK/Apply, but NOT if clicking Cancel or closing the window with [X]. 

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5622 96395faa-99c1-11dd-bbfe-3dabce05a288
2013-04-27 16:24:02 +00:00
gregory.hainaut 86a2f5a8ec gcc:
* Fix a couple of GCC warning
* Fix build with gcc4.8 (issue 1392)


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5618 96395faa-99c1-11dd-bbfe-3dabce05a288
2013-04-14 10:48:50 +00:00
gigaherz 4a27edc8a3 Revert previous mistake.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5487 96395faa-99c1-11dd-bbfe-3dabce05a288
2012-12-28 01:44:32 +00:00
gigaherz d2f3b4a7fc async-iso: First iteration of the experimental read-ahead system.
In this iteration, a simple read-ahead scheme is used where the next expected read begins as soon as the CDVD code calls FinishRead.
The expected improvement is close to 0 since a similar system is already in place in the core.

The next iteration should have an internal buffer, and use completion callbacks to initiate read-aheads as soon as the previous read is done, without waiting for the emulator to fetch the results of the previous operation.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5486 96395faa-99c1-11dd-bbfe-3dabce05a288
2012-12-28 01:42:39 +00:00
gigaherz 72372c2219 Make PCSX2 compile with Visual Studio 2012 (1/3): Workaround compiler differences that result in compile-time errors.
NOTE: The 'glew' project does NOT build yet, but it will have to be decided how to approach the problem (String literal too long in glew.rc)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5382 96395faa-99c1-11dd-bbfe-3dabce05a288
2012-08-19 19:36:59 +00:00
avihal 42f3f9526f Fixed Issue 1311: UI percentage values sometimes save incorrectly to ini file.
All UI percentage values (framerates, zoom) are saved incorrectly when the number ends with 0n (e.g. 105 is saved as 150, 307 is saved as 370, etc). The problem becomes apparent when these values are loaded from the ini file after restarting pcsx2.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5369 96395faa-99c1-11dd-bbfe-3dabce05a288
2012-08-14 07:15:27 +00:00
gregory.hainaut 20958dede3 i18n: use standard pcsx2_Iconize instead of an additional key lookup. In others word, english string is now included directly in the po/pot
Translators note: I save previous translation but a careful review is mandatory


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5366 96395faa-99c1-11dd-bbfe-3dabce05a288
2012-08-10 10:10:55 +00:00
sudonim1@gmail.com 2e22e56b48 Fixed PGO builds, MSVC does not like inline asm for function calls.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5146 96395faa-99c1-11dd-bbfe-3dabce05a288
2012-04-06 18:41:20 +00:00
gregory.hainaut 9264b7725c pcsx2: gcc 4.7 compilation fix
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5132 96395faa-99c1-11dd-bbfe-3dabce05a288
2012-03-17 11:21:51 +00:00
gregory.hainaut 6a0953ab94 cmake: sparsehash moves header file in newer version! Detect the 2 include pathes and add a define. Fix issue 1222
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5117 96395faa-99c1-11dd-bbfe-3dabce05a288
2012-03-06 19:42:59 +00:00
arcum42 5306b13472 More work on the compiler warnings. Removed the warning flags that are now set by default.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4949 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-10-30 00:32:22 +00:00
gregory.hainaut 136300ab2e linux compilation fix
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4868 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-08-12 18:25:21 +00:00
cottonvibes ac9bf45f98 pcsx2: Implemented Threaded VU1 :D
Threading VU1 took a lot of rewrites and new code to make possible (MTGS, microVU, gifUnit...), but we finally got to the point where it was feasible, and now we've done it! (so now everyone can stop complaining that pcsx2 only takes advantages of 2 cores :p).

The speedups in the games that benefit from it are great if you have a cpu with 3+ cores (generally a 10~45% speedup), however games that are GS limited can be a slowdown (especially on dual core cpu's).

The option can be found in the speedhacks section as "MTVU (Multi-Threaded microVU1)". And when enabled it should should show the VU thread-time percentage on the title bar window (Like we currently do for EE/GS/UI threads).

It is listed as a speedhack because in order for threading VU1 to have been a speedup, we need to assume that games will not send gif packets containing Signal/Finish/Label commands from path 1 (vu1's xgkick). The good news is very-few games ever do this, so the compatibility of MTVU is very high (a game that does do this will likely hang).

Note: vs2010 builds and Linux builds need to be updated to include "MTVU.h" and "MTVU.cpp".


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4865 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-08-12 02:31:49 +00:00
arcum42 0b09b84526 Fix Linux so that it compiles.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4827 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-07-25 10:24:05 +00:00
cottonvibes 1515949a98 will probably fix compilation errors on linux/gcc...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4826 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-07-25 08:46:07 +00:00
cottonvibes c05dc759e3 Big gif transfer code rewrite!
Pcsx2 now has a gifUnit class which acts like the ps2's gif and executes a single gif transfer at a time (and performs path arbitration according to priority and path3 slicing).

This new code is generally a speedup for most games. Particularly VU heavy games like GoW.
This revision breaks old saved state compatibility so don't update if you wish to keep playing with your old saved states.
Leave comments if this revision fixes or breaks anything...

Message to GS Plugin authors:
This new code now uses only 1 gif callback to transfer data to the gs plugin (GSgifTransfer).
pcsx2 also is garaunteed to send full GS primitives to the plugin. So you don't have to account for partial-transfers anymore.

Thanks goes out to shadowlady who tested around 500 games for me :D

Note 1: The old gif code is still in this revision, and can be enabled by the USE_OLD_GIF macro. The old code will be deleted soon.
Note 2: This revision also enables assertion dialogs in devel builds, and changed a lot of assume cases into assertions.


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4821 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-07-24 13:02:50 +00:00
gregory.hainaut@gmail.com 35b9dfce3f pcsx2: zzogl:onepad: gsdx: merge linux-gsopen2 branch (4730) into trunk
* Gsopen2 support for GS plugins => Support of the PCSX2 GS window configuration panel. Support of all PCSX2 shortcut.
* new shortcut: shift-f12 to stole the input. ZZogl shortcut must be prefixed with ctrl
* onepad: Support/fix/improve of configuration gui, multiple key, mouse/wiimote for analog joystick, dualshock3/sixaxis (basic), dual pad and experimental forcefeedback

Note: it is advices to delete OnePAD.ini


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4731 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-06-12 14:48:36 +00:00
cottonvibes 996ca8ffff microVU:
- Reimplemented mini/max opcodes using integer comparison operations instead of double comparison. This results in a bit less code and integer operations tend to be faster than double ops (especially on AMD cpus). Thanks to pseudonym for the idea!
- Fixed some minor bugs in mVU dev builds.

pcsx2:
- Added __fc as a shorthand macro for __fastcall since we already have __ri and __fi macros.


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@4713 96395faa-99c1-11dd-bbfe-3dabce05a288
2011-06-05 10:30:04 +00:00