| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/Main/ddio_lnx/lnxkey_null.cpp $ |
| 21 | * $Revision: 1.2 $ |
| 22 | * $Date: 2004/02/25 00:04:06 $ |
| 23 | * $Author: ryan $ |
| 24 | * |
| 25 | * Linux NULL keyboard routines |
| 26 | * |
| 27 | * $Log: lnxkey_null.cpp,v $ |
| 28 | * Revision 1.2 2004/02/25 00:04:06 ryan |
| 29 | * Removed loki_utils dependency and ported to MacOS X (runs, but incomplete). |
| 30 | * |
| 31 | * Revision 1.1.1.1 2000/04/18 00:00:33 icculus |
| 32 | * initial checkin |
| 33 | * |
| 34 | * |
| 35 | * 2 7/14/99 9:06p Jeff |
| 36 | * added comment header |
| 37 | * |
| 38 | * $NoKeywords: $ |
| 39 | */ |
| 40 | |
| 41 | #include "ddio.h"cxx . . $ `<file>/ddio/ddio.h`/ |
| 42 | |
| 43 | extern volatile struct tLnxKeyscxx . . $ tLnxKeys# { |
| 44 | unioncxx . . $ tLnxKeys#$anonymous_type_0# { |
| 45 | int up_tickscxx . . $ tLnxKeys#$anonymous_type_0#up_ticks.; |
| 46 | float up_timecxx . . $ tLnxKeys#$anonymous_type_0#up_time.; |
| 47 | }; |
| 48 | unioncxx . . $ tLnxKeys#$anonymous_type_1# { |
| 49 | int down_tickscxx . . $ tLnxKeys#$anonymous_type_1#down_ticks.; |
| 50 | float down_timecxx . . $ tLnxKeys#$anonymous_type_1#down_time.; |
| 51 | }; |
| 52 | bool statuscxx . . $ tLnxKeys#status.; |
| 53 | } LKeyscxx . . $ LKeys.[DDIO_MAX_KEYScxx . . $ `ddio/ddio_common.h:205:9`!]; |
| 54 | |
| 55 | bool ddio_null_InternalKeyInitcxx . . $ ddio_null_InternalKeyInit(4aa02e9b14a147be).(ddio_init_infocxx . . $ ddio_init_info# *init_info) { |
| 56 | // reset key list |
| 57 | for (int i = 0; i < DDIO_MAX_KEYScxx . . $ `ddio/ddio_common.h:205:9`!; i++) { |
| 58 | LKeyscxx . . $ LKeys.[i].down_tickscxx . . $ tLnxKeys#$anonymous_type_1#down_ticks. = 0; |
| 59 | LKeyscxx . . $ LKeys.[i].up_tickscxx . . $ tLnxKeys#$anonymous_type_0#up_ticks. = 0; |
| 60 | LKeyscxx . . $ LKeys.[i].statuscxx . . $ tLnxKeys#status. = false; |
| 61 | } |
| 62 | |
| 63 | return true; |
| 64 | } |
| 65 | |
| 66 | void ddio_null_InternalKeyClosecxx . . $ ddio_null_InternalKeyClose(49f6e7a06ebc5aa8).() {} |
| 67 | |
| 68 | bool ddio_null_InternalKeyStatecxx . . $ ddio_null_InternalKeyState(cef82f9be00a201a).(uint8_tcxx . . $ uint8_t# key) { return LKeyscxx . . $ LKeys.[key].statuscxx . . $ tLnxKeys#status.; } |
| 69 | |
| 70 | void ddio_null_InternalKeySuspendcxx . . $ ddio_null_InternalKeySuspend(49f6e7a06ebc5aa8).() {} |
| 71 | |
| 72 | void ddio_null_InternalKeyResumecxx . . $ ddio_null_InternalKeyResume(49f6e7a06ebc5aa8).() {} |
| 73 | |
| 74 | float ddio_null_InternalKeyDownTimecxx . . $ ddio_null_InternalKeyDownTime(ef46aeb7cc924ea7).(uint8_tcxx . . $ uint8_t# key) { |
| 75 | float down_time = 0.0f; |
| 76 | if (LKeyscxx . . $ LKeys.[key].statuscxx . . $ tLnxKeys#status.) { |
| 77 | float timer = timer_GetTimecxx . . $ `ddio/ddio.h:236:9`!(); |
| 78 | down_time = timer - LKeyscxx . . $ LKeys.[key].down_timecxx . . $ tLnxKeys#$anonymous_type_1#down_time.; |
| 79 | LKeyscxx . . $ LKeys.[key].down_timecxx . . $ tLnxKeys#$anonymous_type_1#down_time. = timer; |
| 80 | } else { |
| 81 | down_time = LKeyscxx . . $ LKeys.[key].up_timecxx . . $ tLnxKeys#$anonymous_type_0#up_time. - LKeyscxx . . $ LKeys.[key].down_timecxx . . $ tLnxKeys#$anonymous_type_1#down_time.; |
| 82 | LKeyscxx . . $ LKeys.[key].down_timecxx . . $ tLnxKeys#$anonymous_type_1#down_time. = LKeyscxx . . $ LKeys.[key].up_timecxx . . $ tLnxKeys#$anonymous_type_0#up_time. = 0.0f; |
| 83 | } |
| 84 | |
| 85 | return down_time; |
| 86 | } |
| 87 | |
| 88 | void ddio_null_InternalResetKeycxx . . $ ddio_null_InternalResetKey(ac50b47256ae7414).(uint8_tcxx . . $ uint8_t# key) { |
| 89 | LKeyscxx . . $ LKeys.[key].down_timecxx . . $ tLnxKeys#$anonymous_type_1#down_time. = 0.0f; |
| 90 | LKeyscxx . . $ LKeys.[key].up_timecxx . . $ tLnxKeys#$anonymous_type_0#up_time. = 0.0f; |
| 91 | LKeyscxx . . $ LKeys.[key].statuscxx . . $ tLnxKeys#status. = false; |
| 92 | } |
| 93 | |
| 94 | bool ddio_null_KeyFramecxx . . $ ddio_null_KeyFrame(c9857a73d68e59ba).() { return true; } |
| 95 | |
| 96 | void ddio_null_InternalKeyFramecxx . . $ ddio_null_InternalKeyFrame(49f6e7a06ebc5aa8).(void) {} |