forked from meetpatty/basiliskii-vita
-
Notifications
You must be signed in to change notification settings - Fork 2
/
prefs_psp.cpp
94 lines (78 loc) · 2.53 KB
/
prefs_psp.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/*
* prefs_psp.cpp - Preferences handling, PSP specific stuff
*
* Basilisk II (C) 1997-2005 Christian Bauer
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "sysdeps.h"
#include "prefs.h"
#include "main.h"
// Platform-specific preferences items
prefs_desc platform_prefs_items[] = {
{"keycodefile", TYPE_STRING, false, "path of keycode translation file"},
{"udpapoint", TYPE_INT32, false, "UDP tunnel access point"},
{"pspspeed", TYPE_INT32, false, "PSP CPU frequency"},
{"psptv", TYPE_BOOLEAN, false, "Use video output"},
{"pspmar", TYPE_INT32, false, "PSP TV monitor aspect ratio"},
{"psplaced", TYPE_BOOLEAN, false, "PSP TV monitor uses interlace"},
{"pspdar", TYPE_INT32, false, "PSP display aspect ratio"},
{"psposcan", TYPE_BOOLEAN, false, "PSP video overscan enable"},
{"relaxed60hz", TYPE_BOOLEAN, false, "Use relaxed timing for 60 Hz IRQ"},
{NULL, TYPE_END, false, NULL} // End of list
};
extern char psp_home[256];
// Preferences file name and path
char PREFS_FILE_NAME[256];
/*
* Load preferences from settings file
*/
void LoadPrefs(void)
{
strcpy(PREFS_FILE_NAME, psp_home);
strcat(PREFS_FILE_NAME, "BasiliskII_prefs");
// Read preferences from settings file
FILE *f = fopen(PREFS_FILE_NAME, "r");
if (f != NULL) {
// Prefs file found, load settings
LoadPrefsFromStream(f);
fclose(f);
} else {
// No prefs file, save defaults
SavePrefs();
}
}
/*
* Save preferences to settings file
*/
void SavePrefs(void)
{
FILE *f;
if ((f = fopen(PREFS_FILE_NAME, "w")) != NULL) {
SavePrefsToStream(f);
fclose(f);
}
}
/*
* Add defaults of platform-specific prefs items
* You may also override the defaults set in PrefsInit()
*/
void AddPlatformPrefsDefaults(void)
{
PrefsReplaceString("extfs", "ms0:");
}