Commit Graph

33 Commits

Author SHA1 Message Date
Admiral H. Curtiss 97a68becb9 Handle filter management in the folder memcard class rather than outside.
This prevents desync between what is assumed to be the active filter and
what is actually the active filter, fixing errors like #1179 where the
memory cards are closed and reopened for whatever reason.
2016-04-02 15:22:11 +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
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
gigaherz f7c1b6e060 Git-based versioning. 2014-03-25 13:31:36 +01: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
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
Jake.Stine 74a4ecd559 Completed support for various MemoryCard sizes (16, 32, 64 megs cards).
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3084 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-05-26 19:45:33 +00:00
Jake.Stine 24e70bd524 * Re-implemented memorycard ejection (yay!) -- helps avoid memorycard corruption when using savestates on many games (due to them caching memorycard contents).
* Memorycard settings are now applied on-the-fly (can add/remove/disable memory cards in the BIOS browser and it'll act just as if you plugged or unplugged cards on a real PS2)
* Bugfixed memorycard creation dialog; which wasn't creating the memorycards in the right place (oops).

* Removed the CWD option from the first time wizard (was redundant since adding the custom location option).

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3081 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-05-26 01:57:08 +00:00
Jake.Stine 70d47bf240 Copyright 2010 : PCSX2 and plugins! (notable exception: didn't update copyright info in any Gabest plugins)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2937 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-05-03 14:08:02 +00:00
sudonim1 4457fe40fc Removed all trailing whitespace in *.c *.cpp *.h because it irritates me.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2897 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-04-25 00:31:27 +00:00
arcum42 eb54a7185b Add a header with some plugin helper functions. Mess with the comments in PluginCallbacks.h a bit.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2417 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-01-09 01:26:52 +00:00
Jake.Stine f293c2983b A couple dozen user interface refinements; notables:
* Implemented GS window hiding on suspend (option was there, but not tied in)
 * Added Frameskipping options
 * Added option for disabling all GS output, for benchmarking EEcore stuffs.


git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2409 96395faa-99c1-11dd-bbfe-3dabce05a288
2010-01-04 11:51:09 +00:00
Jake.Stine a63115988b PS2E v2 (plugin interface) tweaks and additions.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2402 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-12-27 12:15:21 +00:00
Jake.Stine 4cb8e21f94 Much work on menus, gui features. Partially-working recent-isos menu list. Bugfix for some of the new console stuff that could have caused some funny bunny business, or crashes, in a few games. Why dat wascaly wabbit! >_<
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2100 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-31 10:03:07 +00:00
Jake.Stine cd5265edca Added Console and MenuItem interfaces to the new Plugin API design (work in progress).
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2093 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-30 01:11:17 +00:00
Jake.Stine eda5d1d834 Savestates work! Not much else does yet (settings, etc), but at least this monkey's off my back. I can work on tying up more loose ends now. :)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1975 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-10-07 19:20:11 +00:00
Jake.Stine aaa3b773c6 Improved MTGS (added better suspend/resume support), and work on savestates a bit (still not working tho)
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1908 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-09-23 09:53:21 +00:00
mattmenke 2046b8e7b4 wxWidgets: Added multitap toggles to config menu. Note that currently have to enable multitap both in Pcsx2 and LilyPad for extra pads to work.
Also added suggested interface for plugins for whenever the plugin apis are updated.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1907 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-09-23 05:50:23 +00:00
Jake.Stine 4fbc2c26aa Fixed a bug in BiosTools.cpp that caused Bios-Not-Found errors.
MemoryCard / Multitap Renovations:
 * Memorycards should now support multitap (somewhat untested)
 * Implemented a memorycard plugin interface, using the new API defined in PluginCallbacks.h (still prelim and hackish)
 * Memorycard settings are saved to ini!
 * Multitap is now controlled by PCSX2 instead of the pad plugin (which means no multitap until we implement the gui toggles to enable it)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1817 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-09-13 17:11:35 +00:00
Jake.Stine d2fbb22076 Upgraded PCSX2 core and utilities to GPLv3.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1783 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-09-08 12:08:10 +00:00
Jake.Stine bafd21140f wxgui:
* finished most of the new plugin system (branch is buildable and runnable again, but no significant functionality has been added yet).
 * Removed STGS code from the branch since I planned to kill it off anyway and it was more work to code proper support for it in wx than to remove it.

git-svn-id: http://pcsx2.googlecode.com/svn/branches/wxgui@1595 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-08-02 16:48:03 +00:00
Jake.Stine b93f5bf91a More new plugin api work.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1581 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-07-29 13:54:49 +00:00
Jake.Stine 16fb25c1ed NewPluginApi: Some tweaks as per Gabest suggestion; probably a tired disaster in need much review.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1579 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-07-28 07:34:49 +00:00
Jake.Stine 3935927a99 Cleaned up some loose ends I left behind in my initial rough draft of PluginCallbacks.h, and added some eol-style:native properties to /common/include files that lacked them.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1577 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-07-28 01:25:51 +00:00
Jake.Stine 2cbb853535 Working on a brand new plugin interface, based on passing APIs via structure instead of individually binding each function (which is generally cumbersome and limited in a number of ways).
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1576 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-07-27 23:51:52 +00:00
mattmenke e3b40d1933 LilyPad, Plugin APIs: Slightly changed how multitap API additions work. Now enabling is handled completely by the pad plugin. If anyone ever really feels like adding support for more memcards, can move it over to PCSX2 itself.
Also add some documentation to PadApi.h.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@853 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-03-29 06:14:59 +00:00
arcum42 0feb9de523 General cleanup in Gif.cpp && IPU.cpp. Did a bit of refactoring in Gif.cpp. Moved the path3hack to patches.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@850 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-03-28 06:53:18 +00:00
mattmenke 0efde91a92 Save States: Added PADfreeze calls to PCSX2, though they're currently only implemented by LilyPad. Also fixed a bug where a save state would failed to load when the last plugin's freeze function actually saved something. Minor changes to new plugin API as well.
Because of a convenient bug in load state function, older save states with no saved pad info should still work.  Don't blame me if they don't, though.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@791 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-03-15 09:30:31 +00:00
arcum42 85a1c605fa Plugin APIs: Added the changes in r788 to PluginCallbacks.h. Changed the config path function to be one of the general functions, not plugin specific, and it now passes the whole pcsx2 config, not just the ini path. I can see all sorts of uses for that...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@789 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-03-15 05:57:16 +00:00
arcum42 d793d84860 The joys of unrestrained find/replace. :(
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@781 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-03-14 02:43:40 +00:00
arcum42 ceaee3748e Plugin APIs: Corrected a few things that got missed when I committed initially. Moved the ini path passing to a separate function. Restored a few functions I'd deleted, and depreciated them instead.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@780 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-03-14 02:39:40 +00:00
arcum42 c15b3129d4 Preliminary work on a new version of the plugin api. Not hooked up, and very subject to change. Mainly committed both for backup, and for other devs to mess with...
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@766 96395faa-99c1-11dd-bbfe-3dabce05a288
2009-03-13 07:25:00 +00:00