void declare_params(vsx_module_param_list& in_parameters, vsx_module_param_list& out_parameters) { loading_done = true; init_joysticks(); //if (!init_joystick()) return; //close( joy_fd ); //joy_fd = -1; for (int j = 0; j < joystick_count; j++) { printf("FOO num of axes: %d\n", joysticks[j].num_of_axis); joysticks[j].axis = (int *) calloc( joysticks[j].num_of_axis, sizeof( int ) ); joysticks[j].button = (char *) calloc( joysticks[j].num_of_buttons, sizeof( char ) ); joysticks[j].name = (vsx_module_param_string*)out_parameters.create(VSX_MODULE_PARAM_ID_STRING, vsx_string("j_"+i2s(j)+"_name").c_str()); joysticks[j].name->set(vsx_string(joysticks[j].name_of_joystick)); for (int i = 0; i < joysticks[j].num_of_buttons; i++) { joysticks[j].buttons[i] = (vsx_module_param_float*)out_parameters.create(VSX_MODULE_PARAM_ID_FLOAT,(vsx_string("j_"+i2s(j)+"_button")+i2s(i)).c_str()); joysticks[j].buttons[i]->set(0.0f); } for (int i = 0; i < joysticks[j].num_of_axis; i++) { joysticks[j].axes[i] = (vsx_module_param_float*)out_parameters.create(VSX_MODULE_PARAM_ID_FLOAT,(vsx_string("j_"+i2s(j)+"_axis")+i2s(i)).c_str()); joysticks[j].axes[i]->set(0.0f); } } //float_in = (vsx_module_param_float*)in_parameters.create(VSX_MODULE_PARAM_ID_FLOAT,"shutdown"); //float_in->set(0); //render_out = (vsx_module_param_render*)out_parameters.create(VSX_MODULE_PARAM_ID_RENDER,"render_out"); //-------------------------------------------------------------------------------------------------- }
void init_inputdevs() { init_keybd(); #if JOYSTICK init_joysticks(); #endif }
void module_info(vsx_module_info* info) { info->output = 1; info->identifier = "system;joystick"; info->description = "Joystick input"; info->in_param_spec = ""; info->component_class = "system"; init_joysticks(); if (joystick_count == 0) { info->out_param_spec = "no_joystick_detected:complex{}"; return; } for (int j = 0; j < joystick_count; j++) { if (j != 0) info->out_param_spec += ","; info->out_param_spec += "joystick_"+i2s(j)+":complex{j_"+i2s(j)+"_name:string,axes:complex{"; for (int i = 0; i < joysticks[j].num_of_axis; i++) { if (i != 0) info->out_param_spec += ","; info->out_param_spec += "j_"+i2s(j)+"_axis"+i2s(i)+":float"; } info->out_param_spec += "},"; info->out_param_spec += "buttons:complex{"; // printf("num of buttons: %d\n", joysticks[j].num_of_buttons); for (int i = 0; i < joysticks[j].num_of_buttons; i++) { if (i != 0) info->out_param_spec += ","; info->out_param_spec += "j_"+i2s(j)+"_button"+i2s(i)+":float"; } info->out_param_spec += "}}"; } // printf("%s\n", info->out_param_spec.c_str()); }
static int init(void) { int i; DEBUG(1, "input_sdl: init()\n"); for (i=0; fixed_inputs[i].type; i++) { inputs[i].type = fixed_inputs[i].type; inputs[i].id = fixed_inputs[i].id; strncpy(inputs[i].name, fixed_inputs[i].name, sizeof(inputs[i].name)); } inputs[i].type = 0; num_inputs = i; mouse_mode = MOUSE_POINTER; if (config_get_int("joystick")) { DEBUG(1, "input_sdl: initializing joystick subsystem\n"); if (SDL_InitSubSystem(SDL_INIT_JOYSTICK)) { ERROR("SDL_InitSubSystem(): %s", SDL_GetError()); return 1; } init_joysticks(); } return 0; }
void input_initialize() { //Clear the input arrays for(int i=0;i<3;i++){ last_mousestatus[i]=0; mousestatus[i]=0; } for(int i=0;i<256;i++){ last_keybdstatus[i]=0; keybdstatus[i]=0; } init_joysticks(); }
int main( int argc, char *argv[] ) { mt_srand(time(NULL)); printf("\nWelcome to... >> %s %s <<\n\n", opentyrian_str, opentyrian_version); printf("Copyright (C) 2007-2009 The OpenTyrian Development Team\n\n"); printf("This program comes with ABSOLUTELY NO WARRANTY.\n"); printf("This is free software, and you are welcome to redistribute it\n"); printf("under certain conditions. See the file GPL.txt for details.\n\n"); if (SDL_Init(0)) { printf("Failed to initialize SDL: %s\n", SDL_GetError()); return -1; } JE_loadConfiguration(); xmas = xmas_time(); // arg handler may override JE_paramCheck(argc, argv); JE_scanForEpisodes(); init_video(); init_keyboard(); init_joysticks(); printf("assuming mouse detected\n"); // SDL can't tell us if there isn't one if (xmas && (!dir_file_exists(data_dir(), "tyrianc.shp") || !dir_file_exists(data_dir(), "voicesc.snd"))) { xmas = false; fprintf(stderr, "warning: Christmas is missing.\n"); } JE_loadPals(); JE_loadMainShapeTables(xmas ? "tyrianc.shp" : "tyrian.shp"); if (xmas && !xmas_prompt()) { xmas = false; free_main_shape_tables(); JE_loadMainShapeTables("tyrian.shp"); } /* Default Options */ youAreCheating = false; smoothScroll = true; loadDestruct = false; if (!audio_disabled) { printf("initializing SDL audio...\n"); init_audio(); load_music(); JE_loadSndFile("tyrian.snd", xmas ? "voicesc.snd" : "voices.snd"); } else { printf("audio disabled\n"); } if (record_demo) printf("demo recording enabled (input limited to keyboard)\n"); JE_loadExtraShapes(); /*Editship*/ JE_loadHelpText(); /*debuginfo("Help text complete");*/ if (isNetworkGame) { #ifdef WITH_NETWORK if (network_init()) { network_tyrian_halt(3, false); } #else fprintf(stderr, "OpenTyrian was compiled without networking support."); JE_tyrianHalt(5); #endif } #ifdef NDEBUG if (!isNetworkGame) intro_logos(); #endif for (; ; ) { JE_initPlayerData(); JE_sortHighScores(); if (JE_titleScreen(true)) break; // user quit from title screen if (loadDestruct) { JE_destructGame(); loadDestruct = false; } else { JE_main(); } } JE_tyrianHalt(0); return 0; }
static bool retro_load_game(int argc, char *argv[] ) { if (SDL_Init(0)) { printf("Failed to initialize SDL: %s\n", SDL_GetError()); return false; } JE_loadConfiguration(); xmas = xmas_time(); // arg handler may override JE_paramCheck(argc, argv); JE_scanForEpisodes(); init_video(); init_keyboard(); init_joysticks(); printf("assuming mouse detected\n"); // SDL can't tell us if there isn't one if (xmas && (!dir_file_exists(data_dir(), "tyrianc.shp") || !dir_file_exists(data_dir(), "voicesc.snd"))) { xmas = false; fprintf(stderr, "warning: Christmas is missing.\n"); } JE_loadPals(); JE_loadMainShapeTables(xmas ? "tyrianc.shp" : "tyrian.shp"); if (xmas && !xmas_prompt()) { xmas = false; free_main_shape_tables(); JE_loadMainShapeTables("tyrian.shp"); } /* Default Options */ youAreCheating = false; smoothScroll = true; loadDestruct = false; if (!audio_disabled) { printf("initializing SDL audio...\n"); init_audio(); load_music(); JE_loadSndFile("tyrian.snd", xmas ? "voicesc.snd" : "voices.snd"); } else { printf("audio disabled\n"); } if (record_demo) printf("demo recording enabled (input limited to keyboard)\n"); JE_loadExtraShapes(); /*Editship*/ JE_loadHelpText(); /*debuginfo("Help text complete");*/ if (isNetworkGame) { #ifdef WITH_NETWORK if (network_init()) { network_tyrian_halt(3, false); } #else fprintf(stderr, "OpenTyrian was compiled without networking support."); JE_tyrianHalt(5); #endif } #ifdef NDEBUG if (!isNetworkGame) intro_logos(); #endif return true; }