cfgfile: Code cleanup and merge from WinUAE

This commit is contained in:
Dimitris Panokostas 2020-06-29 16:11:22 +02:00
parent cfe0ac2b6b
commit 56ac1d81e7
4 changed files with 1638 additions and 373 deletions

File diff suppressed because it is too large Load diff

View file

@ -1047,7 +1047,7 @@ extern int cfgfile_save(struct uae_prefs* p, const TCHAR* filename, int);
extern void cfgfile_parse_line(struct uae_prefs* p, TCHAR*, int);
extern void cfgfile_parse_lines(struct uae_prefs* p, const TCHAR*, int);
extern int cfgfile_parse_option(struct uae_prefs* p, const TCHAR* option, TCHAR* value, int);
extern int cfgfile_get_description(struct uae_prefs* p, const TCHAR* filename, TCHAR* description, int* type);
extern int cfgfile_get_description(struct uae_prefs* p, const TCHAR* filename, TCHAR* description, TCHAR* category, TCHAR* tags, TCHAR* hostlink, TCHAR* hardwarelink, int* type);
extern void cfgfile_show_usage(void);
extern int cfgfile_searchconfig(const TCHAR* in, int index, TCHAR* out, int outsize);
extern uae_u32 cfgfile_uaelib(TrapContext* ctx, int mode, uae_u32 name, uae_u32 dst, uae_u32 maxlen);

View file

@ -324,7 +324,7 @@ void ReadConfigFileList(void)
FilterFiles(&files, filter_rp9);
for (auto & file : files)
{
auto tmp = new ConfigFileInfo();
auto* tmp = new ConfigFileInfo();
strncpy(tmp->FullPath, path, MAX_DPATH - 1);
strncat(tmp->FullPath, file.c_str(), MAX_DPATH - 1);
strncpy(tmp->Name, file.c_str(), MAX_DPATH - 1);
@ -339,7 +339,7 @@ void ReadConfigFileList(void)
FilterFiles(&files, filter_uae);
for (auto & file : files)
{
auto tmp = new ConfigFileInfo();
auto* tmp = new ConfigFileInfo();
strncpy(tmp->FullPath, path, MAX_DPATH - 1);
strncat(tmp->FullPath, file.c_str(), MAX_DPATH - 1);
strncpy(tmp->Name, file.c_str(), MAX_DPATH - 1);
@ -347,9 +347,9 @@ void ReadConfigFileList(void)
// If the user has many (thousands) of configs, this will take a long time
if (amiberry_options.read_config_descriptions)
{
struct uae_prefs *p = cfgfile_open(tmp->FullPath, NULL);
auto p = cfgfile_open(tmp->FullPath, NULL);
if (p) {
cfgfile_get_description(p, NULL, tmp->Description, NULL);
cfgfile_get_description(p, NULL, tmp->Description, NULL, NULL, NULL, NULL, NULL);
cfgfile_close(p);
}
}

View file

@ -486,8 +486,8 @@ static int delete_trigger(blockinfo *bi, void *pc)
static int handle_exception(unsigned long* pregs, long fault_addr)
{
int handled = HANDLE_EXCEPTION_NONE;
unsigned int* fault_pc = (unsigned int*)pregs[ARM_REG_PC];
auto handled = HANDLE_EXCEPTION_NONE;
auto* fault_pc = (unsigned int*)pregs[ARM_REG_PC];
if (fault_pc == 0) {
output_log(_T("PC is NULL.\n"));
@ -520,7 +520,7 @@ static int handle_exception(unsigned long* pregs, long fault_addr)
}
// Get Amiga address of illegal memory address
long amiga_addr = (long)fault_addr - (long)regs.natmem_offset;
auto amiga_addr = (long)fault_addr - (long)regs.natmem_offset;
// Check for stupid RAM detection of kickstart
if (a3000lmem_bank.allocated_size > 0 && amiga_addr >= a3000lmem_bank.start - 0x00100000 && amiga_addr < a3000lmem_bank.start - 0x00100000 + 8) {
@ -539,13 +539,13 @@ static int handle_exception(unsigned long* pregs, long fault_addr)
}
// Get memory bank of address
addrbank* ab = &get_mem_bank(amiga_addr);
auto* ab = &get_mem_bank(amiga_addr);
if (ab)
output_log(_T("JIT: Address bank: %s, address %08x\n"), ab->name ? ab->name : _T("NONE"), amiga_addr);
// Analyse ARM instruction
const unsigned int opcode = fault_pc[0];
transfer_type_t transfer_type = TYPE_UNKNOWN;
const auto opcode = fault_pc[0];
auto transfer_type = TYPE_UNKNOWN;
int transfer_size = SIZE_UNKNOWN;
int style = STYLE_UNSIGNED;
output_log(_T("JIT: ARM opcode = 0x%08x\n"), opcode);