aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--frontend/main.c25
-rw-r--r--frontend/main.h20
-rw-r--r--frontend/menu.c27
4 files changed, 39 insertions, 36 deletions
diff --git a/Makefile b/Makefile
index 8df42cf..07908ed 100644
--- a/Makefile
+++ b/Makefile
@@ -2,7 +2,7 @@
# default stuff goes here, so that config can override
TARGET ?= pcsx
-CFLAGS += -Wall -Iinclude -ffast-math
+CFLAGS += -Wall -Iinclude -ffast-math -DPICO_HOME_DIR='"/.pcsx/"'
ifeq ($(DEBUG), 1)
CFLAGS += -O0 -ggdb
@@ -16,7 +16,6 @@ endif
CXXFLAGS += $(CFLAGS)
#DRC_DBG = 1
#PCNT = 1
-PICO_HOME_DIR=".pcsx"
all: config.mak target_ plugins_
diff --git a/frontend/main.c b/frontend/main.c
index cf45475..0266992 100644
--- a/frontend/main.c
+++ b/frontend/main.c
@@ -54,12 +54,15 @@ enum sched_action emu_action, emu_action_old;
char hud_msg[64];
int hud_new_msg;
-static void make_path(char *buf, size_t size, const char *dir, const char *fname)
+void make_path(char *buf, size_t size, const char *dir, const char *fname)
{
+ char root_dir[MAXPATHLEN];
+ plat_get_root_dir(root_dir, MAXPATHLEN);
+
if (fname)
- snprintf(buf, size, ".%s%s", dir, fname);
+ snprintf(buf, size, "%s%s%s", root_dir, dir, fname);
else
- snprintf(buf, size, ".%s", dir);
+ snprintf(buf, size, "%s%s", root_dir, dir);
}
#define MAKE_PATH(buf, dir, fname) \
make_path(buf, sizeof(buf), dir, fname)
@@ -103,7 +106,7 @@ void set_cd_image(const char *fname)
static void set_default_paths(void)
{
#ifndef NO_FRONTEND
- snprintf(Config.PatchesDir, sizeof(Config.PatchesDir), "." PATCHES_DIR);
+ MAKE_PATH(Config.PatchesDir, PATCHES_DIR, NULL);
MAKE_PATH(Config.Mcd1, MEMCARD_DIR, "card1.mcd");
MAKE_PATH(Config.Mcd2, MEMCARD_DIR, "card2.mcd");
strcpy(Config.BiosDir, "bios");
@@ -477,17 +480,13 @@ static void create_profile_dir(const char *directory) {
}
static void check_profile(void) {
- // make sure that ~/.pcsx exists
- create_profile_dir(PCSX_DOT_DIR);
-
- create_profile_dir(BIOS_DIR);
create_profile_dir(MEMCARD_DIR);
create_profile_dir(STATES_DIR);
create_profile_dir(PLUGINS_DIR);
create_profile_dir(PLUGINS_CFG_DIR);
create_profile_dir(CHEATS_DIR);
create_profile_dir(PATCHES_DIR);
- create_profile_dir(PCSX_DOT_DIR "cfg");
+ create_profile_dir("/cfg/");
create_profile_dir("/screenshots/");
}
@@ -601,7 +600,7 @@ int main(int argc, char *argv[])
// FIXME: this recovery doesn't work, just delete bad config and bail out
// SysMessage("could not load plugins, retrying with defaults\n");
set_default_paths();
- snprintf(path, sizeof(path), "." PCSX_DOT_DIR "%s", cfgfile_basename);
+ MAKE_PATH(path, cfgfile_basename, NULL);
remove(path);
SysMessage("Failed loading plugins!");
return 1;
@@ -757,8 +756,10 @@ void SysUpdate() {
}
int get_state_filename(char *buf, int size, int i) {
- return get_gameid_filename(buf, size,
- "." STATES_DIR "%.32s-%.9s.%3.3d", i);
+ char fname[MAXPATHLEN];
+ MAKE_PATH(fname, STATES_DIR, "%.32s-%.9s.%3.3d");
+
+ return get_gameid_filename(buf, size, fname, i);
}
int emu_check_state(int slot)
diff --git a/frontend/main.h b/frontend/main.h
index 7ce9e5d..b53a2a3 100644
--- a/frontend/main.h
+++ b/frontend/main.h
@@ -21,16 +21,12 @@
#include "config.h"
-#define DEFAULT_MEM_CARD_1 "/.pcsx/memcards/card1.mcd"
-#define DEFAULT_MEM_CARD_2 "/.pcsx/memcards/card2.mcd"
-#define MEMCARD_DIR "/.pcsx/memcards/"
-#define PLUGINS_DIR "/.pcsx/plugins/"
-#define PLUGINS_CFG_DIR "/.pcsx/plugins/cfg/"
-#define PCSX_DOT_DIR "/.pcsx/"
-#define STATES_DIR "/.pcsx/sstates/"
-#define CHEATS_DIR "/.pcsx/cheats/"
-#define PATCHES_DIR "/.pcsx/patches/"
-#define BIOS_DIR "/bios/"
+#define MEMCARD_DIR "memcards/"
+#define PLUGINS_DIR "plugins/"
+#define PLUGINS_CFG_DIR "plugins/cfg/"
+#define STATES_DIR "sstates/"
+#define CHEATS_DIR "cheats/"
+#define PATCHES_DIR "patches/"
extern char cfgfile_basename[MAXPATHLEN];
@@ -52,6 +48,10 @@ int emu_save_state(int slot);
int emu_load_state(int slot);
void set_cd_image(const char *fname);
+void make_path(char *buf, size_t size, const char *dir, const char *fname);
+
+#define MAKE_PATH(buf, dir, fname) \
+ make_path(buf, sizeof(buf), dir, fname)
extern unsigned long gpuDisp;
extern int ready_to_go, g_emu_want_quit, g_emu_resetting;
diff --git a/frontend/menu.c b/frontend/menu.c
index 9fa5fd2..229a51b 100644
--- a/frontend/menu.c
+++ b/frontend/menu.c
@@ -478,10 +478,14 @@ static char *get_cd_label(void)
static void make_cfg_fname(char *buf, size_t size, int is_game)
{
- if (is_game)
- snprintf(buf, size, "." PCSX_DOT_DIR "cfg/%.32s-%.9s.cfg", get_cd_label(), CdromId);
+ char fname[MAXPATHLEN];
+
+ if (is_game) {
+ snprintf(fname, MAXPATHLEN, "%.32s-%.9s.cfg", get_cd_label(), CdromId);
+ make_path(buf, size, "/cfg/", fname);
+ }
else
- snprintf(buf, size, "." PCSX_DOT_DIR "%s", cfgfile_basename);
+ make_path(buf, size, cfgfile_basename, NULL);
}
static void keys_write_all(FILE *f);
@@ -538,7 +542,7 @@ static int menu_do_last_cd_img(int is_get)
FILE *f;
int i, ret = -1;
- snprintf(path, sizeof(path), "." PCSX_DOT_DIR "lastcdimg.txt");
+ MAKE_PATH(path, "lastcdimg.txt", NULL);
f = fopen(path, is_get ? "r" : "w");
if (f == NULL) {
ret = -1;
@@ -695,15 +699,13 @@ fail:
if (memcard1_sel == 0)
strcpy(Config.Mcd1, "none");
else if (memcards[memcard1_sel] != NULL)
- snprintf(Config.Mcd1, sizeof(Config.Mcd1), ".%s%s",
- MEMCARD_DIR, memcards[memcard1_sel]);
+ MAKE_PATH(Config.Mcd1, MEMCARD_DIR, memcards[memcard1_sel]);
}
if ((unsigned int)memcard2_sel < ARRAY_SIZE(memcards)) {
if (memcard2_sel == 0)
strcpy(Config.Mcd2, "none");
else if (memcards[memcard2_sel] != NULL)
- snprintf(Config.Mcd2, sizeof(Config.Mcd2), ".%s%s",
- MEMCARD_DIR, memcards[memcard2_sel]);
+ MAKE_PATH(Config.Mcd2, MEMCARD_DIR, memcards[memcard2_sel]);
}
if (strcmp(mcd1_old, Config.Mcd1) || strcmp(mcd2_old, Config.Mcd2))
LoadMcds(Config.Mcd1, Config.Mcd2);
@@ -1769,10 +1771,10 @@ static void handle_memcard_sel(void)
{
strcpy(Config.Mcd1, "none");
if (memcard1_sel != 0)
- snprintf(Config.Mcd1, sizeof(Config.Mcd1), ".%s%s", MEMCARD_DIR, memcards[memcard1_sel]);
+ MAKE_PATH(Config.Mcd1, MEMCARD_DIR, memcards[memcard1_sel]);
strcpy(Config.Mcd2, "none");
if (memcard2_sel != 0)
- snprintf(Config.Mcd2, sizeof(Config.Mcd2), ".%s%s", MEMCARD_DIR, memcards[memcard2_sel]);
+ MAKE_PATH(Config.Mcd2, MEMCARD_DIR, memcards[memcard2_sel]);
LoadMcds(Config.Mcd1, Config.Mcd2);
draw_mc_bg();
}
@@ -2452,7 +2454,8 @@ do_plugins:
closedir(dir);
do_memcards:
- dir = opendir("." MEMCARD_DIR);
+ MAKE_PATH(fname, MEMCARD_DIR, NULL);
+ dir = opendir(fname);
if (dir == NULL) {
perror("scan_bios_plugins memcards opendir");
return;
@@ -2472,7 +2475,7 @@ do_memcards:
if (ent->d_type != DT_REG && ent->d_type != DT_LNK)
continue;
- snprintf(fname, sizeof(fname), "." MEMCARD_DIR "%s", ent->d_name);
+ MAKE_PATH(fname, MEMCARD_DIR, ent->d_name);
if (stat(fname, &st) != 0) {
printf("bad memcard file: %s\n", ent->d_name);
continue;