From e3a2613328e988b38c0bd38cb8aa4137389e6abc Mon Sep 17 00:00:00 2001 From: IvanDSM Date: Sun, 10 May 2020 05:47:38 -0300 Subject: [PATCH] Fix build without new camera, add example to README This fixes an oversight of mine that broke building with BETTERCAMERA=0 and adds an example to the README of how to build with the new camera disabled. --- README.md | 3 ++- src/pc/controller/controller_sdl.c | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 180f12f..e315ac6 100644 --- a/README.md +++ b/README.md @@ -60,7 +60,8 @@ Run `make` to build (defaults to `VERSION=us`) ``` make VERSION=jp -j6 # build (J) version with 6 jobs -make VERSION=us WINDOWS_BUILD=1 # builds a (U) Windows executable +make VERSION=us WINDOWS_BUILD=1 # builds a (U) Windows executable (under Windows, compiling for Windows under Linux is not supported) +make BETTERCAMERA=0 # builds an executable with the original SM64 camera (no analog/mouse support) make TARGET_RPI=1 # targets an executable for a Raspberry Pi ``` diff --git a/src/pc/controller/controller_sdl.c b/src/pc/controller/controller_sdl.c index 1a148bc..9e1b7a4 100644 --- a/src/pc/controller/controller_sdl.c +++ b/src/pc/controller/controller_sdl.c @@ -14,10 +14,13 @@ extern int16_t rightx; extern int16_t righty; + +#ifdef BETTERCAMERA int mouse_x; int mouse_y; extern u8 newcam_mouse; +#endif static bool init_ok; static SDL_GameController *sdl_cntrl; @@ -28,9 +31,11 @@ static void controller_sdl_init(void) { return; } +#ifdef BETTERCAMERA if (newcam_mouse == 1) SDL_SetRelativeMouseMode(SDL_TRUE); SDL_GetRelativeMouseState(&mouse_x, &mouse_y); +#endif init_ok = true; } @@ -40,15 +45,16 @@ static void controller_sdl_read(OSContPad *pad) { return; } +#ifdef BETTERCAMERA if (newcam_mouse == 1) SDL_SetRelativeMouseMode(SDL_TRUE); else SDL_SetRelativeMouseMode(SDL_FALSE); - + SDL_GetRelativeMouseState(&mouse_x, &mouse_y); +#endif SDL_GameControllerUpdate(); - SDL_GetRelativeMouseState(&mouse_x, &mouse_y); if (sdl_cntrl != NULL && !SDL_GameControllerGetAttached(sdl_cntrl)) { SDL_GameControllerClose(sdl_cntrl);