- foundation for the predictive input controller

- 60 FPS for better joystick reposne
This commit is contained in:
tudnai 2020-05-21 22:09:57 -07:00
parent 26341faff2
commit 4773c534f1
4 changed files with 19 additions and 6 deletions

View File

@ -583,16 +583,23 @@ class ViewController: NSViewController {
// TODO: Do we need to do this from here?
// spkr_update()
// Mouse 2 JoyStick (Game Controller / Paddle)
self.mouseLocation = self.view.window!.mouseLocationOutsideOfEventStream
pdl_valarr[0] = Double(self.mouseLocation.x / (self.displayField.frame.width) )
pdl_valarr[1] = 1 - Double(self.mouseLocation.y / (self.displayField.frame.height) )
}
#if SPEEDTEST
#else
if ( !halted ) {
// Mouse 2 JoyStick (Game Controller / Paddle)
mouseLocation = view.window!.mouseLocationOutsideOfEventStream
pdl_prevarr[0] = pdl_valarr[0]
pdl_valarr[0] = Double(mouseLocation.x / (displayField.frame.width) )
pdl_diffarr[0] = pdl_valarr[0] - pdl_prevarr[0]
pdl_prevarr[1] = pdl_valarr[1]
pdl_valarr[1] = 1 - Double(mouseLocation.y / (displayField.frame.height) )
pdl_diffarr[1] = pdl_valarr[1] - pdl_prevarr[1]
m6502_Run()
}
#endif

View File

@ -149,13 +149,15 @@ extern uint8_t * const MEM; // Pointer to the Shadow Memory Map so we ca
extern uint32_t * videoMemPtr;
extern double * pdl_valarr;
extern double * pdl_prevarr;
extern double * pdl_diffarr;
//extern void hires_Update(void);
extern double mips;
extern double mhz;
#define fps 30U
#define fps 60U
extern void rom_loadFile( const char * bundlePath, const char * filename );
extern void woz_loadFile( const char * bundlePath, const char * filename );

View File

@ -68,7 +68,7 @@ ALuint spkr_buffers[BUFFER_COUNT];
const int spkr_fps = fps;
const int spkr_seconds = 1;
const unsigned spkr_sample_rate = 44100;
unsigned spkr_extra_buf = 26; // TODO: Should it be a dynamic value calculated by how many bytes we overshot by the edge curve generator?
unsigned spkr_extra_buf = 780 / fps;
const unsigned spkr_buf_size = spkr_seconds * spkr_sample_rate * 2 / spkr_fps;
char spkr_samples [ spkr_buf_size * spkr_fps * BUFFER_COUNT * 2]; // stereo
unsigned spkr_sample_idx = 0;

View File

@ -20,7 +20,11 @@ uint64_t pdl_current_time = 0;
uint64_t pdl_elapsed_time = 0;
double pdl_value[4] = { 0.5, 0.5, 0.5, 0.5 };
double pdl_prev[4] = { 0.5, 0.5, 0.5, 0.5 };
double pdl_diff[4] = { 0.0, 0.0, 0.0, 0.0 };
double * pdl_valarr = pdl_value;
double * pdl_prevarr = pdl_prev;
double * pdl_diffarr = pdl_diff;
INLINE uint8_t pdl_reset() {
pdl_reset_time = m6502.clktime + clkfrm;