void sysex_process_online(void) { uint8_t block_type, sub_type, data_type, cmd_type; int8_t motor_speed; // read block type. read_sysex_type(&block_type, &sub_type, ON_LINE); if((block_type != g_block_type) || (sub_type != g_block_sub_type)) { send_sysex_error_code(WRONG_TYPE); return; } // read command type. data_type = BYTE_8; if(read_next_sysex_data(&data_type, &cmd_type, ON_LINE)== false) { return; } if(cmd_type == CTL_SET_MOTOR_SPEED) { // read data. data_type = BYTE_16; if(read_next_sysex_data(&data_type, &motor_speed, ON_LINE) == false) { return; } // excute. dc_run(MOTOR_1, motor_speed); } }
int main(int argc, char* argv[]) { // Start the Dark Core Reactor! dc_init(640, 480); world = dc_world_create(); generate_map(&world); dc_object obj = dc_object_create(); dc_object_set_x(&obj, 10); dc_object_set_y(&obj, 1); dc_object_set_on_key_press(&obj, obj_on_key_press); dc_world_add_object(&world, &obj); // Load the texture struct dc_texture tex; dc_texture_create(&tex, "resources/grass-tiles-2-small.png", "png"); dc_world_add_texture(&world, &tex); // Map tiles to texture dc_tile t1, t2, t3; dc_texture_map(&world, &t1, "Grass", 0, 0, 6, 2, 0); dc_world_add_tile(&world, &t1); dc_texture_map(&world, &t2, "Grass", 5, 0, 6, 2, 0); dc_world_add_tile(&world, &t2); dc_texture_map(&world, &t3, "Dirt", 4, 0, 6, 2, 1); dc_world_add_tile(&world, &t3); dc_run(&world); dc_texture_destory(&tex); return 0; }
void sysex_process_offline(void) { uint16_t uniform_value = 0; uint8_t motor_speed = 0; uniform_value = read_uniform_value(); motor_speed = line_map(uniform_value, MOTOR_SPEED_MIN, MOTOR_SPEED_MAX, UNIFORM_MIN, UNIFORM_MAX); dc_run(MOTOR_1, motor_speed); }
int main(int argc, wchar* argv[]) { //if (argc==2) //ndcid=atoi(argv[1]); if (setup_curses() < 0) die("failed to setup curses!\n"); #ifdef TARGET_PANDORA signal(SIGSEGV, clean_exit); signal(SIGKILL, clean_exit); #endif #if defined(USES_HOMEDIR) && HOST_OS != OS_DARWIN string home = (string)getenv("HOME"); if(home.c_str()) { home += "/.reicast"; mkdir(home.c_str(), 0755); // create the directory if missing SetHomeDir(home); } else SetHomeDir("."); #else SetHomeDir("."); #endif /* #if defined(SUPPORT_X11) x11_keymap[113] = DPad_Left; x11_keymap[114] = DPad_Right; x11_keymap[111] = DPad_Up; x11_keymap[116] = DPad_Down; x11_keymap[52] = Btn_Y; x11_keymap[53] = Btn_X; x11_keymap[54] = Btn_B; x11_keymap[55] = Btn_A; x11_keymap[36] = Btn_Start; #endif */ printf("Home dir is: %s\n",GetPath("/").c_str()); common_linux_setup(); SetupInput(); settings.profile.run_counts=0; dc_init(argc,argv); dc_run(); #ifdef TARGET_PANDORA clean_exit(0); #endif return 0; }
JNIEXPORT void JNICALL Java_com_reicast_emulator_JNIdc_run(JNIEnv *env,jobject obj,jobject trk) { install_prof_handler(0); jenv=env; track=trk; jsamples=env->NewShortArray(SAMPLE_COUNT*2); writemid=env->GetMethodID(env->GetObjectClass(track),"WriteBuffer","([SI)I"); dc_run(); }
void* emuthread(void* ) { printf("Emu thread starting up"); char *Args[3]; Args[0] = "dc"; set_user_config_dir("/http"); set_user_data_dir("/http"); dc_init(1,Args); dc_run(); return 0; }
JNIEXPORT void JNICALL Java_com_reicast_emulator_emu_JNIdc_run(JNIEnv *env,jobject obj,jobject emu_thread) { install_prof_handler(0); jenv=env; emu=emu_thread; jsamples=env->NewShortArray(SAMPLE_COUNT*2); writemid=env->GetMethodID(env->GetObjectClass(emu),"WriteBuffer","([SI)I"); coreMessageMid=env->GetMethodID(env->GetObjectClass(emu),"coreMessage","([B)V"); dieMid=env->GetMethodID(env->GetObjectClass(emu),"Die","()V"); // msgboxf("HELLO!", MBX_OK); dc_run(); }
int CALLBACK WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShowCmd) { ReserveBottomMemory(); tick_thd.Start(); int argc=0; wchar* cmd_line=GetCommandLineA(); wchar** argv=CommandLineToArgvA(cmd_line,&argc); if(strstr(cmd_line,"NoConsole")==0) { if (AllocConsole()) { freopen("CON","w",stdout); freopen("CON","w",stderr); freopen("CON","r",stdin); } SetConsoleCtrlHandler( (PHANDLER_ROUTINE) CtrlHandler, TRUE ); } SetupPath(); //SetUnhandledExceptionFilter(&ExeptionHandler); __try { int dc_init(int argc,wchar* argv[]); void dc_run(); void dc_term(); dc_init(argc,argv); #ifdef _WIN64 setup_seh(); #endif dc_run(); dc_term(); } __except( ExeptionHandler(GetExceptionInformation()) ) { printf("Unhandled exception - Emulation thread halted...\n"); } SetUnhandledExceptionFilter(0); return 0; }
int main(int argc, wchar* argv[]) { //if (argc==2) //ndcid=atoi(argv[1]); #if defined(USES_HOMEDIR) string home = (string)getenv("HOME"); if(home.c_str()) { home += "/.reicast"; mkdir(home.c_str(), 0755); // create the directory if missing SetHomeDir(home); } else SetHomeDir("."); #else SetHomeDir("."); #endif printf("Home dir is: %s\n",GetPath("/").c_str()); common_linux_setup(); printf("common linux setup done\n"); settings.profile.run_counts=0; dc_init(argc,argv); if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_JOYSTICK|SDL_INIT_NOPARACHUTE)==-1) die("error initializing SDL"); SetupInput(); #ifdef USE_OSS init_sound(); #endif dc_run(); clean_exit(0); return 0; }
int main(int argc, wchar* argv[]) { if (setup_curses() < 0) { printf("failed to setup curses!\n"); } #ifdef TARGET_PANDORA signal(SIGSEGV, clean_exit); signal(SIGKILL, clean_exit); #endif /* Set home dir */ string home = "."; #if defined(USES_HOMEDIR) if(getenv("HOME") != NULL) { home = (string)getenv("HOME") + "/.reicast"; mkdir(home.c_str(), 0755); // create the directory if missing } #endif SetHomeDir(home); printf("Home dir is: %s\n", GetPath("/").c_str()); #if defined(SUPPORT_X11) x11_keymap[113] = DPad_Left; x11_keymap[114] = DPad_Right; x11_keymap[111] = DPad_Up; x11_keymap[116] = DPad_Down; x11_keymap[52] = Btn_Y; x11_keymap[53] = Btn_X; x11_keymap[54] = Btn_B; x11_keymap[55] = Btn_A; /* //TODO: Fix sliders x11_keymap[38] = DPad_Down; x11_keymap[39] = DPad_Down; */ x11_keymap[36] = Btn_Start; #endif common_linux_setup(); SetupInput(); settings.profile.run_counts=0; dc_init(argc,argv); #if !defined(TARGET_EMSCRIPTEN) dc_run(); #else emscripten_set_main_loop(&dc_run, 100, false); #endif #ifdef TARGET_PANDORA clean_exit(0); #endif return 0; }