From bbb51f49124c13892bb320d6b6135cf81beefc7b Mon Sep 17 00:00:00 2001 From: kichikuou Date: Thu, 27 Oct 2022 20:03:47 +0900 Subject: [PATCH] Always enable GameController, and remove unused USE_JOY code --- src/sys/nact.cpp | 10 ---------- src/sys/nact.h | 8 +------- src/sys/nact_input.cpp | 19 ------------------- 3 files changed, 1 insertion(+), 36 deletions(-) diff --git a/src/sys/nact.cpp b/src/sys/nact.cpp index 643caab..3038ed9 100644 --- a/src/sys/nact.cpp +++ b/src/sys/nact.cpp @@ -96,15 +96,6 @@ NACT::NACT(int sys_ver, uint32 crc32_a, uint32 crc32_b, const Config& config) mako = new MAKO(this, config); msgskip = new MsgSkip(this); -#ifdef USE_JOY - // 入力初期化 - joy_num = joyGetNumDevs(); - if(joy_num) { - joyGetDevCaps(JOYSTICKID1, &joycaps, sizeof(JOYCAPS)); - } -#endif - -#ifdef USE_JOY_SDL SDL_Init(SDL_INIT_GAMECONTROLLER); for (int i = 0; i < SDL_NumJoysticks(); ++i) { if (SDL_IsGameController(i)) { @@ -116,7 +107,6 @@ NACT::NACT(int sys_ver, uint32 crc32_a, uint32 crc32_b, const Config& config) } } } -#endif terminate = false; restart_after_terminate = false; diff --git a/src/sys/nact.h b/src/sys/nact.h index f941c18..a663629 100644 --- a/src/sys/nact.h +++ b/src/sys/nact.h @@ -231,14 +231,8 @@ protected: void get_cursor(int* x, int* y); void set_cursor(int x, int y); -#ifdef USE_JOY - int joy_num; - JOYCAPS joycaps; -#endif - -#ifdef USE_JOY_SDL SDL_GameController *sdl_gamecontroller = NULL; -#endif + int mouse_x = 0, mouse_y = 0; static uint32 calc_crc32(const char* file_name, const std::string& game_id); diff --git a/src/sys/nact_input.cpp b/src/sys/nact_input.cpp index 92803bf..43e6c9e 100644 --- a/src/sys/nact_input.cpp +++ b/src/sys/nact_input.cpp @@ -85,24 +85,6 @@ uint8 NACT::get_key() // マウス移動で方向入力はサポートしない -#ifdef USE_JOY - // ジョイスティック - if(joy_num > 0) { - JOYINFO joyinfo; - if(joyGetPos(JOYSTICKID1, &joyinfo) == JOYERR_NOERROR) { - if(joyinfo.wYpos == joycaps.wYmin) val |= 0x01; - if(joyinfo.wYpos == joycaps.wYmax) val |= 0x02; - if(joyinfo.wXpos == joycaps.wXmin) val |= 0x04; - if(joyinfo.wXpos == joycaps.wXmax) val |= 0x08; - if(joyinfo.wButtons & JOY_BUTTON1) val |= 0x10; - if(joyinfo.wButtons & JOY_BUTTON2) val |= 0x20; - if(joyinfo.wButtons & JOY_BUTTON3) val |= 0x40; - if(joyinfo.wButtons & JOY_BUTTON4) val |= 0x80; - } - } -#endif - -#ifdef USE_JOY_SDL if(sdl_gamecontroller) { if(SDL_GameControllerGetButton(sdl_gamecontroller, SDL_CONTROLLER_BUTTON_DPAD_UP) || SDL_GameControllerGetAxis(sdl_gamecontroller, SDL_CONTROLLER_AXIS_LEFTY) <= -8000) val |= 0x01; if(SDL_GameControllerGetButton(sdl_gamecontroller, SDL_CONTROLLER_BUTTON_DPAD_DOWN) || SDL_GameControllerGetAxis(sdl_gamecontroller, SDL_CONTROLLER_AXIS_LEFTY) >= 8000) val |= 0x02; @@ -113,7 +95,6 @@ uint8 NACT::get_key() if(SDL_GameControllerGetButton(sdl_gamecontroller, SDL_CONTROLLER_BUTTON_X)) val |= 0x40; if(SDL_GameControllerGetButton(sdl_gamecontroller, SDL_CONTROLLER_BUTTON_Y)) val |= 0x80; } -#endif return val; }