summaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorStelios Tsampas <loathingkernel@gmail.com>2017-07-30 13:57:47 +0300
committerStelios Tsampas <loathingkernel@gmail.com>2017-07-30 17:18:07 +0300
commitdcf718bdd96c3bbe27e18200f6384cd43c95c111 (patch)
tree140b77d9d9e4dd940d85daf080cdc944f14984dd /gui
parentb117a70fd03d780b5817c635d5c337c6ecc36d94 (diff)
downloadpcsxr-dcf718bdd96c3bbe27e18200f6384cd43c95c111.tar.gz
* Revert parts of the per game memory card patch.
The previous implementation was doing file paths manipulation deep inside sio.c, and it was hardcoding windows style paths. This was breaking on linux in more than one ways and it is incompatible with the dynamic apppath handling from codeplex branch. Moreover, SaveMcd and LoadMcd functions already take memory card file paths as arguments, making any such logic redundant. This patch rewrites the global Config.Mcd# variables during game startup, which makes it more compatible across all platforms. It also has the added benefit that it doesn't update the configuration file with the each game's memory cards, i.e. at PCSXR startup the default memory cards will be loaded.
Diffstat (limited to 'gui')
-rwxr-xr-xgui/Linux.h1
-rwxr-xr-xgui/LnxMain.c1
-rwxr-xr-xgui/MemcardDlg.c13
3 files changed, 7 insertions, 8 deletions
diff --git a/gui/Linux.h b/gui/Linux.h
index db70a2a9..2a939050 100755
--- a/gui/Linux.h
+++ b/gui/Linux.h
@@ -29,6 +29,7 @@
#define DEFAULT_MEM_CARD_1 "/.pcsxr/memcards/card1.mcd"
#define DEFAULT_MEM_CARD_2 "/.pcsxr/memcards/card2.mcd"
#define MEMCARD_DIR "/.pcsxr/memcards/"
+#define MEMCARD_PERGAME_DIR "/.pcsxr/memcards/games"
#define PLUGINS_DIR "/.pcsxr/plugins/"
#define PLUGINS_CFG_DIR "/.pcsxr/plugins/cfg/"
#define PCSXR_DOT_DIR "/.pcsxr/"
diff --git a/gui/LnxMain.c b/gui/LnxMain.c
index a7f934ae..d6dd9316 100755
--- a/gui/LnxMain.c
+++ b/gui/LnxMain.c
@@ -83,6 +83,7 @@ static void CheckSubDir() {
CreateHomeConfigDir(BIOS_DIR);
CreateHomeConfigDir(MEMCARD_DIR);
+ CreateHomeConfigDir(MEMCARD_PERGAME_DIR);
CreateHomeConfigDir(STATES_DIR);
CreateHomeConfigDir(PLUGINS_DIR);
CreateHomeConfigDir(PLUGINS_CFG_DIR);
diff --git a/gui/MemcardDlg.c b/gui/MemcardDlg.c
index d3949565..666a21e0 100755
--- a/gui/MemcardDlg.c
+++ b/gui/MemcardDlg.c
@@ -443,7 +443,7 @@ static int GetFreeMemcardSlot(gint target_card, gint count, u8* blocks) {
return -1;
}
-void CopyMemcardData(gint dstmcd, char *from, char *to, gint srci, gint dsti,
+void CopyMemcardData(char *from, char *to, gint srci, gint dsti,
gchar *str, const u16 linkindex) {
u16* linkptr;
u8* checksumptr;
@@ -465,11 +465,11 @@ void CopyMemcardData(gint dstmcd, char *from, char *to, gint srci, gint dsti,
//printf("link = %i %i\n", dsti, linkindex);
}
- SaveMcd(dstmcd, (char *)str, to, dsti * 128, 128);
+ SaveMcd((char *)str, to, dsti * 128, 128);
// data
memcpy(to + dsti * 1024 * 8, from + srci * 1024 * 8, 1024 * 8);
- SaveMcd(dstmcd, (char *)str, to, dsti * 1024 * 8, 1024 * 8);
+ SaveMcd((char *)str, to, dsti * 1024 * 8, 1024 * 8);
//printf("data = %s\n", from + (srci+1) * 128);
}
@@ -550,7 +550,7 @@ static void OnMcd_CopyTo(GtkWidget *widget, gpointer user_data) {
for (j=0; srctbl[j] > 0; j++) {
// last parameter specifies link index (next block)
- CopyMemcardData(dstmcd, source, destination,
+ CopyMemcardData(source, destination,
srctbl[j], dsttbl[j], str, dsttbl[j+1]-1);
//printf("count = %i, indices=(%x,%x) jindex=%i\n", count, srctbl[j], dsttbl[j], j);
}
@@ -622,7 +622,7 @@ static void OnMemcardDelete(GtkWidget *widget, gpointer user_data) {
}
*ptr = xorsum;
- SaveMcd(memcard, (char *)filename, data, i * 128, 128);
+ SaveMcd((char *)filename, data, i * 128, 128);
// Check links
i = GETLINKFORBLOCK(data, i); //0...15 index when ++i at top of loop
@@ -753,9 +753,6 @@ void OnConf_Mcds() {
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(
gtk_builder_get_object(builder, "GtkCheckButton_PerGameMcd")), Config.PerGameMcd);
- // Disable it because it is not working yet
- gtk_widget_set_sensitive(GTK_WIDGET(
- gtk_builder_get_object(builder, "GtkCheckButton_PerGameMcd")), FALSE);
LoadMcdDlg(dialog);