Fix config reload?

Apparently I forgot to stage a hunk, also don't attempt to initialize A314 emulation if it has already been initialized.
This commit is contained in:
beeanyew
2021-06-18 10:39:39 +02:00
parent ec8b429671
commit fb39e1127d
2 changed files with 17 additions and 11 deletions

View File

@@ -177,10 +177,9 @@ unsigned int ps_read_16(unsigned int address) {
*(gpio + 7) = (REG_DATA << PIN_A0); *(gpio + 7) = (REG_DATA << PIN_A0);
*(gpio + 7) = 1 << PIN_RD; *(gpio + 7) = 1 << PIN_RD;
while (*(gpio + 13) & (1 << PIN_TXN_IN_PROGRESS))
;
unsigned int value = *(gpio + 13); unsigned int value = *(gpio + 13);
while ((value=*(gpio + 13)) & (1 << PIN_TXN_IN_PROGRESS))
;
*(gpio + 10) = 0xffffec; *(gpio + 10) = 0xffffec;
@@ -209,10 +208,9 @@ unsigned int ps_read_8(unsigned int address) {
*(gpio + 7) = (REG_DATA << PIN_A0); *(gpio + 7) = (REG_DATA << PIN_A0);
*(gpio + 7) = 1 << PIN_RD; *(gpio + 7) = 1 << PIN_RD;
while (*(gpio + 13) & (1 << PIN_TXN_IN_PROGRESS))
;
unsigned int value = *(gpio + 13); unsigned int value = *(gpio + 13);
while ((value=*(gpio + 13)) & (1 << PIN_TXN_IN_PROGRESS))
;
*(gpio + 10) = 0xffffec; *(gpio + 10) = 0xffffec;

View File

@@ -57,7 +57,7 @@ extern unsigned int a314_base;
#define max(a, b) (a > b) ? a : b #define max(a, b) (a > b) ? a : b
uint8_t rtg_enabled = 0, piscsi_enabled = 0, pinet_enabled = 0, kick13_mode = 0, pistorm_dev_enabled = 1; uint8_t rtg_enabled = 0, piscsi_enabled = 0, pinet_enabled = 0, kick13_mode = 0, pistorm_dev_enabled = 1;
uint8_t a314_emulation_enabled = 0; uint8_t a314_emulation_enabled = 0, a314_initialized = 0;
extern uint32_t piscsi_base, pistorm_dev_base; extern uint32_t piscsi_base, pistorm_dev_base;
@@ -440,11 +440,17 @@ void setvar_amiga(struct emulator_config *cfg, char *var, char *val) {
kick13_mode = 1; kick13_mode = 1;
} }
if CHKVAR("a314") { if CHKVAR("a314") {
int32_t res = a314_init(); if (!a314_initialized) {
if (res != 0) { int32_t res = a314_init();
printf("[AMIGA] Failed to enable A314 emulation, error return code: %d.\n", res); if (res != 0) {
printf("[AMIGA] Failed to enable A314 emulation, error return code: %d.\n", res);
} else {
printf("[AMIGA] A314 emulation enabled.\n");
add_z2_pic(ACTYPE_A314, 0);
a314_emulation_enabled = 1;
a314_initialized = 1;
}
} else { } else {
printf("[AMIGA] A314 emulation enabled.\n");
add_z2_pic(ACTYPE_A314, 0); add_z2_pic(ACTYPE_A314, 0);
a314_emulation_enabled = 1; a314_emulation_enabled = 1;
} }
@@ -531,6 +537,7 @@ void handle_reset_amiga(struct emulator_config *cfg) {
} }
void shutdown_platform_amiga(struct emulator_config *cfg) { void shutdown_platform_amiga(struct emulator_config *cfg) {
printf("[AMIGA] Performing Amiga platform shutdown.\n");
if (cfg) {} if (cfg) {}
if (cdtv_mode) { if (cdtv_mode) {
FILE *out = fopen("data/cdtv.sram", "wb+"); FILE *out = fopen("data/cdtv.sram", "wb+");
@@ -545,6 +552,7 @@ void shutdown_platform_amiga(struct emulator_config *cfg) {
} }
if (cfg->platform->subsys) { if (cfg->platform->subsys) {
free(cfg->platform->subsys); free(cfg->platform->subsys);
cfg->platform->subsys = NULL;
} }
if (piscsi_enabled) { if (piscsi_enabled) {
piscsi_shutdown(); piscsi_shutdown();