Skip to content

Commit

Permalink
Revert 60fps patch
Browse files Browse the repository at this point in the history
  • Loading branch information
ckosmic committed Oct 29, 2021
2 parents 8d2bf3f + 170aefe commit f4da2c5
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 15 deletions.
Binary file not shown.
4 changes: 2 additions & 2 deletions sm64ios/sm64ios.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1674,7 +1674,7 @@
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 13.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.1.0;
MARKETING_VERSION = 1.1.1;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.christiankosman.sm64ios;
Expand Down Expand Up @@ -1750,7 +1750,7 @@
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
IPHONEOS_DEPLOYMENT_TARGET = 13.2;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
MARKETING_VERSION = 1.1.0;
MARKETING_VERSION = 1.1.1;
MTL_ENABLE_DEBUG_INFO = NO;
MTL_FAST_MATH = YES;
PRODUCT_BUNDLE_IDENTIFIER = com.christiankosman.sm64ios;
Expand Down
9 changes: 4 additions & 5 deletions src/pc/gfx/gfx_sdl2.m
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ static void gfx_sdl_init(const char *window_title) {

gfx_sdl_set_fullscreen();

SDL_SetWindowInputFocus(wnd);
SDL_RaiseWindow(wnd);

perf_freq = SDL_GetPerformanceFrequency();
frame_time = perf_freq / FRAMERATE;
Expand Down Expand Up @@ -396,14 +396,13 @@ static void gfx_sdl_handle_events(void) {
case SDL_DISPLAYEVENT:
switch(event.display.event) {
case SDL_DISPLAYEVENT_CONNECTED:
//int displayIndex = event.display.display;
if([[UIScreen screens] count] > 1) {
setup_external_screen();
//SDL_SetWindowFullscreen(wnd, SDL_WINDOW_FULLSCREEN_DESKTOP);
//SDL_GL_GetDrawableSize(wnd, &configWindow.w, &configWindow.h);
//SDL_SetWindowSize(wnd, configWindow.w, configWindow.h);
}
break;
case SDL_DISPLAYEVENT_DISCONNECTED:
teardown_external_screen();
break;
}
break;
case SDL_QUIT:
Expand Down
1 change: 1 addition & 0 deletions src/pc/gfx/gfx_uikit.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ UIViewController *gameViewController;

void gfx_uikit_init(UIViewController *viewControllerPointer);
void setup_external_screen();
void teardown_external_screen();
void gfx_uikit_set_touchscreen_callbacks(void (*down)(void* event), void (*motion)(void* event), void (*up)(void* event));

#endif /* gfx_uikit_h */
26 changes: 18 additions & 8 deletions src/pc/gfx/gfx_uikit.m
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@ void gfx_uikit_init(UIViewController *viewControllerPointer) {
tcvc = [storyboard instantiateViewControllerWithIdentifier:@"TouchControlsViewController"];

if([[UIScreen screens] count] > 1) {
mainWindow.rootViewController = tcvc;

//setup_external_screen();
setup_external_screen();
} else {
[gameViewController.view addSubview:tcvc.view];
}
}

void setup_external_screen() {
[tcvc.view removeFromSuperview];
mainWindow.rootViewController = tcvc;

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil];
Expand All @@ -62,13 +61,24 @@ void setup_external_screen() {
externalWindow.screen = screen;
externalWindow.screen.overscanCompensation = UIScreenOverscanCompensationScale;
externalWindow.hidden = NO;
UIView *realView = gameViewController.view;
[externalVc.view addSubview:realView];
realView.frame = externalVc.view.bounds;
realView.contentScaleFactor = 1.0;
[externalVc.view addSubview:gameViewController.view];
gameViewController.view.frame = externalVc.view.bounds;
gameViewController.view.contentScaleFactor = 1.0;
}

void teardown_external_screen() {
if(externalWindow != nil) {
[tcvc.view removeFromSuperview];
mainWindow.rootViewController = gameViewController;
[gameViewController.view addSubview:tcvc.view];
UIScreen *screen = [UIScreen screens][0];
gameViewController.view.frame = screen.bounds;
gameViewController.view.contentScaleFactor = screen.scale;
externalWindow.hidden = YES;
externalWindow = nil;
}
}

void gfx_uikit_set_touchscreen_callbacks(void (*down)(void* event), void (*motion)(void* event), void (*up)(void* event)) {
printf("UIKit set touch stuff\n");
[tcvc set_touchscreen_callbacks:down motion:motion up:up];
}

0 comments on commit f4da2c5

Please sign in to comment.