mirror of
https://github.com/dborth/vbagx.git
synced 2024-12-29 04:01:49 +01:00
restore OSK string safety fixes that got clobbered
This commit is contained in:
parent
6857a8a9e5
commit
e4f0938c2f
@ -22,8 +22,7 @@ static char * GetDisplayText(char * t)
|
|||||||
if(len < MAX_KEYBOARD_DISPLAY)
|
if(len < MAX_KEYBOARD_DISPLAY)
|
||||||
return t;
|
return t;
|
||||||
|
|
||||||
strncpy(tmptxt, &t[len-MAX_KEYBOARD_DISPLAY], MAX_KEYBOARD_DISPLAY);
|
snprintf(tmptxt, MAX_KEYBOARD_DISPLAY, "%s", &t[len-MAX_KEYBOARD_DISPLAY]);
|
||||||
tmptxt[MAX_KEYBOARD_DISPLAY-1] = 0;
|
|
||||||
return &tmptxt[0];
|
return &tmptxt[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -41,8 +40,7 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max)
|
|||||||
focus = 0; // allow focus
|
focus = 0; // allow focus
|
||||||
alignmentHor = ALIGN_CENTRE;
|
alignmentHor = ALIGN_CENTRE;
|
||||||
alignmentVert = ALIGN_MIDDLE;
|
alignmentVert = ALIGN_MIDDLE;
|
||||||
strncpy(kbtextstr, t, max);
|
snprintf(kbtextstr, 255, "%s", t);
|
||||||
kbtextstr[max] = 0;
|
|
||||||
kbtextmaxlen = max;
|
kbtextmaxlen = max;
|
||||||
|
|
||||||
Key thekeys[4][11] = {
|
Key thekeys[4][11] = {
|
||||||
@ -108,7 +106,7 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max)
|
|||||||
keyTextboxImg->SetPosition(0, 0);
|
keyTextboxImg->SetPosition(0, 0);
|
||||||
this->Append(keyTextboxImg);
|
this->Append(keyTextboxImg);
|
||||||
|
|
||||||
kbText = new GuiText(GetDisplayText(kbtextstr), 20, (GXColor){0, 0, 0, 0xff});
|
kbText = new GuiText(GetDisplayText(kbtextstr), 22, (GXColor){0, 0, 0, 0xff});
|
||||||
kbText->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
kbText->SetAlignment(ALIGN_CENTRE, ALIGN_TOP);
|
||||||
kbText->SetPosition(0, 13);
|
kbText->SetPosition(0, 13);
|
||||||
this->Append(kbText);
|
this->Append(kbText);
|
||||||
@ -130,7 +128,7 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max)
|
|||||||
|
|
||||||
keyBackImg = new GuiImage(keyMedium);
|
keyBackImg = new GuiImage(keyMedium);
|
||||||
keyBackOverImg = new GuiImage(keyMediumOver);
|
keyBackOverImg = new GuiImage(keyMediumOver);
|
||||||
keyBackText = new GuiText("Back", 20, (GXColor){0, 0, 0, 0xff});
|
keyBackText = new GuiText("Back", 22, (GXColor){0, 0, 0, 0xff});
|
||||||
keyBack = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
|
keyBack = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
|
||||||
keyBack->SetImage(keyBackImg);
|
keyBack->SetImage(keyBackImg);
|
||||||
keyBack->SetImageOver(keyBackOverImg);
|
keyBack->SetImageOver(keyBackOverImg);
|
||||||
@ -145,7 +143,7 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max)
|
|||||||
|
|
||||||
keyCapsImg = new GuiImage(keyMedium);
|
keyCapsImg = new GuiImage(keyMedium);
|
||||||
keyCapsOverImg = new GuiImage(keyMediumOver);
|
keyCapsOverImg = new GuiImage(keyMediumOver);
|
||||||
keyCapsText = new GuiText("Caps", 20, (GXColor){0, 0, 0, 0xff});
|
keyCapsText = new GuiText("Caps", 22, (GXColor){0, 0, 0, 0xff});
|
||||||
keyCaps = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
|
keyCaps = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
|
||||||
keyCaps->SetImage(keyCapsImg);
|
keyCaps->SetImage(keyCapsImg);
|
||||||
keyCaps->SetImageOver(keyCapsOverImg);
|
keyCaps->SetImageOver(keyCapsOverImg);
|
||||||
@ -160,7 +158,7 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max)
|
|||||||
|
|
||||||
keyShiftImg = new GuiImage(keyMedium);
|
keyShiftImg = new GuiImage(keyMedium);
|
||||||
keyShiftOverImg = new GuiImage(keyMediumOver);
|
keyShiftOverImg = new GuiImage(keyMediumOver);
|
||||||
keyShiftText = new GuiText("Shift", 20, (GXColor){0, 0, 0, 0xff});
|
keyShiftText = new GuiText("Shift", 22, (GXColor){0, 0, 0, 0xff});
|
||||||
keyShift = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
|
keyShift = new GuiButton(keyMedium->GetWidth(), keyMedium->GetHeight());
|
||||||
keyShift->SetImage(keyShiftImg);
|
keyShift->SetImage(keyShiftImg);
|
||||||
keyShift->SetImageOver(keyShiftOverImg);
|
keyShift->SetImageOver(keyShiftOverImg);
|
||||||
@ -198,9 +196,9 @@ GuiKeyboard::GuiKeyboard(char * t, u32 max)
|
|||||||
txt[0] = keys[i][j].ch;
|
txt[0] = keys[i][j].ch;
|
||||||
keyImg[i][j] = new GuiImage(key);
|
keyImg[i][j] = new GuiImage(key);
|
||||||
keyImgOver[i][j] = new GuiImage(keyOver);
|
keyImgOver[i][j] = new GuiImage(keyOver);
|
||||||
keyTxt[i][j] = new GuiText(txt, 20, (GXColor){0, 0, 0, 0xff});
|
keyTxt[i][j] = new GuiText(txt, 22, (GXColor){0, 0, 0, 0xff});
|
||||||
keyTxt[i][j]->SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
keyTxt[i][j]->SetAlignment(ALIGN_CENTRE, ALIGN_BOTTOM);
|
||||||
keyTxt[i][j]->SetPosition(0, -10);
|
keyTxt[i][j]->SetPosition(0, -8);
|
||||||
keyBtn[i][j] = new GuiButton(key->GetWidth(), key->GetHeight());
|
keyBtn[i][j] = new GuiButton(key->GetWidth(), key->GetHeight());
|
||||||
keyBtn[i][j]->SetImage(keyImg[i][j]);
|
keyBtn[i][j]->SetImage(keyImg[i][j]);
|
||||||
keyBtn[i][j]->SetImageOver(keyImgOver[i][j]);
|
keyBtn[i][j]->SetImageOver(keyImgOver[i][j]);
|
||||||
|
Loading…
Reference in New Issue
Block a user