-
-
Save xyzz/5861868db529c0866ada8b8dc51380fa to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --new-file -w -r pcsx_rearmed/build_clean.sh pcsx_rearmed_custom/build_clean.sh | |
0a1,18 | |
> #!/bin/bash | |
> # clean make resource | |
> make clean | |
> rm -f plugins/*.so | |
> rm -f build.log | |
> # clean configure resource | |
> rm -f config.log | |
> rm -f config.mak | |
> # clean binary data | |
> if [ -e ../rootfs/usr/sony/bin/pcsx ]; then | |
> rm -f ../rootfs/usr/sony/bin/pcsx | |
> fi | |
> if [ -e ../rootfs/usr/sony/bin/plugins ]; then | |
> rm -rf ../rootfs/usr/sony/bin/plugins | |
> fi | |
> | |
> TARGET_EXECUTABLE=pcsx | |
> rm -f ${TARGET_EXECUTABLE}.unstripped | |
diff --new-file -w -r pcsx_rearmed/build_pcsx_continue.sh pcsx_rearmed_custom/build_pcsx_continue.sh | |
0a1,9 | |
> #!/bin/bash | |
> if [ ! -e config.log ]; then | |
> # run configure | |
> echo "CFLAGS=-march=armv7-a ./configure --sound-drivers=sdl" | |
> CFLAGS=-march=armv7-a ./configure --sound-drivers=sdl | |
> fi | |
> # build.log include stdout & stderr | |
> echo "make -j 4 2>&1 | tee build.log" | |
> make -k -j 4 2>&1 | tee build.log | |
diff --new-file -w -r pcsx_rearmed/build_pcsx_enable_menu.sh pcsx_rearmed_custom/build_pcsx_enable_menu.sh | |
0a1,2 | |
> #!/bin/bash | |
> ./build_pcsx.sh enable_menu | |
diff --new-file -w -r pcsx_rearmed/build_pcsx.sh pcsx_rearmed_custom/build_pcsx.sh | |
0a1,39 | |
> #!/bin/bash | |
> # | |
> # 使い方: | |
> # $./build_pcsx.sh | |
> # →リリース用のpcsxがビルドされます。 | |
> # | |
> # $./build_pcsx.sh enable_menu | |
> # →Joysticの「select + △」押下でpcsxのメニューが開くpcsxがビルドされます。 | |
> # | |
> # | |
> source /usr/local/oecore-x86_64/environment-setup-cortexa7hf-neon-vfpv4-poky-linux-gnueabi | |
> if [ ! -e config.log ]; then | |
> # run configure | |
> # set sdl2-config path | |
> export PATH=$PATH:$SDKTARGETSYSROOT/usr/bin | |
> CROSS_COMPILE=arm-poky-linux-gnueabi CFLAGS="-march=armv7ve -mfloat-abi=hard -mfpu=neon-vfpv4 -mcpu=cortex-a7 -mtune=cortex-a7" ./configure --sound-drivers=sdl | |
> fi | |
> # build.log include stdout & stderr | |
> if [ $# -eq 1 ]; then | |
> if [ $1 = "enable_menu" ]; then | |
> BUILD_OPTION="CONFIG_ENABLE_MENU=1" | |
> fi | |
> fi | |
> echo "make $BUILD_OPTION -j4 2>&1 | tee build.log" | |
> make $BUILD_OPTION -j4 2>&1 | tee build.log | |
> | |
> TARGET_EXECUTABLE=pcsx | |
> STRIP_OPTION=-s | |
> cp ${TARGET_EXECUTABLE} ${TARGET_EXECUTABLE}.unstripped | |
> $(${STRIP} ${STRIP_OPTION} -o ${TARGET_EXECUTABLE} ${TARGET_EXECUTABLE}.unstripped) | |
> | |
> if [ -e ./pcsx ]; then | |
> mkdir -p ../rootfs/usr/sony/bin/ | |
> cp ./pcsx ../rootfs/usr/sony/bin/ | |
> fi | |
> if [ -e ./plugins ]; then | |
> mkdir -p ../rootfs/usr/sony/bin/plugins | |
> cp ./plugins/gpu_peops.so ../rootfs/usr/sony/bin/plugins | |
> fi | |
diff --new-file -w -r pcsx_rearmed/build_pcsx.sh.bak pcsx_rearmed_custom/build_pcsx.sh.bak | |
0a1,12 | |
> #!/bin/bash | |
> if [ ! -e config.log ]; then | |
> # run configure | |
> echo "CFLAGS=-march=armv7-a ./configure --sound-drivers=sdl --disable-neon" | |
> CFLAGS=-march=armv7-a ./configure --sound-drivers=sdl --disable-neon | |
> | |
> mv config.mak config.mak.org | |
> sed s/SDL/SDL2/ config.mak.org > config.mak | |
> fi | |
> # build.log include stdout & stderr | |
> echo "make -j 4 2>&1 | tee build.log" | |
> make -j 4 2>&1 | tee build.log | |
diff --new-file -w -r pcsx_rearmed/configure pcsx_rearmed_custom/configure | |
255,259c255,259 | |
< floatabi_set_by_gcc=`$CC -v 2>&1 | grep -q -- --with-float= && echo yes` || true | |
< if [ "$floatabi_set_by_gcc" != "yes" ]; then | |
< echo "$CFLAGS" | grep -q -- '-mfloat-abi=' || CFLAGS="$CFLAGS -mfloat-abi=softfp" | |
< echo "$ASFLAGS" | grep -q -- '-mfloat-abi=' || ASFLAGS="$ASFLAGS -mfloat-abi=softfp" | |
< fi | |
--- | |
> #floatabi_set_by_gcc=`$CC -v 2>&1 | grep -q -- --with-float= && echo yes` || true | |
> #if [ "$floatabi_set_by_gcc" != "yes" ]; then | |
> #echo "$CFLAGS" | grep -q -- '-mfloat-abi=' || CFLAGS="$CFLAGS -mfloat-abi=softfp" | |
> #echo "$ASFLAGS" | grep -q -- '-mfloat-abi=' || ASFLAGS="$ASFLAGS -mfloat-abi=softfp" | |
> #fi | |
405c405 | |
< if [ "$need_sdl" = "yes" ] || check_sdl `sdl-config --cflags --libs`; then | |
--- | |
> if [ "$need_sdl" = "yes" ] || check_sdl `sdl2-config --cflags --libs`; then | |
424,428c424,428 | |
< which sdl-config > /dev/null || \ | |
< fail "sdl-config is missing; please install libsdl (libsdl1.2-dev)" | |
< CFLAGS="$CFLAGS `sdl-config --cflags`" | |
< MAIN_LDLIBS="`sdl-config --libs` $MAIN_LDLIBS" | |
< check_sdl || fail "please install libsdl (libsdl1.2-dev)" | |
--- | |
> which sdl2-config > /dev/null || \ | |
> fail "sdl2-config is missing; please install libsdl2" | |
> CFLAGS="$CFLAGS `pkg-config --cflags sdl2`" | |
> MAIN_LDLIBS="`pkg-config --libs sdl2` $MAIN_LDLIBS" | |
> check_sdl || fail "please install libsdl2" | |
451c451 | |
< need_xlib="yes" | |
--- | |
> need_xlib="no" | |
533a534,535 | |
> | |
> MAIN_LDLIBS="$MAIN_LDLIBS -lwayland-client -lwayland-egl" | |
diff --new-file -w -r pcsx_rearmed/frontend/cspace.c pcsx_rearmed_custom/frontend/cspace.c | |
36a37,51 | |
> void bgr555_to_rgb565_without_neon(void *dst_, const void *src_, int bytes) | |
> { | |
> const unsigned int *src = src_; | |
> unsigned int *dst = dst_; | |
> unsigned int p; | |
> int x; | |
> | |
> for (x = 0; x < bytes / 4; x++) { | |
> p = src[x]; | |
> p = ((p & 0x7c007c00) >> 10) | ((p & 0x03e003e0) << 1) | |
> | ((p & 0x001f001f) << 11); | |
> dst[x] = p; | |
> } | |
> } | |
> | |
diff --new-file -w -r pcsx_rearmed/frontend/cspace.h pcsx_rearmed_custom/frontend/cspace.h | |
6a7,9 | |
> #ifdef __ARM_NEON__ | |
> void bgr555_to_rgb565_without_neon(void *dst, const void *src, int bytes); | |
> #endif __ARM_NEON__ | |
diff --new-file -w -r pcsx_rearmed/frontend/libpicofe/.gitignore pcsx_rearmed_custom/frontend/libpicofe/.gitignore | |
1,4d0 | |
< *.o | |
< *.swp | |
< cscope.out | |
< tags | |
diff --new-file -w -r pcsx_rearmed/frontend/libpicofe/gl.c pcsx_rearmed_custom/frontend/libpicofe/gl.c | |
44a45 | |
> | |
49a51,52 | |
> printf("frontend/libpicore/gl.c : gl_init()\n"); | |
> | |
56c59 | |
< tmp_texture_mem = calloc(1, 1024 * 512 * 2); | |
--- | |
> tmp_texture_mem = calloc(1, 1024 * 1024 * 3); | |
106,107c109,110 | |
< glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1024, 512, 0, GL_RGB, | |
< GL_UNSIGNED_SHORT_5_6_5, tmp_texture_mem); | |
--- | |
> glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1024, 1024, 0, GL_RGB, | |
> GL_UNSIGNED_BYTE, tmp_texture_mem); | |
135,138c138,141 | |
< -1.0f, 1.0f, 0.0f, // 0 0 1 | |
< 1.0f, 1.0f, 0.0f, // 1 ^ | |
< -1.0f, -1.0f, 0.0f, // 2 | 2 3 | |
< 1.0f, -1.0f, 0.0f, // 3 +--> | |
--- | |
> -0.95f, 0.95f, 0.0f, // 0 0 1 | |
> 0.95f, 0.95f, 0.0f, // 1 ^ | |
> -0.95f, -0.95f, 0.0f, // 2 | 2 3 | |
> 0.95f, -0.95f, 0.0f, // 3 +--> | |
148c151 | |
< int gl_flip(const void *fb, int w, int h) | |
--- | |
> int gl_flip(const void *fb, int w, int h, int rgb888) | |
155c158 | |
< float f_h = (float)h / 512.0f; | |
--- | |
> float f_h = (float)h / 1024.0f; | |
164c167,171 | |
< glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h, | |
--- | |
> if( rgb888 ){ | |
> glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h > 1024 ? 1024 : h, | |
> GL_RGB, GL_UNSIGNED_BYTE, fb); | |
> }else{ | |
> glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, w, h > 1024 ? 1024 : h, | |
165a173 | |
> } | |
diff --new-file -w -r pcsx_rearmed/frontend/libpicofe/gl.h pcsx_rearmed_custom/frontend/libpicofe/gl.h | |
7c7 | |
< int gl_flip(const void *fb, int w, int h); | |
--- | |
> int gl_flip(const void *fb, int w, int h, int rgb888); | |
diff --new-file -w -r pcsx_rearmed/frontend/libpicofe/gl_platform.c pcsx_rearmed_custom/frontend/libpicofe/gl_platform.c | |
8a9,22 | |
> #include <errno.h> | |
> #include <stdbool.h> | |
> #include <string.h> | |
> #include <time.h> | |
> #include <assert.h> | |
> | |
> #include <EGL/egl.h> | |
> #include <wayland-client.h> | |
> #include <wayland-egl.h> | |
> #include <libdrm/drm_fourcc.h> | |
> //#include <xf86drm.h> | |
> //#include <xf86drmMode.h> | |
> | |
> | |
17c31 | |
< #include <X11/Xlib.h> | |
--- | |
> //#include <X11/Xlib.h> | |
20,21c34,35 | |
< static Display *x11display; | |
< static Window x11window; | |
--- | |
> //static Display *x11display; | |
> //static Window x11window; | |
27,29c41,43 | |
< static FPTR(XGetGeometry); | |
< static FPTR(XGetWindowAttributes); | |
< static FPTR(XTranslateCoordinates); | |
--- | |
> //static FPTR(XGetGeometry); | |
> //static FPTR(XGetWindowAttributes); | |
> //static FPTR(XTranslateCoordinates); | |
33c47 | |
< XWindowAttributes xattrs_root; | |
--- | |
> // XWindowAttributes xattrs_root; | |
37c51 | |
< Window root, dummyw; | |
--- | |
> // Window root, dummyw; | |
48c62 | |
< if (x11display == NULL || x11window == 0) | |
--- | |
> // if (x11display == NULL || x11window == 0) | |
51,53c65,67 | |
< pXGetGeometry(x11display, x11window, &root, &dx, &dy, &dw, &dh, | |
< &dummy, &dummy); | |
< pXGetWindowAttributes(x11display, root, &xattrs_root); | |
--- | |
> // pXGetGeometry(x11display, x11window, &root, &dx, &dy, &dw, &dh, | |
> // &dummy, &dummy); | |
> // pXGetWindowAttributes(x11display, root, &xattrs_root); | |
55,56c69,70 | |
< if (dw == xattrs_root.width && dh == xattrs_root.height) | |
< return; // use fullscreen | |
--- | |
> // if (dw == xattrs_root.width && dh == xattrs_root.height) | |
> // return; // use fullscreen | |
58,59c72,73 | |
< pXTranslateCoordinates(x11display, x11window, root, | |
< dx, dy, &dx, &dy, &dummyw); | |
--- | |
> // pXTranslateCoordinates(x11display, x11window, root, | |
> // dx, dy, &dx, &dy, &dummyw); | |
63,64c77,78 | |
< dx += (disp_w - xattrs_root.width) / 2; | |
< dy += (disp_h - xattrs_root.height) / 2; | |
--- | |
> // dx += (disp_w - xattrs_root.width) / 2; | |
> // dy += (disp_h - xattrs_root.height) / 2; | |
66,69c80,83 | |
< rect->x = dx; | |
< rect->y = dy; | |
< rect->width = dw; | |
< rect->height = dh; | |
--- | |
> // rect->x = dx; | |
> // rect->y = dy; | |
> // rect->width = dw; | |
> // rect->height = dh; | |
97,98c111,112 | |
< x11display = NULL; | |
< x11window = 0; | |
--- | |
> // x11display = NULL; | |
> // x11window = 0; | |
100,111c114,125 | |
< x11lib = dlopen("libX11.so.6", RTLD_LAZY); | |
< if (x11lib != NULL) { | |
< pXGetGeometry = dlsym(x11lib, "XGetGeometry"); | |
< pXGetWindowAttributes = dlsym(x11lib, "XGetWindowAttributes"); | |
< pXTranslateCoordinates = dlsym(x11lib, "XTranslateCoordinates"); | |
< if (pXGetGeometry != NULL && pXGetWindowAttributes != NULL | |
< && pXTranslateCoordinates != NULL) | |
< { | |
< x11display = *display; | |
< x11window = (Window)*window; | |
< } | |
< } | |
--- | |
> // x11lib = dlopen("libX11.so.6", RTLD_LAZY); | |
> // if (x11lib != NULL) { | |
> // pXGetGeometry = dlsym(x11lib, "XGetGeometry"); | |
> // pXGetWindowAttributes = dlsym(x11lib, "XGetWindowAttributes"); | |
> // pXTranslateCoordinates = dlsym(x11lib, "XTranslateCoordinates"); | |
> // if (pXGetGeometry != NULL && pXGetWindowAttributes != NULL | |
> // && pXTranslateCoordinates != NULL) | |
> // { | |
> // x11display = *display; | |
> // x11window = (Window)*window; | |
> // } | |
> // } | |
133,134c147,148 | |
< x11display = NULL; | |
< x11window = 0; | |
--- | |
> // x11display = NULL; | |
> // x11window = 0; | |
138a153,313 | |
> #if 1 | |
> struct wayland_info { | |
> struct wl_display *display; | |
> struct wl_registry *registry; | |
> struct wl_compositor *compositor; | |
> struct wl_shell *shell; | |
> | |
> bool roundtrip_needed; | |
> | |
> struct { | |
> struct wl_shell_surface *shell_surface; | |
> struct wl_surface *surface; | |
> struct wl_egl_window *egl_window; | |
> EGLSurface egl_surface; | |
> } surface; | |
> | |
> }; | |
> #endif | |
> | |
> #if 0 | |
> static void | |
> global_handler(void *data, struct wl_registry *registry, uint32_t id, | |
> const char *interface, uint32_t version) | |
> { | |
> struct wayland_info *info = data; | |
> | |
> if (strcmp(interface, "wl_compositor") == 0) { | |
> info->compositor = wl_registry_bind(registry, id, | |
> &wl_compositor_interface, 1); | |
> } | |
> else if (strcmp(interface, "wl_shell") == 0) { | |
> info->shell = wl_registry_bind(registry, id, | |
> &wl_shell_interface, 1); | |
> } | |
> } | |
> | |
> static void | |
> global_remove_handler(void *data, struct wl_registry *registry, uint32_t name) | |
> { | |
> | |
> } | |
> | |
> static const struct wl_registry_listener registry_listener = { | |
> global_handler, | |
> global_remove_handler | |
> }; | |
> | |
> static void | |
> handle_ping (void *data, struct wl_shell_surface *shell_surface, | |
> uint32_t serial) | |
> { | |
> wl_shell_surface_pong (shell_surface, serial); | |
> } | |
> | |
> | |
> static void | |
> handle_configure (void *data, struct wl_shell_surface *shell_surface, | |
> uint32_t edges, int32_t width, int32_t height) | |
> { | |
> struct wayland_info *info = data; | |
> | |
> wl_egl_window_resize (info->surface.egl_window, width, height, 0, 0); | |
> printf("handle_configure ReSize Window[%d, %d]\n", width, height); | |
> } | |
> | |
> static void | |
> handle_popup_done (void *data, struct wl_shell_surface *shell_surface) | |
> { | |
> } | |
> | |
> static const struct wl_shell_surface_listener shell_surface_listener = { | |
> handle_ping, | |
> handle_configure, | |
> handle_popup_done | |
> }; | |
> | |
> static void | |
> create_surface(struct wayland_info *info) | |
> { | |
> info->surface.shell_surface = wl_shell_get_shell_surface (info->shell, info->surface.surface); | |
> wl_shell_surface_add_listener(info->surface.shell_surface, &shell_surface_listener, info); | |
> wl_shell_surface_set_toplevel(info->surface.shell_surface); | |
> } | |
> | |
> int __gl_platform_init(void **display, void **window, int *quirks) | |
> { | |
> | |
> struct wayland_info *info = malloc(sizeof(struct wayland_info)); | |
> | |
> if (info == NULL) | |
> return 0; | |
> | |
> info->display = wl_display_connect(NULL); | |
> if (!info->display) { | |
> printf("wl_display_connect is failed\n"); | |
> exit(EXIT_SUCCESS); | |
> } | |
> | |
> info->registry = wl_display_get_registry(info->display); | |
> wl_registry_add_listener(info->registry, ®istry_listener, info); | |
> wl_display_dispatch (info->display); | |
> wl_display_roundtrip(info->display); | |
> | |
> *display = info->display; | |
> | |
> info->surface.surface = wl_compositor_create_surface(info->compositor); | |
> create_surface(info); | |
> | |
> wl_display_roundtrip(info->display); | |
> | |
> info->surface.egl_window = wl_egl_window_create(info->surface.surface, | |
> 1280, | |
> 720); | |
> *window = info->surface.egl_window; | |
> | |
> return 0; | |
> } | |
> | |
> void gl_platform_finish(void) | |
> { | |
> } | |
> #endif | |
> | |
> #if 1 | |
> #if 1 | |
> static struct wl_display * aa_display; | |
> static struct wl_shell_surface *aa_shell_surface; | |
> static struct wl_surface *aa_surface; | |
> static struct wl_egl_window *aa_window; | |
> | |
> void gl_setup_wl_information(struct wl_display * idisplay, | |
> struct wl_surface *isurface, | |
> struct wl_shell_surface *ishell_surface) | |
> { | |
> aa_display = idisplay; | |
> aa_surface = isurface; | |
> aa_shell_surface = ishell_surface; | |
> | |
> printf("gl_setup_wl_information, display:0x%x, surface: 0x%x\n", | |
> aa_display, aa_surface); | |
> | |
> } | |
> #endif | |
> | |
> #if 0 | |
> static struct wl_display * plat_display; | |
> static struct wl_surface *plat_surface; | |
> static struct wl_egl_window *plat_window; | |
> | |
> void gl_setup_wl_information(struct wl_display * idisplay, | |
> struct wl_surface *isurface) | |
> { | |
> plat_display = idisplay; | |
> plat_surface = isurface; | |
> | |
> printf("aaaa gl_setup_wl_information, display:0x%x, surface: 0x%x\n", | |
> plat_display, plat_surface); | |
> | |
> } | |
> #endif | |
> | |
140a316,348 | |
> #if 1 | |
> struct wayland_info *info = malloc(sizeof(struct wayland_info)); | |
> | |
> if (info == NULL) | |
> return 0; | |
> | |
> info->display = aa_display; | |
> if (!info->display) { | |
> printf("wl_display_connect is failed\n"); | |
> } | |
> | |
> | |
> *display = info->display; | |
> | |
> info->surface.surface = aa_surface; | |
> info->surface.shell_surface = aa_shell_surface; | |
> | |
> | |
> printf("gl_platform_init before window_create\n"); | |
> | |
> info->surface.egl_window = wl_egl_window_create(info->surface.surface, | |
> 960, | |
> 720); | |
> *window = info->surface.egl_window; | |
> | |
> printf("gl_platform_init, display:0x%x, window: 0x%x\n", | |
> info->display, info->surface.egl_window); | |
> #endif | |
> | |
> //plat_window = wl_egl_window_create(plat_surface, 1280, 720); //640, 480); | |
> //*display = plat_display; | |
> //*window = plat_window; | |
> | |
145a354 | |
> //wl_egl_window_destroy(plat_window); | |
148a358,359 | |
> | |
> #endif | |
diff --new-file -w -r pcsx_rearmed/frontend/libpicofe/input.c pcsx_rearmed_custom/frontend/libpicofe/input.c | |
14a15 | |
> #include <SDL.h> | |
18a20 | |
> #include "../main.h" | |
250c252 | |
< | |
--- | |
> SDL_QuitSubSystem(SDL_INIT_JOYSTICK); | |
318c320 | |
< while (1) | |
--- | |
> while (!power_off_flg) | |
471a474,476 | |
> if (power_off_flg) { | |
> break; | |
> } | |
1026a1032,1045 | |
> | |
> typedef int bool; | |
> #define true 1 | |
> #define false 0 | |
> | |
> bool bIsValidHotPlugEvent(SDL_Event *arg_pEvent) { | |
> bool bRet = false; | |
> | |
> if((arg_pEvent->jdevice.type == SDL_JOYDEVICEADDED) || | |
> (arg_pEvent->jdevice.type == SDL_JOYDEVICEREMOVED)) { | |
> bRet = true; | |
> } | |
> return bRet; | |
> } | |
diff --new-file -w -r pcsx_rearmed/frontend/libpicofe/input.h pcsx_rearmed_custom/frontend/libpicofe/input.h | |
79a80 | |
> int p2_connected; | |
diff --new-file -w -r pcsx_rearmed/frontend/libpicofe/in_sdl.c pcsx_rearmed_custom/frontend/libpicofe/in_sdl.c | |
13a14,17 | |
> #include <sys/types.h> | |
> #include <sys/stat.h> | |
> #include <fcntl.h> | |
> | |
15a20,26 | |
> #if SDL_MAJOR_VERSION == 2 | |
> #include "keysym.h" | |
> typedef int bool; | |
> #define true 1 | |
> #define false 0 | |
> //#define CONFIG_DEBUG | |
> #endif | |
31a43,458 | |
> #if SDL_MAJOR_VERSION == 2 | |
> SDLK_to_MY_SDLK SDLK_to_My_SDLK_ARRAY[] = { | |
> {SDLK_UNKNOWN, MY_SDLK_UNKNOWN}, | |
> | |
> {SDLK_RETURN, MY_SDLK_RETURN}, | |
> {SDLK_ESCAPE, MY_SDLK_ESCAPE}, | |
> {SDLK_BACKSPACE, MY_SDLK_BACKSPACE}, | |
> {SDLK_TAB, MY_SDLK_TAB}, | |
> {SDLK_SPACE, MY_SDLK_SPACE}, | |
> {SDLK_EXCLAIM, MY_SDLK_EXCLAIM}, | |
> {SDLK_QUOTEDBL, MY_SDLK_QUOTEDBL}, | |
> {SDLK_HASH, MY_SDLK_HASH}, | |
> {SDLK_PERCENT, MY_SDLK_PERCENT}, | |
> {SDLK_DOLLAR, MY_SDLK_DOLLAR}, | |
> {SDLK_AMPERSAND, MY_SDLK_AMPERSAND}, | |
> {SDLK_QUOTE, MY_SDLK_QUOTE}, | |
> {SDLK_LEFTPAREN, MY_SDLK_LEFTPAREN}, | |
> {SDLK_RIGHTPAREN, MY_SDLK_RIGHTPAREN}, | |
> {SDLK_ASTERISK, MY_SDLK_ASTERISK}, | |
> {SDLK_PLUS, MY_SDLK_PLUS}, | |
> {SDLK_COMMA, MY_SDLK_COMMA}, | |
> {SDLK_MINUS, MY_SDLK_MINUS}, | |
> {SDLK_PERIOD, MY_SDLK_PERIOD}, | |
> {SDLK_SLASH, MY_SDLK_SLASH}, | |
> {SDLK_0, MY_SDLK_0}, | |
> {SDLK_1, MY_SDLK_1}, | |
> {SDLK_2, MY_SDLK_2}, | |
> {SDLK_3, MY_SDLK_3}, | |
> {SDLK_4, MY_SDLK_4}, | |
> {SDLK_5, MY_SDLK_5}, | |
> {SDLK_6, MY_SDLK_6}, | |
> {SDLK_7, MY_SDLK_7}, | |
> {SDLK_8, MY_SDLK_8}, | |
> {SDLK_9, MY_SDLK_9}, | |
> {SDLK_COLON, MY_SDLK_COLON}, | |
> {SDLK_SEMICOLON, MY_SDLK_SEMICOLON}, | |
> {SDLK_LESS, MY_SDLK_LESS}, | |
> {SDLK_EQUALS, MY_SDLK_EQUALS}, | |
> {SDLK_GREATER, MY_SDLK_GREATER}, | |
> {SDLK_QUESTION, MY_SDLK_QUESTION}, | |
> {SDLK_AT, MY_SDLK_AT}, | |
> /* | |
> Skip uppercase letters | |
> */ | |
> {SDLK_LEFTBRACKET, MY_SDLK_LEFTBRACKET}, | |
> {SDLK_BACKSLASH, MY_SDLK_BACKSLASH}, | |
> {SDLK_RIGHTBRACKET, MY_SDLK_RIGHTBRACKET}, | |
> {SDLK_CARET, MY_SDLK_CARET}, | |
> {SDLK_UNDERSCORE, MY_SDLK_UNDERSCORE}, | |
> {SDLK_BACKQUOTE, MY_SDLK_BACKQUOTE}, | |
> {SDLK_a, MY_SDLK_a}, | |
> {SDLK_b, MY_SDLK_b}, | |
> {SDLK_c, MY_SDLK_c}, | |
> {SDLK_d, MY_SDLK_d}, | |
> {SDLK_e, MY_SDLK_e}, | |
> {SDLK_f, MY_SDLK_f}, | |
> {SDLK_g, MY_SDLK_g}, | |
> {SDLK_h, MY_SDLK_h}, | |
> {SDLK_i, MY_SDLK_i}, | |
> {SDLK_j, MY_SDLK_j}, | |
> {SDLK_k, MY_SDLK_k}, | |
> {SDLK_l, MY_SDLK_l}, | |
> {SDLK_m, MY_SDLK_m}, | |
> {SDLK_n, MY_SDLK_n}, | |
> {SDLK_o, MY_SDLK_o}, | |
> {SDLK_p, MY_SDLK_p}, | |
> {SDLK_q, MY_SDLK_q}, | |
> {SDLK_r, MY_SDLK_r}, | |
> {SDLK_s, MY_SDLK_s}, | |
> {SDLK_t, MY_SDLK_t}, | |
> {SDLK_u, MY_SDLK_u}, | |
> {SDLK_v, MY_SDLK_v}, | |
> {SDLK_w, MY_SDLK_w}, | |
> {SDLK_x, MY_SDLK_x}, | |
> {SDLK_y, MY_SDLK_y}, | |
> {SDLK_z, MY_SDLK_z}, | |
> | |
> {SDLK_CAPSLOCK, MY_SDLK_CAPSLOCK}, | |
> | |
> {SDLK_F1, MY_SDLK_F1}, | |
> {SDLK_F2, MY_SDLK_F2}, | |
> {SDLK_F3, MY_SDLK_F3}, | |
> {SDLK_F4, MY_SDLK_F4}, | |
> {SDLK_F5, MY_SDLK_F5}, | |
> {SDLK_F6, MY_SDLK_F6}, | |
> {SDLK_F7, MY_SDLK_F7}, | |
> {SDLK_F8, MY_SDLK_F8}, | |
> {SDLK_F9, MY_SDLK_F9}, | |
> {SDLK_F10, MY_SDLK_F10}, | |
> {SDLK_F11, MY_SDLK_F11}, | |
> {SDLK_F12, MY_SDLK_F12}, | |
> | |
> {SDLK_PRINTSCREEN, MY_SDLK_PRINTSCREEN}, | |
> {SDLK_SCROLLLOCK, MY_SDLK_SCROLLLOCK}, | |
> {SDLK_PAUSE, MY_SDLK_PAUSE}, | |
> {SDLK_INSERT, MY_SDLK_INSERT}, | |
> {SDLK_HOME, MY_SDLK_HOME}, | |
> {SDLK_PAGEUP, MY_SDLK_PAGEUP}, | |
> {SDLK_DELETE, MY_SDLK_DELETE}, | |
> {SDLK_END, MY_SDLK_END}, | |
> {SDLK_PAGEDOWN, MY_SDLK_PAGEDOWN}, | |
> {SDLK_RIGHT, MY_SDLK_RIGHT}, | |
> {SDLK_LEFT, MY_SDLK_LEFT}, | |
> {SDLK_DOWN, MY_SDLK_DOWN}, | |
> {SDLK_UP, MY_SDLK_UP}, | |
> | |
> {SDLK_NUMLOCKCLEAR, MY_SDLK_NUMLOCKCLEAR}, | |
> {SDLK_KP_DIVIDE, MY_SDLK_KP_DIVIDE}, | |
> {SDLK_KP_MULTIPLY, MY_SDLK_KP_MULTIPLY}, | |
> {SDLK_KP_MINUS, MY_SDLK_KP_MINUS}, | |
> {SDLK_KP_PLUS, MY_SDLK_KP_PLUS}, | |
> {SDLK_KP_ENTER, MY_SDLK_KP_ENTER}, | |
> {SDLK_KP_1, MY_SDLK_KP_1}, | |
> {SDLK_KP_2, MY_SDLK_KP_2}, | |
> {SDLK_KP_3, MY_SDLK_KP_3}, | |
> {SDLK_KP_4, MY_SDLK_KP_4}, | |
> {SDLK_KP_5, MY_SDLK_KP_5}, | |
> {SDLK_KP_6, MY_SDLK_KP_6}, | |
> {SDLK_KP_7, MY_SDLK_KP_7}, | |
> {SDLK_KP_8, MY_SDLK_KP_8}, | |
> {SDLK_KP_9, MY_SDLK_KP_9}, | |
> {SDLK_KP_0, MY_SDLK_KP_0}, | |
> {SDLK_KP_PERIOD, MY_SDLK_KP_PERIOD}, | |
> | |
> {SDLK_APPLICATION, MY_SDLK_APPLICATION}, | |
> {SDLK_POWER, MY_SDLK_POWER}, | |
> {SDLK_KP_EQUALS, MY_SDLK_KP_EQUALS}, | |
> {SDLK_F13, MY_SDLK_F13}, | |
> {SDLK_F14, MY_SDLK_F14}, | |
> {SDLK_F15, MY_SDLK_F15}, | |
> {SDLK_F16, MY_SDLK_F16}, | |
> {SDLK_F17, MY_SDLK_F17}, | |
> {SDLK_F18, MY_SDLK_F18}, | |
> {SDLK_F19, MY_SDLK_F19}, | |
> {SDLK_F20, MY_SDLK_F20}, | |
> {SDLK_F21, MY_SDLK_F21}, | |
> {SDLK_F22, MY_SDLK_F22}, | |
> {SDLK_F23, MY_SDLK_F23}, | |
> {SDLK_F24, MY_SDLK_F24}, | |
> {SDLK_EXECUTE, MY_SDLK_EXECUTE}, | |
> {SDLK_HELP, MY_SDLK_HELP}, | |
> {SDLK_MENU, MY_SDLK_MENU}, | |
> {SDLK_SELECT, MY_SDLK_SELECT}, | |
> {SDLK_STOP, MY_SDLK_STOP}, | |
> {SDLK_AGAIN, MY_SDLK_AGAIN}, | |
> {SDLK_UNDO, MY_SDLK_UNDO}, | |
> {SDLK_CUT, MY_SDLK_CUT}, | |
> {SDLK_COPY, MY_SDLK_COPY}, | |
> {SDLK_PASTE, MY_SDLK_PASTE}, | |
> {SDLK_FIND, MY_SDLK_FIND}, | |
> {SDLK_MUTE, MY_SDLK_MUTE}, | |
> {SDLK_VOLUMEUP, MY_SDLK_VOLUMEUP}, | |
> {SDLK_VOLUMEDOWN, MY_SDLK_VOLUMEDOWN}, | |
> {SDLK_KP_COMMA, MY_SDLK_KP_COMMA}, | |
> {SDLK_KP_EQUALSAS400, MY_SDLK_KP_EQUALSAS400}, | |
> | |
> {SDLK_ALTERASE, MY_SDLK_ALTERASE}, | |
> {SDLK_SYSREQ, MY_SDLK_SYSREQ}, | |
> {SDLK_CANCEL, MY_SDLK_CANCEL}, | |
> {SDLK_CLEAR, MY_SDLK_CLEAR}, | |
> {SDLK_PRIOR, MY_SDLK_PRIOR}, | |
> {SDLK_RETURN2, MY_SDLK_RETURN2}, | |
> {SDLK_SEPARATOR, MY_SDLK_SEPARATOR}, | |
> {SDLK_OUT, MY_SDLK_OUT}, | |
> {SDLK_OPER, MY_SDLK_OPER}, | |
> {SDLK_CLEARAGAIN, MY_SDLK_CLEARAGAIN}, | |
> {SDLK_CRSEL, MY_SDLK_CRSEL}, | |
> {SDLK_EXSEL, MY_SDLK_EXSEL}, | |
> | |
> {SDLK_KP_00, MY_SDLK_KP_00}, | |
> {SDLK_KP_000, MY_SDLK_KP_000}, | |
> {SDLK_THOUSANDSSEPARATOR, MY_SDLK_THOUSANDSSEPARATOR}, | |
> {SDLK_DECIMALSEPARATOR, MY_SDLK_DECIMALSEPARATOR}, | |
> {SDLK_CURRENCYUNIT, MY_SDLK_CURRENCYUNIT}, | |
> {SDLK_CURRENCYSUBUNIT, MY_SDLK_CURRENCYSUBUNIT}, | |
> {SDLK_KP_LEFTPAREN, MY_SDLK_KP_LEFTPAREN}, | |
> {SDLK_KP_RIGHTPAREN, MY_SDLK_KP_RIGHTPAREN}, | |
> {SDLK_KP_LEFTBRACE, MY_SDLK_KP_LEFTBRACE}, | |
> {SDLK_KP_RIGHTBRACE, MY_SDLK_KP_RIGHTBRACE}, | |
> {SDLK_KP_TAB, MY_SDLK_KP_TAB}, | |
> {SDLK_KP_BACKSPACE, MY_SDLK_KP_BACKSPACE}, | |
> {SDLK_KP_A, MY_SDLK_KP_A}, | |
> {SDLK_KP_B, MY_SDLK_KP_B}, | |
> {SDLK_KP_C, MY_SDLK_KP_C}, | |
> {SDLK_KP_D, MY_SDLK_KP_D}, | |
> {SDLK_KP_E, MY_SDLK_KP_E}, | |
> {SDLK_KP_F, MY_SDLK_KP_F}, | |
> {SDLK_KP_XOR, MY_SDLK_KP_XOR}, | |
> {SDLK_KP_POWER, MY_SDLK_KP_POWER}, | |
> {SDLK_KP_PERCENT, MY_SDLK_KP_PERCENT}, | |
> {SDLK_KP_LESS, MY_SDLK_KP_LESS}, | |
> {SDLK_KP_GREATER, MY_SDLK_KP_GREATER}, | |
> {SDLK_KP_AMPERSAND, MY_SDLK_KP_AMPERSAND}, | |
> {SDLK_KP_DBLAMPERSAND, MY_SDLK_KP_DBLAMPERSAND}, | |
> {SDLK_KP_VERTICALBAR, MY_SDLK_KP_VERTICALBAR}, | |
> {SDLK_KP_DBLVERTICALBAR, MY_SDLK_KP_DBLVERTICALBAR}, | |
> {SDLK_KP_COLON, MY_SDLK_KP_COLON}, | |
> {SDLK_KP_HASH, MY_SDLK_KP_HASH}, | |
> {SDLK_KP_SPACE, MY_SDLK_KP_SPACE}, | |
> {SDLK_KP_AT, MY_SDLK_KP_AT}, | |
> {SDLK_KP_EXCLAM, MY_SDLK_KP_EXCLAM}, | |
> {SDLK_KP_MEMSTORE, MY_SDLK_KP_MEMSTORE}, | |
> {SDLK_KP_MEMRECALL, MY_SDLK_KP_MEMRECALL}, | |
> {SDLK_KP_MEMCLEAR, MY_SDLK_KP_MEMCLEAR}, | |
> {SDLK_KP_MEMADD, MY_SDLK_KP_MEMADD}, | |
> {SDLK_KP_MEMSUBTRACT, MY_SDLK_KP_MEMSUBTRACT}, | |
> {SDLK_KP_MEMMULTIPLY, MY_SDLK_KP_MEMMULTIPLY}, | |
> {SDLK_KP_MEMDIVIDE, MY_SDLK_KP_MEMDIVIDE}, | |
> {SDLK_KP_PLUSMINUS, MY_SDLK_KP_PLUSMINUS}, | |
> {SDLK_KP_CLEAR, MY_SDLK_KP_CLEAR}, | |
> {SDLK_KP_CLEARENTRY, MY_SDLK_KP_CLEARENTRY}, | |
> {SDLK_KP_BINARY, MY_SDLK_KP_BINARY}, | |
> {SDLK_KP_OCTAL, MY_SDLK_KP_OCTAL}, | |
> {SDLK_KP_DECIMAL, MY_SDLK_KP_DECIMAL}, | |
> {SDLK_KP_HEXADECIMAL, MY_SDLK_KP_HEXADECIMAL}, | |
> | |
> {SDLK_LCTRL, MY_SDLK_LCTRL}, | |
> {SDLK_LSHIFT, MY_SDLK_LSHIFT}, | |
> {SDLK_LALT, MY_SDLK_LALT}, | |
> {SDLK_LGUI, MY_SDLK_LGUI}, | |
> {SDLK_RCTRL, MY_SDLK_RCTRL}, | |
> {SDLK_RSHIFT, MY_SDLK_RSHIFT}, | |
> {SDLK_RALT, MY_SDLK_RALT}, | |
> {SDLK_RGUI, MY_SDLK_RGUI}, | |
> | |
> {SDLK_MODE, MY_SDLK_MODE}, | |
> | |
> {SDLK_AUDIONEXT, MY_SDLK_AUDIONEXT}, | |
> {SDLK_AUDIOPREV, MY_SDLK_AUDIOPREV}, | |
> {SDLK_AUDIOSTOP, MY_SDLK_AUDIOSTOP}, | |
> {SDLK_AUDIOPLAY, MY_SDLK_AUDIOPLAY}, | |
> {SDLK_AUDIOMUTE, MY_SDLK_AUDIOMUTE}, | |
> {SDLK_MEDIASELECT, MY_SDLK_MEDIASELECT}, | |
> {SDLK_WWW, MY_SDLK_WWW}, | |
> {SDLK_MAIL, MY_SDLK_MAIL}, | |
> {SDLK_CALCULATOR, MY_SDLK_CALCULATOR}, | |
> {SDLK_COMPUTER, MY_SDLK_COMPUTER}, | |
> {SDLK_AC_SEARCH, MY_SDLK_AC_SEARCH}, | |
> {SDLK_AC_HOME, MY_SDLK_AC_HOME}, | |
> {SDLK_AC_BACK, MY_SDLK_AC_BACK}, | |
> {SDLK_AC_FORWARD, MY_SDLK_AC_FORWARD}, | |
> {SDLK_AC_STOP, MY_SDLK_AC_STOP}, | |
> {SDLK_AC_REFRESH, MY_SDLK_AC_REFRESH}, | |
> {SDLK_AC_BOOKMARKS, MY_SDLK_AC_BOOKMARKS}, | |
> | |
> {SDLK_BRIGHTNESSDOWN, MY_SDLK_BRIGHTNESSDOWN}, | |
> {SDLK_BRIGHTNESSUP, MY_SDLK_BRIGHTNESSUP}, | |
> {SDLK_DISPLAYSWITCH, MY_SDLK_DISPLAYSWITCH}, | |
> {SDLK_KBDILLUMTOGGLE, MY_SDLK_KBDILLUMTOGGLE}, | |
> {SDLK_KBDILLUMDOWN, MY_SDLK_KBDILLUMDOWN}, | |
> {SDLK_KBDILLUMUP, MY_SDLK_KBDILLUMUP}, | |
> {SDLK_EJECT, MY_SDLK_EJECT}, | |
> {SDLK_SLEEP, MY_SDLK_SLEEP}, | |
> //{SDLK_APP1, MY_SDLK_APP1}, | |
> //{SDLK_APP2, MY_SDLK_APP2}, | |
> | |
> //{SDLK_AUDIOREWIND, MY_SDLK_AUDIOREWIND}, | |
> //{SDLK_AUDIOFASTFORWARD, MY_SDLK_AUDIOFASTFORWARD}, | |
> | |
> {SDLK_LAST, MY_SDLK_UNKNOWN} | |
> }; | |
> | |
> static int func_SDLK_TO_MY_SDLK(int argSDLK) { | |
> int i = 0; | |
> | |
> do { | |
> if(SDLK_to_My_SDLK_ARRAY[i].m_SDLK == argSDLK) { | |
> break; | |
> } | |
> i++; | |
> } while(SDLK_to_My_SDLK_ARRAY[i].m_SDLK != SDLK_LAST); | |
> return SDLK_to_My_SDLK_ARRAY[i].m_MySDLK; | |
> } | |
> | |
> // SDL1で定義されているものを文字列と指定 | |
> static const char * const in_sdl_keys[SDLK_LAST] = { | |
> [MY_SDLK_BACKSPACE] = "backspace", | |
> [MY_SDLK_TAB] = "tab", | |
> [MY_SDLK_CLEAR] = "clear", | |
> [MY_SDLK_RETURN] = "return", | |
> [MY_SDLK_PAUSE] = "pause", | |
> [MY_SDLK_ESCAPE] = "escape", | |
> [MY_SDLK_SPACE] = "space", | |
> [MY_SDLK_EXCLAIM] = "!", | |
> [MY_SDLK_QUOTEDBL] = "\"", | |
> [MY_SDLK_HASH] = "#", | |
> [MY_SDLK_DOLLAR] = "$", | |
> [MY_SDLK_AMPERSAND] = "&", | |
> [MY_SDLK_QUOTE] = "'", | |
> [MY_SDLK_LEFTPAREN] = "(", | |
> [MY_SDLK_RIGHTPAREN] = ")", | |
> [MY_SDLK_ASTERISK] = "*", | |
> [MY_SDLK_PLUS] = "+", | |
> [MY_SDLK_COMMA] = ",", | |
> [MY_SDLK_MINUS] = "-", | |
> [MY_SDLK_PERIOD] = ".", | |
> [MY_SDLK_SLASH] = "/", | |
> [MY_SDLK_0] = "0", | |
> [MY_SDLK_1] = "1", | |
> [MY_SDLK_2] = "2", | |
> [MY_SDLK_3] = "3", | |
> [MY_SDLK_4] = "4", | |
> [MY_SDLK_5] = "5", | |
> [MY_SDLK_6] = "6", | |
> [MY_SDLK_7] = "7", | |
> [MY_SDLK_8] = "8", | |
> [MY_SDLK_9] = "9", | |
> [MY_SDLK_COLON] = ":", | |
> [MY_SDLK_SEMICOLON] = ";", | |
> [MY_SDLK_LESS] = "<", | |
> [MY_SDLK_EQUALS] = "=", | |
> [MY_SDLK_GREATER] = ">", | |
> [MY_SDLK_QUESTION] = "?", | |
> [MY_SDLK_AT] = "@", | |
> [MY_SDLK_LEFTBRACKET] = "[", | |
> [MY_SDLK_BACKSLASH] = "\\", | |
> [MY_SDLK_RIGHTBRACKET] = "]", | |
> [MY_SDLK_CARET] = "^", | |
> [MY_SDLK_UNDERSCORE] = "_", | |
> [MY_SDLK_BACKQUOTE] = "`", | |
> [MY_SDLK_a] = "a", | |
> [MY_SDLK_b] = "b", | |
> [MY_SDLK_c] = "c", | |
> [MY_SDLK_d] = "d", | |
> [MY_SDLK_e] = "e", | |
> [MY_SDLK_f] = "f", | |
> [MY_SDLK_g] = "g", | |
> [MY_SDLK_h] = "h", | |
> [MY_SDLK_i] = "i", | |
> [MY_SDLK_j] = "j", | |
> [MY_SDLK_k] = "k", | |
> [MY_SDLK_l] = "l", | |
> [MY_SDLK_m] = "m", | |
> [MY_SDLK_n] = "n", | |
> [MY_SDLK_o] = "o", | |
> [MY_SDLK_p] = "p", | |
> [MY_SDLK_q] = "q", | |
> [MY_SDLK_r] = "r", | |
> [MY_SDLK_s] = "s", | |
> [MY_SDLK_t] = "t", | |
> [MY_SDLK_u] = "u", | |
> [MY_SDLK_v] = "v", | |
> [MY_SDLK_w] = "w", | |
> [MY_SDLK_x] = "x", | |
> [MY_SDLK_y] = "y", | |
> [MY_SDLK_z] = "z", | |
> [MY_SDLK_DELETE] = "delete", | |
> | |
> [MY_SDLK_KP_0] = "[0]", | |
> [MY_SDLK_KP_1] = "[1]", | |
> [MY_SDLK_KP_2] = "[2]", | |
> [MY_SDLK_KP_3] = "[3]", | |
> [MY_SDLK_KP_4] = "[4]", | |
> [MY_SDLK_KP_5] = "[5]", | |
> [MY_SDLK_KP_6] = "[6]", | |
> [MY_SDLK_KP_7] = "[7]", | |
> [MY_SDLK_KP_8] = "[8]", | |
> [MY_SDLK_KP_9] = "[9]", | |
> [MY_SDLK_KP_PERIOD] = "[.]", | |
> [MY_SDLK_KP_DIVIDE] = "[/]", | |
> [MY_SDLK_KP_MULTIPLY] = "[*]", | |
> [MY_SDLK_KP_MINUS] = "[-]", | |
> [MY_SDLK_KP_PLUS] = "[+]", | |
> [MY_SDLK_KP_ENTER] = "enter", | |
> [MY_SDLK_KP_EQUALS] = "equals", | |
> | |
> [MY_SDLK_UP] = "up", | |
> [MY_SDLK_DOWN] = "down", | |
> [MY_SDLK_RIGHT] = "right", | |
> [MY_SDLK_LEFT] = "left", | |
> [MY_SDLK_INSERT] = "insert", | |
> [MY_SDLK_HOME] = "home", | |
> [MY_SDLK_END] = "end", | |
> [MY_SDLK_PAGEUP] = "page up", | |
> [MY_SDLK_PAGEDOWN] = "page down", | |
> | |
> [MY_SDLK_F1] = "f1", | |
> [MY_SDLK_F2] = "f2", | |
> [MY_SDLK_F3] = "f3", | |
> [MY_SDLK_F4] = "f4", | |
> [MY_SDLK_F5] = "f5", | |
> [MY_SDLK_F6] = "f6", | |
> [MY_SDLK_F7] = "f7", | |
> [MY_SDLK_F8] = "f8", | |
> [MY_SDLK_F9] = "f9", | |
> [MY_SDLK_F10] = "f10", | |
> [MY_SDLK_F11] = "f11", | |
> [MY_SDLK_F12] = "f12", | |
> [MY_SDLK_F13] = "f13", | |
> [MY_SDLK_F14] = "f14", | |
> [MY_SDLK_F15] = "f15", | |
> | |
> [MY_SDLK_NUMLOCKCLEAR] = "numlock", | |
> [MY_SDLK_CAPSLOCK] = "caps lock", | |
> [MY_SDLK_SCROLLLOCK] = "scroll lock", | |
> [MY_SDLK_RSHIFT] = "right shift", | |
> [MY_SDLK_LSHIFT] = "left shift", | |
> [MY_SDLK_RCTRL] = "right ctrl", | |
> [MY_SDLK_LCTRL] = "left ctrl", | |
> [MY_SDLK_RALT] = "right alt", | |
> [MY_SDLK_LALT] = "left alt", | |
> #ifdef NOTDEF | |
> [MY_SDLK_RMETA] = "right meta", | |
> [MY_SDLK_LMETA] = "left meta", | |
> [MY_SDLK_LSUPER] = "left super", /* "Windows" keys */ | |
> [MY_SDLK_RSUPER] = "right super", | |
> #endif | |
> [MY_SDLK_MODE] = "alt gr", | |
> #ifdef NOTDEF | |
> [MY_SDLK_COMPOSE] = "compose", | |
> #endif | |
> [MY_SDLK_EJECT] = "eject", | |
> [MY_SDLK_SLEEP] = "sleep", | |
> [MY_SDLK_AUDIOPLAY] = "reset", | |
> }; | |
> #else | |
163a591,593 | |
> [SDLK_EJECT] = "eject", | |
> [SDLK_SLEEP] = "sleep", | |
> [SDLK_AUDIOPLAY] = "reset", | |
164a595 | |
> #endif | |
190a622,630 | |
> int fd0 = open("/dev/input/joystick0",O_RDONLY); | |
> int fd1 = open("/dev/input/joystick1",O_RDONLY); | |
> | |
> if( fd1 != -1 ){ | |
> p2_connected = 1; | |
> }else{ | |
> p2_connected = 0; | |
> } | |
> | |
205a646,654 | |
> #if SDL_MAJOR_VERSION == 2 | |
> | |
> if(fd1 != -1 && fd0 == -1) { | |
> snprintf(name, sizeof(name), IN_SDL_PREFIX "%s [%d]", SDL_JoystickName(joy), 1); | |
> } else { | |
> snprintf(name, sizeof(name), IN_SDL_PREFIX "%s", SDL_JoystickName(joy)); | |
> } | |
> | |
> #else | |
206a656 | |
> #endif | |
209a660,664 | |
> if(fd0 != -1) | |
> close(fd0); | |
> if(fd1 != -1) | |
> close(fd1); | |
> | |
211a667 | |
> | |
273a730,737 | |
> #ifdef CONFIG_DEBUG | |
> printf("%s:%d SDL_JOYAXISMOTION which=%d axis=%d value=%d\n", | |
> __func__, | |
> __LINE__, | |
> event->jaxis.which, | |
> event->jaxis.axis, | |
> event->jaxis.value); | |
> #endif | |
286a751,753 | |
> #if SDL_MAJOR_VERSION == 2 | |
> kc = event->jaxis.axis ? MY_SDLK_UP : MY_SDLK_LEFT; | |
> #else | |
287a755 | |
> #endif | |
295a764,766 | |
> #if SDL_MAJOR_VERSION == 2 | |
> kc = event->jaxis.axis ? MY_SDLK_DOWN : MY_SDLK_RIGHT; | |
> #else | |
296a768 | |
> #endif | |
304a777,783 | |
> #ifdef CONFIG_DEBUG | |
> printf("%s:%d SDL_JOYBUTTONxxxx which=%d button=%d\n", | |
> __func__, | |
> __LINE__, | |
> event->jbutton.which, | |
> event->jbutton.button); | |
> #endif | |
306a786,788 | |
> #if SDL_MAJOR_VERSION == 2 | |
> kc = (int)event->jbutton.button + MY_SDLK_WORLD_0; | |
> #else | |
307a790 | |
> #endif | |
311a795,801 | |
> #ifdef CONFIG_DEBUG | |
> printf("%s:%d event=0x%x(%d)\n", | |
> __func__, | |
> __LINE__, | |
> event->type, | |
> event->type); | |
> #endif | |
324a815,1007 | |
> #if SDL_MAJOR_VERSION == 2 | |
> static void ControlJoysticEscape(struct in_sdl_state *arg_pState, | |
> SDL_Event *arg_pEvent) | |
> { | |
> SDL_Event myEvent; | |
> static bool bIsCurrentSelectButtonDown = false; | |
> static bool bIsCurrentStartButtonDown = false; | |
> | |
> bool bIsFormerSelectButtonDown = bIsCurrentSelectButtonDown; | |
> bool bIsFormerStartButtonDown = bIsCurrentStartButtonDown; | |
> char *env_menu, *endptr; | |
> #ifdef CONFIG_ENABLE_MENU | |
> int env = 2; | |
> #else | |
> int env = 0; | |
> #endif | |
> #ifdef CONFIG_DEBUG | |
> printf("%s:%d keysym.scancode=%d keysym.sym=%d keysym.mod=%d\n", | |
> __func__, | |
> __LINE__, | |
> myEvent.key.keysym.scancode, | |
> myEvent.key.keysym.sym, | |
> myEvent.key.keysym.mod); | |
> printf("ControlJoysticEscape SDLK_WORLD %d",(arg_pEvent->jbutton.button + MY_SDLK_WORLD_0)); | |
> | |
> #endif | |
> | |
> if (arg_pState->joy) { | |
> env_menu = getenv("PCSX_ESC_KEY"); | |
> if(env_menu != NULL) { | |
> env = strtol(env_menu, &endptr, 10); | |
> if(strlen(endptr) > 0 || env > 2) { | |
> #ifdef CONFIG_ENABLE_MENU | |
> env = 2; | |
> #else | |
> env = 0; | |
> #endif | |
> } | |
> } | |
> | |
> switch(env) { | |
> case 0: | |
> break; | |
> case 1: | |
> if((arg_pEvent->jbutton.button + MY_SDLK_WORLD_0) == MY_SDLK_WORLD_8) { | |
> // "select" key event | |
> switch (arg_pEvent->type) { | |
> case SDL_JOYBUTTONDOWN: | |
> bIsCurrentSelectButtonDown = true; | |
> break; | |
> case SDL_JOYBUTTONUP: | |
> bIsCurrentSelectButtonDown = false; | |
> break; | |
> } | |
> | |
> } else if(((arg_pEvent->jbutton.button + MY_SDLK_WORLD_0) == MY_SDLK_WORLD_9)) { | |
> // "start" key event | |
> switch (arg_pEvent->type) { | |
> case SDL_JOYBUTTONDOWN: | |
> bIsCurrentStartButtonDown = true; | |
> break; | |
> case SDL_JOYBUTTONUP: | |
> bIsCurrentStartButtonDown = false; | |
> break; | |
> } | |
> } | |
> | |
> if(!((bIsFormerSelectButtonDown == true) && (bIsFormerStartButtonDown == true)) | |
> && | |
> ((bIsCurrentSelectButtonDown == true) && (bIsCurrentStartButtonDown == true))) { | |
> | |
> switch((arg_pEvent->jbutton.button + MY_SDLK_WORLD_0)) { | |
> case MY_SDLK_WORLD_9: | |
> #ifdef CONFIG_DEBUG | |
> printf("ControlJoysticEscape SDL_SCANCODE_ESCAPE - SDL_KEYDOWN"); | |
> #endif | |
> myEvent.key.keysym.scancode = SDL_SCANCODE_ESCAPE; | |
> myEvent.key.keysym.sym = SDLK_ESCAPE; | |
> break; | |
> } | |
> | |
> // make ESC-key/Open-key/Reset-key down event | |
> myEvent.type = myEvent.key.type = SDL_KEYDOWN; | |
> myEvent.key.timestamp = arg_pEvent->key.timestamp; | |
> myEvent.key.windowID = 1; | |
> myEvent.key.state = 1; | |
> myEvent.key.repeat = 0; | |
> myEvent.key.keysym.mod = 0; | |
> | |
> SDL_PushEvent(&myEvent); | |
> | |
> } else if(((bIsFormerSelectButtonDown == true) && (bIsFormerStartButtonDown == true)) | |
> && | |
> !((bIsCurrentSelectButtonDown == true) && (bIsCurrentStartButtonDown == true))) { | |
> | |
> // make ESC-key up event | |
> switch((arg_pEvent->jbutton.button + MY_SDLK_WORLD_0)) { | |
> case MY_SDLK_WORLD_9: | |
> #ifdef CONFIG_DEBUG | |
> printf("ControlJoysticEscape SDL_SCANCODE_ESCAPE - SDL_KEYUP"); | |
> #endif | |
> myEvent.key.keysym.scancode = SDL_SCANCODE_ESCAPE; | |
> myEvent.key.keysym.sym = SDLK_ESCAPE; | |
> break; | |
> case MY_SDLK_WORLD_0: | |
> #ifdef CONFIG_DEBUG | |
> printf("ControlJoysticEscape SDL_SCANCODE_F9 - SDL_KEYUP"); | |
> #endif | |
> myEvent.key.keysym.scancode = SDL_SCANCODE_F9; | |
> myEvent.key.keysym.sym = SDLK_F9; | |
> break; | |
> case MY_SDLK_WORLD_1: | |
> #ifdef CONFIG_DEBUG | |
> printf("ControlJoysticEscape SDL_SCANCODE_F10 - SDL_KEYUP"); | |
> #endif | |
> myEvent.key.keysym.scancode = SDL_SCANCODE_F10; | |
> myEvent.key.keysym.sym = SDLK_F10; | |
> break; | |
> } | |
> | |
> // make ESC-key/Open-key/Reset-key up event | |
> myEvent.type = myEvent.key.type = SDL_KEYUP; | |
> myEvent.key.timestamp = arg_pEvent->key.timestamp; | |
> myEvent.key.windowID = 1; | |
> myEvent.key.state = 0; | |
> myEvent.key.repeat = 0; | |
> myEvent.key.keysym.mod = 0; | |
> | |
> SDL_PushEvent(&myEvent); | |
> } | |
> break; | |
> case 2: | |
> if((arg_pEvent->jbutton.button + MY_SDLK_WORLD_0) == MY_SDLK_WORLD_8) { | |
> // "select" key event | |
> switch (arg_pEvent->type) { | |
> case SDL_JOYBUTTONDOWN: | |
> bIsCurrentSelectButtonDown = true; | |
> break; | |
> case SDL_JOYBUTTONUP: | |
> bIsCurrentSelectButtonDown = false; | |
> break; | |
> } | |
> | |
> } else if(((arg_pEvent->jbutton.button + MY_SDLK_WORLD_0) == MY_SDLK_WORLD_0)) { | |
> // "tryangle" key event | |
> switch (arg_pEvent->type) { | |
> case SDL_JOYBUTTONDOWN: | |
> bIsCurrentStartButtonDown = true; | |
> break; | |
> case SDL_JOYBUTTONUP: | |
> bIsCurrentStartButtonDown = false; | |
> break; | |
> } | |
> } | |
> | |
> if(!((bIsFormerSelectButtonDown == true) && (bIsFormerStartButtonDown == true)) | |
> && | |
> ((bIsCurrentSelectButtonDown == true) && (bIsCurrentStartButtonDown == true))) { | |
> myEvent.key.keysym.scancode = SDL_SCANCODE_ESCAPE; | |
> myEvent.key.keysym.sym = SDLK_ESCAPE; | |
> myEvent.type = myEvent.key.type = SDL_KEYDOWN; | |
> myEvent.key.timestamp = arg_pEvent->key.timestamp; | |
> myEvent.key.windowID = 1; | |
> myEvent.key.state = 1; | |
> myEvent.key.repeat = 0; | |
> myEvent.key.keysym.mod = 0; | |
> | |
> SDL_PushEvent(&myEvent); | |
> | |
> } else if(((bIsFormerSelectButtonDown == true) && (bIsFormerStartButtonDown == true)) | |
> && | |
> !((bIsCurrentSelectButtonDown == true) && (bIsCurrentStartButtonDown == true))) { | |
> myEvent.key.keysym.scancode = SDL_SCANCODE_ESCAPE; | |
> myEvent.key.keysym.sym = SDLK_ESCAPE; | |
> | |
> // make ESC-key/Open-key/Reset-key up event | |
> myEvent.type = myEvent.key.type = SDL_KEYUP; | |
> myEvent.key.timestamp = arg_pEvent->key.timestamp; | |
> myEvent.key.windowID = 1; | |
> myEvent.key.state = 0; | |
> myEvent.key.repeat = 0; | |
> myEvent.key.keysym.mod = 0; | |
> | |
> SDL_PushEvent(&myEvent); | |
> } | |
> default: | |
> break; | |
> } | |
> } | |
> } | |
> | |
> #endif | |
> #if SDL_MAJOR_VERSION == 1 | |
326a1010 | |
> #endif | |
330a1015,1018 | |
> #ifdef CONFIG_DEBUG | |
> static int cnt=0; | |
> #endif | |
> #if SDL_MAJOR_VERSION == 1 | |
331a1020,1060 | |
> #else | |
> static int checkjoy0=0; | |
> int i=0, eventcnt=0; | |
> Uint32 minType; | |
> Uint32 maxType; | |
> eventcnt = SDL_PeepEvents(events, | |
> sizeof(events) / sizeof(events[0]), | |
> SDL_GETEVENT, | |
> SDL_JOYDEVICEADDED, | |
> SDL_JOYDEVICEREMOVED); | |
> if(eventcnt) { | |
> #ifdef CONFIG_DEBUG | |
> printf("eventcnt : %d\n", eventcnt); | |
> printf("events->type : 0x%x\n", events->type); | |
> printf("jdevice.which : %d\n", events->jdevice.which); | |
> #endif | |
> int check = 0; | |
> for(i=0; i < eventcnt; i++) { | |
> check = bIsValidHotPlugEvent(&events[i]); | |
> if(check) { | |
> in_probe(); | |
> } | |
> } | |
> SDL_PumpEvents(); | |
> SDL_FlushEvents(SDL_FIRSTEVENT, SDL_LASTEVENT); | |
> fflush(stdout); | |
> if (check) { | |
> // SDL_JOYDEVICEADDED or SDL_JOYDEVICEREMOVED イベントあり | |
> // デバイス情報領域が再確保 | |
> return -1; | |
> } else { | |
> for (i = 0; i < SDLK_LAST / KEYBITS_WORD_BITS + 1; i++) { | |
> if(state == NULL) | |
> break; | |
> state->keystate[i] = 0; | |
> } | |
> return 0; | |
> } | |
> } | |
> | |
> #endif | |
333c1062 | |
< int i, ret, retval = 0; | |
--- | |
> int ret, retval = 0; | |
340a1070,1087 | |
> #if SDL_MAJOR_VERSION == 2 | |
> minType = SDL_KEYDOWN; | |
> maxType = SDL_KEYUP; | |
> if(state->joy) { | |
> minType = SDL_JOYAXISMOTION; | |
> maxType = SDL_JOYDEVICEREMOVED; | |
> } | |
> num_events = SDL_PeepEvents(NULL, | |
> 0, | |
> SDL_PEEKEVENT, | |
> minType, | |
> maxType); | |
> #ifdef CONFIG_DEBUG | |
> if(num_events) { | |
> printf("%s:%d %d joy=%p num_events=%d\n",__func__,__LINE__,++cnt,state->joy,num_events); | |
> } | |
> #endif | |
> #else | |
341a1089 | |
> #endif | |
343a1092,1098 | |
> #if SDL_MAJOR_VERSION == 2 | |
> count = SDL_PeepEvents(events, | |
> maxcount, | |
> SDL_GETEVENT, | |
> minType, | |
> maxType); | |
> #else | |
344a1100 | |
> #endif | |
348a1105,1165 | |
> #if SDL_MAJOR_VERSION == 2 | |
> ControlJoysticEscape(state, event); | |
> | |
> if (state->joy) | |
> ret = handle_joy_event(state, | |
> event, one_kc, one_down); | |
> else { | |
> #ifdef CONFIG_DEBUG | |
> printf("%s:%d type=0x%x key.type=0x%x timestamp=%d windowID=%d state=%d repeat=%d keysym.scancode=%d keysym.sym=%d keysym.mod=%d\n", | |
> __func__, | |
> __LINE__, | |
> event->type, | |
> event->key.type, | |
> event->key.timestamp, | |
> event->key.windowID, | |
> event->key.state, | |
> event->key.repeat, | |
> event->key.keysym.scancode, | |
> event->key.keysym.sym, | |
> event->key.keysym.mod); | |
> #endif | |
> event->key.keysym.sym = func_SDLK_TO_MY_SDLK(event->key.keysym.sym); | |
> ret = handle_event(state, | |
> event, one_kc, one_down); | |
> } | |
> #ifdef CONFIG_DEBUG | |
> if(one_kc) { | |
> printf("%s:%d i=%d type(SDL_KEYDOWN or SDL_KEYUP)=0x%x timestamp=%d windowID=%d state(SDL_PRESSED or SDL_RELEASED)=%d repeat=%d one_key=0x%x(%d) scancode=0x%x(%d) sym=0x%x(%d) mod=%d\n" , | |
> __func__, | |
> __LINE__, | |
> i, | |
> (event->key).type, /* Uint32 */ | |
> (event->key).timestamp, /* Uint32 */ | |
> (event->key).windowID, /* Uint32 */ | |
> (event->key).state, /* Uint8 */ | |
> (event->key).repeat, /* Uint8 */ | |
> *one_kc, | |
> *one_kc, | |
> (event->key).keysym.scancode, /* enum */ | |
> (event->key).keysym.scancode, /* enum */ | |
> (event->key).keysym.sym, /* int32 */ | |
> (event->key).keysym.sym, /* int32 */ | |
> (event->key).keysym.mod); /* Uint16 */ | |
> } else { | |
> printf("%s:%d i=%d type(SDL_KEYDOWN or SDL_KEYUP)=0x%x timestamp=%d windowID=%d state(SDL_PRESSED or SDL_RELEASED)=%d repeat=%d scancode=0x%x(%d) sym=0x%x(%d) mod=%d\n" , | |
> __func__, | |
> __LINE__, | |
> i, | |
> (event->key).type, /* Uint32 */ | |
> (event->key).timestamp, /* Uint32 */ | |
> (event->key).windowID, /* Uint32 */ | |
> (event->key).state, /* Uint8 */ | |
> (event->key).repeat, /* Uint8 */ | |
> (event->key).keysym.scancode, /* enum */ | |
> (event->key).keysym.scancode, /* enum */ | |
> (event->key).keysym.sym, /* int32 */ | |
> (event->key).keysym.sym, /* int32 */ | |
> (event->key).keysym.mod); /* Uint16 */ | |
> } | |
> #endif // #ifdef CONFIG_DEBUG | |
> #else // #if SDL_MAJOR_VERSION == 2 | |
354a1172 | |
> #endif // #if SDL_MAJOR_VERSION == 2 | |
389c1207,1208 | |
< collect_events(state, NULL, NULL); | |
--- | |
> if (collect_events(state, NULL, NULL) < 0) | |
> return 0; | |
diff --new-file -w -r pcsx_rearmed/frontend/libpicofe/keysym.h pcsx_rearmed_custom/frontend/libpicofe/keysym.h | |
0a1,286 | |
> #ifndef _keysym_h | |
> #define _keysym_h | |
> | |
> #include <SDL.h> | |
> #if SDL_MAJOR_VERSION == 2 | |
> typedef enum { | |
> MY_SDLK_UNKNOWN = 0, | |
> | |
> MY_SDLK_RETURN, | |
> MY_SDLK_ESCAPE, | |
> MY_SDLK_BACKSPACE, | |
> MY_SDLK_TAB, | |
> MY_SDLK_SPACE, | |
> MY_SDLK_EXCLAIM, | |
> MY_SDLK_QUOTEDBL, | |
> MY_SDLK_HASH, | |
> MY_SDLK_PERCENT, | |
> MY_SDLK_DOLLAR, | |
> MY_SDLK_AMPERSAND, | |
> MY_SDLK_QUOTE, | |
> MY_SDLK_LEFTPAREN, | |
> MY_SDLK_RIGHTPAREN, | |
> MY_SDLK_ASTERISK, | |
> MY_SDLK_PLUS, | |
> MY_SDLK_COMMA, | |
> MY_SDLK_MINUS, | |
> MY_SDLK_PERIOD, | |
> MY_SDLK_SLASH, | |
> MY_SDLK_0, | |
> MY_SDLK_1, | |
> MY_SDLK_2, | |
> MY_SDLK_3, | |
> MY_SDLK_4, | |
> MY_SDLK_5, | |
> MY_SDLK_6, | |
> MY_SDLK_7, | |
> MY_SDLK_8, | |
> MY_SDLK_9, | |
> MY_SDLK_COLON, | |
> MY_SDLK_SEMICOLON, | |
> MY_SDLK_LESS, | |
> MY_SDLK_EQUALS, | |
> MY_SDLK_GREATER, | |
> MY_SDLK_QUESTION, | |
> MY_SDLK_AT, | |
> /* | |
> Skip uppercase letters | |
> */ | |
> MY_SDLK_LEFTBRACKET, | |
> MY_SDLK_BACKSLASH, | |
> MY_SDLK_RIGHTBRACKET, | |
> MY_SDLK_CARET, | |
> MY_SDLK_UNDERSCORE, | |
> MY_SDLK_BACKQUOTE, | |
> MY_SDLK_a, | |
> MY_SDLK_b, | |
> MY_SDLK_c, | |
> MY_SDLK_d, | |
> MY_SDLK_e, | |
> MY_SDLK_f, | |
> MY_SDLK_g, | |
> MY_SDLK_h, | |
> MY_SDLK_i, | |
> MY_SDLK_j, | |
> MY_SDLK_k, | |
> MY_SDLK_l, | |
> MY_SDLK_m, | |
> MY_SDLK_n, | |
> MY_SDLK_o, | |
> MY_SDLK_p, | |
> MY_SDLK_q, | |
> MY_SDLK_r, | |
> MY_SDLK_s, | |
> MY_SDLK_t, | |
> MY_SDLK_u, | |
> MY_SDLK_v, | |
> MY_SDLK_w, | |
> MY_SDLK_x, | |
> MY_SDLK_y, | |
> MY_SDLK_z, | |
> | |
> MY_SDLK_CAPSLOCK, | |
> | |
> MY_SDLK_F1, | |
> MY_SDLK_F2, | |
> MY_SDLK_F3, | |
> MY_SDLK_F4, | |
> MY_SDLK_F5, | |
> MY_SDLK_F6, | |
> MY_SDLK_F7, | |
> MY_SDLK_F8, | |
> MY_SDLK_F9, | |
> MY_SDLK_F10, | |
> MY_SDLK_F11, | |
> MY_SDLK_F12, | |
> | |
> MY_SDLK_PRINTSCREEN, | |
> MY_SDLK_SCROLLLOCK, | |
> MY_SDLK_PAUSE, | |
> MY_SDLK_INSERT, | |
> MY_SDLK_HOME, | |
> MY_SDLK_PAGEUP, | |
> MY_SDLK_DELETE, | |
> MY_SDLK_END, | |
> MY_SDLK_PAGEDOWN, | |
> MY_SDLK_RIGHT, | |
> MY_SDLK_LEFT, | |
> MY_SDLK_DOWN, | |
> MY_SDLK_UP, | |
> | |
> MY_SDLK_NUMLOCKCLEAR, | |
> MY_SDLK_KP_DIVIDE, | |
> MY_SDLK_KP_MULTIPLY, | |
> MY_SDLK_KP_MINUS, | |
> MY_SDLK_KP_PLUS, | |
> MY_SDLK_KP_ENTER, | |
> MY_SDLK_KP_1, | |
> MY_SDLK_KP_2, | |
> MY_SDLK_KP_3, | |
> MY_SDLK_KP_4, | |
> MY_SDLK_KP_5, | |
> MY_SDLK_KP_6, | |
> MY_SDLK_KP_7, | |
> MY_SDLK_KP_8, | |
> MY_SDLK_KP_9, | |
> MY_SDLK_KP_0, | |
> MY_SDLK_KP_PERIOD, | |
> | |
> MY_SDLK_APPLICATION, | |
> MY_SDLK_POWER, | |
> MY_SDLK_KP_EQUALS, | |
> MY_SDLK_F13, | |
> MY_SDLK_F14, | |
> MY_SDLK_F15, | |
> MY_SDLK_F16, | |
> MY_SDLK_F17, | |
> MY_SDLK_F18, | |
> MY_SDLK_F19, | |
> MY_SDLK_F20, | |
> MY_SDLK_F21, | |
> MY_SDLK_F22, | |
> MY_SDLK_F23, | |
> MY_SDLK_F24, | |
> MY_SDLK_EXECUTE, | |
> MY_SDLK_HELP, | |
> MY_SDLK_MENU, | |
> MY_SDLK_SELECT, | |
> MY_SDLK_STOP, | |
> MY_SDLK_AGAIN, | |
> MY_SDLK_UNDO, | |
> MY_SDLK_CUT, | |
> MY_SDLK_COPY, | |
> MY_SDLK_PASTE, | |
> MY_SDLK_FIND, | |
> MY_SDLK_MUTE, | |
> MY_SDLK_VOLUMEUP, | |
> MY_SDLK_VOLUMEDOWN, | |
> MY_SDLK_KP_COMMA, | |
> MY_SDLK_KP_EQUALSAS400, | |
> | |
> MY_SDLK_ALTERASE, | |
> MY_SDLK_SYSREQ, | |
> MY_SDLK_CANCEL, | |
> MY_SDLK_CLEAR, | |
> MY_SDLK_PRIOR, | |
> MY_SDLK_RETURN2, | |
> MY_SDLK_SEPARATOR, | |
> MY_SDLK_OUT, | |
> MY_SDLK_OPER, | |
> MY_SDLK_CLEARAGAIN, | |
> MY_SDLK_CRSEL, | |
> MY_SDLK_EXSEL, | |
> | |
> MY_SDLK_KP_00, | |
> MY_SDLK_KP_000, | |
> MY_SDLK_THOUSANDSSEPARATOR, | |
> MY_SDLK_DECIMALSEPARATOR, | |
> MY_SDLK_CURRENCYUNIT, | |
> MY_SDLK_CURRENCYSUBUNIT, | |
> MY_SDLK_KP_LEFTPAREN, | |
> MY_SDLK_KP_RIGHTPAREN, | |
> MY_SDLK_KP_LEFTBRACE, | |
> MY_SDLK_KP_RIGHTBRACE, | |
> MY_SDLK_KP_TAB, | |
> MY_SDLK_KP_BACKSPACE, | |
> MY_SDLK_KP_A, | |
> MY_SDLK_KP_B, | |
> MY_SDLK_KP_C, | |
> MY_SDLK_KP_D, | |
> MY_SDLK_KP_E, | |
> MY_SDLK_KP_F, | |
> MY_SDLK_KP_XOR, | |
> MY_SDLK_KP_POWER, | |
> MY_SDLK_KP_PERCENT, | |
> MY_SDLK_KP_LESS, | |
> MY_SDLK_KP_GREATER, | |
> MY_SDLK_KP_AMPERSAND, | |
> MY_SDLK_KP_DBLAMPERSAND, | |
> MY_SDLK_KP_VERTICALBAR, | |
> MY_SDLK_KP_DBLVERTICALBAR, | |
> MY_SDLK_KP_COLON, | |
> MY_SDLK_KP_HASH, | |
> MY_SDLK_KP_SPACE, | |
> MY_SDLK_KP_AT, | |
> MY_SDLK_KP_EXCLAM, | |
> MY_SDLK_KP_MEMSTORE, | |
> MY_SDLK_KP_MEMRECALL, | |
> MY_SDLK_KP_MEMCLEAR, | |
> MY_SDLK_KP_MEMADD, | |
> MY_SDLK_KP_MEMSUBTRACT, | |
> MY_SDLK_KP_MEMMULTIPLY, | |
> MY_SDLK_KP_MEMDIVIDE, | |
> MY_SDLK_KP_PLUSMINUS, | |
> MY_SDLK_KP_CLEAR, | |
> MY_SDLK_KP_CLEARENTRY, | |
> MY_SDLK_KP_BINARY, | |
> MY_SDLK_KP_OCTAL, | |
> MY_SDLK_KP_DECIMAL, | |
> MY_SDLK_KP_HEXADECIMAL, | |
> | |
> MY_SDLK_LCTRL, | |
> MY_SDLK_LSHIFT, | |
> MY_SDLK_LALT, | |
> MY_SDLK_LGUI, | |
> MY_SDLK_RCTRL, | |
> MY_SDLK_RSHIFT, | |
> MY_SDLK_RALT, | |
> MY_SDLK_RGUI, | |
> | |
> MY_SDLK_MODE, | |
> | |
> MY_SDLK_AUDIONEXT, | |
> MY_SDLK_AUDIOPREV, | |
> MY_SDLK_AUDIOSTOP, | |
> MY_SDLK_AUDIOPLAY, | |
> MY_SDLK_AUDIOMUTE, | |
> MY_SDLK_MEDIASELECT, | |
> MY_SDLK_WWW, | |
> MY_SDLK_MAIL, | |
> MY_SDLK_CALCULATOR, | |
> MY_SDLK_COMPUTER, | |
> MY_SDLK_AC_SEARCH, | |
> MY_SDLK_AC_HOME, | |
> MY_SDLK_AC_BACK, | |
> MY_SDLK_AC_FORWARD, | |
> MY_SDLK_AC_STOP, | |
> MY_SDLK_AC_REFRESH, | |
> MY_SDLK_AC_BOOKMARKS, | |
> | |
> MY_SDLK_BRIGHTNESSDOWN, | |
> MY_SDLK_BRIGHTNESSUP, | |
> MY_SDLK_DISPLAYSWITCH, | |
> MY_SDLK_KBDILLUMTOGGLE, | |
> MY_SDLK_KBDILLUMDOWN, | |
> MY_SDLK_KBDILLUMUP, | |
> MY_SDLK_EJECT, | |
> MY_SDLK_SLEEP, | |
> MY_SDLK_APP1, | |
> MY_SDLK_APP2, | |
> | |
> MY_SDLK_AUDIOREWIND, | |
> MY_SDLK_AUDIOFASTFORWARD, | |
> | |
> MY_SDLK_WORLD_0, | |
> MY_SDLK_WORLD_1, | |
> MY_SDLK_WORLD_2, | |
> MY_SDLK_WORLD_3, | |
> MY_SDLK_WORLD_4, | |
> MY_SDLK_WORLD_5, | |
> MY_SDLK_WORLD_6, | |
> MY_SDLK_WORLD_7, | |
> MY_SDLK_WORLD_8, | |
> MY_SDLK_WORLD_9, | |
> | |
> MY_SDLK_LAST, | |
> SDLK_LAST = MY_SDLK_LAST | |
> } MySDLKey; | |
> | |
> typedef struct { | |
> int m_SDLK; | |
> int m_MySDLK; | |
> } SDLK_to_MY_SDLK; | |
> | |
> #endif // #if SDL_MAJOR_VERSION == 2 | |
> | |
> #endif // #ifndef _keysym_h | |
diff --new-file -w -r pcsx_rearmed/frontend/libpicofe/menu.c pcsx_rearmed_custom/frontend/libpicofe/menu.c | |
26a27,28 | |
> #define DISK_IMG_DIR "/usr/sony/share/data/images/Disk/" | |
> | |
358,359c360 | |
< unsigned int p = *sorc++; | |
< *dest++ = (p&0xf79ef79e)>>1; | |
--- | |
> *dest++ = *sorc++; | |
437a439,457 | |
> void show_text_image(const char *lang_image_path, const char *ok_image_path) | |
> { | |
> char buff[128]; | |
> int msg_x = 115, msg_y = 110; | |
> int btn_x = 280, btn_y = 353; | |
> int ok_x = 258, ok_y = 380; | |
> | |
> menu_draw_begin(1, 1); | |
> | |
> readpng(g_menuscreen_ptr + (msg_x + msg_y * g_menuscreen_w) * 2, lang_image_path, READPNG_BG, g_menuscreen_w, g_menuscreen_h); | |
> | |
> sprintf(buff, "%s%s", DISK_IMG_DIR, "Ball_Btn_SD.png"); | |
> readpng(g_menuscreen_ptr + (btn_x + btn_y * g_menuscreen_w) * 2, buff, READPNG_BG, g_menuscreen_w, g_menuscreen_h); | |
> | |
> readpng(g_menuscreen_ptr + (ok_x + ok_y * g_menuscreen_w) * 2, ok_image_path, READPNG_BG, g_menuscreen_w, g_menuscreen_h); | |
> | |
> menu_draw_end(); | |
> } | |
> | |
859c879 | |
< int n, int sel, int show_help) | |
--- | |
> int n, int sel, int show_help, int curr_sel, int sel_min) | |
874,875c894,895 | |
< darken_ptr = (short *)g_menuscreen_ptr + g_menuscreen_w * max_cnt/2 * me_sfont_h; | |
< menu_darken_bg(darken_ptr, darken_ptr, g_menuscreen_w * me_sfont_h * 8 / 10, 0); | |
--- | |
> // darken_ptr = (short *)g_menuscreen_ptr + g_menuscreen_w * max_cnt/2 * me_sfont_h; | |
> // menu_darken_bg(darken_ptr, darken_ptr, g_menuscreen_w * me_sfont_h * 8 / 10, 0); | |
879c899 | |
< smalltext_out16(14, (start - 2) * me_sfont_h, curdir, 0xffff); | |
--- | |
> // smalltext_out16(14, (start - 2) * me_sfont_h, curdir, 0xffff); | |
885,886c905,906 | |
< smalltext_out16(x, pos * me_sfont_h, "/", 0xfff6); | |
< smalltext_out16(x + me_sfont_w, pos * me_sfont_h, namelist[i+1]->d_name, 0xfff6); | |
--- | |
> // smalltext_out16(x, pos * me_sfont_h, "/", 0xfff6); | |
> // smalltext_out16(x + me_sfont_w, pos * me_sfont_h, namelist[i+1]->d_name, 0xfff6); | |
889c909 | |
< smalltext_out16(x, pos * me_sfont_h, namelist[i+1]->d_name, color); | |
--- | |
> // smalltext_out16(x, pos * me_sfont_h, namelist[i+1]->d_name, color); | |
892c912 | |
< smalltext_out16(5, max_cnt/2 * me_sfont_h, ">", 0xffff); | |
--- | |
> // smalltext_out16(5, max_cnt/2 * me_sfont_h, ">", 0xffff); | |
895,898c915,918 | |
< darken_ptr = (short *)g_menuscreen_ptr | |
< + g_menuscreen_w * (g_menuscreen_h - me_sfont_h * 5 / 2); | |
< menu_darken_bg(darken_ptr, darken_ptr, | |
< g_menuscreen_w * (me_sfont_h * 5 / 2), 1); | |
--- | |
> // darken_ptr = (short *)g_menuscreen_ptr | |
> // + g_menuscreen_w * (g_menuscreen_h - me_sfont_h * 5 / 2); | |
> // menu_darken_bg(darken_ptr, darken_ptr, | |
> // g_menuscreen_w * (me_sfont_h * 5 / 2), 1); | |
902c922 | |
< smalltext_out16(x, g_menuscreen_h - me_sfont_h * 3 - 2, buff, 0xe78c); | |
--- | |
> // smalltext_out16(x, g_menuscreen_h - me_sfont_h * 3 - 2, buff, 0xe78c); | |
907c927 | |
< smalltext_out16(x, g_menuscreen_h - me_sfont_h * 2 - 2, buff, 0xe78c); | |
--- | |
> // smalltext_out16(x, g_menuscreen_h - me_sfont_h * 2 - 2, buff, 0xe78c); | |
912c932,991 | |
< smalltext_out16(x, g_menuscreen_h - me_sfont_h * 1 - 2, buff, 0xe78c); | |
--- | |
> // smalltext_out16(x, g_menuscreen_h - me_sfont_h * 1 - 2, buff, 0xe78c); | |
> } | |
> int disc_num = n - 1; | |
> int skin_dir; | |
> | |
> // show paths of current directory and focused file | |
> if (sel_min == 0 || disc_num > 4) { | |
> smalltext_out16(x, me_sfont_h, curdir, 0xffff); | |
> if (disc_num > 0) { | |
> smalltext_out16(x, me_sfont_h * 3, namelist[sel+1]->d_name, 0xffff); | |
> } | |
> } | |
> else if (disc_num > 0) { | |
> int disc_img_w = 98; | |
> int disc_img_interval = 12; | |
> int num_img_offset = 39; | |
> int disc_img_y = 213; | |
> int num_img_y = 301; | |
> int msg_img_x = 106; | |
> int msg_img_y = 152; | |
> int disc_img_start = g_menuscreen_w - disc_img_w - (disc_img_w+disc_img_interval) * (disc_num-1) + disc_img_y * g_menuscreen_w * 2; | |
> int num_img_start = disc_img_start + num_img_offset * 2 + (num_img_y-disc_img_y) * g_menuscreen_w * 2; | |
> char num_one[] = "Text_one.png"; | |
> char num_two[] = "Text_two.png"; | |
> char num_three[] = "Text_three.png"; | |
> char num_four[] = "Text_four.png"; | |
> char *num_image[4] = {num_one, num_two, num_three, num_four}; | |
> | |
> // disc_img_start must be even | |
> if (disc_img_start % 2) { | |
> disc_img_start--; | |
> } | |
> | |
> // show message of disc change | |
> readpng(g_menuscreen_ptr + (msg_img_x + msg_img_y * g_menuscreen_w) * 2, changedisc_message, READPNG_BG, g_menuscreen_w , g_menuscreen_h); | |
> | |
> // show normal disc images | |
> snprintf(buff, sizeof(buff), "%s%s", DISK_IMG_DIR, "Nomal_Disk.png"); | |
> for (i = 0; i < disc_num; i++) { | |
> readpng(g_menuscreen_ptr + disc_img_start + (disc_img_w+disc_img_interval) * 2 * i, buff, READPNG_BG, g_menuscreen_w , g_menuscreen_h); | |
> } | |
> | |
> // show current disc image | |
> snprintf(buff, sizeof(buff), "%s%s", DISK_IMG_DIR, "Corrent_Disk.png"); | |
> readpng(g_menuscreen_ptr + disc_img_start + (disc_img_w+disc_img_interval) * 2 * (curr_sel-1), buff, READPNG_BG, g_menuscreen_w , g_menuscreen_h); | |
> | |
> // show numbers | |
> for (i = 0; i < disc_num; i++) { | |
> snprintf(buff, sizeof(buff), "%s%s", DISK_IMG_DIR, num_image[i]); | |
> readpng(g_menuscreen_ptr + num_img_start + (disc_img_w+disc_img_interval) * 2 * i, buff, READPNG_BG, g_menuscreen_w , g_menuscreen_h); | |
> } | |
> | |
> // show forcus | |
> if (sel > 0) { | |
> snprintf(buff, sizeof(buff), "%s%s", DISK_IMG_DIR, "Select_Disk.png"); | |
> readpng(g_menuscreen_ptr + disc_img_start + (disc_img_w+disc_img_interval) * 2 * (sel-1), buff, READPNG_BG, g_menuscreen_w , g_menuscreen_h); | |
> } | |
> } | |
> else { | |
> smalltext_out16(x, me_sfont_h * 3, "..", 0xffff); | |
985c1064 | |
< const char *basedir)) | |
--- | |
> const char *basedir), int sel_min) | |
1075c1154,1155 | |
< sel = 0; | |
--- | |
> // sel = 0; | |
> sel = sel_min; | |
1087,1089c1167 | |
< draw_dirlist(curr_path, namelist, n, sel, show_help); | |
< while (in_menu_wait_any(NULL, 50) & (PBTN_MOK|PBTN_MBACK|PBTN_MENU)) | |
< ; | |
--- | |
> int curr_sel = sel; | |
1091c1169,1183 | |
< for (;;) | |
--- | |
> // focus next disc image | |
> if (sel_min) { | |
> if (++sel > n-2) { | |
> sel = sel_min; | |
> } | |
> } | |
> | |
> draw_dirlist(curr_path, namelist, n, sel, show_help, curr_sel, sel_min); | |
> while (in_menu_wait_any(NULL, 50) & (PBTN_MOK|PBTN_MBACK|PBTN_MENU)) { | |
> if (power_off_flg) { | |
> break; | |
> } | |
> } | |
> | |
> while (!power_off_flg) | |
1093,1101c1185,1190 | |
< draw_dirlist(curr_path, namelist, n, sel, show_help); | |
< inp = in_menu_wait(PBTN_UP|PBTN_DOWN|PBTN_LEFT|PBTN_RIGHT | |
< | PBTN_L|PBTN_R|PBTN_MA2|PBTN_MA3|PBTN_MOK|PBTN_MBACK | |
< | PBTN_MENU|PBTN_CHAR, &cinp, 33); | |
< if (inp & PBTN_MA3) { | |
< g_menu_filter_off = !g_menu_filter_off; | |
< snprintf(sel_fname, sizeof(sel_fname), "%s", | |
< namelist[sel+1]->d_name); | |
< goto rescan; | |
--- | |
> draw_dirlist(curr_path, namelist, n, sel, show_help, curr_sel, sel_min); | |
> inp = in_menu_wait(PBTN_LEFT|PBTN_RIGHT|PBTN_MOK|PBTN_MBACK, &cinp, 33); | |
> /* wait until ok, back is released */ | |
> while (in_menu_wait_any(NULL, 50) & (PBTN_MOK|PBTN_MBACK)) { | |
> if (power_off_flg) { | |
> break; | |
1103,1108c1192,1194 | |
< if (inp & PBTN_UP ) { sel--; if (sel < 0) sel = n-2; } | |
< if (inp & PBTN_DOWN) { sel++; if (sel > n-2) sel = 0; } | |
< if (inp & PBTN_LEFT) { sel-=10; if (sel < 0) sel = 0; } | |
< if (inp & PBTN_L) { sel-=24; if (sel < 0) sel = 0; } | |
< if (inp & PBTN_RIGHT) { sel+=10; if (sel > n-2) sel = n-2; } | |
< if (inp & PBTN_R) { sel+=24; if (sel > n-2) sel = n-2; } | |
--- | |
> } | |
> if (inp == PBTN_LEFT) { sel--; if (sel < sel_min) sel = sel_min; } | |
> if (inp == PBTN_RIGHT) { sel++; if (sel > n-2) sel = n-2; } | |
1110c1196 | |
< if ((inp & PBTN_MOK) || (inp & (PBTN_MENU|PBTN_MA2)) == (PBTN_MENU|PBTN_MA2)) | |
--- | |
> if (inp == PBTN_MOK) | |
1111a1198,1201 | |
> if (sel == curr_sel && (isTitleName(PARASITE_EVE_DISC_1_JP) || isTitleName(PARASITE_EVE_DISC_2_JP) | |
> || isTitleName(PARASITE_EVE_DISC_1_US) || isTitleName(PARASITE_EVE_DISC_2_US))) { | |
> continue; | |
> } | |
1147c1237 | |
< ret = menu_loop_romsel(newdir, newlen, filter_exts, extra_filter); | |
--- | |
> ret = menu_loop_romsel(newdir, newlen, filter_exts, extra_filter, sel_min); | |
1152,1161c1242 | |
< else if (inp & PBTN_MA2) { | |
< g_autostateld_opt = !g_autostateld_opt; | |
< show_help = 3; | |
< } | |
< else if (inp & PBTN_CHAR) { | |
< // must be last | |
< sel = dirent_seek_char(namelist, n, sel, cinp); | |
< } | |
< | |
< if (inp & PBTN_MBACK) | |
--- | |
> if (inp == PBTN_MBACK) | |
diff --new-file -w -r pcsx_rearmed/frontend/libpicofe/menu.h pcsx_rearmed_custom/frontend/libpicofe/menu.h | |
125a126 | |
> void show_text_image(const char *lang_image_path, const char *ok_image_path); | |
diff --new-file -w -r pcsx_rearmed/frontend/libpicofe/plat.h pcsx_rearmed_custom/frontend/libpicofe/plat.h | |
96c96 | |
< void plat_video_menu_enter(int is_rom_loaded); | |
--- | |
> void plat_video_menu_enter(int is_rom_loaded, int bpp); | |
diff --new-file -w -r pcsx_rearmed/frontend/libpicofe/plat_sdl.c pcsx_rearmed_custom/frontend/libpicofe/plat_sdl.c | |
23a24,25 | |
> | |
> | |
24a27 | |
> #if SDL_MAJOR_VERSION == 1 | |
25a29 | |
> #endif | |
29a34,39 | |
> #if SDL_MAJOR_VERSION == 2 | |
> static const char *vid_drv_name; | |
> SDL_Window *sdl2_window; | |
> SDL_Renderer *sdl2_renderer; | |
> SDL_Texture *sdl2_texture; | |
> #else | |
30a41 | |
> #endif | |
36a48 | |
> int gl_works = 0; | |
42a55,59 | |
> if (w != prev_w || h != prev_h) { | |
> force = 1; | |
> } | |
> | |
> printf("plat_sdl_change_video_mode() start w=%d,h=%d,force=%d \n",w,h,force); | |
67c84 | |
< | |
--- | |
> #if SDL_MAJOR_VERSION == 1 | |
71a89 | |
> #endif | |
77a96 | |
> #if SDL_MAJOR_VERSION == 1 | |
78a98,101 | |
> #else | |
> Uint32 flags = SDL_WINDOW_OPENGL; | |
> //Uint32 flags = SDL_RESIZABLE | SDL_SWSURFACE; | |
> #endif | |
81c104,105 | |
< | |
--- | |
> printf("plat_sdl_change_video_mode() plat_target.vout_fullscreen=%d fs_w=%d,fs_h=%d\n",plat_target.vout_fullscreen,fs_w,fs_h); | |
> #if SDL_MAJOR_VERSION == 1 | |
87c111 | |
< | |
--- | |
> #endif | |
91a116,124 | |
> #if SDL_MAJOR_VERSION == 2 | |
> plat_sdl_screen = SDL_GetWindowSurface(sdl2_window); | |
> printf("002 plat_sdl_change_video_mode : SDL_GetWindowSurface() \n"); | |
> printf(" win_w=%d, win_h=%d flags=%d \n",win_w,win_h,flags); | |
> if (plat_sdl_screen == NULL) { | |
> fprintf(stderr, "002 plat_sdl_change_video_mode : SDL_GetWindowSurface failed: %s\n", SDL_GetError()); | |
> plat_target.vout_method = 0; | |
> } | |
> #else | |
92a126 | |
> | |
94c128 | |
< fprintf(stderr, "SDL_SetVideoMode failed: %s\n", SDL_GetError()); | |
--- | |
> fprintf(stderr, "002 plat_sdl_change_video_mode : SDL_SetVideoMode failed: %s\n", SDL_GetError()); | |
96a131 | |
> #endif | |
99a135 | |
> #if SDL_MAJOR_VERSION == 1 | |
110a147,149 | |
> #else | |
> plat_target.vout_method = 0; | |
> #endif | |
112a152 | |
> printf("plat_sdl_change_video_mode : gl_init()\n"); | |
115c155,156 | |
< fprintf(stderr, "warning: could not init GL.\n"); | |
--- | |
> printf(" \n"); | |
> fprintf(stderr, "warning: could not plat_sdl_change_video_mode : gl_init.\n"); | |
117a159,161 | |
> else { | |
> printf(" gl_init() success!\n"); | |
> } | |
121a166 | |
> #if SDL_MAJOR_VERSION == 2 | |
122a168,174 | |
> plat_sdl_screen = SDL_GetWindowSurface(sdl2_window); | |
> printf("001 plat_sdl_change_video_mode : SDL_GetWindowSurface() \n"); | |
> if (plat_sdl_screen == NULL) { | |
> fprintf(stderr, "001 SDL_GetWindowSurface failed: %s\n", SDL_GetError()); | |
> return -1; | |
> } | |
> #else | |
125c177 | |
< fprintf(stderr, "SDL_SetVideoMode failed: %s\n", SDL_GetError()); | |
--- | |
> fprintf(stderr, "001 plat_sdl_change_video_mode : SDL_SetVideoMode failed: %s\n", SDL_GetError()); | |
127a180,182 | |
> #endif | |
> | |
> | |
131c186 | |
< if (plat_sdl_resize_cb != NULL) | |
--- | |
> if (plat_sdl_resize_cb != NULL) { | |
132a188 | |
> } | |
133a190 | |
> printf("plat_sdl_change_video_mode() end\n"); | |
136a194,198 | |
> | |
> | |
> | |
> | |
> | |
141a204,205 | |
> printf("frontend/libpicofe/plat.sdl.c : plat_sdl_event_handler() %d\n",event->type); | |
> | |
142a207 | |
> #if SDL_MAJOR_VERSION == 1 | |
156a222 | |
> #if SDL_MAJOR_VERSION == 1 | |
157a224 | |
> #endif | |
169a237 | |
> #endif | |
176a245,260 | |
> | |
> | |
> | |
> | |
> | |
> | |
> | |
> | |
> | |
> #if SDL_MAJOR_VERSION == 2 | |
> void gl_setup_wl_information(struct wl_display * idisplay, | |
> struct wl_surface *isurface, | |
> struct wl_shell_surface *ishell_surface); | |
> | |
> int plat_sdl_init(int isGame) | |
> #else | |
177a262 | |
> #endif | |
178a264 | |
> printf("+ /frontend/libpicofe/plat_sdl_init()\n"); | |
179a266 | |
> #if SDL_MAJOR_VERSION == 1 | |
180a268 | |
> #endif | |
183c271 | |
< int gl_works = 0; | |
--- | |
> | |
185a274,281 | |
> #ifdef UI_INTEGRATION | |
> printf("SDL_Init() not used. for UI_INTEGRATION\n"); | |
> #else | |
> | |
> #if SDL_MAJOR_VERSION == 2 | |
> printf("plat_sdl_init() : SDL_Init(SDL_INIT_VIDEO), %d\n", SDL_INIT_VIDEO); | |
> ret = SDL_Init(SDL_INIT_VIDEO); | |
> #else | |
186a283 | |
> #endif | |
188c285 | |
< fprintf(stderr, "SDL_Init failed: %s\n", SDL_GetError()); | |
--- | |
> fprintf(stderr, "plat_sdl_init() : SDL_Init() failed: %s\n", SDL_GetError()); | |
191a289,331 | |
> #endif | |
> | |
> | |
> #if SDL_MAJOR_VERSION == 2 | |
> /* */ | |
> | |
> sdl2_window = SDL_CreateWindow("Title", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, 640, 480, SDL_WINDOW_FULLSCREEN_DESKTOP); | |
> | |
> | |
> | |
> if (sdl2_window == NULL) { | |
> printf("- /frontend/libpicofe/plat_sdl_init() : SDL_CreateWindow() Error %s\n",SDL_GetError()); | |
> return -1; | |
> } | |
> else { | |
> /* */ | |
> // SDL_SetWindowSize(sdl2_window,640,480); | |
> // printf("SDL_SetWindowSize()\n"); | |
> | |
> SDL_GetWindowSize(sdl2_window, &fs_w, &fs_h); | |
> printf("SDL_GetWindowSize w=%d,h=%d\n", fs_w, fs_h); | |
> } | |
> //sdl2_renderer = SDL_CreateRenderer(sdl2_window, -1, SDL_RENDERER_ACCELERATED); | |
> sdl2_renderer = SDL_CreateRenderer(sdl2_window, -1, SDL_RENDERER_SOFTWARE); | |
> if (sdl2_renderer == NULL) { | |
> printf("- /frontend/libpicofe/plat_sdl_init() SDL_CreateRenderer Error %s\n",SDL_GetError()); | |
> return -1; | |
> } | |
> else { | |
> printf("plat_sdl_init() : SDL_CreateRenderer() Success.\n"); | |
> } | |
> SDL_RenderSetLogicalSize(sdl2_renderer, 640, 480); | |
> | |
> /* */ | |
> sdl2_texture = SDL_CreateTexture(sdl2_renderer,SDL_PIXELFORMAT_RGBA8888,SDL_TEXTUREACCESS_TARGET,fs_w, fs_h); | |
> if (sdl2_texture == NULL) { | |
> printf("SDL_CreateTexture() Error %s\n",SDL_GetError()); | |
> return -1; | |
> } | |
> else { | |
> printf("plat_sdl_init() : SDL_CreateTexture Success.\n"); | |
> } | |
> #else | |
198c338 | |
< | |
--- | |
> #endif | |
204a345,348 | |
> #if SDL_MAJOR_VERSION == 2 | |
> if (sdl2_window && h > WM_DECORATION_H) | |
> h -= WM_DECORATION_H; | |
> #else | |
206a351 | |
> #endif | |
210a356 | |
> /***************************************************/ | |
212a359,372 | |
> #if SDL_MAJOR_VERSION == 2 | |
> plat_sdl_screen = SDL_GetWindowSurface(sdl2_window); | |
> printf("002 plat_sdl_init : SDL_GetWindowSurface() \n"); | |
> printf(" plat_sdl_screen->w=%d,plat_sdl_screen->h=%d\n",plat_sdl_screen->w,plat_sdl_screen->h); | |
> if (plat_sdl_screen == NULL) { | |
> fprintf(stderr, "002 plat_sdl_init : SDL_GetWindowSurface() failed: %s\n", SDL_GetError()); | |
> goto fail; | |
> } | |
> if (plat_sdl_screen->w < 320 || plat_sdl_screen->h < 240) { | |
> fprintf(stderr, "resolution %dx%d is too small, sorry.\n", | |
> plat_sdl_screen->w, plat_sdl_screen->h); | |
> goto fail; | |
> } | |
> #else | |
213a374 | |
> | |
215c376 | |
< fprintf(stderr, "SDL_SetVideoMode failed: %s\n", SDL_GetError()); | |
--- | |
> fprintf(stderr, "002 plat_sdl_init : SDL_SetVideoMode failed: %s\n", SDL_GetError()); | |
223a385 | |
> #endif | |
225,226c387,423 | |
< g_menuscreen_w = window_w = plat_sdl_screen->w; | |
< g_menuscreen_h = window_h = plat_sdl_screen->h; | |
--- | |
> | |
> #if SDL_MAJOR_VERSION == 2 | |
> | |
> #if 1 | |
> // SDL_SetWindowSize(sdl2_window,640,480); | |
> // printf("SDL_SetWindowSize()\n"); | |
> SDL_GetWindowSize(sdl2_window,&plat_sdl_screen->w,&plat_sdl_screen->h); | |
> #endif | |
> | |
> printf(" plat_sdl_screen->w=%d,plat_sdl_screen->h=%d\n",plat_sdl_screen->w,plat_sdl_screen->h); | |
> | |
> | |
> SDL_GetWindowSize(sdl2_window,&window_w,&window_h); | |
> printf("SDL_GetWindowSize() window_w=%d,window_h=%d\n",window_w,window_h); | |
> | |
> //#ifdef SDL2_0_DEBUG | |
> // g_menuscreen_w = window_w = plat_sdl_screen->w * 2; | |
> // g_menuscreen_h = window_h = plat_sdl_screen->h; | |
> //#else | |
> // | |
> //#if 0 | |
> // g_menuscreen_w = window_w = 640; | |
> // g_menuscreen_h = window_h = 480; | |
> //#else | |
> // g_menuscreen_w = window_w = plat_sdl_screen->w; | |
> // g_menuscreen_h = window_h = plat_sdl_screen->h; | |
> //#endif | |
> // | |
> //#endif | |
> | |
> #else | |
> // g_menuscreen_w = window_w = plat_sdl_screen->w; | |
> // g_menuscreen_h = window_h = plat_sdl_screen->h; | |
> g_menuscreen_w = 640; | |
> g_menuscreen_h = 480; | |
> #endif | |
> | |
228a426,433 | |
> #if SDL_MAJOR_VERSION == 2 | |
> plat_sdl_screen = SDL_GetWindowSurface(sdl2_window); | |
> printf("003 plat_sdl_init : SDL_GetWindowSurface() \n"); | |
> if (plat_sdl_screen == NULL) { | |
> fprintf(stderr, "003 plat_sdl_init : SDL_GetWindowSurface() failed: %s\n", SDL_GetError()); | |
> goto fail; | |
> } | |
> #else | |
230a436 | |
> | |
232c438 | |
< fprintf(stderr, "SDL_SetVideoMode failed: %s\n", SDL_GetError()); | |
--- | |
> fprintf(stderr, "003 SDL_SetVideoMode failed: %s\n", SDL_GetError()); | |
234a441 | |
> #endif | |
235a443,444 | |
> #if SDL_MAJOR_VERSION == 1 | |
> /****************************************************************************/ | |
252a462 | |
> #endif | |
254a465,468 | |
> #if SDL_MAJOR_VERSION == 2 | |
> vid_drv_name = SDL_GetCurrentVideoDriver(); | |
> printf("plat_sdl_init : SDL_GetCurrentVideoDriver() vid_drv_name=%s\n",vid_drv_name); | |
> #else | |
255a470,471 | |
> #endif | |
> | |
258a475,477 | |
> #if SDL_MAJOR_VERSION == 2 | |
> ret = SDL_GetWindowWMInfo(sdl2_window,&wminfo); | |
> #else | |
259a479 | |
> #endif | |
265a486,487 | |
> | |
> #if 1 | |
266a489,495 | |
> ret = SDL_GetWindowWMInfo(sdl2_window, &wminfo); | |
> if (ret > 0) { | |
> gl_setup_wl_information(wminfo.info.wl.display, wminfo.info.wl.surface, wminfo.info.wl.shell_surface); | |
> | |
> printf("wminfo: 0x%x, 0x%x, 0x%x\n", | |
> wminfo.info.wl.display, wminfo.info.wl.surface, wminfo.info.wl.shell_surface); | |
> } | |
268a498,505 | |
> #endif | |
> | |
> | |
> | |
> #ifdef SDL2_0_DEBUG | |
> #if SDL_MAJOR_VERSION == 2 | |
> if (isGame) { | |
> #endif | |
269a507 | |
> printf("plat_sdl_init : gl_init() ret=%d\n",ret); | |
271a510 | |
> printf("plat_sdl_init : gl_finish()\n"); | |
273a513,526 | |
> #if SDL_MAJOR_VERSION == 2 | |
> } | |
> #endif | |
> | |
> #else | |
> ret = gl_init(display, window, &gl_quirks); | |
> printf("plat_sdl_init : gl_init() ret=%d\n",ret); | |
> if (ret == 0) { | |
> gl_works = 1; | |
> printf("plat_sdl_init : gl_finish()\n"); | |
> gl_finish(); | |
> } | |
> #endif | |
> | |
276a530,531 | |
> | |
> printf("plat_sdl_init : overlay_works=%d\n",overlay_works); | |
280a536 | |
> printf("plat_sdl_init : gl_works=%d\n",gl_works); | |
284a541,545 | |
> int j; | |
> for(j=0;j<i;j++) { | |
> printf("plat_sdl_init : vout_list[%d]=%s\n",j,vout_list[j]); | |
> } | |
> | |
286a548,549 | |
> | |
> printf("- /frontend/libpicofe/plat_sdl_init() end\n"); | |
289a553,556 | |
> #ifdef UI_INTEGRATION | |
> printf("SDL_Quit() not used. for UI_INTEGRATION\n"); | |
> #else | |
> printf("SDL_Quit()\n"); | |
290a558,559 | |
> #endif | |
> printf("- /frontend/libpicofe/plat_sdl_init() fail\n"); | |
293a563 | |
> | |
295a566,567 | |
> printf("+ /frontend/libpicofe/plat_sdl_finish()\n"); | |
> #if SDL_MAJOR_VERSION == 1 | |
299a572 | |
> #endif | |
306c579,583 | |
< if (strcmp(vid_drv_name, "x11") != 0) | |
--- | |
> if (strcmp(vid_drv_name, "x11") != 0) { | |
> #if SDL_MAJOR_VERSION == 2 | |
> SDL_GetWindowSurface(sdl2_window); | |
> printf("005 /frontend/libpicofe/SDL_GetWindowSurface() \n"); | |
> #else | |
307a585,592 | |
> printf("SDL_SetVideoMode\n"); | |
> #endif | |
> } | |
> | |
> #ifdef UI_INTEGRATION | |
> printf("SDL_Quit() not used. for UI_INTEGRATION\n"); | |
> #else | |
> printf("SDL_Quit()\n"); | |
308a594,596 | |
> #endif | |
> | |
> printf("- /frontend/libpicofe/plat_sdl_finish()\n"); | |
312a601,602 | |
> printf("plat_sdl_overlay_clear()\n"); | |
> #if SDL_MAJOR_VERSION == 1 | |
321a612 | |
> #endif | |
diff --new-file -w -r pcsx_rearmed/frontend/libpicofe/plat_sdl.h pcsx_rearmed_custom/frontend/libpicofe/plat_sdl.h | |
2a3 | |
> | |
3a5 | |
> #if SDL_MAJOR_VERSION == 1 | |
4a7,14 | |
> #endif | |
> | |
> #if SDL_MAJOR_VERSION == 2 | |
> extern SDL_Window *sdl2_window; | |
> extern SDL_Renderer *sdl2_renderer; | |
> extern SDL_Texture *sdl2_texture; | |
> #endif | |
> | |
8a19,21 | |
> #if SDL_MAJOR_VERSION == 2 | |
> int plat_sdl_init(int isGame); | |
> #else | |
9a23 | |
> #endif | |
diff --new-file -w -r pcsx_rearmed/frontend/libpicofe/readpng.c pcsx_rearmed_custom/frontend/libpicofe/readpng.c | |
15a16 | |
> #include <unistd.h> | |
56c57,58 | |
< png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_STRIP_16 | PNG_TRANSFORM_STRIP_ALPHA | PNG_TRANSFORM_PACKING, NULL); | |
--- | |
> // png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_STRIP_16 | PNG_TRANSFORM_STRIP_ALPHA | PNG_TRANSFORM_PACKING, NULL); | |
> png_read_png(png_ptr, info_ptr, PNG_TRANSFORM_STRIP_16 | PNG_TRANSFORM_PACKING, NULL); | |
89,90c91,93 | |
< | |
< for (h = 0; h < height; h++) | |
--- | |
> int w_rate = 1; // reduction rate of width | |
> int h_rate = 1; // reduction rate of height | |
> for (h = 0; h < height / h_rate; h++) | |
92,93c95,96 | |
< unsigned char *src = row_ptr[h + y_ofs] + x_ofs * 3; | |
< int len = width; | |
--- | |
> unsigned char *src = row_ptr[h * h_rate + y_ofs] + x_ofs * 4; | |
> int len = width / w_rate; | |
95a99 | |
> if (src[3] & 0xff) { | |
101d104 | |
< src += 3; | |
103c106,111 | |
< dst += req_w - width; | |
--- | |
> else { | |
> *dst++; | |
> } | |
> src += 4 * w_rate; | |
> } | |
> dst += req_w - width / w_rate; | |
269a278 | |
> fsync(fileno(f)); | |
diff --new-file -w -r pcsx_rearmed/frontend/main.c pcsx_rearmed_custom/frontend/main.c | |
13a14,16 | |
> #include <pthread.h> | |
> #include <sys/inotify.h> | |
> #include <sys/stat.h> | |
39a43 | |
> static int isOpenEnabled = 0; | |
44a49,53 | |
> #define EVENT_SIZE (sizeof (struct inotify_event)) | |
> #define BUF_LEN 4096 | |
> | |
> | |
> | |
52a62,64 | |
> int from_escape = 0; | |
> int power_off_flg = 0; | |
> int is_high_temperature = 0; | |
55a68,100 | |
> int isUnknowCdrom; | |
> int holdResetEvent; | |
> | |
> int display_mode = DISPLAY_MODE_DEFAULT; | |
> int language = LANGUAGE_DEFAULT; | |
> int region = REGION_DEFAULT; | |
> int enter_mode = ENTER_DEFAULT; | |
> | |
> static int cpu_temp_limit = DEFAULT_TEMP_LIMIT; | |
> | |
> const char *lang_list[13] = { | |
> "German", // de_de | |
> "E_UK", // en_gb | |
> "E", // en_us | |
> "Spanish_LA", // es_419 | |
> "Spanish", // es_es | |
> "French_CA", // fr_ca | |
> "French", // fr_fr | |
> "Italian", // it_it | |
> "Dutch", // nl_nl | |
> "Portuguese_BR", // pt_br | |
> "Portuguese", // pt_pt | |
> "Russian", // ru_ru | |
> "J" // ja_jp | |
> }; | |
> | |
> char changedisc_message[128]; | |
> char solodisc_message[128]; | |
> char nottime_message[128]; | |
> char ok_image[128]; | |
> | |
> static pthread_t th_power_off_state = (pthread_t)0; | |
> static pthread_t cpu_temp_thread = (pthread_t)0; | |
70a116 | |
> if (CdromLabel[0] != '\0' && !(g_opts & OPT_AUTOSAVE)) { | |
71a118,121 | |
> } | |
> else { | |
> strncpy(trimlabel, CdromLabel_old, 32); | |
> } | |
78a129 | |
> if (CdromId[0] != '\0' && !(g_opts & OPT_AUTOSAVE)) { | |
79a131,134 | |
> } | |
> else { | |
> snprintf(buf, size, fmt, trimlabel, CdromId_old, i); | |
> } | |
108c163 | |
< MAKE_PATH(Config.Mcd2, MEMCARD_DIR, "card2.mcd"); | |
--- | |
> MAKE_PATH(Config.Mcd2, MEMCARD_DIR, "none"); | |
132a188,191 | |
> pl_rearmed_cbs.gpu_peops.isToShinDen = 0; | |
> pl_rearmed_cbs.gpu_peops.isBiosLogoEnd = 0; | |
> pl_rearmed_cbs.gpu_peops.scenes = 0; | |
> pl_rearmed_cbs.gpu_peops.regions = 0; | |
174a234 | |
> from_escape = 1; | |
258a319,322 | |
> case SACTION_SYNC_STATE: | |
> emu_sync_state2(); | |
> time_to_sync_state = 0; | |
> return; | |
271a336,397 | |
> // add for open button | |
> case SACTION_CD_CHANGE: | |
> if (!isOpenEnabled) { | |
> isOpenEnabled = CheckOpenEnabled(); | |
> if (!isOpenEnabled) { | |
> return; | |
> } | |
> } | |
> toggle_fast_forward(1); | |
> swap_cd(); | |
> return; | |
> // add for power button | |
> case SACTION_POWER_OFF: | |
> power_off(); | |
> return; | |
> // add for reset button | |
> case SACTION_RESET_EVENT: | |
> // save state of restart point | |
> // save state of restart point | |
> if (!(g_opts & OPT_AUTOSAVE) && isUnknownCdrom) { | |
> holdResetEvent = 1; | |
> } | |
> if ((memcardFlag==0)&&(memcardFlagOld==0)) { | |
> } | |
> else { | |
> memcardResetFlag = 1; | |
> return; | |
> } | |
> if (holdResetEvent) return; | |
> ret = emu_auto_save_state(0); | |
> snprintf(hud_msg, sizeof(hud_msg), ret == 0 ? "LOADED" : "FAIL!"); | |
> if (ret) { | |
> char path[MAXPATHLEN]; | |
> struct stat st; | |
> | |
> snprintf(path, sizeof(path), "." PCSX_DOT_DIR "filename.txt"); | |
> ret = stat(path, &st); | |
> if (!ret) { | |
> remove(path); | |
> } | |
> } | |
> else { | |
> // screen picture | |
> char buf[MAXPATHLEN]; | |
> void *scrbuf; | |
> int w, h, bpp; | |
> | |
> scrbuf = pl_prepare_screenshot(&w, &h, &bpp); | |
> get_gameid_filename(buf, sizeof(buf), | |
> "." SCSHOT_DIR "%.32s-%.9s.png", 0); | |
> ret = -1; | |
> if (scrbuf != 0 && bpp == 16) | |
> ret = writepng(buf, scrbuf, w, h); | |
> if (ret == 0) | |
> snprintf(hud_msg, sizeof(hud_msg), "SCREENSHOT TAKEN"); | |
> | |
> // save file | |
> make_file_name(); | |
> } | |
> // emulator exit | |
> stop = 1; | |
> g_emu_want_quit = 1; | |
397c523 | |
< snprintf(hud_msg, sizeof(hud_msg), BOOT_MSG); | |
--- | |
> //snprintf(hud_msg, sizeof(hud_msg), BOOT_MSG); | |
480c606,607 | |
< create_profile_dir("/screenshots/"); | |
--- | |
> // create_profile_dir("/screenshots/"); | |
> create_profile_dir(SCSHOT_DIR); | |
489c616 | |
< for (i = 1; i <= 9; i++) { | |
--- | |
> for (i = 1; i <= 2; i++) { | |
501a629,648 | |
> static int check_prepare_suspend(void) | |
> { | |
> char path[256]; | |
> int ret = -1; | |
> FILE *f; | |
> snprintf(path, sizeof(path), POWER_DIR POWER_OFF_FILE); | |
> f = fopen(path, "rb"); | |
> if (f == NULL) { | |
> ret = 0; | |
> } | |
> else { | |
> ret = -1; | |
> fclose(f); | |
> } | |
> return ret; | |
> } | |
> | |
> #ifdef UI_INTEGRATION | |
> int main_ui(int argc, char *argv[]); | |
> | |
503a651,663 | |
> printf("+ frontend/main()\n"); | |
> main_ui(argc,argv); | |
> printf("- frontend/main()\n"); | |
> } | |
> int main_ui(int argc, char *argv[]) | |
> { | |
> printf("+ frontend/main_ui()\n"); | |
> #else | |
> int main(int argc, char *argv[]) | |
> { | |
> //printf("+ frontend/main()\n"); | |
> #endif | |
> | |
510a671 | |
> int isGame = 0; | |
523a685,686 | |
> printf("argv[i]=%s\n",argv[i]); | |
> printf("argv[i+1]=%s\n",argv[i+1]); | |
543a707,739 | |
> else if (!strcmp(argv[i], "-display")) { | |
> if (i+1 >= argc) { | |
> break; | |
> } | |
> display_mode = atoi(argv[++i]); | |
> if (DISPLAY_MODE_MIN > display_mode || DISPLAY_MODE_MAX < display_mode) { | |
> display_mode = DISPLAY_MODE_DEFAULT; | |
> } | |
> } | |
> else if (!strcmp(argv[i], "-lang")) { | |
> if (i+1 >= argc) { | |
> break; | |
> } | |
> language = atoi(argv[++i]); | |
> if (LANGUAGE_MIN > language || LANGUAGE_MAX < language) { | |
> language = LANGUAGE_DEFAULT; | |
> } | |
> } | |
> else if (!strcmp(argv[i], "-region")) { | |
> if (i+1 >= argc) { | |
> break; | |
> } | |
> region = atoi(argv[++i]); | |
> if (REGION_MIN > region || REGION_MAX < region) { | |
> region = REGION_DEFAULT; | |
> } | |
> } | |
> else if (!strcmp(argv[i], "-enter")) { | |
> if (i+1 >= argc) { | |
> break; | |
> } | |
> enter_mode = atoi(argv[++i]); | |
> } | |
557a754,758 | |
> } | |
> else if (!strcmp(argv[i], "-v") || | |
> !strcmp(argv[i], "--version")) { | |
> printf(REV "\n"); | |
> return 0; | |
570a772,775 | |
> sprintf(changedisc_message, "%s%s%s%s", LANG_IMG_DIR, "msg_current_inserted_disc_info_", lang_list[language-1], ".png"); | |
> sprintf(solodisc_message, "%s%s%s%s", LANG_IMG_DIR, "msg_cant_change_discs_this_game_", lang_list[language-1], ".png"); | |
> sprintf(nottime_message, "%s%s%s%s", LANG_IMG_DIR, "msg_cant_change_discs_now_", lang_list[language-1], ".png"); | |
> sprintf(ok_image, "%s%s%s%s", DISK_IMG_DIR, "OK_SD_Btn_", lang_list[language-1], ".png"); | |
572c777,778 | |
< if (cdfile) | |
--- | |
> if (cdfile) { | |
> printf("set_cd_image(cdfile)\n"); | |
573a780 | |
> } | |
580c787,791 | |
< plat_init(); | |
--- | |
> if (cdfile != NULL) { | |
> isGame = 1; | |
> } | |
> plat_init(isGame, enter_mode); | |
> setTitleName(); | |
605a817,819 | |
> // save file | |
> make_file_name(); | |
> save_error(ERROR_PCSXCRITICALERROR, "Sorry, error occurred during running system..."); | |
643a858,870 | |
> // create thread for watching communication file | |
> if (create_power_off_thread() != 0) { | |
> printf("failed to create power off thread\n"); | |
> return -1; | |
> } | |
> if (check_prepare_suspend() != 0) { | |
> power_off(); | |
> } | |
> // create thread for watching cpu temperature | |
> if (begin_watch_cpu_temperature() != 0) { | |
> printf("failed to create thread for watching cpu temperature\n"); | |
> return -1; | |
> } | |
644a872,874 | |
> StartCheckOpen(); | |
> | |
> printf("while (g_emu_want_quit=%d) start \n",g_emu_want_quit); | |
651c881,884 | |
< if (emu_action != SACTION_NONE) | |
--- | |
> #ifdef UI_INTEGRATION | |
> g_emu_want_quit = -1; | |
> #else | |
> if (emu_action != SACTION_NONE) { | |
653a887,889 | |
> #endif | |
> } | |
> printf("while (g_emu_want_quit=%d) end \n",g_emu_want_quit); | |
660a897,899 | |
> unlink(STATUS_DIR"001.sts"); | |
> | |
> printf("- plat_sdl/main.c:main()\n"); | |
764a1004,1021 | |
> int emu_auto_save_state(int slot) | |
> { | |
> char fname[MAXPATHLEN]; | |
> int ret; | |
> | |
> ret = get_state_filename(fname, sizeof(fname), slot); | |
> if (ret != 0) | |
> return ret; | |
> | |
> ret = SaveStateWork(fname); | |
> #ifdef HAVE_PRE_ARMV7 /* XXX GPH hack */ | |
> sync(); | |
> #endif | |
> SysPrintf("* %s \"%s\" [%d]\n", | |
> ret == 0 ? "saved" : "failed to save", fname, slot); | |
> return ret; | |
> } | |
> | |
1031a1289,1450 | |
> static int check_poweroff_event(int power_fd) { | |
> int i = 0; | |
> char buffer[BUF_LEN]; | |
> int event_length = 0; | |
> char file_name[sizeof(POWER_OFF_FILE)] = POWER_OFF_FILE; | |
> | |
> event_length = read(power_fd, buffer, BUF_LEN); | |
> if(event_length <= 0) { | |
> return 1; | |
> } | |
> while (i < event_length) { | |
> struct inotify_event* event = (struct inotify_event *) &buffer[i]; | |
> if (strcmp(file_name, event->name) == 0) { | |
> return 0; | |
> } | |
> i += EVENT_SIZE + event->len; | |
> } | |
> return 1; | |
> } | |
> | |
> static void power_manage(void) { | |
> int power_fd = -1; | |
> int power_wd = -1; | |
> int is_power_on = 1; | |
> | |
> power_fd = inotify_init(); | |
> if(power_fd == -1) { | |
> printf("ERROR:failed to init inotify for power manage\n"); | |
> return; | |
> } | |
> | |
> power_wd = inotify_add_watch(power_fd, POWER_DIR, IN_CREATE); | |
> if(power_wd == -1) { | |
> printf("ERROR:failed to add watch descriptor for power manage\n"); | |
> return; | |
> } | |
> | |
> while (is_power_on) { | |
> is_power_on = check_poweroff_event(power_fd); | |
> } | |
> | |
> inotify_rm_watch(power_fd, power_wd); | |
> close(power_fd); | |
> | |
> power_off_flg = 1; | |
> | |
> return; | |
> } | |
> | |
> int create_power_off_thread(void) { | |
> int ret; | |
> pthread_attr_t power_manage_attr; | |
> | |
> if (th_power_off_state > 0) { | |
> printf("auto power off thread is already started, id [%d] \n", th_power_off_state); | |
> return -1; | |
> } | |
> pthread_attr_init(&power_manage_attr); | |
> pthread_attr_setdetachstate(&power_manage_attr , PTHREAD_CREATE_DETACHED); | |
> | |
> ret = pthread_create(&th_power_off_state, &power_manage_attr, (void*)power_manage, NULL); | |
> pthread_attr_destroy(&power_manage_attr); | |
> | |
> return ret; | |
> } | |
> | |
> void power_off(void) | |
> { | |
> char path[MAXPATHLEN]; | |
> struct stat st; | |
> | |
> snprintf(path, sizeof(path), "." PCSX_DOT_DIR "filename.txt"); | |
> if(stat(path, &st) == 0) { | |
> remove(path); | |
> } | |
> | |
> // terminate pcsx | |
> stop = 1; | |
> g_emu_want_quit = 1; | |
> } | |
> | |
> // sub-thread for watching cpu temperature | |
> static int check_cpu_temperature(int cpu_temp_fd) | |
> { | |
> int cpu_temperature, cpu_mode; | |
> FILE *fp; | |
> char buffer[BUF_LEN]; | |
> int ret; | |
> | |
> int is_normal_temp = 1; | |
> int event_length = 0; | |
> | |
> event_length = read(cpu_temp_fd, buffer, BUF_LEN); | |
> if(event_length <= 0) { | |
> return 0; | |
> } | |
> fp = fopen(CPU_TEMP_FILE, "r"); | |
> ret = fscanf(fp, "%d%d", &cpu_temperature, &cpu_mode); | |
> if (ret != EOF) { | |
> is_normal_temp = (cpu_temperature < cpu_temp_limit) ? 1 : 0; | |
> } | |
> fclose(fp); | |
> return is_normal_temp; | |
> } | |
> | |
> static void watch_cpu_temperature(void) | |
> { | |
> int cpu_temp_fd; | |
> int cpu_temp_wd; | |
> char temp_limit_str[strlen(CPU_TEMP_LIMIT_STRING)+1]; | |
> int temp_limit_val; | |
> int ret; | |
> FILE *fp; | |
> | |
> cpu_temp_fd = inotify_init(); | |
> if (cpu_temp_fd == -1) { | |
> printf("ERROR:failed to init inotify for cpu temperature\n"); | |
> } | |
> | |
> cpu_temp_wd = inotify_add_watch(cpu_temp_fd, CPU_TEMP_FILE, IN_MODIFY); | |
> if (cpu_temp_wd == -1) { | |
> printf("ERROR:failed to add watch descriptor for cpu temperature\n"); | |
> } | |
> | |
> fp = fopen(CPU_TEMP_LIMIT_FILE, "r"); | |
> if (fp != NULL) { | |
> do { | |
> ret = fscanf(fp, "%s%d", &temp_limit_str, &temp_limit_val); | |
> if (strcmp(temp_limit_str, CPU_TEMP_LIMIT_STRING) == 0) { | |
> cpu_temp_limit = temp_limit_val; | |
> break; | |
> } | |
> } while (ret != EOF); | |
> } | |
> fclose(fp); | |
> | |
> while (1) { | |
> ret = check_cpu_temperature(cpu_temp_fd); | |
> if (ret == 0) { | |
> break; | |
> } | |
> } | |
> | |
> inotify_rm_watch(cpu_temp_fd, cpu_temp_wd); | |
> close(cpu_temp_fd); | |
> | |
> is_high_temperature = 1; | |
> } | |
> | |
> int begin_watch_cpu_temperature(void) | |
> { | |
> int ret; | |
> pthread_attr_t cpu_temp_attr; | |
> | |
> pthread_attr_init(&cpu_temp_attr); | |
> pthread_attr_setdetachstate(&cpu_temp_attr , PTHREAD_CREATE_DETACHED); | |
> | |
> ret = pthread_create(&cpu_temp_thread, &cpu_temp_attr, watch_cpu_temperature, NULL); | |
> pthread_attr_destroy(&cpu_temp_attr); | |
> | |
> return ret; | |
> } | |
diff --new-file -w -r pcsx_rearmed/frontend/main.h pcsx_rearmed_custom/frontend/main.h | |
33a34,36 | |
> #define SCSHOT_DIR "/.pcsx/screenshots/" | |
> #define LANG_IMG_DIR "/usr/sony/share/data/images/BMP_TXT_SST/" | |
> #define DISK_IMG_DIR "/usr/sony/share/data/images/Disk/" | |
36a40,66 | |
> #define POWER_DIR "/data/power/" | |
> #define POWER_OFF_FILE "prepare_suspend" | |
> | |
> #define CPU_TEMP_FILE "/dev/shm/power/cpu_temp" | |
> #define CPU_TEMP_LIMIT_FILE "/dev/shm/power/temp_limit" | |
> #define CPU_TEMP_LIMIT_STRING "CPU_AUTO_START_TEMP" | |
> #define DEFAULT_TEMP_LIMIT 80000 | |
> | |
> #define DISPLAY_MODE_MIN 0 | |
> #define DISPLAY_MODE_MAX 1 | |
> #define DISPLAY_MODE_DEFAULT 1 | |
> #define LANGUAGE_MIN 1 | |
> #define LANGUAGE_MAX 13 | |
> #define LANGUAGE_DEFAULT 13 | |
> #define REGION_MIN 1 | |
> #define REGION_MAX 4 | |
> #define REGION_DEFAULT 3 | |
> #define ENTER_DEFAULT 0 | |
> extern int display_mode; | |
> extern int language; | |
> extern int region; | |
> | |
> extern char changedisc_message[128]; | |
> extern char solodisc_message[128]; | |
> extern char nottime_message[128]; | |
> extern char ok_image[128]; | |
> | |
38a69,75 | |
> extern int from_escape; | |
> extern int power_off_flg; | |
> extern int is_high_temperature; | |
> extern unsigned int memcardFlag; | |
> extern unsigned int memcardFlagOld; | |
> extern int memcardResetFlag; | |
> | |
55a93,95 | |
> int create_power_off_thread(void); | |
> void power_off(void); | |
> | |
81a122,125 | |
> SACTION_RESET_EVENT, // action when reset button pushed | |
> SACTION_POWER_OFF, // action when power button pushed | |
> SACTION_CD_CHANGE, | |
> SACTION_SYNC_STATE, | |
diff --new-file -w -r pcsx_rearmed/frontend/menu.c pcsx_rearmed_custom/frontend/menu.c | |
1c1 | |
< /* | |
--- | |
> /* | |
38a39 | |
> #include "../libpcsxcore/title.h" | |
44a46,48 | |
> #define CONFIG_JP_BIOS_NAME "romJP.bin" | |
> #define CONFIG_WORLD_BIOS_NAME "romw.bin" | |
> | |
48a53,54 | |
> #define DEFAULT_OPEN_INVALID_TIME 22 | |
> | |
95c101 | |
< static int config_save_counter, region, in_type_sel1, in_type_sel2; | |
--- | |
> static int config_save_counter, in_type_sel1, in_type_sel2; | |
102a109,110 | |
> int region; | |
> int open_invalid_time; | |
133a142,144 | |
> static void menu_leave_emu(void); | |
> void menu_prepare_emu(void); | |
> | |
324c335 | |
< | |
--- | |
> config_change(); | |
329a341,517 | |
> void config_change() { | |
> // SPU | |
> if (isTitleName(FINAL_FANTANSY_VII_DICS_1_EU) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_1_JP) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_1_US) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_2_EU) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_2_JP) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_2_US) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_3_EU) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_3_JP) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_3_US) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_4_JP) || | |
> isTitleName(G_DARIUS_JP) || | |
> isTitleName(HARRY_POTTER_AND_THE_PHILOSOPHERS_STONE_EU) || | |
> // isTitleName(IQ_INTELLIGENT_QUBE_JP) || // no need because the issue does not occur | |
> isTitleName(IQ_INTELLIGENT_QUBE_US) || | |
> isTitleName(JUMPING_FLASH_EU) || | |
> isTitleName(JUMPING_FLASH_JP) || | |
> isTitleName(JUMPING_FLASH_US) || | |
> isTitleName(KAGERO_JP) || | |
> isTitleName(LEGACY_OF_KAIN_SOUL_REAVER_EU) || | |
> isTitleName(LEGACY_OF_KAIN_SOUL_REAVER_US) || | |
> isTitleName(MEDAL_OF_HONOR_EU) || | |
> isTitleName(MEDAL_OF_HONOR_US) || | |
> isTitleName(MEDIEVIL_EU) || | |
> isTitleName(MEDIEVIL_US) || | |
> isTitleName(MEGA_MAM_LEGENDS_JP) || | |
> isTitleName(METAL_GEAR_SOLID_DISC_1_EU) || | |
> isTitleName(METAL_GEAR_SOLID_DISC_1_JP) || | |
> isTitleName(METAL_GEAR_SOLID_DISC_1_US) || | |
> isTitleName(METAL_GEAR_SOLID_DISC_2_EU) || | |
> isTitleName(METAL_GEAR_SOLID_DISC_2_JP) || | |
> isTitleName(METAL_GEAR_SOLID_DISC_2_US) || | |
> isTitleName(ODDWORLD_ABES_ODDYSEE_EU) || | |
> isTitleName(ODDWORLD_ABES_ODDYSEE_US) || | |
> isTitleName(PARASITE_EVE_DISC_1_JP) || | |
> isTitleName(PARASITE_EVE_DISC_1_US) || | |
> isTitleName(PARASITE_EVE_DISC_2_JP) || | |
> isTitleName(PARASITE_EVE_DISC_2_US) || | |
> isTitleName(SAGAFRONTIER_JP) || | |
> isTitleName(SPEC_OPS_STEALTH_PATROL_US) || | |
> isTitleName(SUIKODEN_EU) || | |
> isTitleName(SUIKODEN_JP) || | |
> isTitleName(SUIKODEN_US) || | |
> isTitleName(SYPHON_FILTER_US) || | |
> isTitleName(TEKKEN3_EU) || | |
> isTitleName(TEKKEN3_JP) || | |
> isTitleName(TOMBA_JP) || | |
> isTitleName(TOMBA_US) || | |
> isTitleName(TONY_HAWK_SKATE_BOARDING_EU) || | |
> isTitleName(TONY_HAWKS_PRO_SKATER_2_EU) || | |
> isTitleName(TONY_HAWKS_PRO_SKATER_2_US) || | |
> isTitleName(VAGRANT_STORY_EU) || | |
> isTitleName(VAGRANT_STORY_US) || | |
> isTitleName(WILD_ARMS_JP) || | |
> isTitleName(WILD_ARMS_US)) { | |
> spu_config.iUseInterpolation = 2; | |
> } else if(isTitleName(FIGHTING_FORCE_US) || | |
> isTitleName(RESIDENT_EVIL_EU) || | |
> isTitleName(RESIDENT_EVIL_JP) || | |
> isTitleName(RESIDENT_EVIL_US) || | |
> isTitleName(TOM_CLANCYS_RAINBOW_SIX_EU)) { | |
> spu_config.iUseInterpolation = 3; | |
> } | |
> | |
> if (isTitleName(CHOCOBOS_JP) || | |
> isTitleName(CRASH_BANDICOOT_EU) || | |
> isTitleName(DESTRUCTION_DERBY_EU) || | |
> isTitleName(DESTRUCTION_DERBY_US) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_1_EU) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_1_JP) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_1_US) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_2_EU) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_2_JP) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_2_US) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_3_EU) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_3_JP) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_3_US) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_4_JP) || | |
> isTitleName(PARASITE_EVE_DISC_1_JP) || | |
> isTitleName(PARASITE_EVE_DISC_1_US) || | |
> isTitleName(PARASITE_EVE_DISC_2_JP) || | |
> isTitleName(PARASITE_EVE_DISC_2_US) || | |
> isTitleName(SAGAFRONTIER_JP) || | |
> isTitleName(SPEC_OPS_STEALTH_PATROL_US) || | |
> isTitleName(SUIKODEN_EU) || | |
> isTitleName(SUIKODEN_JP) || | |
> isTitleName(SUIKODEN_US) || | |
> isTitleName(TOMBA_JP) || | |
> isTitleName(TOMBA_US) || | |
> isTitleName(VAGRANT_STORY_EU) || | |
> isTitleName(VAGRANT_STORY_US) || | |
> isTitleName(MEDAL_OF_HONOR_EU) || | |
> isTitleName(MEDAL_OF_HONOR_US)) { | |
> spu_config.iUseThread = 0; | |
> } | |
> | |
> if (isTitleName(FINAL_FANTANSY_VII_DICS_1_EU) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_1_JP) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_1_US) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_2_EU) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_2_JP) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_2_US) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_3_EU) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_3_JP) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_3_US) || | |
> isTitleName(FINAL_FANTANSY_VII_DICS_4_JP) || | |
> isTitleName(G_DARIUS_JP) || | |
> isTitleName(PERSONA_JP) || | |
> isTitleName(PERSONA_US)) { | |
> spu_config.iTempo = 1; | |
> } | |
> | |
> // Interlace | |
> if (isTitleName(EHRGEIZ_JP)) { | |
> pl_rearmed_cbs.gpu_neon.allow_interlace = 0; | |
> } | |
> | |
> // Region | |
> if (isTitleName(WILD_ARMS_2_DISC_1_JP) || | |
> isTitleName(WILD_ARMS_2_DISC_2_JP) || | |
> isTitleName(WILD_ARMS_JP)) { | |
> Config.PsxAuto = 0; | |
> Config.PsxType = 0; | |
> } | |
> | |
> // Gpu plugin exchange | |
> if (isTitleName(METAL_GEAR_SOLID_DISC_1_EU) || | |
> isTitleName(METAL_GEAR_SOLID_DISC_1_JP) || | |
> isTitleName(METAL_GEAR_SOLID_DISC_1_US) || | |
> isTitleName(METAL_GEAR_SOLID_DISC_2_EU) || | |
> isTitleName(METAL_GEAR_SOLID_DISC_2_JP) || | |
> isTitleName(METAL_GEAR_SOLID_DISC_2_US) || | |
> isTitleName(PERSONA_JP) || | |
> isTitleName(PERSONA_US) || | |
> isTitleName(SAGAFRONTIER_JP) || | |
> isTitleName(TOSHINDEN_EU) || | |
> isTitleName(TOSHINDEN_JP) || | |
> isTitleName(TOSHINDEN_US)) { | |
> strcpy(Config.Gpu,"gpu_peops.so"); | |
> | |
> if (isTitleName(TOSHINDEN_EU) || | |
> isTitleName(TOSHINDEN_JP) || | |
> isTitleName(TOSHINDEN_US)) { | |
> pl_rearmed_cbs.gpu_peops.isToShinDen = 1; | |
> } | |
> } | |
> | |
> if (isTitleName(METAL_GEAR_SOLID_DISC_1_US) || | |
> isTitleName(METAL_GEAR_SOLID_DISC_2_US)) { | |
> pl_rearmed_cbs.gpu_peops.regions = 1; | |
> } else if (isTitleName(METAL_GEAR_SOLID_DISC_1_JP) || | |
> isTitleName(METAL_GEAR_SOLID_DISC_2_JP)){ | |
> pl_rearmed_cbs.gpu_peops.regions = 2; | |
> } else { | |
> pl_rearmed_cbs.gpu_peops.regions = 0; | |
> } | |
> | |
> // Dithering | |
> if (isTitleName(METAL_GEAR_SOLID_DISC_1_EU) || | |
> isTitleName(METAL_GEAR_SOLID_DISC_1_JP) || | |
> isTitleName(METAL_GEAR_SOLID_DISC_1_US) || | |
> isTitleName(METAL_GEAR_SOLID_DISC_2_EU) || | |
> isTitleName(METAL_GEAR_SOLID_DISC_2_JP) || | |
> isTitleName(METAL_GEAR_SOLID_DISC_2_US) || | |
> isTitleName(SAGAFRONTIER_JP)) { | |
> pl_rearmed_cbs.gpu_peops.iUseDither = 2; | |
> }else if(isTitleName(PERSONA_JP) || | |
> isTitleName(PERSONA_US)) { | |
> pl_rearmed_cbs.gpu_peops.iUseDither = 3; | |
> } | |
> | |
> if (isTitleName(SAGAFRONTIER_JP)) { | |
> pl_rearmed_cbs.gpu_peops.iTrimJaggyFrame = 1; | |
> } | |
> } | |
> | |
347a536 | |
> g_opts |= OPT_AUTOSAVE; | |
350c539 | |
< | |
--- | |
> open_invalid_time = DEFAULT_OPEN_INVALID_TIME; | |
422a612 | |
> CE_INTVAL(open_invalid_time), | |
462a653 | |
> if (CdromLabel[0] != '\0' && !(g_opts & OPT_AUTOSAVE)) { | |
463a655,658 | |
> } | |
> else { | |
> strncpy(trimlabel, CdromLabel_old, 32); | |
> } | |
520a716 | |
> fsync(fileno(f)); | |
547a744 | |
> fsync(fileno(f)); | |
624a822,837 | |
> | |
> if(strcmp(config_data[i].name,"Bios") == 0) { | |
> // set BIOS name by me. | |
> char iso_path[MAXPATHLEN]; | |
> char *iso_char; | |
> strcpy(iso_path, GetIsoFile()); | |
> iso_char = strrchr(iso_path, '/'); | |
> if (iso_char != NULL) { | |
> iso_char += 3; | |
> if(*iso_char == 'P' || *iso_char == 'p') { | |
> strcpy(config_data[i].val, CONFIG_JP_BIOS_NAME); | |
> } else { | |
> strcpy(config_data[i].val, CONFIG_WORLD_BIOS_NAME); | |
> } | |
> } | |
> } | |
694,695d906 | |
< if ((unsigned int)memcard2_sel < ARRAY_SIZE(memcards)) { | |
< if (memcard2_sel == 0) | |
697,700d907 | |
< else if (memcards[memcard2_sel] != NULL) | |
< snprintf(Config.Mcd2, sizeof(Config.Mcd2), ".%s%s", | |
< MEMCARD_DIR, memcards[memcard2_sel]); | |
< } | |
703d909 | |
< | |
874a1081,1083 | |
> { "RESET button ", 1 << SACTION_RESET_EVENT }, | |
> // { "Power button ", 0 }, | |
> { "CD Change button ", 1 << SACTION_CD_CHANGE }, | |
1608a1818 | |
> mee_onoff ("Auto Save State", 0, g_opts, OPT_AUTOSAVE), | |
1760,1761d1969 | |
< if (memcard2_sel != 0) | |
< snprintf(Config.Mcd2, sizeof(Config.Mcd2), ".%s%s", MEMCARD_DIR, memcards[memcard2_sel]); | |
1947a2156 | |
> LoadPlugins(); | |
1951a2161 | |
> make_file_name(); | |
1999c2209 | |
< sizeof(last_selected_fname), exts, NULL); | |
--- | |
> sizeof(last_selected_fname), exts, NULL, 0); | |
2034a2245 | |
> make_file_name(); | |
2079c2290 | |
< optional_cdimg_filter); | |
--- | |
> optional_cdimg_filter, 0); | |
2111c2322,2327 | |
< | |
--- | |
> struct stat status; | |
> int ret; | |
> ret = stat(GetIsoFile(), &status); | |
> if (ret == 0) { | |
> strcpy(last_selected_fname, GetIsoFile()); | |
> } | |
2114c2330 | |
< optional_cdimg_filter); | |
--- | |
> optional_cdimg_filter, 1); | |
2117c2333,2340 | |
< | |
--- | |
> isUnknownCdrom = 1; | |
> if (isTitleName(PARASITE_EVE_DISC_1_JP) || isTitleName(PARASITE_EVE_DISC_2_JP) | |
> || isTitleName(PARASITE_EVE_DISC_1_US) || isTitleName(PARASITE_EVE_DISC_2_US)) { | |
> /* Prohibit re-selecting the disc */ | |
> is_disc_change = 0; | |
> is_nop_count = 0; | |
> nop_cnt = 0; | |
> } | |
2139a2363,2412 | |
> void swap_cd(void) | |
> { | |
> int inp; | |
> | |
> menu_leave_emu(); | |
> | |
> if (disc_change_type == 0) { | |
> show_text_image(solodisc_message, ok_image); | |
> while (!power_off_flg) { | |
> inp = in_menu_wait_any(NULL, 50); | |
> if (inp & PBTN_MOK) { | |
> break; | |
> } | |
> } | |
> /* wait until ok is released */ | |
> while (in_menu_wait_any(NULL, 50) & PBTN_MOK) { | |
> if (power_off_flg) { | |
> break; | |
> } | |
> } | |
> } | |
> else if (is_disc_change) { | |
> swap_cd_image(); | |
> /* wait until ok, back is released */ | |
> while (in_menu_wait_any(NULL, 50) & (PBTN_MOK|PBTN_MBACK)) { | |
> if (power_off_flg) { | |
> break; | |
> } | |
> } | |
> in_set_config_int(0, IN_CFG_BLOCKING, 0); | |
> } | |
> else { | |
> show_text_image(nottime_message, ok_image); | |
> while (!power_off_flg) { | |
> inp = in_menu_wait_any(NULL, 50); | |
> if (inp & PBTN_MOK) { | |
> break; | |
> } | |
> } | |
> /* wait until ok is released */ | |
> while (in_menu_wait_any(NULL, 50) & PBTN_MOK) { | |
> if (power_off_flg) { | |
> break; | |
> } | |
> } | |
> } | |
> | |
> menu_prepare_emu(); | |
> } | |
> | |
2165c2438 | |
< sizeof(last_selected_fname), exts, NULL); | |
--- | |
> sizeof(last_selected_fname), exts, NULL, 0); | |
2232a2506 | |
> from_escape = 0; | |
2252a2527,2547 | |
> static int main_menu1_handler(int id, int keys) | |
> { | |
> static int sel = 0; | |
> | |
> me_enable(e_menu_main, MA_MAIN_RESUME_GAME, ready_to_go); | |
> me_enable(e_menu_main, MA_MAIN_SAVE_STATE, ready_to_go); | |
> me_enable(e_menu_main, MA_MAIN_LOAD_STATE, ready_to_go); | |
> me_enable(e_menu_main, MA_MAIN_RESET_GAME, ready_to_go); | |
> me_enable(e_menu_main, MA_MAIN_CHEATS, ready_to_go); | |
> | |
> return me_loop_d(e_menu_main, &sel, NULL, draw_frame_main); | |
> } | |
> | |
> static menu_entry e_menu_main3[] = | |
> { | |
> mee_handler_id("Change CD image", MA_MAIN_SWAP_CD, main_menu_handler), | |
> mee_handler ("PCSX Menu", main_menu1_handler), | |
> mee_handler_id("Exit", MA_MAIN_EXIT, main_menu_handler), | |
> mee_end, | |
> }; | |
> | |
2287,2288d2581 | |
< static void menu_leave_emu(void); | |
< | |
2293a2587 | |
> printf("frontend/menu.c : menu_loop()\n"); | |
2302a2597 | |
> | |
2304c2599,2600 | |
< menu_bios_warn(); | |
--- | |
> //printf("menu.c : menu_bios_warn() warned_about_bios=%d\n",warned_about_bios); | |
> //menu_bios_warn(); | |
2307d2602 | |
< } | |
2308a2604,2606 | |
> } | |
> printf("menu.c : menu_loop() : me_enable(e_menu_main : MA_MAIN_RESUME_GAME)\n"); | |
> printf(" g_menuscreen_w=%d g_menuscreen_h=%d\n",g_menuscreen_w,g_menuscreen_h); | |
2316a2615 | |
> if (from_escape == 1) { | |
2317a2617,2624 | |
> printf("menu.c : menu_loop() : me_loop_d()\n"); | |
> sel = 0; | |
> me_loop_d(e_menu_main3, &sel, NULL, draw_frame_main); | |
> } while (!ready_to_go && !g_emu_want_quit); | |
> } | |
> else { | |
> do { | |
> printf("menu.c : menu_loop() : me_loop_d()\n"); | |
2320c2627,2628 | |
< | |
--- | |
> } | |
> printf("menu.c : while (in_menu_wait_any) start\n"); | |
2324c2632 | |
< | |
--- | |
> printf("menu.c : while (in_menu_wait_any) end\n"); | |
2350a2659,2660 | |
> printf("menu.c : scan_bios_plugins()\n"); | |
> | |
2485a2796,2797 | |
> printf("menu.c : menu_init()\n"); | |
> | |
2552c2864 | |
< plat_video_menu_enter(ready_to_go); | |
--- | |
> plat_video_menu_enter(ready_to_go, last_vout_bpp); | |
2554d2865 | |
< memcpy(g_menubg_ptr, g_menubg_src_ptr, g_menuscreen_w * g_menuscreen_h * 2); | |
2556,2559c2867,2870 | |
< int x = max(0, g_menuscreen_w - last_vout_w); | |
< int y = max(0, g_menuscreen_h / 2 - last_vout_h / 2); | |
< int w = min(g_menuscreen_w, last_vout_w); | |
< int h = min(g_menuscreen_h, last_vout_h); | |
--- | |
> int x = 0; | |
> int y = 0; | |
> int w = g_menuscreen_w; | |
> int h = g_menuscreen_h; | |
2564c2875 | |
< for (; h > 0; h--, d += g_menuscreen_w, s += last_vout_w * 2) | |
--- | |
> for (; h > 0; h--, d += w, s += w * 2) | |
2568,2570c2879,2881 | |
< for (; h > 0; h--, d += g_menuscreen_w, s += last_vout_w * 3) { | |
< rgb888_to_rgb565(d, s, w * 3); | |
< menu_darken_bg(d, d, w, 0); | |
--- | |
> for (; h > 0; h--, d += w, s += w * 3) { | |
> bgr888_to_rgb565(s, s, w * 3); | |
> menu_darken_bg(d, s, w, 0); | |
2627a2939,2987 | |
> | |
> int make_file_name(void) | |
> { | |
> char isofile[MAXPATHLEN]; | |
> char isolabel[33]; | |
> char isoid[10]; | |
> | |
> char path[256]; | |
> FILE *f; | |
> | |
> if (CdromPath[0] != '\0' && CdromLabel[0] != '\0' && CdromId[0] != '\0' && !(g_opts & OPT_AUTOSAVE)) { | |
> strncpy(isofile, CdromPath, sizeof(CdromPath)); | |
> strncpy(isolabel, CdromLabel, sizeof(CdromLabel)); | |
> strncpy(isoid, CdromId, sizeof(CdromId)); | |
> } | |
> else if (CdromPath_old[0] != '\0' && CdromLabel_old[0] != '\0' && CdromId_old[0] != '\0' && g_opts & OPT_AUTOSAVE) { | |
> strncpy(isofile, CdromPath_old, sizeof(CdromPath_old)); | |
> strncpy(isolabel, CdromLabel_old, sizeof(CdromLabel_old)); | |
> strncpy(isoid, CdromId_old, sizeof(CdromId_old)); | |
> } | |
> else { | |
> printf("- %s %d make_file_name() not make!!!\n",__FILE__,__LINE__); | |
> return -1; | |
> } | |
> | |
> snprintf(path, sizeof(path), "." PCSX_DOT_DIR "filename.txt"); | |
> f = fopen(path, "w"); | |
> if (f == NULL) { | |
> return -1; | |
> } | |
> | |
> char trimlabel[33]; | |
> int j; | |
> | |
> strncpy(trimlabel, isolabel, 32); | |
> trimlabel[32] = 0; | |
> for (j = 31; j >= 0; j--) | |
> if (trimlabel[j] == ' ') | |
> trimlabel[j] = 0; | |
> else | |
> continue; | |
> | |
> fprintf(f, "%s\n", isofile); | |
> fprintf(f, "%.32s-%.9s\n", trimlabel, isoid); | |
> | |
> fsync(fileno(f)); | |
> fclose(f); | |
> return 0; | |
> } | |
diff --new-file -w -r pcsx_rearmed/frontend/menu.h pcsx_rearmed_custom/frontend/menu.h | |
7a8,9 | |
> void swap_cd(void); | |
> | |
13a16 | |
> OPT_AUTOSAVE = 1 << 5, | |
37a41,42 | |
> extern int region; | |
> extern int open_invalid_time; | |
Binary files pcsx_rearmed/frontend/pandora/skin/Disk_Focus.png and pcsx_rearmed_custom/frontend/pandora/skin/Disk_Focus.png differ | |
Binary files pcsx_rearmed/frontend/pandora/skin/Disk_Nomal.png and pcsx_rearmed_custom/frontend/pandora/skin/Disk_Nomal.png differ | |
diff --new-file -w -r pcsx_rearmed/frontend/plat.h pcsx_rearmed_custom/frontend/plat.h | |
1c1 | |
< void plat_init(void); | |
--- | |
> void plat_init(int isGame, int region); | |
9c9 | |
< void *plat_gvideo_flip(void); | |
--- | |
> void *plat_gvideo_flip(int rgb888); | |
diff --new-file -w -r pcsx_rearmed/frontend/plat_sdl.c pcsx_rearmed_custom/frontend/plat_sdl.c | |
25a26,36 | |
> #if SDL_MAJOR_VERSION == 2 | |
> #include "libpicofe/keysym.h" | |
> #endif | |
> | |
> #define RMASK_16 0x0000F800 | |
> #define GMASK_16 0x000007E0 | |
> #define BMASK_16 0x0000001F | |
> #define RMASK_24 0x00FF0000 | |
> #define GMASK_24 0x0000FF00 | |
> #define BMASK_24 0x000000FF | |
> | |
27a39,56 | |
> #if SDL_MAJOR_VERSION == 2 | |
> { MY_SDLK_UP, IN_BINDTYPE_PLAYER12, DKEY_UP }, | |
> { MY_SDLK_DOWN, IN_BINDTYPE_PLAYER12, DKEY_DOWN }, | |
> { MY_SDLK_LEFT, IN_BINDTYPE_PLAYER12, DKEY_LEFT }, | |
> { MY_SDLK_RIGHT, IN_BINDTYPE_PLAYER12, DKEY_RIGHT }, | |
> { MY_SDLK_d, IN_BINDTYPE_PLAYER12, DKEY_TRIANGLE }, | |
> { MY_SDLK_z, IN_BINDTYPE_PLAYER12, DKEY_CROSS }, | |
> { MY_SDLK_x, IN_BINDTYPE_PLAYER12, DKEY_CIRCLE }, | |
> { MY_SDLK_s, IN_BINDTYPE_PLAYER12, DKEY_SQUARE }, | |
> { MY_SDLK_v, IN_BINDTYPE_PLAYER12, DKEY_START }, | |
> { MY_SDLK_c, IN_BINDTYPE_PLAYER12, DKEY_SELECT }, | |
> { MY_SDLK_w, IN_BINDTYPE_PLAYER12, DKEY_L1 }, | |
> { MY_SDLK_r, IN_BINDTYPE_PLAYER12, DKEY_R1 }, | |
> { MY_SDLK_e, IN_BINDTYPE_PLAYER12, DKEY_L2 }, | |
> { MY_SDLK_t, IN_BINDTYPE_PLAYER12, DKEY_R2 }, | |
> { MY_SDLK_EJECT, IN_BINDTYPE_EMU, SACTION_CD_CHANGE }, | |
> { MY_SDLK_AUDIOPLAY, IN_BINDTYPE_EMU, SACTION_RESET_EVENT }, | |
> #else | |
50a80,81 | |
> { SDLK_F9, IN_BINDTYPE_EMU, SACTION_CD_CHANGE }, | |
> { SDLK_F10, IN_BINDTYPE_EMU, SACTION_RESET_EVENT }, | |
52a84,86 | |
> { SDLK_EJECT, IN_BINDTYPE_EMU, SACTION_CD_CHANGE }, | |
> { SDLK_AUDIOPLAY, IN_BINDTYPE_EMU, SACTION_RESET_EVENT }, | |
> #endif | |
57a92,103 | |
> #if SDL_MAJOR_VERSION == 2 | |
> { MY_SDLK_UP, PBTN_UP }, | |
> { MY_SDLK_DOWN, PBTN_DOWN }, | |
> { MY_SDLK_LEFT, PBTN_LEFT }, | |
> { MY_SDLK_RIGHT, PBTN_RIGHT }, | |
> { MY_SDLK_RETURN, PBTN_MOK }, | |
> { MY_SDLK_ESCAPE, PBTN_MBACK }, | |
> { MY_SDLK_SEMICOLON, PBTN_MA2 }, | |
> { MY_SDLK_QUOTE, PBTN_MA3 }, | |
> { MY_SDLK_LEFTBRACKET, PBTN_L }, | |
> { MY_SDLK_RIGHTBRACKET, PBTN_R }, | |
> #else | |
67a114,139 | |
> #endif | |
> }; | |
> | |
> const struct menu_keymap in_sdl_joy_map_1[] = | |
> { | |
> #if SDL_MAJOR_VERSION == 2 | |
> { MY_SDLK_UP, PBTN_UP }, | |
> { MY_SDLK_DOWN, PBTN_DOWN }, | |
> { MY_SDLK_LEFT, PBTN_LEFT }, | |
> { MY_SDLK_RIGHT, PBTN_RIGHT }, | |
> /* joystick */ | |
> { MY_SDLK_WORLD_0, PBTN_MA2 }, | |
> { MY_SDLK_WORLD_1, PBTN_MBACK }, | |
> { MY_SDLK_WORLD_2, PBTN_MOK }, | |
> { MY_SDLK_WORLD_3, PBTN_MA3 }, | |
> #else | |
> { SDLK_UP, PBTN_UP }, | |
> { SDLK_DOWN, PBTN_DOWN }, | |
> { SDLK_LEFT, PBTN_LEFT }, | |
> { SDLK_RIGHT, PBTN_RIGHT }, | |
> /* joystick */ | |
> { SDLK_WORLD_0, PBTN_MOK }, | |
> { SDLK_WORLD_1, PBTN_MBACK }, | |
> { SDLK_WORLD_2, PBTN_MA2 }, | |
> { SDLK_WORLD_3, PBTN_MA3 }, | |
> #endif | |
70c142 | |
< const struct menu_keymap in_sdl_joy_map[] = | |
--- | |
> const struct menu_keymap in_sdl_joy_map_2[] = | |
71a144,154 | |
> #if SDL_MAJOR_VERSION == 2 | |
> { MY_SDLK_UP, PBTN_UP }, | |
> { MY_SDLK_DOWN, PBTN_DOWN }, | |
> { MY_SDLK_LEFT, PBTN_LEFT }, | |
> { MY_SDLK_RIGHT, PBTN_RIGHT }, | |
> /* joystick */ | |
> { MY_SDLK_WORLD_0, PBTN_MA2 }, | |
> { MY_SDLK_WORLD_1, PBTN_MOK }, | |
> { MY_SDLK_WORLD_2, PBTN_MBACK }, | |
> { MY_SDLK_WORLD_3, PBTN_MA3 }, | |
> #else | |
80a164,172 | |
> #endif | |
> }; | |
> | |
> static const struct in_pdata in_sdl_platform_data_1 = { | |
> .defbinds = in_sdl_defbinds, | |
> .key_map = in_sdl_key_map, | |
> .kmap_size = sizeof(in_sdl_key_map) / sizeof(in_sdl_key_map[0]), | |
> .joy_map = in_sdl_joy_map_1, | |
> .jmap_size = sizeof(in_sdl_joy_map_1) / sizeof(in_sdl_joy_map_1[0]), | |
83c175 | |
< static const struct in_pdata in_sdl_platform_data = { | |
--- | |
> static const struct in_pdata in_sdl_platform_data_2 = { | |
87,88c179,180 | |
< .joy_map = in_sdl_joy_map, | |
< .jmap_size = sizeof(in_sdl_joy_map) / sizeof(in_sdl_joy_map[0]), | |
--- | |
> .joy_map = in_sdl_joy_map_2, | |
> .jmap_size = sizeof(in_sdl_joy_map_2) / sizeof(in_sdl_joy_map_2[0]), | |
92c184 | |
< static void *shadow_fb, *menubg_img; | |
--- | |
> static void *shadow_fb, *last_shadow_fb, *menubg_img; | |
93a186 | |
> static int menu_leave; | |
133a227,229 | |
> #if SDL_MAJOR_VERSION == 2 | |
> void plat_init(int isGame, int enter_mode) | |
> #else | |
134a231 | |
> #endif | |
141a239,241 | |
> #if SDL_MAJOR_VERSION == 2 | |
> ret = plat_sdl_init(isGame); | |
> #else | |
142a243 | |
> #endif | |
146a248,251 | |
> menu_leave = 0; | |
> #if SDL_MAJOR_VERSION == 2 | |
> SDL_SetWindowTitle(sdl2_window, "PCSX-ReARMed " REV); | |
> #else | |
148,151c253,256 | |
< | |
< shadow_size = g_menuscreen_w * g_menuscreen_h * 2; | |
< if (shadow_size < 640 * 512 * 2) | |
< shadow_size = 640 * 512 * 2; | |
--- | |
> #endif | |
> shadow_size = g_menuscreen_w * g_menuscreen_h * 3; | |
> if (shadow_size < 640 * (576 + 2) * 3) | |
> shadow_size = 640 * (576 + 2) * 3; | |
153a259 | |
> last_shadow_fb = malloc(shadow_size); | |
155c261 | |
< if (shadow_fb == NULL || menubg_img == NULL) { | |