int Lang_Message_Add (t_lang *lang, char *msg_id, char *msg) { // Find message number (#define) by name int n = -1; for (int i = 0; Msg_Translation_Table[i].name; i++) { if (stricmp (msg_id, Msg_Translation_Table[i].name) == 0) { n = Msg_Translation_Table[i].value; break; } } if (n == -1) return (MEKA_ERR_UNKNOWN); // Store message if (lang->Messages [n]) { free (lang->Messages [n]); ConsolePrintf ("In %s: message \"%s\" redefined! Keeping new value.\n", lang->Name, msg_id); } // lang->Messages [n] = strdup (msg); lang->Messages[n] = parse_getword(NULL, 0, &msg, "\"", 0); // Verify that there's nothing after this line parse_skip_spaces(&msg); if (msg[0]) return (MEKA_ERR_SYNTAX); return (MEKA_ERR_OK); }
//----------------------------------------------------------------------------- // DB_Load_EntryOldFormat (char *line) // Load DB entry in old format from given line //----------------------------------------------------------------------------- static int DB_Load_EntryOldFormat(char *line) { t_db_entry *entry; t_meka_crc mekacrc; char * w; char buf[1024+1]; // Get MekaCRC sscanf (line, "%08X%08X", &mekacrc.v[0], &mekacrc.v[1]); line += 16 + 1; // Get name if (!(w = parse_getword(NULL, 0, &line, ",", ';'))) return (0); // Create and add entry to global list // Note that the old format doesn't store system nor crc32 entry = DB_Entry_New (-1, 0, &mekacrc); list_add (&DB.entries, entry); DB.entries_counter_format_old++; // Add default name DB_Name_New (entry, w, 0, FALSE); // Parse optional parameters while ((w = parse_getword(buf, 1024, &line, "=,", ';')) != NULL) { StrUpper(w); // printf ("field '%s'\n", w); if (!strcmp(w, "JAPNAME")) { if (!(w = parse_getword(NULL, 0, &line, ",", ';'))) return (0); DB_Name_New (entry, w, DB_COUNTRY_JP, FALSE); } else if (!strcmp(w, "VER")) { // In the old format, the 'VER' field holds both COUNTRY and VERSION char *wp; if (!(w = parse_getword(buf, 1024, &line, ",", ';'))) return (0); wp = buf; // printf("VER = %s\n", wp); // Get COUNTRY part if (!strnicmp (wp, "Brazilian", 9)) { wp += 9; entry->country |= DB_COUNTRY_BR; } else if (!strnicmp (wp, "English", 7)) { wp += 7; entry->country |= DB_COUNTRY_EU | DB_COUNTRY_US; } else if (!strnicmp (wp, "European", 8)) { wp += 8; entry->country |= DB_COUNTRY_EU; } else if (!strnicmp (wp, "Export", 6)) { wp += 6; entry->country |= DB_COUNTRY_EU | DB_COUNTRY_US; } else if (!strnicmp (wp, "French", 6)) { wp += 6; entry->country |= DB_COUNTRY_FR; } else if (!strnicmp (wp, "Hong-Kong", 9)) { wp += 9; entry->country |= DB_COUNTRY_HK; } else if (!strnicmp (wp, "International", 13)) { wp += 13; } else if (!strnicmp (wp, "Japanese", 8)) { wp += 8; entry->country |= DB_COUNTRY_JP; } else if (!strnicmp (wp, "Korean", 6)) { wp += 6; entry->country |= DB_COUNTRY_KR; } else if (!strnicmp (wp, "USA", 3)) { wp += 3; entry->country |= DB_COUNTRY_US; } // else // printf("Unknown country in version!"); // If there's anything left after known countries, it goes to VERSION if (*wp != EOSTR) { parse_skip_spaces (&wp); entry->version = strdup (wp); // printf("--> NEW VERSION = '%s'\n", entry->version); } } else if (!strcmp(w, "BAD")) entry->flags |= DB_FLAG_BAD; else if (!strcmp(w, "HACK")) entry->flags |= DB_FLAG_HACK; else if (!strcmp(w, "BIOS")) entry->flags |= DB_FLAG_BIOS; else if (!strcmp(w, "PROTO")) entry->flags |= DB_FLAG_PROTO; else if (!strcmp(w, "3D")) entry->flags |= DB_FLAG_EMU_3D; else if (!strcmp(w, "FLICKER")) entry->flags |= DB_FLAG_EMU_SPRITE_FLICKER; else if (!strcmp(w, "COMMENT")) { if (!(w = parse_getword(NULL, 0, &line, ",", ';'))) return (0); entry->comments = w; } else if (!strcmp(w, "ID")) { if (!(w = parse_getword(NULL, 0, &line, ",", ';'))) return (0); entry->product_no = w; } else if (!strcmp(w, "MAPPER")) { if (!(w = parse_getword(buf, 1024, &line, ",", ';'))) return (0); entry->emu_mapper = atoi(w); } else if (!strcmp(w, "TRANS")) { int value; if (!(w = parse_getword(buf, 1024, &line, ",", ';'))) return (0); // In TRANS field only, 'EN' can be specified. It currently gets the UK flag. if (!strcmp(w, "EN")) value = DB_COUNTRY_UK; else if ((value = DB_FindCountryFlagByName(w)) == -1) return (0); entry->trans_country = value; entry->flags |= DB_FLAG_TRANS; } else if (!strcmp(w, "TVTYPE")) { if (!(w = parse_getword(buf, 1024, &line, ",", ';'))) return (0); StrLower(w); if (!strcmp(w, "pal") || !strcmp(w, "secam") || !strcmp(w, "pal/secam")) entry->emu_tvtype = TVTYPE_PAL_SECAM; else if (!strcmp(w, "ntsc")) entry->emu_tvtype = TVTYPE_NTSC; else return (0); } else if (!strcmp(w, "AUTHORS")) { if (!(w = parse_getword(NULL, 0, &line, ",", ';'))) return (0); entry->authors = w; } else if (!strcmp(w, "DATE")) { if (!(w = parse_getword(buf, 1024, &line, ",", ';'))) return (0); // FIXME: yet ignored } else return (0); // Unknown field } // Ok return (1); }
//----------------------------------------------------------------------------- // DB_Load_Entry (char *line) // Load DB entry from given line //----------------------------------------------------------------------------- static int DB_Load_Entry (char *line) { t_db_entry *entry; int value; u32 crc_crc32; t_meka_crc crc_mekacrc; char * w; char buf[1024+1]; // Get system // FIXME: linear research with strcmp. Could be int compared, or even hashed. parse_getword(buf, 4, &line, " \t", ';'); value = DB_FindDriverIdByName(buf); if (value == -1) return (1); // Silent return if there's anything else than a system parse_skip_spaces (&line); // printf("line: %s\n", line); // Get CRC32 & MekaCRC if (sscanf (line, "%08x %08X%08X", &crc_crc32, &crc_mekacrc.v[0], &crc_mekacrc.v[1]) != 3) return (0); line += 8 + 1 + 16; parse_skip_spaces (&line); // Create and add entry to global list entry = DB_Entry_New (value, crc_crc32, &crc_mekacrc); // value hold system list_add (&DB.entries, entry); DB.entries_counter_format_new++; // Get and add default name if (!(w = parse_getword(NULL, 0, &line, "/", ';'))) return (0); DB_Name_New (entry, w, 0, FALSE); // Parse optional parameters while ((w = parse_getword(buf, 1024, &line, "=/", ';')) != NULL) { StrUpper(w); // printf ("field '%s'\n", w); if (!strncmp (w, "NAME_", 5)) { w += 5; if ((value = DB_FindCountryFlagByName(w)) == -1) return (0); if (!(w = parse_getword(NULL, 0, &line, "/", ';'))) break; DB_Name_New (entry, w, value, FALSE); // printf("adding country %d name %s", value, w); } else if (!strcmp(w, "COUNTRY")) { while (line[-1] == ',' || line[-1] == '=') { if (!(w = parse_getword(buf, 3, &line, ",/", ';'))) return (0); if ((value = DB_FindCountryFlagByName(w)) == -1) return (0); entry->country |= value; } } else if (!strcmp(w, "PRODUCT_NO")) { if (!(w = parse_getword(NULL, 0, &line, "/", ';'))) return (0); entry->product_no = w; } else if (!strcmp(w, "EMU_COUNTRY")) { if (!(w = parse_getword(buf, 1024, &line, ",/", ';'))) return (0); entry->emu_country = atoi(w); } else if (!strcmp(w, "EMU_INPUTS")) { if (!(w = parse_getword(buf, 1024, &line, "/", ';'))) return (0); StrLower(w); if (!strcmp(w, "joypad")) entry->emu_inputs = INPUT_JOYPAD; else if (!strcmp(w, "lightphaser")) entry->emu_inputs = INPUT_LIGHTPHASER; else if (!strcmp(w, "paddle")) entry->emu_inputs = INPUT_PADDLECONTROL; else if (!strcmp(w, "sportspad")) entry->emu_inputs = INPUT_SPORTSPAD; else if (!strcmp(w, "tvoekaki")) entry->emu_inputs = INPUT_GRAPHICBOARD; else if (!strcmp(w, "graphicboardv2")) entry->emu_inputs = INPUT_GRAPHICBOARD_V2; else return (0); } else if (!strcmp(w, "EMU_IPERIOD")) { if (!(w = parse_getword(buf, 1024, &line, "/", ';'))) return (0); entry->emu_iperiod = atoi(w); } else if (!strcmp(w, "EMU_MAPPER")) { if (!(w = parse_getword(buf, 1024, &line, "/", ';'))) return (0); entry->emu_mapper = atoi(w); } else if (!strcmp(w, "EMU_VDP")) { if (!(w = parse_getword(buf, 1024, &line, "/", ';'))) return (0); if ((entry->emu_vdp_model = VDP_Model_FindByName(w)) == -1) return (0); } else if (!strcmp(w, "EMU_TVTYPE")) { if (!(w = parse_getword(buf, 1024, &line, "/", ';'))) return (0); StrLower(w); if (!strcmp(w, "pal")) entry->emu_tvtype = TVTYPE_PAL_SECAM; else if (!strcmp(w, "ntsc")) entry->emu_tvtype = TVTYPE_NTSC; else return (0); } else if (!strcmp(w, "EMU_3D")) entry->flags |= DB_FLAG_EMU_3D; else if (!strcmp(w, "EMU_SPRITE_FLICKER")) entry->flags |= DB_FLAG_EMU_SPRITE_FLICKER; else if (!strcmp(w, "COMMENT")) { if (!(w = parse_getword(NULL, 0, &line, "/", ';'))) return (0); entry->comments = w; } else if (!strcmp(w, "FLAGS")) { while (line[-1] == ',' || line[-1] == '=') { if (!(w = parse_getword(buf, 16, &line, ",/", ';'))) return (0); if (!strcmp(w, "BAD")) entry->flags |= DB_FLAG_BAD; else if (!strcmp(w, "BIOS")) entry->flags |= DB_FLAG_BIOS; else if (!strcmp(w, "SMSGG_MODE")) entry->flags |= DB_FLAG_SMSGG_MODE; else if (!strcmp(w, "HACK")) entry->flags |= DB_FLAG_HACK; else if (!strcmp(w, "TRANS")) entry->flags |= DB_FLAG_TRANS; else if (!strcmp(w, "PROTO")) entry->flags |= DB_FLAG_PROTO; else if (!strcmp(w, "HOMEBREW")) entry->flags |= DB_FLAG_HOMEBREW; else return (0); } } else if (!strcmp(w, "TRANS")) { if (!(w = parse_getword(buf, 1024, &line, "/", ';'))) return (0); // In TRANS field only, 'EN' can be specified. It currently gets the UK flag. if (!strcmp(w, "EN")) value = DB_COUNTRY_UK; else if ((value = DB_FindCountryFlagByName(w)) == -1) return (0); entry->trans_country = value; } else if (!strcmp(w, "AUTHORS")) { if (!(w = parse_getword(NULL, 0, &line, "/", ';'))) return (0); entry->authors = w; } else if (!strcmp(w, "VERSION")) { if (!(w = parse_getword(NULL, 0, &line, "/", ';'))) return (0); entry->version = w; } else { // No error for empty fields (",,") // This is mainly to handle end of line comments ("FIELD=heh ; comment") if (strlen(w) > 0) return (0); } } // Ok return (1); }
//----------------------------------------------------------------------------- // VLFN_DataBase_Load (void) // Load VLFN database from MEKA.FDB file. //----------------------------------------------------------------------------- void VLFN_DataBase_Load (void) { t_tfile * tf; t_list * lines; char * line; int line_cnt; ConsolePrint (Msg_Get (MSG_FDB_Loading)); // Open and read file tf = tfile_read (VLFN_DataBase.filename); if (tf == NULL) { ConsolePrintf ("%s\n", meka_strerror()); return; } // Ok ConsolePrint ("\n"); // Parse each line line_cnt = 0; for (lines = tf->data_lines; lines; lines = lines->next) { char * w; line_cnt += 1; line = lines->elem; w = parse_getword(NULL, 0, &line, "/", ';', 0); if (w == NULL) continue; else { char buf[1024]; char * file_name; u32 crc_crc32; t_meka_crc crc_mekacrc; // Save allocated filename file_name = w; // Get CRCs crc_crc32 = 0; crc_mekacrc.v[0] = crc_mekacrc.v[1] = 0; while ((w = parse_getword(buf, 1024, &line, "/", ';', 0)) != NULL) { if (!strncmp(w, "MEKACRC:", 8)) { if (sscanf(w + 8, "%08X%08X", &crc_mekacrc.v[0], &crc_mekacrc.v[1]) != 2) continue; // Syntax error } else if (!strncmp(w, "CRC32:", 6)) { if (sscanf(w + 6, "%08x", &crc_crc32) != 1) continue; // Syntax error } } // Requires at least MekaCRC // (to be changed by CRC32 when MekaCRC is dropped) if (crc_mekacrc.v[0] == 0 && crc_mekacrc.v[1] == 0) continue; { // Find DB entry t_db_entry *db_entry = DB_Entry_Find (crc_crc32, &crc_mekacrc); if (db_entry) { // Create VLFN entry t_vlfn_entry * entry; entry = VLFN_Entry_New (file_name, db_entry); list_add (&VLFN_DataBase.entries, entry); } } } } // Free file data tfile_free (tf); }
static int Load_Inputs_Src_Parse_Var (int VarIdx, char *s, t_input_src *input_src) { char w[256]; if (!parse_getword(w, sizeof(w), &s, " \t", ';', PARSE_FLAGS_NONE)) return MEKA_ERR_EMPTY; switch (VarIdx) { case 0: // type ----------------------------------------------------------- if (!strcmp(w, "keyboard")) { input_src->type = INPUT_SRC_TYPE_KEYBOARD; input_src->flags = INPUT_SRC_FLAGS_DIGITAL; input_src->Connected_and_Ready = TRUE; return MEKA_ERR_OK; } if (!strcmp(w, "joypad")) { input_src->type = INPUT_SRC_TYPE_JOYPAD; input_src->flags = INPUT_SRC_FLAGS_DIGITAL; input_src->Connected_and_Ready = FALSE; return MEKA_ERR_OK; } if (!strcmp(w, "mouse")) { input_src->type = INPUT_SRC_TYPE_MOUSE; input_src->flags = INPUT_SRC_FLAGS_ANALOG; input_src->Connected_and_Ready = (g_Env.mouse_installed ? TRUE : FALSE); return MEKA_ERR_OK; } return MEKA_ERR_SYNTAX; case 1: // enabled -------------------------------------------------------- if (!strcmp(w, "yes")) { input_src->enabled = TRUE; return MEKA_ERR_OK; } if (!strcmp(w, "no")) { input_src->enabled = FALSE; return MEKA_ERR_OK; } return MEKA_ERR_SYNTAX; case 2: // player --------------------------------------------------------- input_src->player = atoi(w) - 1; if (input_src->player != 0 && input_src->player != 1) return MEKA_ERR_SYNTAX; return MEKA_ERR_OK; case 3: // driver --------------------------------------------------------- if (input_src->type == INPUT_SRC_TYPE_JOYPAD) input_src->Driver = Config_Driver_Joy_Str_to_Int(w); return MEKA_ERR_OK; case 4: // connection ----------------------------------------------------- input_src->Connection_Port = atoi(w); if (input_src->Connection_Port > 0) input_src->Connection_Port -= 1; return MEKA_ERR_OK; case 5: // emulate_digital ------------------------------------------------ if (!strcmp (w, "yes")) { input_src->flags |= INPUT_SRC_FLAGS_EMULATE_DIGITAL; return MEKA_ERR_OK; } if (!strcmp (w, "no")) { input_src->flags &= ~INPUT_SRC_FLAGS_EMULATE_DIGITAL; return MEKA_ERR_OK; } return MEKA_ERR_SYNTAX; case 6: // emulate_analog ------------------------------------------------- if (!strcmp (w, "yes")) { input_src->flags |= INPUT_SRC_FLAGS_EMULATE_ANALOG; return MEKA_ERR_OK; } if (!strcmp (w, "no")) { input_src->flags &= ~INPUT_SRC_FLAGS_EMULATE_ANALOG; return MEKA_ERR_OK; } return MEKA_ERR_SYNTAX; case 7: // digital_falloff ------------------------------------------------ input_src->Analog_to_Digital_FallOff = atof (w); return MEKA_ERR_OK; case 8: // player_up ------------------------------------------------------ case 9: // player_down ---------------------------------------------------- case 10: // player_left ---------------------------------------------------- case 11: // player_right --------------------------------------------------- case 12: // player_button1 ------------------------------------------------- case 13: // player_button2 ------------------------------------------------- case 14: // player_start_pause --------------------------------------------- case 15: // player_reset --------------------------------------------------- { int MapIdx = INPUT_MAP_DIGITAL_UP + VarIdx - 8; // FIXME: ??? //if (MapIdx >= INPUT_MAP_DIGITAL_UP && MapIdx <= INPUT_MAP_DOWN && !(input_src->Result_Type & DIGITAL)) // return MEKA_ERR_INCOHERENT; if (!strcmp (w, "key")) { const t_key_info *key_info; if (input_src->type != INPUT_SRC_TYPE_KEYBOARD) return MEKA_ERR_INCOHERENT; //if (!Parse_LineGet (&w, &s)) // return MEKA_ERR_SYNTAX; parse_skip_spaces(&s); if (StrNull (s)) return MEKA_ERR_SYNTAX; key_info = KeyInfo_FindByName(s); if (key_info != NULL) { input_src->Map [MapIdx].Type = INPUT_MAP_TYPE_KEY; input_src->Map [MapIdx].Idx = key_info->scancode; } return MEKA_ERR_OK; } if (!strcmp (w, "joy")) { int stick, axis, dir; if (input_src->type != INPUT_SRC_TYPE_JOYPAD) return MEKA_ERR_INCOHERENT; if (!parse_getword(w, sizeof(w), &s, " \t", ';', PARSE_FLAGS_NONE) || strcmp(w, "stick") || !parse_getword(w, sizeof(w), &s, " \t", ';', PARSE_FLAGS_NONE)) return MEKA_ERR_SYNTAX; stick = atoi(w); if (!parse_getword(w, sizeof(w), &s, " \t", ';', PARSE_FLAGS_NONE) || strcmp(w, "axis") || !parse_getword(w, sizeof(w), &s, " \t", ';', PARSE_FLAGS_NONE)) return MEKA_ERR_SYNTAX; axis = atoi(w); if (!parse_getword(w, sizeof(w), &s, " \t", ';', PARSE_FLAGS_NONE) || strcmp(w, "dir") || !parse_getword(w, sizeof(w), &s, " \t", ';', PARSE_FLAGS_NONE)) return MEKA_ERR_SYNTAX; dir = atoi(w); input_src->Map [MapIdx].Type = INPUT_MAP_TYPE_JOY_AXIS; input_src->Map [MapIdx].Idx = MAKE_STICK_AXIS_DIR (stick, axis, dir); return MEKA_ERR_OK; } if (!strcmp (w, "joy_button")) { if (input_src->type != INPUT_SRC_TYPE_JOYPAD) return MEKA_ERR_INCOHERENT; if (!parse_getword(w, sizeof(w), &s, " \t", ';', PARSE_FLAGS_NONE)) return MEKA_ERR_SYNTAX; input_src->Map [MapIdx].Type = INPUT_MAP_TYPE_JOY_BUTTON; input_src->Map [MapIdx].Idx = atoi(w); return MEKA_ERR_OK; } if (!strcmp (w, "mouse_button")) { if (input_src->type != INPUT_SRC_TYPE_MOUSE) return MEKA_ERR_INCOHERENT; if (!parse_getword(w, sizeof(w), &s, " \t", ';', PARSE_FLAGS_NONE)) return MEKA_ERR_SYNTAX; input_src->Map [MapIdx].Type = INPUT_MAP_TYPE_MOUSE_BUTTON; input_src->Map [MapIdx].Idx = atoi(w); return MEKA_ERR_OK; } return MEKA_ERR_SYNTAX; } case 16: // player_x_axis -------------------------------------------------- case 17: // player_y_axis -------------------------------------------------- { int MapIdx = INPUT_MAP_ANALOG_AXIS_X + VarIdx - 16; if (!(input_src->flags & INPUT_SRC_FLAGS_ANALOG)) return MEKA_ERR_INCOHERENT; if (!strcmp (w, "mouse_axis")) { if (input_src->type != INPUT_SRC_TYPE_MOUSE) return MEKA_ERR_INCOHERENT; if (!parse_getword(w, sizeof(w), &s, " \t", ';', PARSE_FLAGS_NONE)) return MEKA_ERR_SYNTAX; input_src->Map [MapIdx].Type = input_src->Map [MapIdx + 2].Type = INPUT_MAP_TYPE_MOUSE_AXIS; input_src->Map [MapIdx].Idx = input_src->Map [MapIdx + 2].Idx = MAKE_AXIS(atoi(w)); return MEKA_ERR_OK; } return MEKA_ERR_SYNTAX; } case 18: // joy_driver ----------------------------------------------------- { Inputs.Sources_Joy_Driver = Config_Driver_Joy_Str_to_Int (w); return MEKA_ERR_OK; } case 19: // mouse_speed_x -------------------------------------------------- { Inputs.MouseSpeed_X = atoi (w); return MEKA_ERR_OK; } case 20: // mouse_speed_y -------------------------------------------------- { Inputs.MouseSpeed_Y = atoi (w); return MEKA_ERR_OK; } case 21: // cabinet_mode --------------------------------------------------- { Inputs.Cabinet_Mode = atoi (w); return MEKA_ERR_OK; } } return MEKA_ERR_SYNTAX; }
void Load_Inputs_Src_List (void) { int i; char w[256]; t_input_src * input_src = NULL; t_tfile * tf; t_list * lines; int line_cnt; // Open and read file ConsolePrint (Msg_Get (MSG_Inputs_Src_Loading)); tf = tfile_read (Inputs.FileName); if (tf == NULL) Quit_Msg (meka_strerror()); ConsolePrint ("\n"); // Parse each line line_cnt = 0; for (lines = tf->data_lines; lines; lines = lines->next) { char *line; line_cnt += 1; line = lines->elem; if (StrNull(line)) continue; if (line[0] == '[' && line[strlen(line) - 1] == ']') { input_src = Inputs_Sources_Add (StrNDup (line + 1, strlen(line) - 2)); // ConsolePrintf ("new source --> %s <--\n", CurSrc->Name); continue; } strlwr(line); if (!parse_getword(w, sizeof(w), &line, "=", ';', PARSE_FLAGS_NONE)) continue; for (i = 0; Inputs_Src_List_KeyWords[i]; i++) if (strcmp(w, Inputs_Src_List_KeyWords[i]) == 0) { // FIXME: this is ugly if (input_src == NULL && strcmp (w, "joy_driver") != 0 && strcmp (w, "mouse_speed_x") != 0 && strcmp (w, "mouse_speed_y") != 0 && strcmp (w, "cabinet_mode") != 0) { tfile_free(tf); Quit_Msg (Msg_Get (MSG_Inputs_Src_Missing), line_cnt); } parse_skip_spaces(&line); if (!parse_getword(w, sizeof(w), &line, "", ';', PARSE_FLAGS_NONE)) { tfile_free(tf); Quit_Msg (Msg_Get (MSG_Inputs_Src_Equal), line_cnt); } switch (Load_Inputs_Src_Parse_Var(i, w, input_src)) { case MEKA_ERR_SYNTAX: tfile_free(tf); Quit_Msg (Msg_Get (MSG_Inputs_Src_Syntax_Param), line_cnt); case MEKA_ERR_INCOHERENT : tfile_free(tf); Quit_Msg (Msg_Get (MSG_Inputs_Src_Inconsistency), line_cnt); break; // FIXME: EMPTY is not handled there } break; } if (!Inputs_Src_List_KeyWords [i]) { tfile_free(tf); Quit_Msg (Msg_Get (MSG_Inputs_Src_Unrecognized), line_cnt, w); } } // Free file data tfile_free(tf); // Verify that we have enough inputs sources if (Inputs.Sources_Max == 0) Quit_Msg (Msg_Get (MSG_Inputs_Src_Not_Enough)); }
static int Blitters_Parse_Line(char *s, char *s_case) { if (s[0] == '[') { Blitters.current = Blitter_New(&s_case[1]); if (Blitters.current != NULL) { Blitters.count++; list_add_to_end(&Blitters.list, Blitters.current); } return (MEKA_ERR_OK); } // Skip line when we're inside a blitter we can ignore if (Blitters.current == NULL) return (MEKA_ERR_OK); // Set attributes char w[256]; parse_getword(w, sizeof(w), &s, "=", ';', PARSE_FLAGS_NONE); int i; for (i = 0; Blitters_Def_Variables [i]; i++) if (!strcmp(w, Blitters_Def_Variables [i])) break; if (Blitters.current == NULL) return (MEKA_ERR_MISSING); switch (i) { // Resolution case 0: { int x, y; parse_skip_spaces(&s); if (sscanf(s, "%dx%d", &x, &y) == 2) { Blitters.current->res_x = x; Blitters.current->res_y = y; } return MEKA_ERR_OK; } // Blitter case 1: Blitters.current->blitter = Blitters_Str2Num (s); if (Blitters.current->blitter == BLITTER_TVMODE || Blitters.current->blitter == BLITTER_TVMODE_DOUBLE) Blitters.current->tv_colors = TRUE; else Blitters.current->tv_colors = FALSE; return MEKA_ERR_OK; case 2: if (!strcmp(w, "auto")) Blitters.current->refresh_rate = 0; else Blitters.current->refresh_rate = atoi(s); return MEKA_ERR_OK; // Stretch case 3: Blitters.current->stretch = BLITTER_STRETCH_MAX_INT; return MEKA_ERR_OK; } return MEKA_ERR_UNKNOWN; }