void snes_init() { memset(&Settings, 0, sizeof(Settings)); Settings.MouseMaster = TRUE; Settings.SuperScopeMaster = TRUE; Settings.JustifierMaster = TRUE; Settings.MultiPlayer5Master = TRUE; Settings.FrameTimePAL = 20000; Settings.FrameTimeNTSC = 16667; Settings.SixteenBitSound = TRUE; Settings.Stereo = TRUE; Settings.SoundPlaybackRate = 32000; Settings.SoundInputRate = 32000; Settings.SupportHiRes = TRUE; Settings.Transparency = TRUE; Settings.AutoDisplayMessages = TRUE; Settings.InitialInfoStringTimeout = 120; Settings.HDMATimingHack = 100; Settings.BlockInvalidVRAMAccessMaster = TRUE; Settings.StopEmulation = TRUE; Settings.WrongMovieStateProtection = TRUE; Settings.DumpStreamsMaxFrames = -1; Settings.StretchScreenshots = 1; Settings.SnapshotScreenshots = TRUE; Settings.SkipFrames = AUTO_FRAMERATE; Settings.TurboSkipFrames = 15; Settings.CartAName[0] = 0; Settings.CartBName[0] = 0; Settings.AutoSaveDelay = 1; CPU.Flags = 0; if (!Memory.Init() || !S9xInitAPU()) { Memory.Deinit(); S9xDeinitAPU(); fprintf(stderr, "[libsnes]: Failed to init Memory or APU.\n"); exit(1); } S9xInitSound(64, 0); S9xSetSoundMute(FALSE); S9xSetSamplesAvailableCallback(S9xAudioCallback, NULL); S9xSetRenderPixelFormat(RGB555); GFX.Pitch = 2048; GFX.Screen = (uint16*) calloc(1, GFX.Pitch * 512 * sizeof(uint16)); S9xGraphicsInit(); S9xInitInputDevices(); for (int i = 0; i < 2; i++) { S9xSetController(i, CTL_JOYPAD, i, 0, 0, 0); snes_devices[i] = SNES_DEVICE_JOYPAD; } S9xUnmapAllControls(); map_buttons(); }
static void snes_init (void) { memset(&Settings, 0, sizeof(Settings)); Settings.SpeedhackGameID = SPEEDHACK_NONE; Settings.Transparency = TRUE; Settings.FrameTimePAL = 20000; Settings.FrameTimeNTSC = 16667; Settings.SoundPlaybackRate = 32000; Settings.SoundInputRate = 32000; Settings.HDMATimingHack = 100; Settings.BlockInvalidVRAMAccessMaster = TRUE; Settings.CartAName[0] = 0; Settings.CartBName[0] = 0; Settings.Crosshair = 1; CPU.Flags = 0; if (!Init() || !S9xInitAPU()) { Deinit(); S9xDeinitAPU(); if (log_cb) log_cb(RETRO_LOG_ERROR, "Failed to init Memory or APU.\n"); exit(1); } //very slow devices will still pop //this needs to be applied to all snes9x cores //increasing the buffer size does not cause extra lag(tested with 1000ms buffer) //bool8 S9xInitSound (int buffer_ms, int lag_ms) S9xInitSound(1000, 0);//just give it a 1 second buffer S9xSetSamplesAvailableCallback(S9xAudioCallback); GFX.Pitch = use_overscan ? 1024 : 2048; // FIXME: What is this supposed to do? Overscan has nothing to do with anything like this. If this is the Wii performance hack, it should be done differently. #if defined(_POSIX_C_SOURCE) && (_POSIX_C_SOURCE >= 200112L) /* request 128-bit alignment here if possible */ posix_memalign((void**)&GFX.Screen, 16, GFX.Pitch * 512 * sizeof(uint16)); #else GFX.Screen = (uint16*) calloc(1, GFX.Pitch * 512 * sizeof(uint16)); #endif S9xGraphicsInit(); retro_set_controller_port_device(0, RETRO_DEVICE_JOYPAD); retro_set_controller_port_device(1, RETRO_DEVICE_JOYPAD); S9xUnmapAllControls(); map_buttons(); /* Initialize SuperFX CPU to normal speed by default */ Settings.SuperFXSpeedPerLine = 0.417 * 10.5e6; }
EXPORT void snes_init() { int i; if(environ_cb) { unsigned pitch; if (!environ_cb(SNES_ENVIRONMENT_GET_OVERSCAN, &use_overscan)) use_overscan = FALSE; if (use_overscan) { struct snes_geometry geom = {256, 239, 512, 512}; environ_cb(SNES_ENVIRONMENT_SET_GEOMETRY, &geom); pitch = 1024; environ_cb(SNES_ENVIRONMENT_SET_PITCH, &pitch); } } memset(&Settings, 0, sizeof(Settings)); Settings.FrameTimePAL = 20000; Settings.FrameTimeNTSC = 16667; Settings.SoundPlaybackRate = 32000; Settings.SoundInputRate = 32000; Settings.HDMATimingHack = 100; Settings.BlockInvalidVRAMAccessMaster = TRUE; Settings.CartAName[0] = 0; Settings.CartBName[0] = 0; Settings.Crosshair = 1; CPU.Flags = 0; if (!Init() || !S9xInitAPU()) { Deinit(); S9xDeinitAPU(); fprintf(stderr, "[libsnes]: Failed to init Memory or APU.\n"); exit(1); } S9xInitSound(16, 0); S9xSetSamplesAvailableCallback(S9xAudioCallback); GFX.Pitch = use_overscan ? 1024 : 2048; GFX.Screen = (uint16*) calloc(1, GFX.Pitch * 512 * sizeof(uint16)); S9xGraphicsInit(); for ( i = 0; i < 2; i++) { S9xSetController(i, CTL_JOYPAD, i, 0, 0, 0); snes_devices[i] = SNES_DEVICE_JOYPAD; } S9xUnmapAllControls(); map_buttons(); }
void snes_init() { memset(&Settings, 0, sizeof(Settings)); Settings.MouseMaster = TRUE; Settings.SuperScopeMaster = TRUE; Settings.JustifierMaster = TRUE; Settings.MultiPlayer5Master = TRUE; Settings.FrameTimePAL = 20000; Settings.FrameTimeNTSC = 16667; Settings.SoundPlaybackRate = 32000; Settings.SoundInputRate = 32000; Settings.AutoDisplayMessages = TRUE; Settings.InitialInfoStringTimeout = 120; Settings.HDMATimingHack = 100; Settings.BlockInvalidVRAMAccessMaster = TRUE; Settings.CartAName[0] = 0; Settings.CartBName[0] = 0; Settings.AutoSaveDelay = 1; CPU.Flags = 0; if (!Memory.Init() || !S9xInitAPU()) { Memory.Deinit(); S9xDeinitAPU(); fprintf(stderr, "[libsnes]: Failed to init Memory or APU.\n"); exit(1); } S9xInitSound(16, 0); S9xSetSamplesAvailableCallback(S9xAudioCallback); S9xSetRenderPixelFormat(RGB555); GFX.Pitch = 2048; GFX.Screen = (uint16*) calloc(1, GFX.Pitch * 512 * sizeof(uint16)); S9xGraphicsInit(); S9xInitInputDevices(); for (int i = 0; i < 2; i++) { S9xSetController(i, CTL_JOYPAD, i, 0, 0, 0); snes_devices[i] = SNES_DEVICE_JOYPAD; } S9xUnmapAllControls(); map_buttons(); }
void mouse_button(int down,int up,int rep) { if(rep==0) { msend(0,0,0,rep,down,up); if(down&BUTTON1) ms.buttons[map_buttons(BUTTON1)]=button_down; if(down&BUTTON2) ms.buttons[map_buttons(BUTTON2)]=button_down; if(down&BUTTON3) ms.buttons[map_buttons(BUTTON3)]=button_down; if(up&BUTTON1) ms.buttons[map_buttons(BUTTON1)]=button_up; if(up&BUTTON2) ms.buttons[map_buttons(BUTTON2)]=button_up; if(up&BUTTON3) ms.buttons[map_buttons(BUTTON3)]=button_up; } }
void mouse_conv(int rep,char *button,char *remote) { struct trans_mouse *tm; int found=0; tm=tm_first; while(tm!=NULL) { if(tm->tm_remote!=ALL) { if(strcasecmp(remote,tm->tm_remote)!=0) { tm=tm->tm_next; continue; } } if(tm->tm_button!=ALL) { if(strcasecmp(button,tm->tm_button)!=0) { tm=tm->tm_next; continue; } } if(tm->tm_directive==mouse_activate) { if(ms.active==0 && ms.always_active==0) { activate(); } } else if(tm->tm_directive==mouse_toggle_activate && rep==0) { if(ms.always_active==0) { if(ms.active==0) { activate(); ms.toggle_active=1; } else { deactivate(); } } } if(ms.active || ms.always_active) { int i; for(i=0;config_table[i].string!=NULL;i++) { if(tm->tm_directive==config_table[i].d) { int x,y,z,up,down,toggle; x=config_table[i].x; y=config_table[i].y; z=config_table[i].z; down=config_table[i].down; up=config_table[i].up; toggle=config_table[i].toggle; if(x || y || z) { mouse_move(x,y,z,rep); } if(toggle) { /* assert(down==up); assert(up==BUTTON1 || up==BUTTON2 || up==BUTTON3); */ if(ms.buttons[map_buttons(up)]==button_up) mouse_button(down,0,rep); else mouse_button(0,up,rep); } else { if(down && up) /* click */ { mouse_button(down,0,rep); #ifdef CLICK_DELAY usleep(CLICK_DELAY); #endif mouse_button(0,up,rep); } else if(down || up); { mouse_button(down,up,rep); } } break; } } } found=1; tm=tm->tm_next; } if(found==0) { if(ms.active==1 && ms.always_active==0 && ms.toggle_active==0) { deactivate(); } } }