mirror of
https://github.com/kanjitalk755/macemu.git
synced 2024-11-26 10:49:21 +00:00
BasiliskII side of changes to support .sheepvm bundles for SheepShaver
This commit is contained in:
parent
5b958defa7
commit
d0c46de7c3
@ -38,7 +38,7 @@ static BPath xpram_path;
|
||||
* Load XPRAM from settings file
|
||||
*/
|
||||
|
||||
void LoadXPRAM(void)
|
||||
void LoadXPRAM(const char *vmdir)
|
||||
{
|
||||
// Construct XPRAM path
|
||||
find_directory(B_USER_SETTINGS_DIRECTORY, &xpram_path, true);
|
||||
|
@ -286,6 +286,7 @@ int main(int argc, char **argv)
|
||||
|
||||
bool InitEmulator (void)
|
||||
{
|
||||
const char *vmdir = NULL;
|
||||
char str[256];
|
||||
|
||||
|
||||
@ -423,7 +424,7 @@ bool InitEmulator (void)
|
||||
|
||||
|
||||
// Initialize everything
|
||||
if (!InitAll())
|
||||
if (!InitAll(vmdir))
|
||||
QuitEmulator();
|
||||
D(bug("Initialization complete\n"));
|
||||
|
||||
|
@ -374,13 +374,14 @@ static void usage(const char *prg_name)
|
||||
" --break ADDRESS\n set ROM breakpoint\n"
|
||||
" --rominfo\n dump ROM information\n", prg_name
|
||||
);
|
||||
LoadPrefs(); // read the prefs file so PrefsPrintUsage() will print the correct default values
|
||||
LoadPrefs(NULL); // read the prefs file so PrefsPrintUsage() will print the correct default values
|
||||
PrefsPrintUsage();
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
const char *vmdir = NULL;
|
||||
char str[256];
|
||||
|
||||
// Initialize variables
|
||||
@ -466,7 +467,7 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
|
||||
// Read preferences
|
||||
PrefsInit(argc, argv);
|
||||
PrefsInit(vmdir, argc, argv);
|
||||
|
||||
// Any command line arguments left?
|
||||
for (int i=1; i<argc; i++) {
|
||||
@ -674,7 +675,7 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
|
||||
// Initialize everything
|
||||
if (!InitAll())
|
||||
if (!InitAll(vmdir))
|
||||
QuitEmulator();
|
||||
D(bug("Initialization complete\n"));
|
||||
|
||||
|
@ -56,8 +56,20 @@ static string prefs_path;
|
||||
* Load preferences from settings file
|
||||
*/
|
||||
|
||||
void LoadPrefs(void)
|
||||
void LoadPrefs(const char *vmdir)
|
||||
{
|
||||
if (vmdir) {
|
||||
prefs_path = string(vmdir) + '/' + string("prefs");
|
||||
FILE *prefs = fopen(prefs_path.c_str(), "r");
|
||||
if (!prefs) {
|
||||
printf("No file at %s found.\n", prefs_path.c_str());
|
||||
exit(1);
|
||||
}
|
||||
LoadPrefsFromStream(prefs);
|
||||
fclose(prefs);
|
||||
return;
|
||||
}
|
||||
|
||||
// Construct prefs path
|
||||
if (UserPrefsPath.empty()) {
|
||||
char *home = getenv("HOME");
|
||||
|
@ -38,8 +38,15 @@ static char xpram_path[1024];
|
||||
* Load XPRAM from settings file
|
||||
*/
|
||||
|
||||
void LoadXPRAM(void)
|
||||
void LoadXPRAM(const char *vmdir)
|
||||
{
|
||||
if (vmdir) {
|
||||
#if POWERPC_ROM
|
||||
snprintf(xpram_path, sizeof(xpram_path), "%s/nvram", vmdir);
|
||||
#else
|
||||
snprintf(xpram_path, sizeof(xpram_path), "%s/xpram", vmdir);
|
||||
#endif
|
||||
} else {
|
||||
// Construct XPRAM path
|
||||
xpram_path[0] = 0;
|
||||
char *home = getenv("HOME");
|
||||
@ -48,6 +55,7 @@ void LoadXPRAM(void)
|
||||
strcat(xpram_path, "/");
|
||||
}
|
||||
strcat(xpram_path, XPRAM_FILE_NAME);
|
||||
}
|
||||
|
||||
// Load XPRAM from settings file
|
||||
int fd;
|
||||
|
@ -206,7 +206,7 @@ static void usage(const char *prg_name)
|
||||
" --break ADDRESS\n set ROM breakpoint\n"
|
||||
" --rominfo\n dump ROM information\n", prg_name
|
||||
);
|
||||
LoadPrefs(); // read the prefs file so PrefsPrintUsage() will print the correct default values
|
||||
LoadPrefs(NULL); // read the prefs file so PrefsPrintUsage() will print the correct default values
|
||||
PrefsPrintUsage();
|
||||
exit(0);
|
||||
}
|
||||
|
@ -1731,7 +1731,7 @@ int main(int argc, char *argv[])
|
||||
gtk_init(&argc, &argv);
|
||||
|
||||
// Read preferences
|
||||
PrefsInit(argc, argv);
|
||||
PrefsInit(NULL, argc, argv);
|
||||
|
||||
// Migrate preferences
|
||||
PrefsMigrate();
|
||||
|
@ -70,7 +70,7 @@ static string prefs_path;
|
||||
* Load preferences from settings file
|
||||
*/
|
||||
|
||||
void LoadPrefs(void)
|
||||
void LoadPrefs(const char *vmdir)
|
||||
{
|
||||
// Construct prefs path
|
||||
if (UserPrefsPath.empty()) {
|
||||
|
@ -58,7 +58,7 @@ static void build_xpram_path(void)
|
||||
* Load XPRAM from settings file
|
||||
*/
|
||||
|
||||
void LoadXPRAM(void)
|
||||
void LoadXPRAM(const char *vmdir)
|
||||
{
|
||||
// Construct XPRAM path
|
||||
build_xpram_path();
|
||||
|
@ -39,7 +39,7 @@ struct M68kRegisters {
|
||||
};
|
||||
|
||||
// General functions
|
||||
extern bool InitAll(void);
|
||||
extern bool InitAll(const char *vmdir);
|
||||
extern void ExitAll(void);
|
||||
|
||||
// Platform-specific functions
|
||||
|
@ -23,7 +23,7 @@
|
||||
|
||||
#include <stdio.h>
|
||||
|
||||
extern void PrefsInit(int &argc, char **&argv);
|
||||
extern void PrefsInit(const char *vmdir, int &argc, char **&argv);
|
||||
extern void PrefsExit(void);
|
||||
|
||||
extern void PrefsPrintUsage(void);
|
||||
@ -32,7 +32,7 @@ extern void AddPrefsDefaults(void);
|
||||
extern void AddPlatformPrefsDefaults(void);
|
||||
|
||||
// Preferences loading/saving
|
||||
extern void LoadPrefs(void);
|
||||
extern void LoadPrefs(const char *vmdir);
|
||||
extern void SavePrefs(void);
|
||||
|
||||
extern void LoadPrefsFromStream(FILE *f);
|
||||
|
@ -29,11 +29,11 @@ const int XPRAM_SIZE = 256;
|
||||
|
||||
extern uint8 XPRAM[XPRAM_SIZE];
|
||||
|
||||
extern void XPRAMInit(void);
|
||||
extern void XPRAMInit(const char *vmdir);
|
||||
extern void XPRAMExit(void);
|
||||
|
||||
// System specific and internal functions/data
|
||||
extern void LoadXPRAM(void);
|
||||
extern void LoadXPRAM(const char *vmdir);
|
||||
extern void SaveXPRAM(void);
|
||||
extern void ZapPRAM(void);
|
||||
|
||||
|
@ -61,7 +61,7 @@ static void mon_write_byte_b2(uintptr adr, uint32 b)
|
||||
* Initialize everything, returns false on error
|
||||
*/
|
||||
|
||||
bool InitAll(void)
|
||||
bool InitAll(const char *vmdir)
|
||||
{
|
||||
// Check ROM version
|
||||
if (!CheckROM()) {
|
||||
@ -100,7 +100,7 @@ bool InitAll(void)
|
||||
#endif
|
||||
|
||||
// Load XPRAM
|
||||
XPRAMInit();
|
||||
XPRAMInit(vmdir);
|
||||
|
||||
// Load XPRAM default values if signature not found
|
||||
if (XPRAM[0x0c] != 0x4e || XPRAM[0x0d] != 0x75
|
||||
|
@ -47,21 +47,21 @@ static const prefs_desc *find_prefs_desc(const char *name);
|
||||
* Initialize preferences
|
||||
*/
|
||||
|
||||
void PrefsInit(int &argc, char **&argv)
|
||||
void PrefsInit(const char *vmdir, int &argc, char **&argv)
|
||||
{
|
||||
// Set defaults
|
||||
AddPrefsDefaults();
|
||||
AddPlatformPrefsDefaults();
|
||||
|
||||
// Load preferences from settings file
|
||||
LoadPrefs();
|
||||
LoadPrefs(vmdir);
|
||||
|
||||
// Override prefs with command line options
|
||||
for (int i=1; i<argc; i++) {
|
||||
|
||||
// Options are of the form '--keyword'
|
||||
const char *option = argv[i];
|
||||
if (strlen(option) < 3 || option[0] != '-' || option[1] != '-')
|
||||
if (!option || strlen(option) < 3 || option[0] != '-' || option[1] != '-')
|
||||
continue;
|
||||
const char *keyword = option + 2;
|
||||
|
||||
|
@ -37,13 +37,13 @@ uint8 XPRAM[XPRAM_SIZE];
|
||||
* Initialize XPRAM
|
||||
*/
|
||||
|
||||
void XPRAMInit(void)
|
||||
void XPRAMInit(const char *vmdir)
|
||||
{
|
||||
// Clear XPRAM
|
||||
memset(XPRAM, 0, XPRAM_SIZE);
|
||||
|
||||
// Load XPRAM from settings file
|
||||
LoadXPRAM();
|
||||
LoadXPRAM(vmdir);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user