mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/4jcraft.git
synced 2026-07-17 15:18:52 +00:00
fix: sign entry crash and remove blocking callback workaround
- Initialize m_iEditingLine to 0 in SignEntryMenu constructor (was uninitialized, causing out-of-bounds array access) - Add bounds check on m_iEditingLine before array access in callback - Only truncate sign text if longer than 15 chars (avoid padding) - Remove manual KeyboardCompleteSeedCallback call in LaunchMoreOptionsMenu (no longer needed since RequestKeyboard now fires callbacks asynchronously from Tick)
This commit is contained in:
@@ -18,6 +18,7 @@ UIScene_SignEntryMenu::UIScene_SignEntryMenu(int iPad, void* _initData,
|
||||
SignEntryScreenInput* initData = (SignEntryScreenInput*)_initData;
|
||||
m_sign = initData->sign;
|
||||
|
||||
m_iEditingLine = 0;
|
||||
m_bConfirmed = false;
|
||||
m_bIgnoreInput = false;
|
||||
|
||||
@@ -141,12 +142,12 @@ int UIScene_SignEntryMenu::KeyboardCompleteCallback(void* lpParam, bool bRes) {
|
||||
// 4J HEG - No reason to set value if keyboard was cancelled
|
||||
UIScene_SignEntryMenu* pClass = (UIScene_SignEntryMenu*)lpParam;
|
||||
pClass->m_bIgnoreInput = false;
|
||||
if (bRes) {
|
||||
if (bRes && pClass->m_iEditingLine >= 0 && pClass->m_iEditingLine < 4) {
|
||||
uint16_t pchText[128];
|
||||
ZeroMemory(pchText, 128 * sizeof(uint16_t));
|
||||
InputManager.GetText(pchText);
|
||||
std::wstring str = uint16_to_wstring(pchText);
|
||||
str.resize(15);
|
||||
if (str.size() > 15) str.resize(15);
|
||||
pClass->m_textInputLines[pClass->m_iEditingLine].setLabel(str);
|
||||
}
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user