Cleanup.
This commit is contained in:
16
file_io.cpp
16
file_io.cpp
@@ -82,10 +82,10 @@ static int FileIsZipped(char* path, char** zip_path, char** file_path)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static char* make_fullpath(const char *path, int mode = 0, bool absolutePath = false)
|
||||
static char* make_fullpath(const char *path, int mode = 0)
|
||||
{
|
||||
const char *root = getRootDir();
|
||||
if (!absolutePath && strncasecmp(getRootDir(), path, strlen(root)))
|
||||
if (path[0] != '/')
|
||||
{
|
||||
sprintf(full_path, "%s/%s", (mode == -1) ? "" : root, path);
|
||||
}
|
||||
@@ -253,9 +253,9 @@ static int zip_search_by_crc(mz_zip_archive *zipArchive, uint32_t crc32)
|
||||
return -1;
|
||||
}
|
||||
|
||||
int FileOpenZip(fileTYPE *file, const char *name, uint32_t crc32, bool absolutePath)
|
||||
int FileOpenZip(fileTYPE *file, const char *name, uint32_t crc32)
|
||||
{
|
||||
make_fullpath(name, 0, absolutePath);
|
||||
make_fullpath(name);
|
||||
FileClose(file);
|
||||
file->mode = 0;
|
||||
file->type = 0;
|
||||
@@ -317,9 +317,9 @@ int FileOpenZip(fileTYPE *file, const char *name, uint32_t crc32, bool absoluteP
|
||||
return 1;
|
||||
}
|
||||
|
||||
int FileOpenEx(fileTYPE *file, const char *name, int mode, char mute, bool absolutePath)
|
||||
int FileOpenEx(fileTYPE *file, const char *name, int mode, char mute)
|
||||
{
|
||||
make_fullpath((char*)name, mode, absolutePath);
|
||||
make_fullpath((char*)name, mode);
|
||||
FileClose(file);
|
||||
file->mode = 0;
|
||||
file->type = 0;
|
||||
@@ -461,9 +461,9 @@ __off64_t FileGetSize(fileTYPE *file)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int FileOpen(fileTYPE *file, const char *name, char mute, bool absolutePath)
|
||||
int FileOpen(fileTYPE *file, const char *name, char mute)
|
||||
{
|
||||
return FileOpenEx(file, name, O_RDONLY, mute, absolutePath);
|
||||
return FileOpenEx(file, name, O_RDONLY, mute);
|
||||
}
|
||||
|
||||
int FileSeek(fileTYPE *file, __off64_t offset, int origin)
|
||||
|
||||
@@ -59,9 +59,9 @@ int getStorage(int from_setting);
|
||||
void setStorage(int dev);
|
||||
int isUSBMounted();
|
||||
|
||||
int FileOpenZip(fileTYPE *file, const char *name, uint32_t crc32, bool absolutePath = false);
|
||||
int FileOpenEx(fileTYPE *file, const char *name, int mode, char mute = 0, bool absolutePath = false);
|
||||
int FileOpen(fileTYPE *file, const char *name, char mute = 0, bool absolutePath = false);
|
||||
int FileOpenZip(fileTYPE *file, const char *name, uint32_t crc32);
|
||||
int FileOpenEx(fileTYPE *file, const char *name, int mode, char mute = 0);
|
||||
int FileOpen(fileTYPE *file, const char *name, char mute = 0);
|
||||
void FileClose(fileTYPE *file);
|
||||
|
||||
__off64_t FileGetSize(fileTYPE *file);
|
||||
|
||||
5
menu.cpp
5
menu.cpp
@@ -1727,9 +1727,8 @@ void HandleUI(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
unsigned char ioctl_subindex = user_io_ext_idx(SelectedPath, fs_pFileExt);
|
||||
user_io_set_index(ioctl_subindex << 6 | (menusub + 1));
|
||||
user_io_file_mount(SelectedPath, ioctl_index, 0, ioctl_subindex);
|
||||
user_io_set_index(user_io_ext_idx(SelectedPath, fs_pFileExt) << 6 | (menusub + 1));
|
||||
user_io_file_mount(SelectedPath, ioctl_index);
|
||||
}
|
||||
|
||||
menustate = SelectedPath[0] ? MENU_NONE1 : MENU_8BIT_MAIN1;
|
||||
|
||||
@@ -164,7 +164,7 @@ int c64_convert_t64_to_d64(fileTYPE* f, const char *path)
|
||||
|
||||
CHECK_SUCCESS(files.size());
|
||||
|
||||
CHECK_SUCCESS(FileOpenEx(&fd, path, O_CREAT | O_TRUNC | O_RDWR | O_SYNC, 0, true));
|
||||
CHECK_SUCCESS(FileOpenEx(&fd, path, O_CREAT | O_TRUNC | O_RDWR | O_SYNC, 0));
|
||||
|
||||
unsigned char sector[D64_BYTE_PER_SECTOR];
|
||||
memset(sector, D64_INIT_VALUE, sizeof(sector));
|
||||
|
||||
@@ -1187,7 +1187,7 @@ void user_io_set_download(unsigned char enable)
|
||||
DisableFpga();
|
||||
}
|
||||
|
||||
int user_io_file_mount(char *name, unsigned char index, char pre, unsigned char subindex)
|
||||
int user_io_file_mount(char *name, unsigned char index, char pre)
|
||||
{
|
||||
int writable = 0;
|
||||
int ret = 0;
|
||||
@@ -1247,7 +1247,9 @@ int user_io_file_mount(char *name, unsigned char index, char pre, unsigned char
|
||||
|
||||
if (is_c64_core())
|
||||
{
|
||||
if (subindex == 1) {
|
||||
int len = strlen(name);
|
||||
if(len>4 && !strcasecmp(name+len-4, ".t64"))
|
||||
{
|
||||
// mount T64
|
||||
size = 0;
|
||||
writable = false;
|
||||
@@ -1257,7 +1259,7 @@ int user_io_file_mount(char *name, unsigned char index, char pre, unsigned char
|
||||
|
||||
if (ret)
|
||||
{
|
||||
ret = FileOpenEx(&sd_image[index], path, O_RDONLY, 0, true);
|
||||
ret = FileOpenEx(&sd_image[index], path, O_RDONLY, 0);
|
||||
size = sd_image[index].size;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,7 +216,7 @@ void user_io_file_tx_write(const uint8_t *addr, uint16_t len);
|
||||
int user_io_get_width();
|
||||
|
||||
uint32_t user_io_get_file_crc();
|
||||
int user_io_file_mount(char *name, unsigned char index = 0, char pre = 0, unsigned char subindex = 0);
|
||||
int user_io_file_mount(char *name, unsigned char index = 0, char pre = 0);
|
||||
char user_io_serial_status(serial_status_t *, uint8_t);
|
||||
char *user_io_make_filepath(const char *path, const char *filename);
|
||||
char *user_io_get_core_name();
|
||||
|
||||
Reference in New Issue
Block a user