Exemple #1
0
/* Loads a keyboard map from a section in the configuration file */
void load_keyboard_map(keyboard_map & kb_map, char const * section_name)
{
    if (cfgOpen())
    {
        // Loading analog keys
        kb_map.key_axis_up = cfgLoadInt(section_name, "keyboard.axis_up", -1);
        kb_map.key_axis_down = cfgLoadInt(section_name, "keyboard.axis_down", -1);
        kb_map.key_axis_left = cfgLoadInt(section_name, "keyboard.axis_left", -1);
        kb_map.key_axis_right = cfgLoadInt(section_name, "keyboard.axis_right", -1);
        kb_map.key_axis_lt = cfgLoadInt(section_name, "keyboard.axis_lt", -1);
        kb_map.key_axis_rt = cfgLoadInt(section_name, "keyboard.axis_rt", -1);

        // Loading buttons keys
        unsigned int dpad_up = cfgLoadInt(section_name, "keyboard.dpad_up", -1);
        unsigned int dpad_down = cfgLoadInt(section_name, "keyboard.dpad_down", -1);
        unsigned int dpad_left = cfgLoadInt(section_name, "keyboard.dpad_left", -1);
        unsigned int dpad_right = cfgLoadInt(section_name, "keyboard.dpad_right", -1);
        unsigned int button_A = cfgLoadInt(section_name, "keyboard.A", -1);
        unsigned int button_B = cfgLoadInt(section_name, "keyboard.B", -1);
        //unsigned int button_C = cfgLoadInt(section_name, "keyboard.C", -1);
        unsigned int button_X = cfgLoadInt(section_name, "keyboard.X", -1);
        unsigned int button_Y = cfgLoadInt(section_name, "keyboard.Y", -1);
        //unsigned int button_Z = cfgLoadInt(section_name, "keyboard.Z", -1);
        unsigned int button_start = cfgLoadInt(section_name, "keyboard.start", -1);

        kb_map.keymap[dpad_up] = DPad_Up;
        kb_map.keymap[dpad_down] = DPad_Down;
        kb_map.keymap[dpad_left] = DPad_Left;
        kb_map.keymap[dpad_right] = DPad_Right;
        kb_map.keymap[button_A] = Btn_A;
        kb_map.keymap[button_B] = Btn_B;
        //kb_map.keymap[button_C] = Btn_C;
        kb_map.keymap[button_X] = Btn_X;
        kb_map.keymap[button_Y] = Btn_Y;
        //kb_map.keymap[button_Z] = Btn_Z;
        kb_map.keymap[button_start] = Btn_Start;

    }
}
Exemple #2
0
/* Loads a joystick map from a section in the configuration file */
void load_joystick_map(joystick_map & js_map, char const * section_name)
{
    // Initialize the file descriptor for the current joystick in case
    // no joystick is found
    js_map.js.file_descriptor = -1;

    if (cfgOpen())
    {
        // Find the desired controller's name
        char target_name[128];
        cfgLoadStr(section_name, "controller.name", target_name, "None");
        printf("Using following controller: %s\n", target_name);
        // We find the corresponding controller
        for (int i = 0; i <= 3; ++i)
        {
            // We check if the names match
            if (strcmp(js[i].name, target_name) == 0)
            {
                js_map.js = js[i];
                // We erase the name so the same controller is not used twice
                js[i].name[0] = '\0';
                // And we stop looking for other controllers
                break;
            }
        }

        if (js_map.js.file_descriptor < 0)
        {
            // If no controller was found, no need to load the configuration
            return;
        }

        // Loading axis mapping
        int id_axis_x = cfgLoadInt(section_name, "js.axis_x", -1);
        int id_axis_y = cfgLoadInt(section_name, "js.axis_y", -1);
        int id_axis_lt = cfgLoadInt(section_name, "js.axis_lt", -1);
        int id_axis_rt = cfgLoadInt(section_name, "js.axis_rt", -1);
        int id_axis_dpad_x = cfgLoadInt(section_name, "js.axis_dpad_x", -1);
        int id_axis_dpad_y = cfgLoadInt(section_name, "js.axis_dpad_y", -1);

        js_map.id_axis_x = id_axis_x;
        js_map.id_axis_y = id_axis_y;
        js_map.id_axis_lt = id_axis_lt;
        js_map.id_axis_rt = id_axis_rt;
        js_map.id_axis_dpad_x = id_axis_dpad_x;
        js_map.id_axis_dpad_y = id_axis_dpad_y;

        // Loading buttons mapping
        int button_A = cfgLoadInt(section_name, "js.button_A", -1);
        int button_B = cfgLoadInt(section_name, "js.button_B", -1);
        int button_C = cfgLoadInt(section_name, "js.button_C", -1);
        int button_X = cfgLoadInt(section_name, "js.button_X", -1);
        int button_Y = cfgLoadInt(section_name, "js.button_Y", -1);
        int button_Z = cfgLoadInt(section_name, "js.button_Z", -1);
        int button_start = cfgLoadInt(section_name, "js.button_start", -1);

        js_map.button_map[button_A] = Btn_A;
        js_map.button_map[button_B] = Btn_B;
        js_map.button_map[button_C] = Btn_C;
        js_map.button_map[button_X] = Btn_X;
        js_map.button_map[button_Y] = Btn_Y;
        js_map.button_map[button_Z] = Btn_Z;
        js_map.button_map[button_start] = Btn_Start;
    }
}
Exemple #3
0
int dc_init(int argc,wchar* argv[])
{
	setbuf(stdin,0);
	setbuf(stdout,0);
	setbuf(stderr,0);
	if (!_vmem_reserve())
	{
		printf("Failed to alloc mem\n");
		return -1;
	}

#if !defined(TARGET_NO_WEBUI)
	webui_thd.Start();
#endif

	if(ParseCommandLine(argc,argv))
	{
		return 69;
	}
	if(!cfgOpen())
	{
		msgboxf("Unable to open config file",MBX_ICONERROR);
		return -4;
	}
	LoadSettings();
#ifndef _ANDROID
	os_CreateWindow();
#endif

	int rv= 0;

#if HOST_OS != OS_DARWIN
    #define DATA_PATH "/data/"
#else
    #define DATA_PATH "/"
#endif
    
	if (settings.bios.UseReios || !LoadRomFiles(GetPath(DATA_PATH)))
	{
		if (!LoadHle(GetPath(DATA_PATH)))
			return -3;
		else
			printf("Did not load bios, using reios\n");
	}

#if FEAT_SHREC != DYNAREC_NONE
	if(settings.dynarec.Enable)
	{
		Get_Sh4Recompiler(&sh4_cpu);
		printf("Using Recompiler\n");
	}
	else
#endif
	{
		Get_Sh4Interpreter(&sh4_cpu);
		printf("Using Interpreter\n");
	}
	
  InitAudio();

	sh4_cpu.Init();
	mem_Init();

	plugins_Init();
	
	mem_map_default();

#ifndef _ANDROID
	mcfg_CreateDevices();
#else
    mcfg_CreateDevices();
#endif

	plugins_Reset(false);
	mem_Reset(false);
	

	sh4_cpu.Reset(false);
	
	return rv;
}
int dc_init(int argc,wchar* argv[])
{
	setbuf(stdin,0);
	setbuf(stdout,0);
	setbuf(stderr,0);
	if (!_vmem_reserve())
	{
		printf("Failed to alloc mem\n");
		return -1;
	}

	if(ParseCommandLine(argc,argv))
	{
		return 69;
	}

	if(!cfgOpen())
	{
		msgboxf("Unable to open config file",MBX_ICONERROR);
		return -4;
	}
	LoadSettings();

#ifndef _ANDROID
	os_CreateWindow();
#endif

	int rv= 0;


	if (!LoadRomFiles(GetPath("/data/")))
	{
		return -3;
	}

#if !defined(HOST_NO_REC)
	if(settings.dynarec.Enable)
	{
		Get_Sh4Recompiler(&sh4_cpu);
		printf("Using Recompiler\n");
	}
	else
#endif
	{
		Get_Sh4Interpreter(&sh4_cpu);
		printf("Using Interpreter\n");
	}
	
	  void InitAudio();
  InitAudio();

	sh4_cpu.Init();
	mem_Init();

	plugins_Init();
	
	mem_map_default();

	mcfg_CreateDevices();

	plugins_Reset(false);
	mem_Reset(false);
	

	sh4_cpu.Reset(false);
	
	return rv;
}