예제 #1
0
void    Free_ROM (void)
{
    // Call BMemory_Save() only if Machine_Off() won't call it
    // FIXME: this is some crap hack, the whole machine thing need to be rewritten
    if (!(g_machine_flags & MACHINE_POWER_ON))
        BMemory_Save();
    Machine_OFF();
    Machine_Remove_Cartridge();
    g_machine_flags = 0;
    if (Game_ROM)
    {
        free (Game_ROM);
        Game_ROM = NULL;
        tsms.Size_ROM = 0;
        DB.current_entry = NULL;
        BIOS_Load();
    }
    if (g_machine.driver_id != DRV_COLECO)
        g_machine.driver_id = DRV_SMS;
    Machine_Reset();
    gamebox_rename_all();
    Change_System_Misc();

    // Clear filename data
    strcpy(g_env.Paths.MediaImageFile, "");
    Filenames_Init_ROM();
}
예제 #2
0
파일: bios.c 프로젝트: mnstrmnch/meka
//-----------------------------------------------------------------------------
// BIOS_Load (void)
// Load BIOS ROM
//-----------------------------------------------------------------------------
void    BIOS_Load (void)
{
    if (sms.Country == COUNTRY_JAPAN)
    {
        ROM = BIOS_ROM_Jap;
    }
    else
    {
        ROM = BIOS_ROM;
    }
    g_machine.driver_id = DRV_SMS;
    Machine_Reset();
}
예제 #3
0
void    Machine_OFF (void)
{
    if (g_machine_flags & MACHINE_POWER_ON)
    {
        BMemory_Save();
        g_machine_flags &= ~MACHINE_POWER_ON;   // Switch power Off
        CPU_Loop_Stop = TRUE;                   // Setup flag to stop Z80 emulation
        Machine_Reset();
        Skins_Background_Redraw();
        //effects.TV_Start_Line = 0;
        Effects_TV_Reset();
    }
}
예제 #4
0
void    Machine_ON (void)
{
#ifdef DEBUG_WHOLE
    Msg(MSGT_DEBUG, "Machine_ON()");
#endif
    if (!(g_machine_flags & MACHINE_POWER_ON))
    {
        g_machine_flags |= MACHINE_POWER_ON;
        CPU_Loop_Stop = TRUE;
        Machine_Reset();
        if (!(g_machine_flags & MACHINE_ROM_LOADED))
        {
#ifdef DEBUG_WHOLE
            Msg(MSGT_DEBUG, "Machine_ON() : BIOS_Load()");
#endif
            BIOS_Load();
            Machine_Remove_Cartridge();
        }
        Skins_Background_Redraw();
    }
}
예제 #5
0
파일: inputs.c 프로젝트: dafyddcrosby/meka
//-----------------------------------------------------------------------------
// Inputs_Check_GUI ()
// Check for GUI related inputs
//-----------------------------------------------------------------------------
// Note: 'sk1100_pressed' tells if SK-1100 emulation has taken a key yet.
// Specific checks are being done here to avoid collision.
//-----------------------------------------------------------------------------
void        Inputs_Check_GUI (bool sk1100_pressed)
{
    // Update INPUTS configuration in priority, since it eat some keys
    Inputs_CFG_Update(&Inputs_CFG);
    //Inputs_CFG_Map_Change_Update();
    //if (Inputs_CFG.active)
    //    Inputs_CFG.Box->update ();

    switch (key_shifts & (KB_CTRL_FLAG | KB_ALT_FLAG | KB_SHIFT_FLAG))
    {
    case 0: // No modifiers
        {
            // State save/load
            if (Inputs_KeyPressed (KEY_F5, FALSE))
                Save_Game ();
            if (Inputs_KeyPressed (KEY_F7, FALSE))
                Load_Game ();

            // State change slot
            /*
            if (cur_drv->id != DRV_COLECO)
                if (!gui.box_z_ordered[0]->focus_inputs_exclusive) // check note in inputs_u.c::Inputs_Emulation_Update()
                {
                    if (Inputs_KeyPressed (KEY_0, FALSE))  Save_Set_Slot (0);
                    if (Inputs_KeyPressed (KEY_1, FALSE))  Save_Set_Slot (1);
                    if (Inputs_KeyPressed (KEY_2, FALSE))  Save_Set_Slot (2);
                    if (Inputs_KeyPressed (KEY_3, FALSE))  Save_Set_Slot (3);
                    if (Inputs_KeyPressed (KEY_4, FALSE))  Save_Set_Slot (4);
                    if (Inputs_KeyPressed (KEY_5, FALSE))  Save_Set_Slot (5);
                    if (Inputs_KeyPressed (KEY_6, FALSE))  Save_Set_Slot (6);
                    if (Inputs_KeyPressed (KEY_7, FALSE))  Save_Set_Slot (7);
                    if (Inputs_KeyPressed (KEY_8, FALSE))  Save_Set_Slot (8);
                    if (Inputs_KeyPressed (KEY_9, FALSE))  Save_Set_Slot (9);
                }
            */
            if (Inputs_KeyPressed_Repeat (KEY_F6, FALSE, 30, 3)) 
                Save_Set_Slot (opt.State_Current - 1);
            if (Inputs_KeyPressed_Repeat (KEY_F8, FALSE, 30, 3)) 
                Save_Set_Slot (opt.State_Current + 1);

            // Blitters switch
            if (Inputs_KeyPressed (KEY_F1, FALSE))    
                Blitters_SwitchNext();

            // Speed & Frame skip 
            if (Inputs_KeyPressed (KEY_F2, FALSE))
                Frame_Skipper_Switch ();
            if (Inputs_KeyPressed (KEY_F3, FALSE))
                Frame_Skipper_Configure (-1);
            if (Inputs_KeyPressed (KEY_F4, FALSE))
                Frame_Skipper_Configure (1);

            // Input peripheral
            if (Inputs_KeyPressed (KEY_F9, FALSE))
                Inputs_Peripheral_Next (PLAYER_1);

            // Switch mode (Fullscreen <-> GUI)
            if (Inputs_KeyPressed (Inputs.Cabinet_Mode ? KEY_F10 : KEY_ESC, FALSE))
                Action_Switch_Mode ();

            // Sprites Refresh switch
            if (Inputs_KeyPressed (KEY_F11, FALSE))
                Action_Switch_Layer_Sprites ();

            // Hard Pause
            if (Inputs_KeyPressed (KEY_F12, FALSE))
                Machine_Pause_Need_To = TRUE;
        }
        break;
    case KB_CTRL_FLAG:
        {
            // Easter egg: Tetris
            if (!sk1100_pressed && Inputs_KeyPressed (KEY_T, FALSE))
                Tetris_Start ();
            // Nintendon't - now removed because it is too violent
            #ifdef ARCH_DOS
                if (!sk1100_pressed && Inputs_KeyPressed (KEY_N, FALSE))     
                    Quit_Msg ("Nintendont.");
            #endif

            // Hard Pause
            if (Inputs_KeyPressed (KEY_F12, FALSE) || (!sk1100_pressed && Inputs_KeyPressed (KEY_P, FALSE)))
                Machine_Pause_Need_To = TRUE;
            // Hard Reset
            if (!sk1100_pressed && Inputs_KeyPressed (KEY_BACKSPACE, TRUE)) // Note: eat backspace to avoid triggering software reset as well
                Machine_Reset ();

            // CTRL-TAB cycle thru boxes with TAB_STOP flag
            if (Inputs_KeyPressed(KEY_TAB, FALSE))
            {
                int n;

                // Remove keypress
                // FIXME-KEYPRESS
                t_list *keypresses;
                for (keypresses = Inputs.KeyPressedQueue; keypresses != NULL; )
                {
                    t_key_press *keypress = keypresses->elem;
                    keypresses = keypresses->next;
                    if (keypress->scancode == KEY_TAB)
                        list_remove(&Inputs.KeyPressedQueue, keypress);
                }

                // Cycle focus
                for (n = gui.boxes_count - 1; n >= 0; n--)
                {
                    t_gui_box *b = gui.boxes_z_ordered[n];
                    if ((b->flags & GUI_BOX_FLAGS_TAB_STOP) && (b->flags & GUI_BOX_FLAGS_ACTIVE))
                    {
                        gui_box_set_focus(b);
                        break;
                    }
                }
            }

        }
        break;
   case KB_ALT_FLAG:
       {
           // SK-1100 Keyboard switch
           if (Inputs_KeyPressed (KEY_F9, FALSE))        
               Keyboard_Switch ();
           // Background Refresh switch
           if (Inputs_KeyPressed (KEY_F11, FALSE)) 
               Action_Switch_Layer_Background ();
           // Next frame (pause hack)
           if (Inputs_KeyPressed (KEY_F12, FALSE))
               Machine_Pause_Need_To = (machine & MACHINE_PAUSED) ? 2 : 1;

           if (!sk1100_pressed)
           {
               // FPS Counter switch
               if (Inputs_KeyPressed (KEY_F, FALSE))         
                   Frame_Skipper_Switch_FPS_Counter ();
               // Applets hotkeys
               if (Inputs_KeyPressed (KEY_L, FALSE))         FB_Switch ();
               if (Inputs_KeyPressed (KEY_O, FALSE))         Options_Switch ();
               if (Inputs_KeyPressed (KEY_M, FALSE))         TB_Message_Switch ();
               if (Inputs_KeyPressed (KEY_P, FALSE))         PaletteViewer_Switch();
               if (Inputs_KeyPressed (KEY_T, FALSE))         TileViewer_Switch ();
               if (Inputs_KeyPressed (KEY_I, FALSE))         TechInfo_Switch ();
               // Quit emulator
               if (Inputs_KeyPressed (KEY_X, FALSE))         
                   opt.Force_Quit = TRUE;
               // Hard Reset
               if (Inputs_KeyPressed (KEY_BACKSPACE, TRUE))  // Note: eat backspace to avoid triggering software reset as well
                   Machine_Reset ();

               // GUI fullscreen/windowed
                if (Inputs_KeyPressed (KEY_ENTER, FALSE))
                {
                    if (Meka_State == MEKA_STATE_FULLSCREEN)
                    {
                        t_video_driver *driver = VideoDriver_FindByDriverId(Blitters.current->driver);
                        if (driver && driver->drv_id_switch_fs_win)
                        {
                            // FIXME: Put that properly in blitter interface
                            // FIXME: Not saved anywhere... better than nothing anyway.
                            Blitters.current->driver = driver->drv_id_switch_fs_win;
                            Video_Setup_State();
                        }
                    }
                    else if (Meka_State == MEKA_STATE_GUI)
                    {
                        t_video_driver *driver = VideoDriver_FindByDriverId(g_Configuration.video_mode_gui_driver);
                        if (driver && driver->drv_id_switch_fs_win)
                        {
                            g_Configuration.video_mode_gui_driver = driver->drv_id_switch_fs_win;
                            Video_GUI_ChangeVideoMode(g_Configuration.video_mode_gui_res_x, g_Configuration.video_mode_gui_res_y, g_Configuration.video_mode_gui_depth);
                        }
                    }
                    return;
                }

           }
       }
       break;
    }

    // Quit emulator
    if (key [Inputs.Cabinet_Mode ? KEY_ESC : KEY_F10]) 
        opt.Force_Quit = TRUE;

    // Debugger switch
    #ifdef MEKA_Z80_DEBUGGER
        // Disabled when SK-1100 is emulated because of collision in usage of ScrollLock key
        // Actually on SC-3000 it is hardwired to NMI
        if (!Inputs.Keyboard_Enabled && Inputs_KeyPressed (KEY_SCRLOCK, TRUE))
        //if (!sk1100_pressed && Inputs_KeyPressed (KEY_SCRLOCK, TRUE))
            Debugger_Switch ();
    #endif

    // Screen capture
    if (Inputs_KeyPressed (KEY_PRTSCR, FALSE))
        Capture_Request();

    // SF-7000 Disk 21 Bomber Raid
    // if (Test_Key(KEY_W))
    //     PSG.Registers[6] = PSG.Registers[6] ^ 0x04;

    // Wonder Boy III, Current Song
    //if (key[KEY_J])
    //   Msg (0, "RAM[0xFF9] = %02X", RAM[0xFF9]);

    // Old video modes debugging
    // if (Test_Key(KEY_J)) BACK_AREA -= 0x100;
    // if (Test_Key(KEY_K)) BACK_AREA += 0x100;
    // if (Test_Key(KEY_U)) BACK_AREA -= 0x1;
    // if (Test_Key(KEY_I)) BACK_AREA += 0x1;
    // SG-1000 stuff
    // if (Test_Key(KEY_U)) SG_BACK_TILE -= 0x100;
    // if (Test_Key(KEY_I)) SG_BACK_TILE += 0x100;
    // if (Test_Key(KEY_O)) SG_BACK_TILE -= 0x2000;
}
예제 #6
0
파일: bios.c 프로젝트: mnstrmnch/meka
//-----------------------------------------------------------------------------
// BIOS_Switch_to_Game (void)
// Switch from loaded BIOS to ROM
//-----------------------------------------------------------------------------
void    BIOS_Switch_to_Game (void)
{
	BIOS_Unload();
	Machine_Reset();
}