mirror of
https://github.com/libretro/RetroArch
synced 2025-01-27 21:35:25 +00:00
Rollback extended character PR - caused too many issues
and caused crashes - contributor can submit a new improved PR - would also prefer increased readability
This commit is contained in:
parent
0ffdf0790c
commit
c4d2788c08
2
Makefile
2
Makefile
@ -64,7 +64,7 @@ ifneq ($(findstring FPGA,$(OS)),)
|
||||
endif
|
||||
|
||||
ifneq ($(findstring Win32,$(OS)),)
|
||||
LDFLAGS += -static-libgcc -lwinmm -limm32
|
||||
LDFLAGS += -static-libgcc -lwinmm
|
||||
endif
|
||||
|
||||
include Makefile.common
|
||||
|
@ -1161,11 +1161,6 @@ static LRESULT CALLBACK wnd_proc_winraw_common_internal(HWND hwnd,
|
||||
}
|
||||
#endif
|
||||
|
||||
/* IME for CJK (-limm32) */
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "Imm32")
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DINPUT
|
||||
static LRESULT CALLBACK wnd_proc_common_dinput_internal(HWND hwnd,
|
||||
UINT message, WPARAM wparam, LPARAM lparam)
|
||||
@ -1177,32 +1172,6 @@ static LRESULT CALLBACK wnd_proc_common_dinput_internal(HWND hwnd,
|
||||
|
||||
switch (message)
|
||||
{
|
||||
case WM_IME_ENDCOMPOSITION:
|
||||
input_keyboard_event(true, 1, 0x80000000, 0, RETRO_DEVICE_KEYBOARD);
|
||||
break;
|
||||
case WM_IME_COMPOSITION:
|
||||
{
|
||||
wchar_t wstr[4]={0,};
|
||||
char utf8[8]={0,};
|
||||
HIMC hIMC = ImmGetContext(hwnd);
|
||||
unsigned gcs = lparam & (GCS_COMPSTR|GCS_RESULTSTR); /* GCS_COMPSTR:0x0008 GCS_RESULTSTR:0x0800 */
|
||||
if( gcs )
|
||||
{
|
||||
int i;
|
||||
int len1=ImmGetCompositionStringW(hIMC, gcs, wstr, 4); /* len:2 - usally (byte) */
|
||||
for( i=0; i<len1/2; i++) /* len:4 - input ascii character while MBC composition */
|
||||
{
|
||||
int len2=WideCharToMultiByte( CP_UTF8, 0, wstr+i, -1, utf8, 8, NULL, NULL );
|
||||
if (len2)
|
||||
{
|
||||
utf8[3] = (gcs) | (gcs>>4); /* COMPSTR:0x08000000, RESULTSTR:0x80000000 */
|
||||
input_keyboard_event(true, 1, *((int*)utf8), 0, RETRO_DEVICE_KEYBOARD);
|
||||
}
|
||||
}
|
||||
}
|
||||
ImmReleaseContext(hwnd, hIMC);
|
||||
return 0; /* block WM_CHAR */
|
||||
} break;
|
||||
case WM_KEYUP: /* Key released */
|
||||
case WM_SYSKEYUP: /* Key released */
|
||||
keydown = false;
|
||||
|
@ -663,34 +663,6 @@ bool gfx_thumbnail_update_path(
|
||||
thumbnail_path[0] = '\0';
|
||||
fill_pathname_join_special(thumbnail_path, tmp_buf,
|
||||
path_data->content_img, PATH_MAX_LENGTH * sizeof(char));
|
||||
|
||||
/* Thumbnail fallback 1 - rom_name.png */
|
||||
/* :\thumbnails\db_name\Named_Snaps\rom_name.png */
|
||||
if (!path_is_valid(thumbnail_path))
|
||||
{
|
||||
char content_name[PATH_MAX_LENGTH];
|
||||
char* cp = find_last_slash(path_data->content_path);
|
||||
if( cp ) cp++; else cp = path_data->content_path;
|
||||
strcpy(content_name,cp);
|
||||
cp = strchr( content_name,'.');
|
||||
if(cp) strcpy(cp,".png");
|
||||
fill_pathname_join(thumbnail_path, dir_thumbnails, system_name, PATH_MAX_LENGTH);
|
||||
fill_pathname_join(thumbnail_path, thumbnail_path, type, PATH_MAX_LENGTH);
|
||||
fill_pathname_join(thumbnail_path, thumbnail_path, content_name, PATH_MAX_LENGTH);
|
||||
}
|
||||
/* Thumbnail fallback 2 - rom_path/rom_name.png */
|
||||
/* :\roms\db_name\rom_name.png */
|
||||
if (!path_is_valid(thumbnail_path))
|
||||
{
|
||||
char* cp;
|
||||
char content_name[PATH_MAX_LENGTH];
|
||||
strcpy(content_name,path_data->content_path);
|
||||
cp = strstr(content_name, ".zip#");
|
||||
if( cp ) cp[4]=0;
|
||||
cp = strrchr( content_name,'.');
|
||||
strcpy(cp,".png");
|
||||
strcpy(thumbnail_path,content_name);
|
||||
}
|
||||
}
|
||||
|
||||
/* Final error check - is cached path empty? */
|
||||
|
@ -3354,59 +3354,65 @@ bool input_keyboard_line_event(
|
||||
input_driver_state_t *input_st,
|
||||
input_keyboard_line_t *state, uint32_t character)
|
||||
{
|
||||
char array[2];
|
||||
bool ret = false;
|
||||
const char * word = (char*) &character;
|
||||
static unsigned composition = 0;
|
||||
const char *word = NULL;
|
||||
char c = (character >= 128) ? '?' : character;
|
||||
|
||||
/* COMPSTR:0x08000000, RESULTSTR:0x80000000 END:0x01000000*/
|
||||
if (character & 0xFF000000)
|
||||
{
|
||||
size_t len = strlen((char*)&composition);
|
||||
if ( (len > 0)
|
||||
&& (state->ptr >= len)
|
||||
&& state->buffer)
|
||||
{
|
||||
memmove(state->buffer + state->ptr-len,
|
||||
state->buffer+state->ptr, len + 1);
|
||||
state->ptr -= len;
|
||||
state->size -= len;
|
||||
}
|
||||
if (character & 0xF0000000)
|
||||
composition = 0;
|
||||
else
|
||||
composition = character &0xffffff; /* GCS_COMPSTR */
|
||||
if (len && composition==0)
|
||||
word = state->buffer;
|
||||
character &= 0xffffff;
|
||||
}
|
||||
/* Treat extended chars as ? as we cannot support
|
||||
* printable characters for unicode stuff. */
|
||||
|
||||
/*(c == '\r' || c == '\n') */
|
||||
if (character == 0x0000000D || character == 0x0000000A)
|
||||
if (c == '\r' || c == '\n')
|
||||
{
|
||||
state->cb(state->userdata, state->buffer);
|
||||
|
||||
array[0] = c;
|
||||
array[1] = 0;
|
||||
|
||||
ret = true;
|
||||
} else
|
||||
if ( character == 0x00000008 || character == 0x0000007f) /* c == '\b' || c == '\x7f') 0x7f is ASCII for del */
|
||||
word = array;
|
||||
}
|
||||
else if (c == '\b' || c == '\x7f') /* 0x7f is ASCII for del */
|
||||
{
|
||||
if (state->ptr)
|
||||
{
|
||||
unsigned i;
|
||||
int len = input_st->osk_last_codepoint_len;
|
||||
if ( (len > 0)
|
||||
&& (state->ptr >= len)
|
||||
&& state->buffer)
|
||||
{
|
||||
memmove(state->buffer + state->ptr-len, state->buffer + state->ptr, (state->size - state->ptr) + 1);
|
||||
state->ptr -=len;
|
||||
state->size-=len;
|
||||
}
|
||||
word = state->buffer; /* ?? */
|
||||
unsigned i;
|
||||
|
||||
for (i = 0; i < input_st->osk_last_codepoint_len; i++)
|
||||
{
|
||||
memmove(state->buffer + state->ptr - 1,
|
||||
state->buffer + state->ptr,
|
||||
state->size - state->ptr + 1);
|
||||
state->ptr--;
|
||||
state->size--;
|
||||
}
|
||||
|
||||
word = state->buffer;
|
||||
}
|
||||
} else
|
||||
if (character)
|
||||
input_keyboard_line_append( state, (char*)&character, strlen((char*)&character));
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else if (ISPRINT(c))
|
||||
{
|
||||
/* Handle left/right here when suitable */
|
||||
char *newbuf = (char*)
|
||||
realloc(state->buffer, state->size + 2);
|
||||
if (!newbuf)
|
||||
return false;
|
||||
|
||||
memmove(newbuf + state->ptr + 1,
|
||||
newbuf + state->ptr,
|
||||
state->size - state->ptr + 1);
|
||||
newbuf[state->ptr] = c;
|
||||
state->ptr++;
|
||||
state->size++;
|
||||
newbuf[state->size] = '\0';
|
||||
|
||||
state->buffer = newbuf;
|
||||
|
||||
array[0] = c;
|
||||
array[1] = 0;
|
||||
|
||||
word = array;
|
||||
}
|
||||
|
||||
/* OSK - update last character */
|
||||
if (word)
|
||||
|
Loading…
x
Reference in New Issue
Block a user