Skip to content

Commit

Permalink
modern dkp
Browse files Browse the repository at this point in the history
  • Loading branch information
Craftyawesome committed Jun 2, 2024
1 parent 311130f commit 6ee0b76
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/switch.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
name: Nintendo Switch

on:
workflow_dispatch:
push:
branches: [ switch-port ]
pull_request:
branches: [ switch-port ]

jobs:
build:
runs-on: ubuntu-20.04
container: devkitpro/devkita64:20200730
runs-on: ubuntu-latest
container: devkitpro/devkita64
steps:
- name: Install 7z/zip
run: |
Expand Down
2 changes: 1 addition & 1 deletion src/console.c
Original file line number Diff line number Diff line change
Expand Up @@ -895,7 +895,7 @@ void CON_Responder_SWITCH_SwkbdDecidedEnter_cb(const char* str, SwkbdDecidedEnte
CON_InputSetString(str);

if (!input_len)
return true;
return;

// push the command
COM_BufAddText(inputlines[inputline]);
Expand Down
9 changes: 6 additions & 3 deletions src/hu_stuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,11 @@
#include "s_sound.h" // song credits
#include "k_kart.h"

#ifdef __SWITCH__
#include "switch/swkbd.h"
#endif


// coords are scaled
#define HU_INPUTX 0
#define HU_INPUTY 0
Expand Down Expand Up @@ -1243,7 +1248,7 @@ void CHAT_Close() {

void CHAT_SetText(const char* str) {
// if (strlen(str) > HU_MAXMSGLEN) return; // Overflow prevention
SDL_strlcpy(w_chat, str, HU_MAXMSGLEN);
strlcpy(w_chat, str, HU_MAXMSGLEN);
}

void CHAT_SendText(const char* str) {
Expand All @@ -1255,8 +1260,6 @@ void CHAT_SendText(const char* str) {

#ifdef __SWITCH__

#include "switch/swkbd.h"

void CHAT_Switch_SwkbdChanged(const char* str, SwkbdChangedStringArg* arg) {
CHAT_SetText(str);
c_input = arg->cursorPos;
Expand Down
6 changes: 3 additions & 3 deletions src/m_menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -2505,7 +2505,7 @@ void M_Responder_Switch_SwkbdChanged(const char* str, SwkbdChangedStringArg* arg
CV_Set(currentMenu->menuitems[itemOn].itemaction, str);
}

void M_Responder_Switch_SwkbdMovedCursor(const char* str, SwkbdChangedStringArg* arg) {
void M_Responder_Switch_SwkbdMovedCursor(const char* str, SwkbdMovedCursorArg* arg) {
char *currentStr = ((consvar_t *)currentMenu->menuitems[itemOn].itemaction)->string;
swkbdInlineSetCursorPos(&switch_kbdinline, strlen(currentStr)); // Place swkbd cursor at string end
}
Expand Down Expand Up @@ -9315,13 +9315,13 @@ void M_HandleConnectIP_Switch_SwkbdChanged(const char* str, SwkbdChangedStringAr
SDL_strlcpy(setupm_ip, str, sizeof(setupm_ip));
}

void M_HandleConnectIP_Switch_SwkbdDecidedEnter(const char* str, SwkbdChangedStringArg* arg) {
void M_HandleConnectIP_Switch_SwkbdDecidedEnter(const char* str, SwkbdDecidedEnterArg* arg) {
S_StartSound(NULL,sfx_menu1); // Tails
currentMenu->lastOn = itemOn;
M_ConnectIP(1);
}

void M_HandleConnectIP_Switch_SwkbdMovedCursor(const char* str, SwkbdChangedStringArg* arg) {
void M_HandleConnectIP_Switch_SwkbdMovedCursor(const char* str, SwkbdMovedCursorArg* arg) {
swkbdInlineSetCursorPos(&switch_kbdinline, strlen(setupm_ip)); // Place swkbd cursor at string end
}

Expand Down
2 changes: 1 addition & 1 deletion src/sdl/i_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -1326,7 +1326,7 @@ void I_OsPolling(void)
{
#ifdef __SWITCH__
// Disable input if software keyboard is up
if (switch_kbdstate == SwkbdState_TextAvailable)
if (switch_kbdstate == SwkbdState_Shown)
return;
#endif
SDL_Keymod mod;
Expand Down

0 comments on commit 6ee0b76

Please sign in to comment.