void Frame_Skipper_Show (void) { if (fskipper.Mode == FRAMESKIP_MODE_AUTO) Msg (MSGT_USER, Msg_Get (MSG_Frameskip_Auto), fskipper.Automatic_Speed); else Msg (MSGT_USER, Msg_Get (MSG_Frameskip_Standard), fskipper.Standard_Frameskip); }
int FM_Digital_Init() { ConsolePrintf("%s ", Msg_Get(MSG_Sound_Init_YM2413_Digital)); opll = OPLL_new(Z80_DEFAULT_CPU_CLOCK, Sound.SampleRate); if (opll == NULL) { ConsolePrintf("%s\n", Msg_Get(MSG_Failed)); return (MEKA_ERR_FAIL); } // FIXME-NEWSOUND: FM init /* FM_Digital_saChannel = stream_init ("YM-2413 #0", g_sasound.audio_sample_rate, 16, 0, FM_Digital_Update); if (FM_Digital_saChannel == -1) { ConsolePrintf ("%s\n", Msg_Get(MSG_Failed)); return (MEKA_ERR_FAIL); // FIXME: Error in channel creation } stream_set_volume (FM_Digital_saChannel, VOLUME_MAX); */ OPLL_reset(opll); ConsolePrintf("%s\n", Msg_Get(MSG_Ok)); return (MEKA_ERR_OK); }
void Fatal( int reason, char *insert ) /* the reason doesn't have to be good */ { char msg_buffer[RESOURCE_MAX_SIZE]; int i = 0; Msg_Get( reason, msg_buffer ); while( msg_buffer[i] != '\0' ) { if( msg_buffer[i] == '%' ) { if( msg_buffer[i+1] == 's' ) { Outs( 0, insert ); } else { Outc( msg_buffer[i+1] ); } i++; } else { Outc( msg_buffer[i] ); } i++; } Msg_Get( MSG_WSTRIP_ABORT, msg_buffer ); Outs( 1, msg_buffer ); Msg_Fini(); exit( -1 ); }
static void AboutBox_Layout(bool setup) { t_app_about_box *app = &AboutBox; // Global instance const int dragon_h = al_get_bitmap_height(Graphics.Misc.Dragon); al_set_target_bitmap(app->box->gfx_buffer); al_clear_to_color(COLOR_SKIN_WINDOW_BACKGROUND); if (setup) widget_closebox_add(app->box, (t_widget_callback)AboutBox_Switch); // Draw MEKA dragon sprite al_draw_bitmap(Graphics.Misc.Dragon, 16, (app->box->frame.size.y - dragon_h) / 2, 0); // Print about information lines { int y = 12; Font_SetCurrent((t_font_id)g_config.font_about); for (int i = 0; i < 4; i ++) { char buffer[256]; switch (i) { case 0: snprintf(buffer, countof(buffer), Msg_Get(MSG_About_Line_Meka_Date), MEKA_NAME_VERSION, MEKA_DATE); break; case 1: snprintf(buffer, countof(buffer), Msg_Get(MSG_About_Line_Authors), MEKA_AUTHORS_SHORT); break; case 2: snprintf(buffer, countof(buffer), Msg_Get(MSG_About_Line_Homepage), MEKA_HOMEPAGE); break; case 3: snprintf(buffer, countof(buffer), "Built %s, %s", MEKA_BUILD_DATE, MEKA_BUILD_TIME); break; } const int x = (( (app->box->frame.size.x - dragon_h - 18 - 6) - Font_TextWidth(FONTID_CUR, buffer) ) / 2) + dragon_h + 8 + 6; Font_Print(FONTID_CUR, buffer, x, y, COLOR_SKIN_WINDOW_TEXT); y += Font_Height() + 3; } } }
void BMemory_SRAM_Save (FILE *f) { if (f && fwrite (SRAM, sms.SRAM_Pages * 0x2000, 1, f) == 1) Msg(MSGT_USER, Msg_Get(MSG_SRAM_Wrote), sms.SRAM_Pages * 8); else Msg(MSGT_USER, Msg_Get(MSG_SRAM_Write_Unable), sms.SRAM_Pages * 8); }
void TB_Message_Init() { t_app_messages *app = &TB_Message; // Global instance t_font_id font_id = (t_font_id)g_configuration.font_messages; app->active = true; // Create box t_frame frame; frame.pos.x = 16; frame.pos.y = 626; frame.size.x = (48 * Font_Height(font_id)) + (4*2); // 4*2=padding frame.size.y = (8 * Font_Height(font_id)) + (2*2); // 2*2=padding app->box = gui_box_new(&frame, Msg_Get(MSG_Message_BoxTitle)); app->box->flags |= GUI_BOX_FLAGS_ALLOW_RESIZE; // Register to desktop Desktop_Register_Box("MESSAGES", app->box, true, &app->active); // Layout TB_Message_Layout(app, true); // Open log file if (app->log_filename != NULL) { app->log_file = fopen(app->log_filename, "a+t"); if (app->log_file) fprintf(app->log_file, Msg_Get(MSG_Log_Session_Start), meka_date_getf()); } }
void TVType_Set (int tv_type, bool verbose) { TV_Type_User = &TV_Type_Table[tv_type]; g_machine.TV = TV_Type_User; g_machine.TV_lines = TV_Type_User->screen_lines; // FIXME: CPU_Clock_Current is not taken into account for IPeriod in CPU emulation // 262 * 228 = 59736, * 60 = 3584160 // 313 * 228 = 71364, * 50 = 3568200 // SN76489_SetClock(opt.TV_Lines_Current * opt.Cur_IPeriod); // 59736 for NTSC // SN76489_SetClock(g_machine.TV->CPU_clock); Sound_UpdateClockSpeed(); if (Sound.LogVGM.Logging == VGM_LOGGING_ACCURACY_SAMPLE) VGM_Update_Timing (&Sound.LogVGM); if (verbose) { // Print message & and update GUI checks Msg(MSGT_USER, Msg_Get(MSG_TVType_Set), TV_Type_User->name); Msg(MSGT_USER_LOG, Msg_Get(MSG_TVType_Info_Speed), TV_Type_User->screen_frequency); gui_menu_uncheck_all (menus_ID.tvtype); gui_menu_check (menus_ID.tvtype, tv_type); // Note that GUI checks are NOT updated if verbose mode is not set. // The reason is the parameters in MEKA.NAM can force a TV type, but we don't // want the user to be notified by that (unless he manually reoverride it). } }
void FM_Enable (void) { Sound.FM_Enabled = TRUE; Msg (MSGT_USER, Msg_Get (MSG_FM_Enabled)); Msg (MSGT_USER_BOX, Msg_Get (MSG_Must_Reset)); gui_menu_un_check_area (menus_ID.fm, 0, 1); gui_menu_check (menus_ID.fm, 0); }
void Frame_Skipper_Switch_FPS_Counter (void) { fskipper.FPS_Display = !fskipper.FPS_Display; if (fskipper.FPS_Display) Msg (MSGT_USER, Msg_Get (MSG_FPS_Counter_Enabled)); else Msg (MSGT_USER, Msg_Get (MSG_FPS_Counter_Disabled)); }
void Glasses_Switch_Mode_Com_Port (void) { Glasses.Mode = GLASSES_MODE_COM_PORT; gui_menu_uncheck_range (menus_ID.glasses, 1, 4); gui_menu_check (menus_ID.glasses, 4); Msg(MSGT_USER, Msg_Get(MSG_Glasses_Com_Port), Glasses.ComPort); Msg(MSGT_USER_LOG, "%s", Msg_Get(MSG_Glasses_Com_Port2)); }
void Inputs_Switch_SportsPad (void) { Inputs_CFG_Peripheral_Change (PLAYER_1, INPUT_SPORTSPAD); Msg (MSGT_USER, Msg_Get (MSG_Inputs_SportsPad)); Msg (MSGT_USER_BOX, Msg_Get (MSG_Inputs_Play_Mouse)); gui_menu_un_check_area (menus_ID.inputs, 0, 4); gui_menu_check (menus_ID.inputs, Inputs.Peripheral [PLAYER_1]); }
// INPUTS: SET INPUT TO LIGHT PHASER ------------------------------------------ void Inputs_Switch_LightPhaser (void) { Inputs_CFG_Peripheral_Change (PLAYER_1, INPUT_LIGHTPHASER); Msg (MSGT_USER, Msg_Get (MSG_Inputs_LightPhaser)); Msg (MSGT_USER_BOX, Msg_Get (MSG_Inputs_Play_Mouse)); gui_menu_un_check_area (menus_ID.inputs, 0, 4); gui_menu_check (menus_ID.inputs, Inputs.Peripheral [PLAYER_1]); }
void Inputs_Switch_TVOekaki (void) { Inputs_CFG_Peripheral_Change (PLAYER_1, INPUT_TVOEKAKI); Msg (MSGT_USER, Msg_Get (MSG_Inputs_TVOekaki)); Msg (MSGT_USER_BOX, Msg_Get (MSG_Inputs_Play_Pen)); gui_menu_un_check_area (menus_ID.inputs, 0, 4); gui_menu_check (menus_ID.inputs, Inputs.Peripheral [PLAYER_1]); }
// ACTION: SET INPUT TO STANDARD JOYPADS -------------------------------------- void Inputs_Switch_Joypad (void) { Inputs_CFG_Peripheral_Change (PLAYER_1, INPUT_JOYPAD); Msg (MSGT_USER, Msg_Get (MSG_Inputs_Joypad)); Msg (MSGT_USER_BOX, Msg_Get (MSG_Inputs_Play_Digital)); gui_menu_un_check_area (menus_ID.inputs, 0, 4); gui_menu_check (menus_ID.inputs, Inputs.Peripheral [PLAYER_1]); }
void TechInfo_Switch (void) { if (TechInfo.active ^= 1) Msg (MSGT_USER, Msg_Get(MSG_TechInfo_Enabled)); else Msg (MSGT_USER, Msg_Get(MSG_TechInfo_Disabled)); gui_box_show(TechInfo.box, TechInfo.active, TRUE); gui_menu_inverse_check(menus_ID.tools, 5); }
void TileViewer_Switch (void) { if (TileViewer.active ^= 1) Msg(MSGT_USER, "%s", Msg_Get(MSG_TilesViewer_Enabled)); else Msg(MSGT_USER, "%s", Msg_Get(MSG_TilesViewer_Disabled)); gui_box_show (TileViewer.box, TileViewer.active, TRUE); gui_menu_toggle_check (menus_ID.tools, 2); }
// Initialize Sound Card ------------------------------------------------------ static int Sound_Init_SoundCard (void) { int i; AUDIOINFO Audio_Infos; ConsolePrintf (Msg_Get (MSG_Sound_Init_Soundcard), Sound.SampleRate); ConsolePrint ("\n"); Audio_Infos.nDeviceId = Sound.SoundCard; Audio_Infos.wFormat = AUDIO_FORMAT_16BITS | AUDIO_FORMAT_STEREO; // FIXME: Stereo ? Audio_Infos.nSampleRate = audio_sample_rate = Sound.SampleRate; if (AOpenAudio(&Audio_Infos) != AUDIO_ERROR_NONE) { Quit_Msg ("%s", Msg_Get (MSG_Sound_Init_Error_Audio)); return (MEKA_ERR_FAIL); } // FIXME: original sound engine was trying different sample rate on failure // Unused // Maybe it was intended to check out number of channels there ? // AGetAudioCaps (Audio_Infos.nDeviceId, &Audio_Caps); // Open voices if (AOpenVoices(Sound.Voices_Max) != AUDIO_ERROR_NONE) { Quit_Msg ("%s", Msg_Get (MSG_Sound_Init_Error_Voices)); return (MEKA_ERR_FAIL); } ASetAudioMixerValue (AUDIO_MIXER_MASTER_VOLUME, 256); // Allocate voices and waveforms Sound.Voices = Memory_Alloc (sizeof (t_voice) * Sound.Voices_Max); for (i = 0; i < Sound.Voices_Max; i++) { if (ACreateAudioVoice(&Sound.Voices[i].hVoice) != AUDIO_ERROR_NONE) { Quit_Msg (Msg_Get (MSG_Sound_Init_Error_Voice_N), i); return (MEKA_ERR_FAIL); } ASetVoicePanning(Sound.Voices[i].hVoice, 128); // Center voice Sound.Voices[i].lpWave = NULL; Sound.Voices[i].playing = FALSE; } // FIXME: is this needed ? AUpdateAudio (); // FIXME: is this needed ? // Check frame sample rate audio_sample_rate = nominal_sample_rate = Audio_Infos.nSampleRate; return (MEKA_ERR_OK); }
void TB_Message_Switch(void) { t_app_messages *app = &TB_Message; // Global instance if (app->active ^= 1) Msg(MSGT_USER, "%s", Msg_Get(MSG_Message_Enabled)); else Msg(MSGT_USER, "%s", Msg_Get(MSG_Message_Disabled)); gui_box_show (app->box, app->active, TRUE); gui_menu_toggle_check (menus_ID.tools, 0); }
// Enable/disable SK-1100 emulation void SK1100_Switch() { Inputs.SK1100_Enabled ^= 1; gui_menu_toggle_check (menus_ID.inputs, 7); Skins_Background_Redraw(); gui.info.must_redraw = TRUE; if (Inputs.SK1100_Enabled) Msg(MSGT_USER, "%s", Msg_Get(MSG_Inputs_SK1100_Enabled)); else Msg(MSGT_USER, "%s", Msg_Get(MSG_Inputs_SK1100_Disabled)); }
void Blitters_Init() { ConsolePrint(Msg_Get(MSG_Blitters_Loading)); Blitters.list = NULL; Blitters.current = NULL; // Open and read file t_tfile * tf; if ((tf = tfile_read (Blitters.filename)) == NULL) Quit_Msg("%s", meka_strerror()); ConsolePrint("\n"); // Parse each line int line_cnt = 0; for (t_list* lines = tf->data_lines; lines; lines = lines->next) { const char* line = (char*)lines->elem; line_cnt += 1; int i, j; char s1 [256], s2 [256]; for (i = 0, j = 0; line [i] != 0 && line [i] != ';'; i ++) if ((line [0] == '[') || (line [i] != ' ' && line [i] != '\t')) s2 [j ++] = line [i]; s2 [j] = 0; if (StrIsNull (s2)) continue; strcpy(s1, s2); StrLower(s1); switch (Blitters_Parse_Line (s1, s2)) { case MEKA_ERR_UNKNOWN: tfile_free(tf); Quit_Msg(Msg_Get(MSG_Blitters_Error_Unrecognized), line_cnt); case MEKA_ERR_MISSING: tfile_free(tf); Quit_Msg(Msg_Get(MSG_Blitters_Error_Missing), line_cnt); case MEKA_ERR_VALUE_INCORRECT: tfile_free(tf); Quit_Msg(Msg_Get(MSG_Blitters_Error_Incorrect_Value), line_cnt); } } // Free file data tfile_free(tf); // Requires at least 1 blitter if (Blitters.count == 0) Quit_Msg("%s", Msg_Get(MSG_Blitters_Error_Not_Enough)); // Current blitter if (Blitters.blitter_configuration_name != NULL) Blitters.current = Blitters_FindBlitterByName(Blitters.blitter_configuration_name); if (Blitters.current == NULL) Blitters.current = (t_blitter*)Blitters.list->elem; // first }
void Inputs_CFG_Map_Change_Handler (t_widget *w) { t_app_inputs_config *app = &Inputs_CFG; // Global instance int MapIdx = (w->mouse_y * 8) / w->frame.size.y; t_input_src * input_src = Inputs.Sources [app->Current_Source]; if (app->Current_Map != -1) return; // Note: eating mouse press FIXME gui.mouse.buttons_prev = gui.mouse.buttons; if (input_src->flags & INPUT_SRC_FLAGS_ANALOG) { if (MapIdx >= 6) return; if (MapIdx >= 2) MapIdx += 2; // Add two because X_REL/Y_REL are not shown } switch (input_src->type) { case INPUT_SRC_TYPE_KEYBOARD: Msg (MSGT_USER_INFOLINE, Msg_Get (MSG_Inputs_Src_Map_Keyboard)); break; case INPUT_SRC_TYPE_JOYPAD: Msg (MSGT_USER_INFOLINE, Msg_Get (MSG_Inputs_Src_Map_Joypad)); break; case INPUT_SRC_TYPE_MOUSE: if (MapIdx < 4) { Msg (MSGT_USER, Msg_Get (MSG_Inputs_Src_Map_Mouse_No_A)); return; } Msg (MSGT_USER_INFOLINE, Msg_Get (MSG_Inputs_Src_Map_Mouse)); break; default: Msg (MSGT_USER, "Error #24813R"); return; } // Change cursor to the '...' one Set_Mouse_Cursor(MEKA_MOUSE_CURSOR_WAIT); // Be sure nothing is kept highlighted if (app->Current_Map != -1) Inputs_CFG_Current_Source_Draw_Map (app->Current_Map, COLOR_SKIN_WINDOW_TEXT); // Set current map, for the updater app->Current_Map = MapIdx; Inputs_CFG_Current_Source_Draw_Map (MapIdx, COLOR_SKIN_WINDOW_TEXT_HIGHLIGHT); }
// INPUTS: SET INPUT TO PADDLE CONTROLLER ------------------------------------- void Inputs_Switch_PaddleControl (void) { Inputs_CFG_Peripheral_Change (PLAYER_1, INPUT_PADDLECONTROL); // Easter egg: Pong if (Inputs_KeyPressed (KEY_P, FALSE)) Pong_Start (); Msg (MSGT_USER, Msg_Get (MSG_Inputs_PaddleControl)); Msg (MSGT_USER_BOX, Msg_Get (MSG_Inputs_Play_Mouse)); Msg (MSGT_USER_BOX, Msg_Get (MSG_Inputs_Play_Digital_Unrecommended)); gui_menu_un_check_area (menus_ID.inputs, 0, 4); gui_menu_check (menus_ID.inputs, Inputs.Peripheral [PLAYER_1]); }
void Fatal( int reason, const char *insert ) /* the reason doesn't have to be good */ { char msg_buffer[RESOURCE_MAX_SIZE]; Msg_Get( reason, msg_buffer ); printf( msg_buffer, insert ); Msg_Get( MSG_WSTRIP_ABORT, msg_buffer ); printf( msg_buffer ); Msg_Fini(); exit( -1 ); }
// ACTION: SHOW OR HIDE BACKGROUND LAYER -------------------------------------- void Action_Switch_Layer_Background (void) { opt.Layer_Mask ^= LAYER_BACKGROUND; gui_menu_inverse_check (menus_ID.layers, 1); if (opt.Layer_Mask & LAYER_BACKGROUND) { Msg (MSGT_USER, Msg_Get (MSG_Layer_BG_Enabled)); } else { Msg (MSGT_USER, Msg_Get (MSG_Layer_BG_Disabled)); } }
static void Lang_Set (t_menu_event *event) { Messages.Lang_Cur = (t_lang *)event->user_data; gui_menu_uncheck_all (menus_ID.languages); gui_menu_check (menus_ID.languages, event->menu_item_idx); Msg(MSGT_USER, Msg_Get(MSG_Language_Set), Messages.Lang_Cur->Name); Msg(MSGT_USER_BOX, "%s", Msg_Get(MSG_Language_Set_Warning)); // Post-process // FIXME: Rebuild menus gamebox_rename_all(); gui_relayout_all(); }
// ACTION: SHOW OR HIDE SPRITES LAYER ----------------------------------------------- void Action_Switch_Layer_Sprites (void) { opt.Layer_Mask ^= LAYER_SPRITES; gui_menu_inverse_check (menus_ID.layers, 0); if (opt.Layer_Mask & LAYER_SPRITES) { Msg (MSGT_USER, Msg_Get (MSG_Layer_Spr_Enabled)); } else { Msg (MSGT_USER, Msg_Get (MSG_Layer_Spr_Disabled)); } }
static unsigned MakeExeName( char * buff, unsigned max ) /******************************************************/ /* make up the "an OS/2 executable" string. */ { char rc_buff[RESOURCE_MAX_SIZE]; exe_format format; unsigned len; char * str; unsigned num; if( max <= 3 ) return( 0 ); len = 1; *buff++ = 'a'; if( FmtData.osname != NULL ) { str = FmtData.osname; } else { format = FmtData.type; for( ;; ) { num = blog_32( format ); format &= ~(1 << num); if( format == 0 ) break; } Msg_Get( MSG_FILE_TYPES_0 + num, rc_buff ); str = rc_buff; } if( IS_VOWEL( tolower(*str) ) ) { *buff++ = 'n'; len++; } *buff++ = ' '; num = strlen(str); len += num + 2; if( len > max ) return( len - (num + 2) ); memcpy( buff, str, num ); buff += num; *buff++ = ' '; if( FmtData.dll ) { Msg_Get( MSG_CREATE_TYPE_DLL, rc_buff ); str = rc_buff; } else { Msg_Get( MSG_CREATE_TYPE_EXE, rc_buff ); str = rc_buff; } num = strlen( str ); len += num; if( len > max ) return( len - num ); memcpy( buff, str, num + 1 ); /* +1 for the nullchar */ return( len ); }
// Reload current ROM file bool Reload_ROM() { if (StrIsNull(g_env.Paths.MediaImageFile)) { Msg(MSGT_USER, "%s", Msg_Get(MSG_LoadROM_Reload_No_ROM)); return false; } if (Load_ROM(LOAD_MODE_GUI, FALSE)) { Msg(MSGT_USER, "%s", Msg_Get(MSG_LoadROM_Reload_Reloaded)); return true; } return false; }
//----------------------------------------------------------------------------- // DB_Load (const char *filename) // Initialize and load given Meka DB file //----------------------------------------------------------------------------- void DB_Load (const char *filename) { t_tfile * tf; t_list * lines; char * line; int line_cnt; ConsolePrint (Msg_Get (MSG_DB_Loading)); // Open and read file tf = tfile_read (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) { line_cnt += 1; line = lines->elem; // Strip comments // FIXME // Trim spaces? // FIXME // Skip empty lines //if (line[0] == EOSTR) // continue; if (DB_Load_Line (line) == 0) { tfile_free (tf); Quit_Msg (Msg_Get (MSG_DB_SyntaxError), line_cnt); } } // Free file data tfile_free(tf); // FIXME - Uncomment for counting progress of DB transition //ConsolePrintf ("ENTRIES NEW = %d, OLD = %d\n", DB.entries_counter_format_new, DB.entries_counter_format_old); //Quit(); }
wio_size_t QWrite( f_handle file, void *buffer, wio_size_t len, char *name ) /**************************************************************************/ /* write from far memory */ { wio_size_t h; char rc_buff[RESOURCE_MAX_SIZE]; if( len == 0 ) return( 0 ); #ifdef _INT_DEBUG { wio_off_t pos = QPos(file); if( pos <= SpyWrite && SpyWrite <= pos+len && file == Root->outfile->handle) { DEBUG((DBG_ALWAYS, "About to write to %s (handle %d) %d bytes at position %d:", name, file, len, pos)); PrintMemDump(buffer, len, DUMP_BYTE); } } #endif CheckBreak(); h = write( file, buffer, len ); if( name != NULL ) { if( h == -1 ) { LnkMsg( ERR+MSG_IO_PROBLEM, "12", name, strerror( errno ) ); } else if( h != len ) { Msg_Get( MSG_IOERRLIST_7, rc_buff ); LnkMsg( (FTL+MSG_IO_PROBLEM) & ~OUT_MAP, "12", name, rc_buff ); } } return( h ); }