Fix file handle leakage. Fix minimig config switching.
This commit is contained in:
4
archie.c
4
archie.c
@@ -18,7 +18,7 @@ typedef struct
|
||||
|
||||
static archie_config_t config;
|
||||
|
||||
fileTYPE floppy[MAX_FLOPPY];
|
||||
fileTYPE floppy[MAX_FLOPPY] = { 0 };
|
||||
|
||||
#define ARCHIE_FILE_TX 0x53
|
||||
#define ARCHIE_FILE_TX_DAT 0x54
|
||||
@@ -114,7 +114,7 @@ void archie_send_file(unsigned char id, char *name)
|
||||
{
|
||||
archie_debugf("Sending file with id %d", id);
|
||||
|
||||
fileTYPE file;
|
||||
fileTYPE file = { 0 };
|
||||
if (!FileOpen(&file, name)) return;
|
||||
|
||||
// prepare transmission of new file
|
||||
|
||||
9
boot.c
9
boot.c
@@ -174,7 +174,7 @@ void BootClearScreen(int adr, int size)
|
||||
//// BootUploadLogo() ////
|
||||
void BootUploadLogo()
|
||||
{
|
||||
fileTYPE file;
|
||||
fileTYPE file = { 0 };
|
||||
int x, y;
|
||||
int i = 0;
|
||||
int adr;
|
||||
@@ -235,7 +235,7 @@ void BootUploadLogo()
|
||||
//// BootUploadBall() ////
|
||||
void BootUploadBall()
|
||||
{
|
||||
fileTYPE file;
|
||||
fileTYPE file = { 0 };
|
||||
int x;
|
||||
int i = 0;
|
||||
int adr;
|
||||
@@ -267,7 +267,7 @@ void BootUploadBall()
|
||||
//// BootUploadCopper() ////
|
||||
void BootUploadCopper()
|
||||
{
|
||||
fileTYPE file;
|
||||
fileTYPE file = { 0 };
|
||||
int x;
|
||||
int i = 0;
|
||||
int adr;
|
||||
@@ -461,8 +461,7 @@ void BootInit()
|
||||
df[3].status = 0;
|
||||
|
||||
config.kickstart[0] = 0;
|
||||
SetConfigurationFilename(0); // Use default config
|
||||
LoadConfiguration(0); // Use slot-based config filename
|
||||
LoadConfiguration(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
100
config.c
100
config.c
@@ -16,7 +16,6 @@
|
||||
#include "input.h"
|
||||
|
||||
configTYPE config = { 0 };
|
||||
char configfilename[32];
|
||||
char DebugMode = 0;
|
||||
unsigned char romkey[3072];
|
||||
|
||||
@@ -67,7 +66,7 @@ void SendFileV2(fileTYPE* file, unsigned char* key, int keysize, int address, in
|
||||
//// UploadKickstart() ////
|
||||
char UploadKickstart(char *name)
|
||||
{
|
||||
fileTYPE file;
|
||||
fileTYPE file = { 0 };
|
||||
int keysize = 0;
|
||||
|
||||
BootPrint("Checking for Amiga Forever key file:");
|
||||
@@ -151,7 +150,7 @@ char UploadKickstart(char *name)
|
||||
//// UploadActionReplay() ////
|
||||
char UploadActionReplay()
|
||||
{
|
||||
fileTYPE file;
|
||||
fileTYPE file = { 0 };
|
||||
if(FileOpen(&file, "Amiga/HRTMON.ROM") || FileOpen(&file, "HRTMON.ROM"))
|
||||
{
|
||||
int adr, data;
|
||||
@@ -217,31 +216,19 @@ char UploadActionReplay()
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
//// SetConfigurationFilename() ////
|
||||
void SetConfigurationFilename(int config)
|
||||
{
|
||||
if (config)
|
||||
siprintf(configfilename, "MINIMIG%d.CFG", config);
|
||||
else
|
||||
strcpy(configfilename, "MINIMIG.CFG");
|
||||
}
|
||||
#define SET_CONFIG_NAME(str,num) \
|
||||
if (num) sprintf(str, "MINIMIG%d.CFG", num); \
|
||||
else strcpy(str, "MINIMIG.CFG");
|
||||
|
||||
|
||||
//// ConfigurationExists() ////
|
||||
unsigned char ConfigurationExists(char *filename)
|
||||
unsigned char ConfigurationExists(int num)
|
||||
{
|
||||
char path[256] = { CONFIG_DIR"/" };
|
||||
static char path[256];
|
||||
strcpy(path, CONFIG_DIR"/");
|
||||
SET_CONFIG_NAME((path+strlen(path)), num);
|
||||
|
||||
if (!filename)
|
||||
{
|
||||
// use slot-based filename if none provided
|
||||
filename = configfilename;
|
||||
}
|
||||
|
||||
strcat(path, filename);
|
||||
|
||||
fileTYPE f;
|
||||
fileTYPE f = { 0 };
|
||||
if(FileOpen(&f, path))
|
||||
{
|
||||
FileClose(&f);
|
||||
@@ -250,9 +237,8 @@ unsigned char ConfigurationExists(char *filename)
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
//// LoadConfiguration() ////
|
||||
unsigned char LoadConfiguration(char *filename)
|
||||
unsigned char LoadConfiguration(int num)
|
||||
{
|
||||
static const char config_id[] = "MNMGCFG0";
|
||||
char updatekickstart = 0;
|
||||
@@ -260,11 +246,8 @@ unsigned char LoadConfiguration(char *filename)
|
||||
unsigned char key, i;
|
||||
static configTYPE tmpconf;
|
||||
|
||||
if (!filename)
|
||||
{
|
||||
// use slot-based filename if none provided
|
||||
filename = configfilename;
|
||||
}
|
||||
static char filename[256];
|
||||
SET_CONFIG_NAME(filename, num);
|
||||
|
||||
// load configuration data
|
||||
int size = FileLoadConfig(filename, 0, 0);
|
||||
@@ -310,11 +293,9 @@ unsigned char LoadConfiguration(char *filename)
|
||||
config.floppy.drives = 1;
|
||||
config.enable_ide = 0;
|
||||
config.hardfile[0].enabled = 1;
|
||||
strcpy(config.hardfile[0].long_name, "HARDFILE1.HDF");
|
||||
config.hardfile[0].long_name[0] = 0;
|
||||
strcpy(config.hardfile[1].long_name, "HARDFILE2.HDF");
|
||||
config.hardfile[1].enabled = 1;
|
||||
config.hardfile[1].long_name[0] = 0;
|
||||
config.hardfile[1].enabled = 1; // Default is access to entire SD card
|
||||
updatekickstart = true;
|
||||
BootPrintEx(">>> No config found. Using defaults. <<<");
|
||||
}
|
||||
@@ -345,6 +326,19 @@ unsigned char LoadConfiguration(char *filename)
|
||||
return(result);
|
||||
}
|
||||
|
||||
void IDE_setup()
|
||||
{
|
||||
OpenHardfile(0);
|
||||
OpenHardfile(1);
|
||||
spi_osd_cmd8(OSD_CMD_HDD, ((config.hardfile[1].present && config.hardfile[1].enabled) ? 4 : 0) | ((config.hardfile[0].present && config.hardfile[0].enabled) ? 2 : 0) | (config.enable_ide ? 1 : 0));
|
||||
}
|
||||
|
||||
void MinimigReset()
|
||||
{
|
||||
spi_osd_cmd8(OSD_CMD_RST, 0x01);
|
||||
IDE_setup();
|
||||
spi_osd_cmd8(OSD_CMD_RST, 0x00);
|
||||
}
|
||||
|
||||
//// ApplyConfiguration() ////
|
||||
void ApplyConfiguration(char reloadkickstart)
|
||||
@@ -361,36 +355,7 @@ void ApplyConfiguration(char reloadkickstart)
|
||||
}
|
||||
|
||||
// Whether or not we uploaded a kickstart image we now need to set various parameters from the config.
|
||||
if (OpenHardfile(0)) {
|
||||
switch (hdf[0].type) {
|
||||
// Customise message for SD card acces
|
||||
case (HDF_FILE | HDF_SYNTHRDB) :
|
||||
printf("\nHardfile 0 (with fake RDB): %s\n", hdf[0].file.name);
|
||||
break;
|
||||
case HDF_FILE:
|
||||
printf("\nHardfile 0: %s\n", hdf[0].file.name);
|
||||
break;
|
||||
}
|
||||
printf("CHS: %u.%u.%u\n", hdf[0].cylinders, hdf[0].heads, hdf[0].sectors);
|
||||
printf("Size: %lu MB\n", ((((unsigned long)hdf[0].cylinders) * hdf[0].heads * hdf[0].sectors) >> 11));
|
||||
printf("Offset: %ld\n", hdf[0].offset);
|
||||
}
|
||||
|
||||
if (OpenHardfile(1)) {
|
||||
switch (hdf[1].type) {
|
||||
case (HDF_FILE | HDF_SYNTHRDB) :
|
||||
printf("\nHardfile 1 (with fake RDB): %s\n", hdf[1].file.name);
|
||||
break;
|
||||
case HDF_FILE:
|
||||
printf("\nHardfile 1: %s\n", hdf[1].file.name);
|
||||
break;
|
||||
}
|
||||
printf("CHS: %u.%u.%u\n", hdf[1].cylinders, hdf[1].heads, hdf[1].sectors);
|
||||
printf("Size: %lu MB\n", ((((unsigned long)hdf[1].cylinders) * hdf[1].heads * hdf[1].sectors) >> 11));
|
||||
printf("Offset: %ld\n", hdf[1].offset);
|
||||
}
|
||||
|
||||
ConfigIDE(config.enable_ide, config.hardfile[0].present && config.hardfile[0].enabled, config.hardfile[1].present && config.hardfile[1].enabled);
|
||||
IDE_setup();
|
||||
|
||||
printf("CPU clock : %s\n", config.chipset & 0x01 ? "turbo" : "normal");
|
||||
printf("Chip RAM size : %s\n", config_memory_chip_msg[config.memory & 0x03]);
|
||||
@@ -481,11 +446,10 @@ void ApplyConfiguration(char reloadkickstart)
|
||||
}
|
||||
|
||||
//// SaveConfiguration() ////
|
||||
unsigned char SaveConfiguration(char *filename)
|
||||
unsigned char SaveConfiguration(int num)
|
||||
{
|
||||
if (!filename) {
|
||||
// use slot-based filename if none provided
|
||||
filename = configfilename;
|
||||
}
|
||||
static char filename[256];
|
||||
SET_CONFIG_NAME(filename, num);
|
||||
|
||||
return FileSaveConfig(filename, &config, sizeof(config));
|
||||
}
|
||||
|
||||
9
config.h
9
config.h
@@ -42,9 +42,8 @@ extern char DebugMode;
|
||||
|
||||
char UploadKickstart(char *name);
|
||||
char UploadActionReplay();
|
||||
void SetConfigurationFilename(int config); // Set configuration filename by slot number
|
||||
unsigned char LoadConfiguration(char *filename); // Can supply NULL to use filename previously set by slot number
|
||||
unsigned char SaveConfiguration(char *filename); // Can supply NULL to use filename previously set by slot number
|
||||
unsigned char ConfigurationExists(char *filename);
|
||||
unsigned char LoadConfiguration(int num); // Can supply NULL to use filename previously set by slot number
|
||||
unsigned char SaveConfiguration(int num); // Can supply NULL to use filename previously set by slot number
|
||||
unsigned char ConfigurationExists(int num);
|
||||
void ApplyConfiguration(char reloadkickstart);
|
||||
|
||||
void MinimigReset();
|
||||
|
||||
11
file_io.c
11
file_io.c
@@ -23,7 +23,11 @@ int iFirstEntry = 0;
|
||||
|
||||
void FileClose(fileTYPE *file)
|
||||
{
|
||||
if (file->fd > 0) close(file->fd);
|
||||
if (file->fd > 0)
|
||||
{
|
||||
//printf("closing %d\n", file->fd);
|
||||
close(file->fd);
|
||||
}
|
||||
file->fd = -1;
|
||||
}
|
||||
|
||||
@@ -40,7 +44,7 @@ int FileOpenEx(fileTYPE *file, const char *name, int mode)
|
||||
strcpy(file->name, p+1);
|
||||
|
||||
file->fd = open(full_path, mode);
|
||||
if (file->fd < 0)
|
||||
if (file->fd <= 0)
|
||||
{
|
||||
printf("FileOpenEx(open) File:%s, error: %d.\n", full_path, file->fd);
|
||||
file->fd = -1;
|
||||
@@ -52,6 +56,7 @@ int FileOpenEx(fileTYPE *file, const char *name, int mode)
|
||||
if ( ret < 0)
|
||||
{
|
||||
printf("FileOpenEx(fstat) File:%s, error: %d.\n", full_path, ret);
|
||||
file->fd = -1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -59,7 +64,7 @@ int FileOpenEx(fileTYPE *file, const char *name, int mode)
|
||||
file->offset = 0;
|
||||
file->mode = mode;
|
||||
|
||||
// printf("opened %s, size %lu\n", full_path, file->size);
|
||||
//printf("opened %s, size %lu\n", full_path, file->size);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
23
hdd.c
23
hdd.c
@@ -36,7 +36,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#define SWAPW(a) ((((a)<<8)&0xff00)|(((a)>>8)&0x00ff))
|
||||
|
||||
// hardfile structure
|
||||
hdfTYPE hdf[2];
|
||||
hdfTYPE hdf[2] = { 0 };
|
||||
|
||||
static uint8_t sector_buffer[512];
|
||||
|
||||
@@ -685,11 +685,11 @@ unsigned char HardFileSeek(hdfTYPE *pHDF, unsigned long lba)
|
||||
return FileSeekLBA(&pHDF->file, lba);
|
||||
}
|
||||
|
||||
|
||||
// OpenHardfile()
|
||||
unsigned char OpenHardfile(unsigned char unit)
|
||||
{
|
||||
unsigned long time;
|
||||
printf("\nChecking HDD %d\n", unit);
|
||||
|
||||
switch (config.hardfile[unit].enabled)
|
||||
{
|
||||
@@ -701,25 +701,26 @@ unsigned char OpenHardfile(unsigned char unit)
|
||||
if(FileOpenEx(&hdf[unit].file, config.hardfile[unit].long_name, FileCanWrite(config.hardfile[unit].long_name) ? O_RDWR : O_RDONLY))
|
||||
{
|
||||
GetHardfileGeometry(&hdf[unit]);
|
||||
hdd_debugf("HARDFILE %d:", unit);
|
||||
hdd_debugf("file: \"%.8s.%.3s\"", hdf[unit].file.name, &hdf[unit].file.name[8]);
|
||||
hdd_debugf("size: %lu (%lu MB)", hdf[unit].file.size, hdf[unit].file.size >> 20);
|
||||
hdd_debugf("CHS: %u.%u.%u", hdf[unit].cylinders, hdf[unit].heads, hdf[unit].sectors);
|
||||
hdd_debugf(" (%lu MB)", ((((unsigned long)hdf[unit].cylinders) * hdf[unit].heads * hdf[unit].sectors) >> 11));
|
||||
time = GetTimer(0);
|
||||
time = GetTimer(0) - time;
|
||||
hdd_debugf("Hardfile indexed in %lu ms", time >> 16);
|
||||
printf("HARDFILE %d%s:\n", unit, (config.hardfile[unit].enabled&HDF_SYNTHRDB) ? " (with fake RDB)" : "");
|
||||
printf("file: \"%s\"\n", hdf[unit].file.name);
|
||||
printf("size: %lu (%lu MB)\n", hdf[unit].file.size, hdf[unit].file.size >> 20);
|
||||
printf("CHS: %u/%u/%u", hdf[unit].cylinders, hdf[unit].heads, hdf[unit].sectors);
|
||||
printf(" (%lu MB), ", ((((unsigned long)hdf[unit].cylinders) * hdf[unit].heads * hdf[unit].sectors) >> 11));
|
||||
if (config.hardfile[unit].enabled & HDF_SYNTHRDB) {
|
||||
hdf[unit].offset = -(hdf[unit].heads*hdf[unit].sectors);
|
||||
}
|
||||
else {
|
||||
hdf[unit].offset = 0;
|
||||
}
|
||||
printf("Offset: %d\n\n", hdf[unit].offset);
|
||||
config.hardfile[unit].present = 1;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
FileClose(&hdf[unit].file);
|
||||
printf("HDD %d: not present\n\n", unit);
|
||||
config.hardfile[unit].present = 0;
|
||||
return 0;
|
||||
}
|
||||
@@ -728,7 +729,7 @@ unsigned char OpenHardfile(unsigned char unit)
|
||||
unsigned char GetHDFFileType(char *filename)
|
||||
{
|
||||
uint8_t type = HDF_FILETYPE_NOTFOUND;
|
||||
fileTYPE rdbfile;
|
||||
fileTYPE rdbfile = { 0 };
|
||||
|
||||
if(FileOpen(&rdbfile, filename))
|
||||
{
|
||||
|
||||
82
menu.c
82
menu.c
@@ -1859,25 +1859,34 @@ void HandleUI(void)
|
||||
helptext = helptexts[HELPTEXT_NONE];
|
||||
if (parentstate != menustate) // First run?
|
||||
{
|
||||
menumask = 0x20;
|
||||
SetConfigurationFilename(0); if (ConfigurationExists(0)) menumask |= 0x01;
|
||||
SetConfigurationFilename(1); if (ConfigurationExists(0)) menumask |= 0x02;
|
||||
SetConfigurationFilename(2); if (ConfigurationExists(0)) menumask |= 0x04;
|
||||
SetConfigurationFilename(3); if (ConfigurationExists(0)) menumask |= 0x08;
|
||||
SetConfigurationFilename(4); if (ConfigurationExists(0)) menumask |= 0x10;
|
||||
menumask = 0x200;
|
||||
if (ConfigurationExists(0)) menumask |= 0x001;
|
||||
if (ConfigurationExists(1)) menumask |= 0x002;
|
||||
if (ConfigurationExists(2)) menumask |= 0x004;
|
||||
if (ConfigurationExists(3)) menumask |= 0x008;
|
||||
if (ConfigurationExists(4)) menumask |= 0x010;
|
||||
if (ConfigurationExists(5)) menumask |= 0x020;
|
||||
if (ConfigurationExists(6)) menumask |= 0x040;
|
||||
if (ConfigurationExists(7)) menumask |= 0x080;
|
||||
if (ConfigurationExists(8)) menumask |= 0x100;
|
||||
}
|
||||
parentstate = menustate;
|
||||
OsdSetTitle("Load", 0);
|
||||
|
||||
OsdWrite(0, "", 0, 0);
|
||||
OsdWrite(1, " Default", menusub == 0, (menumask & 1) == 0);
|
||||
OsdWrite(2, " 1", menusub == 1, (menumask & 2) == 0);
|
||||
OsdWrite(3, " 2", menusub == 2, (menumask & 4) == 0);
|
||||
OsdWrite(4, " 3", menusub == 3, (menumask & 8) == 0);
|
||||
OsdWrite(5, " 4", menusub == 4, (menumask & 0x10) == 0);
|
||||
OsdWrite(6, "", 0, 0);
|
||||
for (int i = 7; i < OsdGetSize() - 1; i++) OsdWrite(i, "", 0, 0);
|
||||
OsdWrite(OsdGetSize() - 1, STD_EXIT, menusub == 5, 0);
|
||||
OsdWrite(1, "", 0, 0);
|
||||
OsdWrite(2, " Default", menusub == 0, (menumask & 1) == 0);
|
||||
OsdWrite(3, "", 0, 0);
|
||||
OsdWrite(4, " 1", menusub == 1, (menumask & 2) == 0);
|
||||
OsdWrite(5, " 2", menusub == 2, (menumask & 4) == 0);
|
||||
OsdWrite(6, " 3", menusub == 3, (menumask & 8) == 0);
|
||||
OsdWrite(7, " 4", menusub == 4, (menumask & 0x10) == 0);
|
||||
OsdWrite(8, " 5", menusub == 5, (menumask & 0x20) == 0);
|
||||
OsdWrite(9, " 6", menusub == 6, (menumask & 0x40) == 0);
|
||||
OsdWrite(10, " 7", menusub == 7, (menumask & 0x80) == 0);
|
||||
OsdWrite(11, " 8", menusub == 8, (menumask & 0x100) == 0);
|
||||
for (int i = 12; i < OsdGetSize() - 1; i++) OsdWrite(i, "", 0, 0);
|
||||
OsdWrite(OsdGetSize() - 1, STD_EXIT, menusub == 9, 0);
|
||||
|
||||
menustate = MENU_LOADCONFIG_2;
|
||||
break;
|
||||
@@ -1885,19 +1894,16 @@ void HandleUI(void)
|
||||
case MENU_LOADCONFIG_2:
|
||||
if (down)
|
||||
{
|
||||
// if (menusub < 3)
|
||||
if (menusub < 5)
|
||||
menusub++;
|
||||
if (menusub < 9) menusub++;
|
||||
menustate = MENU_LOADCONFIG_1;
|
||||
}
|
||||
else if (select)
|
||||
{
|
||||
if (menusub<5)
|
||||
if (menusub<9)
|
||||
{
|
||||
OsdDisable();
|
||||
SetConfigurationFilename(menusub);
|
||||
LoadConfiguration(NULL);
|
||||
OsdReset();
|
||||
LoadConfiguration(menusub);
|
||||
MinimigReset();
|
||||
menustate = MENU_NONE1;
|
||||
}
|
||||
else
|
||||
@@ -2029,7 +2035,7 @@ void HandleUI(void)
|
||||
if (m)
|
||||
{
|
||||
menustate = MENU_NONE1;
|
||||
OsdReset();
|
||||
MinimigReset();
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2051,19 +2057,24 @@ void HandleUI(void)
|
||||
|
||||
case MENU_SAVECONFIG_1:
|
||||
helptext = helptexts[HELPTEXT_NONE];
|
||||
menumask = 0x3f;
|
||||
menumask = 0x3ff;
|
||||
parentstate = menustate;
|
||||
OsdSetTitle("Save", 0);
|
||||
|
||||
OsdWrite(0, "", 0, 0);
|
||||
OsdWrite(1, " Default", menusub == 0, 0);
|
||||
OsdWrite(2, " 1", menusub == 1, 0);
|
||||
OsdWrite(3, " 2", menusub == 2, 0);
|
||||
OsdWrite(4, " 3", menusub == 3, 0);
|
||||
OsdWrite(5, " 4", menusub == 4, 0);
|
||||
OsdWrite(6, "", 0, 0);
|
||||
for (int i = 7; i < OsdGetSize() - 1; i++) OsdWrite(i, "", 0, 0);
|
||||
OsdWrite(OsdGetSize() - 1, STD_EXIT, menusub == 5, 0);
|
||||
OsdWrite(1, "", 0, 0);
|
||||
OsdWrite(2, " Default", menusub == 0, 0);
|
||||
OsdWrite(3, "", 0, 0);
|
||||
OsdWrite(4, " 1", menusub == 1, 0);
|
||||
OsdWrite(5, " 2", menusub == 2, 0);
|
||||
OsdWrite(6, " 3", menusub == 3, 0);
|
||||
OsdWrite(7, " 4", menusub == 4, 0);
|
||||
OsdWrite(8, " 5", menusub == 5, 0);
|
||||
OsdWrite(9, " 6", menusub == 6, 0);
|
||||
OsdWrite(10, " 7", menusub == 7, 0);
|
||||
OsdWrite(11, " 8", menusub == 8, 0);
|
||||
for (int i = 12; i < OsdGetSize() - 1; i++) OsdWrite(i, "", 0, 0);
|
||||
OsdWrite(OsdGetSize() - 1, STD_EXIT, menusub == 9, 0);
|
||||
|
||||
menustate = MENU_SAVECONFIG_2;
|
||||
break;
|
||||
@@ -2085,16 +2096,15 @@ void HandleUI(void)
|
||||
else if (down)
|
||||
{
|
||||
// if (menusub < 3)
|
||||
if (menusub < 5)
|
||||
if (menusub < 9)
|
||||
menusub++;
|
||||
menustate = MENU_SAVECONFIG_1;
|
||||
}
|
||||
else if (select)
|
||||
{
|
||||
if (menusub<5)
|
||||
if (menusub<9)
|
||||
{
|
||||
SetConfigurationFilename(menusub);
|
||||
SaveConfiguration(NULL);
|
||||
SaveConfiguration(menusub);
|
||||
menustate = MENU_NONE1;
|
||||
}
|
||||
else
|
||||
@@ -2586,7 +2596,7 @@ void HandleUI(void)
|
||||
|
||||
if (menustate == MENU_HARDFILE_CHANGED2)
|
||||
{
|
||||
OsdReset();
|
||||
MinimigReset();
|
||||
menustate = MENU_NONE1;
|
||||
}
|
||||
}
|
||||
|
||||
13
osd.c
13
osd.c
@@ -496,14 +496,6 @@ void OsdDisable(void)
|
||||
spi_osd_cmd8(OSD_CMD_OSD, 0x00);
|
||||
}
|
||||
|
||||
void OsdReset()
|
||||
{
|
||||
spi_osd_cmd8(OSD_CMD_RST, 0x01);
|
||||
|
||||
ConfigIDE(config.enable_ide, config.hardfile[0].present && config.hardfile[0].enabled, config.hardfile[1].present && config.hardfile[1].enabled);
|
||||
|
||||
spi_osd_cmd8(OSD_CMD_RST, 0x00);
|
||||
}
|
||||
|
||||
void MM1_ConfigFilter(unsigned char lores, unsigned char hires) {
|
||||
spi_osd_cmd(MM1_OSDCMDCFGFLT | ((hires & 0x03) << 2) | (lores & 0x03));
|
||||
@@ -539,11 +531,6 @@ void MM1_ConfigScanlines(unsigned char scanlines)
|
||||
spi_osd_cmd(MM1_OSDCMDCFGSCL | (scanlines & 0x0F));
|
||||
}
|
||||
|
||||
void ConfigIDE(unsigned char gayle, unsigned char master, unsigned char slave)
|
||||
{
|
||||
spi_osd_cmd8(OSD_CMD_HDD, (slave ? 4 : 0) | (master ? 2 : 0) | (gayle ? 1 : 0));
|
||||
}
|
||||
|
||||
void ConfigAutofire(unsigned char autofire, unsigned char mask)
|
||||
{
|
||||
uint16_t param = mask;
|
||||
|
||||
2
osd.h
2
osd.h
@@ -72,7 +72,6 @@ void OsdClear(void);
|
||||
void OsdEnable(unsigned char mode);
|
||||
void OsdDisable(void);
|
||||
void OsdWaitVBL(void);
|
||||
void OsdReset();
|
||||
void ConfigFilter(unsigned char lores, unsigned char hires);
|
||||
void OsdReconfig(); // Reset to Chameleon core.
|
||||
// deprecated functions from Minimig 1
|
||||
@@ -83,7 +82,6 @@ void ConfigMemory(unsigned char memory);
|
||||
void ConfigCPU(unsigned char cpu);
|
||||
void ConfigChipset(unsigned char chipset);
|
||||
void ConfigFloppy(unsigned char drives, unsigned char speed);
|
||||
void ConfigIDE(unsigned char gayle, unsigned char master, unsigned char slave);
|
||||
void ConfigAutofire(unsigned char autofire, unsigned char mask);
|
||||
void OSD_PrintText(unsigned char line, char *text, unsigned long start, unsigned long width, unsigned long offset, unsigned char invert);
|
||||
void OsdWriteDoubleSize(unsigned char n, char *s, unsigned char pass);
|
||||
|
||||
16
tos.c
16
tos.c
@@ -36,10 +36,10 @@ static struct {
|
||||
fileTYPE file;
|
||||
unsigned char sides;
|
||||
unsigned char spt;
|
||||
} fdd_image[2];
|
||||
} fdd_image[2] = { 0 };
|
||||
|
||||
// one harddisk
|
||||
fileTYPE hdd_image[2];
|
||||
fileTYPE hdd_image[2] = { 0 };
|
||||
unsigned long hdd_direct = 0;
|
||||
|
||||
static unsigned char dma_buffer[512];
|
||||
@@ -613,7 +613,7 @@ static void tos_clr() {
|
||||
extern unsigned char charfont[256][8];
|
||||
|
||||
static void tos_font_load() {
|
||||
fileTYPE file;
|
||||
fileTYPE file = { 0 };
|
||||
if (FileOpen(&file, "SYSTEM.FNT")) {
|
||||
if (file.size == 4096) {
|
||||
int i;
|
||||
@@ -645,8 +645,9 @@ static void tos_font_load() {
|
||||
}
|
||||
}
|
||||
|
||||
void tos_load_cartridge(char *name) {
|
||||
fileTYPE file;
|
||||
void tos_load_cartridge(char *name)
|
||||
{
|
||||
fileTYPE file = { 0 };
|
||||
|
||||
if (name)
|
||||
strncpy(config.cart_img, name, 11);
|
||||
@@ -693,8 +694,9 @@ char tos_cartridge_is_inserted() {
|
||||
return config.cart_img[0];
|
||||
}
|
||||
|
||||
void tos_upload(char *name) {
|
||||
fileTYPE file;
|
||||
void tos_upload(char *name)
|
||||
{
|
||||
fileTYPE file = { 0 };
|
||||
|
||||
// set video offset in fpga
|
||||
tos_set_video_adjust(0, 0);
|
||||
|
||||
@@ -584,7 +584,7 @@ int user_io_file_mount(int num, char *name)
|
||||
|
||||
int user_io_file_tx(char* name, unsigned char index)
|
||||
{
|
||||
fileTYPE f;
|
||||
fileTYPE f = { 0 };
|
||||
static uint8_t buf[512];
|
||||
|
||||
if (!FileOpen(&f, name)) return 0;
|
||||
@@ -1318,7 +1318,7 @@ void user_io_check_reset(unsigned short modifiers, char useKeys)
|
||||
switch (core_type)
|
||||
{
|
||||
case CORE_TYPE_MINIMIG2:
|
||||
OsdReset();
|
||||
MinimigReset();
|
||||
break;
|
||||
|
||||
case CORE_TYPE_8BIT:
|
||||
|
||||
Reference in New Issue
Block a user