mirror of
https://github.com/RaySollium99/libpicofe.git
synced 2025-09-03 06:17:44 -04:00
commit
b202518cd3
8 changed files with 61 additions and 16 deletions
19
input.c
19
input.c
|
@ -41,6 +41,7 @@ static int in_driver_count = 0;
|
|||
static int in_dev_count = 0; /* probed + bind devices */
|
||||
static int in_have_async_devs = 0;
|
||||
static int in_probe_dev_id;
|
||||
static int in_probe_dev_ix;
|
||||
static int menu_key_state = 0;
|
||||
static int menu_last_used_dev = 0;
|
||||
static int menu_key_prev = 0;
|
||||
|
@ -69,8 +70,13 @@ static int *in_alloc_binds(int drv_id, int key_count)
|
|||
&& defbinds[i].bit == 0)
|
||||
break;
|
||||
|
||||
binds_d[IN_BIND_OFFS(defbinds[i].code, defbinds[i].btype)] |=
|
||||
1 << defbinds[i].bit;
|
||||
if (defbinds[i].btype == IN_BINDTYPE_PLAYER12) {
|
||||
unsigned btype = IN_BINDTYPE_PLAYER12 + (in_probe_dev_ix >= 2);
|
||||
binds_d[IN_BIND_OFFS(defbinds[i].code, btype)] |=
|
||||
1 <<(defbinds[i].bit + (in_probe_dev_ix&1)*16);
|
||||
} else
|
||||
binds_d[IN_BIND_OFFS(defbinds[i].code, defbinds[i].btype)] |=
|
||||
1 << defbinds[i].bit;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -170,6 +176,7 @@ update:
|
|||
in_devices[i].binds = NULL;
|
||||
}
|
||||
}
|
||||
in_probe_dev_ix ++;
|
||||
}
|
||||
|
||||
/* key combo handling, to be called by drivers that support it.
|
||||
|
@ -252,6 +259,7 @@ void in_probe(void)
|
|||
|
||||
for (i = 0; i < in_driver_count; i++) {
|
||||
in_probe_dev_id = i;
|
||||
in_probe_dev_ix = 0;
|
||||
in_drivers[i].probe(&DRV(i));
|
||||
}
|
||||
|
||||
|
@ -357,8 +365,13 @@ int in_update_keycode(int *dev_id_out, int *is_down_out, char *charcode, int tim
|
|||
|
||||
if (in_have_async_devs) {
|
||||
result = in_update_kc_async(&dev_id, &is_down, timeout_ms);
|
||||
if (result == -1)
|
||||
if (result == -1) {
|
||||
#ifdef SDL_REDRAW_EVT
|
||||
// no key up event for RDRAW, clear to avoid key repeat
|
||||
menu_key_state &= ~PBTN_RDRAW;
|
||||
#endif
|
||||
return -1;
|
||||
}
|
||||
drv = &DRV(in_devices[dev_id].drv_id);
|
||||
goto finish;
|
||||
}
|
||||
|
|
|
@ -24,17 +24,17 @@ static struct disassemble_info di;
|
|||
static disassembler_ftype print_insn_func;
|
||||
|
||||
#if defined __arm__
|
||||
#define print_insn_func print_insn_little_arm
|
||||
//#define print_insn_func print_insn_little_arm
|
||||
#define BFD_ARCH bfd_arch_arm
|
||||
#define BFD_MACH bfd_mach_arm_unknown
|
||||
#define DASM_OPTS "reg-names-std"
|
||||
#elif defined __aarch64__
|
||||
#define print_insn_func print_insn_aarch64
|
||||
//#define print_insn_func print_insn_aarch64
|
||||
#define BFD_ARCH bfd_arch_aarch64
|
||||
#define BFD_MACH bfd_mach_aarch64
|
||||
#define DASM_OPTS NULL
|
||||
#elif defined __mips__
|
||||
#define print_insn_func print_insn_little_mips
|
||||
//#define print_insn_func print_insn_little_mips
|
||||
#define BFD_ARCH bfd_arch_mips
|
||||
#define BFD_MACH bfd_mach_mipsisa64r2
|
||||
#define DASM_OPTS NULL
|
||||
|
@ -44,12 +44,12 @@ static disassembler_ftype print_insn_func;
|
|||
#define BFD_MACH bfd_mach_riscv64
|
||||
#define DASM_OPTS NULL
|
||||
#elif defined __powerpc__
|
||||
#define print_insn_func print_insn_little_powerpc
|
||||
//#define print_insn_func print_insn_little_powerpc
|
||||
#define BFD_ARCH bfd_arch_powerpc
|
||||
#define BFD_MACH bfd_mach_ppc64
|
||||
#define DASM_OPTS NULL
|
||||
#elif defined(__x86_64__) || defined(__i386__)
|
||||
#define print_insn_func print_insn_i386_intel
|
||||
//#define print_insn_func print_insn_i386_intel
|
||||
#define BFD_ARCH bfd_arch_i386
|
||||
#ifdef __x86_64__
|
||||
#define BFD_MACH bfd_mach_x86_64_intel_syntax
|
||||
|
@ -205,13 +205,31 @@ static int print_insn_hex(bfd_vma addr, struct disassemble_info *info)
|
|||
return 4;
|
||||
}
|
||||
|
||||
#ifdef BFD_COMPRESS_ZSTD
|
||||
static int insn_printf_styled(void *f, enum disassembler_style style, const char* format, ...)
|
||||
{
|
||||
va_list args;
|
||||
size_t n;
|
||||
|
||||
va_start(args, format);
|
||||
n = vprintf(format, args);
|
||||
va_end(args);
|
||||
|
||||
return n;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void host_dasm_init(void)
|
||||
{
|
||||
bfd_init();
|
||||
if (g_argv && g_argv[0])
|
||||
slurp_symtab(g_argv[0]);
|
||||
|
||||
#ifdef BFD_COMPRESS_ZSTD
|
||||
init_disassemble_info(&di, NULL, insn_printf, insn_printf_styled);
|
||||
#else
|
||||
init_disassemble_info(&di, NULL, insn_printf);
|
||||
#endif
|
||||
di.flavour = bfd_target_unknown_flavour;
|
||||
di.memory_error_func = dis_asm_memory_error;
|
||||
di.print_address_func = dis_asm_print_address;
|
||||
|
|
|
@ -17,11 +17,14 @@
|
|||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#ifndef __MINGW32__
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
#include "../plat.h"
|
||||
#include "../posix.h"
|
||||
|
||||
/* XXX: maybe unhardcode pagesize? */
|
||||
#define HUGETLB_PAGESIZE (2 * 1024 * 1024)
|
||||
|
|
2
menu.c
2
menu.c
|
@ -1152,7 +1152,7 @@ rescan:
|
|||
} else {
|
||||
strcpy(newdir, curr_path);
|
||||
p = newdir + strlen(newdir) - 1;
|
||||
while (*p == '/' && p >= newdir) *p-- = 0;
|
||||
while (p >= newdir && *p == '/') *p-- = 0;
|
||||
strcat(newdir, "/");
|
||||
strcat(newdir, namelist[sel]->d_name);
|
||||
}
|
||||
|
|
1
plat.h
1
plat.h
|
@ -119,6 +119,7 @@ static __inline int plat_target_switch_layer(int which, int enable)
|
|||
}
|
||||
|
||||
/* menu: enter (switch bpp, etc), begin/end drawing */
|
||||
void plat_video_menu_update(void);
|
||||
void plat_video_menu_enter(int is_rom_loaded);
|
||||
void plat_video_menu_begin(void);
|
||||
void plat_video_menu_end(void);
|
||||
|
|
16
plat_sdl.c
16
plat_sdl.c
|
@ -10,6 +10,7 @@
|
|||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <SDL.h>
|
||||
#include <SDL_syswm.h>
|
||||
|
||||
|
@ -107,7 +108,7 @@ int plat_sdl_change_video_mode(int w, int h, int force)
|
|||
int W = plat_target.vout_method == vout_mode_overlay2x && w < 640 ? 2*w : w;
|
||||
plat_sdl_overlay = SDL_CreateYUVOverlay(W, h, SDL_UYVY_OVERLAY, plat_sdl_screen);
|
||||
if (plat_sdl_overlay != NULL && SDL_LockYUVOverlay(plat_sdl_overlay) == 0) {
|
||||
if ((long)plat_sdl_overlay->pixels[0] & 3)
|
||||
if ((uintptr_t)plat_sdl_overlay->pixels[0] & 3)
|
||||
fprintf(stderr, "warning: overlay pointer is unaligned\n");
|
||||
|
||||
plat_sdl_overlay_clear();
|
||||
|
@ -144,7 +145,8 @@ int plat_sdl_change_video_mode(int w, int h, int force)
|
|||
flags |= SDL_FULLSCREEN;
|
||||
win_w = fs_w;
|
||||
win_h = fs_h;
|
||||
}
|
||||
} else if (window_b)
|
||||
flags |= SDL_RESIZABLE;
|
||||
|
||||
SDL_PumpEvents();
|
||||
|
||||
|
@ -173,12 +175,12 @@ void plat_sdl_event_handler(void *event_)
|
|||
switch (event->type) {
|
||||
case SDL_VIDEORESIZE:
|
||||
//printf("resize %dx%d\n", event->resize.w, event->resize.h);
|
||||
if (plat_target.vout_method != 0
|
||||
&& !plat_target.vout_fullscreen && !old_fullscreen)
|
||||
if ((plat_target.vout_method != 0 || window_b) &&
|
||||
!plat_target.vout_fullscreen && !old_fullscreen)
|
||||
{
|
||||
window_w = event->resize.w & ~3;
|
||||
window_h = event->resize.h & ~3;
|
||||
plat_sdl_change_video_mode(0, 0, 1);
|
||||
plat_sdl_change_video_mode(window_w, window_h, 1);
|
||||
}
|
||||
break;
|
||||
case SDL_ACTIVEEVENT:
|
||||
|
@ -377,4 +379,8 @@ void plat_sdl_overlay_clear(void)
|
|||
*dst = v;
|
||||
}
|
||||
|
||||
int plat_sdl_is_windowed(void)
|
||||
{
|
||||
return window_b != 0;
|
||||
}
|
||||
// vim:shiftwidth=2:expandtab
|
||||
|
|
|
@ -7,6 +7,7 @@ extern void (*plat_sdl_resize_cb)(int w, int h);
|
|||
extern void (*plat_sdl_quit_cb)(void);
|
||||
|
||||
int plat_sdl_init(void);
|
||||
int plat_sdl_is_windowed(void);
|
||||
int plat_sdl_change_video_mode(int w, int h, int force);
|
||||
void plat_sdl_overlay_clear(void);
|
||||
void plat_sdl_event_handler(void *event_);
|
||||
|
|
5
posix.h
5
posix.h
|
@ -14,7 +14,10 @@
|
|||
#define mkdir(pathname,mode) mkdir(pathname)
|
||||
#define d_type d_ino
|
||||
#define DT_REG 0
|
||||
#define DT_DIR 0
|
||||
#define DT_DIR 1
|
||||
#define DT_LNK 2
|
||||
#define DT_UNKNOWN -1
|
||||
#define readlink(p,d,s) -1
|
||||
#endif
|
||||
|
||||
#else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue