void Java_org_deadc0de_apple2ix_Apple2Preferences_nativeSetCPUSpeed(JNIEnv *env, jclass cls, jint percentSpeed) { LOG("percentSpeed : %d%%", percentSpeed); #if TESTING cpu_scale_factor = CPU_SCALE_FASTEST; cpu_altscale_factor = CPU_SCALE_FASTEST; timing_initialize(); #else bool wasPaused = cpu_isPaused(); if (!wasPaused) { cpu_pause(); } cpu_scale_factor = percentSpeed/100.0; if (cpu_scale_factor > CPU_SCALE_FASTEST) { cpu_scale_factor = CPU_SCALE_FASTEST; } if (cpu_scale_factor < CPU_SCALE_SLOWEST) { cpu_scale_factor = CPU_SCALE_SLOWEST; } if (video_backend->animation_showCPUSpeed) { video_backend->animation_showCPUSpeed(); } timing_initialize(); if (!wasPaused) { cpu_resume(); } #endif }
static #endif void reinitialize(void) { #if !TESTING ASSERT_ON_CPU_THREAD(); #endif cycles_count_total = 0; cycles_video_frame = 0; #if !TEST_CPU video_scannerReset(); #endif #if TESTING extern unsigned long (*testing_getCyclesCount)(void); if (testing_getCyclesCount) { cycles_count_total = testing_getCyclesCount(); } #endif vm_initialize(); cpu65_init(); timing_initialize(); MB_Reset(); }
static #endif void reinitialize(void) { #if !TESTING assert(pthread_self() == cpu_thread_id); #endif cycles_count_total = 0; vm_initialize(); softswitches = SS_TEXT | SS_IOUDIS | SS_C3ROM | SS_LCWRT | SS_LCSEC; video_setpage( 0 ); video_redraw(); cpu65_init(); timing_initialize(); #ifdef AUDIO_ENABLED MB_Reset(); #endif }
bool timing_loadState(StateHelper_s *helper) { bool loaded = false; int fd = helper->fd; do { uint32_t lVal = 0; uint8_t serialized[4] = { 0 }; if (!helper->load(fd, serialized, sizeof(uint32_t))) { break; } lVal = (uint32_t)(serialized[0] << 24); lVal |= (uint32_t)(serialized[1] << 16); lVal |= (uint32_t)(serialized[2] << 8); lVal |= (uint32_t)(serialized[3] << 0); cpu_scale_factor = lVal / 100.; if (!helper->load(fd, serialized, sizeof(uint32_t))) { break; } lVal = (uint32_t)(serialized[0] << 24); lVal |= (uint32_t)(serialized[1] << 16); lVal |= (uint32_t)(serialized[2] << 8); lVal |= (uint32_t)(serialized[3] << 0); cpu_altscale_factor = lVal / 100.; uint8_t bVal = 0; if (!helper->load(fd, &bVal, sizeof(bVal))) { break; } alt_speed_enabled = !!bVal; timing_initialize(); loaded = true; } while (0); return loaded; }
void cpu65_reboot(void) { timing_initialize(); video_reset(); joy_button0 = 0xff; // OpenApple cpu65_interrupt(ResetSig); }
void timing_toggleCPUSpeed(void) { assert(cpu_isPaused() || (pthread_self() == cpu_thread_id)); alt_speed_enabled = !alt_speed_enabled; timing_initialize(); }