Skip to content

Instantly share code, notes, and snippets.

@xyzz

xyzz/pcsx.diff Secret

Last active July 12, 2020 07:13
Show Gist options
  • Star 23 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save xyzz/5861868db529c0866ada8b8dc51380fa to your computer and use it in GitHub Desktop.
Save xyzz/5861868db529c0866ada8b8dc51380fa to your computer and use it in GitHub Desktop.
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, &registry_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) {
---
> if (shadow_fb == NULL || last_shadow_fb == NULL || menubg_img == NULL) {
159,160c265,270
<
< in_sdl_init(&in_sdl_platform_data, plat_sdl_event_handler);
---
> if (enter_mode == 1) {
> in_sdl_init(&in_sdl_platform_data_1, plat_sdl_event_handler);
> }
> else {
> in_sdl_init(&in_sdl_platform_data_2, plat_sdl_event_handler);
> }
162c272
< pl_rearmed_cbs.only_16bpp = 1;
---
> pl_rearmed_cbs.only_16bpp = 0;
171a282,283
> free(last_shadow_fb);
> last_shadow_fb = NULL;
201a314
> #if SDL_MAJOR_VERSION == 1
219a333
> #endif
223a338
> #if SDL_MAJOR_VERSION == 1
226a342
> #endif
232a349,352
>
> /* workaround for ps logo issue */
> if (psx_w == 640 && psx_h == 472) psx_h = 480;
>
233a354
> #if SDL_MAJOR_VERSION == 1
248a370,383
> #else
> printf("plat_gvideo_set_mode() : plat_sdl_gl_active=%d psx_w=%d,psx_h=%d\n",plat_sdl_gl_active,psx_w,psx_h);
> pl_plat_clear = NULL;
> pl_plat_blit = NULL;
> pl_plat_hud_print = NULL;
> if (plat_sdl_gl_active) {
> printf(" shadow_fb=%0x\n",shadow_fb);
> return shadow_fb;
> }
> else {
> printf(" plat_sdl_screen->pixels=%0x\n",plat_sdl_screen->pixels);
> return plat_sdl_screen->pixels;
> }
> #endif
251c386
< void *plat_gvideo_flip(void)
---
> void *plat_gvideo_flip(int rgb888)
252a388,389
>
> #if SDL_MAJOR_VERSION == 1
259c396,404
< gl_flip(shadow_fb, psx_w, psx_h);
---
> #else
> if (plat_sdl_gl_active) {
> #endif
> if (menu_leave) {
> // restore last shadow_fb
> memcpy(shadow_fb, last_shadow_fb, psx_w * psx_h * (rgb888 ? 3 : 2));
> menu_leave = 0;
> }
> gl_flip(shadow_fb, psx_w, psx_h, rgb888);
263a409,415
> #if SDL_MAJOR_VERSION == 2
> SDL_Window* window;
> SDL_Renderer* renderer;
>
> renderer = SDL_CreateRenderer(window, -1, 0);
> SDL_RenderPresent(renderer);
> #else
264a417
> #endif
273c426
< void plat_video_menu_enter(int is_rom_loaded)
---
> void plat_video_menu_enter(int is_rom_loaded, int bpp)
276a430,431
> printf("frontend/plat_sdl.c : plat_video_menu_enter() : plat_sdl_gl_active=%d is_rom_loaded=%d\n",plat_sdl_gl_active,is_rom_loaded);
>
278a434
> #if SDL_MAJOR_VERSION == 1
286a443,523
> }
> #else
> int depth = bpp;
> if (plat_sdl_gl_active) {
>
> SDL_Surface *source_surface, *target_surface, *darken_surface;
> int ret;
> int pitch = psx_w * depth / 8;
> Uint32 rmask, gmask, bmask;
>
> if (depth == 16) {
> rmask = RMASK_16;
> gmask = GMASK_16;
> bmask = BMASK_16;
> }
> else {
> rmask = RMASK_24;
> gmask = GMASK_24;
> bmask = BMASK_24;
> }
>
> // keep last shdow_fb
> memcpy(last_shadow_fb, shadow_fb, psx_w * psx_h * depth / 8);
>
> // create source surface (original size)
> source_surface = SDL_CreateRGBSurfaceFrom(shadow_fb, psx_w, psx_h, depth, pitch, rmask, gmask, bmask, 0);
> if (source_surface == NULL) {
> printf("failed to create source_surface\n");
> goto out;
> }
> // create target surface (full size)
> target_surface = SDL_CreateRGBSurface(0, g_menuscreen_w, g_menuscreen_h, depth, rmask, gmask, bmask, 0);
> if (target_surface == NULL) {
> printf("failed to create target_surface\n");
> goto out;
> }
> // blit source surface to target surface
> ret = SDL_BlitScaled(source_surface, NULL, target_surface, NULL);
> if (ret < 0) {
> printf("SDL_BlitScaled error\n");
> goto out;
> }
> // create darken surface (full size)
> darken_surface = SDL_CreateRGBSurface(0, g_menuscreen_w, g_menuscreen_h, 32, 0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF);
> if (darken_surface == NULL) {
> printf("failed to create darken_surface\n");
> goto out;
> }
> // set pixels of darken surface
> ret = SDL_FillRect(darken_surface, NULL, SDL_MapRGB(darken_surface->format, 0, 0, 0));
> if (ret < 0) {
> printf("SDL_FillRect error\n");
> goto out;
> }
> // set alpha of darken surface (30%)
> ret = SDL_SetSurfaceAlphaMod(darken_surface, 204);
> if (ret < 0) {
> printf("SDL_SetSurfaceAlphaMod error\n");
> goto out;
> }
> // blit darken surface to target surface
> ret = SDL_BlitSurface(darken_surface, NULL, target_surface, NULL);
> if (ret < 0) {
> printf("SDL_BlitSurface error\n");
> }
>
> memcpy(menubg_img, target_surface->pixels, g_menuscreen_w * g_menuscreen_h * depth / 8);
>
> out:
> SDL_FreeSurface(source_surface);
> SDL_FreeSurface(target_surface);
> SDL_FreeSurface(darken_surface);
>
> pl_vout_buf = menubg_img;
> }
> else {
> memcpy(menubg_img, plat_sdl_screen->pixels, psx_w * psx_h * depth / 8);
> pl_vout_buf = menubg_img;
> printf("memcpy menubg_img=%0x,plat_sdl_screen->pixels=%0x,psx_w=%d,psx_h=%d\n",menubg_img,plat_sdl_screen->pixels,psx_w,psx_h);
> }
> #endif
294a532,533
>
>
296a536
> #if SDL_MAJOR_VERSION == 1
303a544,559
> #else
> printf("frontend/plat_sdl.c : plat_video_menu_begin() : plat_sdl_gl_active=%d\n",plat_sdl_gl_active);
>
> if (plat_sdl_gl_active) {
> g_menuscreen_ptr = shadow_fb;
> }
> else {
> SDL_LockSurface(plat_sdl_screen);
> g_menuscreen_ptr = plat_sdl_screen->pixels;
> }
> printf("plat_video_menu_begin() end\n");
> printf(" shadow_fb=%x\n",shadow_fb);
> printf(" plat_sdl_screen->pixels=%x\n",plat_sdl_screen->pixels);
> printf(" g_menuscreen_ptr=%x\n",g_menuscreen_ptr);
>
> #endif
305a562,565
>
>
>
>
307a568
> #if SDL_MAJOR_VERSION == 1
319c580
< gl_flip(g_menuscreen_ptr, g_menuscreen_w, g_menuscreen_h);
---
> gl_flip(g_menuscreen_ptr, g_menuscreen_w, g_menuscreen_h, 0);
322d582
< SDL_UnlockSurface(plat_sdl_screen);
324a585,619
> #else
> printf("frontend/plat_sdl.c : plat_video_menu_end() : plat_sdl_gl_active=%d\n",plat_sdl_gl_active);
> printf(" plat_sdl_gl_active=%d\n",plat_sdl_gl_active);
>
> if (plat_sdl_gl_active) {
>
> printf("gl_flip() g_menuscreen_ptr=%0x, g_menuscreen_w=%d, g_menuscreen_h=%d\n",g_menuscreen_ptr,g_menuscreen_w,g_menuscreen_h);
>
> //gl_flip(g_menuscreen_ptr, 640, 480);
> gl_flip(g_menuscreen_ptr, g_menuscreen_w, g_menuscreen_h, 0);
>
> printf("gl_flip() end\n");
> }
> else {
>
> SDL_UnlockSurface(plat_sdl_screen);
>
> int fs_w,fs_h;
> SDL_GetWindowSize(sdl2_window, &fs_w, &fs_h);
> printf("plat_video_menu_end: window->W=%d, h=%d \n", fs_w, fs_h);
> printf("plat_video_menu_end: plat_sdl_screen->w=%d, h=%d \n",plat_sdl_screen->w,plat_sdl_screen->h);
>
> #if 0
> sdl2_texture = SDL_CreateTextureFromSurface(sdl2_renderer, plat_sdl_screen);
> SDL_RenderClear(sdl2_renderer);
> SDL_RenderCopy(sdl2_renderer, sdl2_texture, NULL, NULL);
>
> SDL_RenderPresent(sdl2_renderer);
> #else
> SDL_UpdateWindowSurface(sdl2_window);
> #endif
>
>
> }
> #endif
330a626
> menu_leave = 1;
diff --new-file -w -r pcsx_rearmed/frontend/plugin.c pcsx_rearmed_custom/frontend/plugin.c
49a50,51
> extern void CALLBACK SPUfadein(void);
> extern void CALLBACK SPUenableRvbConfig(int);
86a89
> extern void GPUsetPatchFlag(int, int);
87a91
> extern uint32_t GPUboStatus(void);
148a153,154
> DIRECT_SPU(SPUfadein),
> DIRECT_SPU(SPUenableRvbConfig),
180a187
> DIRECT_GPU(GPUsetPatchFlag),
181a189
> DIRECT_GPU(GPUboStatus),
264a273
> pc_hook_func_ret(uint32_t, GPU_boStatus, (void), (), PCNT_GPU)
292a302
> hook_it(GPU_boStatus);
diff --new-file -w -r pcsx_rearmed/frontend/plugin_lib.c pcsx_rearmed_custom/frontend/plugin_lib.c
34a35
> #include "../libpcsxcore/misc.h"
35a37
> #include "../libpcsxcore/title.h"
60a63,113
> static int s_bgr24_old = 0;
> static unsigned char s_scrennshotBuf[1024 *512 * 2];
>
> void set_scenes(int scenes) {
> pl_rearmed_cbs.gpu_peops.scenes = scenes;
> }
>
> #define FRAME_INTERVAL_ADJUSTED 18821
> void change_frame_Motionjpeg(int onoff){
>
> if(onoff){
> frame_interval = 16667;
> frame_interval1024 = 17066667;
> }
> else{
> frame_interval = FRAME_INTERVAL_ADJUSTED;
> frame_interval1024 = FRAME_INTERVAL_ADJUSTED*1024;
> }
> }
>
> #define DO_CANCEL 0x80000000
> void set_bo_trg(int onoff, int ch){
>
> static int trg_off_cnt = 0;
> int region = 0;
> int threshold = 0;
>
> if ((isTitleName(METAL_GEAR_SOLID_DISC_1_JP) ||
> isTitleName(METAL_GEAR_SOLID_DISC_1_US))) {
> if (isTitleName(METAL_GEAR_SOLID_DISC_1_JP)) {
> region = 1;
> threshold = 300*24;
> }
> if (isTitleName(METAL_GEAR_SOLID_DISC_1_US)) {
> region = 2;
> threshold = 300*24;
> }
>
> if (onoff) {
> pl_rearmed_cbs.gpu_unai.lineskip = region;
> trg_off_cnt = 0;
> }
> else {
> if ( trg_off_cnt > threshold) {
> pl_rearmed_cbs.gpu_unai.lineskip = onoff;
> trg_off_cnt = 0;
> }
> trg_off_cnt++;
> }
> }
> }
354a408
> bgr24 = 0;
356a411,421
> if (h - h1 == 1 && isTitleName(IQ_INTELLIGENT_QUBE_JP)) {
> unsigned char blank_src[1024 * 3];
> memset(blank_src, 0x0, sizeof(blank_src));
> bgr888_to_rgb565(dest, blank_src, w * 3);
> } else if (h - h1 < 16 &&
> (isTitleName(SUPER_PUZZLE_FIGHTER_2_TURBO_US) ||
> isTitleName(SUPER_PUZZLE_FIGHTER_2_X_JP))) {
> unsigned char blank_src[1024 * 3];
> memset(blank_src, 0x0, sizeof(blank_src));
> bgr888_to_rgb565(dest, blank_src, w * 3);
> } else {
359a425
> }
366c432,444
< bgr888_to_rgb888(dest, src, w * 3);
---
> if (h - h1 == 1 && isTitleName(IQ_INTELLIGENT_QUBE_JP)) {
> unsigned char blank_src[1024 * 3];
> memset(blank_src, 0x0, sizeof(blank_src));
> memcpy(dest, blank_src, w * 3);
> } else if (h - h1 < 16 &&
> (isTitleName(SUPER_PUZZLE_FIGHTER_2_TURBO_US) ||
> isTitleName(SUPER_PUZZLE_FIGHTER_2_X_JP))) {
> unsigned char blank_src[1024 * 3];
> memset(blank_src, 0x0, sizeof(blank_src));
> memcpy(dest, blank_src, w * 3);
> } else {
> memcpy( dest, src, w * 3 );
> }
400a479,495
> if (h - h1 == 1 && isTitleName(IQ_INTELLIGENT_QUBE_JP)) {
> unsigned char blank_src[1024 * 3];
> memset(blank_src, 0x0, sizeof(blank_src));
> bgr555_to_rgb565(dest, blank_src, w * 2);
> } else if (h - h1 < 16 &&
> (isTitleName(SUPER_PUZZLE_FIGHTER_2_TURBO_US) ||
> isTitleName(SUPER_PUZZLE_FIGHTER_2_X_JP))) {
> unsigned char blank_src[1024 * 3];
> memset(blank_src, 0x0, sizeof(blank_src));
> bgr555_to_rgb565(dest, blank_src, w * 2);
> } else {
> if(isTitleName(ARC_THE_LAD_JP) ||
> isTitleName(ARC_THE_LAD_2_JP) ||
> isTitleName(SAGAFRONTIER_JP) ||
> isTitleName(COOL_BOARDERS_2_EU)) {
> bgr555_to_rgb565_without_neon(dest, src, w * 2);
> } else {
403a499,533
> }
> }
>
> // bottom blank
> int blank_pixel = 2;
> if (isTitleName(MR_DRILLER_EU) ||
> isTitleName(MR_DRILLER_JP) ||
> isTitleName(MR_DRILLER_US)) {
> blank_pixel = 6;
> }
> paint_black(dest, dstride * blank_pixel * pl_vout_bpp / 8);
> dest += dstride * blank_pixel * pl_vout_bpp / 8;
>
> // PLF-363 Blink RYU silhouette
> if (isTitleName(GRAN_TURISMO_EU) ||
> isTitleName(GRAN_TURISMO_JP) ||
> isTitleName(GRAN_TURISMO_US) ||
> isTitleName(STREET_FIGHTER_ALPHA_3_US)) {
> //static unsigned short former_rgb565[2][w * h];
> static unsigned short former_rgb565[2][640 * 512]; // show frontend/plat_sdl.c:224
> static int voutCnt = 0;
> unsigned short *us_pl_vout_buf = (unsigned short *)pl_vout_buf;
> unsigned short *pformer_rgb565;
>
> pformer_rgb565 = &former_rgb565[voutCnt][0];
> memcpy(pformer_rgb565, pl_vout_buf, sizeof(former_rgb565) / 2);
>
> voutCnt ^= 0x01;
> pformer_rgb565 = &former_rgb565[voutCnt][0];
>
> for(int i = 0; i < (sizeof(former_rgb565) / 2) / sizeof(unsigned short) ; i ++) {
> unsigned short us0 = \
> (*(us_pl_vout_buf + i) >> 1) & 0x7bef; // mask rgb msb (0x7bef = 0111 1011 1110 1111)
> unsigned short us1 = \
> (*(pformer_rgb565 + i) >> 1) & 0x7bef; // mask rgb msb ( --R- -===G===- -B--)
404a535,537
> *(us_pl_vout_buf + i) = us0 + us1;
> }
> }
410a544,547
> if( dest != NULL ){
> s_bgr24_old = bgr24;
> }
>
412c549
< pl_vout_buf = plat_gvideo_flip();
---
> pl_vout_buf = plat_gvideo_flip( s_bgr24_old );
419a557,565
> void paint_black(void *dst_, int bytes) {
> unsigned short *dst = dst_;
> int x;
>
> for (x = 0; x < bytes / 2; x++) {
> dst[x] = 0;
> }
> }
>
456a603,607
> if( s_bgr24_old ){
> *bpp = 16;
> bgr888_to_rgb565(s_scrennshotBuf, pl_vout_buf, pl_vout_w * pl_vout_h * 3 );
> return s_scrennshotBuf;
> }else{
459a611,612
> }
>
593a747,748
> #define ONE_CONTROLLER 0
> #define TWO_CONTROLLER 16
612a768,780
> // auto save state
> if (time_to_sync_state && emu_act != SACTION_CD_CHANGE) {
> emu_set_action(SACTION_SYNC_STATE);
> }
> // auto_power_off
> if (power_off_flg) {
> emu_set_action(SACTION_POWER_OFF);
> }
> // error : cpu temperature is too high
> if (is_high_temperature) {
> save_error(ERROR_CPUOVERHEAT, "CPU temperature is too high.");
> emu_set_action(SACTION_RESET_EVENT);
> }
614a783,791
>
> if (isTitleName(METAL_GEAR_SOLID_DISC_1_JP) ||
> isTitleName(METAL_GEAR_SOLID_DISC_1_US)) {
> if (pl_rearmed_cbs.gpu_unai.lineskip &&
> ((in_keystate & (1 << DKEY_START + ONE_CONTROLLER)) ||
> (in_keystate & (1 << DKEY_START + TWO_CONTROLLER)))) {
> pl_rearmed_cbs.gpu_unai.lineskip |= DO_CANCEL;
> }
> }
734a912,924
>
> if(isTitleName(METAL_GEAR_SOLID_DISC_1_JP) ||
> isTitleName(METAL_GEAR_SOLID_DISC_2_JP) ||
> isTitleName(METAL_GEAR_SOLID_DISC_1_US) ||
> isTitleName(METAL_GEAR_SOLID_DISC_2_US)) {
> frame_interval = is_pal ? 20000 : FRAME_INTERVAL_ADJUSTED;
> frame_interval1024 = is_pal ? 20000*1024 : FRAME_INTERVAL_ADJUSTED*1024;
> }
> else if(isTitleName(SAGAFRONTIER_JP)) {
> frame_interval = is_pal ? 20000 : 18377;
> frame_interval1024 = is_pal ? 20000*1024 : 18377*1024;
> }
> else {
736a927
> }
diff --new-file -w -r pcsx_rearmed/frontend/plugin_lib.h pcsx_rearmed_custom/frontend/plugin_lib.h
70a71
> int iTrimJaggyFrame;
73a75,78
> int isToShinDen;
> int isBiosLogoEnd;
> int scenes;
> int regions;
102a108,119
> enum msg_scenes{
> NO_SCENES = 0,
> MSG_SCENE1,
> MSG_SCENE2,
> MSG_SCENE3,
> MSG_SCENE4,
> MSG_SCENE5,
> MSG_SCENE6,
> MSG_SCENE7,
> MSG_SCENE8
> };
>
Binary files pcsx_rearmed/frontend/warm/bin/warm_2.4.25.o and pcsx_rearmed_custom/frontend/warm/bin/warm_2.4.25.o differ
Binary files pcsx_rearmed/frontend/warm/bin/warm_2.4.26-open2x.o and pcsx_rearmed_custom/frontend/warm/bin/warm_2.4.26-open2x.o differ
diff --new-file -w -r pcsx_rearmed/frontend/warm/.gitignore pcsx_rearmed_custom/frontend/warm/.gitignore
1d0
< *.o
diff --new-file -w -r pcsx_rearmed/.gitignore pcsx_rearmed_custom/.gitignore
1,13d0
< *.o
< *.a
< *.so
< tags
< cscope.out
< pandora
< pcsx.map
< config.mak
< config.log
< frontend/revision.h
< tools
< .pcsx/
< obj/
diff --new-file -w -r pcsx_rearmed/.gitmodules pcsx_rearmed_custom/.gitmodules
1,6d0
< [submodule "libpicofe"]
< path = frontend/libpicofe
< url = git://notaz.gp2x.de/~notaz/libpicofe.git
< [submodule "warm"]
< path = frontend/warm
< url = git://notaz.gp2x.de/~notaz/warm.git
diff --new-file -w -r pcsx_rearmed/libpcsxcore/cdriso.c pcsx_rearmed_custom/libpcsxcore/cdriso.c
223,224c223,224
< // can't do it yet due to readahead..
< //cdrAttenuate((short *)sndbuffer, s / 4, 1);
---
> cdrAttenuate((short *)sndbuffer, s / 4, 1);
>
1040c1040
< strcpy(subname + strlen(subname) - 4, ".sub");
---
> strcpy(subname + strlen(subname) - 4, ".otf");
1281c1281
< SysPrintf("[+sub]");
---
> SysPrintf("[+otf]");
1482,1483c1482,1488
< fseek(subHandle, sector * SUB_FRAMESIZE, SEEK_SET);
< fread(subbuffer, 1, SUB_FRAMESIZE, subHandle);
---
> int r = fseek(subHandle, sector * SUB_FRAMESIZE, SEEK_SET);
> if (r == 0) {
> if (fread(subbuffer, 1, SUB_FRAMESIZE, subHandle) < SUB_FRAMESIZE)
> memset(subbuffer, 0, sizeof(subbuffer));
> } else {
> memset(subbuffer, 0, sizeof(subbuffer));
> }
diff --new-file -w -r pcsx_rearmed/libpcsxcore/cdrom.c pcsx_rearmed_custom/libpcsxcore/cdrom.c
27a28,32
> #include "title.h"
> #include "misc.h"
> #include "../plugins/dfsound/externals.h"
> #include "../plugins/dfsound/spu_config.h"
> #include "../frontend/plugin_lib.h"
49a55,59
> int is_disc_change = 0;
> int is_nop_count = 0;
> int nop_cnt = 0;
> static int scenes=0;
>
138c148,155
<
---
> // video sector head
> #define CD_STR_HEAD (0x80010160)
> #define CD_STR_HEAD_SIZE (0x20)
>
> #define H_CDLeft 0x0db0
> #define SET_VOLUME_L 0x1f801c00
> #define SET_VOLUME_R 0x1f801c12
> #define MAX_VOLUME 0x7fff
153a171,184
> static int isUseBuf = 0;
> static int arc_sec_count = 0;
> static int arc_sec_not_read = 0;
>
> static int RunBiosLogoFarst = 0;
>
> int Loading2Setloc = 0;
>
> int xaSave_iLeftVolume;
> int xaSave_iRightVolume;
> unsigned char State_CdlPause;
>
> #define ARC_BUFF_MAX (10)
> static unsigned char arcSecBuf[ARC_BUFF_MAX][DATA_SIZE];
228a260,349
> extern void change_HSync_Motionjpeg(int onfoff);
> extern void change_frame_Motionjpeg(int onfoff);
> extern void check_Motionjpeg(unsigned char arg1, unsigned char arg2, unsigned char arg3);
> extern void set_scenes(int scenes);
>
> int CheckDiscChange(unsigned short irq)
> {
> // check exit conditions
> if ((is_disc_change || is_nop_count) && irq != CdlNop && irq != CdlSetmode && irq != CdlGetTN && irq != CdlSetloc && irq != CdlStop) {
> is_nop_count = 0;
> nop_cnt = 0;
> return 0;
> }
>
> // check initiation conditions
> if (!is_disc_change) {
> switch (disc_change_type) {
> case 1:
> if (irq == CdlStop) {
> is_nop_count = 0;
> nop_cnt = 0;
> return 1;
> }
> else if (irq == CdlPause) {
> is_nop_count = 1;
> }
> else if (irq == CdlNop && is_nop_count) {
> nop_cnt++;
> if (nop_cnt >= 20) {
> is_nop_count = 0;
> nop_cnt = 0;
> return 1;
> }
> }
> break;
> case 2:
> if (irq == CdlStop) {
> is_nop_count = 0;
> nop_cnt = 0;
> return 1;
> }
> else if (irq == CdlPause || irq == CdlReadN || irq == CdlReadS) {
> is_nop_count = 1;
> }
> else if (irq == CdlNop && is_nop_count) {
> nop_cnt++;
> if (nop_cnt >= 20) {
> is_nop_count = 0;
> nop_cnt = 0;
> return 1;
> }
> }
> break;
> case 3:
> if (irq == CdlStop) {
> is_nop_count = 0;
> nop_cnt = 0;
> return 1;
> }
> break;
> case 4:
> if (irq == CdlStop || irq == CdlPause) {
> is_nop_count = 0;
> nop_cnt = 0;
> return 1;
> }
> break;
> case 5:
> if (irq == CdlStop || irq == CdlReadN || irq == CdlReadS) {
> is_nop_count = 0;
> nop_cnt = 0;
> return 1;
> }
> else if (irq == CdlPause) {
> is_nop_count = 1;
> }
> else if (irq == CdlNop && is_nop_count) {
> nop_cnt++;
> if (nop_cnt >= 20) {
> is_nop_count = 0;
> nop_cnt = 0;
> return 1;
> }
> }
> }
> return 0;
> }
> return 1;
> }
>
384a506,518
> if (isTitleName(METAL_GEAR_SOLID_DISC_1_JP) ||
> isTitleName(METAL_GEAR_SOLID_DISC_1_US) ||
> isTitleName(METAL_GEAR_SOLID_DISC_2_JP) ||
> isTitleName(METAL_GEAR_SOLID_DISC_2_US)) {
> check_Motionjpeg(tmp[0], tmp[1], tmp[2]);
> check_scenes(tmp[0], tmp[1], tmp[2]);
> }
>
> if (isTitleName(WILD_ARMS_US) ||
> isTitleName(WILD_ARMS_JP)) {
> check_scenesforSPU(tmp[0], tmp[1], tmp[2]);
> }
>
393,394c527,529
< crc = calcCrc((u8 *)subq + 12, 10);
< if (crc == (((u16)subq->CRC[0] << 8) | subq->CRC[1])) {
---
> // crc = calcCrc((u8 *)subq + 12, 10);
> // if (crc == (((u16)subq->CRC[0] << 8) | subq->CRC[1])) {
> if (subq->TrackNumber != 0) {
400a536
> generate_subq(time);
505c641,648
< if (!cdr.Play) return;
---
> if (!cdr.Play){
> if (isTitleName(TOSHINDEN_EU) ||
> isTitleName(TOSHINDEN_JP) ||
> isTitleName(TOSHINDEN_US)) {
> SPU_writeRegister(H_CDLeft, 0, psxRegs.cycle);
> }
> return;
> }
817a961,987
>
> if (isTitleName(WILD_ARMS_US)) {
> if(cdr.SetSector[0] == 0x20 && cdr.SetSector[1] == 0x1c && cdr.SetSector[2] == 0x3d && scenes) {
> cdr.Seeked = SEEK_DONE;
> cdr.Stat = Complete;
> break;
> } else if(cdr.SetSector[0] == 0x26 && cdr.SetSector[1] == 0x32 && cdr.SetSector[2] == 0xb && scenes) {
> if (msf2sec(cdr.SetSector) <= msf2sec(cdr.SetSectorPlay)) {
> cdr.Seeked = SEEK_DONE;
> cdr.Stat = Complete;
> break;
> }
> }
> } else if (isTitleName(WILD_ARMS_JP)) {
> if(cdr.SetSector[0] == 0x20 && cdr.SetSector[1] == 0x1d && cdr.SetSector[2] == 0x6 && scenes) {
> cdr.Seeked = SEEK_DONE;
> cdr.Stat = Complete;
> break;
> } else if(cdr.SetSector[0] == 0x26 && cdr.SetSector[1] == 0x32 && cdr.SetSector[2] == 0x1f && scenes) {
> if (msf2sec(cdr.SetSector) <= msf2sec(cdr.SetSectorPlay)) {
> cdr.Seeked = SEEK_DONE;
> cdr.Stat = Complete;
> break;
> }
> }
> }
>
880c1050,1067
< strncpy((char *)&cdr.Result[4], "PCSX", 4);
---
> switch (CdromId[2]) {
> case 'P':
> case 'p':
> strncpy((char *)&cdr.Result[4], "SCEI", 4);
> break;
> // To compliance the requirement, remove trademark notification
> // case 'E':
> // case 'e':
> // strncpy((char *)&cdr.Result[4], "SCEE", 4);
> // break;
> // case 'U':
> // case 'u':
> // strncpy((char *)&cdr.Result[4], "SCEA", 4);
> // break;
> default:
> strncpy((char *)&cdr.Result[4], " ", 4);
> break;
> }
1026a1214
> int shift;
1033a1222,1247
> if (isTitleName(ARMORED_CORE_JP) ||
> 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(JUMPING_FLASH_EU) ||
> isTitleName(JUMPING_FLASH_JP) ||
> isTitleName(JUMPING_FLASH_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(TEKKEN3_EU) ||
> isTitleName(TEKKEN3_JP)) {
> shift = 8;
> } else {
> shift = 7;
> }
>
1038,1039c1252,1253
< l = (l * ll + r * rl) >> 7;
< r = (r * rr + l * lr) >> 7;
---
> l = (l * ll + r * rl) >> shift;
> r = (r * rr + l * lr) >> shift;
1049c1263,1269
< l = l * (ll + rl) >> 7;
---
> /* PLF-409 DEL Start */
> // l = l * (ll + rl) >> 7;
> /* PLF-409 DEL End */
> if (isTitleName(MEDIEVIL_EU) ||
> isTitleName(MEDIEVIL_US)) {
> l = l * (ll + rl) >> shift;
> }
1076a1297,1304
> if (isTitleName(DESTRUCTION_DERBY_EU) &&
> Loading2Setloc &&
> cdr.SetSectorPlay[0] == 0 &&
> cdr.SetSectorPlay[1] == 2 &&
> cdr.SetSectorPlay[2] == 23) {
> cdr.SetSectorPlay[2] = 22;
> }
>
1091a1320,1350
> const char searchLicenseString[] =
> " Licensed by Sony Computer Entertainment(Europe)\0\0\0\0";
> const char changeLicenseString[] =
> " Licensed by Sony Computer Entertainment(Eur ope) \0";
>
> int searchLicenseStringLen = sizeof(searchLicenseString) - 1;
> int cnt = 0;
> int foundCnt = 0;
>
> if ((cdr.SetSectorPlay[0] == 0) &&
> (cdr.SetSectorPlay[1] == 2) &&
> (cdr.SetSectorPlay[2] == 4) &&
> (cdr.SetSectorPlay[3] == 0)) {
>
> // License string area.
> while(cnt != DATA_SIZE) {
> if (*(buf + cnt) == searchLicenseString[foundCnt]) {
> if(++foundCnt == searchLicenseStringLen) {
> // found !!
> memcpy(buf + cnt - searchLicenseStringLen + 1,
> changeLicenseString,
> searchLicenseStringLen);
> break;
> }
> } else {
> foundCnt = 0;
> }
> cnt ++;
> }
> }
>
1094a1354,1361
> if (isTitleName(PACAPACA_PASSION_JP)) {
> if (isUseBuf) {
> if (arc_sec_count >= ARC_BUFF_MAX)
> arc_sec_count = 0;
> memcpy(arcSecBuf[arc_sec_count++], buf, DATA_SIZE);
> CheckPPFCache(arcSecBuf[arc_sec_count-1], cdr.Prev[0], cdr.Prev[1], cdr.Prev[2]);
> }
> }
1117a1385,1390
> if (isTitleName(PARAPPA_THE_RAPPER_US)
> && cdr.SetSectorPlay[0] == 62
> && cdr.SetSectorPlay[1] == 53
> && cdr.SetSectorPlay[2] == 66) {
> cdrWrite1(0x08);
> }
1129a1403,1425
> if (isTitleName(IQ_INTELLIGENT_QUBE_JP) &&
> cdr.SetSectorPlay[0] == 1 &&
> cdr.SetSectorPlay[1] == 55 &&
> (57 <= cdr.SetSectorPlay[2] && cdr.SetSectorPlay[2] <= 74)) {
> CDREAD_INT(cdReadTime / 2 * 0.5);
> } else if (isTitleName(IQ_INTELLIGENT_QUBE_US) &&
> cdr.SetSectorPlay[0] == 1 &&
> cdr.SetSectorPlay[1] == 20 &&
> (60 <= cdr.SetSectorPlay[2] && cdr.SetSectorPlay[2] <= 74)) {
> CDREAD_INT(cdReadTime / 2 * 0.5);
> } else if (isTitleName(WILD_ARMS_JP) &&
> cdr.SetSectorPlay[0] == 32 &&
> cdr.SetSectorPlay[1] == 29 &&
> (7 <= cdr.SetSectorPlay[2] && cdr.SetSectorPlay[2] <= 50)) {
> CDREAD_INT(cdReadTime / 2 * 0.9);
> } else if (isTitleName(WILD_ARMS_US) &&
> cdr.SetSectorPlay[0] == 32 &&
> (cdr.SetSectorPlay[1] == 28 &&
> (61 <= cdr.SetSectorPlay[2] && cdr.SetSectorPlay[2] <= 74)) ||
> (cdr.SetSectorPlay[1] == 29 &&
> (0 <= cdr.SetSectorPlay[2] && cdr.SetSectorPlay[2] <= 30))) {
> CDREAD_INT(cdReadTime / 2 * 0.9);
> } else {
1130a1427
> }
1227a1525,1526
> is_disc_change = CheckDiscChange(cdr.Cmd);
>
1229a1529
>
1230a1531,1970
> if (isTitleName(ARC_THE_LAD_JP)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x24 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 375);
> RunBiosLogoFarst = 1;
> } else if (cdr.Cmd == CdlPause &&
> cdr.SetSector[0] == 9 &&
> cdr.SetSector[1] == 41 &&
> cdr.SetSector[2] == 43) {
> SPU_enableRvbConfig(1);
> AddIrqQueue(cdr.Cmd, 0x800);
> } else if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x38 &&
> cdr.Param[1] == 0x24 &&
> cdr.Param[2] == 0x11) {
> SPU_enableRvbConfig(0);
> AddIrqQueue(cdr.Cmd, 0x800);
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(ARC_THE_LAD_2_JP)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x26 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 300);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(ARMORED_CORE_JP)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x22 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 450);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(COOL_BOARDERS_2_EU)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x25 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 450);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(CRASH_BANDICOOT_EU)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x24 &&
> cdr.Param[1] == 0x15 &&
> cdr.Param[2] == 0x4) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 60);
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(CRASH_BANDICOOT_US)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x24 &&
> cdr.Param[1] == 0x29 &&
> cdr.Param[2] == 0x1) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 60);
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(DESTRUCTION_DERBY_EU)) {
> if( cdr.Cmd == CdlSetloc) {
> if (cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x22) {
> Loading2Setloc = 1;
> } else {
> Loading2Setloc = 0;
> }
> }
>
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x22 &&
> cdr.Param[2] == 0x1 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 300);
> RunBiosLogoFarst = 1;
>
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(FINAL_FANTANSY_VII_DICS_1_US) ||
> isTitleName(FINAL_FANTANSY_VII_DICS_1_JP)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x25 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 450);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(G_DARIUS_JP)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x25 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 450);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(GRADIUS_GAIDEN_JP)) {
> if (cdr.Cmd == CdlPause) {
> State_CdlPause = 1;
> xaSave_iLeftVolume = 0xFFFF;
> xaSave_iRightVolume =0xFFFF;
> } else if (cdr.Cmd == CdlSetloc && State_CdlPause == 1) {
> if (xaSave_iLeftVolume != 0xFFFF) {
> spu.iLeftXAVol = xaSave_iLeftVolume;
> xaSave_iLeftVolume = 0xFFFF;
> }
> if (xaSave_iRightVolume != 0xFFFF) {
> spu.iRightXAVol = xaSave_iRightVolume;
> xaSave_iRightVolume = 0xFFFF;
> }
> State_CdlPause = 0;
> }
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x22 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 375);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(GRAND_THEFT_AUTO_EU)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x22 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 450);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
> if (RunBiosLogoFarst == 1 &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x25) {
> spu.dwNewChannel&=~(1<<4);
> spu.dwNewChannel&=~(1<<5);
> spu.s_chan[4].ADSRX.ReleaseRate = 0x5;
> spu.s_chan[5].ADSRX.ReleaseRate = 0x5;
> spu.s_chan[4].ADSRX.State = ADSR_RELEASE;
> spu.s_chan[5].ADSRX.State = ADSR_RELEASE;
> RunBiosLogoFarst = 0xFF;
> }
>
> } else if (isTitleName(G_DARIUS_JP)) {
> if((cdr.Cmd == CdlSetloc && cdr.Param[0] == 0x00 && cdr.Param[1] == 0x10 && cdr.Param[2] == 0x53) ||
> (cdr.Cmd == CdlSetloc && cdr.Param[0] == 0x27 && cdr.Param[1] == 0x19 && cdr.Param[2] == 0x64) ||
> (cdr.Cmd == CdlSetloc && cdr.Param[0] == 0x27 && cdr.Param[1] == 0x19 && cdr.Param[2] == 0x65)) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 60);
> } else if((cdr.Cmd == CdlSetloc && cdr.Param[0] == 0x00 && cdr.Param[1] == 0x19 && cdr.Param[2] == 0x42) ||
> (cdr.Cmd == CdlSetloc && cdr.Param[0] == 0x00 && cdr.Param[1] == 0x13 && cdr.Param[2] == 0x37) ||
> (cdr.Cmd == CdlSetloc && cdr.Param[0] == 0x00 && cdr.Param[1] == 0x14 && cdr.Param[2] == 0x38) ||
> (cdr.Cmd == CdlSetloc && cdr.Param[0] == 0x01 && cdr.Param[1] == 0x51 && cdr.Param[2] == 0x16)) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 58);
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(IQ_INTELLIGENT_QUBE_JP) ||
> isTitleName(IQ_INTELLIGENT_QUBE_US)) {
> if (cdr.Cmd == CdlReadS) {
> unsigned short volume = isTitleName(IQ_INTELLIGENT_QUBE_JP) ?
> IQ_JP_MAX_VOLUME : IQ_US_MAX_VOLUME;
> SPU_writeRegister(H_CDLeft, volume, psxRegs.cycle);
> }
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x22 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 450);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(JUMPING_FLASH_EU) ||
> isTitleName(JUMPING_FLASH_JP)) {
> if (isTitleName(JUMPING_FLASH_JP)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x25 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 450);
> RunBiosLogoFarst = 1;
> } else if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x50 &&
> cdr.Param[1] == 0x30 &&
> cdr.Param[2] == 0x38) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 7);
> } else if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x8 &&
> cdr.Param[1] == 0x20 &&
> cdr.Param[2] == 0x13) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 7);
> } else if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x50 &&
> cdr.Param[1] == 0x44 &&
> cdr.Param[2] == 0x59) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 7);
> } else if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x15 &&
> cdr.Param[1] == 0x7 &&
> cdr.Param[2] == 0x24) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 7);
> } else if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x50 &&
> cdr.Param[1] == 0x59 &&
> cdr.Param[2] == 0x13) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 7);
> } else if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x22 &&
> cdr.Param[1] == 0x17 &&
> cdr.Param[2] == 0x70) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 7);
> } else if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x51 &&
> cdr.Param[1] == 0x13 &&
> cdr.Param[2] == 0x34) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 7);
> } else if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x29 &&
> cdr.Param[1] == 0x42 &&
> cdr.Param[2] == 0x71) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 7);
> } else if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x51 &&
> cdr.Param[1] == 0x27 &&
> cdr.Param[2] == 0x55) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 7);
> } else if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x36 &&
> cdr.Param[1] == 0x4 &&
> cdr.Param[2] == 0x61) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 7);
> } else if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x43 &&
> cdr.Param[1] == 0x11 &&
> cdr.Param[2] == 0x68) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 7);
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
> } else {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x25 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 450);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
> }
>
> } else if (isTitleName(KAGERO_JP)) {
> if (cdr.Cmd == CdlSetloc) {
> if (cdr.Param[0] == 0x24 && cdr.Param[1] == 0x16 && cdr.Param[2] == 0x64) {
> //movie
> AddIrqQueue(cdr.Cmd, cdReadTime * 15);
> } else if (cdr.Param[0] == 0x28 && cdr.Param[1] == 0x31 && cdr.Param[2] == 0x43) {
> //config
> AddIrqQueue(cdr.Cmd, cdReadTime * 25);
> } else if (cdr.Param[0] == 0x30 && cdr.Param[1] == 0x56 && cdr.Param[2] == 0x56) {
> //trapMake
> AddIrqQueue(cdr.Cmd, cdReadTime * 30);
> } else if (cdr.Param[0] == 0x35 && cdr.Param[1] == 0x42 && cdr.Param[2] == 0x73) {
> //logo
> AddIrqQueue(cdr.Cmd, cdReadTime);
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(MEDIEVIL_EU)) {
> if (cdr.Cmd == CdlSetloc) {
> if ((cdr.Param[0] == 0x43 && cdr.Param[1] == 0x16 && cdr.Param[2] == 0x2) ||
> (cdr.Param[0] == 0x49 && cdr.Param[1] == 0x12 && cdr.Param[2] == 0x54)) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 5);
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(MEDIEVIL_US)) {
> if (cdr.Cmd == CdlSetloc) {
> if ((cdr.Param[0] == 0x38 && cdr.Param[1] == 0x7 && cdr.Param[2] == 0x26) ||
> (cdr.Param[0] == 0x44 && cdr.Param[1] == 0x4 && cdr.Param[2] == 0x3)) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 5);
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(METAL_GEAR_SOLID_DISC_1_EU) ||
> isTitleName(METAL_GEAR_SOLID_DISC_1_JP) ||
> isTitleName(METAL_GEAR_SOLID_DISC_1_US)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x22 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 400);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(MR_DRILLER_US) ||
> isTitleName(MR_DRILLER_JP)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x25 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 150);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(ODDWORLD_ABES_ODDYSEE_EU)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x25 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 400);
> RunBiosLogoFarst = 1;
> } else if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x09 &&
> cdr.Param[1] == 0x57 &&
> cdr.Param[2] == 0x61) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 60);
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(ODDWORLD_ABES_ODDYSEE_US)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x25 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 400);
> RunBiosLogoFarst = 1;
> } else if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x09 &&
> cdr.Param[1] == 0x58 &&
> cdr.Param[2] == 0x64) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 60);
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(PARASITE_EVE_DISC_1_US) ||
> isTitleName(PARASITE_EVE_DISC_1_JP)) {
> if (isTitleName(PARASITE_EVE_DISC_1_JP)){
> if (cdr.Cmd == CdlSetloc) {
> if( (cdr.Param[0] == 0x2 && cdr.Param[1] == 0x11 && cdr.Param[2] == 0x63) ||
> (cdr.Param[0] == 0x0 && cdr.Param[1] == 0x27 && cdr.Param[2] == 0x64) ) {
> spu_config.iTempo = 1;
> } else if( (cdr.Param[0] == 0x0 && cdr.Param[1] == 0x17 && cdr.Param[2] == 0x44) ||
> (cdr.Param[0] == 0x11 && cdr.Param[1] == 0x9 && cdr.Param[2] == 0x37)) {
> spu_config.iTempo = 0;
> } else if (cdr.Param[0] == 0x40 && cdr.Param[1] == 0x38 && cdr.Param[2] == 0x42) {
> SPU_writeRegister(SET_VOLUME_L, PARASITE_EVE_JP_DISABLE_VOLUME, psxRegs.cycle);
> SPU_writeRegister(SET_VOLUME_R, PARASITE_EVE_JP_DISABLE_VOLUME, psxRegs.cycle);
> } else if (cdr.Param[0] == 0x11 && cdr.Param[1] == 0x8 && cdr.Param[2] == 0x6) {
> SPU_enableRvbConfig(1);
> } else if (cdr.Param[0] == 0x11 && cdr.Param[1] == 0x11 && cdr.Param[2] == 0x68) {
> SPU_enableRvbConfig(0);
> }
> }
> }
>
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x15 &&
> cdr.Param[2] == 0x38) {
> spu_config.iTempo = 1;
> }
>
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x25 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 150);
> RunBiosLogoFarst = 1;
> } else if (isTitleName(PARASITE_EVE_DISC_1_JP) &&
> cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x2 &&
> cdr.Param[1] == 0x11 &&
> cdr.Param[2] == 0x63) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 30);
> } else {
1231a1972,2231
> }
>
> } else if (isTitleName(PARASITE_EVE_DISC_2_US) ||
> isTitleName(PARASITE_EVE_DISC_2_JP)) {
> if (cdr.Cmd == CdlSetloc) {
> if( cdr.Param[0] == 0x11 &&
> cdr.Param[1] == 0x35 &&
> cdr.Param[2] == 0x10) {
> spu_config.iTempo = 0;
> } else if (cdr.Param[0] == 0x11 &&
> cdr.Param[1] == 0x35 &&
> cdr.Param[2] == 0x18) {
> spu_config.iTempo = 0;
> }
> }
> AddIrqQueue(cdr.Cmd, 0x800);
>
> } else if (isTitleName(PERSONA_JP) ||
> isTitleName(PERSONA_US)) {
> if (isTitleName(PERSONA_JP) && cdr.Cmd == CdlSetloc) {
> if (cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x14 &&
> cdr.Param[2] == 0x61) {
> // "Adjust tempo" ON
> spu_config.iTempo = 1;
> }
> } else if (isTitleName(PERSONA_US) && cdr.Cmd == CdlSetloc) {
> if (cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x17 &&
> cdr.Param[2] == 0x15) {
> // "Adjust tempo" ON
> spu_config.iTempo = 1;
> }
> }
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x22 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 400);
> RunBiosLogoFarst = 1;
> // "Adjust tempo" OFF
> spu_config.iTempo = 0;
> } else if (isTitleName(PERSONA_JP) && cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x18 &&
> cdr.Param[1] == 0x57 &&
> cdr.Param[2] == 0x6) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 45);
> } else if (isTitleName(PERSONA_US) && cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x18 &&
> cdr.Param[1] == 0x57 &&
> cdr.Param[2] == 0x33) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 45);
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(RAYMAN_US)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x25 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 400);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(RESIDENT_EVIL_EU) ||
> isTitleName(RESIDENT_EVIL_JP) ||
> isTitleName(RESIDENT_EVIL_US)) {
>
> if (isTitleName(RESIDENT_EVIL_JP)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x35 &&
> cdr.Param[1] == 0x35 &&
> cdr.Param[2] == 0x42) {
> // NewGame selected "Adjust tempo" ON
> spu_config.iTempo = 1;
> } else if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x35 &&
> cdr.Param[1] == 0x35 &&
> cdr.Param[2] == 0x40) {
> // CharacterSelect selected "Adjust tempo" OFF
> spu_config.iTempo = 0;
> }
> }
>
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x22 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 300);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
> if (RunBiosLogoFarst == 1 &&
> ((cdr.Param[0] == 0x65 && cdr.Param[1] == 0x14 && cdr.Param[2] == 0x4) || //US
> (cdr.Param[0] == 0x63 && cdr.Param[1] == 0x53 && cdr.Param[2] == 0x47) || //JP
> (cdr.Param[0] == 0x63 && cdr.Param[1] == 0x17 && cdr.Param[2] == 0x4))) { //EU
> spu.dwNewChannel&=~(1<<4);
> spu.dwNewChannel&=~(1<<5);
> spu.s_chan[4].ADSRX.State = ADSR_RELEASE;
> spu.s_chan[5].ADSRX.State = ADSR_RELEASE;
> RunBiosLogoFarst = 0xFF;
> }
>
> } else if (isTitleName(RIDGE_RACER_TYPE_4_EU) ||
> isTitleName(RIDGE_RACER_TYPE_4_JP) ||
> isTitleName(RIDGE_RACER_TYPE_4_US)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x25 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 400);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(SAGAFRONTIER_JP)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x25 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 300);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(SUPER_PUZZLE_FIGHTER_2_TURBO_US)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x25 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 450);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(SUPER_PUZZLE_FIGHTER_2_X_JP)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x25 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 375);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(SYPHON_FILTER_US)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x25 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 150);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(TEKKEN3_EU) ||
> isTitleName(TEKKEN3_JP)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x25 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 150);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(TOM_CLANCYS_RAINBOW_SIX_EU)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x22 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 450);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(TOSHINDEN_EU) ||
> isTitleName(TOSHINDEN_JP) ||
> isTitleName(TOSHINDEN_US)) {
> if (cdr.Cmd == CdlPlay) {
> unsigned short volume = isTitleName(TOSHINDEN_JP) ?
> TOSHINDEN_JP_DEFAULT_VOLUME : TOSHINDEN_DEFAULT_VOLUME;
> SPU_writeRegister(H_CDLeft, volume | 0x8000, psxRegs.cycle);
> } else if (cdr.Cmd == CdlPause) {
> SPU_writeRegister(H_CDLeft, 0x8000, psxRegs.cycle);
> }
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x25 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 450);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(TWISTED_METAL_US)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x25 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 450);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(WILD_ARMS_US) ||
> isTitleName(WILD_ARMS_JP)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x25 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 450);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> } else if (isTitleName(XI_EU) ||
> isTitleName(XI_JP)) {
> if (cdr.Cmd == CdlSetloc &&
> cdr.Param[0] == 0x0 &&
> cdr.Param[1] == 0x2 &&
> cdr.Param[2] == 0x25 &&
> RunBiosLogoFarst == 0) {
> AddIrqQueue(cdr.Cmd, cdReadTime * 450);
> RunBiosLogoFarst = 1;
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
> } else {
> AddIrqQueue(cdr.Cmd, 0x800);
> }
>
> if (RunBiosLogoFarst) pl_rearmed_cbs.gpu_peops.isBiosLogoEnd = 1;
1245a2246,2261
> if (isTitleName(PACAPACA_PASSION_JP)) {
> unsigned char sector_s[4] = {0, 15, 24, 0};
> unsigned char sector_e[4] = {4, 0, 33, 0};
> int arc_file_s = msf2sec(sector_s);
> int arc_file_e = msf2sec(sector_e);
> int set_sector = msf2sec(cdr.SetSector);
> if (arc_file_s <= set_sector && set_sector <= arc_file_e) {
> isUseBuf = 1;
> arc_sec_count = 0;
> arc_sec_not_read = 0;
> memset(arcSecBuf, 0, DATA_SIZE * ARC_BUFF_MAX);
> }
> else {
> isUseBuf = 0;
> }
> }
1336a2353,2359
> if (isTitleName(RESIDENT_EVIL_EU) ||
> isTitleName(RESIDENT_EVIL_JP) ||
> isTitleName(RESIDENT_EVIL_US)) {
> unsigned short volume;
> volume = fmin((cdr.AttenuatorLeftToLeft + cdr.AttenuatorRightToLeft) << 8, MAX_VOLUME);
> SPU_writeRegister(H_CDLeft, volume, psxRegs.cycle);
> }
1410a2434,2438
> if (isUseBuf && isTitleName(PACAPACA_PASSION_JP)) {
> if (arc_sec_not_read >= ARC_BUFF_MAX) arc_sec_not_read = 0; // reset ring buffer
> memcpy(ptr, arcSecBuf[arc_sec_not_read++] + (pTransfer - cdr.Transfer), size);
> }
> else {
1412a2441
> }
1425a2455,2464
> int left_cycle = psxRegs.intCycle[PSXINT_CDREAD].sCycle
> + psxRegs.intCycle[PSXINT_CDREAD].cycle
> - psxRegs.cycle;
> u32 str_headr = *((u32*)ptr);
> if(left_cycle <= 0x1000
> && size == CD_STR_HEAD_SIZE
> && ((str_headr&CD_STR_HEAD) == CD_STR_HEAD)) {
> CDREAD_INT(0x1000);
> CDR_LOG("psxDma3() Log: CDREAD_INT(0x1000)\n");
> }
1481a2521,2536
> if(Mode == 2) {
> int iRetSize = sizeof(cdr) \
> + sizeof(tmp);
>
> if(f) {
> cdr.freeze_ver = 0x63647202;
> memcpy(f, &cdr, sizeof(cdr));
> f = (void *)((char *)f + sizeof(cdr));
>
> cdr.ParamP = cdr.ParamC;
> tmp = pTransfer - cdr.Transfer;
> memcpy(f, &tmp, sizeof(tmp));
> f = (void *)((char *)f + sizeof(tmp));
> }
> return iRetSize;
> }
1536a2592,2752
>
> int mgs_disk1_jp[][2] = {
> {0x605657,0x624116},
> {0x600452,0x605644},
> {0x624124,0x640462},
> {0x585550,0x600441}
> };
> int mgs_disk2_jp[][2] = {
> {0x510434,0x520847},
> {0x520868,0x543706},
> {0x550948,0x672735},
> {0x543723,0x550923}
> };
> int mgs_disk1_us[][2] = {
> {0x603166,0x621624},
> {0x593961,0x603152},
> {0x621632,0x633969},
> {0x583059,0x593948}
> };
> int mgs_disk2_us[][2] = {
> {0x504407,0x514820},
> {0x514840,0x541652},
> {0x544911,0x670059},
> {0x541661,0x544862}
> };
>
> void check_Motionjpeg(unsigned char arg1, unsigned char arg2, unsigned char arg3){
>
> int i,hit=0;
> int track=arg1<<16|arg2<<8|arg3;
>
> if (isTitleName(METAL_GEAR_SOLID_DISC_1_JP)){
> for(i=0; i < sizeof(mgs_disk1_jp)/sizeof(mgs_disk1_jp[0]); i++){
> if((track >= mgs_disk1_jp[i][0]) && (track <= mgs_disk1_jp[i][1])){
> hit=1;
> break;
> }
> }
> }
> else if (isTitleName(METAL_GEAR_SOLID_DISC_2_JP)){
> for(i=0; i < sizeof(mgs_disk2_jp)/sizeof(mgs_disk2_jp[0]); i++){
> if((track >= mgs_disk2_jp[i][0]) && (track <= mgs_disk2_jp[i][1])){
> hit=1;
> break;
> }
> }
> }
> else if (isTitleName(METAL_GEAR_SOLID_DISC_1_US)){
> for(i=0; i < sizeof(mgs_disk1_us)/sizeof(mgs_disk1_us[0]); i++){
> if((track >= mgs_disk1_us[i][0]) && (track <= mgs_disk1_us[i][1])){
> hit=1;
> break;
> }
> }
> }
> else if (isTitleName(METAL_GEAR_SOLID_DISC_2_US)){
> for(i=0; i < sizeof(mgs_disk2_us)/sizeof(mgs_disk2_us[0]); i++){
> if((track >= mgs_disk2_us[i][0]) && (track <= mgs_disk2_us[i][1])){
> hit=1;
> break;
> }
> }
> }
>
> if(hit){
> change_HSync_Motionjpeg(1);
> change_frame_Motionjpeg(1);
> }
> else{
> change_HSync_Motionjpeg(0);
> change_frame_Motionjpeg(0);
> }
> }
>
> int mgs_disk1_scenes_jp[][3] = {
> {0x284037,0x284334,MSG_SCENE1},
> {0x141408,0x141936,MSG_SCENE2},
> {0x145317,0x145821,MSG_SCENE3},
> {0x173745,0x174574,MSG_SCENE4},
> {0x250774,0x251000,MSG_SCENE5},
> {0x255266,0x255853,MSG_SCENE6},
> {0x114172,0x114558,MSG_SCENE7},
> {0x072815,0x074943,MSG_SCENE8}
> };
> int mgs_disk1_scenes_us[][3] = {
> {0x284444,0x284770,MSG_SCENE1},
> {0x141817,0x142357,MSG_SCENE2},
> {0x145743,0x150240,MSG_SCENE3},
> {0x174225,0x175022,MSG_SCENE4},
> {0x251241,0x251435,MSG_SCENE5},
> {0x255753,0x260318,MSG_SCENE6},
> {0x114623,0x114969,MSG_SCENE7},
> {0x073234,0x075411,MSG_SCENE8}
> };
>
> void check_scenes(unsigned char arg1, unsigned char arg2, unsigned char arg3) {
> int i,hit = 0;
> int track = arg1 << 16 | arg2 << 8 | arg3;
>
> if (isTitleName(METAL_GEAR_SOLID_DISC_1_JP)) {
> for (i = 0; i < sizeof(mgs_disk1_scenes_jp) / sizeof(mgs_disk1_scenes_jp[0]); i++) {
> if ((track >= mgs_disk1_scenes_jp[i][0]) && (track <= mgs_disk1_scenes_jp[i][1])) {
> hit = mgs_disk1_scenes_jp[i][2];
> break;
> }
> }
> }
> else if (isTitleName(METAL_GEAR_SOLID_DISC_1_US)) {
> for (i = 0; i < sizeof(mgs_disk1_scenes_us) / sizeof(mgs_disk1_scenes_us[0]); i++) {
> if ((track >= mgs_disk1_scenes_us[i][0]) && (track <= mgs_disk1_scenes_us[i][1])) {
> hit = mgs_disk1_scenes_us[i][2];
> break;
> }
> }
> }
>
> if (hit) {
> set_scenes(hit);
> }
> else {
> set_scenes(NO_SCENES);
> }
> }
>
> int wa_jp[][2] = {
> {0x385031,0x411234}
> };
> int wa_us[][2] = {
> {0x385011,0x411741}
> };
>
> void check_scenesforSPU(unsigned char arg1, unsigned char arg2, unsigned char arg3) {
>
> int i, hit = 0;
> int track = arg1 << 16 | arg2 << 8 | arg3;
>
> if (isTitleName(WILD_ARMS_US)) {
> for (i = 0; i < sizeof(wa_us) / sizeof(wa_us[0]); i++) {
> if ((track >= wa_us[i][0]) && (track <= wa_us[i][1])) {
> hit = 1;
> break;
> }
> }
> }
> else if (isTitleName(WILD_ARMS_JP)) {
> for (i = 0; i < sizeof(wa_jp) / sizeof(wa_jp[0]); i++) {
> if ((track >= wa_jp[i][0]) && (track <= wa_jp[i][1])) {
> hit = 1;
> break;
> }
> }
> }
>
> if (hit) {
> scenes = 1;
> }
> else {
> scenes = 0;
> }
> }
>
diff --new-file -w -r pcsx_rearmed/libpcsxcore/cdrom.h pcsx_rearmed_custom/libpcsxcore/cdrom.h
113a114,116
> extern int is_disc_change;
> extern int is_nop_count;
> extern int nop_cnt;
diff --new-file -w -r pcsx_rearmed/libpcsxcore/mdec.c pcsx_rearmed_custom/libpcsxcore/mdec.c
21a22
> #include "title.h"
625a627,631
> if (isTitleName(RIDGE_RACER_TYPE_4_EU)
> || isTitleName(RIDGE_RACER_TYPE_4_JP)
> || isTitleName(RIDGE_RACER_TYPE_4_US)) {
> MDECOUTDMA_INT(words * 3.5);
> } else {
628a635
> }
675a683,733
> if(Mode == 2) {
> int iRetSize = sizeof(mdec.reg0) \
> + sizeof(mdec.reg1) \
> + sizeof(v) \
> + sizeof(v) \
> + sizeof(v) \
> + sizeof(mdec.block_buffer) \
> + sizeof(mdec.pending_dma1) \
> + sizeof(iq_y) \
> + sizeof(iq_uv);
>
> if(f) {
> memcpy(f, &mdec.reg0, sizeof(mdec.reg0));
> f = (void *)((char *)f + sizeof(mdec.reg0));
>
> memcpy(f, &mdec.reg1, sizeof(mdec.reg1));
> f = (void *)((char *)f + sizeof(mdec.reg1));
>
> // old code used to save raw pointers..
> v = (u8 *)mdec.rl - base;
> memcpy(f, &v, sizeof(v));
> f = (void *)((char *)f + sizeof(v));
>
> v = (u8 *)mdec.rl_end - base;
> memcpy(f, &v, sizeof(v));
> f = (void *)((char *)f + sizeof(v));
>
> v = 0;
> if (mdec.block_buffer_pos)
> v = mdec.block_buffer_pos - base;
> memcpy(f, &v, sizeof(v));
> f = (void *)((char *)f + sizeof(v));
>
> mdec.block_buffer_pos = 0;
> if (v)
> mdec.block_buffer_pos = base + (v & 0xfffff);
>
> memcpy(f, &mdec.block_buffer, sizeof(mdec.block_buffer));
> f = (void *)((char *)f + sizeof(mdec.block_buffer));
>
> memcpy(f, &mdec.pending_dma1, sizeof(mdec.pending_dma1));
> f = (void *)((char *)f + sizeof(mdec.pending_dma1));
>
> memcpy(f, iq_y, sizeof(iq_y));
> f = (void *)((char *)f + sizeof(iq_y));
>
> memcpy(f, iq_uv, sizeof(iq_uv));
> f = (void *)((char *)f + sizeof(iq_uv));
> }
> return iRetSize;
> } else {
701a760
> }
diff --new-file -w -r pcsx_rearmed/libpcsxcore/misc.c pcsx_rearmed_custom/libpcsxcore/misc.c
28a29
> #include "title.h"
29a31,38
> #include "../frontend/menu.h"
> #include "../frontend/main.h"
> #include <dirent.h>
> #include <pthread.h>
> #include <sys/types.h>
> #include <unistd.h>
> #include <fcntl.h>
> #include <time.h>
31a41
> char CdromId_old[10] = "";
32a43,52
> char CdromLabel_old[33] = "";
> char CdromPath[MAXPATHLEN] = "";
> char CdromPath_old[MAXPATHLEN] = "";
>
> int disc_change_type = 0;
> static pthread_mutex_t statefile_mutex = PTHREAD_MUTEX_INITIALIZER;
> pthread_t statefile_thread = (pthread_t)0;
> int time_to_sync_state = 0;
>
> #define EXCLUSION_CONTROL
40a61,67
> #define MAX_ERROR_LEN 1024
> #define MAX_STATE_PATH_LEN 64 // sufficient size in the current operation
>
> struct error_info {
> int id;
> char message[MAX_ERROR_LEN];
> };
55a83,470
> // Save State.
> #define AUTO_SAVE_TO_HEAP_SECOND (2)
> #define AUTO_SAVE_TO_FILE_COUNT ((10/AUTO_SAVE_TO_HEAP_SECOND) + 1)
> #define BLOCKING_TIME (10)
>
> static struct timespec start_time = {0, 0};
>
> typedef struct {
> int enable;
> int counting;
> int num;
> } disc_change_state;
>
> enum STATUS_RUNING{
> NOT_BUFF_INITIALIZED = 0, /* status: not get memory */
> BUFF_INITIALIZED, /* status: memory is ready ,only menu setting is ON */
> CONFIG_SET_OFF /* status: when menu setting is OFF */
> };
>
> typedef struct {
> unsigned char* Buff;
> int Size;
> }data_buff_t;
>
> typedef struct {
> data_buff_t ScreenPic;
> data_buff_t BIOS;
> data_buff_t GPU;
> data_buff_t SPU; /* not write to file */
> data_buff_t SPU1; /* size is not const */
> data_buff_t SIO;
> data_buff_t CDR;
> data_buff_t PSXHW;
> data_buff_t PSXRCNT;
> data_buff_t MDEC;
> data_buff_t NewDyna; /* size is not const */
> int iNewDynaValidDataSize;
> int Num;
> }state_data_t;
>
> static state_data_t g_stateData[AUTO_SAVE_TO_FILE_COUNT];
> static disc_change_state dcstateData[AUTO_SAVE_TO_FILE_COUNT] = {0};
> static int gLastCount = 0;
> static int gFilledNum = 0;
> static int gBuffInitialized = NOT_BUFF_INITIALIZED;
> static int resume_play = 0;
> static int blocking_count = 0;
> int memcardResetFlag = 0;
> unsigned int memcardFlagOld = 0;
>
> static char stateid[AUTO_SAVE_TO_FILE_COUNT][10];
> int isUnknownCdrom = 1;
> int holdResetEvent = 0;
>
> void LogPrint(char* title1, int data){
> struct timeval myTime;
> gettimeofday(&myTime, NULL);
> printf("[%d.%6d] :%s, %d \n", myTime.tv_sec, myTime.tv_usec,title1, data );
> }
> #define xprintf //printf
> #define LOG_Print //LogPrint
>
> static int lock_statefile_mutex(void)
> {
> #ifdef EXCLUSION_CONTROL
> int ret;
>
> ret = pthread_mutex_lock(&statefile_mutex);
> if (ret != 0) {
> printf("ERROR: failed to lock the mutex\n");
> return -1;
> }
> #endif
> return 0;
> }
>
> static int unlock_statefile_mutex(void)
> {
> #ifdef EXCLUSION_CONTROL
> int ret;
>
> ret = pthread_mutex_unlock(&statefile_mutex);
> if (ret != 0) {
> printf("ERROR: failed to unlock the mutex\n");
> return -1;
> }
> #endif
> return 0;
> }
>
> static int write_statefile(struct error_info *err)
> {
> pid_t pid;
> int status_num = 1;
> int fd;
> struct dirent **entry_list;
> int entry_num;
> int i, ret;
> char file_name[MAX_STATE_PATH_LEN], buff[MAX_ERROR_LEN];
> char *ext;
>
> int error_id;
> char error_msg[MAX_ERROR_LEN];
>
> error_id = err->id;
> strcpy(error_msg, err->message);
> free(err);
>
> ret = lock_statefile_mutex();
> if (ret < 0) {
> return -1;
> }
>
> entry_num = scandir(STATUS_DIR, &entry_list, NULL, alphasort);
> for (i=0; i<entry_num; i++) {
> ext = strrchr(entry_list[i]->d_name, '.');
> ret = strcmp(ext, ".sts");
> if (ret == 0) {
> status_num++;
> }
> }
> sprintf(buff, "%03d.sts", status_num);
> sprintf(file_name, "%s%s", STATUS_DIR, buff);
> fd = open(file_name, O_WRONLY | O_CREAT, 0644);
> if (fd < 0) {
> printf("ERROR: failed to open a state file:%s\n", file_name);
> unlock_statefile_mutex();
> return -1;
> }
>
> sprintf(buff, "%d\n%s", error_id, error_msg);
> ret = write(fd, buff, strlen(buff));
> if (fd < 0) {
> printf("ERROR: failed to write a state file:%s\n", file_name);
> close(fd);
> unlock_statefile_mutex();
> return -1;
> }
>
> fsync(fd);
> close(fd);
> unlock_statefile_mutex();
>
> return 0;
> }
>
> int save_error(int error_id, char *error_msg)
> {
> int ret;
> struct error_info *err;
>
> err = malloc(sizeof(struct error_info));
> bzero(err, sizeof(struct error_info));
> err->id = error_id;
> strncpy(err->message, error_msg, MAX_ERROR_LEN-1);
>
> pthread_attr_t thread_attr;
> pthread_attr_init(&thread_attr);
> pthread_attr_setdetachstate(&thread_attr , PTHREAD_CREATE_DETACHED);
>
> ret = pthread_create(&statefile_thread, &thread_attr, write_statefile, err);
> pthread_attr_destroy(&thread_attr);
>
> return ret;
> }
>
> static int setTileScreenAdjust(){
> int ret = isTitleName(COLIN_MCRAE_RALLY_EU)
> || isTitleName(CRASH_BANDICOOT_2_EU)
> || isTitleName(CRASH_BANDICOOT_2_JP)
> || isTitleName(CRASH_BANDICOOT_2_US)
> || isTitleName(DESTRUCTION_DERBY_EU)
> || isTitleName(DESTRUCTION_DERBY_US)
> || isTitleName(DISNEY_TOY_STORY_2_EU)
> || isTitleName(DRIVER_EU)
> || isTitleName(DRIVER_US)
> || isTitleName(EHRGEIZ_JP)
> || isTitleName(FIGHTING_FORCE_US)
> || isTitleName(GRAND_THEFT_AUTO_2_EU)
> || isTitleName(GRAND_THEFT_AUTO_2_US)
> || isTitleName(HARRY_POTTER_AND_THE_PHILOSOPHERS_STONE_EU)
> || isTitleName(KLONOA_DOOR_TO_PHANTAMILE_JP)
> || isTitleName(KLONOA_DOOR_TO_PHANTAMILE_US)
> || isTitleName(KULA_WORLD_EU)
> || isTitleName(MEDIEVIL_EU)
> || isTitleName(MEDIEVIL_US)
> || isTitleName(MR_DRILLER_EU)
> || isTitleName(MR_DRILLER_G_JP)
> || isTitleName(MR_DRILLER_JP)
> || isTitleName(MR_DRILLER_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(RAY_STORM_JP)
> || isTitleName(RIDGE_RACER_TYPE_4_EU)
> || isTitleName(RIDGE_RACER_TYPE_4_JP)
> || isTitleName(RIDGE_RACER_TYPE_4_US)
> || isTitleName(SILENT_HILL_EU)
> || isTitleName(SILENT_HILL_JP)
> || isTitleName(SILENT_HILL_US)
> || isTitleName(SPEC_OPS_STEALTH_PATROL_US)
> || isTitleName(STREET_FIGHTER_ALPHA_3_US)
> || isTitleName(STREET_FIGHTER_EX_PLUS_EU)
> || isTitleName(STREET_FIGHTER_EX_PLUS_JP)
> || isTitleName(STREET_FIGHTER_EX_PLUS_US)
> || isTitleName(TEKKEN3_JP)
> || isTitleName(TOM_CLANCYS_RAINBOW_SIX_EU)
> || isTitleName(TOMB_RAIDER_2_EU)
> || isTitleName(TOMB_RAIDER_2_JP)
> || isTitleName(TOMB_RAIDER_2_US)
> || isTitleName(TOMB_RAIDER_EU)
> || isTitleName(TOMB_RAIDER_JP)
> || isTitleName(TOMB_RAIDER_US)
> || isTitleName(TOMBA_JP)
> || isTitleName(TOMBA_US)
> || isTitleName(XEVIOUS_3D_G_JP)
> || isTitleName(XEVIOUS_3D_G_US);
>
> if(GPU_setPatchFlag)
> GPU_setPatchFlag(GPU_PATCH_SCREEN_ADJUST, ret);
>
> return ret;
> }
>
> static int setTitleIsFF7(){
> int ret = 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);
>
> if(GPU_setPatchFlag)
> GPU_setPatchFlag(GPU_PATCH_IS_FF7, ret);
>
> return ret;
> }
>
> static int setTitleIsMrDriller(){
> int ret = isTitleName(MR_DRILLER_EU)
> || isTitleName(MR_DRILLER_G_JP)
> || isTitleName(MR_DRILLER_JP)
> || isTitleName(MR_DRILLER_US);
>
> if(GPU_setPatchFlag)
> GPU_setPatchFlag(GPU_PATCH_IS_MR_DRILLER, ret);
>
> return ret;
> }
>
> static int setTitleIsMrDrillerJp(){
> int ret = isTitleName(MR_DRILLER_JP);
>
> if(GPU_setPatchFlag)
> GPU_setPatchFlag(GPU_PATCH_IS_MR_DRILLER_JP, ret);
>
> return ret;
> }
>
> static int setTitleAddVram2(){
> int ret = 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);
>
> if(GPU_setPatchFlag)
> GPU_setPatchFlag(GPU_PATCH_ADD_VRAM2, ret);
> return ret;
> }
>
> static int setTitleBO(){
> int ret = isTitleName(METAL_GEAR_SOLID_DISC_1_JP)
> || isTitleName(METAL_GEAR_SOLID_DISC_1_US);
>
> if(GPU_setPatchFlag)
> GPU_setPatchFlag(GPU_PATCH_ADD_BO, ret);
> return ret;
> }
>
> static int setTitleIsARCTHELAD(){
> int ret = isTitleName(ARC_THE_LAD_JP)
> || isTitleName(ARC_THE_LAD_2_JP);
>
> if(GPU_setPatchFlag)
> GPU_setPatchFlag(GPU_PATCH_ARC_THE_LAD, ret);
>
> return ret;
> }
>
> int isTitleName(enum TITLE_NAME argTitleName)
> {
> return (g_eTitleName == argTitleName) ? 1 : 0;
> }
>
> void initTitleName(void) {
> g_eTitleName = TITLE_NAME_NONE;
> }
>
> void setTitleName(void) {
> int i = 0;
>
> initTitleName();
> setCdromId();
> while(*(stTitleList[i].m_cpCdromId)) {
> if(strcmp(stTitleList[i].m_cpCdromId , CdromId) == 0) {
> g_eTitleName = stTitleList[i].m_eTitleName;
> break;
> }
> i++;
> }
> setTileScreenAdjust();
> setTitleIsFF7();
> setTitleIsMrDriller();
> setTitleIsMrDrillerJp();
> setTitleAddVram2();
> setTitleBO();
> setTitleIsARCTHELAD();
> }
>
> void setCdromId(void) {
> char * fileName = strrchr(GetIsoFile(), '/');
> int c = 0;
> for (int i = 0; i < strlen(fileName); ++i) {
> if (fileName[i] == '.' || c >= sizeof(CdromId) - 1) {
> break;
> }
> if (isalnum(fileName[i])) {
> CdromId[c++] = fileName[i];
> }
> }
> }
>
> void setDiscChangeType()
> {
> int i, n, ret, cd_num;
> char title_dir_path[128];
> char *ext, *p;
> struct dirent **namelist;
>
> // get title directory path
> strcpy(title_dir_path, GetIsoFile());
> p = strrchr(title_dir_path, '/');
> if (p != NULL) {
> *p = 0;
> }
>
> // count number of .cue file
> n = scandir(title_dir_path, &namelist, NULL, NULL);
> cd_num = 0;
> for (i=0; i<n; i++) {
> ext = strrchr(namelist[i]->d_name, '.');
> ret = strcmp(ext, ".cue");
> if (ret == 0) {
> cd_num++;
> }
> }
>
> if (cd_num <= 1) {
> disc_change_type = 0;
> }
> #if 0
> else if (isTitleName(DUMMY_TITLE_1)) {
> disc_change_type = 2;
> }
> else if (isTitleName(DUMMY_TITLE_2)) {
> disc_change_type = 3;
> }
> else if (isTitleName(DUMMY_TITLE_3)) {
> disc_change_type = 4;
> }
> else if (isTitleName(DUMMY_TITLE_4)) {
> disc_change_type = 5;
> }
> #endif
> else {
> disc_change_type = 1;
> }
>
> return;
> }
>
109a525,538
> void StartCheckOpen(void) {
> clock_gettime(CLOCK_MONOTONIC, &start_time);
> }
>
> int CheckOpenEnabled(void) {
> struct timespec current_time;
>
> clock_gettime(CLOCK_MONOTONIC, &current_time);
> if (resume_play || current_time.tv_sec - start_time.tv_sec > open_invalid_time) {
> return 1;
> }
> return 0;
> }
>
185c614
< psxRegs.pc = psxRegs.GPR.n.ra;
---
> //psxRegs.pc = psxRegs.GPR.n.ra;
316a746,747
> initTitleName();
>
366,367c797
< if (CdromId[0] == '\0') {
< len = strlen(exename);
---
> char * fileName = strrchr(GetIsoFile(), '/');
369,370c799,800
< for (i = 0; i < len; ++i) {
< if (exename[i] == ';' || c >= sizeof(CdromId) - 1)
---
> for (i = 0; i < strlen(fileName); ++i) {
> if (fileName[i] == '.' || c >= sizeof(CdromId) - 1)
372,374c802,803
< if (isalnum(exename[i]))
< CdromId[c++] = exename[i];
< }
---
> if (isalnum(fileName[i]))
> CdromId[c++] = fileName[i];
392a822,832
> strncpy(CdromPath, GetIsoFile(), sizeof(CdromPath));
> if (CdromPath_old[0] == '\0' || CdromLabel_old[0] == '\0' || CdromId_old[0] == '\0' || !(g_opts & OPT_AUTOSAVE)) {
> strncpy(CdromPath_old, CdromPath, sizeof(CdromPath));
> strncpy(CdromLabel_old, CdromLabel, sizeof(CdromLabel));
> strncpy(CdromId_old, CdromId, sizeof(CdromId));
> }
> if (holdResetEvent) {
> emu_set_action(SACTION_RESET_EVENT);
> holdResetEvent = 0;
> }
> isUnknownCdrom = 0;
394a835,837
> setTitleName();
>
> setDiscChangeType();
528a972,977
> static void *fadein(void* param) {
> SPU_fadein();
>
> return;
> }
>
575c1024
<
---
> xprintf("SaveState to file [%s] \n", file);
619a1069,1074
> // disc change state
> disc_change_state current_state = {is_disc_change, is_nop_count, nop_cnt};
> SaveFuncs.write(f, &current_state, sizeof(disc_change_state));
>
> int fd = fileno(f);
> fsync(fd);
626a1082,1522
> state_data_t* getSaveStateArray(int count) {
> if (count < 0 || count >= AUTO_SAVE_TO_FILE_COUNT) return NULL;
>
> state_data_t* buff = (state_data_t* )&g_stateData[count];
> return buff;
> }
>
> int SaveStateWork(void * fname) {
>
> xprintf("SaveStateWork g_opts & OPT_AUTOSAVE [%d] \n", g_opts & OPT_AUTOSAVE);
> if ((g_opts & OPT_AUTOSAVE) == 0) {
> return SaveState(fname);
> }
> int old_index;
>
> if (gFilledNum <= 0) {
> xprintf("SaveStateWork gFilledNum [%d] \n", gFilledNum);
> return -1;
> }
> else if (gFilledNum < AUTO_SAVE_TO_FILE_COUNT) {
> if (resume_play) {
> return -1;
> }
> old_index = 0;
> }
> else {
> if (gLastCount < AUTO_SAVE_TO_FILE_COUNT) {
> old_index = gLastCount;
> }
> else {
> old_index = 0;
> }
> }
>
> xprintf("SaveStateWork old_index [%d] , gLastCount [%d], gFilledNum[%d] \n", old_index, gLastCount, gFilledNum);
>
> void *f = SaveFuncs.open(fname, "wb");
> if (f == NULL) {
> printf("SaveStateWork file open failed!! [%s] \n", fname);
> return -1;
> }
>
> state_data_t * pData = getSaveStateArray(old_index);
> if (pData == NULL) {
> printf("SaveStateWork getSaveStateArray failed!![%d] \n", old_index);
> return -1;
> }
> disc_change_state save_state = dcstateData[old_index];
>
> if (pData->ScreenPic.Buff) SaveFuncs.write(f, (void *)pData->ScreenPic.Buff, pData->ScreenPic.Size);
> if (pData->BIOS.Buff) SaveFuncs.write(f, (void *)pData->BIOS.Buff, pData->BIOS.Size);
> if (pData->GPU.Buff) SaveFuncs.write(f, (void *)pData->GPU.Buff, pData->GPU.Size);
> if (pData->SPU.Buff) SaveFuncs.write(f, (void *)pData->SPU.Buff, pData->SPU.Size);
> if (pData->SPU1.Buff) SaveFuncs.write(f, (void *)pData->SPU1.Buff, pData->SPU1.Size);
> if (pData->SIO.Buff) SaveFuncs.write(f, (void *)pData->SIO.Buff, pData->SIO.Size);
> if (pData->CDR.Buff) SaveFuncs.write(f, (void *)pData->CDR.Buff, pData->CDR.Size);
> if (pData->PSXHW.Buff) SaveFuncs.write(f, (void *)pData->PSXHW.Buff, pData->PSXHW.Size);
> if (pData->PSXRCNT.Buff) SaveFuncs.write(f, (void *)pData->PSXRCNT.Buff, pData->PSXRCNT.Size);
> if (pData->MDEC.Buff) SaveFuncs.write(f, (void *)pData->MDEC.Buff, pData->MDEC.Size);
> if (pData->NewDyna.Buff) SaveFuncs.write(f, (void *)pData->NewDyna.Buff, pData->iNewDynaValidDataSize);
>
> xprintf("SaveStateWork ScreenPic [%d] \n", pData->ScreenPic.Size);
> xprintf("SaveStateWork BIOS [%d] \n", pData->BIOS.Size);
> xprintf("SaveStateWork GPU [%d] \n", pData->GPU.Size);
> xprintf("SaveStateWork SPU [%d] \n", pData->SPU.Size);
> xprintf("SaveStateWork SPU1 [%d] \n", pData->SPU1.Size);
> xprintf("SaveStateWork SIO [%d] \n", pData->SIO.Size);
> xprintf("SaveStateWork CDR [%d] \n", pData->CDR.Size);
> xprintf("SaveStateWork PSXHW [%d] \n", pData->PSXHW.Size);
> xprintf("SaveStateWork PSXRCNT [%d] \n", pData->PSXRCNT.Size);
> xprintf("SaveStateWork MDEC [%d] \n", pData->MDEC.Size);
> xprintf("SaveStateWork NewDyna [%d] \n", pData->NewDyna.Size);
> xprintf("SaveStateWork Num [%d] \n", pData->Num);
>
> SaveFuncs.write(f, (void *)&save_state, sizeof(disc_change_state));
>
> int fd = fileno(f);
> fsync(fd);
> SaveFuncs.close(f);
>
> return 0;
> }
>
> int freeSaveStateMem(state_data_t * buff) {
>
> if (buff == NULL) return -1;
>
> if (buff->ScreenPic.Buff) free(buff->ScreenPic.Buff);
> if (buff->BIOS.Buff) free(buff->BIOS.Buff);
> if (buff->GPU.Buff) free(buff->GPU.Buff);
> if (buff->SPU.Buff) free(buff->SPU.Buff);
> if (buff->SPU1.Buff) free(buff->SPU1.Buff);
> if (buff->SIO.Buff) free(buff->SIO.Buff);
> if (buff->CDR.Buff) free(buff->CDR.Buff);
> if (buff->PSXHW.Buff) free(buff->PSXHW.Buff);
> if (buff->PSXRCNT.Buff) free(buff->PSXRCNT.Buff);
> if (buff->MDEC.Buff) free(buff->MDEC.Buff);
> if (buff->NewDyna.Buff) free(buff->NewDyna.Buff);
>
> buff->ScreenPic.Buff = NULL;
> buff->BIOS.Buff = NULL;
> buff->GPU.Buff = NULL;
> buff->SPU.Buff = NULL;
> buff->SPU1.Buff = NULL;
> buff->SIO.Buff = NULL;
> buff->CDR.Buff = NULL;
> buff->PSXHW.Buff = NULL;
> buff->PSXRCNT.Buff = NULL;
> buff->MDEC.Buff = NULL;
> buff->NewDyna.Buff = NULL;
>
> return 0;
> }
>
> int SetCdromId(void) {
> int oldest_index = 0;
> int ret;
>
> if (gFilledNum < 0) {
> return -1;
> }
> else if (gFilledNum < AUTO_SAVE_TO_FILE_COUNT - 1) {
> oldest_index = 0;
> }
> else {
> oldest_index = gLastCount + 1;
> if (oldest_index >= AUTO_SAVE_TO_FILE_COUNT) {
> oldest_index = 0;
> }
> }
>
> ret = strncmp(stateid[oldest_index], CdromId, sizeof(CdromId));
> if (!ret) {
> ret = strncmp(CdromId_old, CdromId, sizeof(CdromId));
> if (ret) {
> strncpy(CdromPath_old, CdromPath, sizeof(CdromPath));
> strncpy(CdromLabel_old, CdromLabel, sizeof(CdromLabel));
> strncpy(CdromId_old, CdromId, sizeof(CdromId));
> }
> }
>
> return 0;
> }
>
> int AutoSaveState(int count) {
> int Size;
> unsigned char *pMem;
> if (count >= AUTO_SAVE_TO_FILE_COUNT || count < 0)
> return -1;
>
> state_data_t * pStateData = getSaveStateArray(count);
> if (pStateData == NULL)
> return -1;
>
> new_dyna_before_save();
>
> pMem = pStateData->ScreenPic.Buff;
> memcpy(pMem, (unsigned char *)PcsxHeader, 32);
> pMem += 32;
> memcpy(pMem, (unsigned char *)&SaveVersion, sizeof(u32));
> pMem += sizeof(u32);
> memcpy(pMem, (unsigned char *)&Config.HLE, sizeof(boolean));
> pMem += sizeof(boolean);
> GPU_getScreenPic(pMem);
>
>
> if (Config.HLE)
> psxBiosFreeze(1);
>
> pMem = pStateData->BIOS.Buff;
> memcpy(pMem, (unsigned char *)psxM, 0x00200000);
> pMem += 0x00200000;
> memcpy(pMem, (unsigned char *)psxR, 0x00080000);
> pMem += 0x00080000;
> memcpy(pMem, (unsigned char *)psxH, 0x00010000);
> pMem += 0x00010000;
> memcpy(pMem, (unsigned char *)&psxRegs, sizeof(psxRegs));
>
> // gpu
> GPUFreeze_t *gpufP = (GPUFreeze_t *)pStateData->GPU.Buff;
> gpufP->ulFreezeVersion = 1;
> GPU_freeze(1, gpufP);
>
> // spu
> char ca[16];
> SPUFreeze_t *spufP = (SPUFreeze_t *) ca;
> SPU_freeze(2, spufP, psxRegs.cycle);
> Size = spufP->Size;
> memcpy(pStateData->SPU.Buff, &Size, pStateData->SPU.Size);
>
> spufP = (SPUFreeze_t *) pStateData->SPU1.Buff;
> SPU_freeze(1, spufP, psxRegs.cycle);
>
> sioFreeze(pStateData->SIO.Buff, 2);
> cdrFreeze(pStateData->CDR.Buff, 2);
> psxHwFreeze(pStateData->PSXHW.Buff, 2);
> psxRcntFreeze(pStateData->PSXRCNT.Buff, 2);
> mdecFreeze(pStateData->MDEC.Buff, 2);
>
> pStateData->iNewDynaValidDataSize = new_dyna_freeze(pStateData->NewDyna.Buff, 2);
>
> xprintf("AutoSaveState ScreenPic [%d] \n", pStateData->ScreenPic.Size);
> xprintf("AutoSaveState BIOS [%d] \n", pStateData->BIOS.Size);
> xprintf("AutoSaveState GPU [%d] \n", pStateData->GPU.Size);
> xprintf("AutoSaveState SPU [%d] \n", pStateData->SPU.Size);
> xprintf("AutoSaveState SPU1 [%d] \n", pStateData->SPU1.Size);
> xprintf("AutoSaveState NewDyna [%d] \n", pStateData->iNewDynaValidDataSize);
> xprintf("AutoSaveState Num [%d] \n", pStateData->Num);
>
> disc_change_state current_state = {is_disc_change, is_nop_count, nop_cnt};
> dcstateData[count] = current_state;
>
> if (CdromId[0] != '\0') {
> strncpy(stateid[count], CdromId, sizeof(CdromId));
> }
> else {
> strncpy(stateid[count], CdromId_old, sizeof(CdromId_old));
> }
> SetCdromId();
>
> new_dyna_after_save();
> return 0;
> }
>
> int InitAutoSave(void) {
> int ret = 0;
> gFilledNum = 0;
> gLastCount = 0;
> memset((unsigned char *)g_stateData, 0, sizeof(g_stateData));
>
> state_data_t * pStateData = NULL;
> for (int i=0;i<AUTO_SAVE_TO_FILE_COUNT;i++) {
> pStateData = getSaveStateArray(i);
> if (pStateData == NULL) {
> ret = -1;
> break;
> }
> freeSaveStateMem(pStateData);
>
> int size;
> unsigned char *pMem;
>
> size = 32 + sizeof(u32) + sizeof(boolean) + 128 * 96 * 3;
> pMem = (unsigned char *)malloc(size);
> if (pStateData == NULL) {
> ret = -1;
> break;
> }
>
> pStateData->ScreenPic.Buff = pMem;
> pStateData->ScreenPic.Size = size;
>
> size = 0x00200000 + 0x00080000 + 0x00010000 + sizeof(psxRegs);
> pMem = (unsigned char *)malloc(size);
> if (pMem == NULL) {
> ret = -1;
> break;
> }
>
> pStateData->BIOS.Buff = pMem;
> pStateData->BIOS.Size = size;
>
> size = sizeof(GPUFreeze_t);
> pMem = (unsigned char *)malloc(size);
> if (pMem == NULL) {
> ret = -1;
> break;
> }
> pStateData->GPU.Buff = pMem;
> pStateData->GPU.Size = size;
>
> size = 4;
> pMem = (unsigned char *)malloc(size);
> if (pMem == NULL) {
> ret = -1;
> break;
> }
>
> pStateData->SPU.Buff = pMem;
> pStateData->SPU.Size = size;
>
> pStateData->SPU1.Size = SPU_freeze(2, (void *)0, 0);
> pStateData->SPU1.Buff = (unsigned char *)malloc(pStateData->SPU1.Size);
> if (pStateData->SPU1.Buff == NULL) {
> ret = -1;
> break;
> }
>
> pStateData->SIO.Size = sioFreeze((void *)0, 2);
> pStateData->SIO.Buff = (unsigned char *)malloc(pStateData->SIO.Size);
> if (pStateData->SIO.Buff == NULL) {
> ret = -1;
> break;
> }
>
> pStateData->CDR.Size = cdrFreeze((void *)0, 2);
> pStateData->CDR.Buff = (unsigned char *)malloc(pStateData->CDR.Size);
> if (pStateData->CDR.Buff == NULL) {
> ret = -1;
> break;
> }
>
> pStateData->PSXHW.Size = psxHwFreeze((void *)0, 2);
> pStateData->PSXHW.Buff = (unsigned char *)malloc(pStateData->PSXHW.Size);
> if (pStateData->PSXHW.Buff == NULL) {
> ret = -1;
> break;
> }
>
> pStateData->PSXRCNT.Size = psxRcntFreeze((void *)0, 2);
> pStateData->PSXRCNT.Buff = (unsigned char *)malloc(pStateData->PSXRCNT.Size);
> if (pStateData->PSXRCNT.Buff == NULL) {
> ret = -1;
> break;
> }
>
> pStateData->MDEC.Size = mdecFreeze((void *)0, 2);
> pStateData->MDEC.Buff = (unsigned char *)malloc(pStateData->MDEC.Size);
> if (pStateData->MDEC.Buff == NULL) {
> ret = -1;
> break;
> }
>
> pStateData->NewDyna.Size = new_dyna_freeze((void *)0, 2);
> pStateData->NewDyna.Buff = (unsigned char *)malloc(pStateData->NewDyna.Size);
> if (pStateData->NewDyna.Buff == NULL) {
> ret = -1;
> break;
> }
>
> pStateData->Num = i;
> }
>
> if (ret == -1) {
> for (int i=0; i<AUTO_SAVE_TO_FILE_COUNT; i++) {
> pStateData = getSaveStateArray(i);
> freeSaveStateMem(pStateData);
> }
> printf("InitAutoSave malloc failed! \n");
> }
> else {
> gBuffInitialized = BUFF_INITIALIZED;
> /* wait for 2s when starting */
> printf("InitAutoSave malloc OK! \n");
> }
>
> return ret;
> }
>
> void emu_sync_state(void) {
> static struct timespec formerTimeSpec = {0, 0};
> struct timespec currentTimeSpec;
> struct timespec intervalTimeSpec;
>
> if ((g_opts & OPT_AUTOSAVE) == 0) {
> if (BUFF_INITIALIZED == gBuffInitialized) {
> xprintf("OPT_AUTOSAVE OFF! \n");
> gLastCount = 0;
> gFilledNum = 0;
> gBuffInitialized = CONFIG_SET_OFF;
> }
> // check interval time
> clock_gettime(CLOCK_MONOTONIC, &currentTimeSpec);
> if((formerTimeSpec.tv_sec == 0) && (formerTimeSpec.tv_nsec == 0)) {
> memcpy(&formerTimeSpec, &currentTimeSpec, sizeof(struct timespec));
> }
>
> intervalTimeSpec.tv_sec = currentTimeSpec.tv_sec - formerTimeSpec.tv_sec;
> if((currentTimeSpec.tv_nsec - formerTimeSpec.tv_nsec) < 0){
> intervalTimeSpec.tv_sec --;
> }
>
> if(intervalTimeSpec.tv_sec < AUTO_SAVE_TO_HEAP_SECOND) {
> return;
> }
> memcpy(&formerTimeSpec, &currentTimeSpec, sizeof(struct timespec));
> if ((memcardFlag==0)&&(memcardFlagOld==0)&&(memcardResetFlag==1)) {
> emu_set_action(SACTION_RESET_EVENT);
> memcardResetFlag = 0;
> }
> memcardFlagOld = memcardFlag; //Memory Card Flag Save
> memcardFlag = 0; //Memory Card Flag Clear
> return;
> }
> if (NOT_BUFF_INITIALIZED == gBuffInitialized) {
> if (InitAutoSave() == -1) return;
> }
> else if (CONFIG_SET_OFF == gBuffInitialized) {
> xprintf("OPT_AUTOSAVE ON! \n");
> gBuffInitialized = BUFF_INITIALIZED;
> }
>
> // check interval time
> clock_gettime(CLOCK_MONOTONIC, &currentTimeSpec);
> if((formerTimeSpec.tv_sec == 0) && (formerTimeSpec.tv_nsec == 0)) {
> memcpy(&formerTimeSpec, &currentTimeSpec, sizeof(struct timespec));
> }
>
> intervalTimeSpec.tv_sec = currentTimeSpec.tv_sec - formerTimeSpec.tv_sec;
> if((currentTimeSpec.tv_nsec - formerTimeSpec.tv_nsec) < 0){
> intervalTimeSpec.tv_sec --;
> }
>
> if(intervalTimeSpec.tv_sec < AUTO_SAVE_TO_HEAP_SECOND) {
> return;
> }
> memcpy(&formerTimeSpec, &currentTimeSpec, sizeof(struct timespec));
>
> // Don't get the status while displaying the BIOS screen.
> if (!resume_play && AUTO_SAVE_TO_HEAP_SECOND * blocking_count < BLOCKING_TIME) {
> blocking_count++;
> return;
> }
>
> if (memcardFlag == 0) {
> time_to_sync_state = 1;
> }
> if ((memcardFlag==0)&&(memcardFlagOld==0)&&(memcardResetFlag==1)) {
> emu_set_action(SACTION_RESET_EVENT);
> memcardResetFlag = 0;
> }
> memcardFlagOld = memcardFlag;
> memcardFlag = 0;
> }
>
> void emu_sync_state2(void) {
> int count = gLastCount;
> LOG_Print("emu_sync_state start", count);
> if(AutoSaveState(count) == 0) {
> if (gFilledNum < AUTO_SAVE_TO_FILE_COUNT) {
> gFilledNum ++;
> }
> count += 1;
> if (count >= AUTO_SAVE_TO_FILE_COUNT) {
> count = 0;
> }
> gLastCount = count;
> }
> LOG_Print("emu_sync_state end", count);
> }
>
634a1531
> disc_change_state last_state;
642d1538
<
677a1574,1575
> xprintf("LoadState spu Size [0x%d] \n", Size);
>
684a1583,1588
> // load disc change state
> SaveFuncs.read(f, &last_state, sizeof(disc_change_state));
> is_disc_change = last_state.enable;
> is_nop_count = last_state.counting;
> nop_cnt = last_state.num;
>
686a1591,1600
> if (g_opts & OPT_AUTOSAVE) { /* reset auto save buff when load state*/
> gLastCount = 0;
> gFilledNum = 0;
> printf("LoadState reset auto save buff \n");
> }
> resume_play = 1;
>
> pthread_t fadein_thread;
> pthread_create(&fadein_thread, NULL, &fadein, NULL);
>
diff --new-file -w -r pcsx_rearmed/libpcsxcore/misc.h pcsx_rearmed_custom/libpcsxcore/misc.h
56a57
> extern char CdromId_old[10];
57a59,69
> extern char CdromLabel_old[33];
> extern char CdromPath[MAXPATHLEN];
> extern char CdromPath_old[MAXPATHLEN];
> extern int disc_change_type;
> extern int time_to_sync_state;
> extern unsigned int memcardFlag;
> extern int isUnknownCdrom;
> extern int holdResetEvent;
>
> void StartCheckOpen(void);
> int CheckOpenEnabled(void);
66a79
> int SaveStateWork(void * file);
73a87,88
> void emu_sync_state(void);
>
77a93,97
>
> #define ERROR_CPUOVERHEAT 20001
> #define ERROR_PCSXCRITICALERROR 90000
>
> #define STATUS_DIR "/tmp/PCSX/exitstatus/"
diff --new-file -w -r pcsx_rearmed/libpcsxcore/new_dynarec/emu_if.c pcsx_rearmed_custom/libpcsxcore/new_dynarec/emu_if.c
90a91
> emu_sync_state();
150c151
< void new_dyna_freeze(void *f, int mode)
---
> int new_dyna_freeze(void *f, int mode)
158c159,178
< if (mode != 0) { // save
---
> if (mode == 2) { // save buffer or get max buffer size
> if(f) {
> size = new_dynarec_save_blocks(addrs, sizeof(addrs));
>
> memcpy(f, header_save, sizeof(header_save));
> f = (void *)((char *)f + sizeof(header_save));
>
> memcpy(f, &size, sizeof(size));
> f = (void *)((char *)f + sizeof(size));
>
> memcpy(f, addrs, size);
> f = (void *)((char *)f + size);
>
> } else {
> size = new_dynarec_save_blocks((void *)0, sizeof(addrs)); // get max size
> }
> size += (sizeof(header_save) + sizeof(size));
> return size;
>
> } else if (mode != 0) { // save
161c181
< return;
---
> return 0;
174c194
< return;
---
> return 0;
178c198
< return;
---
> return 0;
186c206
< return;
---
> return 0;
191a212,238
> return 0;
> }
>
> void new_dyna_freeze_data(unsigned char** buff_out, int* size_out)
> {
> const char header_save[8] = "ariblks";
> uint32_t addrs[1024 * 4];
> int32_t size = 0;
>
> if (size_out == NULL) return;
>
> size = new_dynarec_save_blocks(addrs, sizeof(addrs));
> if (size == 0) {
> printf("new_dyna_freeze new_dynarec_save_blocks size is 0\n");
> *size_out = 0;
> return;
> }
>
> unsigned char * p = (unsigned char *) malloc(sizeof(header_save) + sizeof(size) + size);
> *buff_out = p;
> memcpy(p, (unsigned char *)header_save, sizeof(header_save));
> p += sizeof(header_save);
> memcpy(p, (unsigned char *)&size, sizeof(size));
> p += sizeof(size);
> memcpy(p, (unsigned char *)addrs, size);
> *size_out = sizeof(header_save) + sizeof(size) + size;
>
diff --new-file -w -r pcsx_rearmed/libpcsxcore/new_dynarec/new_dynarec.c pcsx_rearmed_custom/libpcsxcore/new_dynarec/new_dynarec.c
7165a7166,7167
> static struct savestate_block tmp_blocks[1024];
>
7170d7171
< struct savestate_block tmp_blocks[1024];
7174a7176,7178
> if(!(save)) {
> return maxcount * sizeof(blocks[0]);
> }
diff --new-file -w -r pcsx_rearmed/libpcsxcore/new_dynarec/pcsxmem.c pcsx_rearmed_custom/libpcsxcore/new_dynarec/pcsxmem.c
13a14
> #include "../title.h"
211a213,226
> if (isTitleName(DESTRUCTION_DERBY_EU) ||
> isTitleName(DESTRUCTION_DERBY_US)) {
> int r = address & 0xfff;
> if ((r == 0xdb0 || r == 0xdb2) &&
> (value == 0x0b18 || value == 0x0988 || value == 0x8009)) {
> value = 0;
> }
> }
>
> if ((isTitleName(IQ_INTELLIGENT_QUBE_JP) && value == IQ_JP_MAX_VOLUME) ||
> (isTitleName(IQ_INTELLIGENT_QUBE_US) && value == IQ_US_MAX_VOLUME)) {
> return;
> }
>
396a412,414
> if(isTitleName(ARMORED_CORE_JP) || isTitleName(ARMORED_CORE_MASTER_OF_ARENA)) {
> map_item(&mem_iortab[IOMEM16(0x1054)], sio1ReadCtrl16, 1);
> }
diff --new-file -w -r pcsx_rearmed/libpcsxcore/plugins.c pcsx_rearmed_custom/libpcsxcore/plugins.c
52a53,54
> GPUsetPatchFlag GPU_setPatchFlag;
> GPUboStatus GPU_boStatus;
93a96,97
> SPUfadein SPU_fadein;
> SPUenableRvbConfig SPU_enableRvbConfig;
244a249
> LoadGpuSym1(setPatchFlag, "GPUsetPatchFlag");
247a253
> LoadGpuSym1(boStatus, "GPUboStatus");
363a370,371
> LoadSpuSym1(fadein, "SPUfadein");
> LoadSpuSym1(enableRvbConfig, "SPUenableRvbConfig");
diff --new-file -w -r pcsx_rearmed/libpcsxcore/plugins.h pcsx_rearmed_custom/libpcsxcore/plugins.h
81a82
> typedef uint32_t (CALLBACK* GPUboStatus)(void);
84a86,87
> uint32_t ulEventStatus;
> uint32_t ulEventCnt;
92a96
> typedef void (CALLBACK* GPUsetPatchFlag)(int, int);
117a122,123
> extern GPUsetPatchFlag GPU_setPatchFlag;
> extern GPUboStatus GPU_boStatus;
201a208,209
> int volume;
> int reverb;
205a214,216
> typedef void (CALLBACK* SPUfadein)(void);
> typedef void (CALLBACK* SPUenableRvbConfig)(int);
>
227a239,240
> extern SPUfadein SPU_fadein;
> extern SPUenableRvbConfig SPU_enableRvbConfig;
diff --new-file -w -r pcsx_rearmed/libpcsxcore/psxcounters.c pcsx_rearmed_custom/libpcsxcore/psxcounters.c
26a27,28
> #include "../libpcsxcore/title.h"
> int isTitleName(enum TITLE_NAME argTitleName);
63c65
< static const u32 HSyncTotal[] = { 263, 313 };
---
> static u32 HSyncTotal[] = { 263, 313 };
81a84,96
> #define HSYNC_ADJUSTED 297
> void change_HSync_Motionjpeg(int onoff){
>
> if(onoff)
> {
> HSyncTotal[0] = 263;
> }
> else
> {
> HSyncTotal[0] = HSYNC_ADJUSTED;
> }
> }
>
460a476,485
> if(isTitleName(METAL_GEAR_SOLID_DISC_1_JP) ||
> isTitleName(METAL_GEAR_SOLID_DISC_2_JP) ||
> isTitleName(METAL_GEAR_SOLID_DISC_1_US) ||
> isTitleName(METAL_GEAR_SOLID_DISC_2_US)){
> HSyncTotal[0] = HSYNC_ADJUSTED;
> }
> else if(isTitleName(SAGAFRONTIER_JP)){
> HSyncTotal[0] = 290;
> }
>
496a522,546
> if(Mode == 2) {
> int iRetSize = sizeof(rcnts) \
> + sizeof(hSyncCount) \
> + sizeof(spuSyncCount) \
> + sizeof(psxNextCounter) \
> + sizeof(psxNextsCounter);
>
> if(f) {
> memcpy(f, &rcnts, sizeof(rcnts) );
> f = (void *)((char *)f + sizeof(rcnts));
>
> memcpy(f, &hSyncCount, sizeof(hSyncCount) );
> f = (void *)((char *)f + sizeof(hSyncCount));
>
> memcpy(f, &spuSyncCount, sizeof(spuSyncCount) );
> f = (void *)((char *)f + sizeof(spuSyncCount));
>
> memcpy(f, &psxNextCounter, sizeof(psxNextCounter) );
> f = (void *)((char *)f + sizeof(psxNextCounter));
>
> memcpy(f, &psxNextsCounter, sizeof(psxNextsCounter) );
> f = (void *)((char *)f + sizeof(psxNextsCounter));
> }
> return iRetSize;
> } else {
519a570
> }
diff --new-file -w -r pcsx_rearmed/libpcsxcore/psxdma.c pcsx_rearmed_custom/libpcsxcore/psxdma.c
25a26
> #include "title.h"
199c200,206
< GPUDMA_INT(size);
---
> u32 offset = 0;
> if (isTitleName(TOSHINDEN_JP)) {
> if (!(HW_GPU_STATUS & PSXGPU_ILACE_BITS)) {
> offset = 240000;
> }
> }
> GPUDMA_INT(size + offset);
252c259,273
< GPUOTCDMA_INT(16);
---
>
> u32 offset = 0;
> if (isTitleName(TOSHINDEN_EU) ||
> isTitleName(TOSHINDEN_JP) ||
> isTitleName(TOSHINDEN_US)) {
> if (!(HW_GPU_STATUS & PSXGPU_ILACE_BITS)) {
> offset = 340000;
> }
> }
> else if (isTitleName(KAGERO_JP)) {
> if (!(HW_GPU_STATUS & PSXGPU_ILACE_BITS)) {
> offset = 180000;
> }
> }
> GPUOTCDMA_INT(16 + offset);
diff --new-file -w -r pcsx_rearmed/libpcsxcore/r3000a.h pcsx_rearmed_custom/libpcsxcore/r3000a.h
195c195,196
< void new_dyna_freeze(void *f, int mode);
---
> int new_dyna_freeze(void *f, int mode);
> void new_dyna_freeze_data(unsigned char** buff_out, int* size_out);
diff --new-file -w -r pcsx_rearmed/libpcsxcore/sio.c pcsx_rearmed_custom/libpcsxcore/sio.c
25a26,27
> #include "../frontend/libpicofe/input.h"
> #include <unistd.h>
68a71
> unsigned int memcardFlag = 0;
205a209
> memcardFlag=1;
231c235,241
< case 0x2002: buf[0] = PAD2_startPoll(2); break;
---
> case 0x2002:
> if(p2_connected) {
> buf[0] = PAD2_startPoll(2);
> } else {
> goto no_device;
> }
> break;
373a384,387
> unsigned short sio1ReadCtrl16() {
> return 0x80;
> }
>
478a493,494
> int fd = fileno(f);
> fsync(fd);
647a664
> fsync(fileno(f));
659a677
> fsync(fileno(f));
688a707
> fsync(fileno(f));
693a713
> fsync(fileno(f));
710a731
> fsync(fileno(f));
715a737
> fsync(fileno(f));
815a838,891
> if(Mode == 2) {
> int iRetSize = sizeof(buf) \
> + sizeof(StatReg) \
> + sizeof(ModeReg) \
> + sizeof(CtrlReg) \
> + sizeof(BaudReg) \
> + sizeof(bufcount) \
> + sizeof(parp) \
> + sizeof(mcdst) \
> + sizeof(rdwr) \
> + sizeof(adrH) \
> + sizeof(adrL) \
> + sizeof(padst);
>
> if(f) {
> memcpy(f,buf, sizeof(buf));
> f = (void *)((char *)f + sizeof(buf));
>
> memcpy(f, &StatReg, sizeof(StatReg));
> f = (void *)((char *)f + sizeof(StatReg));
>
> memcpy(f, &ModeReg, sizeof(ModeReg));
> f = (void *)((char *)f + sizeof(ModeReg));
>
> memcpy(f, &CtrlReg, sizeof(CtrlReg));
> f = (void *)((char *)f + sizeof(CtrlReg));
>
> memcpy(f, &BaudReg, sizeof(BaudReg));
> f = (void *)((char *)f + sizeof(BaudReg));
>
> memcpy(f, &bufcount, sizeof(bufcount));
> f = (void *)((char *)f + sizeof(bufcount));
>
> memcpy(f, &parp, sizeof(parp));
> f = (void *)((char *)f + sizeof(parp));
>
> memcpy(f, &mcdst, sizeof(mcdst));
> f = (void *)((char *)f + sizeof(mcdst));
>
> memcpy(f, &rdwr, sizeof(rdwr));
> f = (void *)((char *)f + sizeof(rdwr));
>
> memcpy(f, &adrH, sizeof(adrH));
> f = (void *)((char *)f + sizeof(adrH));
>
> memcpy(f, &adrL, sizeof(adrL));
> f = (void *)((char *)f + sizeof(adrL));
>
> memcpy(f, &padst, sizeof(padst));
> f = (void *)((char *)f + sizeof(padst));
> }
> return iRetSize;
>
> } else {
830a907
> }
diff --new-file -w -r pcsx_rearmed/libpcsxcore/sio.h pcsx_rearmed_custom/libpcsxcore/sio.h
48a49
> unsigned short sio1ReadCtrl16();
diff --new-file -w -r pcsx_rearmed/libpcsxcore/title.h pcsx_rearmed_custom/libpcsxcore/title.h
0a1,299
> #ifndef _TITLE_H
> #define _TITLE_H
>
> #define INCLUDE_TITLE_NUMBER 20
>
> enum TITLE_NAME {
> ARC_THE_LAD_JP,
> ARC_THE_LAD_2_JP,
> ARMORED_CORE_JP,
> ARMORED_CORE_MASTER_OF_ARENA,
> CHOCOBOS_JP,
> COLIN_MCRAE_RALLY_EU,
> COOL_BOARDERS_2_EU,
> CRASH_BANDICOOT_EU,
> CRASH_BANDICOOT_US,
> CRASH_BANDICOOT_2_EU,
> CRASH_BANDICOOT_2_JP,
> CRASH_BANDICOOT_2_US,
> DESTRUCTION_DERBY_EU,
> DESTRUCTION_DERBY_US,
> DISNEY_TOY_STORY_2_EU,
> DRIVER_EU,
> DRIVER_US,
> EHRGEIZ_JP,
> FIGHTING_FORCE_US,
> FINAL_FANTANSY_VII_DICS_1_EU,
> FINAL_FANTANSY_VII_DICS_1_JP,
> FINAL_FANTANSY_VII_DICS_1_US,
> FINAL_FANTANSY_VII_DICS_2_EU,
> FINAL_FANTANSY_VII_DICS_2_JP,
> FINAL_FANTANSY_VII_DICS_2_US,
> FINAL_FANTANSY_VII_DICS_3_EU,
> FINAL_FANTANSY_VII_DICS_3_JP,
> FINAL_FANTANSY_VII_DICS_3_US,
> FINAL_FANTANSY_VII_DICS_4_JP,
> G_DARIUS_JP,
> GRADIUS_GAIDEN_JP,
> GRAN_TURISMO_EU,
> GRAN_TURISMO_JP,
> GRAN_TURISMO_US,
> GRAND_THEFT_AUTO_2_EU,
> GRAND_THEFT_AUTO_2_US,
> GRAND_THEFT_AUTO_EU,
> GRAND_THEFT_AUTO_US,
> HARRY_POTTER_AND_THE_PHILOSOPHERS_STONE_EU,
> IQ_INTELLIGENT_QUBE_JP,
> IQ_INTELLIGENT_QUBE_US,
> JUMPING_FLASH_EU,
> JUMPING_FLASH_JP,
> JUMPING_FLASH_US,
> KAGERO_JP,
> KLONOA_DOOR_TO_PHANTAMILE_JP,
> KLONOA_DOOR_TO_PHANTAMILE_US,
> KULA_WORLD_EU,
> LEGACY_OF_KAIN_SOUL_REAVER_EU,
> LEGACY_OF_KAIN_SOUL_REAVER_US,
> MEDAL_OF_HONOR_EU,
> MEDAL_OF_HONOR_US,
> MEDIEVIL_EU,
> MEDIEVIL_US,
> MEGA_MAM_LEGENDS_EU,
> MEGA_MAM_LEGENDS_JP,
> MEGA_MAM_LEGENDS_US,
> METAL_GEAR_SOLID_DISC_1_EU,
> METAL_GEAR_SOLID_DISC_1_JP,
> METAL_GEAR_SOLID_DISC_1_US,
> METAL_GEAR_SOLID_DISC_2_EU,
> METAL_GEAR_SOLID_DISC_2_JP,
> METAL_GEAR_SOLID_DISC_2_US,
> MR_DRILLER_EU,
> MR_DRILLER_G_JP,
> MR_DRILLER_JP,
> MR_DRILLER_US,
> ODDWORLD_ABES_ODDYSEE_EU,
> ODDWORLD_ABES_ODDYSEE_US,
> PACAPACA_PASSION_JP,
> PARAPPA_THE_RAPPER_US,
> PARASITE_EVE_DISC_1_JP,
> PARASITE_EVE_DISC_1_US,
> PARASITE_EVE_DISC_2_JP,
> PARASITE_EVE_DISC_2_US,
> PERSONA_JP,
> PERSONA_US,
> RAY_STORM_JP,
> RAYMAN_US,
> RESIDENT_EVIL_EU,
> RESIDENT_EVIL_JP,
> RESIDENT_EVIL_US,
> RIDGE_RACER_EU,
> RIDGE_RACER_JP,
> RIDGE_RACER_US,
> RIDGE_RACER_TYPE_4_EU,
> RIDGE_RACER_TYPE_4_JP,
> RIDGE_RACER_TYPE_4_US,
> SAGAFRONTIER_JP,
> SILENT_HILL_EU,
> SILENT_HILL_JP,
> SILENT_HILL_US,
> SPEC_OPS_STEALTH_PATROL_US,
> STREET_FIGHTER_ALPHA_3_US,
> STREET_FIGHTER_EX_PLUS_EU,
> STREET_FIGHTER_EX_PLUS_JP,
> STREET_FIGHTER_EX_PLUS_US,
> SUIKODEN_EU,
> SUIKODEN_JP,
> SUIKODEN_US,
> SUPER_PUZZLE_FIGHTER_2_TURBO_US,
> SUPER_PUZZLE_FIGHTER_2_X_JP,
> SYPHON_FILTER_US,
> TEKKEN3_EU,
> TEKKEN3_JP,
> TOM_CLANCYS_RAINBOW_SIX_EU,
> TOMB_RAIDER_2_EU,
> TOMB_RAIDER_2_JP,
> TOMB_RAIDER_2_US,
> TOMB_RAIDER_EU,
> TOMB_RAIDER_JP,
> TOMB_RAIDER_US,
> TOMBA_JP,
> TOMBA_US,
> TONY_HAWK_SKATE_BOARDING_EU,
> TONY_HAWKS_PRO_SKATER_2_EU,
> TONY_HAWKS_PRO_SKATER_2_US,
> TOSHINDEN_EU,
> TOSHINDEN_JP,
> TOSHINDEN_US,
> TWISTED_METAL_US,
> VAGRANT_STORY_EU,
> VAGRANT_STORY_US,
> WILD_ARMS_2_DISC_1_JP,
> WILD_ARMS_2_DISC_2_JP,
> WILD_ARMS_JP,
> WILD_ARMS_US,
> XEVIOUS_3D_G_JP,
> XEVIOUS_3D_G_US,
> XI_EU,
> XI_JP,
> TITLE_NAME_NONE
> };
>
> struct INCLUDE_TITLE {
> char *m_cpCdromId;
> enum TITLE_NAME m_eTitleName;
> } INCLUDE_TITLE;
>
> static struct INCLUDE_TITLE stTitleList[] = {
> {"SCPS10008" , ARC_THE_LAD_JP},
> {"SCPS10026" , ARC_THE_LAD_2_JP},
> {"SLPS00900" , ARMORED_CORE_JP},
> {"SLPS91444" , ARMORED_CORE_MASTER_OF_ARENA},
> {"SLPS01234" , CHOCOBOS_JP},
> {"SLES00477" , COLIN_MCRAE_RALLY_EU},
> {"SCES00992" , COOL_BOARDERS_2_EU},
> {"SCES00344" , CRASH_BANDICOOT_EU},
> {"SCUS94900" , CRASH_BANDICOOT_US},
> {"SCES00967" , CRASH_BANDICOOT_2_EU},
> {"SCPS10047" , CRASH_BANDICOOT_2_JP},
> {"SCUS94154" , CRASH_BANDICOOT_2_US},
> {"SCES00008" , DESTRUCTION_DERBY_EU},
> {"SCUS94302" , DESTRUCTION_DERBY_US},
> {"SLES02067" , DISNEY_TOY_STORY_2_EU},
> {"SLES01816" , DRIVER_EU},
> {"SLUS00842" , DRIVER_US},
> {"SLPS01750" , EHRGEIZ_JP},
> {"SLUS00433" , FIGHTING_FORCE_US},
> {"SCES00867" , FINAL_FANTANSY_VII_DICS_1_EU},
> {"SLPS01057" , FINAL_FANTANSY_VII_DICS_1_JP},
> {"SCUS94163" , FINAL_FANTANSY_VII_DICS_1_US},
> {"SCES10867" , FINAL_FANTANSY_VII_DICS_2_EU},
> {"SLPS01058" , FINAL_FANTANSY_VII_DICS_2_JP},
> {"SCUS94164" , FINAL_FANTANSY_VII_DICS_2_US},
> {"SCES20867" , FINAL_FANTANSY_VII_DICS_3_EU},
> {"SLPS01059" , FINAL_FANTANSY_VII_DICS_3_JP},
> {"SCUS94165" , FINAL_FANTANSY_VII_DICS_3_US},
> {"SLPS01060" , FINAL_FANTANSY_VII_DICS_4_JP},
> {"SLPS01348" , G_DARIUS_JP},
> {"SLPM86042" , GRADIUS_GAIDEN_JP},
> {"SCES00984" , GRAN_TURISMO_EU},
> {"SCPS10045" , GRAN_TURISMO_JP},
> {"SCUS94194" , GRAN_TURISMO_US},
> {"SLES01404" , GRAND_THEFT_AUTO_2_EU},
> {"SLUS00789" , GRAND_THEFT_AUTO_2_US},
> {"SLES00032" , GRAND_THEFT_AUTO_EU},
> {"SLUS00106" , GRAND_THEFT_AUTO_US},
> {"SLES03662" , HARRY_POTTER_AND_THE_PHILOSOPHERS_STONE_EU},
> {"SCPS10029" , IQ_INTELLIGENT_QUBE_JP},
> {"SCUS94181" , IQ_INTELLIGENT_QUBE_US},
> {"SCES00003" , JUMPING_FLASH_EU},
> {"SCPS10007" , JUMPING_FLASH_JP},
> {"SCUS94103" , JUMPING_FLASH_US},
> {"SLPS01421" , KAGERO_JP},
> {"SLPS01010" , KLONOA_DOOR_TO_PHANTAMILE_JP},
> {"SLUS00585" , KLONOA_DOOR_TO_PHANTAMILE_US},
> {"SCES01000" , KULA_WORLD_EU},
> {"SLES01301" , LEGACY_OF_KAIN_SOUL_REAVER_EU},
> {"SLUS00708" , LEGACY_OF_KAIN_SOUL_REAVER_US},
> {"SLES02470" , MEDAL_OF_HONOR_EU},
> {"SLUS00974" , MEDAL_OF_HONOR_US},
> {"SCES00311" , MEDIEVIL_EU},
> {"SCUS94227" , MEDIEVIL_US},
> {"SLES01485" , MEGA_MAM_LEGENDS_EU},
> {"SLPS01141" , MEGA_MAM_LEGENDS_JP},
> {"SLUS00603" , MEGA_MAM_LEGENDS_US},
> {"SLES01370" , METAL_GEAR_SOLID_DISC_1_EU},
> {"SLPM86114" , METAL_GEAR_SOLID_DISC_1_JP},
> {"SLUS00594" , METAL_GEAR_SOLID_DISC_1_US},
> {"SLES11370" , METAL_GEAR_SOLID_DISC_2_EU},
> {"SLPM86115" , METAL_GEAR_SOLID_DISC_2_JP},
> {"SLUS00776" , METAL_GEAR_SOLID_DISC_2_US},
> {"SCES02771" , MR_DRILLER_EU},
> {"SLPS03336" , MR_DRILLER_G_JP},
> {"SLPS02600" , MR_DRILLER_JP},
> {"SLUS01111" , MR_DRILLER_US},
> {"SLES00664" , ODDWORLD_ABES_ODDYSEE_EU},
> {"SLUS00190" , ODDWORLD_ABES_ODDYSEE_US},
> {"SLPS02122" , PACAPACA_PASSION_JP},
> {"SCUS94183" , PARAPPA_THE_RAPPER_US},
> {"SLPS01230" , PARASITE_EVE_DISC_1_JP},
> {"SLUS00662" , PARASITE_EVE_DISC_1_US},
> {"SLPS01231" , PARASITE_EVE_DISC_2_JP},
> {"SLUS00668" , PARASITE_EVE_DISC_2_US},
> {"SLPS00500" , PERSONA_JP},
> {"SLUS00339" , PERSONA_US},
> {"SLPS00678" , RAY_STORM_JP},
> {"SLUS00005" , RAYMAN_US},
> {"SLES00969" , RESIDENT_EVIL_EU},
> {"SLPS00998" , RESIDENT_EVIL_JP},
> {"SLUS00747" , RESIDENT_EVIL_US},
> {"SCES00001" , RIDGE_RACER_EU},
> {"SLPS00001" , RIDGE_RACER_JP},
> {"SCUS94300" , RIDGE_RACER_US},
> {"SCES01706" , RIDGE_RACER_TYPE_4_EU},
> {"SLPS01800" , RIDGE_RACER_TYPE_4_JP},
> {"SLUS00797" , RIDGE_RACER_TYPE_4_US},
> {"SLPS00898" , SAGAFRONTIER_JP},
> {"SLES01514" , SILENT_HILL_EU},
> {"SLPM86192" , SILENT_HILL_JP},
> {"SLUS00707" , SILENT_HILL_US},
> {"SLUS01131" , SPEC_OPS_STEALTH_PATROL_US},
> {"SLUS00821" , STREET_FIGHTER_ALPHA_3_US},
> {"SLES00939" , STREET_FIGHTER_EX_PLUS_EU},
> {"SLPM86041" , STREET_FIGHTER_EX_PLUS_JP},
> {"SLUS00548" , STREET_FIGHTER_EX_PLUS_US},
> {"SLES00527" , SUIKODEN_EU},
> {"SLPS00097" , SUIKODEN_JP},
> {"SLUS00292" , SUIKODEN_US},
> {"SLUS00418" , SUPER_PUZZLE_FIGHTER_2_TURBO_US},
> {"SLPS00611" , SUPER_PUZZLE_FIGHTER_2_X_JP},
> {"SCUS94240" , SYPHON_FILTER_US},
> {"SCES01237" , TEKKEN3_EU},
> {"SLPS01300" , TEKKEN3_JP},
> {"SLES01136" , TOM_CLANCYS_RAINBOW_SIX_EU},
> {"SLES00718" , TOMB_RAIDER_2_EU},
> {"SLPS01200" , TOMB_RAIDER_2_JP},
> {"SLUS00437" , TOMB_RAIDER_2_US},
> {"SLES00024" , TOMB_RAIDER_EU},
> {"SLPS00617" , TOMB_RAIDER_JP},
> {"SLUS00152" , TOMB_RAIDER_US},
> {"SLPS01144" , TOMBA_JP},
> {"SCUS94236" , TOMBA_US},
> {"SLES02055" , TONY_HAWK_SKATE_BOARDING_EU},
> {"SLES02908" , TONY_HAWKS_PRO_SKATER_2_EU},
> {"SLUS01066" , TONY_HAWKS_PRO_SKATER_2_US},
> {"SCES00002" , TOSHINDEN_EU},
> {"SLPS00025" , TOSHINDEN_JP},
> {"SCUS94200" , TOSHINDEN_US},
> {"SCUS94304" , TWISTED_METAL_US},
> {"SLES02754" , VAGRANT_STORY_EU},
> {"SLUS01040" , VAGRANT_STORY_US},
> {"SCPS10089" , WILD_ARMS_2_DISC_1_JP},
> {"SCPS10090" , WILD_ARMS_2_DISC_2_JP},
> {"SCPS10028" , WILD_ARMS_JP},
> {"SCUS94608" , WILD_ARMS_US},
> {"SLPS00750" , XEVIOUS_3D_G_JP},
> {"SLUS00461" , XEVIOUS_3D_G_US},
> {"SCES01312" , XI_EU},
> {"SCPS10051" , XI_JP},
> {"\0" , TITLE_NAME_NONE}
> };
> static enum TITLE_NAME g_eTitleName = TITLE_NAME_NONE;
>
> #define GPU_PATCH_SCREEN_ADJUST (0x00000001)
> #define GPU_PATCH_IS_FF7 (0x00000002)
> #define GPU_PATCH_IS_MR_DRILLER (0x00000004)
> #define GPU_PATCH_ADD_VRAM2 (0x00000008)
> #define GPU_PATCH_IS_MR_DRILLER_JP (0x00000010)
> #define GPU_PATCH_ADD_BO (0x00000020)
> #define GPU_PATCH_ARC_THE_LAD (0x00000080)
>
> #define TOSHINDEN_DEFAULT_VOLUME 0x4890
> #define TOSHINDEN_JP_DEFAULT_VOLUME 0x3870
> #define IQ_JP_MAX_VOLUME 0x7fff
> #define IQ_US_MAX_VOLUME 0x7ffe
> #define ARMORED_CORE_JP_MAX_VOLUME 0x3f7e
> #define TOM_CLANCYS_RAINBOW_SIX_EU_MAX_VOLUME 0x3fff
> #define PARASITE_EVE_JP_ENABLE_VOLUME 0x600
> #define PARASITE_EVE_JP_DISABLE_VOLUME 0xffff8000
>
> #endif
diff --new-file -w -r pcsx_rearmed/Makefile pcsx_rearmed_custom/Makefile
5a6,8
> ifdef CONFIG_ENABLE_MENU
> CFLAGS += -DCONFIG_ENABLE_MENU
> endif
diff --new-file -w -r pcsx_rearmed/plugins/dfsound/alsa.c pcsx_rearmed_custom/plugins/dfsound/alsa.c
42c42,43
< const char *alsa_name = "default";
---
> // const char *alsa_name = "default";
> const char *alsa_name = "plughw:0,2";
diff --new-file -w -r pcsx_rearmed/plugins/dfsound/externals.h pcsx_rearmed_custom/plugins/dfsound/externals.h
242a243,246
> extern int xaSave_iLeftVolume;
> extern int xaSave_iRightVolume;
> extern unsigned char State_CdlPause;
>
diff --new-file -w -r pcsx_rearmed/plugins/dfsound/freeze.c pcsx_rearmed_custom/plugins/dfsound/freeze.c
24a25
> #include "spu_config.h"
116a118,120
> unsigned char *SPUInfo;
> int volume;
> int reverb;
231,232c235
<
< if(!pF) return 0; // first check
---
> size_t size;
238,240c241,247
< if(ulFreezeMode==1)
< memset(pF,0,sizeof(SPUFreeze_t)+sizeof(SPUOSSFreeze_t));
<
---
> size = sizeof(SPUFreeze_t)+sizeof(SPUOSSFreeze_t);
> if(ulFreezeMode==1) {
> if(pF) {
> memset(pF,0,size);
> }
> }
> if(pF) {
243c250,251
< pF->ulFreezeSize=sizeof(SPUFreeze_t)+sizeof(SPUOSSFreeze_t);
---
> pF->ulFreezeSize=size;
> }
245c253,254
< if(ulFreezeMode==2) return 1; // info mode? ok, bye
---
> if(ulFreezeMode==2) return (long)size; // info mode? ok, bye
> if(!pF) return 0; // first check
273a283,285
> pF->volume = spu_config.iVolume;
> pF->reverb = SPUisRvbConfigEnabled();
>
278a291
> if(!pF) return 0; // first check
279a293
> SPUResetStream(); // reset SPU stream buffer
312a327,329
>
> spu_config.iVolume = pF->volume;
> SPUenableRvbConfig(pF->reverb);
diff --new-file -w -r pcsx_rearmed/plugins/dfsound/registers.c pcsx_rearmed_custom/plugins/dfsound/registers.c
24a25
> #include "../../libpcsxcore/title.h"
33a35
> static int SetDisableVolumeChange(short vol);
53a56,59
> static int isAlreadyRunBiosLogo = 0;
> static int spuOn2OffCnt = 0;
> unsigned short former_spuCtrl;
>
104a111,116
> if (isTitleName(PARASITE_EVE_DISC_1_JP) ||
> isTitleName(PARASITE_EVE_DISC_1_US) ||
> isTitleName(PARASITE_EVE_DISC_2_JP) ||
> isTitleName(PARASITE_EVE_DISC_2_US)) {
> spu.s_chan[ch].ADSRX.ReleaseRate = ((lval & 0x001f)*9)/10;
> } else {
105a118
> }
139a153,165
>
> if (isAlreadyRunBiosLogo == 0) {
> former_spuCtrl = spu.spuCtrl;
>
> if ((!(val & 0x8000)) && (former_spuCtrl & 0x8000)) {
> // waiting until sound data has been played.
> while (SOUND_isPlaying()) {};
>
> if (++spuOn2OffCnt > 2) {
> isAlreadyRunBiosLogo = 1;
> }
> }
> }
170a197
> */
173c200,228
< //auxprintf("ML %d\n",val);
---
> if (isTitleName(ARMORED_CORE_JP)) {
> double percent = (double)val / ARMORED_CORE_JP_MAX_VOLUME;
> spu_config.iVolume = 768 * percent;
> } else if (isTitleName(CRASH_BANDICOOT_2_EU) ||
> isTitleName(CRASH_BANDICOOT_2_JP) ||
> isTitleName(CRASH_BANDICOOT_2_US) ||
> isTitleName(JUMPING_FLASH_EU) ||
> isTitleName(JUMPING_FLASH_JP) ||
> isTitleName(JUMPING_FLASH_US) ||
> isTitleName(METAL_GEAR_SOLID_DISC_1_EU) ||
> isTitleName(METAL_GEAR_SOLID_DISC_2_EU) ||
> isTitleName(METAL_GEAR_SOLID_DISC_1_JP) ||
> isTitleName(METAL_GEAR_SOLID_DISC_2_JP) ||
> isTitleName(METAL_GEAR_SOLID_DISC_1_US) ||
> isTitleName(METAL_GEAR_SOLID_DISC_2_US) ||
> isTitleName(SILENT_HILL_EU) ||
> isTitleName(SILENT_HILL_JP) ||
> isTitleName(SILENT_HILL_US)) {
> if (val != 0) {
> spu.dwChannelOn = 0xffffff;
> spu_config.iVolume = 768;
> } else {
> spu.dwChannelOn = 0;
> spu_config.iVolume = 0;
> }
> } else if (isTitleName(TOM_CLANCYS_RAINBOW_SIX_EU)) {
> double percent = (double)val / TOM_CLANCYS_RAINBOW_SIX_EU_MAX_VOLUME;
> spu_config.iVolume = 768 * percent;
> }
177c232,260
< //auxprintf("MR %d\n",val);
---
> if (isTitleName(ARMORED_CORE_JP)) {
> double percent = (double)val / ARMORED_CORE_JP_MAX_VOLUME;
> spu_config.iVolume = 768 * percent;
> } else if (isTitleName(CRASH_BANDICOOT_2_EU) ||
> isTitleName(CRASH_BANDICOOT_2_JP) ||
> isTitleName(CRASH_BANDICOOT_2_US) ||
> isTitleName(JUMPING_FLASH_EU) ||
> isTitleName(JUMPING_FLASH_JP) ||
> isTitleName(JUMPING_FLASH_US) ||
> isTitleName(METAL_GEAR_SOLID_DISC_1_EU) ||
> isTitleName(METAL_GEAR_SOLID_DISC_2_EU) ||
> isTitleName(METAL_GEAR_SOLID_DISC_1_JP) ||
> isTitleName(METAL_GEAR_SOLID_DISC_2_JP) ||
> isTitleName(METAL_GEAR_SOLID_DISC_1_US) ||
> isTitleName(METAL_GEAR_SOLID_DISC_2_US) ||
> isTitleName(SILENT_HILL_EU) ||
> isTitleName(SILENT_HILL_JP) ||
> isTitleName(SILENT_HILL_US)) {
> if (val != 0) {
> spu.dwChannelOn = 0xffffff;
> spu_config.iVolume = 768;
> } else {
> spu.dwChannelOn = 0;
> spu_config.iVolume = 0;
> }
> } else if (isTitleName(TOM_CLANCYS_RAINBOW_SIX_EU)) {
> double percent = (double)val / TOM_CLANCYS_RAINBOW_SIX_EU_MAX_VOLUME;
> spu_config.iVolume = 768 * percent;
> }
179a263,264
>
> /*
205a291,307
> if (isTitleName(TOSHINDEN_EU) ||
> isTitleName(TOSHINDEN_JP) ||
> isTitleName(TOSHINDEN_US)) {
> unsigned short max = isTitleName(TOSHINDEN_JP) ?
> TOSHINDEN_JP_DEFAULT_VOLUME : TOSHINDEN_DEFAULT_VOLUME;
> if (val == max) {
> break;
> }
> }
>
> if (isTitleName(GRADIUS_GAIDEN_JP)) {
> if (State_CdlPause == 1) {
> xaSave_iLeftVolume = val & 0x7fff;
> break;
> }
> }
>
209a312,318
> if (isTitleName(GRADIUS_GAIDEN_JP)) {
> if (State_CdlPause == 1) {
> xaSave_iRightVolume = val & 0x7fff;
> break;
> }
> }
>
430a540,545
> if (isTitleName(PARASITE_EVE_DISC_1_JP) && ch <= 1) {
> if (SetDisableVolumeChange(vol)) {
> return;
> }
> }
>
456a572,577
> if (isTitleName(PARASITE_EVE_DISC_1_JP) && ch <= 1) {
> if (SetDisableVolumeChange(vol)) {
> return;
> }
> }
>
505a627,644
> }
>
> static int SetDisableVolumeChange(short vol) {
> static int DisableVolumeChange = 0;
> int disableVolume, enableVolume;
>
> if (isTitleName(PARASITE_EVE_DISC_1_JP)) {
> disableVolume = PARASITE_EVE_JP_DISABLE_VOLUME;
> enableVolume = PARASITE_EVE_JP_ENABLE_VOLUME;
> }
>
> if (vol == disableVolume) {
> DisableVolumeChange = 1;
> } else if (enableVolume <= vol) {
> DisableVolumeChange = 0;
> }
>
> return DisableVolumeChange;
diff --new-file -w -r pcsx_rearmed/plugins/dfsound/reverb.c pcsx_rearmed_custom/plugins/dfsound/reverb.c
73a74
> int shift;
106a108,113
> if (SPUisRvbConfigEnabled()) {
> shift = 16;
> } else {
> shift = 15;
> }
>
110c117
< g_buffer(ACC_SRC_D0) * rvb->ACC_COEF_D) >> 15;
---
> g_buffer(ACC_SRC_D0) * rvb->ACC_COEF_D) >> shift;
114c121
< g_buffer(ACC_SRC_D1) * rvb->ACC_COEF_D) >> 15;
---
> g_buffer(ACC_SRC_D1) * rvb->ACC_COEF_D) >> shift;
diff --new-file -w -r pcsx_rearmed/plugins/dfsound/sdl.c pcsx_rearmed_custom/plugins/dfsound/sdl.c
27a28,34
> volatile int g_isAudioPlaying = 0;
>
> #define DURATION_TIME_FOR_BG_SOUND 500
>
> int SOUND_isPlaying(void) {
> return g_isAudioPlaying;
> }
30a38,39
> static int fromPlayToStopCnt = 0;
> int waitSoundQueEmpty;
33a43,54
> if ((iReadPos == iWritePos) && (g_isAudioPlaying == 1)) {
>
> waitSoundQueEmpty = (int)((double)(DURATION_TIME_FOR_BG_SOUND) / ((len / 2) / 44.1)) + 1;
> if (++fromPlayToStopCnt > waitSoundQueEmpty) {
> g_isAudioPlaying = 0;
> }
>
> } else if ((iReadPos != iWritePos) && (g_isAudioPlaying == 0)) {
> g_isAudioPlaying = 1;
> fromPlayToStopCnt = 0;
> }
>
diff --new-file -w -r pcsx_rearmed/plugins/dfsound/spu.c pcsx_rearmed_custom/plugins/dfsound/spu.c
37a38,39
> #include "../../libpcsxcore/title.h"
>
77a80
> static int isRvbConfigEnabled = 0;
81a85,87
> void detect_pi(int ch, int ns_to);
> void set_bo_trg(int onoff, int ch);
>
252a259,266
>
> if ((isTitleName(SUIKODEN_EU) ||
> isTitleName(SUIKODEN_JP) ||
> isTitleName(SUIKODEN_US))&&
> ch == 0x15)
> {
> s_chan->ADSRX.SustainIncrease = 1;
> }
572,573c586,587
< StoreInterpolationVal(SB, sinc, fa, spu.s_chan[ch].bFMod==2),
< ChanBuf[ns] = iGetInterpolationVal(SB, sinc, *spos, spu.s_chan[ch].bFMod==2), )
---
> StoreInterpolationVal(SB, sinc, fa, spu.s_chan[ch].bFMod==2 && spu.s_chan[ch].iLeftVolume==0 && spu.s_chan[ch].iRightVolume==0),
> ChanBuf[ns] = iGetInterpolationVal(SB, sinc, *spos, spu.s_chan[ch].bFMod==2 && spu.s_chan[ch].iLeftVolume==0 && spu.s_chan[ch].iRightVolume==0), )
788c802
< else if (s_chan->bFMod == 2
---
> else if ((s_chan->bFMod == 2 && s_chan->iLeftVolume == 0 && s_chan->iRightVolume == 0)
812,813c826,828
< if (s_chan->bFMod == 2) // fmod freq channel
< memcpy(iFMod, &ChanBuf, ns_to * sizeof(iFMod[0]));
---
> if (s_chan->bFMod == 2) { // fmod freq channel
> memcpy(iFMod, ChanBuf, ns_to * sizeof(iFMod[0]));
> }
1016c1031
< else if (s_chan->bFMod == 2
---
> else if ((s_chan->bFMod == 2 && s_chan->iLeftVolume == 0 && s_chan->iRightVolume == 0)
1036,1037c1051,1057
< if (s_chan->bFMod == 2) // fmod freq channel
< memcpy(iFMod, &ChanBuf, ns_to * sizeof(iFMod[0]));
---
> if (isTitleName(METAL_GEAR_SOLID_DISC_1_JP) || isTitleName(METAL_GEAR_SOLID_DISC_1_US)){
> detect_pi(ch, ns_to);
> }
>
> if (s_chan->bFMod == 2) { // fmod freq channel
> memcpy(iFMod, ChanBuf, ns_to * sizeof(iFMod[0]));
> }
1195a1216
> memset(SSumLR, 0, ns_to * 2 * sizeof(SSumLR[0]));
1346a1368,1374
> // SPU Reset stream buffer
> int SPUResetStream(void) {
> RemoveStreams();
> SetupStreams();
> return 0;
> }
>
1638a1667,1783
> int pi_first[]={
> 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
> 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000223, 0x00001093,
> 0x00001f21, 0x00002c93, 0x0000391f, 0x00004593, 0x00005140, 0x00005b8c, 0x00006497, 0x00006ca4};
>
> void detect_pi(int ch, int ns_to){
>
> int result = 0;
> int pi_size = (sizeof(pi_first)/sizeof(int));
> int i=0,start_index=0,end_index=0,remain=0;
> static int judge_nextdata[24]={0};
> static int judge_nextdata_index[24]={0};
>
> if(!judge_nextdata[ch]){
> if(pi_size <= ns_to){
> start_index = 0;
> end_index = pi_size;
> }
> else{
> start_index = 0;
> end_index = ns_to;
> remain=1;
> }
> }
> else{
> if((pi_size - judge_nextdata_index[ch]) <= ns_to){
> start_index = judge_nextdata_index[ch];
> end_index = pi_size - judge_nextdata_index[ch];
> }
> else{
> start_index = judge_nextdata_index[ch];
> end_index = ns_to;
> remain=1;
> }
> }
>
> for(i=0; i<end_index; i++){
> if( ChanBuf[i] != pi_first[start_index + i]){
> break;
> }
> }
>
> if((i == end_index) && (remain ==1)){
> judge_nextdata[ch] = 1;
> judge_nextdata_index[ch] = start_index + i;
> }
> else if(i == end_index){
> result = 1;
> }
> else{
> judge_nextdata[ch] = 0;
> judge_nextdata_index[ch] = 0;
> }
>
> if (result == 1) {
> set_bo_trg(1, ch);
> memset(judge_nextdata,0,sizeof(judge_nextdata));
> memset(judge_nextdata_index,0,sizeof(judge_nextdata_index));
> }
> else {
> set_bo_trg(0, ch);
> }
> }
>
> void CALLBACK SPUfadein(void)
> {
> int end = spu_config.iVolume;
> float t, v;
>
> spu_config.iVolume = 0;
> usleep(300000);
>
> if (spu_config.iVolume != 0) end = spu_config.iVolume;
>
> for (t = -2; t <= 2; t += 0.125) {
> v = (tanh(t) + 1) * (end / 2.0);
> spu_config.iVolume = (int)v;
> usleep(62500);
> if (spu_config.iVolume != (int)v) end = spu_config.iVolume;
> }
>
> spu_config.iVolume = end;
>
> return;
> }
>
> void CALLBACK SPUenableRvbConfig(int val)
> {
> if (isTitleName(ARC_THE_LAD_JP)) {
> isRvbConfigEnabled = val;
> if (isRvbConfigEnabled) {
> spu_config.iUseInterpolation = 3;
> spu_config.iTempo = 1;
> } else {
> spu_config.iUseInterpolation = 1;
> spu_config.iTempo = 0;
> }
> } else if (isTitleName(PARASITE_EVE_DISC_1_JP)) {
> isRvbConfigEnabled = val;
> }
>
> return;
> }
>
> int SPUisRvbConfigEnabled(void)
> {
> int val = 0;
>
> if (isTitleName(ARC_THE_LAD_JP)) {
> val = isRvbConfigEnabled;
> } else if (isTitleName(PARASITE_EVE_DISC_1_JP)) {
> val = isRvbConfigEnabled;
> }
>
> return val;
> }
>
diff --new-file -w -r pcsx_rearmed/plugins/dfsound/spu.h pcsx_rearmed_custom/plugins/dfsound/spu.h
20a21,24
> int SPUResetStream(void);
> void CALLBACK SPUfadein(void);
> void CALLBACK SPUenableRvbConfig(int val);
> int SPUisRvbConfigEnabled(void);
diff --new-file -w -r pcsx_rearmed/plugins/dfsound/xa.c pcsx_rearmed_custom/plugins/dfsound/xa.c
20a21,23
> #include "../../libpcsxcore/title.h"
>
> #include "../libpcsxcore/title.h"
24a28,29
> extern int isTitleName(enum TITLE_NAME argTitleName);
>
114a120,139
>
> if(isTitleName(JUMPING_FLASH_EU) ||
> isTitleName(GRADIUS_GAIDEN_JP) ||
> isTitleName(JUMPING_FLASH_JP) ||
> isTitleName(JUMPING_FLASH_US) ||
> isTitleName(KAGERO_JP) ||
> isTitleName(MEDIEVIL_EU) ||
> isTitleName(MEDIEVIL_US) ||
> isTitleName(RESIDENT_EVIL_EU) ||
> isTitleName(RESIDENT_EVIL_JP) ||
> isTitleName(RESIDENT_EVIL_US) ||
> isTitleName(STREET_FIGHTER_EX_PLUS_EU) ||
> isTitleName(STREET_FIGHTER_EX_PLUS_JP) ||
> isTitleName(STREET_FIGHTER_EX_PLUS_US) ||
> isTitleName(TEKKEN3_EU) ||
> isTitleName(TEKKEN3_JP) ||
> isTitleName(XEVIOUS_3D_G_JP) ||
> isTitleName(XEVIOUS_3D_G_US)) {
> spu.XARepeat = 0; // set up repeat
> } else {
115a141
> }
116a143,151
> if(isTitleName(MEGA_MAM_LEGENDS_EU) ||
> isTitleName(MEGA_MAM_LEGENDS_JP) ||
> isTitleName(MEGA_MAM_LEGENDS_US) ) {
> if(xap->stereo){
> iSize=((44100*xap->nsamples)/xap->freq); // get size
> } else {
> iSize=((45500*xap->nsamples)/xap->freq); // get size
> }
> } else {
121a157,158
> }
>
diff --new-file -w -r pcsx_rearmed/plugins/dfxvideo/gpu.c pcsx_rearmed_custom/plugins/dfxvideo/gpu.c
1078a1079,1080
> uint32_t ulEventStatus; // event status
> uint32_t ulEventCnt; // event count
1141a1144,1145
> scenes = &cbs->gpu_peops.scenes;
>
diff --new-file -w -r pcsx_rearmed/plugins/dfxvideo/gpu.h pcsx_rearmed_custom/plugins/dfxvideo/gpu.h
233a234
> extern int *scenes;
diff --new-file -w -r pcsx_rearmed/plugins/dfxvideo/gpulib_if.c pcsx_rearmed_custom/plugins/dfxvideo/gpulib_if.c
77c77,78
< #define PUTLE16(X, Y) do{*((uint16_t *)X)=HOST2LE16((uint16_t)Y);}while(0)
---
> #define PUTLE16(X, Y) do{*((uint16_t *)X)=HOST2LE16((uint16_t)Y); \
> if(GlobalTextTP!=2 && gpu.vram2) *((uint16_t *)(psxVuw_t + (X - psxVuw)))=HOST2LE16((uint16_t)Y);}while(0)
86a88,263
> static const unsigned int SKIP_DATA_MASK[12] = {
> 0xffffffff, 0x01ff03ff, 0x00000000, 0x00ffffff,
> 0x01ff03ff, 0x01e00000, 0x00ffffff, 0x01ff03ff,
> 0x00000000, 0x00ffffff, 0x01ff03ff, 0x00000000
> };
> #define CMD_DATA_COUNT (123)
> static unsigned int skip_frame_data[CMD_DATA_COUNT][12] = {
> /*135*/ 0x3c416752, 0x55ff60, 0x3ce0f258, 0x3f644e, 0x55ff6c, 0x90f251, 0x9324f38, 0x8cff5e, 0xd358, 0x8314d36, 0x8aff6b, 0x3e15d351,
> /*135*/ 0x3c808080, 0xff77ffe4, 0x3e892795, 0x3c808080, 0xff72ffeb, 0x1052696, 0x3c808080, 0xff75ffed, 0x3c802798, 0x3c808080, 0xff6ffff3, 0x3c802598,
> /*136*/ 0x3c416752, 0x56ff62, 0x3ce0f258, 0x3f644e, 0x55ff6e, 0x90f251, 0x8324f38, 0x8dff60, 0xffcad358, 0x8314d36, 0x8aff6d, 0x3c32d351,
> /*136*/ 0x3c808080, 0xff7affe5, 0x3e89008b, 0x3c808080, 0xff76ffeb, 0x100008f, 0x3c808080, 0xff79ffed, 0x91, 0x3c808080, 0xff72fff3, 0x3e890096,
> /*221*/ 0x3c50744d, 0xff56, 0x3cc0513e, 0x3c23371e, 0xffd0ff57, 0x92003e, 0x3c50744d, 0xff69, 0x8385100, 0x3c23371e, 0xffcbff69, 0xc0b0000,
> /*222*/ 0x3c50744d, 0xff57, 0x3cc0513e, 0x3c23371e, 0xffd0ff57, 0x92003e, 0x3c50744d, 0xff69, 0x645100, 0x3c23371e, 0xffcbff69, 0xc0b0000,
> /*287*/ 0x3c808080, 0x0034ffbc, 0x3e189d6b, 0x3c808080, 0x0035ffbc, 0x01059e6b, 0x3c808080, 0x0033ffbb, 0x3e899c6a, 0x3c808080, 0x0035ffbc, 0x01069e6b,
> /*287*/ 0x3c808080, 0xffe20074, 0x3e89b16e, 0x3c808080, 0xffe20071, 0x0100b267, 0x3c808080, 0xffe10073, 0x0014af6d, 0x3c808080, 0xffe20071, 0xfff7b067,
> /*287*/ 0x3c406550, 0xffe3ffdb, 0x3d20003f, 0x3c3c5f49, 0xffe5ffef, 0x91002f, 0x3c5d9482, 0x33ffda, 0x103f3f, 0x3c538471, 0x32ffef, 0x103f2f,
> /*288*/ 0x3c406550, 0xffe4ffdf, 0x3d20003f, 0x3c3c5f49, 0xffe6fff3, 0x91002f, 0x3c5d9482, 0x33ffde, 0x103f3f, 0x3c538471, 0x33fff3, 0x3c3d3f2f,
> /*338*/ 0x3c42683d, 0xff8affdd, 0x3e4d00d3, 0x3c6aa86d, 0xff890000, 0x1500b4, 0x3c42683d, 0xff92ffdf, 0x3c723ed3, 0x3c5d9b73, 0xff910007, 0x3c6f3eb4,
> /*339*/ 0x3c42683d, 0xff8fffdc, 0x3e4d00d3, 0x3c6aa86d, 0xff8effff, 0x1500b4, 0x3c42683d, 0xff96ffde, 0x3c723ed3, 0x3c5d9b73, 0xff960006, 0x3c6f3eb4,
> /*314*/ 0x3c42683d, 0xff8cffd9, 0x3e3d00d7, 0x3c42683d, 0xff8bfff7, 0x001500b8, 0x3c42683d, 0xff91ffdb, 0x3c5e3ed7, 0x3c6aa86d, 0xff91fffd, 0x3c6d3eb8,
> /*349*/ 0x3c42683d, 0xff96004a, 0x3e3d3ed7, 0x3c5d9b73, 0xff930021, 0x00153ef6, 0x3c42683d, 0xff8b004c, 0x3c5100d7, 0x3c6aa86d, 0xff890028, 0x3c6100f6,
> /*374*/ 0x3c42683d, 0xff95004a, 0x3e4d3ed3, 0x3c5d9b73, 0xff930021, 0x153ef2, 0x3c42683d, 0xff8a004d, 0x3c5100d3, 0x3c6aa86d, 0xff880028, 0x3c6100f2,
> /*375*/ 0x3c42683d, 0xff95004a, 0x3e4d3ed3, 0x3c5d9b73, 0xff930021, 0x153ef2, 0x3c42683d, 0xff8a004d, 0x3c5100d3, 0x3c6aa86d, 0xff890028, 0x3c6100f2,
> /*399*/ 0x3c456240, 0x100053, 0x3e868e00, 0x3c456240, 0x100070, 0x168e2e, 0x3c324f2d, 0x3b0055, 0x14eddc00, 0x3c324f2d, 0x3c0073, 0x10e8dc2e,
> /*400*/ 0x3c23371e, 0x110053, 0x3e81a0f4, 0x3c23371e, 0x100053, 0x13a0fa, 0x3c23371e, 0x3c0055, 0xeef4, 0x3c23371e, 0x3c0055, 0xffceeefa,
> /*540*/ 0x3c577555, 0xffc9009a, 0x3d20001b, 0x25d7d5d, 0xffca00b2, 0x910027, 0x537353, 0xffe5009d, 0xffae0e1b, 0x25a7d5d, 0xffe300b6, 0xffae0d27,
> /*541*/ 0x3c577555, 0xffc9009a, 0x3d20001b, 0x25d7d5d, 0xffca00b2, 0x910027, 0x537353, 0xffe5009d, 0x3c7f0e1b, 0x25a7d5d, 0xffe300b6, 0x3c800d27,
> /*541*/ 0x3c808080, 0x1c0010, 0x3e898bac, 0x3c808080, 0x1e0007, 0x1058ea6, 0x3c808080, 0x290016, 0xffa498b1, 0x3c808080, 0x2f000e, 0x3c809fab,
> /*79 */ 0x3c5a5549, 0xffd1ff76, 0x3bf07fa8, 0x0067645b, 0xffabff6d, 0x00135fa8, 0x006d6a63, 0xffd5ff9b, 0x3c817fc7, 0x0092918c, 0xffacff96, 0x0c195fc7,
> /*80 */ 0x3c5a5549, 0xffd2ff75, 0x3bf07fa8, 0x0067645b, 0xffabff6c, 0x00135fa8, 0x006d6a63, 0xffd5ff9b, 0x3c647fc7, 0x0092918c, 0xffacff95, 0x0c1c5fc7,
> /*81 */ 0x3c5a5549, 0xffd3ff74, 0x3bf07fa8, 0x0067645b, 0xffacff6b, 0x00135fa8, 0x006d6a63, 0xffd6ff9a, 0x3c817fc7, 0x0092918c, 0xffadff94, 0x0c195fc7,
> /*248*/ 0x3c75736e, 0xffabff4f, 0x3bf03fa8, 0x056f6c66, 0xff8fff4f, 0x00132fa8, 0x00969692, 0xffa7ff66, 0x00143fb7, 0x048a8984, 0xff8aff67, 0x003d2fb7,
> /*249*/ 0x3c6f6c66, 0xff90ff4f, 0x3bf02fa8, 0x0569665e, 0xff74ff51, 0x00131fa8, 0x048a8984, 0xff8aff67, 0x00142fb7, 0x047f7d77, 0xff6dff68, 0x00731fb7,
> /*248*/ 0x3c808080, 0xff7c0019, 0x3e1600ff, 0x3c808080, 0xff890000, 0x010100ff, 0x3c808080, 0xff7c0016, 0x001300ff, 0x3c808080, 0xff88fffe, 0x088400ff,
> /*249*/ 0x3c808080, 0xff81001b, 0x3e1600b3, 0x3c808080, 0xff8f0001, 0x010000a0, 0x3c808080, 0xff800018, 0x001300b1, 0x3c808080, 0xff8effff, 0x0884009e,
> /*302*/ 0x3c745b51, 0xfff3ff5c, 0x3bf03fe7, 0x3c463b31, 0xffceff5d, 0x001300e7, 0x3cffc0b6, 0xfff2ff80, 0x00173fa8, 0x3c785e54, 0xffccff81, 0x3e7a00a8,
> /*302*/ 0x3c745b51, 0xfff2ff5c, 0x3bf03fe7, 0x3c463b31, 0xffcdff5d, 0x001300e7, 0x3cffc0b6, 0xfff1ff80, 0x00173fa8, 0x3c785e54, 0xffcbff81, 0x001800a8,
> /*303*/ 0x3c745b51, 0xfff3ff5c, 0x3bf03fe7, 0x3c463b31, 0xffceff5d, 0x001300e7, 0x3cffc0b6, 0xfff3ff80, 0x45453fa8, 0x3c785e54, 0xffccff81, 0x424200a8,
> /* 23*/ 0x3c808080, 0x015bfff2, 0x3af85009, 0x3c808080, 0x0156ffec, 0x001a4711, 0x3c808080, 0x014cffe8, 0xfff94e00, 0x3c808080, 0x014cffe8, 0xfff24e00,
> /* 23*/ 0x3c808080, 0x014cffdf, 0x3af84e00, 0x3c808080, 0x0156ffdc, 0x001a4711, 0x3c808080, 0x015cffd8, 0xff8b5009, 0x3c808080, 0x015cffd8, 0xff9c5009,
> /* 24*/ 0x3c808080, 0x015bfff3, 0x3af8df96, 0x3c808080, 0x0156ffed, 0x0105df91, 0x3c808080, 0x014cffe9, 0x3b77df8e, 0x3c808080, 0x014cffe9, 0x001adf8e,
> /* 24*/ 0x3c808080, 0x014cffe0, 0x3af8df88, 0x3c808080, 0x0156ffdd, 0x0105df85, 0x3c808080, 0x015cffd9, 0x3b77df82, 0x3c808080, 0x015cffd9, 0x001adf82,
> /* 87*/ 0x3c808080, 0x0016001a, 0x3af8c682, 0x3c808080, 0x0010001b, 0x0100be82, 0x3c808080, 0x00170014, 0x3c32c686, 0x3c808080, 0x00110015, 0x3c32be85,
> /* 87*/ 0x3c808080, 0x00190014, 0x3af8df84, 0x3c808080, 0x00170014, 0x0100da84, 0x3c808080, 0x00290018, 0x3c80d685, 0x3c808080, 0x00220019, 0x3c80d384,
> /* 88*/ 0x3c808080, 0x002c0022, 0x3af895ba, 0x3c808080, 0x0026001e, 0x01058fb7, 0x3c808080, 0x001d001b, 0x005786b5, 0x3c808080, 0x001a001b, 0x0c1c84b5,
> /* 88*/ 0x3c808080, 0xffdafff2, 0x3bb84198, 0x3c808080, 0xffc9ffe9, 0x01053196, 0x3c808080, 0xffd8fff3, 0x02694099, 0x3c808080, 0xffc7ffea, 0x03852e97,
> /* 25*/ 0x3c808080, 0xffceffdb, 0x3af582f3, 0x3c808080, 0xffd6ffd5, 0x001d8ff3, 0x3c808080, 0xffc7ffe0, 0xfc0082e9, 0x3c808080, 0xffccffdc, 0xfc0089ea,
> /* 25*/ 0x3c808080, 0xffb3ffde, 0x3af57eee, 0x3c808080, 0xffb5fff1, 0x001d90f0, 0x3c808080, 0xffb6ffe8, 0xfc008cec, 0x3c808080, 0xffb6ffe8, 0xfc008cec,
> /* 26*/ 0x3c808080, 0xffcfffda, 0x3af582f3, 0x3c808080, 0xffd6ffd4, 0x001d8ff3, 0x3c808080, 0xffc7ffdf, 0xfc0082e9, 0x3c808080, 0xffccffdb, 0xfc0089ea,
> /* 26*/ 0x3c808080, 0xffb3ffde, 0x3af57eee, 0x3c808080, 0xffb6fff0, 0x001d90f0, 0x3c808080, 0xffb7ffe7, 0xfc008cec, 0x3c808080, 0xffb7ffe7, 0xfc008cec,
> /* 26*/ 0x3c808080, 0x015bfff2, 0x3af8df95, 0x3c808080, 0x0155ffec, 0x0105df91, 0x3c808080, 0x014cffe8, 0x3b77df8e, 0x3c808080, 0x014cffe8, 0x001adf8e,
> /* 26*/ 0x3c808080, 0x014dffde, 0x3af8df87, 0x3c808080, 0x0156ffdc, 0x0105df85, 0x3c808080, 0x015cffd8, 0x3b77df82, 0x3c808080, 0x015cffd8, 0x001adf82,
> /* 27*/ 0x3c808080, 0xffcfffd9, 0x3af53e84, 0x3c808080, 0xffd7ffd2, 0x0105467f, 0x3c808080, 0xffc8ffdd, 0xfc003788, 0x3c808080, 0xffcdffd9, 0xfc003c85,
> /* 27*/ 0x3c808080, 0xffb4ffdc, 0x3af52386, 0x3c808080, 0xffb7ffee, 0x01052594, 0x3c808080, 0xffb7ffe6, 0xfc00268e, 0x3c808080, 0xffb7ffe6, 0xfc00268e,
> /* 28*/ 0x3c808080, 0xffd0ffd7, 0x3af53f83, 0x3c808080, 0xffd8ffd1, 0x0100467f, 0x3c808080, 0xffc8ffdc, 0xfc003787, 0x3c808080, 0xffcdffd8, 0xfc003c84,
> /* 28*/ 0x3c808080, 0xffb5ffdb, 0x3af52386, 0x3c808080, 0xffb8ffec, 0x01002694, 0x3c808080, 0xffb8ffe4, 0xfc00278d, 0x3c808080, 0xffb8ffe4, 0xfc00278d,
> /* 29*/ 0x3c808080, 0xffd0ffd6, 0x3af53f82, 0x3c808080, 0xffd8ffcf, 0x0105477d, 0x3c808080, 0xffc9ffdb, 0xfc003885, 0x3c808080, 0xffceffd6, 0xfc003d82,
> /* 29*/ 0x3c808080, 0xffb5ffda, 0x3af52485, 0x3c808080, 0xffb8ffeb, 0x01052792, 0x3c808080, 0xffb9ffe3, 0xfc00278c, 0x3c808080, 0xffb9ffe3, 0xfc00278c,
> /*167*/ 0x3c808080, 0x00ab0011, 0x3c3bdf74, 0x3c808080, 0x00a80014, 0x0100df70, 0x3c808080, 0x00b6000f, 0x02bcdf7f, 0x3c808080, 0x00b10013, 0x3c3fdf79,
> /*167*/ 0x3c808080, 0x00b7001d, 0x3c3bdf6a, 0x3c808080, 0x00b20019, 0x0100df6f, 0x3c808080, 0x00ae001a, 0x01fcdf66, 0x3c808080, 0x00a90018, 0x3c32df69,
> /*168*/ 0x3c808080, 0x00ac0012, 0x3c3bdf74, 0x3c808080, 0x00a90014, 0x0105df70, 0x3c808080, 0x00b7000f, 0x02dddf7f, 0x3c808080, 0x00b20013, 0x3c40df79,
> /*168*/ 0x3c808080, 0x00b8001d, 0x3c3bdf6a, 0x3c808080, 0x00b20019, 0x0105df70, 0x3c808080, 0x00ae001a, 0x020edf67, 0x3c808080, 0x00aa0018, 0x3c27df6a,
> /*169*/ 0x3c808080, 0x00ad0012, 0x3c3bdfad, 0x3c808080, 0x00a90014, 0x0100dfaf, 0x3c808080, 0x00b8000f, 0x02bcdfac, 0x3c808080, 0x00b30013, 0x3c3fdfaf,
> /*169*/ 0x3c808080, 0x00b9001d, 0x3c3bdfb6, 0x3c808080, 0x00b3001a, 0x0100dfb3, 0x3c808080, 0x00af001a, 0x01fcdfb4, 0x3c808080, 0x00ab0018, 0x3c32dfb2,
> /*181*/ 0x3c808080, 0x0024fff0, 0x3df928f4, 0x3c808080, 0x0021ffea, 0x007628fc, 0x3c808080, 0x0025ffef, 0x00172bf4, 0x3c808080, 0x0026ffe7, 0xff922bfd,
> /*181*/ 0x3c808080, 0x000b0001, 0x3db3bbff, 0x3c808080, 0x00060002, 0x0075b9ff, 0x3c808080, 0x0007fffa, 0xffc3bbf7, 0x3c808080, 0x000afffb, 0xffc3bbf7,
> /*182*/ 0x3c808080, 0x000affec, 0x3db37ba1, 0x3c808080, 0x0005ffef, 0x010076a2, 0x3c808080, 0x0004ffe7, 0x3c80779b, 0x3c808080, 0x0006ffe6, 0x3c807a9c,
> /*182*/ 0x3c808080, 0x000affec, 0x3dfc7ba1, 0x3c808080, 0x000cffed, 0x01007ca1, 0x3c808080, 0x0005ffef, 0x3c8076a2, 0x3c808080, 0x0007fff1, 0x3c8077a3,
> /*151*/ 0x3c808080, 0x0011ffe9, 0x3d7c5465, 0x3c808080, 0x0012ffe9, 0x01054c65, 0x3c808080, 0x0012ffe8, 0x00175467, 0x3c808080, 0x0013ffe9, 0x012c4c67,
> /*151*/ 0x3c808080, 0x0012ffe8, 0x3d7c4ba1, 0x3c808080, 0x0013ffe9, 0x010544a3, 0x3c808080, 0x0012ffe7, 0x3c6e4da1, 0x3c808080, 0x0013ffe8, 0x3c6e44a3,
> /*152*/ 0x3c808080, 0x0012ffe8, 0x3d7c7e8f, 0x3c808080, 0x0014ffe8, 0x01007f8f, 0x3c808080, 0x0013ffe7, 0xad097f8e, 0x3c808080, 0x0015ffe8, 0xd46a808f,
> /*152*/ 0x3c808080, 0xffe70002, 0x3d7c5a5b, 0x3c808080, 0xffe80001, 0x01005a5e, 0x3c808080, 0xffe80000, 0x08d95b5e, 0x3c808080, 0xffe80000, 0xc0645b5e,
> /*153*/ 0x3c808080, 0x0025fffb, 0x3d7ba298, 0x3c808080, 0x0027fff5, 0x0105a493, 0x3c808080, 0x002dfffb, 0x000eab97, 0x3c808080, 0x002cfff6, 0xffe5a994,
> /*153*/ 0x3c808080, 0xffec0001, 0x3d7c5ca1, 0x3c808080, 0xffecffff, 0x01055c9f, 0x3c808080, 0xffec0000, 0x00175da0, 0x3c808080, 0xffec0000, 0x3c805da0,
> /*30 */ 0x3c808080, 0x015afff3, 0x3d001939, 0x3c808080, 0x0156ffed, 0x001a1041, 0x3c808080, 0x014bffe9, 0xffdc1730, 0x3c808080, 0x014bffe9, 0x00121730,
> /*30 */ 0x3c808080, 0x014bffe0, 0x3d001730, 0x3c808080, 0x0156ffdd, 0x001a1041, 0x3c808080, 0x015cffd9, 0xff931939, 0x3c808080, 0x015cffd9, 0xffbb1939,
> /*31 */ 0x3c808080, 0x015bfff2, 0x3d001939, 0x3c808080, 0x0156ffec, 0x001a1041, 0x3c808080, 0x014cffe8, 0x3d1b1730, 0x3c808080, 0x014cffe8, 0x00161730,
> /*31 */ 0x3c808080, 0x014cffdf, 0x3d001730, 0x3c808080, 0x0156ffdc, 0x001a1041, 0x3c808080, 0x015cffd8, 0x3d1b1939, 0x3c808080, 0x015cffd8, 0x00161939,
> /*32 */ 0x3c808080, 0x015bfff3, 0x3d001939, 0x3c808080, 0x0156ffed, 0x001a1041, 0x3c808080, 0x014cffe9, 0xffdc1730, 0x3c808080, 0x014cffe9, 0x00121730,
> /*32 */ 0x3c808080, 0x014cffe0, 0x3d001730, 0x3c808080, 0x0157ffdd, 0x001a1041, 0x3c808080, 0x015cffd9, 0xff931939, 0x3c808080, 0x015cffd9, 0xffbb1939,
> /*33 */ 0x3c808080, 0x015afff2, 0x3d00df96, 0x3c808080, 0x0155ffed, 0x0100df91, 0x3c808080, 0x014bffe9, 0x3d1bdf8e, 0x3c808080, 0x014bffe9, 0x0016df8e,
> /*33 */ 0x3c808080, 0x014cffdf, 0x3d00df88, 0x3c808080, 0x0156ffdd, 0x0100df85, 0x3c808080, 0x015cffd9, 0x3d1bdf82, 0x3c808080, 0x015cffd9, 0x0016df82,
> /*34 */ 0x3c808080, 0x015dfff2, 0x3d00df96, 0x3c808080, 0x0156ffec, 0x0105df91, 0x3c808080, 0x014effe9, 0xffdcdf8e, 0x3c808080, 0x014effe9, 0x0012df8e,
> /*34 */ 0x3c808080, 0x014fffdf, 0x3d00df88, 0x3c808080, 0x0158ffdc, 0x0105df85, 0x3c808080, 0x015effd8, 0xff93df82, 0x3c808080, 0x015effd8, 0xffbbdf82,
> /*35 */ 0x3c808080, 0x015efff3, 0x3d00df95, 0x3c808080, 0x0157ffed, 0x0100df91, 0x3c808080, 0x014fffe9, 0x3d1bdf8e, 0x3c808080, 0x014fffe9, 0x0016df8e,
> /*35 */ 0x3c808080, 0x0150ffe0, 0x3d00df86, 0x3c808080, 0x0158ffdd, 0x0100df85, 0x3c808080, 0x015fffd9, 0x3d1bdf82, 0x3c808080, 0x015fffd9, 0x0016df82,
> /*36 */ 0x3c808080, 0x006d001c, 0x3d4fdfb9, 0x3c808080, 0x00670009, 0x0105dfac, 0x3c808080, 0x006c0020, 0xffe4dfbc, 0x3c808080, 0x0065000c, 0xffe4dfaf,
> /*36 */ 0x3c808080, 0x0075001f, 0x3d4fdfbb, 0x3c808080, 0x006e000c, 0x0105dfae, 0x3c808080, 0x006d001c, 0xffe2dfb9, 0x3c808080, 0x00670009, 0xffe2dfac,
> /*111*/ 0x3c808080, 0x0018001b, 0x3d00c682, 0x3c808080, 0x0012001c, 0x0100be82, 0x3c808080, 0x00190015, 0x0035c686, 0x3c808080, 0x00130016, 0x0032be85,
> /*111*/ 0x3c808080, 0x001b0015, 0x3d00df82, 0x3c808080, 0x00190015, 0x0100df82, 0x3c808080, 0x002b0019, 0x005ddd83, 0x3c808080, 0x00240019, 0x014cdb82,
> /*112*/ 0x3c808080, 0x002f0022, 0x3d0095ba, 0x3c808080, 0x0028001e, 0x01058fb7, 0x3c808080, 0x0020001b, 0xffe786b5, 0x3c808080, 0x001d001b, 0xffab84b5,
> /*112*/ 0x3c808080, 0x0028001e, 0x3d008fb7, 0x3c808080, 0x0021001d, 0x010587b6, 0x3c808080, 0x001d001b, 0x003084b5, 0x3c808080, 0x0018001c, 0x00007eb5,
> /*113*/ 0x3c808080, 0x0033001f, 0x3d0093b7, 0x3c808080, 0x002c001d, 0x01008cb6, 0x3c808080, 0x0028001c, 0xffcf88b5, 0x3c808080, 0x0021001d, 0xffda82b5,
> /*113*/ 0x3c808080, 0x00340019, 0x3d0094b3, 0x3c808080, 0x00290015, 0x010089b0, 0x3c808080, 0x002c0019, 0x01328cb3, 0x3c808080, 0x00220016, 0x043283b1,
> /*191*/ 0x3c808080, 0x00670014, 0x3de2c2bb, 0x3c808080, 0x00630014, 0x0100b0b9, 0x3c808080, 0x0072001e, 0x0019d7c8, 0x3c808080, 0x0072001e, 0x3cd1d7c8,
> /*191*/ 0x3c808080, 0x00630014, 0x3de2b0b9, 0x3c808080, 0x005f0014, 0x0100a1bb, 0x3c808080, 0x0067001d, 0x0019b4c9, 0x3c808080, 0x0064001c, 0x3c8da9c7,
> /*192*/ 0x3c808080, 0x0063001d, 0x3de2dfcb, 0x3c808080, 0x005c001a, 0x0105dfc8, 0x3c808080, 0x0066001f, 0x001adfce, 0x3c808080, 0x0060001a, 0x3c84dfc9,
> /*192*/ 0x3c808080, 0x00680014, 0x3de2d8af, 0x3c808080, 0x00630013, 0x0105d3af, 0x3c808080, 0x0073001e, 0x0019dfb7, 0x3c808080, 0x0073001e, 0x3cd1dfb7,
> /*40 */ 0x3c808080, 0xffcfffda, 0x3ce582f3, 0x3c808080, 0xffd6ffd4, 0x001d8ff3, 0x3c808080, 0xffc7ffdf, 0xfc0082e9, 0x3c808080, 0xffccffdb, 0xfc0089ea,
> /*41 */ 0x3c808080, 0xffcfffd9, 0x3ce53d85, 0x3c808080, 0xffd7ffd2, 0x01054580, 0x3c808080, 0xffc8ffdd, 0xfc003688, 0x3c808080, 0xffcdffd9, 0xfc003b85,
> /*41 */ 0x3c808080, 0xffb4ffdc, 0x3ce52287, 0x3c808080, 0xffb7ffee, 0x01052595, 0x3c808080, 0xffb7ffe6, 0xfc00268e, 0x3c808080, 0xffb7ffe6, 0xfc00268e,
> /*40 */ 0x3c808080, 0xffb3ffde, 0x3ce57eee, 0x3c808080, 0xffb6fff0, 0x001d90f0, 0x3c808080, 0xffb7ffe7, 0xfc008cec, 0x3c808080, 0xffb7ffe7, 0xfc008cec,
> /*42 */ 0x3c808080, 0xffd0ffd7, 0x3ce53f83, 0x3c808080, 0xffd8ffd1, 0x0100467f, 0x3c808080, 0xffc8ffdc, 0xfc003787, 0x3c808080, 0xffcdffd8, 0xfc003c84,
> /*42 */ 0x3c808080, 0xffb5ffdb, 0x3ce52386, 0x3c808080, 0xffb8ffec, 0x01002694, 0x3c808080, 0xffb8ffe4, 0xfc00278d, 0x3c808080, 0xffb8ffe4, 0xfc00278d,
> /*43 */ 0x3c808080, 0xffd0ffd6, 0x3ce53f82, 0x3c808080, 0xffd8ffcf, 0x0105477d, 0x3c808080, 0xffc9ffdb, 0xfc003885, 0x3c808080, 0xffceffd6, 0xfc003d82,
> /*43 */ 0x3c808080, 0xffb5ffda, 0x3ce52485, 0x3c808080, 0xffb8ffeb, 0x01052792, 0x3c808080, 0xffb9ffe3, 0xfc00278c, 0x3c808080, 0xffb9ffe3, 0xfc00278c,
> /*276*/ 0x3c808080, 0x00ac0012, 0x3d83df74, 0x3c808080, 0x00a90014, 0x0105df70, 0x3c808080, 0x00b7000f, 0x02bcdf7f, 0x3c808080, 0x00b20013, 0x3c3fdf79,
> /*276*/ 0x3c808080, 0x00b8001d, 0x3d83df6a, 0x3c808080, 0x00b20019, 0x0105df70, 0x3c808080, 0x00ae001a, 0x01fcdf67, 0x3c808080, 0x00aa0018, 0x3c27df6a,
> /*277*/ 0x3c808080, 0x00ae0012, 0x3d83dfad, 0x3c808080, 0x00aa0014, 0x0100dfaf, 0x3c808080, 0x00b9000f, 0x02dddfac, 0x3c808080, 0x00b30013, 0x3c40dfaf,
> /*277*/ 0x3c808080, 0x00ba001d, 0x3d83dfb6, 0x3c808080, 0x00b4001a, 0x0100dfb3, 0x3c808080, 0x00b0001a, 0x020edfb4, 0x3c808080, 0x00ac0018, 0x3c32dfb2,
> /*253*/ 0x3c191e0a, 0x009600df, 0x38b18ffb, 0x3c242a14, 0x009300d2, 0x000c92fb, 0x3c779173, 0x007e00d3, 0x00958ff0, 0x3c748c6e, 0x008000c8, 0x009493f0,
> /*254*/ 0x3c191e0a, 0x00bb00ee, 0x38b193fb, 0x3c4b5e48, 0x00a400dc, 0x000c94f0, 0x3c191e0a, 0x00b900ed, 0x001792fb, 0x3c687c5f, 0x00a300da, 0x0c1c93f0,
> /*255*/ 0x3c33432f, 0x00cd0109, 0x38b18ffb, 0x3c191e0a, 0x00cc00fa, 0x000c92fb, 0x3c738a6c, 0x00af00ec, 0x00958ff0, 0x3c627457, 0x00b400e2, 0x009493f0,
> /*266*/ 0x3c1a200c, 0x00a700ed, 0x38b18ffb, 0x3c1e240f, 0x00a500de, 0x000c92fb, 0x3c779072, 0x008d00db, 0x00178ff0, 0x3c6e8567, 0x009000d0, 0x0c1c93f0,
> /*73 */ 0x3c808080, 0xffdbfff4, 0x3d3c4e56, 0x3c808080, 0xffdefff4, 0x01054e55, 0x3c808080, 0xffd5fff0, 0x3c994459, 0x3c808080, 0xffd5fff0, 0x3c954459,
> /*73 */ 0x3c808080, 0xffd5fff0, 0x3d3c4459, 0x3c808080, 0xffd5fff2, 0x01054d58, 0x3c808080, 0xffdbfff4, 0x3ccb4e56, 0x3c808080, 0xffdbfff4, 0x3cdc4e56,
> /*74 */ 0x3c808080, 0xffddfff3, 0x3d3c465a, 0x3c808080, 0xffdffff7, 0x01004555, 0x3c808080, 0xffdffff2, 0x7742405a, 0x3c808080, 0xffdffff2, 0xc87d405a,
> /*74 */ 0x3c808080, 0xffde0000, 0x3d3c5dac, 0x3c808080, 0xffe30001, 0x01005fac, 0x3c808080, 0xffe0fffc, 0xde585dac, 0x3c808080, 0xffe5fffe, 0x028160ac,
> /*75 */ 0x3c808080, 0xfff0fff7, 0x3d7c549b, 0x3c808080, 0xffeefff5, 0x0105519a, 0x3c808080, 0xffeffff7, 0x3c68539c, 0x3c808080, 0xffeffff7, 0x3c7e539c,
> /*75 */ 0x3c808080, 0xffe7fff1, 0x3d3c4b97, 0x3c808080, 0xffeafff1, 0x01054e97, 0x3c808080, 0xffe2ffed, 0x3c994594, 0x3c808080, 0xffe2ffed, 0x3c954594,
> /*76 */ 0x3c808080, 0xfff3fff5, 0x3d7c5a9a, 0x3c808080, 0xfff1fff3, 0x01005899, 0x3c808080, 0xfff2fff5, 0x5c4d5a9a, 0x3c808080, 0xfff2fff5, 0x0de15a9a,
> /*76 */ 0x3c808080, 0xffeaffef, 0x3d3c5195, 0x3c808080, 0xffedffef, 0x01005496, 0x3c808080, 0xffe5ffeb, 0x0b2f4c93, 0x3c808080, 0xffe5ffeb, 0xc9694c93,
> /*30 */ 0x3c808080, 0x0027000e, 0x3d73a588, 0x3c808080, 0x0024000e, 0x0100a288, 0x3c808080, 0x00270012, 0x9f92a48b, 0x3c808080, 0x00240012, 0x5e72a28b,
> /*30 */ 0x3c808080, 0x0021000e, 0x3d7ba088, 0x3c808080, 0x0026000f, 0x0100a189, 0x3c808080, 0x001b000b, 0x3a3ea68a, 0x3c808080, 0x0021000c, 0xda49a88a,
> /*31 */ 0x3c808080, 0x000c0011, 0x3d7b978b, 0x3c808080, 0x0009000d, 0x0105968a, 0x3c808080, 0x000e0011, 0x00f9998b, 0x3c808080, 0x000c000d, 0x3c50988a,
> /*31 */ 0x3c808080, 0x0020000f, 0x3d7ba288, 0x3c808080, 0x00260010, 0x0105a389, 0x3c808080, 0x001c000c, 0x01d9a88a, 0x3c808080, 0x0022000d, 0x3c93aa8a,
> /*32 */ 0x3c808080, 0x0024000e, 0x3d7391a9, 0x3c808080, 0x0021000f, 0x01008eab, 0x3c808080, 0x0025000f, 0x829494ab, 0x3c808080, 0x00210010, 0xbf7790ac,
> /*32 */ 0x3c808080, 0x00240013, 0x3d7391ae, 0x3c808080, 0x00250013, 0x010094ae, 0x3c808080, 0x00210012, 0x24868eac, 0x3c808080, 0x00210011, 0x312390ac,
> /*33 */ 0x3c808080, 0x0009000d, 0x3d7b79aa, 0x3c808080, 0x00090009, 0x010578a7, 0x3c808080, 0x000d000d, 0x00f97caa, 0x3c808080, 0x000d0009, 0x3c707ca7,
> /*33 */ 0x3c808080, 0x00060002, 0x3d7b80a6, 0x3c808080, 0xffff0002, 0x01057aa5, 0x3c808080, 0x0005fffb, 0x03ff80a1, 0x3c808080, 0x0000fffb, 0x3c807ba0,
> };
> #define PMT_CMD_COUNT (12)
> #define PMT_CMD_SIZE (8)
> #define PMT_CMD_ex_SIZE (1)
> #define PMT_CMD_60_SIZE (3)
> #define PMT_CMD_64_SIZE (4)
>
> const unsigned int PMT_MASK_60_62[PMT_CMD_60_SIZE] = {
> 0xffffffff, 0x001fffff, 0x01ff03ff
> };
> static const unsigned int PMT_MASK_64[PMT_CMD_64_SIZE] = {
> 0xffffffff, 0x00ffffff, 0xffffffff, 0x01ff03ff
> };
> static const unsigned int PMT_MASK_38[PMT_CMD_SIZE] = {
> 0xffffffff, 0x001fffff, 0x00ffffff, 0, 0x00ffffff, 0x001fffff, 0x00ffffff, 0
> };
> /* PMT life label */
> static unsigned int* PMT_MASK[PMT_CMD_COUNT] = {
> PMT_MASK_60_62,
> PMT_MASK_60_62,
> PMT_MASK_60_62,
> PMT_MASK_60_62,
> PMT_MASK_60_62,
> PMT_MASK_38,
> PMT_MASK_60_62,
> PMT_MASK_64,
> PMT_MASK_64,
> PMT_MASK_64,
> PMT_MASK_64,
> PMT_MASK_64
> };
> static const unsigned int PMT_CMD[PMT_CMD_COUNT][PMT_CMD_SIZE+1] = {
> /* 35, cmd 60,len 3 */ 3, 0x60000000, 0x00280048, 0x00060001, 0, 0, 0, 0, 0,
> /* 35, cmd 60,len 3 */ 3, 0x60000000, 0x002d0010, 0x00010038, 0, 0, 0, 0, 0,
> /* 35, cmd 60,len 3 */ 3, 0x60000000, 0x00280010, 0x00010038, 0, 0, 0, 0, 0,
> /* 35, cmd 60,len 3 */ 3, 0x60000000, 0x0028000f, 0x00060001, 0, 0, 0, 0, 0,
> /* 35, cmd 62,len 3 */ 3, 0x62181800, 0x00290010, 0x00040038, 0, 0, 0, 0, 0,
> /* 35, cmd 38,len 8 */ 8, 0x385fbf1f, 0x00290010, 0x005fbf1f, 0x00290027, 0x005fbf1f, 0x002d0010, 0x645fbf1f, 0x002d0027,
> /* 35, cmd 62,len 3 */ 3, 0x62000000, 0x002b0013, 0x00070020, 0, 0, 0, 0, 0,
> /* 35, cmd 64,len 4 */ 4, 0x64ffffff, 0x002c002c, 0x7ffced42, 0x00050006, 0, 0, 0, 0,
> /* 35, cmd 64,len 4 */ 4, 0x64ffffff, 0x002c0026, 0x7ffced90, 0x00050006, 0, 0, 0, 0,
> /* 35, cmd 64,len 4 */ 4, 0x64ffffff, 0x002c0020, 0x7ffced66, 0x00050006, 0, 0, 0, 0,
> /* 35, cmd 64,len 4 */ 4, 0x64ffffff, 0x002c001a, 0x7ffced18, 0x00050006, 0, 0, 0, 0,
> /* 35, cmd 64,len 4 */ 4, 0x64ffffff, 0x002c0014, 0x7ffced48, 0x00050006, 0, 0, 0, 0
> };
> extern int g_gpu_patch_flag;
201a379,383
> extern int isToShinDen;
> extern int isBiosLogoEnd;
> extern int *scenes;
> extern int regions;
> extern int iTrimJaggyFrame;
243a426
> unsigned short *psxVuw_t;
278a462,465
> if (gpu.vram2)
> psxVuw_t = gpu.vram2;
> else
> psxVuw_t = psxVuw;
309a497,544
> static void check_skip_frame(unsigned int *list) {
> for (int i=0;i<CMD_DATA_COUNT;i++) {
> int count = 0;
> for (int cs=0;cs<12;cs++) {
> if ((skip_frame_data[i][cs]&SKIP_DATA_MASK[cs]) == (list[cs]&SKIP_DATA_MASK[cs])){
> count ++;
> }
> else {
> count = 0;
> break;
> }
> }
> if (count == 12 && !gpu.state.skip_frame) {
> gpu.state.skip_frame = 1;
> break;
> }
> }
> }
>
> static int pmt_cmd_count = 0;
> void check_pmt_cmd(unsigned int cmd, unsigned int len, unsigned int *list) {
> if (gpu.state.dma_chain) {
> pmt_cmd_count = 0;
> gpu.state.dma_chain = 0;
> gpu.state.pmt_show = 0;
> }
> if (gpu.state.pmt_show)
> return;
>
> int pos = 0;
> for (int i=0;i<PMT_CMD[pmt_cmd_count][0];i++) {
> if ((PMT_CMD[pmt_cmd_count][i+1] & *(PMT_MASK[pmt_cmd_count] + i)) == (list[i] & *(PMT_MASK[pmt_cmd_count] + i))) {
> pos ++;
> }
> else
> break;
> }
> if (pos >= PMT_CMD[pmt_cmd_count][0]) {
> pmt_cmd_count ++;
> if (pmt_cmd_count >= PMT_CMD_COUNT) {
> gpu.state.pmt_show = 1;
> pmt_cmd_count = 0;
> }
> }
> else
> pmt_cmd_count = 0;
> }
>
335a571,577
> if ((g_gpu_patch_flag & 0x00000020) == 0x00000020) {
> check_pmt_cmd(cmd, len, list);
> }
>
> if (cmd==0x3c && !gpu.state.skip_frame && gpu.vram2)
> check_skip_frame(list);
>
434a677,681
> isToShinDen = cbs->gpu_peops.isToShinDen;
> isBiosLogoEnd = cbs->gpu_peops.isBiosLogoEnd;
> scenes = &cbs->gpu_peops.scenes;
> regions = cbs->gpu_peops.regions;
> iTrimJaggyFrame = cbs->gpu_peops.iTrimJaggyFrame;
diff --new-file -w -r pcsx_rearmed/plugins/dfxvideo/prim.c pcsx_rearmed_custom/plugins/dfxvideo/prim.c
34a35,39
> int isToShinDen=0;
> int isBiosLogoEnd=0;
> int *scenes;
> int regions=0;
> int iTrimJaggyFrame=0;
73a79,81
> case 3:
> iDither=3;
> break;
112,113c120,121
< #define CHKMAX_X 1024
< #define CHKMAX_Y 512
---
> #define CHKMAX_X 1023
> #define CHKMAX_Y 511
173,232c181,192
< if(lx0<0)
< {
< if(((lx1-lx0)>CHKMAX_X) ||
< ((lx2-lx0)>CHKMAX_X))
< {
< if(lx3<0)
< {
< if((lx1-lx3)>CHKMAX_X) return TRUE;
< if((lx2-lx3)>CHKMAX_X) return TRUE;
< }
< }
< }
< if(lx1<0)
< {
< if((lx0-lx1)>CHKMAX_X) return TRUE;
< if((lx2-lx1)>CHKMAX_X) return TRUE;
< if((lx3-lx1)>CHKMAX_X) return TRUE;
< }
< if(lx2<0)
< {
< if((lx0-lx2)>CHKMAX_X) return TRUE;
< if((lx1-lx2)>CHKMAX_X) return TRUE;
< if((lx3-lx2)>CHKMAX_X) return TRUE;
< }
< if(lx3<0)
< {
< if(((lx1-lx3)>CHKMAX_X) ||
< ((lx2-lx3)>CHKMAX_X))
< {
< if(lx0<0)
< {
< if((lx1-lx0)>CHKMAX_X) return TRUE;
< if((lx2-lx0)>CHKMAX_X) return TRUE;
< }
< }
< }
<
<
< if(ly0<0)
< {
< if((ly1-ly0)>CHKMAX_Y) return TRUE;
< if((ly2-ly0)>CHKMAX_Y) return TRUE;
< }
< if(ly1<0)
< {
< if((ly0-ly1)>CHKMAX_Y) return TRUE;
< if((ly2-ly1)>CHKMAX_Y) return TRUE;
< if((ly3-ly1)>CHKMAX_Y) return TRUE;
< }
< if(ly2<0)
< {
< if((ly0-ly2)>CHKMAX_Y) return TRUE;
< if((ly1-ly2)>CHKMAX_Y) return TRUE;
< if((ly3-ly2)>CHKMAX_Y) return TRUE;
< }
< if(ly3<0)
< {
< if((ly1-ly3)>CHKMAX_Y) return TRUE;
< if((ly2-ly3)>CHKMAX_Y) return TRUE;
< }
---
> // check delta x
> if (abs(lx0 - lx1) > CHKMAX_X) return TRUE;
> if (abs(lx1 - lx2) > CHKMAX_X) return TRUE;
> if (abs(lx2 - lx0) > CHKMAX_X) return TRUE;
> if (abs(lx3 - lx1) > CHKMAX_X) return TRUE;
> if (abs(lx3 - lx2) > CHKMAX_X) return TRUE;
> // check delta y
> if (abs(ly0 - ly1) > CHKMAX_Y) return TRUE;
> if (abs(ly1 - ly2) > CHKMAX_Y) return TRUE;
> if (abs(ly2 - ly0) > CHKMAX_Y) return TRUE;
> if (abs(ly3 - ly1) > CHKMAX_Y) return TRUE;
> if (abs(ly3 - ly2) > CHKMAX_Y) return TRUE;
239,268c199,206
< if(lx0<0)
< {
< if((lx1-lx0)>CHKMAX_X) return TRUE;
< if((lx2-lx0)>CHKMAX_X) return TRUE;
< }
< if(lx1<0)
< {
< if((lx0-lx1)>CHKMAX_X) return TRUE;
< if((lx2-lx1)>CHKMAX_X) return TRUE;
< }
< if(lx2<0)
< {
< if((lx0-lx2)>CHKMAX_X) return TRUE;
< if((lx1-lx2)>CHKMAX_X) return TRUE;
< }
< if(ly0<0)
< {
< if((ly1-ly0)>CHKMAX_Y) return TRUE;
< if((ly2-ly0)>CHKMAX_Y) return TRUE;
< }
< if(ly1<0)
< {
< if((ly0-ly1)>CHKMAX_Y) return TRUE;
< if((ly2-ly1)>CHKMAX_Y) return TRUE;
< }
< if(ly2<0)
< {
< if((ly0-ly2)>CHKMAX_Y) return TRUE;
< if((ly1-ly2)>CHKMAX_Y) return TRUE;
< }
---
> // check delta x
> if (abs(lx0 - lx1) > CHKMAX_X) return TRUE;
> if (abs(lx1 - lx2) > CHKMAX_X) return TRUE;
> if (abs(lx2 - lx0) > CHKMAX_X) return TRUE;
> // check delta y
> if (abs(ly0 - ly1) > CHKMAX_Y) return TRUE;
> if (abs(ly1 - ly2) > CHKMAX_Y) return TRUE;
> if (abs(ly2 - ly0) > CHKMAX_Y) return TRUE;
276,291c214,217
< if(lx0<0)
< {
< if((lx1-lx0)>CHKMAX_X) return TRUE;
< }
< if(lx1<0)
< {
< if((lx0-lx1)>CHKMAX_X) return TRUE;
< }
< if(ly0<0)
< {
< if((ly1-ly0)>CHKMAX_Y) return TRUE;
< }
< if(ly1<0)
< {
< if((ly0-ly1)>CHKMAX_Y) return TRUE;
< }
---
> // check delta x
> if (abs(lx0 - lx1) > CHKMAX_X) return TRUE;
> // check delta y
> if (abs(ly0 - ly1) > CHKMAX_Y) return TRUE;
298,313c224,227
< if(slx0<0)
< {
< if((slx1-slx0)>CHKMAX_X) return TRUE;
< }
< if(slx1<0)
< {
< if((slx0-slx1)>CHKMAX_X) return TRUE;
< }
< if(sly0<0)
< {
< if((sly1-sly0)>CHKMAX_Y) return TRUE;
< }
< if(sly1<0)
< {
< if((sly0-sly1)>CHKMAX_Y) return TRUE;
< }
---
> // check delta x
> if (abs(slx0 - slx1) > 1023) return TRUE;
> // check delta y
> if (abs(sly0 - sly1) > 511) return TRUE;
1054a969,1012
> if (isToShinDen) {
> if (GETLEs16(&sgpuData[4]) == 0x38e0 && lx1-lx0 == 0x10 && ly2-ly0 == 0x8)
> {
> short sW = 4;
> short sH = 1;
>
> lx0 = lx0 + 6; // 0
> ly0 = ly0 + 3; //
> lx1 = lx0 + sW; // 1 x
> ly1 = ly0; // +---->
> lx2 = lx1; // 2 | 0 1
> ly2 = ly0 + sH; // y|
> lx3 = lx0; // 3 v 3 2
> ly3 = ly2; //
>
> DrawSemiTrans = FALSE;
> int color = -1;
> switch (GETLEs16(&sgpuData[5]))
> {
> case 0x7ce0: // Yellow "H"
> color = 0x00ffff;
> break;
> case 0x7da0: // Blue "H"
> color = 0xff8c00;
> break;
> case 0x7d20: // Pink "H"
> color = 0x7860f8;
> break;
> case 0x7d60: // light blue "H"
> color = 0xf8f800;
> break;
> case 0x7de0: // white "H"
> color = 0xffffff;
> default:
> break;
> }
>
> if (color != -1)
> {
> FillSoftwareAreaTrans(lx0,ly0,lx2,ly2,BGR24to16((0x40 << 24) | color));
> }
> }
> }
>
1165a1124,1213
> if (*scenes != 0)
> {
> if (GETLE32(&gpuData[0]) == 0x3c808080 && GETLE32(&gpuData[3]) == 0x3c808080 && GETLE32(&gpuData[6]) == 0x3c808080 && GlobalTextTP == 0)
> {
> int cba = GETLEs16(&sgpuData[5]);
> switch (*scenes)
> {
> case 1:
> if (regions == 1)
> {
> if (cba >= 0x3a00 && cba <= 0x3d00)
> {
> bDoVSyncUpdate=TRUE;
> return;
> }
> }
> if (regions == 2)
> {
> if (cba >= 0x3c00 && cba <= 0x3e00)
> {
> bDoVSyncUpdate=TRUE;
> return;
> }
> }
> break;
>
> case 2:
> case 3:
> case 7:
> if (regions == 1)
> {
> if (cba >= 0x3d00 && cba <= 0x3d33 ||
> cba >= 0x3d35 && cba <= 0x3e00)
> {
> bDoVSyncUpdate=TRUE;
> return;
> }
> }
> if (regions == 2)
> {
> if (cba >= 0x3da0 && cba <= 0x3dd2 ||
> cba >= 0x3dd4 && cba <= 0x3ea0)
> {
> bDoVSyncUpdate=TRUE;
> return;
> }
> }
> break;
>
> case 4:
> if (regions == 1)
> {
> if (cba >= 0x3ee0 && cba <= 0x3ef7 ||
> cba >= 0x3f00 && cba <= 0x4000)
> {
> bDoVSyncUpdate=TRUE;
> return;
> }
> }
> if (regions == 2)
> {
> if (cba >= 0x3e80 && cba <= 0x3e82 ||
> cba >= 0x3e84 && cba <= 0x3e94 ||
> cba >= 0x3e96 && cba <= 0x3ee0)
> {
> bDoVSyncUpdate=TRUE;
> return;
> }
> }
> break;
>
> case 5:
> case 6:
> case 8:
> if (regions == 1 || regions == 2)
> {
> if (cba >= 0x3a00 && cba <= 0x3f00)
> {
> bDoVSyncUpdate=TRUE;
> return;
> }
> }
> break;
>
> default:
> break;
> }
> }
> }
>
1197a1246,1257
> if (!isBiosLogoEnd) {
> if (GETLE32(&gpuData[1]) == 0x00e10125 && GETLE32(&gpuData[2]) == 0x00e80120 && GETLE32(&gpuData[3]) == 0x00eb010c) {
> int color = (0x68 << 24) | (GETLE32(&gpuData[0]) & 0xffffff);
> DrawSemiTrans = FALSE;
>
> FillSoftwareAreaTrans(272,233,273,234,BGR24to16(color));
> FillSoftwareAreaTrans(277,231,278,232,BGR24to16(color));
> FillSoftwareAreaTrans(282,229,283,230,BGR24to16(color));
> FillSoftwareAreaTrans(287,227,288,228,BGR24to16(color));
> }
> }
>
diff --new-file -w -r pcsx_rearmed/plugins/dfxvideo/soft.c pcsx_rearmed_custom/plugins/dfxvideo/soft.c
1279a1280,1307
> static inline BOOL NextRow_G4(void)
> {
> if(--left_section_height<=0)
> {
> if(--left_section <= 0) {return TRUE;}
> if(LeftSection_G() <= 0) {return TRUE;}
> }
> else
> {
> left_x += delta_left_x;
> left_R += delta_left_R;
> left_G += delta_left_G;
> left_B += delta_left_B;
> }
>
> if(--right_section_height<=0)
> {
> if(--right_section<=0) {return TRUE;}
> if(RightSection_G() <=0) {return TRUE;}
> }
> else
> {
> if((right_section_height < left_section_height || right_section-1 > 0 || right_section_height < 3) || (left_R != left_G || left_G!=left_B || left_R != left_B)){
> right_x += delta_right_x;
> }
> }
> return FALSE;
> }
1328a1357
>
3891c3920
< (((int32_t)GETLE16(&psxVuw[((((posY+difY)>>16)+GlobalTextAddrY)<<10)+((posX+difX)>>16)+GlobalTextAddrX]))<<16)|
---
> (((int32_t)GETLE16(&psxVuw_t[((((posY+difY)>>16)+GlobalTextAddrY)<<10)+((posX+difX)>>16)+GlobalTextAddrX]))<<16)|
3899c3928
< GETLE16(&psxVuw[(((posY>>16)+GlobalTextAddrY)<<10)+(posX>>16)+GlobalTextAddrX]));
---
> GETLE16(&psxVuw_t[(((posY>>16)+GlobalTextAddrY)<<10)+(posX>>16)+GlobalTextAddrX]));
4117,4118c4146,4147
< (((int32_t)GETLE16(&psxVuw[((((posY+difY)>>16)+GlobalTextAddrY)<<10)+((posX+difX)>>16)+GlobalTextAddrX]))<<16)|
< GETLE16(&psxVuw[(((posY>>16)+GlobalTextAddrY)<<10)+((posX)>>16)+GlobalTextAddrX]));
---
> (((int32_t)GETLE16(&psxVuw_t[((((posY+difY)>>16)+GlobalTextAddrY)<<10)+((posX+difX)>>16)+GlobalTextAddrX]))<<16)|
> GETLE16(&psxVuw_t[(((posY>>16)+GlobalTextAddrY)<<10)+((posX)>>16)+GlobalTextAddrX]));
4125c4154
< GETLE16(&psxVuw[(((posY>>16)+GlobalTextAddrY)<<10)+(posX>>16)+GlobalTextAddrX]));
---
> GETLE16(&psxVuw_t[(((posY>>16)+GlobalTextAddrY)<<10)+(posX>>16)+GlobalTextAddrX]));
4488a4518,4522
> if (iTrimJaggyFrame &&
> (((lx1-lx0 >= -4 && lx1-lx0 <= 4 && lx3-lx2 >= -4 && lx3-lx2 <= 4) && (lx2-lx0 == 0 && lx3-lx1 == 0)) ||
> ((ly2-ly0 >= -4 && ly2-ly0 <= 4 && ly3-ly1 >= -4 && ly3-ly1 <= 4) && (ly1-ly0 == 0 && ly3-ly2 == 0)))) {
> if(NextRow_G4()) return;
> } else {
4490a4525
> }
4580c4615
< if(!bCheckMask && !DrawSemiTrans && !iDither)
---
> if(!bCheckMask && !DrawSemiTrans && iDither!=2)
4663c4698
< if(iDither)
---
> if(iDither==2)
4727c4762
< if(!bCheckMask && !DrawSemiTrans && !iDither)
---
> if(!bCheckMask && !DrawSemiTrans && iDither!=2)
4812c4847
< if(iDither)
---
> if(iDither==2)
4896c4931
< if(!bCheckMask && !DrawSemiTrans && !iDither)
---
> if(!bCheckMask && !DrawSemiTrans && iDither!=2)
5007c5042
< if(iDither)
---
> if(iDither==2)
5086c5121
< if(!bCheckMask && !DrawSemiTrans && !iDither)
---
> if(!bCheckMask && !DrawSemiTrans && iDither!=2)
5160c5195
< if(iDither)
---
> if(iDither==2)
5223c5258
< if(!bCheckMask && !DrawSemiTrans && !iDither)
---
> if(!bCheckMask && !DrawSemiTrans && iDither!=2)
5301c5336
< if(iDither)
---
> if(iDither==2)
5379c5414
< if(!bCheckMask && !DrawSemiTrans && !iDither)
---
> if(!bCheckMask && !DrawSemiTrans && iDither!=2)
5479c5514
< if(iDither)
---
> if(iDither==2)
5552c5587
< if(!bCheckMask && !DrawSemiTrans && !iDither)
---
> if(!bCheckMask && !DrawSemiTrans && iDither!=2)
5574,5575c5609,5610
< (((int32_t)GETLE16(&psxVuw[((((posY+difY)>>16)+GlobalTextAddrY)<<10)+((posX+difX)>>16)+GlobalTextAddrX]))<<16)|
< GETLE16(&psxVuw[(((posY>>16)+GlobalTextAddrY)<<10)+((posX)>>16)+GlobalTextAddrX]),
---
> (((int32_t)GETLE16(&psxVuw_t[((((posY+difY)>>16)+GlobalTextAddrY)<<10)+((posX+difX)>>16)+GlobalTextAddrX]))<<16)|
> GETLE16(&psxVuw_t[(((posY>>16)+GlobalTextAddrY)<<10)+((posX)>>16)+GlobalTextAddrX]),
5587c5622
< GETLE16(&psxVuw[(((posY>>16)+GlobalTextAddrY)<<10)+(posX>>16)+GlobalTextAddrX]),
---
> GETLE16(&psxVuw_t[(((posY>>16)+GlobalTextAddrY)<<10)+(posX>>16)+GlobalTextAddrX]),
5619c5654
< if(iDither)
---
> if(iDither==2)
5676c5711
< if(!bCheckMask && !DrawSemiTrans && !iDither)
---
> if(!bCheckMask && !DrawSemiTrans && iDither!=2)
5746c5781
< if(iDither)
---
> if(iDither==2)
5813c5848
< if(!bCheckMask && !DrawSemiTrans && !iDither)
---
> if(!bCheckMask && !DrawSemiTrans && iDither!=2)
5902a5938
> int i_t = i+5;
5905c5941,5943
< if(iDither)
---
> int j_t = j+5;
> if(iDither==2) {
> if (*scenes == 8) {
5907c5945
< GETLE16(&psxVuw[(((posY>>16)+GlobalTextAddrY)<<10)+(posX>>16)+GlobalTextAddrX]),
---
> GETLE16(&psxVuw_t[(i_t<<10)+j_t]),
5908a5947,5952
> } else {
> GetTextureTransColGX(&psxVuw[(i<<10)+j],
> GETLE16(&psxVuw_t[(((posY>>16)+GlobalTextAddrY)<<10)+(posX>>16)+GlobalTextAddrX]),
> (cB1>>16),(cG1>>16),(cR1>>16));
> }
> }
5911c5955
< GETLE16(&psxVuw[(((posY>>16)+GlobalTextAddrY)<<10)+(posX>>16)+GlobalTextAddrX]),
---
> GETLE16(&psxVuw_t[(((posY>>16)+GlobalTextAddrY)<<10)+(posX>>16)+GlobalTextAddrX]),
6623c6667,6670
< if ((x0>=drawX)&&(x0<drawW)&&(y0>=drawY)&&(y0<drawH))
---
> if ((x0>=drawX)&&(x0<drawW)&&(y0>=drawY)&&(y0<drawH)){
> if(iDither==3){
> GetShadeTransCol_Dither(&psxVuw[(y0<<10)+x0],(b0>>16),(g0>>16),(r0>>16));
> }else{
6624a6672,6673
> }
> }
6642c6691,6694
< if ((x0>=drawX)&&(x0<drawW)&&(y0>=drawY)&&(y0<drawH))
---
> if ((x0>=drawX)&&(x0<drawW)&&(y0>=drawY)&&(y0<drawH)){
> if(iDither==3){
> GetShadeTransCol_Dither(&psxVuw[(y0<<10)+x0],(b0>>16),(g0>>16),(r0>>16));
> }else{
6645a6698,6699
> }
> }
6682c6736,6739
< if ((x0>=drawX)&&(x0<drawW)&&(y0>=drawY)&&(y0<drawH))
---
> if ((x0>=drawX)&&(x0<drawW)&&(y0>=drawY)&&(y0<drawH)){
> if(iDither==3){
> GetShadeTransCol_Dither(&psxVuw[(y0<<10)+x0],(b0>>16),(g0>>16),(r0>>16));
> }else{
6683a6741,6742
> }
> }
6701c6760,6763
< if ((x0>=drawX)&&(x0<drawW)&&(y0>=drawY)&&(y0<drawH))
---
> if ((x0>=drawX)&&(x0<drawW)&&(y0>=drawY)&&(y0<drawH)){
> if(iDither==3){
> GetShadeTransCol_Dither(&psxVuw[(y0<<10)+x0],(b0>>16),(g0>>16),(r0>>16));
> }else{
6704a6767,6768
> }
> }
6741c6805,6808
< if ((x0>=drawX)&&(x0<drawW)&&(y0>=drawY)&&(y0<drawH))
---
> if ((x0>=drawX)&&(x0<drawW)&&(y0>=drawY)&&(y0<drawH)){
> if(iDither==3){
> GetShadeTransCol_Dither(&psxVuw[(y0<<10)+x0],(b0>>16),(g0>>16),(r0>>16));
> }else{
6742a6810,6811
> }
> }
6760c6829,6832
< if ((x0>=drawX)&&(x0<drawW)&&(y0>=drawY)&&(y0<drawH))
---
> if ((x0>=drawX)&&(x0<drawW)&&(y0>=drawY)&&(y0<drawH)){
> if(iDither==3){
> GetShadeTransCol_Dither(&psxVuw[(y0<<10)+x0],(b0>>16),(g0>>16),(r0>>16));
> }else{
6763a6836,6837
> }
> }
6800c6874,6877
< if ((x0>=drawX)&&(x0<drawW)&&(y0>=drawY)&&(y0<drawH))
---
> if ((x0>=drawX)&&(x0<drawW)&&(y0>=drawY)&&(y0<drawH)){
> if(iDither==3){
> GetShadeTransCol_Dither(&psxVuw[(y0<<10)+x0],(b0>>16),(g0>>16),(r0>>16));
> }else{
6801a6879,6881
> }
> }
>
6819c6899,6902
< if ((x0>=drawX)&&(x0<drawW)&&(y0>=drawY)&&(y0<drawH))
---
> if ((x0>=drawX)&&(x0<drawW)&&(y0>=drawY)&&(y0<drawH)){
> if(iDither==3){
> GetShadeTransCol_Dither(&psxVuw[(y0<<10)+x0],(b0>>16),(g0>>16),(r0>>16));
> }else{
6822a6906,6907
> }
> }
6866a6952,6954
> if(iDither==3){
> GetShadeTransCol_Dither(&psxVuw[(y<<10)+x],(b0>>16),(g0>>16),(r0>>16));
> }else{
6867a6956
> }
6916a7006,7008
> if(iDither==3){
> GetShadeTransCol_Dither(&psxVuw[(y<<10)+x],(b0>>16),(g0>>16),(r0>>16));
> }else{
6917a7010
> }
diff --new-file -w -r pcsx_rearmed/plugins/gpu-gles/gpuPlugin.h pcsx_rearmed_custom/plugins/gpu-gles/gpuPlugin.h
60a61,62
> unsigned int ulEventStatus;
> unsigned int ulEventCnt;
diff --new-file -w -r pcsx_rearmed/plugins/gpulib/gpu.c pcsx_rearmed_custom/plugins/gpulib/gpu.c
37a38,39
> static void do_bo(void);
> static void check_pmt_frame(void);
49a52,103
> int g_gpu_patch_flag = 0;
>
> // double, for overdraw guard
> #define VRAM_SIZE (1024 * 512 * 2 * 2)
> #define GPU_PATCH_SCREEN_ADJUST (0x00000001)
> #define GPU_PATCH_ADD_VRAM2 (0x00000008)
> #define GPU_PATCH_ADD_BO (0x00000020)
> #define GPU_PATCH_ARC_THE_LAD (0x00000080)
>
> void GPUsetPatchFlag(int flag, int set) {
> if(set)
> g_gpu_patch_flag |= flag;
> else
> g_gpu_patch_flag &= ~flag;
>
> if (g_gpu_patch_flag & GPU_PATCH_ADD_VRAM2 && gpu.vram2 == NULL) {
> gpu.vram2 = gpu.mmap(VRAM_SIZE);
> if (gpu.vram2 != NULL) {
> gpu.vram2 += 4096 / 2;
> }
> }
> }
>
> static noinline int update_sw(int sw_in){
> int sw = sw_in;
>
> if (g_gpu_patch_flag & GPU_PATCH_IS_MR_DRILLER) {
> if (gpu.screen.pck_rate == 0 || sw == 0) {
> sw = gpu.screen.hres;
> } else {
> sw = sw / gpu.screen.pck_rate;
> }
> return sw;
> }
>
> if (sw <= 0 || sw >= 2560)
> // full width
> sw = gpu.screen.hres;
> else
> sw = sw * gpu.screen.hres / 2560;
> return sw;
> }
>
> static noinline int update_sh(int sh_in){
> int sh = sh_in;
> if (gpu.status.dheight)
> sh *= 2;
> if (sh <= 0 || sh > gpu.screen.vres)
> sh = gpu.screen.vres;
> return sh;
> }
>
63a118,120
> gpu.screen.w_regs = 0;
> gpu.screen.h_regs = 0;
> gpu.screen.pck_rate = 0;
66c123
< static noinline void update_width(void)
---
> static noinline void update_width(int isHVcmd)
67a125,147
> if (g_gpu_patch_flag & GPU_PATCH_SCREEN_ADJUST) {
> int data = gpu.regs[6];
> gpu.screen.x1 = data & 0xfff;
> gpu.screen.x2 = (data >> 12) & 0xfff;
> int sw = update_sw(gpu.screen.x2 - gpu.screen.x1);
> if(isHVcmd == 0) {
> gpu.screen.w = sw;
> return;
> }
>
> int diff = sw - update_sw(gpu.screen.w_cmd);
> if (diff > 4 || diff < -4) {
> gpu.screen.w = sw;
> gpu.screen.w_regs = data;
> }
> else if (gpu.screen.w == sw) {
> gpu.screen.w_regs = data;
> }
> gpu.regs[6] = gpu.screen.w_regs;
> gpu.screen.w_cmd = gpu.screen.x2 - gpu.screen.x1;
> return;
> }
>
68a149,158
>
> if (g_gpu_patch_flag & GPU_PATCH_IS_MR_DRILLER) {
> if (gpu.screen.pck_rate == 0 || sw == 0) {
> gpu.screen.w = gpu.screen.hres;
> } else {
> gpu.screen.w = sw / gpu.screen.pck_rate;
> }
> return;
> }
>
76c166
< static noinline void update_height(void)
---
> static noinline void update_height(int isHVcmd)
77a168,193
> if (g_gpu_patch_flag & GPU_PATCH_SCREEN_ADJUST) {
> int data = gpu.regs[7];
> gpu.screen.y1 = data & 0x3ff;
> gpu.screen.y2 = (data >> 10) & 0x3ff;
> // TODO: emulate this properly..
> int sh = update_sh(gpu.screen.y2 - gpu.screen.y1);
> if(isHVcmd == 0) {
> gpu.screen.h = sh;
> return;
> }
>
> int diff = sh - update_sh(gpu.screen.h_cmd);
> if (diff > 4 || diff < -4 || gpu.screen.region_change == 1) {
> gpu.screen.h = sh;
> gpu.screen.h_regs = data;
> if (diff == 0)
> gpu.screen.region_change = 0;
> }
> else if (gpu.screen.h == sh) {
> gpu.screen.h_regs = data;
> }
> gpu.regs[7] = gpu.screen.h_regs;
> gpu.screen.h_cmd = gpu.screen.y2 - gpu.screen.y1;
> return;
> }
>
84d199
<
144,146d258
< // double, for overdraw guard
< #define VRAM_SIZE (1024 * 512 * 2 * 2)
<
190a303,310
> if (g_gpu_patch_flag & GPU_PATCH_ADD_VRAM2) {
> if (gpu.vram2 != NULL) {
> gpu.vram2 -= 4096 / 2;
> gpu.munmap(gpu.vram2, VRAM_SIZE);
> }
> gpu.vram2 = NULL;
> }
>
196,197c316,327
< static const short hres[8] = { 256, 368, 320, 384, 512, 512, 640, 640 };
< static const short vres[4] = { 240, 480, 256, 480 };
---
> static const short hres[2][4] = {
> { 256, 320, 512, 640 }, // HDS2 = 0
> { 368, 384, 384, 384 } // HDS2 = 1
> };
> static const short vres[2][2] = {
> { 240, 480 }, // NTSC
> { 288, 576 } // PAL
> };
> static const short pck_rate[2][4] = {
> { 10, 8, 5, 4 }, // HDS2 = 0
> { 7, 7, 7, 7 } // HDS2 = 1
> };
206a337
> int video = gpu.status.video;
235c366
< update_width();
---
> update_width(1);
240c371
< update_height();
---
> update_height(1);
244,247c375,390
< gpu.screen.hres = hres[(gpu.status.reg >> 16) & 7];
< gpu.screen.vres = vres[(gpu.status.reg >> 19) & 3];
< update_width();
< update_height();
---
> gpu.screen.hres = hres[gpu.status.width1][gpu.status.width0];
> gpu.screen.vres = vres[gpu.status.video][gpu.status.dheight];
>
> if (g_gpu_patch_flag & GPU_PATCH_IS_MR_DRILLER) {
> if (gpu.screen.hres == 368) gpu.screen.hres = 384;
> if (!gpu.status.interlace && gpu.status.dheight) {
> // VGA non-interlace
> gpu.screen.pck_rate = 2;
> } else {
> gpu.screen.pck_rate = pck_rate[gpu.status.width1][gpu.status.width0];
> }
> }
>
> if (video != gpu.status.video) gpu.screen.region_change = 1;
> update_width(0);
> update_height(0);
463a607,612
> } else {
> if ((g_gpu_patch_flag & GPU_PATCH_IS_FF7) ||
> (g_gpu_patch_flag & GPU_PATCH_IS_MR_DRILLER)) {
> gpu.frameskip.frame_ready = 1;
> gpu.frameskip.active = 0;
> }
577a727,731
> if (g_gpu_patch_flag & GPU_PATCH_ADD_BO) {
> check_pmt_frame();
> do_bo();
> }
>
627a782,783
> uint32_t ulEventStatus; // event status
> uint32_t ulEventCnt; // event count
641a798,801
> if (g_gpu_patch_flag & GPU_PATCH_SCREEN_ADJUST) {
> memcpy(freeze->ulControl + sizeof(gpu.regs), (unsigned char*)&gpu.screen.w_cmd, sizeof(int));
> memcpy(freeze->ulControl + sizeof(gpu.regs) + sizeof(int), (unsigned char*)&gpu.screen.h_cmd, sizeof(int));
> }
643a804,805
> freeze->ulEventStatus = gpu.state.bo_processing;
> freeze->ulEventCnt = gpu.state.bo_cnt;
650a813,814
> gpu.state.bo_processing = freeze->ulEventStatus;
> gpu.state.bo_cnt = freeze->ulEventCnt;
654a819,822
> if (g_gpu_patch_flag & GPU_PATCH_SCREEN_ADJUST) {
> memcpy((unsigned char*)&gpu.screen.w_cmd, freeze->ulControl + sizeof(gpu.regs), sizeof(int));
> memcpy((unsigned char*)&gpu.screen.h_cmd, freeze->ulControl + sizeof(gpu.regs) + sizeof(int), sizeof(int));
> }
662a831
> static int frame_cnt = 0;
688a858,863
> if (gpu.state.skip_frame && g_gpu_patch_flag & GPU_PATCH_ADD_VRAM2) {
> gpu.state.skip_frame = 0;
> gpu.state.fb_dirty = 0;
> gpu.state.blanked = 0;
> return;
> }
689a865,874
> if ((g_gpu_patch_flag & GPU_PATCH_IS_MR_DRILLER) ||
> (g_gpu_patch_flag & GPU_PATCH_ARC_THE_LAD)) {
> if (frame_cnt >= 59) {
> gpu.state.fb_dirty = 0;
> gpu.state.blanked = 0;
> frame_cnt = 0;
> return;
> }
> frame_cnt++;
> }
719a905
> gpu.state.bo_trigger = &cbs->gpu_unai.lineskip;
741a928,1208
> uint32_t GPUboStatus(void) {
> uint32_t ret = 0;
>
> if (g_gpu_patch_flag & GPU_PATCH_ADD_BO) {
> ret = gpu.state.bo_processing;
> }
>
> return ret;
> }
>
> static void check_pmt_frame(void) {
> if (!gpu.state.bo && gpu.state.last_pmt_show && !gpu.state.pmt_show) {
> gpu.state.bo = 1;
> }
> else if (gpu.state.bo && !gpu.state.last_pmt_show && gpu.state.pmt_show) {
> gpu.state.bo = 0;
> }
> gpu.state.last_pmt_show = gpu.state.pmt_show;
> gpu.state.dma_chain = 1;
> }
>
> static void wo(void){
>
> uint32_t data[12];
> int cmd, pos;
>
> if((gpu.state.bo_processing == 1) || (gpu.state.bo_processing == 2) ){
>
> cmd = 0xe3;
> pos = 6;
> data[0]=0xe3000140;
> data[1]=0xe4037e7f;
> data[2]=0xe5000140;
> data[3]=0xe1000200;
> data[4]=0xe2000000;
> data[5]=0xe6000000;
> do_cmd_list(data, pos, &cmd);
>
> cmd = 0x28;
> pos = 5;
> data[0]=0x28ffffff;
> data[1]=0x00000000;
> data[2]=0x00000140;
> data[3]=0x00e00000;
> data[4]=0x00e00140;
> do_cmd_list(data, pos, &cmd);
>
> cmd = 0xe3;
> pos = 6;
> data[0]=0xe3000140;
> data[1]=0xe4037e7f;
> data[2]=0xe5000140;
> data[3]=0xe100021f;
> data[4]=0xe2000000;
> data[5]=0xe6000000;
> do_cmd_list(data, pos, &cmd);
> }
> }
>
> static void small_bh(int count){
>
> uint32_t data[12];
> int cmd, pos;
>
> if((gpu.state.bo_processing == 1) || (gpu.state.bo_processing == 2) ){
>
> cmd = 0xe3;
> pos = 6;
> if((count & 0x1) == 0){
> data[0]=0xe3000140;
> data[1]=0xe4037e7f;
> data[2]=0xe5000140;
> data[3]=0xe1000200;
> data[4]=0xe2000000;
> data[5]=0xe6000000;
> }
> else{
> data[0]=0xe3000000;
> data[1]=0xe4037d3f;
> data[2]=0xe5000000;
> data[3]=0xe1000200;
> data[4]=0xe2000000;
> data[5]=0xe6000000;
> }
> do_cmd_list(data, pos, &cmd);
>
> cmd = 0x28;
>
> pos = 5;
> data[0]=0x28000000;
> data[1]=0x00000000;
> data[2]=0x00000140;
> data[3]=0x00e00000;
> data[4]=0x00e00140;
> do_cmd_list(data, pos, &cmd);
>
> cmd = 0x2c;
> pos = 9;
> if(gpu.state.bo_processing == 1){
> data[0]=0x2c808080;
> data[1]=0x00080104;
> data[2]=0x003c70ac;
> data[3]=0x00080128;
> data[4]=0x001470f3;
> data[5]=0x00180104;
> data[6]=0x00008fac;
> data[7]=0x00180128;
> data[8]=0x00008ff3;
> }
> else{
> data[0]=0x2c808080;
> data[1]=0x000800fc;
> data[2]=0x003c0ec4;
> data[3]=0x00080138;
> data[4]=0x00130eff;
> data[5]=0x001600fc;
> data[6]=0x00001bc4;
> data[7]=0x00160138;
> data[8]=0x00001bff;
> }
>
> do_cmd_list(data, pos, &cmd);
>
> cmd = 0xe3;
> pos = 6;
> if((count & 0x1) == 0){
> data[0]=0xe3000140;
> data[1]=0xe4037e7f;
> data[2]=0xe5000140;
> data[3]=0xe100021f;
> data[4]=0xe2000000;
> data[5]=0xe6000000;
> }
> else{
> data[0]=0xe3000000;
> data[1]=0xe4037d3f;
> data[2]=0xe5000000;
> data[3]=0xe100021f;
> data[4]=0xe2000000;
> data[5]=0xe6000000;
> }
> do_cmd_list(data, pos, &cmd);
> }
> }
>
> static void big_bh(int count){
>
> uint32_t data[12];
> int cmd, pos;
>
> if((gpu.state.bo_processing == 1) || (gpu.state.bo_processing == 2) ){
>
> cmd = 0xe3;
> pos = 6;
> if((count & 0x1) == 0){
> data[0]=0xe3000140;
> data[1]=0xe4037e7f;
> data[2]=0xe5000140;
> data[3]=0xe1000200;
> data[4]=0xe2000000;
> data[5]=0xe6000000;
> }
> else{
> data[0]=0xe3000000;
> data[1]=0xe4037d3f;
> data[2]=0xe5000000;
> data[3]=0xe1000200;
> data[4]=0xe2000000;
> data[5]=0xe6000000;
> }
> do_cmd_list(data, pos, &cmd);
>
> cmd = 0x28;
> pos = 5;
> data[0]=0x28000000;
> data[1]=0x00000000;
> data[2]=0x00000140;
> data[3]=0x00e00000;
> data[4]=0x00e00140;
> do_cmd_list(data, pos, &cmd);
>
> cmd = 0x2c;
> pos = 9;
> if(gpu.state.bo_processing == 1){
> data[0]=0x2c808080;
> data[1]=0x000800e0;
> data[2]=0x003c70ac;
> data[3]=0x00080128;
> data[4]=0x001470f3;
> data[5]=0x002800e0;
> data[6]=0x00008fac;
> data[7]=0x00280128;
> data[8]=0x00008ff3;
> }
> else{
> data[0]=0x2c808080;
> data[1]=0x000800c0;
> data[2]=0x007ce020;
> data[3]=0x00080138;
> data[4]=0x0011e097;
> data[5]=0x002400c0;
> data[6]=0x0000fb20;
> data[7]=0x00240138;
> data[8]=0x0000fb97;
> }
> do_cmd_list(data, pos, &cmd);
>
> cmd = 0xe3;
> pos = 6;
> if((count & 0x1) == 0){
> data[0]=0xe3000140;
> data[1]=0xe4037e7f;
> data[2]=0xe5000140;
> data[3]=0xe100021f;
> data[4]=0xe2000000;
> data[5]=0xe6000000;
> }
> else{
> data[0]=0xe3000000;
> data[1]=0xe4037d3f;
> data[2]=0xe5000000;
> data[3]=0xe1000200;
> data[4]=0xe2000000;
> data[5]=0xe6000000;
> }
> do_cmd_list(data, pos, &cmd);
> }
> }
>
> #define DO_CANCEL 0x80000000
> static void do_bo(void){
>
> if((((*gpu.state.bo_trigger) & DO_CANCEL) == DO_CANCEL) && (gpu.state.bo_cnt < 18)){
> gpu.state.bo_processing = 0;
> gpu.state.bo_cnt = 0;
> return;
> }
>
> if( gpu.state.pmt_show == 1 ){
> if(!gpu.state.bo_processing){
> gpu.state.bo_processing = 0xf & (*gpu.state.bo_trigger);
> }
> }
>
> if(gpu.state.bo_processing){
>
> if(gpu.state.bo_cnt < 18){
> ; //nop
> }
> else if(gpu.state.bo_cnt == 18){
> wo();
> }
> else if(gpu.state.bo_cnt < 60+18){
> big_bh(gpu.state.bo_cnt);
> }
> else if(gpu.state.bo_cnt < 240+36){
>
> if(gpu.state.pmt_show == 1){
> wo();
> gpu.state.bo_processing = 8;
> }
> else{
> small_bh(gpu.state.bo_cnt);
> }
> }
> else if(gpu.state.bo_cnt == 240+36){
> wo();
> }
> else{
> gpu.state.bo_processing = 8;
> }
>
> if((gpu.state.bo_processing == 8)&&(*gpu.state.bo_trigger == 0)) gpu.state.bo_processing=0;
>
> gpu.state.bo_cnt++;
> }
> else{
> if(gpu.state.bo_cnt) gpu.state.bo_cnt = 0;
> }
> }
>
diff --new-file -w -r pcsx_rearmed/plugins/gpulib/gpu.h pcsx_rearmed_custom/plugins/gpulib/gpu.h
18a19,23
> #define GPU_PATCH_SCREEN_ADJUST (0x00000001)
> #define GPU_PATCH_IS_FF7 (0x00000002)
> #define GPU_PATCH_IS_MR_DRILLER (0x00000004)
> #define GPU_PATCH_IS_MR_DRILLER_JP (0x00000010)
>
22a28
> uint16_t *vram2;
56a63,65
> int w_regs, h_regs, w_cmd, h_cmd;
> int region_change;
> int pck_rate;
70a80,84
> uint32_t skip_frame:1;
> uint32_t dma_chain:1;
> uint32_t pmt_show:1;
> uint32_t last_pmt_show:1;
> uint32_t bo:1;
79a94,97
> int bo_cnt;
> int *bo_trigger;
> int bo_processing;
> int bo_2nd;
137a156
> void GPUsetPatchFlag(int flag, int set);
diff --new-file -w -r pcsx_rearmed/plugins/gpulib/vout_pl.c pcsx_rearmed_custom/plugins/gpulib/vout_pl.c
55a56
> extern int g_gpu_patch_flag;
82a84,94
> if (g_gpu_patch_flag & GPU_PATCH_IS_FF7) {
> if (gpu.screen.y2 - gpu.screen.y1 == 224) {
> y -= 8;
> h = gpu.screen.h = 240;
> }
> }else if(g_gpu_patch_flag & GPU_PATCH_IS_MR_DRILLER_JP) {
> if((gpu.screen.x1==830) && (gpu.screen.x2==3290) && (w==246)) {
> w = 208;
> }
> }
>
85a98,106
>
> if (gpu.vram2 != NULL) {
> uint16_t *p_vram2 = gpu.vram2;
> p_vram2 += y * 1024 + x;
> for (int i = h-1; i >= 0; i--) {
> uint16_t *s_2 = p_vram2 + 1024*i;
> memset((char*)s_2, 0, w * (gpu.status.rgb24 ? 3 : 2));
> }
> }
diff --new-file -w -r pcsx_rearmed/plugins/gpulib/vout_sdl.c pcsx_rearmed_custom/plugins/gpulib/vout_sdl.c
15a16,20
> #if SDL_MAJOR_VERSION == 2
> SDL_Window *hoge_window;
> SDL_bool hoge_ret;
> #endif
>
29a35
> #if SDL_MAJOR_VERSION == 1
30a37,39
> #else
> screen = SDL_GetWindowSurface(hoge_window);
> #endif
37a47
> #if SDL_MAJOR_VERSION == 1
39a50,53
> #else
> hoge_ret = SDL_GetWindowWMInfo(hoge_window, &wminfo);
> if (hoge_ret == 1)
> #endif
diff --new-file -w -r pcsx_rearmed/plugins/gpu_neon/psx_gpu/psx_gpu_main.c pcsx_rearmed_custom/plugins/gpu_neon/psx_gpu/psx_gpu_main.c
165a166
> #if SDL_MAJOR_VERSION == 1
166a168,171
> #else
> SDL_Window* sdl2Window;
> screen = SDL_GetWindowSurface(sdl2Window);
> #endif
diff --new-file -w -r pcsx_rearmed/plugins/gpu_unai/gpu.h pcsx_rearmed_custom/plugins/gpu_unai/gpu.h
62a63,64
> u32 EventStatus;
> u32 EventCnt;
diff --new-file -w -r pcsx_rearmed/skin pcsx_rearmed_custom/skin
0a1
> frontend/pandora/skin
\ No newline at end of file
@Alain-Christian
Copy link

Left out for licensing reason I'll bet.

@Wsreylet
Copy link

Wsreylet commented Jan 4, 2019

Gist of github

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment