#include <stdlib.h>
#include <string.h>
+#include "rominfo.h"
+
#define M68K_CPU_TYPES M68K_CPU_TYPE_SCC68070
const char *cpu_types[M68K_CPU_TYPES] = {
"rom",
"ram",
"register",
+ "ram (no alloc)",
};
const char *config_item_names[CONFITEM_NUM] = {
}
void get_next_string(char *str, char *str_out, int *strpos, char separator) {
- int str_pos = 0, out_pos = 0;
+ int str_pos = 0, out_pos = 0, startquote = 0, endstring = 0;
if (!str_out)
return;
if (strpos)
str_pos = *strpos;
- while (str[str_pos] == ' ' && str[str_pos] == '\t' && str_pos < (int)strlen(str)) {
+ while ((str[str_pos] == ' ' || str[str_pos] == '\t') && str_pos < (int)strlen(str)) {
+ str_pos++;
+ }
+
+ if (str[str_pos] == '\"') {
str_pos++;
+ startquote = 1;
}
+
for (int i = str_pos; i < (int)strlen(str); i++) {
str_out[out_pos] = str[i];
- if ((separator == ' ' && (str[i] == ' ' || str[i] == '\t')) || str[i] == separator) {
+
+ if (startquote) {
+ if (str[i] == '\"')
+ endstring = 1;
+ } else {
+ if ((separator == ' ' && (str[i] == ' ' || str[i] == '\t')) || str[i] == separator) {
+ endstring = 1;
+ }
+ }
+
+ if (endstring) {
str_out[out_pos] = '\0';
if (strpos) {
*strpos = i + 1;
}
break;
}
+
out_pos++;
if (i + 1 == (int)strlen(str) && strpos) {
*strpos = i + 1;
}
switch(type) {
+ case MAPTYPE_RAM_NOALLOC:
+ printf("[CFG] Adding %d byte (%d MB) RAM mapping %s...\n", size, size / 1024 / 1024, map_id);
+ cfg->map_data[index] = (unsigned char *)filename;
+ break;
case MAPTYPE_RAM:
printf("[CFG] Allocating %d bytes for RAM mapping (%d MB)...\n", size, size / 1024 / 1024);
cfg->map_data[index] = (unsigned char *)malloc(size);
memset(cfg->map_data[index], 0x00, cfg->map_size[index]);
fread(cfg->map_data[index], cfg->rom_size[index], 1, in);
fclose(in);
+ displayRomInfo(cfg->map_data[index], cfg->rom_size[index]);
+ if (cfg->map_size[index] == cfg->rom_size[index])
+ m68k_add_rom_range(cfg->map_offset[index], cfg->map_high[index], cfg->map_data[index]);
break;
case MAPTYPE_REGISTER:
default:
}
printf("[CFG] [MAP %d] Added %s mapping for range %.8lX-%.8lX ID: %s\n", index, map_type_names[type], cfg->map_offset[index], cfg->map_high[index] - 1, cfg->map_id[index] ? cfg->map_id[index] : "None");
- if (cfg->map_size[index] == cfg->rom_size[index])
- m68k_add_rom_range(cfg->map_offset[index], cfg->map_high[index], cfg->map_data[index]);
return;