Skip to content

Commit

Permalink
Make joystick more responsive while using the 60fps patch
Browse files Browse the repository at this point in the history
  • Loading branch information
ckosmic committed Sep 16, 2022
1 parent 8c81981 commit 52ee3c8
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 9 deletions.
43 changes: 34 additions & 9 deletions enhancements/60fps_ios.patch
Original file line number Diff line number Diff line change
Expand Up @@ -1884,6 +1884,30 @@ index 37c6752..10ca977 100644
gSPMatrix(displayListIter++, scaleMat, G_MTX_MODELVIEW | G_MTX_MUL | G_MTX_PUSH);
gSPDisplayList(displayListIter++, &intro_seg7_dl_0700B3A0);
gSPPopMatrix(displayListIter++, G_MTX_MODELVIEW);
diff --git a/src/pc/controller/controller_touchscreen.h b/src/pc/controller/controller_touchscreen.h
index bba42aa..631c739 100644
--- a/src/pc/controller/controller_touchscreen.h
+++ b/src/pc/controller/controller_touchscreen.h
@@ -20,6 +20,7 @@ void touch_motion(struct TouchEvent* event);
void touch_up(struct TouchEvent* event);

void touchscreen_set_imageviews(NSMutableArray *imageViews);
+void update_touch_controls(void);

void (*menu_button_pressed)(void);

diff --git a/src/pc/controller/controller_touchscreen.m b/src/pc/controller/controller_touchscreen.m
index 99cb4d4..1b05875 100644
--- a/src/pc/controller/controller_touchscreen.m
+++ b/src/pc/controller/controller_touchscreen.m
@@ -208,7 +208,6 @@ static void touchscreen_init(void) {
if(hapticsSupported) {
haptics = [[HapticsController alloc] init];
}
- [frameController.onScreenRefresh addObject:[NSValue valueWithPointer:update_touch_controls]];
}

void touchscreen_set_imageviews(NSMutableArray *imageViews) {
diff --git a/src/pc/gfx/gfx_dxgi.cpp b/src/pc/gfx/gfx_dxgi.cpp
index 0467495..fa4eb33 100644
--- a/src/pc/gfx/gfx_dxgi.cpp
Expand All @@ -1902,10 +1926,10 @@ index 0467495..fa4eb33 100644

using namespace Microsoft::WRL; // For ComPtr
diff --git a/src/pc/gfx/gfx_sdl2.m b/src/pc/gfx/gfx_sdl2.m
index 66b719f..d602533 100644
index bed05a3..c58b874 100644
--- a/src/pc/gfx/gfx_sdl2.m
+++ b/src/pc/gfx/gfx_sdl2.m
@@ -177,7 +177,11 @@ static inline void gfx_sdl_set_vsync(const bool enabled) {
@@ -181,7 +181,11 @@ static inline void gfx_sdl_set_vsync(const bool enabled) {
if (enabled) {
// try to detect refresh rate
SDL_GL_SetSwapInterval(1);
Expand All @@ -1918,7 +1942,7 @@ index 66b719f..d602533 100644
if (vblanks) {
printf("determined swap interval: %d\n", vblanks);
SDL_GL_SetSwapInterval(vblanks);
@@ -268,7 +272,7 @@ static void gfx_sdl_init(const char *window_title) {
@@ -272,7 +276,7 @@ static void gfx_sdl_init(const char *window_title) {
gfx_sdl_set_fullscreen();

perf_freq = SDL_GetPerformanceFrequency();
Expand All @@ -1927,7 +1951,7 @@ index 66b719f..d602533 100644

for (size_t i = 0; i < sizeof(windows_scancode_table) / sizeof(SDL_Scancode); i++) {
inverted_scancode_table[windows_scancode_table[i]] = i;
@@ -283,7 +287,7 @@ static void gfx_sdl_init(const char *window_title) {
@@ -287,7 +291,7 @@ static void gfx_sdl_init(const char *window_title) {
inverted_scancode_table[scancode_rmapping_nonextended[i][1]] += 0x100;
}

Expand All @@ -1936,7 +1960,7 @@ index 66b719f..d602533 100644
SDL_RaiseWindow(wnd);
}

@@ -468,6 +472,7 @@ static inline void sync_framerate_with_timer(void) {
@@ -487,6 +491,7 @@ static inline void sync_framerate_with_timer(void) {

static void gfx_sdl_swap_buffers_begin(void) {
if (use_timer) sync_framerate_with_timer();
Expand All @@ -1945,10 +1969,10 @@ index 66b719f..d602533 100644

static void gfx_sdl_swap_buffers_end(void) {
diff --git a/src/pc/pc_main.m b/src/pc/pc_main.m
index 1a531ee..107cf8e 100644
index 0734130..8c8f693 100644
--- a/src/pc/pc_main.m
+++ b/src/pc/pc_main.m
@@ -95,6 +95,25 @@ void send_display_list(struct SPTask *spTask) {
@@ -97,6 +97,25 @@ void send_display_list(struct SPTask *spTask) {
#define SAMPLES_LOW 528
#endif

Expand All @@ -1974,7 +1998,7 @@ index 1a531ee..107cf8e 100644
void produce_one_frame(void) {
wm_api->handle_events();
if(!paused_by_menu) {
@@ -123,6 +142,11 @@ void produce_one_frame(void) {
@@ -126,6 +145,11 @@ void produce_one_frame(void) {
audio_api->play((u8 *)audio_buffer, 2 * num_audio_samples * 4);
gfx_end_frame();
}
Expand All @@ -1986,14 +2010,15 @@ index 1a531ee..107cf8e 100644
}

void audio_shutdown(void) {
@@ -289,9 +313,10 @@ void main_func(void) {
@@ -298,9 +322,11 @@ void main_func(void) {
emscripten_set_main_loop(em_main_loop, 0, 0);
request_anim_frame(on_anim_frame);
#else
- [gameTimer.onGameTick addObject:[NSValue valueWithPointer:ios_produce_one_frame]];
- [gameTimer startMainLoop:1.0 / 30.0];
[frameController startMainLoop];
+ while(true) {
+ update_touch_controls();
+ ios_produce_one_frame();
+ }
#endif
Expand Down
Binary file not shown.

0 comments on commit 52ee3c8

Please sign in to comment.