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.
master
IvanDSM 2020-05-10 05:47:38 -03:00
parent 6ed071e49e
commit e3a2613328
2 changed files with 10 additions and 3 deletions

View File

@ -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
```

View File

@ -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);