Commit Graph

715 Commits

Author SHA1 Message Date
Gregory Hainaut 7aa36133de Merge pull request #657 from turtleli/wxwidgets3_switch
Windows: switch to wxWidgets 3.0
2015-07-29 14:16:02 +02:00
Jonathan Li db6a32ac33 windows: switch to wxWidgets 3.0
This replaces wxWidgets 2.8 with wxWidgets 3.0 plus all the necessary
include/referencing to get PCSX2 to compile.

VS2012 change is untested.
2015-07-13 21:19:12 +01: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 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
Jonathan Li fbf71218f1 Remove wxWidgets linker dependencies in property sheet
The wxWidgets projects have already been specified as references for
both the SPU2-X and pcsx2 project, so there is no need to also specify
the static libraries as additional linker dependencies.
2015-06-19 22:14:47 +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 97467f9e30 Merge pull request #579 from PCSX2/drop-vs2010-support
Drop vs2010 support
2015-06-06 10:47:16 +02: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 ba5b367ae8 drop support of Visual Studio 2010
* Severals PR uses C++11 features
* 2015 will soon be released
* Win 10 will soon be released

Time to upgrade
2015-06-04 08:55:22 +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
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
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 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 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 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 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