Commit Graph

529 Commits

Author SHA1 Message Date
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
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