From 30132d5d73a8e08ae7a535dfb5965843dd282682 Mon Sep 17 00:00:00 2001 From: gouchi Date: Sun, 24 Sep 2017 21:28:55 +0200 Subject: [PATCH 001/253] Adding snap package --- pkg/snap/gui/retroarch.desktop | 11 +++ pkg/snap/gui/retroarch.svg | 77 ++++++++++++++++ pkg/snap/retroarch.wrapper | 63 +++++++++++++ pkg/snap/snapcraft.yaml | 161 +++++++++++++++++++++++++++++++++ 4 files changed, 312 insertions(+) create mode 100644 pkg/snap/gui/retroarch.desktop create mode 100644 pkg/snap/gui/retroarch.svg create mode 100755 pkg/snap/retroarch.wrapper create mode 100644 pkg/snap/snapcraft.yaml diff --git a/pkg/snap/gui/retroarch.desktop b/pkg/snap/gui/retroarch.desktop new file mode 100644 index 0000000000..7d8c0793ff --- /dev/null +++ b/pkg/snap/gui/retroarch.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Version=1.0 +Name=RetroArch +GenericName=Libretro Frontend +Type=Application +Comment=Multi-Engine Platform +Icon=${SNAP}/meta/gui/retroarch.svg +Terminal=false +StartupNotify=false +Keywords=multi;engine;emulator;xmb; +Categories=Game;Emulator; diff --git a/pkg/snap/gui/retroarch.svg b/pkg/snap/gui/retroarch.svg new file mode 100644 index 0000000000..08dbe2e93c --- /dev/null +++ b/pkg/snap/gui/retroarch.svg @@ -0,0 +1,77 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/pkg/snap/retroarch.wrapper b/pkg/snap/retroarch.wrapper new file mode 100755 index 0000000000..c043cf32ff --- /dev/null +++ b/pkg/snap/retroarch.wrapper @@ -0,0 +1,63 @@ +#!/bin/sh + +set -e + +case "$SNAP_ARCH" in + "amd64") ARCH='x86_64-linux-gnu' + ;; + "i386") ARCH='i386-linux-gnu' + ;; + "armhf") ARCH='arm-linux-gnueabihf' + ;; + *) + echo "Unsupported architecture for this app build" + exit 1 + ;; +esac + + +export LD_LIBRARY_PATH="$SNAP/usr/lib/$ARCH/dri:$SNAP/usr/lib/$ARCH/alsa-lib:$LD_LIBRARY_PATH" +export XDG_DATA_HOME="$SNAP/usr/share" +export FONTCONFIG_PATH="$SNAP/etc/fonts/config.d" +export FONTCONFIG_FILE="$SNAP/etc/fonts/fonts.conf" +export XKB_CONFIG_ROOT="$SNAP/usr/share/X11/xkb" + +# Mesa Libs +export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/mesa:$LD_LIBRARY_PATH +export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/mesa-egl:$LD_LIBRARY_PATH + +# Tell libGL where to find the drivers +export LIBGL_DRIVERS_PATH=$SNAP/usr/lib/$ARCH/dri + +# ensure that our HW/opengl libs are before the snap specific libs +export LD_LIBRARY_PATH=$SNAP_LIBRARY_PATH:$LD_LIBRARY_PATH + +# Otherwise XOpenIM failed +export XLOCALEDIR=$SNAP/usr/share/X11/locale + +#Create RetroArch user configuration directory if doesn't exist +[ ! -d "$SNAP_USER_DATA/.config/retroarch" ] && mkdir -p "$SNAP_USER_DATA/.config/retroarch" + +#Copy assets if doesn't exist +[ ! -d "$SNAP_USER_DATA/.config/retroarch/assets" ] && cp -R "$SNAP/.config/assets" "$SNAP_USER_DATA/.config/retroarch" + +#Copy joypad autoconfig files if doesn't exist +[ ! -d "$SNAP_USER_DATA/.config/retroarch/autoconfig" ] && cp -R "$SNAP/.config/autoconfig" "$SNAP_USER_DATA/.config/retroarch" + +#Copy cheats files if doesn't exist +[ ! -d "$SNAP_USER_DATA/.config/retroarch/cheats" ] && cp -R "$SNAP/.config/cheats" "$SNAP_USER_DATA/.config/retroarch" + +#Copy database files if doesn't exist +[ ! -d "$SNAP_USER_DATA/.config/retroarch/database" ] && cp -R "$SNAP/.config/database" "$SNAP_USER_DATA/.config/retroarch" + +#Copy info files if doesn't exist +[ ! -d "$SNAP_USER_DATA/.config/retroarch/cores" ] && cp -R "$SNAP/.config/cores" "$SNAP_USER_DATA/.config/retroarch" + +#Copy overlay if doesn't exist +[ ! -d "$SNAP_USER_DATA/.config/retroarch/overlay" ] && cp -R "$SNAP/.config/overlay" "$SNAP_USER_DATA/.config/retroarch" + +#Copy shaders if doesn't exist +[ ! -d "$SNAP_USER_DATA/.config/retroarch/shaders" ] && cp -R "$SNAP/.config/shaders" "$SNAP_USER_DATA/.config/retroarch" + +$SNAP/usr/local/bin/retroarch $* + diff --git a/pkg/snap/snapcraft.yaml b/pkg/snap/snapcraft.yaml new file mode 100644 index 0000000000..559c553332 --- /dev/null +++ b/pkg/snap/snapcraft.yaml @@ -0,0 +1,161 @@ +name: retroarch +version: "1.6.7" +summary: RetroArch +description: RetroArch is the official reference frontend for the libretro API. +confinement: strict +grade: stable + + +apps: + retroarch: + command: usr/local/bin/retroarch.wrapper + plugs: [network, network-bind, x11, opengl, home, alsa, pulseaudio, bluez] + +parts: + retroarch: + plugin: autotools + source-type: tar + source: https://github.com/libretro/RetroArch/archive/v1.6.7.tar.gz + configflags: + - --enable-kms + - --enable-xvideo + - --enable-ffmpeg + - --enable-ssa + - --disable-coreaudio + - --disable-jack + - --disable-python + - --enable-pulse + - --disable-roar + - --disable-rsound + - --disable-sdl + - --disable-sdl2 + - --disable-vg + - --disable-v4l2 + - --disable-xinerama + stage-packages: + - fonts-dejavu-core + - libasound2 + - libavcodec-ffmpeg56 + - libavformat-ffmpeg56 + - libavutil-ffmpeg54 + - libc6 + - libdrm2 + - libegl1-mesa + - libfreetype6 + - libgbm1 + - libgl1-mesa-dri + - libgl1-mesa-glx + - libgles2-mesa + - libminizip1 + - libopenal1 + - libpulse0 + - libswresample-ffmpeg1 + - libswscale-ffmpeg3 + - libudev1 + - libusb-1.0-0 + - libwayland-client0 + - libwayland-egl1-mesa + - libx11-6 + - libxext6 + - libxinerama1 + - libxkbcommon0 + - libxv1 + - libxxf86vm1 + - pulseaudio + - zlib1g + build-packages: + - gcc + - make + - libasound2-dev + - libass-dev + - libavcodec-dev + - libavdevice-dev + - libavformat-dev + - libdrm-dev + - libegl1-mesa-dev + - libfreetype6-dev + - libgbm-dev + - libgl1-mesa-dev + - libpulse-dev + - libswscale-dev + - libusb-1.0-0-dev + - libudev-dev + - libxml2-dev + - libxv-dev + - mesa-common-dev + - xserver-xorg-input-all + - zlib1g-dev + retroarch-wrapper: + plugin: dump + source: . + organize: + retroarch.wrapper: usr/local/bin/retroarch.wrapper + stage: + - usr/local/bin/retroarch.wrapper + retroarch-assets: + plugin: dump + source: https://github.com/libretro/retroarch-assets/archive/master.tar.gz + source-type: tar + organize: + xmb: .config/assets/xmb + glui: .config/assets/glui + filesets: + assets: [.config/assets/xmb/*, -.config/assets/xmb/*/src, .config/assets/glui/*.png, .config/assets/glui/*.ttf] + stage: + - -configure + - -Makefile + - $assets + prime: + - $assets + retroarch-autoconfig: + plugin: dump + source: https://github.com/libretro/retroarch-joypad-autoconfig/archive/master.tar.gz + source-type: tar + organize: + udev: .config/autoconfig/udev + linuxraw: .config/autoconfig/linuxraw + hid: .config/autoconfig/hid + x: .config/autoconfig/x + filesets: + autoconfig: [ .config/autoconfig/udev, .config/autoconfig/linuxraw, .config/autoconfig/hid, .config/autoconfig/x] + stage: + - $autoconfig + prime: + - $autoconfig + retroarch-database: + plugin: dump + source: https://github.com/libretro/libretro-database/archive/master.tar.gz + source-type : tar + organize: + rdb: .config/database/rdb + cursors: .config/database/cursors + cht: .config/cheats + stage: + - .config/database + - .config/cheats + retroarch-info: + plugin: dump + source: https://github.com/libretro/libretro-super/archive/master.tar.gz + source-type : tar + organize: + dist/info: .config/cores + stage: + - .config/cores + retroarch-overlays: + plugin: dump + source: https://github.com/libretro/common-overlays/archive/master.tar.gz + source-type : tar + organize: + "*": .config/overlay + stage: + - .config/overlay + retroarch-shaders: + plugin: dump + source: https://github.com/libretro/glsl-shaders/archive/master.tar.gz + source-type : tar + organize: + "*": .config/shaders/shaders_glsl + stage: + - -configure + - -Makefile + - .config/shaders From 65f9dc7accbd523ccecff7951bd83ddd652698aa Mon Sep 17 00:00:00 2001 From: altiereslima Date: Mon, 25 Sep 2017 14:47:04 -0300 Subject: [PATCH 002/253] Update portuguese transation --- intl/msg_hash_pt_br.h | 24 ++++++++++++------------ intl/msg_hash_pt_pt.c | 6 +++--- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index 0ce923777d..0b40ad1a3d 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -857,10 +857,10 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_SLOWMOTION, "Câmera Lenta" ) MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_STATE_SLOT_MINUS, - "Box do Estado de Jogo -" + "Posição do Estado de Jogo -" ) MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_STATE_SLOT_PLUS, - "Box do Estado de Jogo +" + "Posição do Estado de Jogo +" ) MSG_HASH(MENU_ENUM_LABEL_VALUE_INPUT_META_VOLUME_DOWN, "Volume -" @@ -1661,7 +1661,7 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_START_VIDEO_PROCESSOR, "Iniciar Processador de Vídeo" ) MSG_HASH(MENU_ENUM_LABEL_VALUE_STATE_SLOT, - "Box do Estado de Jogo" + "Posição do Estado de Jogo" ) MSG_HASH(MENU_ENUM_LABEL_VALUE_STATUS, "Condição" @@ -2729,7 +2729,7 @@ MSG_HASH(MSG_FOUND_FIRST_DATA_TRACK_ON_FILE, "Encontrada primeira faixa de dados no arquivo" ) MSG_HASH(MSG_FOUND_LAST_STATE_SLOT, - "Encontrado último box de Estado de Jogo" + "Encontrada última posição de Estado de Jogo" ) MSG_HASH(MSG_FOUND_SHADER, "Shader encontrado" @@ -2798,10 +2798,10 @@ MSG_HASH(MSG_LIBRETRO_FRONTEND, "Frontend para Libretro" ) MSG_HASH(MSG_LOADED_STATE_FROM_SLOT, - "Estado de Jogo carregado do box #%d." + "Estado de Jogo carregado da posição #%d." ) MSG_HASH(MSG_LOADED_STATE_FROM_SLOT_AUTO, - "Estado de Jogo carregado do box #-1 (automático)." + "Estado de Jogo carregado da posição #-1 (automático)." ) MSG_HASH(MSG_LOADING, "Carregando" @@ -2927,10 +2927,10 @@ MSG_HASH(MSG_SAVED_NEW_CONFIG_TO, "Nova configuração salva em" ) MSG_HASH(MSG_SAVED_STATE_TO_SLOT, - "Estado de Jogo salvo no box #%d." + "Estado de Jogo salvo na posição #%d." ) MSG_HASH(MSG_SAVED_STATE_TO_SLOT_AUTO, - "Estado de Jogo salvo no box #-1 (automático)." + "Estado de Jogo salvo na posição #-1 (automático)." ) MSG_HASH(MSG_SAVED_SUCCESSFULLY_TO, "Salvo com sucesso em" @@ -2981,7 +2981,7 @@ MSG_HASH(MSG_STATE_SIZE, "Tamanho do Estado de Jogo" ) MSG_HASH(MSG_STATE_SLOT, - "Box do Estado de Jogo" + "Posição do Estado de Jogo" ) MSG_HASH(MSG_TAKING_SCREENSHOT, "Fazendo captura de tela" @@ -3584,10 +3584,10 @@ MSG_HASH(MENU_ENUM_SUBLABEL_CLOSE_CONTENT, "Fecha o conteúdo atual. Alterações não salvas serão perdidas." ) MSG_HASH(MENU_ENUM_SUBLABEL_LOAD_STATE, - "Carregar um Estado de Jogo do box selecionado atualmente." + "Carregar um Estado de Jogo da posição selecionado atualmente." ) MSG_HASH(MENU_ENUM_SUBLABEL_SAVE_STATE, - "Salvar um Estado de Jogo no box selecionado atualmente." + "Salvar um Estado de Jogo na posição selecionado atualmente." ) MSG_HASH(MENU_ENUM_SUBLABEL_RESUME, "Retomar a execução do conteúdo atual e sair do Menu Rápido." @@ -3596,7 +3596,7 @@ MSG_HASH(MENU_ENUM_SUBLABEL_RESUME_CONTENT, "Retomar a execução do conteúdo atual e sair do Menu Rápido." ) MSG_HASH(MENU_ENUM_SUBLABEL_STATE_SLOT, - "Altera o box do Estado de Jogo selecionado atualmente." + "Altera a posição do Estado de Jogo selecionado atualmente." ) MSG_HASH(MENU_ENUM_SUBLABEL_UNDO_LOAD_STATE, "Se um Estado de Jogo for carregado, o conteúdo voltará ao estado anterior ao carregamento." diff --git a/intl/msg_hash_pt_pt.c b/intl/msg_hash_pt_pt.c index 0ab39d3033..3877ade922 100644 --- a/intl/msg_hash_pt_pt.c +++ b/intl/msg_hash_pt_pt.c @@ -57,7 +57,7 @@ int menu_hash_get_help_pt_pt_enum(enum msg_hash_enums msg, char *s, size_t len) "Esse driver funciona sem o X. \n" " \n" "Ele usa a recente API de joypads \n" - "evdev para supporte a joystick. \n" + "evdev para suporte a joystick. \n" "Suporta Hot-Swap e force feedback \n" "(se suportado pelo dispositivo). \n" " \n" @@ -490,7 +490,7 @@ int menu_hash_get_help_pt_pt_enum(enum msg_hash_enums msg, char *s, size_t len) "compatibilidade.\n" " \n" "Esse valor deve ficar próximo de 60Hz para \n" - "evitar grande mudanças de pitch. Se o monitor \n" + "evitar grandes mudanças de pitch. Se o monitor \n" "não rodar a 60Hz, ou algo próximo a isso, desative\n" "o VSync, e deixe-o com valores padrão."; strlcpy(s, u, len); @@ -822,7 +822,7 @@ int menu_hash_get_help_pt_pt_enum(enum msg_hash_enums msg, char *s, size_t len) case MENU_ENUM_LABEL_LOCATION_ALLOW: snprintf(s, len, "Autorizar ou desautorizar o acesso de \n" - "serviços de localização pelos cores."); + "serviços de localização pelas cores."); break; case MENU_ENUM_LABEL_TURBO: snprintf(s, len, From 2af496e7e24f21ac20af39363e936dedee12ddf1 Mon Sep 17 00:00:00 2001 From: Rob Loach Date: Mon, 25 Sep 2017 17:20:14 -0400 Subject: [PATCH 003/253] Move pkg/snap to libretro/retroarch-snap . The Snap now lives over at https://github.com/libretro/retroarch-snap . --- pkg/snap/gui/retroarch.desktop | 11 --- pkg/snap/gui/retroarch.svg | 77 ---------------- pkg/snap/retroarch.wrapper | 63 ------------- pkg/snap/snapcraft.yaml | 161 --------------------------------- 4 files changed, 312 deletions(-) delete mode 100644 pkg/snap/gui/retroarch.desktop delete mode 100644 pkg/snap/gui/retroarch.svg delete mode 100755 pkg/snap/retroarch.wrapper delete mode 100644 pkg/snap/snapcraft.yaml diff --git a/pkg/snap/gui/retroarch.desktop b/pkg/snap/gui/retroarch.desktop deleted file mode 100644 index 7d8c0793ff..0000000000 --- a/pkg/snap/gui/retroarch.desktop +++ /dev/null @@ -1,11 +0,0 @@ -[Desktop Entry] -Version=1.0 -Name=RetroArch -GenericName=Libretro Frontend -Type=Application -Comment=Multi-Engine Platform -Icon=${SNAP}/meta/gui/retroarch.svg -Terminal=false -StartupNotify=false -Keywords=multi;engine;emulator;xmb; -Categories=Game;Emulator; diff --git a/pkg/snap/gui/retroarch.svg b/pkg/snap/gui/retroarch.svg deleted file mode 100644 index 08dbe2e93c..0000000000 --- a/pkg/snap/gui/retroarch.svg +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - image/svg+xml - - - - - - - - - diff --git a/pkg/snap/retroarch.wrapper b/pkg/snap/retroarch.wrapper deleted file mode 100755 index c043cf32ff..0000000000 --- a/pkg/snap/retroarch.wrapper +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh - -set -e - -case "$SNAP_ARCH" in - "amd64") ARCH='x86_64-linux-gnu' - ;; - "i386") ARCH='i386-linux-gnu' - ;; - "armhf") ARCH='arm-linux-gnueabihf' - ;; - *) - echo "Unsupported architecture for this app build" - exit 1 - ;; -esac - - -export LD_LIBRARY_PATH="$SNAP/usr/lib/$ARCH/dri:$SNAP/usr/lib/$ARCH/alsa-lib:$LD_LIBRARY_PATH" -export XDG_DATA_HOME="$SNAP/usr/share" -export FONTCONFIG_PATH="$SNAP/etc/fonts/config.d" -export FONTCONFIG_FILE="$SNAP/etc/fonts/fonts.conf" -export XKB_CONFIG_ROOT="$SNAP/usr/share/X11/xkb" - -# Mesa Libs -export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/mesa:$LD_LIBRARY_PATH -export LD_LIBRARY_PATH=$SNAP/usr/lib/$ARCH/mesa-egl:$LD_LIBRARY_PATH - -# Tell libGL where to find the drivers -export LIBGL_DRIVERS_PATH=$SNAP/usr/lib/$ARCH/dri - -# ensure that our HW/opengl libs are before the snap specific libs -export LD_LIBRARY_PATH=$SNAP_LIBRARY_PATH:$LD_LIBRARY_PATH - -# Otherwise XOpenIM failed -export XLOCALEDIR=$SNAP/usr/share/X11/locale - -#Create RetroArch user configuration directory if doesn't exist -[ ! -d "$SNAP_USER_DATA/.config/retroarch" ] && mkdir -p "$SNAP_USER_DATA/.config/retroarch" - -#Copy assets if doesn't exist -[ ! -d "$SNAP_USER_DATA/.config/retroarch/assets" ] && cp -R "$SNAP/.config/assets" "$SNAP_USER_DATA/.config/retroarch" - -#Copy joypad autoconfig files if doesn't exist -[ ! -d "$SNAP_USER_DATA/.config/retroarch/autoconfig" ] && cp -R "$SNAP/.config/autoconfig" "$SNAP_USER_DATA/.config/retroarch" - -#Copy cheats files if doesn't exist -[ ! -d "$SNAP_USER_DATA/.config/retroarch/cheats" ] && cp -R "$SNAP/.config/cheats" "$SNAP_USER_DATA/.config/retroarch" - -#Copy database files if doesn't exist -[ ! -d "$SNAP_USER_DATA/.config/retroarch/database" ] && cp -R "$SNAP/.config/database" "$SNAP_USER_DATA/.config/retroarch" - -#Copy info files if doesn't exist -[ ! -d "$SNAP_USER_DATA/.config/retroarch/cores" ] && cp -R "$SNAP/.config/cores" "$SNAP_USER_DATA/.config/retroarch" - -#Copy overlay if doesn't exist -[ ! -d "$SNAP_USER_DATA/.config/retroarch/overlay" ] && cp -R "$SNAP/.config/overlay" "$SNAP_USER_DATA/.config/retroarch" - -#Copy shaders if doesn't exist -[ ! -d "$SNAP_USER_DATA/.config/retroarch/shaders" ] && cp -R "$SNAP/.config/shaders" "$SNAP_USER_DATA/.config/retroarch" - -$SNAP/usr/local/bin/retroarch $* - diff --git a/pkg/snap/snapcraft.yaml b/pkg/snap/snapcraft.yaml deleted file mode 100644 index 559c553332..0000000000 --- a/pkg/snap/snapcraft.yaml +++ /dev/null @@ -1,161 +0,0 @@ -name: retroarch -version: "1.6.7" -summary: RetroArch -description: RetroArch is the official reference frontend for the libretro API. -confinement: strict -grade: stable - - -apps: - retroarch: - command: usr/local/bin/retroarch.wrapper - plugs: [network, network-bind, x11, opengl, home, alsa, pulseaudio, bluez] - -parts: - retroarch: - plugin: autotools - source-type: tar - source: https://github.com/libretro/RetroArch/archive/v1.6.7.tar.gz - configflags: - - --enable-kms - - --enable-xvideo - - --enable-ffmpeg - - --enable-ssa - - --disable-coreaudio - - --disable-jack - - --disable-python - - --enable-pulse - - --disable-roar - - --disable-rsound - - --disable-sdl - - --disable-sdl2 - - --disable-vg - - --disable-v4l2 - - --disable-xinerama - stage-packages: - - fonts-dejavu-core - - libasound2 - - libavcodec-ffmpeg56 - - libavformat-ffmpeg56 - - libavutil-ffmpeg54 - - libc6 - - libdrm2 - - libegl1-mesa - - libfreetype6 - - libgbm1 - - libgl1-mesa-dri - - libgl1-mesa-glx - - libgles2-mesa - - libminizip1 - - libopenal1 - - libpulse0 - - libswresample-ffmpeg1 - - libswscale-ffmpeg3 - - libudev1 - - libusb-1.0-0 - - libwayland-client0 - - libwayland-egl1-mesa - - libx11-6 - - libxext6 - - libxinerama1 - - libxkbcommon0 - - libxv1 - - libxxf86vm1 - - pulseaudio - - zlib1g - build-packages: - - gcc - - make - - libasound2-dev - - libass-dev - - libavcodec-dev - - libavdevice-dev - - libavformat-dev - - libdrm-dev - - libegl1-mesa-dev - - libfreetype6-dev - - libgbm-dev - - libgl1-mesa-dev - - libpulse-dev - - libswscale-dev - - libusb-1.0-0-dev - - libudev-dev - - libxml2-dev - - libxv-dev - - mesa-common-dev - - xserver-xorg-input-all - - zlib1g-dev - retroarch-wrapper: - plugin: dump - source: . - organize: - retroarch.wrapper: usr/local/bin/retroarch.wrapper - stage: - - usr/local/bin/retroarch.wrapper - retroarch-assets: - plugin: dump - source: https://github.com/libretro/retroarch-assets/archive/master.tar.gz - source-type: tar - organize: - xmb: .config/assets/xmb - glui: .config/assets/glui - filesets: - assets: [.config/assets/xmb/*, -.config/assets/xmb/*/src, .config/assets/glui/*.png, .config/assets/glui/*.ttf] - stage: - - -configure - - -Makefile - - $assets - prime: - - $assets - retroarch-autoconfig: - plugin: dump - source: https://github.com/libretro/retroarch-joypad-autoconfig/archive/master.tar.gz - source-type: tar - organize: - udev: .config/autoconfig/udev - linuxraw: .config/autoconfig/linuxraw - hid: .config/autoconfig/hid - x: .config/autoconfig/x - filesets: - autoconfig: [ .config/autoconfig/udev, .config/autoconfig/linuxraw, .config/autoconfig/hid, .config/autoconfig/x] - stage: - - $autoconfig - prime: - - $autoconfig - retroarch-database: - plugin: dump - source: https://github.com/libretro/libretro-database/archive/master.tar.gz - source-type : tar - organize: - rdb: .config/database/rdb - cursors: .config/database/cursors - cht: .config/cheats - stage: - - .config/database - - .config/cheats - retroarch-info: - plugin: dump - source: https://github.com/libretro/libretro-super/archive/master.tar.gz - source-type : tar - organize: - dist/info: .config/cores - stage: - - .config/cores - retroarch-overlays: - plugin: dump - source: https://github.com/libretro/common-overlays/archive/master.tar.gz - source-type : tar - organize: - "*": .config/overlay - stage: - - .config/overlay - retroarch-shaders: - plugin: dump - source: https://github.com/libretro/glsl-shaders/archive/master.tar.gz - source-type : tar - organize: - "*": .config/shaders/shaders_glsl - stage: - - -configure - - -Makefile - - .config/shaders From 5a7a54d10cae85f7dd60549f8c1841078bccd7d7 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 26 Sep 2017 00:39:29 +0200 Subject: [PATCH 004/253] Add Makefile.version --- Makefile.openpandora | 2 +- Makefile.ps3 | 2 +- Makefile.ps3.cobra | 2 +- Makefile.psl1ght | 2 +- Makefile.version | 1 + 5 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 Makefile.version diff --git a/Makefile.openpandora b/Makefile.openpandora index b39176e1c8..4a72fbb9f1 100644 --- a/Makefile.openpandora +++ b/Makefile.openpandora @@ -1,4 +1,4 @@ -RARCH_VERSION = "1.6.7.0" +include Makefile.version DEBUG = 0 diff --git a/Makefile.ps3 b/Makefile.ps3 index a0f1a339d6..0ab0467f59 100644 --- a/Makefile.ps3 +++ b/Makefile.ps3 @@ -1,4 +1,4 @@ -RARCH_VERSION = "1.6.7.0" +include Makefile.version #which compiler to build with - GCC or SNC #set to GCC for debug builds for use with debugger diff --git a/Makefile.ps3.cobra b/Makefile.ps3.cobra index 8c153d2694..d1ae13b3ad 100644 --- a/Makefile.ps3.cobra +++ b/Makefile.ps3.cobra @@ -1,4 +1,4 @@ -RARCH_VERSION = "1.6.7.0" +include Makefile.version #which compiler to build with - GCC or SNC #set to GCC for debug builds for use with debugger diff --git a/Makefile.psl1ght b/Makefile.psl1ght index 09e7755e47..0ed9ffdd1e 100644 --- a/Makefile.psl1ght +++ b/Makefile.psl1ght @@ -1,4 +1,4 @@ -RARCH_VERSION = "1.6.7.0" +include Makefile.version DEBUG = 0 HAVE_LOGGER = 0 diff --git a/Makefile.version b/Makefile.version new file mode 100644 index 0000000000..9af223c1cc --- /dev/null +++ b/Makefile.version @@ -0,0 +1 @@ +RARCH_VERSION = "1.6.7.0" From 76e9aaf17278b489c31721abe1c284ec1ff6ee9d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 26 Sep 2017 00:44:55 +0200 Subject: [PATCH 005/253] Start using DTD file --- pkg/android/phoenix/AndroidManifest.xml | 3 ++- pkg/wii/meta.xml | 3 ++- pkg/wiiu/meta.xml | 3 ++- version.dtd | 1 + 4 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 version.dtd diff --git a/pkg/android/phoenix/AndroidManifest.xml b/pkg/android/phoenix/AndroidManifest.xml index 0528ea7ebb..a6a44a8edd 100644 --- a/pkg/android/phoenix/AndroidManifest.xml +++ b/pkg/android/phoenix/AndroidManifest.xml @@ -1,7 +1,8 @@ + %versionDTD; ]> diff --git a/pkg/wii/meta.xml b/pkg/wii/meta.xml index 75c81a3cfa..2841ccef3b 100644 --- a/pkg/wii/meta.xml +++ b/pkg/wii/meta.xml @@ -1,8 +1,9 @@ + %versionDTD; ]> RetroArch Libretro - 1.6.7 + "&version;" 2012-2017 The cross-platform entertainment system A port of RetroArch to the GameCube/Wii. diff --git a/pkg/wiiu/meta.xml b/pkg/wiiu/meta.xml index 66fc7271bf..4320eb0bae 100644 --- a/pkg/wiiu/meta.xml +++ b/pkg/wiiu/meta.xml @@ -1,8 +1,9 @@ + %versionDTD; ]> Retroarch Libretro - 1.67 + "&version;" 20170108133000 RetroArch diff --git a/version.dtd b/version.dtd new file mode 100644 index 0000000000..c5a25eb60c --- /dev/null +++ b/version.dtd @@ -0,0 +1 @@ + From bf8811ca64f48ad98d1a797f3be2f3516fab3b0d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 26 Sep 2017 00:47:07 +0200 Subject: [PATCH 006/253] Update --- pkg/android/phoenix/AndroidManifest.xml | 2 +- pkg/wii/meta.xml | 4 ++-- pkg/wiiu/meta.xml | 4 ++-- version.dtd | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/android/phoenix/AndroidManifest.xml b/pkg/android/phoenix/AndroidManifest.xml index a6a44a8edd..4bce244afa 100644 --- a/pkg/android/phoenix/AndroidManifest.xml +++ b/pkg/android/phoenix/AndroidManifest.xml @@ -1,4 +1,4 @@ - %versionDTD; ]> + %versionDTD; ]> %versionDTD; ]> + %versionDTD; ]> RetroArch Libretro - "&version;" + &version; 2012-2017 The cross-platform entertainment system A port of RetroArch to the GameCube/Wii. diff --git a/pkg/wiiu/meta.xml b/pkg/wiiu/meta.xml index 4320eb0bae..59505c5736 100644 --- a/pkg/wiiu/meta.xml +++ b/pkg/wiiu/meta.xml @@ -1,9 +1,9 @@ - %versionDTD; ]> + %versionDTD; ]> Retroarch Libretro - "&version;" + &version; 20170108133000 RetroArch diff --git a/version.dtd b/version.dtd index c5a25eb60c..9520dcf0d2 100644 --- a/version.dtd +++ b/version.dtd @@ -1 +1 @@ - + From f75ce5fb5c57dae40929e87b686bb5dd3db2715a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 26 Sep 2017 00:47:52 +0200 Subject: [PATCH 007/253] Another update --- pkg/wii/meta.xml | 2 +- pkg/wiiu/meta.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/wii/meta.xml b/pkg/wii/meta.xml index 091e8d2f72..aa4c7cc2aa 100644 --- a/pkg/wii/meta.xml +++ b/pkg/wii/meta.xml @@ -1,5 +1,5 @@ - %versionDTD; ]> + %versionDTD; ]> RetroArch Libretro diff --git a/pkg/wiiu/meta.xml b/pkg/wiiu/meta.xml index 59505c5736..f159828141 100644 --- a/pkg/wiiu/meta.xml +++ b/pkg/wiiu/meta.xml @@ -1,5 +1,5 @@ - %versionDTD; ]> + %versionDTD; ]> Retroarch Libretro From 5f6b79e7f4df8cec01e5f7529fc109003dd04511 Mon Sep 17 00:00:00 2001 From: Alcaro Date: Tue, 26 Sep 2017 01:05:43 +0200 Subject: [PATCH 008/253] Merge version.h, dist-cores.sh and version.all --- Makefile.openpandora | 2 +- Makefile.ps3 | 2 +- Makefile.ps3.cobra | 2 +- Makefile.psl1ght | 2 +- Makefile.version | 1 - dist-scripts/dist-cores.sh | 2 +- version.all | 13 +++++++++++++ version.h | 4 +--- 8 files changed, 19 insertions(+), 9 deletions(-) delete mode 100644 Makefile.version create mode 100644 version.all diff --git a/Makefile.openpandora b/Makefile.openpandora index 4a72fbb9f1..a17adf5afc 100644 --- a/Makefile.openpandora +++ b/Makefile.openpandora @@ -1,4 +1,4 @@ -include Makefile.version +include version.all DEBUG = 0 diff --git a/Makefile.ps3 b/Makefile.ps3 index 0ab0467f59..3e2771193c 100644 --- a/Makefile.ps3 +++ b/Makefile.ps3 @@ -1,4 +1,4 @@ -include Makefile.version +include version.all #which compiler to build with - GCC or SNC #set to GCC for debug builds for use with debugger diff --git a/Makefile.ps3.cobra b/Makefile.ps3.cobra index d1ae13b3ad..17cd151fa2 100644 --- a/Makefile.ps3.cobra +++ b/Makefile.ps3.cobra @@ -1,4 +1,4 @@ -include Makefile.version +include version.all #which compiler to build with - GCC or SNC #set to GCC for debug builds for use with debugger diff --git a/Makefile.psl1ght b/Makefile.psl1ght index 0ed9ffdd1e..d619e64b82 100644 --- a/Makefile.psl1ght +++ b/Makefile.psl1ght @@ -1,4 +1,4 @@ -include Makefile.version +include version.all DEBUG = 0 HAVE_LOGGER = 0 diff --git a/Makefile.version b/Makefile.version deleted file mode 100644 index 9af223c1cc..0000000000 --- a/Makefile.version +++ /dev/null @@ -1 +0,0 @@ -RARCH_VERSION = "1.6.7.0" diff --git a/dist-scripts/dist-cores.sh b/dist-scripts/dist-cores.sh index dd708f539b..d1fafaafab 100755 --- a/dist-scripts/dist-cores.sh +++ b/dist-scripts/dist-cores.sh @@ -1,6 +1,6 @@ #!/bin/sh -RARCH_VERSION=1.6.7 +source ../version.all PLATFORM=$1 SALAMANDER=no MAKEFILE_GRIFFIN=no diff --git a/version.all b/version.all new file mode 100644 index 0000000000..7b71569142 --- /dev/null +++ b/version.all @@ -0,0 +1,13 @@ +# /* this file is a polyglot: it's valid C, Makefile and shell */ +# /* this reduces the number of files to update when changing the version */ +# /* files to change to update version: */ +# /* - this one, obviously */ +# /* - version.dtd */ +# /* - pkg/snap/snapcraft.yaml (including the github url) */ + +#if 0 +RARCH_VERSION="1.6.7" +#endif +#ifndef PACKAGE_VERSION +#define PACKAGE_VERSION "1.6.7" +#endif diff --git a/version.h b/version.h index e10de54d6a..e4304b615b 100644 --- a/version.h +++ b/version.h @@ -17,8 +17,6 @@ #ifndef RARCH_VERSION_H__ #define RARCH_VERSION_H__ -#ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "1.6.7" -#endif +#include "version.all" #endif From 581ef744d79a054e5aab28a1fbeeb24669ea3616 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 26 Sep 2017 02:52:24 +0200 Subject: [PATCH 009/253] Update RARCH_VERSION; replace with PACKAGE_VERSION --- Makefile.ps3 | 12 ++++++------ Makefile.ps3.cobra | 12 ++++++------ Makefile.psl1ght | 2 +- dist-scripts/wiiu-cores.sh | 4 ++-- 4 files changed, 15 insertions(+), 15 deletions(-) diff --git a/Makefile.ps3 b/Makefile.ps3 index 3e2771193c..31d862d0d5 100644 --- a/Makefile.ps3 +++ b/Makefile.ps3 @@ -163,20 +163,20 @@ pkg: $(PPU_TARGET) create-shaders copy-media-files create-npdrm-salamander crea $(MAKE_PACKAGE_NPDRM) pkg/ps3/package.conf pkg/ps3 pkg-signed: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core - $(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg + $(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg pkg-signed-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core $(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID) - $(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg + $(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg pkg-signed-cfw: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core - $(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg - $(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg + $(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg + $(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg pkg-signed-cfw-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core $(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID) - $(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg - $(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg + $(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg + $(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg clean-selfs: ifeq ($(EBOOT_EXISTS),1) diff --git a/Makefile.ps3.cobra b/Makefile.ps3.cobra index 17cd151fa2..7b3ce395f9 100644 --- a/Makefile.ps3.cobra +++ b/Makefile.ps3.cobra @@ -159,20 +159,20 @@ pkg: $(PPU_TARGET) create-shaders copy-media-files create-npdrm-salamander crea $(MAKE_PACKAGE_NPDRM) pkg/ps3/package.conf pkg/ps3 pkg-signed: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core - $(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg + $(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg pkg-signed-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core $(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID) - $(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg + $(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg pkg-signed-cfw: $(PPU_TARGET) create-shaders copy-media-files create-salamander create-core - $(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg - $(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg + $(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg + $(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg pkg-signed-cfw-standalone: $(PPU_TARGET) create-shaders copy-media-files create-core $(MAKE_SELF) $(PPU_TARGET) $(EBOOT_PATH) $(CONTENT_ID) - $(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg - $(PKG_FINALIZE) retroarch-ps3-cfw-$(RARCH_VERSION)-kmeaw.pkg + $(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg + $(PKG_FINALIZE) retroarch-ps3-cfw-$(PACKAGE_VERSION)-kmeaw.pkg clean-selfs: ifeq ($(EBOOT_EXISTS),1) diff --git a/Makefile.psl1ght b/Makefile.psl1ght index d619e64b82..f08a49317c 100644 --- a/Makefile.psl1ght +++ b/Makefile.psl1ght @@ -121,7 +121,7 @@ pkg: $(ELF_TARGET) create-npdrm-core $(MAKE_PACKAGE_NPDRM) pkg/ps3/package.conf ps3/pkg pkg-signed: $(ELF_TARGET) create-core - $(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(RARCH_VERSION).pkg + $(PYTHON2) $(PKG_SCRIPT) --contentid $(CONTENT_ID_FULL) pkg/ps3 retroarch-ps3-cfw-$(PACKAGE_VERSION).pkg clean: rm -f $(ELF_TARGET) diff --git a/dist-scripts/wiiu-cores.sh b/dist-scripts/wiiu-cores.sh index c9306f3c71..74eb2afd5b 100755 --- a/dist-scripts/wiiu-cores.sh +++ b/dist-scripts/wiiu-cores.sh @@ -5,7 +5,7 @@ # and icons (https://github.com/libretro/retroarch-assets/tree/master/pkg/wiiu) to this directory then run # the script. the output will be in retroarch/pkg/wiiu -RARCH_VERSION=1.3.6 +source ../version.all platform=wiiu EXT=a @@ -51,7 +51,7 @@ gen_meta_xml() echo '' >> "$1"_meta.xml echo ' '$corename'' >> "$1"_meta.xml echo ' '$authors'' >> "$1"_meta.xml - echo ' '$RARCH_VERSION' r'$build_hash'' >> "$1"_meta.xml + echo ' '$PACKAGE_VERSION' r'$build_hash'' >> "$1"_meta.xml echo ' '$date'' >> "$1"_meta.xml echo ' RetroArch' >> "$1"_meta.xml echo -e ' '$display_name'\n\nSystem: '$systemname'\nLicense: '$license'' >> "$1"_meta.xml From 6cf6d46e4b0260c110db559b1d31b1076d0b5741 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 26 Sep 2017 03:51:50 +0200 Subject: [PATCH 010/253] Try silencing more warnings - do something with return value --- tasks/task_database.c | 54 ++++++++++++++++++++++++--------------- tasks/task_database_cue.c | 20 +++++++++++---- 2 files changed, 48 insertions(+), 26 deletions(-) diff --git a/tasks/task_database.c b/tasks/task_database.c index f485d33d38..0d0d66e726 100644 --- a/tasks/task_database.c +++ b/tasks/task_database.c @@ -277,17 +277,24 @@ static bool intfstream_file_get_serial(const char *name, size_t offset, size_t s if (!fd) return 0; - intfstream_seek(fd, 0, SEEK_END); + if (intfstream_seek(fd, 0, SEEK_END) == -1) + goto error; + file_size = intfstream_tell(fd); - intfstream_seek(fd, 0, SEEK_SET); + + if (intfstream_seek(fd, 0, SEEK_SET) == -1) + goto error; if (file_size < 0) goto error; if (offset != 0 || size < (size_t) file_size) { + if (intfstream_seek(fd, offset, SEEK_SET) == -1) + goto error; + data = (uint8_t*)malloc(size); - intfstream_seek(fd, offset, SEEK_SET); + if (intfstream_read(fd, data, size) != (ssize_t) size) { free(data); @@ -415,38 +422,33 @@ static bool intfstream_file_get_crc(const char *name, if (!fd) return 0; - intfstream_seek(fd, 0, SEEK_END); + if (intfstream_seek(fd, 0, SEEK_END) == -1) + goto error; + file_size = intfstream_tell(fd); - intfstream_seek(fd, 0, SEEK_SET); + + if (intfstream_seek(fd, 0, SEEK_SET) == -1) + goto error; if (file_size < 0) - { - intfstream_close(fd); - free(fd); - return 0; - } + goto error; if (offset != 0 || size < (size_t) file_size) { + if (intfstream_seek(fd, offset, SEEK_SET) == -1) + goto error; + data = (uint8_t*)malloc(size); - intfstream_seek(fd, offset, SEEK_SET); if (intfstream_read(fd, data, size) != (ssize_t) size) - { - intfstream_close(fd); - free(fd); - free(data); - return 0; - } + goto error; + intfstream_close(fd); free(fd); fd = open_memory(data, size); if (!fd) - { - free(data); - return 0; - } + goto error; } rv = intfstream_get_crc(fd, crc); @@ -454,6 +456,16 @@ static bool intfstream_file_get_crc(const char *name, free(fd); free(data); return rv; + +error: + if (fd) + { + intfstream_close(fd); + free(fd); + } + if (data) + free(data); + return 0; } static int task_database_cue_get_crc(const char *name, uint32_t *crc) diff --git a/tasks/task_database_cue.c b/tasks/task_database_cue.c index 83ad52b2ab..b972face4f 100644 --- a/tasks/task_database_cue.c +++ b/tasks/task_database_cue.c @@ -134,7 +134,9 @@ static int detect_ps1_game_sub(intfstream_t *fp, buffer[0] = '\0'; is_mode1 = 0; - intfstream_seek(fp, 0, SEEK_END); + + if (intfstream_seek(fp, 0, SEEK_END) == -1) + goto error; if (!sub_channel_mixed) { @@ -142,7 +144,9 @@ static int detect_ps1_game_sub(intfstream_t *fp, { unsigned int mode_test = 0; - intfstream_seek(fp, 0, SEEK_SET); + if (intfstream_seek(fp, 0, SEEK_SET) == -1) + goto error; + intfstream_read(fp, &mode_test, 4); if (mode_test != MODETEST_VAL) is_mode1 = 1; @@ -152,11 +156,15 @@ static int detect_ps1_game_sub(intfstream_t *fp, skip = is_mode1? 0: 24; frame_size = sub_channel_mixed? 2448: is_mode1? 2048: 2352; - intfstream_seek(fp, 156 + skip + 16 * frame_size, SEEK_SET); + if (intfstream_seek(fp, 156 + skip + 16 * frame_size, SEEK_SET) == -1) + goto error; + intfstream_read(fp, buffer, 6); cd_sector = buffer[2] | (buffer[3] << 8) | (buffer[4] << 16); - intfstream_seek(fp, skip + cd_sector * frame_size, SEEK_SET); + + if (intfstream_seek(fp, skip + cd_sector * frame_size, SEEK_SET) == -1) + goto error; intfstream_read(fp, buffer, 2048 * 2); tmp = buffer; @@ -175,7 +183,9 @@ static int detect_ps1_game_sub(intfstream_t *fp, goto error; cd_sector = tmp[2] | (tmp[3] << 8) | (tmp[4] << 16); - intfstream_seek(fp, skip + cd_sector * frame_size, SEEK_SET); + if (intfstream_seek(fp, skip + cd_sector * frame_size, SEEK_SET) == -1) + goto error; + intfstream_read(fp, buffer, 256); buffer[256] = '\0'; From 9c4192c9c7855494d3dea91f22e9ad4f6af58c00 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 26 Sep 2017 04:05:00 +0200 Subject: [PATCH 011/253] Bump up to version 1.6.8 --- version.all | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.all b/version.all index 7b71569142..2bea844e2c 100644 --- a/version.all +++ b/version.all @@ -6,8 +6,8 @@ # /* - pkg/snap/snapcraft.yaml (including the github url) */ #if 0 -RARCH_VERSION="1.6.7" +RARCH_VERSION="1.6.8" #endif #ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "1.6.7" +#define PACKAGE_VERSION "1.6.8" #endif From 33fad9ffa2f3e67fb39cce8f26c3a35b64cc835a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 26 Sep 2017 04:05:36 +0200 Subject: [PATCH 012/253] Revert "Bump up to version 1.6.8" This reverts commit 9c4192c9c7855494d3dea91f22e9ad4f6af58c00. --- version.all | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/version.all b/version.all index 2bea844e2c..7b71569142 100644 --- a/version.all +++ b/version.all @@ -6,8 +6,8 @@ # /* - pkg/snap/snapcraft.yaml (including the github url) */ #if 0 -RARCH_VERSION="1.6.8" +RARCH_VERSION="1.6.7" #endif #ifndef PACKAGE_VERSION -#define PACKAGE_VERSION "1.6.8" +#define PACKAGE_VERSION "1.6.7" #endif From 5b388a0e81d3a228a7c2da10655779d14b95eafb Mon Sep 17 00:00:00 2001 From: radius Date: Mon, 25 Sep 2017 23:22:30 -0500 Subject: [PATCH 013/253] show RetroPad buttons instead of keyboard keys when controls are not autoconfigured --- menu/menu_displaylist.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 62ad4ce903..ae0a8c022f 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -3532,6 +3532,14 @@ static int menu_displaylist_parse_options_remappings( input_config_get_bind_string(descriptor, keybind, auto_bind, sizeof(descriptor)); + if(!strstr(descriptor, "Auto")) + { + const struct retro_keybind *keyptr = + &input_config_binds[settings->uints.keymapper_port][retro_id]; + + strlcpy(descriptor, msg_hash_to_str(keyptr->enum_idx), sizeof(descriptor)); + } + menu_entries_append_enum(info->list, descriptor, "", MSG_UNKNOWN, MENU_SETTINGS_INPUT_DESC_KBD_BEGIN + retro_id, 0, 0); From a1e9027fe24ce7d51f1cab236e28f1747fd27441 Mon Sep 17 00:00:00 2001 From: Mikael Brunnhede Date: Tue, 26 Sep 2017 14:41:07 +0200 Subject: [PATCH 014/253] Added XMB menu option to show the Settings tab if it has previously been hidden. --- configuration.c | 1 + configuration.h | 1 + intl/msg_hash_chs.h | 16 ++++++++++++- intl/msg_hash_cht.h | 16 ++++++++++++- intl/msg_hash_de.h | 14 +++++++++++ intl/msg_hash_eo.h | 14 +++++++++++ intl/msg_hash_fr.h | 14 +++++++++++ intl/msg_hash_it.h | 14 +++++++++++ intl/msg_hash_ja.h | 16 ++++++++++++- intl/msg_hash_ko.h | 16 ++++++++++++- intl/msg_hash_lbl.h | 4 ++++ intl/msg_hash_nl.h | 14 +++++++++++ intl/msg_hash_pt_br.h | 23 +++++++++++++++++- intl/msg_hash_pt_pt.h | 14 +++++++++++ intl/msg_hash_ru.h | 16 ++++++++++++- intl/msg_hash_us.h | 14 +++++++++++ intl/msg_hash_vn.h | 16 ++++++++++++- menu/cbs/menu_cbs_ok.c | 46 ++++++++++++++++++++++++++++++++++++ menu/cbs/menu_cbs_sublabel.c | 8 +++++++ menu/drivers/xmb.c | 8 +++++++ menu/menu_displaylist.c | 7 ++++++ menu/menu_setting.c | 22 +++++++++++++++++ msg_hash.h | 5 ++++ 23 files changed, 312 insertions(+), 7 deletions(-) diff --git a/configuration.c b/configuration.c index 3f9a0a0abc..96f0153c0e 100644 --- a/configuration.c +++ b/configuration.c @@ -990,6 +990,7 @@ static struct config_path_setting *populate_settings_path(settings_t *settings, /* Paths */ #ifdef HAVE_XMB SETTING_PATH("xmb_font", settings->paths.path_menu_xmb_font, false, NULL, true); + SETTING_PATH("xmb_show_settings_password", settings->paths.menu_xmb_show_settings_password, false, NULL, true); #endif SETTING_PATH("netplay_nickname", settings->paths.username, false, NULL, true); SETTING_PATH("video_filter", settings->paths.path_softfilter_plugin, false, NULL, true); diff --git a/configuration.h b/configuration.h index d4a73dba15..77a0f5f078 100644 --- a/configuration.h +++ b/configuration.h @@ -379,6 +379,7 @@ typedef struct settings #ifdef HAVE_MENU char path_menu_xmb_font[PATH_MAX_LENGTH]; + char menu_xmb_show_settings_password[PATH_MAX_LENGTH]; #endif char path_cheat_database[PATH_MAX_LENGTH]; char path_content_database[PATH_MAX_LENGTH]; diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 7d78d479e4..6f7037f88c 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -1,4 +1,4 @@ -MSG_HASH( +MSG_HASH( MSG_COMPILER, "编译器" ) @@ -1676,6 +1676,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroActive") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "菜单颜色主题") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1714,6 +1716,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "显示音乐页") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "显示设置页") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "显示视频页") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_THEME, @@ -2035,6 +2039,12 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "Preset Filename") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rename Title") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") MSG_HASH(MSG_INTERFACE, "接口") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2845,6 +2855,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Modify the opacity of the background wallpaper.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2861,6 +2873,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "Show the netplay tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Show the settings tab inside the main menu.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Show the recent history tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index 41c0f34a4e..bee15e43d4 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -1,4 +1,4 @@ -MSG_HASH( +MSG_HASH( MSG_COMPILER, "編譯器" ) @@ -1676,6 +1676,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroActive") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "選單顏色主題") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1714,6 +1716,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "顯示音樂頁") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "顯示設定頁") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "顯示視訊頁") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_THEME, @@ -2035,6 +2039,12 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "目前檔案") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rename Title") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") MSG_HASH(MSG_INTERFACE, "接口") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2845,6 +2855,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Modify the opacity of the background wallpaper.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2861,6 +2873,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "Show the netplay tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Show the settings tab inside the main menu.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Show the recent history tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index 39e671f9c0..3894f1302c 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -1673,6 +1673,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroActive") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "Menü-Farbschema") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1711,6 +1713,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "Zeige Tab 'Musik'") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "Zeige Tab 'Einstellungen'") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "Zeige Tab 'Video'") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_NETPLAY, @@ -2035,6 +2039,12 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "Vorlagen-Dateiname") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rename Title") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") MSG_HASH(MSG_INTERFACE, "Netzwerk-Karte") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2841,6 +2851,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Wähle einen anderen Farbverlauf für das Hintergrundbild.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Ändere die Transparenz des Hintergrundbildes.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Wähle einen anderen Farbverlauf für das Hintergrundbild.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2857,6 +2869,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "Zeigen den Tab 'Netplay' im Hauptmenü an.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Zeige den Tab 'Einstellungen' im Hauptmenü an") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Zeige den Tab 'Verlauf' im Hauptmenü an.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index f3fddd60a1..1d24d3598c 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -1572,6 +1572,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroActive") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "Menu Color Theme") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1608,6 +1610,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "Display Music Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "Display Settings Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "Display Video Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_THEME, @@ -1924,6 +1928,12 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "Preset Filename") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rename Title") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") MSG_HASH(MSG_INTERFACE, "Interface") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2706,6 +2716,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Modify the opacity of the background wallpaper.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2724,6 +2736,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "Show the netplay tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Show the settings tab inside the main menu.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Show the recent history tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index e93f65c2f4..4005d86d89 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -1697,6 +1697,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroActive") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "Palette du menu") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1733,6 +1735,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "Afficher l'onglet Musique") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "Afficher l'onglet Paramètres") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "Afficher l'onglet Vidéo") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_THEME, @@ -2055,6 +2059,12 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "Nom du fichier de pré-réglage") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rename Title") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") MSG_HASH(MSG_INTERFACE, "Interface") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2877,6 +2887,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Modify the opacity of the background wallpaper.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2893,6 +2905,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "Affiche l'onglet de jeu en réseau dans le menu principal.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Affiche l'onglet ces réglages dans le menu principal.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Affiche l'onglet de l'historique dans le menu principal.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index 5cb4f50653..11b432385e 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -1723,6 +1723,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroAttivo") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "Colore del menu") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1763,6 +1765,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "Visualizza colonna Musica") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "Visualizza colonna Impostazioni") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "Visualizza colonna Video") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_NETPLAY, @@ -2093,6 +2097,12 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "Nome del file predefinito") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rinomina Titolo") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") MSG_HASH(MSG_INTERFACE, "Interfaccia") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2923,6 +2933,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Seleziona uno sfondo differente con colore sfumato nel tema.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Modifica l'opacità dello sfondo") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Seleziona un colore di sfondo differente nel tema.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2941,6 +2953,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "Mostra la colonna camere netplay all'interno del menu principale") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Mostra la colonna impostazioni all'interno del menu principale") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Mostra la colonna cronologia all'interno del menu principale.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index 3b7053e440..8a94a68f07 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -1,4 +1,4 @@ -#if defined(_MSC_VER) && !defined(_XBOX) +#if defined(_MSC_VER) && !defined(_XBOX) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") #endif @@ -1719,6 +1719,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "レトロアクティブ") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "ドット絵") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "メニューの色テーマ") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1757,6 +1759,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "音楽タブを表示") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "設定タブを表示") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "ビデオタブを表示") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_NETPLAY, @@ -2081,6 +2085,12 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "Preset Filename") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rename Title") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") MSG_HASH(MSG_INTERFACE, "インタフェース") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2865,6 +2875,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Modify the opacity of the background wallpaper.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2881,6 +2893,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "メニューにネットプレイタブを表示する。") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "メニューに設定タブを表示する。") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "メニューに履歴タブを表示する。") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index a9cc790329..eef786555a 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -1,4 +1,4 @@ -MSG_HASH( +MSG_HASH( MSG_COMPILER, "컴파일러" ) @@ -1673,6 +1673,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroActive") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "메뉴 색상 테마") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1711,6 +1713,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "음악 탭 표시") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "설정 탭 보이기") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "비디오 탭 보이기") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_NETPLAY, @@ -2035,6 +2039,12 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "프리셋 파일명") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rename Title") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") MSG_HASH(MSG_INTERFACE, "인터페이스") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2841,6 +2851,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "배경색 그라데이션 테마를 선택.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "배경화면의 투명도 변경.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "배경색 그라데이션 테마 선택.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2857,6 +2869,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "메인 메뉴에 넷플레이 탭 보이기.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "메인 메뉴에 설정 탭 보이기.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "메인 메뉴에 최근 실행목록 탭 보이기.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, diff --git a/intl/msg_hash_lbl.h b/intl/msg_hash_lbl.h index 7069e2d7f3..1c267fbb34 100644 --- a/intl/msg_hash_lbl.h +++ b/intl/msg_hash_lbl.h @@ -1151,6 +1151,8 @@ MSG_HASH(MENU_ENUM_LABEL_XMB_ALPHA_FACTOR, "xmb_alpha_factor") MSG_HASH(MENU_ENUM_LABEL_XMB_FONT, "xmb_font") +MSG_HASH(MENU_ENUM_LABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "xmb_main_menu_enable_settings") MSG_HASH(MENU_ENUM_LABEL_XMB_MENU_COLOR_THEME, "xmb_menu_color_theme") MSG_HASH(MENU_ENUM_LABEL_XMB_RIBBON_ENABLE, @@ -1171,6 +1173,8 @@ MSG_HASH(MENU_ENUM_LABEL_XMB_SHOW_MUSIC, "xmb_show_music") MSG_HASH(MENU_ENUM_LABEL_XMB_SHOW_SETTINGS, "xmb_show_settings") +MSG_HASH(MENU_ENUM_LABEL_XMB_SHOW_SETTINGS_PASSWORD, + "xmb_show_settings_password") MSG_HASH(MENU_ENUM_LABEL_XMB_SHOW_VIDEO, "xmb_show_video") MSG_HASH(MENU_ENUM_LABEL_XMB_SHOW_NETPLAY, diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index 939ac2016b..eda589b5e8 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -1570,6 +1570,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroActive") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "Menu Color Theme") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1606,6 +1608,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "Muziektab weergeven") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "Instellingentab weergeven") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "Videotab weergeven") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_THEME, @@ -1922,6 +1926,12 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "Preset Filename") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rename Title") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") MSG_HASH(MSG_INTERFACE, "Interface") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2708,6 +2718,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Modify the opacity of the background wallpaper.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2724,6 +2736,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "Show the netplay tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Show the settings tab inside the main menu.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Show the recent history tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index 0ce923777d..fa39dc6d8a 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -2215,6 +2215,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab" + ) MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "Tema de Cor do Menu" ) @@ -2275,6 +2278,9 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "Exibir Aba de Configurações" ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab" + ) MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "Exibir Aba de Vídeo" ) @@ -2770,6 +2776,15 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Renomear Título" ) +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password" + ) +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct." + ) +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect." + ) MSG_HASH(MSG_INTERFACE, "Interface" ) @@ -3694,6 +3709,9 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Modificar a opacidade do plano de fundo." ) +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear." + ) MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Selecionar um tema de gradiente de cor de plano de fundo diferente." ) @@ -3721,6 +3739,9 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Mostrar a aba de configurações dentro do menu principal." ) +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password." + ) MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Mostrar a aba de histórico recente dentro do menu principal." ) @@ -3960,4 +3981,4 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE, ) MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, "Habilitar/desabilitar os ícones exibidos do lado esquerdo dos itens de menu. " - ) \ No newline at end of file + ) diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index c5cd817d1c..fd41372558 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -1665,6 +1665,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroActive") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "Cor do tema do Menu") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1703,6 +1705,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "Exibir Aba de Música") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "Exibir Aba de Definições") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "Exibir Aba de Vídeo") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_THEME, @@ -2025,6 +2029,12 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "Nome de Arquivo Pré-Definido") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rename Title") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") MSG_HASH(MSG_INTERFACE, "Interface") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2819,6 +2829,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Selecionar um tema degradê de cor de fundo diferente.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Modificar a opacidade do papel de parede.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Selecionar um tema degradê de cor de fundo diferente.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2833,6 +2845,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_VIDEO, "Mostrar a aba de vídeo dentro do menu principal.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Mostrar a aba de definições dentro do menu principal.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Mostrar a aba de histórico recente dentro do menu principal.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index 5ef0f49fba..817ce24679 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -1,4 +1,4 @@ -#if defined(_MSC_VER) && !defined(_XBOX) +#if defined(_MSC_VER) && !defined(_XBOX) /* https://support.microsoft.com/en-us/kb/980263 */ #pragma execution_character_set("utf-8") #endif @@ -1706,6 +1706,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroActive") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "Цветная тема меню") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1744,6 +1746,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "Показать вкладку Музыка") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "Показать вкладку Настройки") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "Показать вкладку Видео") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_NETPLAY, @@ -2070,6 +2074,12 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "Имя настроек") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Переименовать заголовок") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") MSG_HASH(MSG_INTERFACE, "Интерфейс") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2892,6 +2902,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Выберите другую тему цветового градиента.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Изменить прозрачность обоев интерфейса.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Выберите другую тему цветового градиента.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2908,6 +2920,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "Показать вкладку Сетевая игра в главном меню.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Показать вкладку Настройка в главном меню.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Показать вкладку История просмотров в главном меню.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index 13b5e8505c..d6d4d9a034 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -1725,6 +1725,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroActive") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "Menu Color Theme") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1765,6 +1767,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "Show Music Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "Show Settings Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "Show Video Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_NETPLAY, @@ -2095,6 +2099,12 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "Preset Filename") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rename Title") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") MSG_HASH(MSG_INTERFACE, "Interface") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2925,6 +2935,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Modify the opacity of the background wallpaper.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2943,6 +2955,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "Show the netplay tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Show the settings tab inside the main menu.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Show the recent history tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index a5582641b6..e8bdcb1c9e 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -1,4 +1,4 @@ -MSG_HASH( +MSG_HASH( MSG_COMPILER, "Compiler" ) @@ -1691,6 +1691,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroActive") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "Menu Color Theme") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1729,6 +1731,8 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "Display Music Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "Show thiết lập Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "Display Video Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_NETPLAY, @@ -2053,6 +2057,12 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "Preset Filename") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rename Title") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") MSG_HASH(MSG_INTERFACE, "Interface") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2875,6 +2885,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Modify the opacity of the background wallpaper.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2891,6 +2903,8 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "Show the netplay tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Show the settings tab inside the main menu.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Show the recent history tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 9b2c920698..8247a54779 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1938,6 +1938,33 @@ static void menu_input_st_string_cb_rename_entry(void *userdata, menu_input_dialog_end(); } +static void menu_input_st_string_cb_enable_settings(void *userdata, + const char *str) +{ + if (str && *str) + { + const char *label = menu_input_dialog_get_buffer(); + settings_t *settings = config_get_ptr(); + + if (string_is_equal(label, settings->paths.menu_xmb_show_settings_password)) + { + settings->bools.menu_xmb_show_settings = true; + + runloop_msg_queue_push( + msg_hash_to_str(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK), + 1, 100, true); + } + else + { + runloop_msg_queue_push( + msg_hash_to_str(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK), + 1, 100, true); + } + } + + menu_input_dialog_end(); +} + static void menu_input_st_string_cb_save_preset(void *userdata, const char *str) { @@ -3199,6 +3226,22 @@ static int action_ok_delete_entry(const char *path, return 0; } +static int action_ok_enable_settings(const char *path, + const char *label, unsigned type, size_t idx, size_t entry_idx) +{ + menu_input_ctx_line_t line; + + line.label = msg_hash_to_str(MSG_INPUT_ENABLE_SETTINGS_PASSWORD); + line.label_setting = label; + line.type = type; + line.idx = (unsigned)entry_idx; + line.cb = menu_input_st_string_cb_enable_settings; + + if (!menu_input_dialog_start(&line)) + return -1; + return 0; +} + static int action_ok_rdb_entry_submenu(const char *path, const char *label, unsigned type, size_t idx, size_t entry_idx) { @@ -4308,6 +4351,9 @@ static int menu_cbs_init_bind_ok_compare_label(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_DELETE_ENTRY: BIND_ACTION_OK(cbs, action_ok_delete_entry); break; + case MENU_ENUM_LABEL_XMB_MAIN_MENU_ENABLE_SETTINGS: + BIND_ACTION_OK(cbs, action_ok_enable_settings); + break; case MENU_ENUM_LABEL_QUIT_RETROARCH: BIND_ACTION_OK(cbs, action_ok_quit); break; diff --git a/menu/cbs/menu_cbs_sublabel.c b/menu/cbs/menu_cbs_sublabel.c index 9a9682e71d..f659b9ae5d 100644 --- a/menu/cbs/menu_cbs_sublabel.c +++ b/menu/cbs/menu_cbs_sublabel.c @@ -296,8 +296,10 @@ default_sublabel_macro(action_bind_sublabel_menu_music_tab, default_sublabel_macro(action_bind_sublabel_menu_video_tab, MENU_ENUM_SUBLABEL_XMB_SHOW_VIDEO) default_sublabel_macro(action_bind_sublabel_menu_netplay_tab, MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY) default_sublabel_macro(action_bind_sublabel_menu_settings_tab, MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS) +default_sublabel_macro(action_bind_sublabel_menu_settings_tab_enable_password, MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD) default_sublabel_macro(action_bind_sublabel_menu_history_tab, MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY) default_sublabel_macro(action_bind_sublabel_menu_import_content_tab, MENU_ENUM_SUBLABEL_XMB_SHOW_ADD) +default_sublabel_macro(action_bind_sublabel_main_menu_enable_settings, MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS) default_sublabel_macro(action_bind_sublabel_rgui_show_start_screen, MENU_ENUM_SUBLABEL_RGUI_SHOW_START_SCREEN) default_sublabel_macro(action_bind_sublabel_menu_header_opacity, MENU_ENUM_SUBLABEL_MATERIALUI_MENU_HEADER_OPACITY) default_sublabel_macro(action_bind_sublabel_menu_footer_opacity, MENU_ENUM_SUBLABEL_MATERIALUI_MENU_FOOTER_OPACITY) @@ -558,12 +560,18 @@ int menu_cbs_init_bind_sublabel(menu_file_list_cbs_t *cbs, case MENU_ENUM_LABEL_XMB_SHOW_ADD: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_import_content_tab); break; + case MENU_ENUM_LABEL_XMB_MAIN_MENU_ENABLE_SETTINGS: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_main_menu_enable_settings); + break; case MENU_ENUM_LABEL_XMB_SHOW_HISTORY: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_history_tab); break; case MENU_ENUM_LABEL_XMB_SHOW_SETTINGS: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_settings_tab); break; + case MENU_ENUM_LABEL_XMB_SHOW_SETTINGS_PASSWORD: + BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_menu_settings_tab_enable_password); + break; case MENU_ENUM_LABEL_GOTO_IMAGES: BIND_ACTION_SUBLABEL(cbs, action_bind_sublabel_goto_images); break; diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index f97609ddf5..1aa3378f43 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -4331,6 +4331,14 @@ static int xmb_list_push(void *data, void *userdata, } } #endif + + settings_t *settings = config_get_ptr(); + if (!settings->bools.menu_xmb_show_settings && !string_is_empty(settings->paths.menu_xmb_show_settings_password)) + { + entry.enum_idx = MENU_ENUM_LABEL_XMB_MAIN_MENU_ENABLE_SETTINGS; + menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); + } + entry.enum_idx = MENU_ENUM_LABEL_INFORMATION_LIST; menu_displaylist_ctl(DISPLAYLIST_SETTING_ENUM, &entry); #ifndef HAVE_DYNAMIC diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 89298adca0..598836bde1 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -5272,6 +5272,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) MENU_ENUM_LABEL_XMB_SHOW_SETTINGS, PARSE_ONLY_BOOL, false); + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_XMB_SHOW_SETTINGS_PASSWORD, + PARSE_ONLY_STRING, false); + menu_displaylist_parse_settings_enum(menu, info, MENU_ENUM_LABEL_XMB_SHOW_FAVORITES, PARSE_ONLY_BOOL, false); @@ -6356,6 +6360,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) MENU_ENUM_LABEL_START_CORE, PARSE_ACTION, false); } + menu_displaylist_parse_settings_enum(menu, info, + MENU_ENUM_LABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + PARSE_ACTION, false); #ifndef HAVE_DYNAMIC if (frontend_driver_has_fork()) diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 727f92e04c..552618fe70 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -2280,6 +2280,14 @@ static bool setting_append_list( &subgroup_info, parent_group); + CONFIG_ACTION( + list, list_info, + MENU_ENUM_LABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + &group_info, + &subgroup_info, + parent_group); + #ifndef HAVE_DYNAMIC if (frontend_driver_has_fork()) #endif @@ -5388,6 +5396,20 @@ static bool setting_append_list( SD_FLAG_NONE); settings_data_list_current_add_flags(list, list_info, SD_FLAG_LAKKA_ADVANCED); + CONFIG_STRING( + list, list_info, + settings->paths.menu_xmb_show_settings_password, + sizeof(settings->paths.menu_xmb_show_settings_password), + MENU_ENUM_LABEL_XMB_SHOW_SETTINGS_PASSWORD, + MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "", + &group_info, + &subgroup_info, + parent_group, + general_write_handler, + general_read_handler); + settings_data_list_current_add_flags(list, list_info, SD_FLAG_ALLOW_INPUT | SD_FLAG_LAKKA_ADVANCED); + CONFIG_BOOL( list, list_info, &settings->bools.menu_xmb_show_favorites, diff --git a/msg_hash.h b/msg_hash.h index a10d840577..9482dbd021 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -288,6 +288,9 @@ enum msg_hash_enums MSG_INPUT_PRESET_FILENAME, MSG_INPUT_CHEAT_FILENAME, MSG_INPUT_RENAME_ENTRY, + MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, MSG_REMAP_FILE_SAVED_SUCCESSFULLY, MSG_REMAP_FILE_REMOVED_SUCCESSFULLY, MSG_SHADER_PRESET_SAVED_SUCCESSFULLY, @@ -687,9 +690,11 @@ enum msg_hash_enums MENU_LABEL(XMB_SCALE_FACTOR), MENU_LABEL(XMB_FONT), MENU_LABEL(XMB_THEME), + MENU_LABEL(XMB_MAIN_MENU_ENABLE_SETTINGS), MENU_LABEL(XMB_MENU_COLOR_THEME), MENU_LABEL(XMB_SHADOWS_ENABLE), MENU_LABEL(XMB_SHOW_SETTINGS), + MENU_LABEL(XMB_SHOW_SETTINGS_PASSWORD), MENU_LABEL(XMB_SHOW_FAVORITES), MENU_LABEL(XMB_SHOW_IMAGES), MENU_LABEL(XMB_SHOW_MUSIC), From 208854e3d9c1986a3fc292ec76fb292eed205ba4 Mon Sep 17 00:00:00 2001 From: Mikael Brunnhede Date: Tue, 26 Sep 2017 15:46:56 +0200 Subject: [PATCH 015/253] Put new strings at the end. --- intl/msg_hash_chs.h | 28 ++++++++++++++-------------- intl/msg_hash_cht.h | 28 ++++++++++++++-------------- intl/msg_hash_de.h | 28 ++++++++++++++-------------- intl/msg_hash_eo.h | 28 ++++++++++++++-------------- intl/msg_hash_fr.h | 28 ++++++++++++++-------------- intl/msg_hash_it.h | 28 ++++++++++++++-------------- intl/msg_hash_ja.h | 28 ++++++++++++++-------------- intl/msg_hash_ko.h | 28 ++++++++++++++-------------- intl/msg_hash_nl.h | 28 ++++++++++++++-------------- intl/msg_hash_pt_br.h | 42 +++++++++++++++++++++--------------------- intl/msg_hash_pt_pt.h | 28 ++++++++++++++-------------- intl/msg_hash_ru.h | 28 ++++++++++++++-------------- intl/msg_hash_us.h | 28 ++++++++++++++-------------- intl/msg_hash_vn.h | 28 ++++++++++++++-------------- 14 files changed, 203 insertions(+), 203 deletions(-) diff --git a/intl/msg_hash_chs.h b/intl/msg_hash_chs.h index 6f7037f88c..2cc5e83d20 100644 --- a/intl/msg_hash_chs.h +++ b/intl/msg_hash_chs.h @@ -1676,8 +1676,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroActive") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "菜单颜色主题") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1716,8 +1714,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "显示音乐页") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "显示设置页") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, - "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "显示视频页") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_THEME, @@ -2039,12 +2035,6 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "Preset Filename") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rename Title") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, - "Enter Password") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, - "Password correct.") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, - "Password incorrect.") MSG_HASH(MSG_INTERFACE, "接口") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2855,8 +2845,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Modify the opacity of the background wallpaper.") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2873,8 +2861,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "Show the netplay tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Show the settings tab inside the main menu.") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, - "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Show the recent history tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, @@ -3059,3 +3045,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE, "Menu Icons") MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, "Enable/disable the menu icons shown at the lefthand side of the menu entries.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") diff --git a/intl/msg_hash_cht.h b/intl/msg_hash_cht.h index bee15e43d4..a1bc897be9 100644 --- a/intl/msg_hash_cht.h +++ b/intl/msg_hash_cht.h @@ -1676,8 +1676,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroActive") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "選單顏色主題") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1716,8 +1714,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "顯示音樂頁") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "顯示設定頁") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, - "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "顯示視訊頁") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_THEME, @@ -2039,12 +2035,6 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "目前檔案") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rename Title") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, - "Enter Password") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, - "Password correct.") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, - "Password incorrect.") MSG_HASH(MSG_INTERFACE, "接口") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2855,8 +2845,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Modify the opacity of the background wallpaper.") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2873,8 +2861,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "Show the netplay tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Show the settings tab inside the main menu.") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, - "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Show the recent history tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, @@ -3059,3 +3045,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE, "Menu Icons") MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, "Enable/disable the menu icons shown at the lefthand side of the menu entries.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") diff --git a/intl/msg_hash_de.h b/intl/msg_hash_de.h index 3894f1302c..c8e297d1fe 100644 --- a/intl/msg_hash_de.h +++ b/intl/msg_hash_de.h @@ -1673,8 +1673,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroActive") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "Menü-Farbschema") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1713,8 +1711,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "Zeige Tab 'Musik'") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "Zeige Tab 'Einstellungen'") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, - "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "Zeige Tab 'Video'") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_NETPLAY, @@ -2039,12 +2035,6 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "Vorlagen-Dateiname") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rename Title") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, - "Enter Password") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, - "Password correct.") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, - "Password incorrect.") MSG_HASH(MSG_INTERFACE, "Netzwerk-Karte") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2851,8 +2841,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Wähle einen anderen Farbverlauf für das Hintergrundbild.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Ändere die Transparenz des Hintergrundbildes.") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Wähle einen anderen Farbverlauf für das Hintergrundbild.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2869,8 +2857,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "Zeigen den Tab 'Netplay' im Hauptmenü an.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Zeige den Tab 'Einstellungen' im Hauptmenü an") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, - "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Zeige den Tab 'Verlauf' im Hauptmenü an.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, @@ -3053,3 +3039,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE, "Menu Icons") MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, "Enable/disable the menu icons shown at the lefthand side of the menu entries.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") diff --git a/intl/msg_hash_eo.h b/intl/msg_hash_eo.h index 1d24d3598c..1fbfbeb151 100644 --- a/intl/msg_hash_eo.h +++ b/intl/msg_hash_eo.h @@ -1572,8 +1572,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroActive") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "Menu Color Theme") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1610,8 +1608,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "Display Music Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "Display Settings Tab") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, - "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "Display Video Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_THEME, @@ -1928,12 +1924,6 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "Preset Filename") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rename Title") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, - "Enter Password") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, - "Password correct.") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, - "Password incorrect.") MSG_HASH(MSG_INTERFACE, "Interface") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2716,8 +2706,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Modify the opacity of the background wallpaper.") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2736,8 +2724,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "Show the netplay tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Show the settings tab inside the main menu.") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, - "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Show the recent history tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, @@ -2922,3 +2908,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE, "Menu Icons") MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, "Enable/disable the menu icons shown at the lefthand side of the menu entries.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") diff --git a/intl/msg_hash_fr.h b/intl/msg_hash_fr.h index 4005d86d89..c2215e8bd9 100644 --- a/intl/msg_hash_fr.h +++ b/intl/msg_hash_fr.h @@ -1697,8 +1697,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroActive") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "Palette du menu") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1735,8 +1733,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "Afficher l'onglet Musique") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "Afficher l'onglet Paramètres") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, - "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "Afficher l'onglet Vidéo") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_THEME, @@ -2059,12 +2055,6 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "Nom du fichier de pré-réglage") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rename Title") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, - "Enter Password") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, - "Password correct.") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, - "Password incorrect.") MSG_HASH(MSG_INTERFACE, "Interface") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2887,8 +2877,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Modify the opacity of the background wallpaper.") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2905,8 +2893,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "Affiche l'onglet de jeu en réseau dans le menu principal.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Affiche l'onglet ces réglages dans le menu principal.") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, - "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Affiche l'onglet de l'historique dans le menu principal.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, @@ -3091,3 +3077,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE, "Menu Icons") MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, "Enable/disable the menu icons shown at the lefthand side of the menu entries.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") diff --git a/intl/msg_hash_it.h b/intl/msg_hash_it.h index 11b432385e..5440d64028 100644 --- a/intl/msg_hash_it.h +++ b/intl/msg_hash_it.h @@ -1723,8 +1723,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroAttivo") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "Colore del menu") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1765,8 +1763,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "Visualizza colonna Musica") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "Visualizza colonna Impostazioni") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, - "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "Visualizza colonna Video") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_NETPLAY, @@ -2097,12 +2093,6 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "Nome del file predefinito") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rinomina Titolo") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, - "Enter Password") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, - "Password correct.") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, - "Password incorrect.") MSG_HASH(MSG_INTERFACE, "Interfaccia") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2933,8 +2923,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Seleziona uno sfondo differente con colore sfumato nel tema.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Modifica l'opacità dello sfondo") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Seleziona un colore di sfondo differente nel tema.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2953,8 +2941,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "Mostra la colonna camere netplay all'interno del menu principale") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Mostra la colonna impostazioni all'interno del menu principale") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, - "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Mostra la colonna cronologia all'interno del menu principale.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, @@ -3145,3 +3131,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE, "Icone del Menu") MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, "Abilita/disabilita le icone del menu visualizzate sul lato sinistro di ogni voce.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") diff --git a/intl/msg_hash_ja.h b/intl/msg_hash_ja.h index 8a94a68f07..b8b2cf8e4c 100644 --- a/intl/msg_hash_ja.h +++ b/intl/msg_hash_ja.h @@ -1719,8 +1719,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "レトロアクティブ") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "ドット絵") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "メニューの色テーマ") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1759,8 +1757,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "音楽タブを表示") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "設定タブを表示") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, - "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "ビデオタブを表示") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_NETPLAY, @@ -2085,12 +2081,6 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "Preset Filename") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rename Title") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, - "Enter Password") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, - "Password correct.") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, - "Password incorrect.") MSG_HASH(MSG_INTERFACE, "インタフェース") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2875,8 +2865,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Modify the opacity of the background wallpaper.") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2893,8 +2881,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "メニューにネットプレイタブを表示する。") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "メニューに設定タブを表示する。") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, - "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "メニューに履歴タブを表示する。") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, @@ -3045,3 +3031,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE, "Menu Icons") MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, "Enable/disable the menu icons shown at the lefthand side of the menu entries.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") diff --git a/intl/msg_hash_ko.h b/intl/msg_hash_ko.h index eef786555a..3ff5018be1 100644 --- a/intl/msg_hash_ko.h +++ b/intl/msg_hash_ko.h @@ -1673,8 +1673,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroActive") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "메뉴 색상 테마") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1713,8 +1711,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "음악 탭 표시") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "설정 탭 보이기") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, - "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "비디오 탭 보이기") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_NETPLAY, @@ -2039,12 +2035,6 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "프리셋 파일명") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rename Title") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, - "Enter Password") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, - "Password correct.") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, - "Password incorrect.") MSG_HASH(MSG_INTERFACE, "인터페이스") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2851,8 +2841,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "배경색 그라데이션 테마를 선택.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "배경화면의 투명도 변경.") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "배경색 그라데이션 테마 선택.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2869,8 +2857,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "메인 메뉴에 넷플레이 탭 보이기.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "메인 메뉴에 설정 탭 보이기.") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, - "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "메인 메뉴에 최근 실행목록 탭 보이기.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, @@ -3054,3 +3040,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE, "Menu Icons") MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, "Enable/disable the menu icons shown at the lefthand side of the menu entries.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") diff --git a/intl/msg_hash_nl.h b/intl/msg_hash_nl.h index eda589b5e8..b434f8ccd0 100644 --- a/intl/msg_hash_nl.h +++ b/intl/msg_hash_nl.h @@ -1570,8 +1570,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroActive") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "Menu Color Theme") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1608,8 +1606,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "Muziektab weergeven") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "Instellingentab weergeven") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, - "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "Videotab weergeven") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_THEME, @@ -1926,12 +1922,6 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "Preset Filename") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rename Title") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, - "Enter Password") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, - "Password correct.") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, - "Password incorrect.") MSG_HASH(MSG_INTERFACE, "Interface") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2718,8 +2708,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Modify the opacity of the background wallpaper.") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2736,8 +2724,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "Show the netplay tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Show the settings tab inside the main menu.") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, - "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Show the recent history tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, @@ -2922,3 +2908,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE, "Menu Icons") MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, "Enable/disable the menu icons shown at the lefthand side of the menu entries.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") diff --git a/intl/msg_hash_pt_br.h b/intl/msg_hash_pt_br.h index fa39dc6d8a..ea07b1db12 100644 --- a/intl/msg_hash_pt_br.h +++ b/intl/msg_hash_pt_br.h @@ -2215,9 +2215,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art" ) -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enable Settings Tab" - ) MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "Tema de Cor do Menu" ) @@ -2278,9 +2275,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "Exibir Aba de Configurações" ) -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, - "Set Password For Enabling Settings Tab" - ) MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "Exibir Aba de Vídeo" ) @@ -2776,15 +2770,6 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Renomear Título" ) -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, - "Enter Password" - ) -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, - "Password correct." - ) -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, - "Password incorrect." - ) MSG_HASH(MSG_INTERFACE, "Interface" ) @@ -3709,9 +3694,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Modificar a opacidade do plano de fundo." ) -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enables the Settings tab. A restart is required for the tab to appear." - ) MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Selecionar um tema de gradiente de cor de plano de fundo diferente." ) @@ -3739,9 +3721,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Mostrar a aba de configurações dentro do menu principal." ) -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, - "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password." - ) MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Mostrar a aba de histórico recente dentro do menu principal." ) @@ -3982,3 +3961,24 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE, MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, "Habilitar/desabilitar os ícones exibidos do lado esquerdo dos itens de menu. " ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab" + ) +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab" + ) +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password" + ) +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct." + ) +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect." + ) +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear." + ) +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password." + ) diff --git a/intl/msg_hash_pt_pt.h b/intl/msg_hash_pt_pt.h index fd41372558..ac543b90df 100644 --- a/intl/msg_hash_pt_pt.h +++ b/intl/msg_hash_pt_pt.h @@ -1665,8 +1665,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroActive") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "Cor do tema do Menu") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1705,8 +1703,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "Exibir Aba de Música") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "Exibir Aba de Definições") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, - "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "Exibir Aba de Vídeo") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_THEME, @@ -2029,12 +2025,6 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "Nome de Arquivo Pré-Definido") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rename Title") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, - "Enter Password") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, - "Password correct.") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, - "Password incorrect.") MSG_HASH(MSG_INTERFACE, "Interface") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2829,8 +2819,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Selecionar um tema degradê de cor de fundo diferente.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Modificar a opacidade do papel de parede.") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Selecionar um tema degradê de cor de fundo diferente.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2845,8 +2833,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_VIDEO, "Mostrar a aba de vídeo dentro do menu principal.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Mostrar a aba de definições dentro do menu principal.") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, - "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Mostrar a aba de histórico recente dentro do menu principal.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, @@ -3029,3 +3015,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE, "Menu Icons") MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, "Enable/disable the menu icons shown at the lefthand side of the menu entries.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") diff --git a/intl/msg_hash_ru.h b/intl/msg_hash_ru.h index 817ce24679..8e43483a36 100644 --- a/intl/msg_hash_ru.h +++ b/intl/msg_hash_ru.h @@ -1706,8 +1706,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroActive") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "Цветная тема меню") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1746,8 +1744,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "Показать вкладку Музыка") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "Показать вкладку Настройки") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, - "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "Показать вкладку Видео") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_NETPLAY, @@ -2074,12 +2070,6 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "Имя настроек") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Переименовать заголовок") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, - "Enter Password") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, - "Password correct.") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, - "Password incorrect.") MSG_HASH(MSG_INTERFACE, "Интерфейс") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2902,8 +2892,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Выберите другую тему цветового градиента.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Изменить прозрачность обоев интерфейса.") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Выберите другую тему цветового градиента.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2920,8 +2908,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "Показать вкладку Сетевая игра в главном меню.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Показать вкладку Настройка в главном меню.") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, - "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Показать вкладку История просмотров в главном меню.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, @@ -3112,3 +3098,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE, "Иконки интерфейса") MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, "Отображать или скрывать иконки интерфейса, отображающиеся в левой части меню.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") diff --git a/intl/msg_hash_us.h b/intl/msg_hash_us.h index d6d4d9a034..b12b1f2126 100644 --- a/intl/msg_hash_us.h +++ b/intl/msg_hash_us.h @@ -1725,8 +1725,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroActive") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "Menu Color Theme") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1767,8 +1765,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "Show Music Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "Show Settings Tab") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, - "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "Show Video Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_NETPLAY, @@ -2099,12 +2095,6 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "Preset Filename") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rename Title") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, - "Enter Password") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, - "Password correct.") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, - "Password incorrect.") MSG_HASH(MSG_INTERFACE, "Interface") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2935,8 +2925,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Modify the opacity of the background wallpaper.") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2955,8 +2943,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "Show the netplay tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Show the settings tab inside the main menu.") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, - "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Show the recent history tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, @@ -3147,3 +3133,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE, "Menu Icons") MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, "Enable/disable the menu icons shown at the lefthand side of the menu entries.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") diff --git a/intl/msg_hash_vn.h b/intl/msg_hash_vn.h index e8bdcb1c9e..0754579517 100644 --- a/intl/msg_hash_vn.h +++ b/intl/msg_hash_vn.h @@ -1691,8 +1691,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_RETROACTIVE, "RetroActive") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_ICON_THEME_DOTART, "Dot-Art") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enable Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME, "Menu Color Theme") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MENU_COLOR_THEME_APPLE_GREEN, @@ -1731,8 +1729,6 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_MUSIC, "Display Music Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS, "Show thiết lập Tab") -MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, - "Set Password For Enabling Settings Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_VIDEO, "Display Video Tab") MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_NETPLAY, @@ -2057,12 +2053,6 @@ MSG_HASH(MSG_INPUT_PRESET_FILENAME, "Preset Filename") MSG_HASH(MSG_INPUT_RENAME_ENTRY, "Rename Title") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, - "Enter Password") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, - "Password correct.") -MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, - "Password incorrect.") MSG_HASH(MSG_INTERFACE, "Interface") MSG_HASH(MSG_INTERNAL_STORAGE, @@ -2885,8 +2875,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_MENU_WALLPAPER_OPACITY, "Modify the opacity of the background wallpaper.") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, - "Enables the Settings tab. A restart is required for the tab to appear.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MENU_COLOR_THEME, "Select a different background color gradient theme.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_RIBBON_ENABLE, @@ -2903,8 +2891,6 @@ MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_NETPLAY, "Show the netplay tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS, "Show the settings tab inside the main menu.") -MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, - "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_HISTORY, "Show the recent history tab inside the main menu.") MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_ADD, @@ -3083,3 +3069,17 @@ MSG_HASH(MENU_ENUM_LABEL_VALUE_MATERIALUI_ICONS_ENABLE, "Menu Icons") MSG_HASH(MENU_ENUM_SUBLABEL_MATERIALUI_ICONS_ENABLE, "Enable/disable the menu icons shown at the lefthand side of the menu entries.") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enable Settings Tab") +MSG_HASH(MENU_ENUM_LABEL_VALUE_XMB_SHOW_SETTINGS_PASSWORD, + "Set Password For Enabling Settings Tab") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD, + "Enter Password") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_OK, + "Password correct.") +MSG_HASH(MSG_INPUT_ENABLE_SETTINGS_PASSWORD_NOK, + "Password incorrect.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_MAIN_MENU_ENABLE_SETTINGS, + "Enables the Settings tab. A restart is required for the tab to appear.") +MSG_HASH(MENU_ENUM_SUBLABEL_XMB_SHOW_SETTINGS_PASSWORD, + "Supplying a password when hiding the settings tab makes it possible to later restore it from the menu, by going to the Main Menu tab, selecting Enable Settings Tab and entering the password.") From cf81ddcb4eb73adb3ac6ce4c3b991bdbfe917159 Mon Sep 17 00:00:00 2001 From: Shane Mouton Date: Tue, 26 Sep 2017 20:53:02 -0400 Subject: [PATCH 016/253] Audio Performance Change changed bufferSource variable to constant...This fixes the constant sound popping in Safari. --- emscripten/library_rwebaudio.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/emscripten/library_rwebaudio.js b/emscripten/library_rwebaudio.js index d1b0c8bc2b..fd85d607a0 100644 --- a/emscripten/library_rwebaudio.js +++ b/emscripten/library_rwebaudio.js @@ -61,7 +61,7 @@ var LibraryRWebAudio = { else startTime = RA.context.currentTime; RA.buffers[index].endTime = startTime + RA.buffers[index].duration; - var bufferSource = RA.context.createBufferSource(); + const bufferSource = RA.context.createBufferSource(); bufferSource.buffer = RA.buffers[index]; bufferSource.connect(RA.context.destination); bufferSource.start(startTime); From b79f95668bbe750eb63f5075bd3093fc1f816890 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 27 Sep 2017 20:08:37 +0200 Subject: [PATCH 017/253] Turn it into char pointer array --- input/input_driver.c | 11 ++++++++--- input/input_driver.h | 2 +- tasks/task_autodetect.c | 5 ++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/input/input_driver.c b/input/input_driver.c index 8a2f5944fd..cf86f54d7f 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -2318,7 +2318,10 @@ void input_config_parse_joy_button(void *data, const char *prefix, if (config_get_string(conf, key_label, &tmp_a)) { - strlcpy(bind->joykey_label, tmp_a, sizeof(bind->joykey_label)); + if (!string_is_empty(bind->joykey_label)) + free(bind->joykey_label); + + bind->joykey_label = strdup(tmp_a); free(tmp_a); } } @@ -2375,7 +2378,8 @@ static void input_config_get_bind_string_joykey( if (GET_HAT_DIR(bind->joykey)) { - if (!string_is_empty(bind->joykey_label) && label_show) + if (bind->joykey_label && + !string_is_empty(bind->joykey_label) && label_show) snprintf(buf, size, "%s %s ", prefix, bind->joykey_label); else { @@ -2405,7 +2409,8 @@ static void input_config_get_bind_string_joykey( } else { - if (!string_is_empty(bind->joykey_label) && label_show) + if (bind->joykey_label && + !string_is_empty(bind->joykey_label) && label_show) snprintf(buf, size, "%s%s (btn) ", prefix, bind->joykey_label); else snprintf(buf, size, "%s%u (%s) ", prefix, (unsigned)bind->joykey, diff --git a/input/input_driver.h b/input/input_driver.h index 111613ae02..0f99da1940 100644 --- a/input/input_driver.h +++ b/input/input_driver.h @@ -114,7 +114,7 @@ struct retro_keybind /* Used by input_{push,pop}_analog_dpad(). */ uint32_t orig_joyaxis; - char joykey_label[64]; + char *joykey_label; char joyaxis_label[64]; }; diff --git a/tasks/task_autodetect.c b/tasks/task_autodetect.c index d7c820c133..46c64e46a7 100644 --- a/tasks/task_autodetect.c +++ b/tasks/task_autodetect.c @@ -475,7 +475,10 @@ bool input_autoconfigure_connect( { input_autoconf_binds[state->idx][i].joykey = NO_BTN; input_autoconf_binds[state->idx][i].joyaxis = AXIS_NONE; - input_autoconf_binds[state->idx][i].joykey_label[0] = '\0'; + if (input_autoconf_binds[state->idx][i].joykey_label + && !string_is_empty(input_autoconf_binds[state->idx][i].joykey_label)) + free(input_autoconf_binds[state->idx][i].joykey_label); + input_autoconf_binds[state->idx][i].joykey_label = NULL; input_autoconf_binds[state->idx][i].joyaxis_label[0] = '\0'; } From fcf6228dcec7deb78c9dba4899bdbbfd9fb599e8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 27 Sep 2017 20:11:44 +0200 Subject: [PATCH 018/253] Turn into char pointer array --- input/input_driver.c | 8 ++++++-- input/input_driver.h | 2 +- tasks/task_autodetect.c | 7 +++++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/input/input_driver.c b/input/input_driver.c index cf86f54d7f..1a1fc3662d 100644 --- a/input/input_driver.c +++ b/input/input_driver.c @@ -2364,7 +2364,10 @@ void input_config_parse_joy_axis(void *data, const char *prefix, if (config_get_string(conf, key_label, &tmp_a)) { - strlcpy(bind->joyaxis_label, tmp_a, sizeof(bind->joyaxis_label)); + if (bind->joyaxis_label && + !string_is_empty(bind->joyaxis_label)) + free(bind->joyaxis_label); + bind->joyaxis_label = strdup(tmp_a); free(tmp_a); } } @@ -2423,7 +2426,8 @@ static void input_config_get_bind_string_joyaxis(char *buf, const char *prefix, { settings_t *settings = config_get_ptr(); - if (!string_is_empty(bind->joyaxis_label) + if (bind->joyaxis_label && + !string_is_empty(bind->joyaxis_label) && settings->bools.input_descriptor_label_show) snprintf(buf, size, "%s%s (axis) ", prefix, bind->joyaxis_label); else diff --git a/input/input_driver.h b/input/input_driver.h index 0f99da1940..17d135402d 100644 --- a/input/input_driver.h +++ b/input/input_driver.h @@ -115,7 +115,7 @@ struct retro_keybind uint32_t orig_joyaxis; char *joykey_label; - char joyaxis_label[64]; + char *joyaxis_label; }; typedef struct rarch_joypad_info diff --git a/tasks/task_autodetect.c b/tasks/task_autodetect.c index 46c64e46a7..b071b94d59 100644 --- a/tasks/task_autodetect.c +++ b/tasks/task_autodetect.c @@ -478,8 +478,11 @@ bool input_autoconfigure_connect( if (input_autoconf_binds[state->idx][i].joykey_label && !string_is_empty(input_autoconf_binds[state->idx][i].joykey_label)) free(input_autoconf_binds[state->idx][i].joykey_label); - input_autoconf_binds[state->idx][i].joykey_label = NULL; - input_autoconf_binds[state->idx][i].joyaxis_label[0] = '\0'; + if (input_autoconf_binds[state->idx][i].joyaxis_label + && !string_is_empty(input_autoconf_binds[state->idx][i].joyaxis_label)) + free(input_autoconf_binds[state->idx][i].joyaxis_label); + input_autoconf_binds[state->idx][i].joykey_label = NULL; + input_autoconf_binds[state->idx][i].joyaxis_label = NULL; } input_autoconfigured[state->idx] = false; From a3ded01b647b4f5b73b7c507835085465f4da578 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 27 Sep 2017 23:16:37 +0200 Subject: [PATCH 019/253] Cleanups --- gfx/drivers/gx_gfx.c | 92 +++++++++++++++++-------------- gfx/drivers/wiiu_gfx.c | 107 ++++++++++++++++++++----------------- input/drivers/ctr_input.c | 6 ++- input/drivers/gx_input.c | 6 ++- input/drivers/wiiu_input.c | 6 +-- 5 files changed, 122 insertions(+), 95 deletions(-) diff --git a/gfx/drivers/gx_gfx.c b/gfx/drivers/gx_gfx.c index 3f36723efd..0f8347fae8 100644 --- a/gfx/drivers/gx_gfx.c +++ b/gfx/drivers/gx_gfx.c @@ -118,23 +118,32 @@ static struct } menu_tex ATTRIBUTE_ALIGN(32); static OSCond g_video_cond; -static unsigned g_current_framebuf; -static volatile bool g_draw_done = false; -static bool g_vsync = false; -static uint32_t g_orientation = 0; -static uint32_t retraceCount; -static uint32_t referenceRetraceCount; +static volatile bool g_draw_done = false; +static bool g_vsync = false; -static uint8_t gx_fifo[256 * 1024] ATTRIBUTE_ALIGN(32); -static uint8_t display_list[1024] ATTRIBUTE_ALIGN(32); -static size_t display_list_size; -uint16_t gx_xOrigin, gx_yOrigin; int8_t gx_system_xOrigin, gx_used_system_xOrigin; int8_t gx_xOriginNeg, gx_xOriginPos; int8_t gx_yOriginNeg, gx_yOriginPos; + +static uint8_t gx_fifo[256 * 1024] ATTRIBUTE_ALIGN(32); +static uint8_t display_list[1024] ATTRIBUTE_ALIGN(32); + +static uint16_t gx_xOrigin = 0; +static uint16_t gx_yOrigin = 0; + +static unsigned g_current_framebuf = 0; +static uint32_t g_orientation = 0; + +static uint32_t retraceCount = 0; +static uint32_t referenceRetraceCount = 0; + +static unsigned gx_old_width = 0; +static unsigned gx_old_height = 0; + +static size_t display_list_size; + GXRModeObj gx_mode; -unsigned gx_old_width, gx_old_height; float verts[16] ATTRIBUTE_ALIGN(32) = { -1, 1, -0.5, @@ -247,15 +256,15 @@ unsigned menu_gx_resolutions[][2] = { static void retrace_callback(u32 retrace_count) { - u32 level = 0; + uint32_t level = 0; (void)retrace_count; g_draw_done = true; OSSignalCond(g_video_cond); - _CPU_ISR_Disable(level); + _CPU_ISR_Disable((u32)level); retraceCount = retrace_count; - _CPU_ISR_Restore(level); + _CPU_ISR_Restore((u32)level); } static bool gx_isValidXOrigin(int origin) @@ -276,14 +285,19 @@ static bool gx_isValidYOrigin(int origin) static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines, bool fullscreen) { - f32 y_scale; + int tmpOrigin; float refresh_rate; - u16 xfbWidth, xfbHeight; bool progressive; unsigned modetype, viHeightMultiplier, viWidth, tvmode, max_width, i; - gx_video_t *gx = (gx_video_t*)data; - settings_t *settings = config_get_ptr(); + size_t new_fb_pitch = 0; + unsigned new_fb_width = 0; + unsigned new_fb_height = 0; + float y_scale = 0.0f; + uint16_t xfbWidth = 0; + uint16_t xfbHeight = 0; + gx_video_t *gx = (gx_video_t*)data; + settings_t *settings = config_get_ptr(); /* stop vsync callback */ VIDEO_SetPostRetraceCallback(NULL); @@ -391,7 +405,8 @@ static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines, while(viWidth + gx_used_system_xOrigin > 720) gx_used_system_xOrigin++; } - int tmpOrigin = (max_width - gx_mode.viWidth) / 2; + tmpOrigin = (max_width - gx_mode.viWidth) / 2; + if(gx_system_xOrigin > 0) { while(!gx_isValidXOrigin(tmpOrigin)) tmpOrigin--; @@ -446,10 +461,7 @@ static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines, gx->should_resize = true; /* calculate menu dimensions */ - size_t new_fb_pitch; - unsigned new_fb_width; - unsigned new_fb_height = (gx_mode.efbHeight / - (gx->double_strike ? 1 : 2)) & ~3; + new_fb_height = (gx_mode.efbHeight / (gx->double_strike ? 1 : 2)) & ~3; if (new_fb_height > 240) new_fb_height = 240; @@ -466,10 +478,10 @@ static void gx_set_video_mode(void *data, unsigned fbWidth, unsigned lines, GX_SetViewportJitter(0, 0, gx_mode.fbWidth, gx_mode.efbHeight, 0, 1, 1); GX_SetDispCopySrc(0, 0, gx_mode.fbWidth, gx_mode.efbHeight); - y_scale = GX_GetYScaleFactor(gx_mode.efbHeight, gx_mode.xfbHeight); - xfbWidth = VIDEO_PadFramebufferWidth(gx_mode.fbWidth); - xfbHeight = GX_SetDispCopyYScale(y_scale); - GX_SetDispCopyDst(xfbWidth, xfbHeight); + y_scale = GX_GetYScaleFactor(gx_mode.efbHeight, gx_mode.xfbHeight); + xfbWidth = VIDEO_PadFramebufferWidth(gx_mode.fbWidth); + xfbHeight = GX_SetDispCopyYScale((f32)y_scale); + GX_SetDispCopyDst((u16)xfbWidth, (u16)xfbHeight); GX_SetCopyFilter(gx_mode.aa, gx_mode.sample_pattern, (gx_mode.xfbMode == VI_XFBMODE_SF) @@ -585,17 +597,16 @@ static void setup_video_mode(gx_video_t *gx) static void init_texture(void *data, unsigned width, unsigned height) { - unsigned g_filter; size_t fb_pitch; unsigned fb_width, fb_height; gx_video_t *gx = (gx_video_t*)data; GXTexObj *fb_ptr = (GXTexObj*)&g_tex.obj; GXTexObj *menu_ptr = (GXTexObj*)&menu_tex.obj; settings_t *settings = config_get_ptr(); + unsigned g_filter = settings->bools.video_smooth ? GX_LINEAR : GX_NEAR; width &= ~3; height &= ~3; - g_filter = settings->bools.video_smooth ? GX_LINEAR : GX_NEAR; menu_display_get_fb_size(&fb_width, &fb_height, &fb_pitch); @@ -614,11 +625,11 @@ static void init_texture(void *data, unsigned width, unsigned height) static void init_vtx(void *data, const video_info_t *video) { Mtx44 m; - gx_video_t *gx = (gx_video_t*)data; - u32 level = 0; - _CPU_ISR_Disable(level); + gx_video_t *gx = (gx_video_t*)data; + uint32_t level = 0; + _CPU_ISR_Disable((u32)level); referenceRetraceCount = retraceCount; - _CPU_ISR_Restore(level); + _CPU_ISR_Restore((u32)level); GX_SetCullMode(GX_CULL_NONE); GX_SetClipMode(GX_CLIP_DISABLE); @@ -898,6 +909,7 @@ static void convert_texture32(const uint32_t *_src, uint32_t *_dst, static void gx_resize(void *data) { + int gamma; unsigned degrees; unsigned width, height; Mtx44 m1, m2; @@ -915,11 +927,11 @@ static void gx_resize(void *data) #ifdef HW_RVL VIDEO_SetTrapFilter(global->console.softfilter_enable); - int gamma = global->console.screen.gamma_correction; + gamma = global->console.screen.gamma_correction; if(gamma == 0) gamma = 10; //default 1.0 gamma value VIDEO_SetGamma(gamma); #else - int gamma = global->console.screen.gamma_correction; + gamma = global->console.screen.gamma_correction; GX_SetDispCopyGamma(MAX(0,MIN(2,gamma))); #endif @@ -1484,7 +1496,7 @@ static bool gx_frame(void *data, const void *frame, char fps_text_buf[128]; gx_video_t *gx = (gx_video_t*)data; u8 clear_efb = GX_FALSE; - u32 level = 0; + uint32_t level = 0; fps_text_buf[0] = '\0'; @@ -1569,11 +1581,11 @@ static bool gx_frame(void *data, const void *frame, gx_render_overlay(gx); #endif - _CPU_ISR_Disable(level); + _CPU_ISR_Disable((u32)level); if (referenceRetraceCount > retraceCount) VIDEO_WaitVSync(); referenceRetraceCount = retraceCount; - _CPU_ISR_Restore(level); + _CPU_ISR_Restore((u32)level); GX_DrawDone(); @@ -1615,9 +1627,9 @@ static bool gx_frame(void *data, const void *frame, VIDEO_SetNextFramebuffer(gx->framebuf[g_current_framebuf]); VIDEO_Flush(); - _CPU_ISR_Disable(level); + _CPU_ISR_Disable((u32)level); ++referenceRetraceCount; - _CPU_ISR_Restore(level); + _CPU_ISR_Restore((u32)level); return true; } diff --git a/gfx/drivers/wiiu_gfx.c b/gfx/drivers/wiiu_gfx.c index 57778bb9de..069acfe3d4 100644 --- a/gfx/drivers/wiiu_gfx.c +++ b/gfx/drivers/wiiu_gfx.c @@ -215,7 +215,7 @@ static void* wiiu_gfx_init(const video_info_t* video, *input_data = wiiuinput; } - /* video init */ + /* video initialize */ wiiu->cmd_buffer = MEM2_alloc(0x400000, 0x40); u32 init_attributes[] = { @@ -276,19 +276,14 @@ static void* wiiu_gfx_init(const video_info_t* video, GX2SetScissor(0, 0, wiiu->color_buffer.surface.width, wiiu->color_buffer.surface.height); GX2SetDepthOnlyControl(GX2_DISABLE, GX2_DISABLE, GX2_COMPARE_FUNC_ALWAYS); GX2SetColorControl(GX2_LOGIC_OP_COPY, 1, GX2_DISABLE, GX2_ENABLE); -#if 1 GX2SetBlendControl(GX2_RENDER_TARGET_0, GX2_BLEND_MODE_SRC_ALPHA, GX2_BLEND_MODE_INV_SRC_ALPHA, GX2_BLEND_COMBINE_MODE_ADD, GX2_ENABLE, GX2_BLEND_MODE_SRC_ALPHA, GX2_BLEND_MODE_INV_SRC_ALPHA, GX2_BLEND_COMBINE_MODE_ADD); -#else - GX2SetBlendControl(GX2_RENDER_TARGET_0, GX2_BLEND_MODE_ONE, GX2_BLEND_MODE_ZERO, GX2_BLEND_COMBINE_MODE_ADD, - GX2_DISABLE, GX2_BLEND_MODE_ONE, GX2_BLEND_MODE_ZERO, GX2_BLEND_COMBINE_MODE_ADD); -#endif GX2SetCullOnlyControl(GX2_FRONT_FACE_CCW, GX2_DISABLE, GX2_DISABLE); #ifdef GX2_CAN_ACCESS_DATA_SECTION wiiu->shader = &tex_shader; #else - /* init shader */ + /* Initialize shader */ wiiu->shader = MEM2_alloc(sizeof(tex_shader), 0x1000); memcpy(wiiu->shader, &tex_shader, sizeof(tex_shader)); GX2Invalidate(GX2_INVALIDATE_MODE_CPU, wiiu->shader, sizeof(tex_shader)); @@ -341,7 +336,7 @@ static void* wiiu_gfx_init(const video_info_t* video, wiiu_set_tex_coords(wiiu->menu.tex_coord, &wiiu->menu.texture, 0, 0, wiiu->menu.texture.surface.width, wiiu->menu.texture.surface.height, 0); - /* init frame texture */ + /* Initialize frame texture */ memset(&wiiu->texture, 0, sizeof(GX2Texture)); wiiu->texture.surface.width = video->input_scale * RARCH_SCALE_BASE; wiiu->texture.surface.height = video->input_scale * RARCH_SCALE_BASE; @@ -390,12 +385,14 @@ static void* wiiu_gfx_init(const video_info_t* video, GX2Invalidate(GX2_INVALIDATE_MODE_CPU_TEXTURE, wiiu->menu.texture.surface.image, wiiu->menu.texture.surface.imageSize); - wiiu->vertex_cache.size = 0x1000; - wiiu->vertex_cache.current = 0; - wiiu->vertex_cache.positions = MEM2_alloc(wiiu->vertex_cache.size * sizeof(position_t), GX2_VERTEX_BUFFER_ALIGNMENT); - wiiu->vertex_cache.tex_coords = MEM2_alloc(wiiu->vertex_cache.size * sizeof(tex_coord_t), GX2_VERTEX_BUFFER_ALIGNMENT); + wiiu->vertex_cache.size = 0x1000; + wiiu->vertex_cache.current = 0; + wiiu->vertex_cache.positions = MEM2_alloc(wiiu->vertex_cache.size + * sizeof(position_t), GX2_VERTEX_BUFFER_ALIGNMENT); + wiiu->vertex_cache.tex_coords = MEM2_alloc(wiiu->vertex_cache.size + * sizeof(tex_coord_t), GX2_VERTEX_BUFFER_ALIGNMENT); - /* init samplers */ + /* Initialize samplers */ GX2InitSampler(&wiiu->sampler_nearest, GX2_TEX_CLAMP_MODE_CLAMP, GX2_TEX_XY_FILTER_MODE_POINT); GX2InitSampler(&wiiu->sampler_linear, GX2_TEX_CLAMP_MODE_CLAMP, GX2_TEX_XY_FILTER_MODE_LINEAR); @@ -415,10 +412,10 @@ static void* wiiu_gfx_init(const video_info_t* video, GX2SetTVEnable(GX2_ENABLE); GX2SetDRCEnable(GX2_ENABLE); - wiiu->keep_aspect = true; - wiiu->should_resize = true; - wiiu->smooth = video->smooth; - wiiu->vsync = video->vsync; + wiiu->keep_aspect = true; + wiiu->should_resize = true; + wiiu->smooth = video->smooth; + wiiu->vsync = video->vsync; GX2SetSwapInterval(!!video->vsync); wiiu->vp.x = 0; @@ -495,11 +492,17 @@ static bool wiiu_gfx_frame(void* data, const void* frame, unsigned width, unsigned height, uint64_t frame_count, unsigned pitch, const char* msg, video_frame_info_t *video_info) { - (void)msg; +#if 0 + static float fps; + static u32 frames; + static u32 lastTick , currentTick; + u32 diff; +#endif int i; - wiiu_video_t* wiiu = (wiiu_video_t*) data; + (void)msg; + if(wiiu->vsync) { uint32_t swap_count; @@ -517,32 +520,32 @@ static bool wiiu_gfx_frame(void* data, const void* frame, else wiiu->last_vsync = last_vsync; } - GX2WaitForFlip(); + GX2WaitForFlip(); if (!width || !height) return true; - static u32 lastTick , currentTick; +#if 0 currentTick = OSGetSystemTick(); - u32 diff = currentTick - lastTick; - static float fps; - static u32 frames; + diff = currentTick - lastTick; + frames++; + if(diff > wiiu_timer_clock) { fps = (float)frames * ((float) wiiu_timer_clock / (float) diff); lastTick = currentTick; frames = 0; } -#if 0 + static u32 last_frame_tick; if (!(wiiu->menu.enable)) printf("frame time : %10.6f ms \r", (float)(currentTick - last_frame_tick) * 1000.0f / (float)wiiu_timer_clock); last_frame_tick = currentTick; -#endif printf("fps: %8.8f frames : %5i\r", fps, wiiu->frames++); fflush(stdout); +#endif if (wiiu->should_resize) wiiu_gfx_update_viewport(wiiu); @@ -559,8 +562,9 @@ static bool wiiu_gfx_frame(void* data, const void* frame, if (height > wiiu->texture.surface.height) height = wiiu->texture.surface.height; - wiiu->width = width; + wiiu->width = width; wiiu->height = height; + if(wiiu->rgb32) { const uint32_t* src = frame; @@ -577,12 +581,12 @@ static bool wiiu_gfx_frame(void* data, const void* frame, } else { - const uint16_t* src = frame; - uint16_t* dst = (uint16_t*)wiiu->texture.surface.image; + const uint16_t *src = frame; + uint16_t *dst = (uint16_t*)wiiu->texture.surface.image; for (i = 0; i < height; i++) { - int j; + unsigned j; for(j = 0; j < width; j++) dst[j] = __builtin_bswap16(src[j]); dst += wiiu->texture.surface.pitch; @@ -596,8 +600,10 @@ static bool wiiu_gfx_frame(void* data, const void* frame, wiiu_set_tex_coords(wiiu->tex_coord, &wiiu->texture, 0, 0, width, height, wiiu->rotation); } - GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->position), sizeof(*wiiu->position), wiiu->position); - GX2SetAttribBuffer(1, 4 * sizeof(*wiiu->tex_coord), sizeof(*wiiu->tex_coord), wiiu->tex_coord); + GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->position), + sizeof(*wiiu->position), wiiu->position); + GX2SetAttribBuffer(1, 4 * sizeof(*wiiu->tex_coord), + sizeof(*wiiu->tex_coord), wiiu->tex_coord); GX2SetPixelTexture(&wiiu->texture, wiiu->shader->sampler.location); GX2SetPixelSampler(wiiu->smooth? &wiiu->sampler_linear : &wiiu->sampler_nearest, @@ -607,8 +613,10 @@ static bool wiiu_gfx_frame(void* data, const void* frame, if (wiiu->menu.enable) { - GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->menu.position), sizeof(*wiiu->menu.position), wiiu->menu.position); - GX2SetAttribBuffer(1, 4 * sizeof(*wiiu->menu.tex_coord), sizeof(*wiiu->menu.tex_coord), wiiu->menu.tex_coord); + GX2SetAttribBuffer(0, 4 * sizeof(*wiiu->menu.position), + sizeof(*wiiu->menu.position), wiiu->menu.position); + GX2SetAttribBuffer(1, 4 * sizeof(*wiiu->menu.tex_coord), + sizeof(*wiiu->menu.tex_coord), wiiu->menu.tex_coord); GX2SetPixelTexture(&wiiu->menu.texture, wiiu->shader->sampler.location); GX2SetPixelSampler(&wiiu->sampler_linear, wiiu->shader->sampler.location); @@ -617,8 +625,10 @@ static bool wiiu_gfx_frame(void* data, const void* frame, } wiiu->vertex_cache.current = 0; - GX2SetAttribBuffer(0, wiiu->vertex_cache.size * sizeof(position_t), sizeof(position_t), wiiu->vertex_cache.positions); - GX2SetAttribBuffer(1, wiiu->vertex_cache.size * sizeof(tex_coord_t), sizeof(tex_coord_t), wiiu->vertex_cache.tex_coords); + GX2SetAttribBuffer(0, wiiu->vertex_cache.size * sizeof(position_t), + sizeof(position_t), wiiu->vertex_cache.positions); + GX2SetAttribBuffer(1, wiiu->vertex_cache.size * sizeof(tex_coord_t), + sizeof(tex_coord_t), wiiu->vertex_cache.tex_coords); GX2SetPixelSampler(&wiiu->sampler_linear, wiiu->shader->sampler.location); wiiu->render_msg_enabled = true; @@ -631,8 +641,10 @@ static bool wiiu_gfx_frame(void* data, const void* frame, wiiu->render_msg_enabled = false; - GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, wiiu->vertex_cache.positions, wiiu->vertex_cache.current * sizeof(position_t)); - GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, wiiu->vertex_cache.tex_coords, wiiu->vertex_cache.current * sizeof(tex_coord_t)); + GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, + wiiu->vertex_cache.positions, wiiu->vertex_cache.current * sizeof(position_t)); + GX2Invalidate(GX2_INVALIDATE_MODE_CPU_ATTRIBUTE_BUFFER, + wiiu->vertex_cache.tex_coords, wiiu->vertex_cache.current * sizeof(tex_coord_t)); if (wiiu->menu.enable) GX2DrawDone(); @@ -729,8 +741,8 @@ static uintptr_t wiiu_gfx_load_texture(void* video_data, void* data, texture->surface.tileMode = GX2_TILE_MODE_LINEAR_ALIGNED; texture->viewNumSlices = 1; - texture->surface.format = GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8; - texture->compMap = GX2_COMP_SEL(_G, _B, _A, _R); + texture->surface.format = GX2_SURFACE_FORMAT_UNORM_R8_G8_B8_A8; + texture->compMap = GX2_COMP_SEL(_G, _B, _A, _R); GX2CalcSurfaceSizeAndAlignment(&texture->surface); GX2InitTextureRegs(texture); @@ -768,15 +780,15 @@ static void wiiu_gfx_apply_state_changes(void* data) if (wiiu) wiiu->should_resize = true; - - } static void wiiu_gfx_set_texture_frame(void* data, const void* frame, bool rgb32, unsigned width, unsigned height, float alpha) { int i; - wiiu_video_t* wiiu = (wiiu_video_t*) data; + const uint16_t *src = NULL; + uint16_t *dst = NULL; + wiiu_video_t* wiiu = (wiiu_video_t*) data; if (!wiiu) return; @@ -790,11 +802,11 @@ static void wiiu_gfx_set_texture_frame(void* data, const void* frame, bool rgb32 if (height > wiiu->menu.texture.surface.height) height = wiiu->menu.texture.surface.height; - wiiu->menu.width = width; + wiiu->menu.width = width; wiiu->menu.height = height; - const uint16_t* src = frame; - uint16_t* dst = (uint16_t*)wiiu->menu.texture.surface.image; + src = frame; + dst = (uint16_t*)wiiu->menu.texture.surface.image; for (i = 0; i < height; i++) { @@ -807,7 +819,6 @@ static void wiiu_gfx_set_texture_frame(void* data, const void* frame, bool rgb32 wiiu->menu.texture.surface.imageSize); wiiu_set_tex_coords(wiiu->menu.tex_coord, &wiiu->menu.texture, 0, 0, width, height, 0); -// wiiu_set_tex_coords(wiiu->menu.tex_coord, &wiiu->menu.texture, 0, 0, wiiu->menu.texture.surface.width, wiiu->menu.texture.surface.height, 0); } static void wiiu_gfx_set_texture_enable(void* data, bool state, bool full_screen) @@ -860,7 +871,7 @@ static const video_poke_interface_t wiiu_poke_interface = }; static void wiiu_gfx_get_poke_interface(void* data, - const video_poke_interface_t** iface) + const video_poke_interface_t** iface) { (void)data; *iface = &wiiu_poke_interface; diff --git a/input/drivers/ctr_input.c b/input/drivers/ctr_input.c index 579769dc78..9871a9669d 100644 --- a/input/drivers/ctr_input.c +++ b/input/drivers/ctr_input.c @@ -59,10 +59,12 @@ static int16_t ctr_input_state(void *data, switch (device) { case RETRO_DEVICE_JOYPAD: - return input_joypad_pressed(ctr->joypad, joypad_info, port, binds[port], id); + return input_joypad_pressed(ctr->joypad, + joypad_info, port, binds[port], id); case RETRO_DEVICE_ANALOG: if (binds[port]) - return input_joypad_analog(ctr->joypad, joypad_info, port, idx, id, binds[port]); + return input_joypad_analog(ctr->joypad, + joypad_info, port, idx, id, binds[port]); break; } diff --git a/input/drivers/gx_input.c b/input/drivers/gx_input.c index 4544709057..b4daff900d 100644 --- a/input/drivers/gx_input.c +++ b/input/drivers/gx_input.c @@ -53,10 +53,12 @@ static int16_t gx_input_state(void *data, switch (device) { case RETRO_DEVICE_JOYPAD: - return input_joypad_pressed(gx->joypad, joypad_info, port, binds[port], id); + return input_joypad_pressed(gx->joypad, + joypad_info, port, binds[port], id); case RETRO_DEVICE_ANALOG: if (binds[port]) - return input_joypad_analog(gx->joypad, joypad_info, port, idx, id, binds[port]); + return input_joypad_analog(gx->joypad, + joypad_info, port, idx, id, binds[port]); break; } diff --git a/input/drivers/wiiu_input.c b/input/drivers/wiiu_input.c index df0d7f208b..b88395bd97 100644 --- a/input/drivers/wiiu_input.c +++ b/input/drivers/wiiu_input.c @@ -36,9 +36,9 @@ #define MAX_PADS 5 static unsigned char keyboardChannel = 0x00; -static KBDModifier keyboardModifier = 0x00; -static unsigned char keyboardCode = 0x00; -static KEYState keyboardState[256] = { KBD_WIIU_NULL }; +static KBDModifier keyboardModifier = 0x00; +static unsigned char keyboardCode = 0x00; +static KEYState keyboardState[256] = { KBD_WIIU_NULL }; typedef struct wiiu_input { From 7acda37b4e8237e8af2473be50c1604f537c7a78 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 27 Sep 2017 23:50:40 +0200 Subject: [PATCH 020/253] This does not work right now --- pkg/android/phoenix/AndroidManifest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/android/phoenix/AndroidManifest.xml b/pkg/android/phoenix/AndroidManifest.xml index 4bce244afa..5d82f1b08c 100644 --- a/pkg/android/phoenix/AndroidManifest.xml +++ b/pkg/android/phoenix/AndroidManifest.xml @@ -1,8 +1,8 @@ - %versionDTD; ]> + From e7d41f6ea7dc348da8fb434ca2e3407365ec7299 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 27 Sep 2017 23:54:31 +0200 Subject: [PATCH 021/253] Cleanup --- tasks/task_content.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tasks/task_content.c b/tasks/task_content.c index b6fd4bee55..2acf49152f 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -492,7 +492,6 @@ static bool content_file_init_extract( msg_hash_to_str( MSG_FAILED_TO_EXTRACT_CONTENT_FROM_COMPRESSED_FILE), temp_content); - free(new_path); free(temp_content); free(str); goto error; @@ -504,10 +503,7 @@ static bool content_file_init_extract( if (!string_list_append(content_ctx->temporary_content, new_path, *attr)) - { - free(new_path); goto error; - } free(new_path); } @@ -516,6 +512,7 @@ static bool content_file_init_extract( return true; error: + free(new_path); return false; } #endif From f34250e38ec9107d4183f1da6009b7832f9fc8e9 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 27 Sep 2017 23:55:54 +0200 Subject: [PATCH 022/253] Buildfix --- tasks/task_content.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tasks/task_content.c b/tasks/task_content.c index 2acf49152f..bb2e5d798c 100644 --- a/tasks/task_content.c +++ b/tasks/task_content.c @@ -448,6 +448,7 @@ static bool content_file_init_extract( ) { unsigned i; + char *new_path = NULL; for (i = 0; i < content->size; i++) { @@ -464,12 +465,13 @@ static bool content_file_init_extract( continue; { - char *temp_content = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - char *new_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - const char *valid_ext = special ? + char *temp_content = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + const char *valid_ext = special ? special->roms[i].valid_extensions : content_ctx->valid_extensions; + new_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + temp_content[0] = new_path[0] = '\0'; strlcpy(temp_content, path, From cb92ad77d2cbe2ba14019e5bc572cef42b84a8c1 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 27 Sep 2017 23:59:18 +0200 Subject: [PATCH 023/253] Remove ifdef conditionals from command.h --- command.c | 87 ++++++++++++++++++++++++++++++------------------------- command.h | 4 --- 2 files changed, 47 insertions(+), 44 deletions(-) diff --git a/command.c b/command.c index b0878fbded..2b30ccc909 100644 --- a/command.c +++ b/command.c @@ -438,8 +438,52 @@ static bool command_verify(const char *cmd) return false; } +#ifdef HAVE_COMMAND +static void command_network_poll(command_t *handle) +{ + fd_set fds; + struct timeval tmp_tv = {0}; + + if (handle->net_fd < 0) + return; + + FD_ZERO(&fds); + FD_SET(handle->net_fd, &fds); + + if (socket_select(handle->net_fd + 1, &fds, NULL, NULL, &tmp_tv) <= 0) + return; + + if (!FD_ISSET(handle->net_fd, &fds)) + return; + + for (;;) + { + ssize_t ret; + char buf[1024]; + + buf[0] = '\0'; + + lastcmd_net_fd = handle->net_fd; + lastcmd_net_source_len = sizeof(lastcmd_net_source); + ret = recvfrom(handle->net_fd, buf, + sizeof(buf) - 1, 0, + (struct sockaddr*)&lastcmd_net_source, + &lastcmd_net_source_len); + + if (ret <= 0) + break; + + buf[ret] = '\0'; + + command_parse_msg(handle, buf, CMD_NETWORK); + } +} +#endif +#endif + bool command_network_send(const char *cmd_) { +#if defined(HAVE_COMMAND) && defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) bool ret = false; char *command = NULL; char *save = NULL; @@ -483,49 +527,12 @@ bool command_network_send(const char *cmd_) free(command); return ret; +#else + return false; +#endif } -#ifdef HAVE_COMMAND -static void command_network_poll(command_t *handle) -{ - fd_set fds; - struct timeval tmp_tv = {0}; - - if (handle->net_fd < 0) - return; - - FD_ZERO(&fds); - FD_SET(handle->net_fd, &fds); - - if (socket_select(handle->net_fd + 1, &fds, NULL, NULL, &tmp_tv) <= 0) - return; - - if (!FD_ISSET(handle->net_fd, &fds)) - return; - - for (;;) - { - ssize_t ret; - char buf[1024]; - - buf[0] = '\0'; - - lastcmd_net_fd = handle->net_fd; - lastcmd_net_source_len = sizeof(lastcmd_net_source); - ret = recvfrom(handle->net_fd, buf, - sizeof(buf) - 1, 0, (struct sockaddr*)&lastcmd_net_source, &lastcmd_net_source_len); - - if (ret <= 0) - break; - - buf[ret] = '\0'; - - command_parse_msg(handle, buf, CMD_NETWORK); - } -} -#endif -#endif #ifdef HAVE_STDIN_CMD static bool command_stdin_init(command_t *handle) diff --git a/command.h b/command.h index 71bd968dec..b9f49e2c6f 100644 --- a/command.h +++ b/command.h @@ -231,11 +231,7 @@ enum event_command bool command_set_shader(const char *arg); -#ifdef HAVE_COMMAND -#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) bool command_network_send(const char *cmd_); -#endif -#endif bool command_network_new( command_t *handle, From 1ed61d2fdb473416c2da2e9236dd4332467f16e3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 00:01:42 +0200 Subject: [PATCH 024/253] Remove ifdefs from configuration.h --- configuration.c | 5 ++--- configuration.h | 33 --------------------------------- 2 files changed, 2 insertions(+), 36 deletions(-) diff --git a/configuration.c b/configuration.c index 96f0153c0e..c6a7b429e2 100644 --- a/configuration.c +++ b/configuration.c @@ -901,7 +901,6 @@ const char *config_get_default_location(void) return "null"; } -#ifdef HAVE_MENU /** * config_get_default_menu: * @@ -911,6 +910,7 @@ const char *config_get_default_location(void) **/ const char *config_get_default_menu(void) { +#ifdef HAVE_MENU enum menu_driver_enum default_driver = MENU_DEFAULT_DRIVER; if (!string_is_empty(g_defaults.settings.menu)) @@ -931,12 +931,11 @@ const char *config_get_default_menu(void) case MENU_NULL: break; } +#endif return "null"; } -#endif - bool config_overlay_enable_default(void) { if (g_defaults.overlay.set) diff --git a/configuration.h b/configuration.h index 77a0f5f078..84806e68a8 100644 --- a/configuration.h +++ b/configuration.h @@ -25,10 +25,6 @@ #include #include -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - #include "gfx/video_driver.h" #include "input/input_defines.h" @@ -53,9 +49,7 @@ typedef struct settings bool video_vsync; bool video_hard_sync; bool video_black_frame_insertion; -#ifdef GEKKO bool video_vfilter; -#endif bool video_smooth; bool video_force_aspect; bool video_crop_overscan; @@ -77,10 +71,8 @@ typedef struct settings bool audio_enable; bool audio_sync; bool audio_rate_control; -#ifdef HAVE_WASAPI bool audio_wasapi_exclusive_mode; bool audio_wasapi_float_format; -#endif /* Input */ bool input_remap_binds_enable; @@ -102,7 +94,6 @@ typedef struct settings #endif bool input_keyboard_gamepad_enable; -#ifdef HAVE_MENU /* Menu */ bool filter_by_current_core; bool menu_show_start_screen; @@ -134,9 +125,7 @@ typedef struct settings bool menu_xmb_show_history; bool menu_xmb_show_add; bool menu_unified_controls; -#endif -#ifdef HAVE_NETWORKING /* Netplay */ bool netplay_public_announce; bool netplay_start_as_spectator; @@ -146,7 +135,6 @@ typedef struct settings bool netplay_swap_input; bool netplay_nat_traversal; bool netplay_use_mitm_server; -#endif /* Network */ bool network_buildbot_auto_extract_archive; @@ -157,13 +145,11 @@ typedef struct settings bool ui_companion_start_on_boot; bool ui_companion_enable; -#ifdef HAVE_CHEEVOS /* Cheevos */ bool cheevos_enable; bool cheevos_test_unofficial; bool cheevos_hardcore_mode_enable; bool cheevos_verbose_enable; -#endif /* Camera */ bool camera_allow; @@ -183,9 +169,7 @@ typedef struct settings bool bundle_assets_extract_enable; /* Misc. */ -#ifdef HAVE_THREADS bool threaded_data_runloop_enable; -#endif bool set_supports_no_game_enable; bool auto_screenshot_filename; bool history_list_enable; @@ -219,11 +203,9 @@ typedef struct settings bool savestates_in_content_dir; bool screenshots_in_content_dir; bool systemfiles_in_content_dir; -#ifdef HAVE_LAKKA bool ssh_enable; bool samba_enable; bool bluetooth_enable; -#endif } bools; struct @@ -262,10 +244,7 @@ typedef struct settings int location_update_interval_ms; int location_update_interval_distance; int state_slot; - -#ifdef HAVE_WASAPI int audio_wasapi_sh_buffer_length; -#endif } ints; struct @@ -315,9 +294,7 @@ typedef struct settings unsigned video_swap_interval; unsigned video_hard_sync_frames; unsigned video_frame_delay; -#ifdef GEKKO unsigned video_viwidth; -#endif unsigned video_aspect_ratio_idx; unsigned video_rotation; @@ -350,15 +327,11 @@ typedef struct settings char camera_driver[32]; char wifi_driver[32]; char location_driver[32]; -#ifdef HAVE_MENU char menu_driver[32]; -#endif char audio_device[255]; char camera_device[255]; -#ifdef HAVE_CHEEVOS char cheevos_username[32]; char cheevos_password[32]; -#endif char video_context_driver[32]; char audio_driver[32]; char audio_resampler[32]; @@ -377,10 +350,8 @@ typedef struct settings char browse_url[4096]; -#ifdef HAVE_MENU char path_menu_xmb_font[PATH_MAX_LENGTH]; char menu_xmb_show_settings_password[PATH_MAX_LENGTH]; -#endif char path_cheat_database[PATH_MAX_LENGTH]; char path_content_database[PATH_MAX_LENGTH]; char path_overlay[PATH_MAX_LENGTH]; @@ -422,11 +393,9 @@ typedef struct settings char directory_thumbnails[PATH_MAX_LENGTH]; char directory_menu_config[PATH_MAX_LENGTH]; char directory_menu_content[PATH_MAX_LENGTH]; -#ifdef HAVE_NETWORKING char netplay_server[255]; char netplay_password[128]; char netplay_spectate_password[128]; -#endif char username[32]; } paths; @@ -525,7 +494,6 @@ const char *config_get_default_input(void); **/ const char *config_get_default_joypad(void); -#ifdef HAVE_MENU /** * config_get_default_menu: * @@ -534,7 +502,6 @@ const char *config_get_default_joypad(void); * Returns: Default menu driver. **/ const char *config_get_default_menu(void); -#endif const char *config_get_default_record(void); From a05dd09ea86b494dc95afa7911c2f61f40e91eab Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 00:03:50 +0200 Subject: [PATCH 025/253] Update --- configuration.h | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/configuration.h b/configuration.h index 84806e68a8..9a5f922bf9 100644 --- a/configuration.h +++ b/configuration.h @@ -28,6 +28,23 @@ #include "gfx/video_driver.h" #include "input/input_defines.h" +#define configuration_set_float(settings, var, newvar) \ + settings->modified = true; \ + var = newvar + +#define configuration_set_bool(settings, var, newvar) \ + settings->modified = true; \ + var = newvar + +#define configuration_set_uint(settings, var, newvar) \ + settings->modified = true; \ + var = newvar + +#define configuration_set_int(settings, var, newvar) \ + settings->modified = true; \ + var = newvar + + enum override_type { OVERRIDE_NONE = 0, @@ -85,13 +102,9 @@ typedef struct settings bool input_descriptor_hide_unbound; bool input_all_users_control_menu; bool input_menu_swap_ok_cancel_buttons; -#if defined(VITA) bool input_backtouch_enable; bool input_backtouch_toggle; -#endif -#if TARGET_OS_IPHONE bool input_small_keyboard_enable; -#endif bool input_keyboard_gamepad_enable; /* Menu */ @@ -406,22 +419,6 @@ typedef struct settings size_t rewind_buffer_size; } settings_t; -#define configuration_set_float(settings, var, newvar) \ - settings->modified = true; \ - var = newvar - -#define configuration_set_bool(settings, var, newvar) \ - settings->modified = true; \ - var = newvar - -#define configuration_set_uint(settings, var, newvar) \ - settings->modified = true; \ - var = newvar - -#define configuration_set_int(settings, var, newvar) \ - settings->modified = true; \ - var = newvar - /** * config_get_default_camera: * From c7975d8e36376c2d56ca2f67f4f3e02ca3129f8b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 00:06:13 +0200 Subject: [PATCH 026/253] Take out RARCH_INTERNAL ifdef --- gfx/video_driver.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/gfx/video_driver.h b/gfx/video_driver.h index b9f1fc5745..5760a40c03 100644 --- a/gfx/video_driver.h +++ b/gfx/video_driver.h @@ -403,9 +403,7 @@ typedef struct video_info */ unsigned input_scale; -#ifndef RARCH_INTERNAL uintptr_t parent; -#endif } video_info_t; typedef struct video_frame_info From a75ceae68805372ac8a0afc5ded44a29c75953e4 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 00:09:59 +0200 Subject: [PATCH 027/253] Update - order according to size --- configuration.h | 45 +++++++++++++++++++++++++-------------------- 1 file changed, 25 insertions(+), 20 deletions(-) diff --git a/configuration.h b/configuration.h index 9a5f922bf9..e06a41b5ca 100644 --- a/configuration.h +++ b/configuration.h @@ -266,17 +266,8 @@ typedef struct settings unsigned audio_out_rate; unsigned audio_block_frames; unsigned audio_latency; - unsigned input_remap_ids[MAX_USERS][RARCH_CUSTOM_BIND_LIST_END]; - unsigned input_keymapper_ids[RARCH_CUSTOM_BIND_LIST_END]; - /* Set by autoconfiguration in joypad_autoconfig_dir. - * Does not override main binds. */ - unsigned input_libretro_device[MAX_USERS]; - unsigned input_analog_dpad_mode[MAX_USERS]; - unsigned input_joypad_map[MAX_USERS]; - unsigned input_device[MAX_USERS]; - unsigned input_mouse_index[MAX_USERS]; unsigned input_turbo_period; unsigned input_turbo_duty_cycle; @@ -327,22 +318,30 @@ typedef struct settings unsigned camera_height; unsigned input_overlay_show_physical_inputs_port; + + unsigned input_joypad_map[MAX_USERS]; + unsigned input_device[MAX_USERS]; + unsigned input_mouse_index[MAX_USERS]; + /* Set by autoconfiguration in joypad_autoconfig_dir. + * Does not override main binds. */ + unsigned input_libretro_device[MAX_USERS]; + unsigned input_analog_dpad_mode[MAX_USERS]; + + unsigned input_keymapper_ids[RARCH_CUSTOM_BIND_LIST_END]; + + unsigned input_remap_ids[MAX_USERS][RARCH_CUSTOM_BIND_LIST_END]; } uints; struct { char placeholder; - char playlist_names[PATH_MAX_LENGTH]; - char playlist_cores[PATH_MAX_LENGTH]; char video_driver[32]; char record_driver[32]; char camera_driver[32]; char wifi_driver[32]; char location_driver[32]; char menu_driver[32]; - char audio_device[255]; - char camera_device[255]; char cheevos_username[32]; char cheevos_password[32]; char video_context_driver[32]; @@ -350,7 +349,14 @@ typedef struct settings char audio_resampler[32]; char input_driver[32]; char input_joypad_driver[32]; + char input_keyboard_layout[64]; + + char audio_device[255]; + char camera_device[255]; + + char playlist_names[PATH_MAX_LENGTH]; + char playlist_cores[PATH_MAX_LENGTH]; char bundle_assets_src[PATH_MAX_LENGTH]; char bundle_assets_dst[PATH_MAX_LENGTH]; char bundle_assets_dst_subdir[PATH_MAX_LENGTH]; @@ -360,7 +366,12 @@ typedef struct settings { char placeholder; - + char username[32]; + char netplay_password[128]; + char netplay_spectate_password[128]; + char netplay_server[255]; + char network_buildbot_url[255]; + char network_buildbot_assets_url[255]; char browse_url[4096]; char path_menu_xmb_font[PATH_MAX_LENGTH]; @@ -382,8 +393,6 @@ typedef struct settings char path_shader[PATH_MAX_LENGTH]; char path_font[PATH_MAX_LENGTH]; - char network_buildbot_url[255]; - char network_buildbot_assets_url[255]; char directory_audio_filter[PATH_MAX_LENGTH]; char directory_autoconfig[PATH_MAX_LENGTH]; @@ -406,10 +415,6 @@ typedef struct settings char directory_thumbnails[PATH_MAX_LENGTH]; char directory_menu_config[PATH_MAX_LENGTH]; char directory_menu_content[PATH_MAX_LENGTH]; - char netplay_server[255]; - char netplay_password[128]; - char netplay_spectate_password[128]; - char username[32]; } paths; bool modified; From 4a133144d5583b05648962f1e58bcf67e5af2c4d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 00:45:40 +0200 Subject: [PATCH 028/253] Get rid of Coverity warning --- menu/cbs/menu_cbs_ok.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index e6232f947a..e336eca9a2 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -4184,7 +4184,7 @@ static int action_ok_core_delete(const char *path, generic_action_ok_command(CMD_EVENT_UNLOAD_CORE); menu_entries_flush_stack(0, 0); - remove(core_path); + if (remove(core_path) != 0) { } free(core_path); From 67ff372a3817a95f5e825339a920e86d467a1ad7 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 00:50:03 +0200 Subject: [PATCH 029/253] Reorder from lowest to highest sized variables --- menu/menu_input.h | 6 +++--- setting_list.h | 31 +++++++++++++++---------------- 2 files changed, 18 insertions(+), 19 deletions(-) diff --git a/menu/menu_input.h b/menu/menu_input.h index 8f7d982512..2c5694eb00 100644 --- a/menu/menu_input.h +++ b/menu/menu_input.h @@ -88,15 +88,15 @@ typedef struct menu_input struct { + bool back; + bool pressed[2]; int16_t x; int16_t y; int16_t dx; int16_t dy; - float accel; - bool pressed[2]; - bool back; unsigned ptr; unsigned counter; + float accel; } pointer; } menu_input_t; diff --git a/setting_list.h b/setting_list.h index 92322400e0..a4b8b0a66c 100644 --- a/setting_list.h +++ b/setting_list.h @@ -90,17 +90,14 @@ struct rarch_setting_group_info struct rarch_setting { + enum setting_type browser_selection_type; + enum msg_hash_enums enum_idx; + enum msg_hash_enums enum_value_idx; + enum setting_type type; + bool dont_use_enum_idx_representation; bool enforce_minrange; bool enforce_maxrange; - - const char *rounding_fraction; - const char *name; - const char *short_description; - const char *group; - const char *subgroup; - const char *parent_group; - const char *values; uint8_t index; uint8_t index_offset; @@ -111,11 +108,19 @@ struct rarch_setting float step; + uint64_t flags; + uint64_t free_flags; + double min; double max; - uint64_t flags; - uint64_t free_flags; + const char *rounding_fraction; + const char *name; + const char *short_description; + const char *group; + const char *subgroup; + const char *parent_group; + const char *values; change_handler_t change_handler; change_handler_t read_handler; @@ -176,12 +181,6 @@ struct rarch_setting const char *off_label; const char *on_label; } boolean; - - enum setting_type browser_selection_type; - enum msg_hash_enums enum_idx; - enum msg_hash_enums enum_value_idx; - enum setting_type type; - }; struct rarch_setting_info From 221939ccb5568ab37996d9e6bd5bd64fc525d613 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 00:53:13 +0200 Subject: [PATCH 030/253] Cleanups --- input/input_remote.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/input/input_remote.c b/input/input_remote.c index 307c73611b..e66b8f5ae0 100644 --- a/input/input_remote.c +++ b/input/input_remote.c @@ -48,30 +48,27 @@ struct remote_message { + uint16_t state; int port; int device; int index; int id; - uint16_t state; }; struct input_remote { - + bool state[RARCH_BIND_LIST_END]; #if defined(HAVE_NETWORKING) && defined(HAVE_NETWORKGAMEPAD) int net_fd[MAX_USERS]; #endif - - bool state[RARCH_BIND_LIST_END]; }; typedef struct input_remote_state { - /* This is a bitmask of (1 << key_bind_id). */ - uint64_t buttons[MAX_USERS]; /* Left X, Left Y, Right X, Right Y */ int16_t analog[4][MAX_USERS]; - + /* This is a bitmask of (1 << key_bind_id). */ + uint64_t buttons[MAX_USERS]; } input_remote_state_t; static input_remote_state_t remote_st_ptr; @@ -257,7 +254,7 @@ void input_remote_poll(input_remote_t *handle, unsigned max_users) else if ((ret != -1) || ((errno != EAGAIN) && (errno != ENOENT))) #endif { - input_state->buttons[user] = 0; + input_state->buttons[user] = 0; input_state->analog[0][user] = 0; input_state->analog[1][user] = 0; input_state->analog[2][user] = 0; From 9863afdbd0ca74fbe29b11b5eddd1b3fec80fd14 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 00:55:47 +0200 Subject: [PATCH 031/253] Cleanups --- movie.c | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/movie.c b/movie.c index fc769cd90c..dc16efe051 100644 --- a/movie.c +++ b/movie.c @@ -55,16 +55,16 @@ struct bsv_movie struct bsv_state { - /* Movie playback/recording support. */ - char movie_path[PATH_MAX_LENGTH]; - bool movie_playback; - bool eof_exit; - - /* Immediate playback/recording. */ - char movie_start_path[PATH_MAX_LENGTH]; bool movie_start_recording; bool movie_start_playback; + bool movie_playback; + bool eof_exit; bool movie_end; + + /* Movie playback/recording support. */ + char movie_path[PATH_MAX_LENGTH]; + /* Immediate playback/recording. */ + char movie_start_path[PATH_MAX_LENGTH]; }; static bsv_movie_t *bsv_movie_state_handle = NULL; @@ -104,12 +104,12 @@ static bool bsv_movie_init_playback(bsv_movie_t *handle, const char *path) state_size = swap_if_big32(header[STATE_SIZE_INDEX]); - #if 0 - RARCH_ERR("----- debug %u -----\n", header[0]); - RARCH_ERR("----- debug %u -----\n", header[1]); - RARCH_ERR("----- debug %u -----\n", header[2]); - RARCH_ERR("----- debug %u -----\n", header[3]); - #endif +#if 0 + RARCH_ERR("----- debug %u -----\n", header[0]); + RARCH_ERR("----- debug %u -----\n", header[1]); + RARCH_ERR("----- debug %u -----\n", header[2]); + RARCH_ERR("----- debug %u -----\n", header[3]); +#endif if (state_size) { @@ -265,7 +265,8 @@ void bsv_movie_set_frame_end(void) return; bsv_movie_state_handle->frame_ptr = - (bsv_movie_state_handle->frame_ptr + 1) & bsv_movie_state_handle->frame_mask; + (bsv_movie_state_handle->frame_ptr + 1) + & bsv_movie_state_handle->frame_mask; bsv_movie_state_handle->first_rewind = !bsv_movie_state_handle->did_rewind; @@ -293,7 +294,8 @@ static void bsv_movie_frame_rewind(bsv_movie_t *handle) * plus another. */ handle->frame_ptr = (handle->frame_ptr - (handle->first_rewind ? 1 : 2)) & handle->frame_mask; - filestream_seek(handle->file, handle->frame_pos[handle->frame_ptr], SEEK_SET); + filestream_seek(handle->file, + handle->frame_pos[handle->frame_ptr], SEEK_SET); } if (filestream_tell(handle->file) <= (long)handle->min_file_pos) @@ -360,7 +362,8 @@ bool bsv_movie_init(void) runloop_msg_queue_push( msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD), 1, 180, true); - RARCH_ERR("%s.\n", msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD)); + RARCH_ERR("%s.\n", + msg_hash_to_str(MSG_FAILED_TO_START_MOVIE_RECORD)); return ret; } @@ -375,7 +378,8 @@ bool bsv_movie_init(void) if (set_granularity) { settings_t *settings = config_get_ptr(); - configuration_set_uint(settings, settings->uints.rewind_granularity, 1); + configuration_set_uint(settings, + settings->uints.rewind_granularity, 1); } return ret; From b253ea7b08a06d497e7d7f35be31222a749e2e6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s?= Date: Wed, 27 Sep 2017 18:03:34 -0500 Subject: [PATCH 032/253] Move HAVE_KEYMAPPER --- Makefile.wiiu | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.wiiu b/Makefile.wiiu index 74e6a1fe3c..b31b5b7351 100644 --- a/Makefile.wiiu +++ b/Makefile.wiiu @@ -38,7 +38,7 @@ ifeq ($(GRIFFIN_BUILD), 1) OBJ += griffin/griffin.o DEFINES += -DHAVE_GRIFFIN=1 -DHAVE_MENU -DHAVE_RGUI -DHAVE_LIBRETRODB DEFINES += -DHAVE_ZLIB -DHAVE_RPNG -DHAVE_RJPEG -DHAVE_RBMP -DHAVE_RTGA -DWANT_ZLIB -DHAVE_CC_RESAMPLER - DEFINES += -DHAVE_STB_FONT -DHAVE_STB_VORBIS -DHAVE_LANGEXTRA -DHAVE_LIBRETRODB -DHAVE_NETWORKING -DHAVE_KEYMAPPER + DEFINES += -DHAVE_STB_FONT -DHAVE_STB_VORBIS -DHAVE_LANGEXTRA -DHAVE_LIBRETRODB -DHAVE_NETWORKING # DEFINES += -DWANT_IFADDRS # DEFINES += -DHAVE_FREETYPE DEFINES += -DHAVE_XMB -DHAVE_MATERIALUI @@ -62,7 +62,6 @@ else HAVE_LIBRETRODB = 1 HAVE_NETWORKING = 1 # WANT_IFADDRS = 1 - HAVE_KEYMAPPER = 1 include Makefile.common BLACKLIST := @@ -98,6 +97,7 @@ else OBJ += libretro-common/audio/dsp_filters/wahwah.o endif +DEFINES += -DHAVE_KEYMAPPER ifeq ($(strip $(DEVKITPPC)),) $(error "Please set DEVKITPPC in your environment. export DEVKITPPC=devkitPPC") From 72f42b602f9288f6ae1a25e332411c87e94e6151 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 01:37:39 +0200 Subject: [PATCH 033/253] menu_displaylist_info - reduce stack usage - exts no longer a fixed size path --- menu/cbs/menu_cbs_deferred_push.c | 111 +++++++++++++++------------ menu/drivers/xmb.c | 9 ++- menu/menu_displaylist.c | 120 +++++++++++++++++++++--------- menu/menu_displaylist.h | 2 +- menu/widgets/menu_dialog.c | 2 +- 5 files changed, 154 insertions(+), 90 deletions(-) diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index 155fa43f3d..54b255e574 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -629,10 +629,11 @@ end: static int general_push(menu_displaylist_info_t *info, unsigned id, enum menu_displaylist_ctl_state state) { - settings_t *settings = config_get_ptr(); - core_info_list_t *list = NULL; - menu_handle_t *menu = NULL; - rarch_system_info_t *system = runloop_get_system_info(); + settings_t *settings = config_get_ptr(); + char *newstring2 = NULL; + core_info_list_t *list = NULL; + menu_handle_t *menu = NULL; + rarch_system_info_t *system = runloop_get_system_info(); struct retro_system_info *system_menu = &system->info; if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) @@ -666,52 +667,60 @@ static int general_push(menu_displaylist_info_t *info, break; } + newstring2 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); + + newstring2[0] = '\0'; + switch (id) { case PUSH_ARCHIVE_OPEN: + if (system_menu && system_menu->valid_extensions) { if (*system_menu->valid_extensions) - strlcpy(info->exts, system_menu->valid_extensions, - sizeof(info->exts)); + strlcpy(newstring2, system_menu->valid_extensions, + PATH_MAX_LENGTH * sizeof(char)); } else - strlcpy(info->exts, system->valid_extensions, sizeof(info->exts)); + { + strlcpy(newstring2, system->valid_extensions, + PATH_MAX_LENGTH * sizeof(char)); + } break; case PUSH_DEFAULT: - if (menu_setting_get_browser_selection_type(info->setting) == ST_DIR) { - } - else if (system_menu && system_menu->valid_extensions) - { - if (*system_menu->valid_extensions) - strlcpy(info->exts, system_menu->valid_extensions, - sizeof(info->exts)); - } - else - { - if (!string_is_empty(system->valid_extensions)) - strlcpy(info->exts, system->valid_extensions, sizeof(info->exts)); - } - { - union string_list_elem_attr attr; - size_t path_size = PATH_MAX_LENGTH * sizeof(char); - char *newstring2 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - struct string_list *str_list3 = string_split(info->exts, "|"); + char *new_exts = info->exts; - newstring2[0] = '\0'; - attr.i = 0; + if (menu_setting_get_browser_selection_type(info->setting) == ST_DIR) + { + } + else if (system_menu && system_menu->valid_extensions) + { + if (*system_menu->valid_extensions) + new_exts = strdup(system_menu->valid_extensions); + } + else + { + if (!string_is_empty(system->valid_extensions)) + new_exts = strdup(system->valid_extensions); + } + + { + union string_list_elem_attr attr; + size_t path_size = PATH_MAX_LENGTH * sizeof(char); + struct string_list *str_list3 = string_split(new_exts, "|"); + + attr.i = 0; #ifdef HAVE_IBXM - string_list_append(str_list3, "s3m", attr); - string_list_append(str_list3, "mod", attr); - string_list_append(str_list3, "xm", attr); + string_list_append(str_list3, "s3m", attr); + string_list_append(str_list3, "mod", attr); + string_list_append(str_list3, "xm", attr); #endif - string_list_join_concat(newstring2, path_size, - str_list3, "|"); - string_list_free(str_list3); - strlcpy(info->exts, newstring2, sizeof(info->exts)); - free(newstring2); + string_list_join_concat(newstring2, path_size, + str_list3, "|"); + string_list_free(str_list3); + } } break; case PUSH_ARCHIVE_OPEN_DETECT_CORE: @@ -722,8 +731,8 @@ static int general_push(menu_displaylist_info_t *info, char *newstring = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); struct string_list *str_list2 = string_list_new(); - newstring[0] = '\0'; - attr.i = 0; + newstring[0] = '\0'; + attr.i = 0; if (system_menu && system_menu->valid_extensions) { @@ -765,14 +774,9 @@ static int general_push(menu_displaylist_info_t *info, string_list_join_concat(newstring, path_size, str_list2, "|"); - strlcpy(info->exts, newstring, sizeof(info->exts)); - { union string_list_elem_attr attr; - char *newstring2 = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); - struct string_list *str_list3 = string_split(info->exts, "|"); - - newstring2[0] = '\0'; + struct string_list *str_list3 = string_split(newstring, "|"); attr.i = 0; #ifdef HAVE_IBXM @@ -783,8 +787,6 @@ static int general_push(menu_displaylist_info_t *info, string_list_join_concat(newstring2, path_size, str_list3, "|"); string_list_free(str_list3); - strlcpy(info->exts, newstring2, sizeof(info->exts)); - free(newstring2); } free(newstring); string_list_free(str_list2); @@ -804,20 +806,31 @@ static int general_push(menu_displaylist_info_t *info, if (settings->bools.multimedia_builtin_mediaplayer_enable) { libretro_ffmpeg_retro_get_system_info(&sysinfo); - strlcat(info->exts, "|", sizeof(info->exts)); - strlcat(info->exts, sysinfo.valid_extensions, sizeof(info->exts)); + strlcat(newstring2, "|", PATH_MAX_LENGTH * sizeof(char)); + strlcat(newstring2, sysinfo.valid_extensions, + PATH_MAX_LENGTH * sizeof(char)); } #endif #ifdef HAVE_IMAGEVIEWER if (settings->bools.multimedia_builtin_imageviewer_enable) { libretro_imageviewer_retro_get_system_info(&sysinfo); - strlcat(info->exts, "|", sizeof(info->exts)); - strlcat(info->exts, sysinfo.valid_extensions, sizeof(info->exts)); + strlcat(newstring2, "|", + PATH_MAX_LENGTH * sizeof(char)); + strlcat(newstring2, sysinfo.valid_extensions, + PATH_MAX_LENGTH * sizeof(char)); } #endif } + if (!string_is_empty(newstring2)) + { + if (info->exts && !string_is_empty(info->exts)) + free(info->exts); + info->exts = strdup(newstring2); + } + free(newstring2); + return deferred_push_dlist(info, state); } diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 1aa3378f43..d9e46a4bc7 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1864,8 +1864,9 @@ static void xmb_init_horizontal_list(xmb_handle_t *xmb) strlcpy(info.label, msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST), sizeof(info.label)); - strlcpy(info.exts, - file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT), sizeof(info.exts)); + + info.exts = strdup( + file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT)); info.type_default = FILE_TYPE_PLAIN; info.enum_idx = MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST; @@ -4378,8 +4379,8 @@ static bool xmb_menu_init_list(void *data) strlcpy(info.label, msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU), sizeof(info.label)); - strlcpy(info.exts, - file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT), sizeof(info.exts)); + info.exts = + strdup(file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT)); info.type_default = FILE_TYPE_PLAIN; info.enum_idx = MENU_ENUM_LABEL_MAIN_MENU; diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 0af5161efa..12bf58dd6c 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -3989,9 +3989,12 @@ static bool menu_displaylist_push_internal( { filebrowser_clear_type(); info->type = 42; - strlcpy(info->exts, - file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT), - sizeof(info->exts)); + + if (info->exts && !string_is_empty(info->exts)) + free(info->exts); + + info->exts = strdup( + file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT)); strlcpy(info->label, msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST), sizeof(info->label)); @@ -4004,9 +4007,11 @@ static bool menu_displaylist_push_internal( { filebrowser_clear_type(); info->type = 42; - strlcpy(info->exts, - file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT), - sizeof(info->exts)); + + if (info->exts && !string_is_empty(info->exts)) + free(info->exts); + info->exts = strdup( + file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT)); strlcpy(info->label, msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST), sizeof(info->label)); @@ -4019,9 +4024,11 @@ static bool menu_displaylist_push_internal( { filebrowser_clear_type(); info->type = 42; - strlcpy(info->exts, - file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT), - sizeof(info->exts)); + + if (info->exts && !string_is_empty(info->exts)) + free(info->exts); + info->exts = strdup( + file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT)); strlcpy(info->label, msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST), sizeof(info->label)); @@ -4054,9 +4061,11 @@ static bool menu_displaylist_push_internal( filebrowser_clear_type(); info->type = 42; - strlcpy(info->exts, - file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT), - sizeof(info->exts)); + + if (info->exts && !string_is_empty(info->exts)) + free(info->exts); + info->exts = strdup( + file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT)); strlcpy(info->label, msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST), sizeof(info->label)); @@ -4302,6 +4311,9 @@ void menu_displaylist_info_free(menu_displaylist_info_t *info) { if (!info) return; + if (info->exts) + free(info->exts); + info->exts = NULL; #if 0 if (info->path) free(info->path); @@ -4309,14 +4321,11 @@ void menu_displaylist_info_free(menu_displaylist_info_t *info) free(info->path_b); if (info->path_c) free(info->path_c); - if (info->exts) - free(info->exts); if (info->label) free(info->label); info->path = NULL; info->path_b = NULL; info->path_c = NULL; - info->exts = NULL; info->label = NULL; #endif } @@ -4338,13 +4347,13 @@ void menu_displaylist_info_init(menu_displaylist_info_t *info) info->path[0] = '\0'; info->path_b[0] = '\0'; info->path_c[0] = '\0'; - info->exts[0] = '\0'; info->label[0] = '\0'; info->type = 0; info->type_default = 0; info->flags = 0; info->label_hash = 0; info->directory_ptr = 0; + info->exts = NULL; info->list = NULL; info->menu_list = NULL; info->setting = NULL; @@ -6627,9 +6636,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); filebrowser_clear_type(); info->type_default = FILE_TYPE_RDB; - strlcpy(info->exts, - file_path_str(FILE_PATH_RDB_EXTENSION), - sizeof(info->exts)); + if (info->exts && !string_is_empty(info->exts)) + free(info->exts); + info->exts = strdup( + file_path_str(FILE_PATH_RDB_EXTENSION)); info->enum_idx = MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST; load_content = false; use_filebrowser = true; @@ -6641,26 +6651,33 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) info->type_default = FILE_TYPE_CURSOR; load_content = false; use_filebrowser = true; - strlcpy(info->exts, "dbc", sizeof(info->exts)); + if (info->exts && !string_is_empty(info->exts)) + free(info->exts); + info->exts = strdup("dbc"); strlcpy(info->path, settings->paths.directory_cursor, sizeof(info->path)); break; case DISPLAYLIST_CONFIG_FILES: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); filebrowser_clear_type(); info->type_default = FILE_TYPE_CONFIG; - strlcpy(info->exts, "cfg", sizeof(info->exts)); + if (info->exts && !string_is_empty(info->exts)) + free(info->exts); + info->exts = strdup("cfg"); load_content = false; use_filebrowser = true; break; case DISPLAYLIST_SHADER_PRESET: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); { + char new_exts[PATH_MAX_LENGTH]; struct string_list *str_list; #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_VULKAN) union string_list_elem_attr attr; attr.i = 0; #endif - str_list = string_list_new(); + + new_exts[0] = '\0'; + str_list = string_list_new(); filebrowser_clear_type(); info->type_default = FILE_TYPE_SHADER_PRESET; @@ -6674,7 +6691,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) #ifdef HAVE_VULKAN string_list_append(str_list, "slangp", attr); #endif - string_list_join_concat(info->exts, sizeof(info->exts), str_list, "|"); + string_list_join_concat(new_exts, sizeof(new_exts), str_list, "|"); + if (info->exts && !string_is_empty(info->exts)) + free(info->exts); + info->exts = strdup(new_exts); string_list_free(str_list); use_filebrowser = true; } @@ -6682,13 +6702,15 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) case DISPLAYLIST_SHADER_PASS: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); { + char new_exts[PATH_MAX_LENGTH]; struct string_list *str_list; #if defined(HAVE_CG) || defined(HAVE_GLSL) || defined(HAVE_VULKAN) union string_list_elem_attr attr; attr.i = 0; #endif - str_list = string_list_new(); + new_exts[0] = '\0'; + str_list = string_list_new(); filebrowser_clear_type(); info->type_default = FILE_TYPE_SHADER; @@ -6703,7 +6725,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) #ifdef HAVE_VULKAN string_list_append(str_list, "slang", attr); #endif - string_list_join_concat(info->exts, sizeof(info->exts), str_list, "|"); + string_list_join_concat(new_exts, sizeof(new_exts), str_list, "|"); + if (info->exts && !string_is_empty(info->exts)) + free(info->exts); + info->exts = strdup(new_exts); string_list_free(str_list); use_filebrowser = true; } @@ -6714,7 +6739,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) info->type_default = FILE_TYPE_VIDEOFILTER; load_content = false; use_filebrowser = true; - strlcpy(info->exts, "filt", sizeof(info->exts)); + if (info->exts && !string_is_empty(info->exts)) + free(info->exts); + info->exts = strdup("filt"); break; case DISPLAYLIST_IMAGES: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); @@ -6723,10 +6750,12 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) filebrowser_clear_type(); info->type_default = FILE_TYPE_IMAGE; { + char new_exts[PATH_MAX_LENGTH]; union string_list_elem_attr attr; struct string_list *str_list = string_list_new(); attr.i = 0; + new_exts[0] = '\0'; #ifdef HAVE_RBMP string_list_append(str_list, "bmp", attr); @@ -6741,7 +6770,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) #ifdef HAVE_RTGA string_list_append(str_list, "tga", attr); #endif - string_list_join_concat(info->exts, sizeof(info->exts), str_list, "|"); + string_list_join_concat(new_exts, sizeof(new_exts), str_list, "|"); + if (info->exts && !string_is_empty(info->exts)) + free(info->exts); + info->exts = strdup(new_exts); string_list_free(str_list); } use_filebrowser = true; @@ -6776,7 +6808,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) info->type_default = FILE_TYPE_AUDIOFILTER; load_content = false; use_filebrowser = true; - strlcpy(info->exts, "dsp", sizeof(info->exts)); + if (info->exts && !string_is_empty(info->exts)) + free(info->exts); + info->exts = strdup("dsp"); break; case DISPLAYLIST_CHEAT_FILES: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); @@ -6784,14 +6818,18 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) info->type_default = FILE_TYPE_CHEAT; load_content = false; use_filebrowser = true; - strlcpy(info->exts, "cht", sizeof(info->exts)); + if (info->exts && !string_is_empty(info->exts)) + free(info->exts); + info->exts = strdup("cht"); break; case DISPLAYLIST_CONTENT_HISTORY: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); filebrowser_clear_type(); info->type_default = FILE_TYPE_PLAIN; use_filebrowser = true; - strlcpy(info->exts, "lpl", sizeof(info->exts)); + if (info->exts && !string_is_empty(info->exts)) + free(info->exts); + info->exts = strdup("lpl"); break; case DISPLAYLIST_FONTS: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); @@ -6799,7 +6837,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) info->type_default = FILE_TYPE_FONT; load_content = false; use_filebrowser = true; - strlcpy(info->exts, "ttf", sizeof(info->exts)); + if (info->exts && !string_is_empty(info->exts)) + free(info->exts); + info->exts = strdup("ttf"); break; case DISPLAYLIST_OVERLAYS: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); @@ -6807,7 +6847,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) info->type_default = FILE_TYPE_OVERLAY; load_content = false; use_filebrowser = true; - strlcpy(info->exts, "cfg", sizeof(info->exts)); + if (info->exts && !string_is_empty(info->exts)) + free(info->exts); + info->exts = strdup("cfg"); break; case DISPLAYLIST_RECORD_CONFIG_FILES: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); @@ -6815,7 +6857,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) info->type_default = FILE_TYPE_RECORD_CONFIG; load_content = false; use_filebrowser = true; - strlcpy(info->exts, "cfg", sizeof(info->exts)); + if (info->exts && !string_is_empty(info->exts)) + free(info->exts); + info->exts = strdup("cfg"); break; case DISPLAYLIST_REMAP_FILES: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); @@ -6823,7 +6867,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) info->type_default = FILE_TYPE_REMAP; load_content = false; use_filebrowser = true; - strlcpy(info->exts, "rmp", sizeof(info->exts)); + if (info->exts && !string_is_empty(info->exts)) + free(info->exts); + info->exts = strdup("rmp"); break; case DISPLAYLIST_DATABASE_PLAYLISTS_HORIZONTAL: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); @@ -6851,7 +6897,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) filebrowser_clear_type(); info->type_default = FILE_TYPE_PLAIN; if (frontend_driver_get_core_extension(ext_name, sizeof(ext_name))) - strlcpy(info->exts, ext_name, sizeof(info->exts)); + { + if (info->exts && !string_is_empty(info->exts)) + free(info->exts); + info->exts = strdup(ext_name); + } } if (menu_displaylist_parse_cores(menu, info) == 0) { diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 9bb023f082..62063a2ced 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -187,7 +187,7 @@ typedef struct menu_displaylist_info char path[PATH_MAX_LENGTH]; char path_b[PATH_MAX_LENGTH]; char path_c[PATH_MAX_LENGTH]; - char exts[PATH_MAX_LENGTH]; + char *exts; char label[255]; unsigned type; unsigned type_default; diff --git a/menu/widgets/menu_dialog.c b/menu/widgets/menu_dialog.c index b3f078bcad..d39e813dab 100644 --- a/menu/widgets/menu_dialog.c +++ b/menu/widgets/menu_dialog.c @@ -272,7 +272,7 @@ void menu_dialog_push(void) info.path_c[0] = '\0'; info.label[0] = '\0'; info.label_hash = 0; - info.exts[0] = '\0'; + info.exts = NULL; info.type = 0; info.type_default = 0; info.directory_ptr = 0; From 72087d17493f6ac6b2bbdc3c51fd0e1bab5dc4cc Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 02:30:31 +0200 Subject: [PATCH 034/253] Rewrite path_b and path_c --- menu/cbs/menu_cbs_deferred_push.c | 39 ++++++++++++++++++++++++------- menu/menu_displaylist.c | 16 ++++++------- menu/menu_displaylist.h | 4 ++-- menu/widgets/menu_dialog.c | 20 ++-------------- 4 files changed, 43 insertions(+), 36 deletions(-) diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index 54b255e574..967a750fb6 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -282,8 +282,13 @@ static int deferred_push_core_collection_list_deferred( static int deferred_push_database_manager_list_deferred( menu_displaylist_info_t *info) { - strlcpy(info->path_b, info->path, sizeof(info->path_b)); - info->path_c[0] = '\0'; + if (info->path_b && !string_is_empty(info->path_b)) + free(info->path_b); + if (info->path_c && !string_is_empty(info->path_c)) + free(info->path_c); + + info->path_b = strdup(info->path); + info->path_c = NULL; return deferred_push_dlist(info, DISPLAYLIST_DATABASE_QUERY); } @@ -458,9 +463,15 @@ static int deferred_push_cursor_manager_list_deferred( settings->paths.path_content_database, rdb, sizeof(rdb_path)); - strlcpy(info->path_b, info->path, sizeof(info->path_b)); + if (info->path_b && !string_is_empty(info->path_b)) + free(info->path_b); + if (info->path_c && !string_is_empty(info->path_c)) + free(info->path_c); + + info->path_b = strdup(info->path); + info->path_c = strdup(query); + strlcpy(info->path, rdb_path, sizeof(info->path)); - strlcpy(info->path_c, query, sizeof(info->path_c)); ret = deferred_push_dlist(info, DISPLAYLIST_DATABASE_QUERY); @@ -488,9 +499,15 @@ static int deferred_push_cursor_manager_list_generic( if (string_is_empty(query)) goto end; + if (info->path_b && !string_is_empty(info->path_b)) + free(info->path_b); + if (info->path_c && !string_is_empty(info->path_c)) + free(info->path_c); + strlcpy(info->path, str_list->elems[1].data, sizeof(info->path)); - strlcpy(info->path_b, str_list->elems[0].data, sizeof(info->path_b)); - strlcpy(info->path_c, query, sizeof(info->path_c)); + + info->path_b = strdup(str_list->elems[0].data); + info->path_c = strdup(query); ret = deferred_push_dlist(info, DISPLAYLIST_DATABASE_QUERY); @@ -614,8 +631,14 @@ static int deferred_push_cursor_manager_list_deferred_query_subsearch( goto end; strlcpy(info->path, str_list->elems[1].data, sizeof(info->path)); - strlcpy(info->path_b, str_list->elems[0].data, sizeof(info->path_b)); - strlcpy(info->path_c, query, sizeof(info->path_c)); + + if (info->path_b && !string_is_empty(info->path_b)) + free(info->path_b); + info->path_b = strdup(str_list->elems[0].data); + + if (info->path_c && !string_is_empty(info->path_c)) + free(info->path_c); + info->path_c = strdup(query); ret = deferred_push_dlist(info, DISPLAYLIST_DATABASE_QUERY); diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 12bf58dd6c..abc3be0e43 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -4313,19 +4313,19 @@ void menu_displaylist_info_free(menu_displaylist_info_t *info) return; if (info->exts) free(info->exts); - info->exts = NULL; -#if 0 - if (info->path) - free(info->path); if (info->path_b) free(info->path_b); if (info->path_c) free(info->path_c); + info->exts = NULL; + info->path_b = NULL; + info->path_c = NULL; +#if 0 + if (info->path) + free(info->path); if (info->label) free(info->label); info->path = NULL; - info->path_b = NULL; - info->path_c = NULL; info->label = NULL; #endif } @@ -4345,14 +4345,14 @@ void menu_displaylist_info_init(menu_displaylist_info_t *info) info->download_core = false; info->need_navigation_clear = false; info->path[0] = '\0'; - info->path_b[0] = '\0'; - info->path_c[0] = '\0'; info->label[0] = '\0'; info->type = 0; info->type_default = 0; info->flags = 0; info->label_hash = 0; info->directory_ptr = 0; + info->path_b = NULL; + info->path_c = NULL; info->exts = NULL; info->list = NULL; info->menu_list = NULL; diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 62063a2ced..4dcfc0c411 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -185,8 +185,8 @@ typedef struct menu_displaylist_info bool need_navigation_clear; char path[PATH_MAX_LENGTH]; - char path_b[PATH_MAX_LENGTH]; - char path_c[PATH_MAX_LENGTH]; + char *path_b; + char *path_c; char *exts; char label[255]; unsigned type; diff --git a/menu/widgets/menu_dialog.c b/menu/widgets/menu_dialog.c index d39e813dab..b0710b5673 100644 --- a/menu/widgets/menu_dialog.c +++ b/menu/widgets/menu_dialog.c @@ -259,26 +259,10 @@ void menu_dialog_push(void) if (!menu_dialog_is_push_pending()) return; - info.need_sort = false; - info.need_refresh = false; - info.need_entries_refresh = false; - info.need_push = false; - info.need_clear = false; - info.need_navigation_clear= false; + menu_displaylist_info_init(&info); + info.list = menu_entries_get_menu_stack_ptr(0); - info.menu_list = NULL; - info.path[0] = '\0'; - info.path_b[0] = '\0'; - info.path_c[0] = '\0'; - info.label[0] = '\0'; - info.label_hash = 0; - info.exts = NULL; - info.type = 0; - info.type_default = 0; - info.directory_ptr = 0; - info.flags = 0; info.enum_idx = MENU_ENUM_LABEL_HELP; - info.setting = NULL; strlcpy(info.label, msg_hash_to_str(MENU_ENUM_LABEL_HELP), From 08ecfc74ec464684024ed059215ca8bdaa2acbfe Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 02:45:03 +0200 Subject: [PATCH 035/253] Rewrite info.label --- menu/cbs/menu_cbs_info.c | 5 +-- menu/cbs/menu_cbs_ok.c | 2 +- menu/drivers/menu_generic.c | 4 +- menu/drivers/nuklear.c | 4 +- menu/drivers/xmb.c | 9 ++-- menu/drivers/zarch.c | 4 +- menu/menu_displaylist.c | 63 +++++++++++++++++---------- menu/menu_displaylist.h | 2 +- menu/menu_setting.c | 7 ++- menu/widgets/menu_dialog.c | 6 +-- menu/widgets/menu_input_bind_dialog.c | 9 ++-- 11 files changed, 62 insertions(+), 53 deletions(-) diff --git a/menu/cbs/menu_cbs_info.c b/menu/cbs/menu_cbs_info.c index 213ac38d60..076818b8bf 100644 --- a/menu/cbs/menu_cbs_info.c +++ b/menu/cbs/menu_cbs_info.c @@ -41,9 +41,8 @@ static int action_info_default(unsigned type, const char *label) info.list = menu_stack; info.directory_ptr = selection; info.enum_idx = MENU_ENUM_LABEL_INFO_SCREEN; - strlcpy(info.label, - msg_hash_to_str(MENU_ENUM_LABEL_INFO_SCREEN), - sizeof(info.label)); + info.label = strdup( + msg_hash_to_str(MENU_ENUM_LABEL_INFO_SCREEN)); if (!menu_displaylist_ctl(DISPLAYLIST_HELP, &info)) goto error; diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index e336eca9a2..be0015243b 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -875,7 +875,7 @@ int generic_action_ok_displaylist_push(const char *path, } if (info_label) - strlcpy(info.label, info_label, sizeof(info.label)); + info.label = strdup(info_label); if (info_path) strlcpy(info.path, info_path, sizeof(info.path)); diff --git a/menu/drivers/menu_generic.c b/menu/drivers/menu_generic.c index ce8a61e5d4..39b25f678e 100644 --- a/menu/drivers/menu_generic.c +++ b/menu/drivers/menu_generic.c @@ -266,8 +266,8 @@ bool generic_menu_init_list(void *data) menu_displaylist_info_init(&info); - strlcpy(info.label, - msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU), sizeof(info.label)); + info.label = strdup( + msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU)); info.enum_idx = MENU_ENUM_LABEL_MAIN_MENU; menu_entries_append_enum(menu_stack, info.path, diff --git a/menu/drivers/nuklear.c b/menu/drivers/nuklear.c index 433944c768..d863556794 100644 --- a/menu/drivers/nuklear.c +++ b/menu/drivers/nuklear.c @@ -464,8 +464,8 @@ static bool nk_menu_init_list(void *data) menu_displaylist_info_init(&info); - strlcpy(info.label, - msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB), sizeof(info.label)); + info.label = strdup( + msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)); info.enum_idx = MENU_ENUM_LABEL_HISTORY_TAB; menu_entries_append_enum(menu_stack, diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index d9e46a4bc7..ddd6b2fa09 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1861,10 +1861,9 @@ static void xmb_init_horizontal_list(xmb_handle_t *xmb) info.list = xmb->horizontal_list; strlcpy(info.path, settings->paths.directory_playlist, sizeof(info.path)); - strlcpy(info.label, - msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST), - sizeof(info.label)); + info.label = strdup( + msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST)); info.exts = strdup( file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT)); info.type_default = FILE_TYPE_PLAIN; @@ -4377,8 +4376,8 @@ static bool xmb_menu_init_list(void *data) menu_displaylist_info_init(&info); - strlcpy(info.label, - msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU), sizeof(info.label)); + info.label = strdup( + msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU)); info.exts = strdup(file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT)); info.type_default = FILE_TYPE_PLAIN; diff --git a/menu/drivers/zarch.c b/menu/drivers/zarch.c index 9ee54f4097..036d07fb8f 100644 --- a/menu/drivers/zarch.c +++ b/menu/drivers/zarch.c @@ -1130,8 +1130,8 @@ static bool zarch_menu_init_list(void *data) menu_displaylist_info_free(&info); - strlcpy(info.label, - msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB), sizeof(info.label)); + info.label = strdup( + msg_hash_to_str(MENU_ENUM_LABEL_HISTORY_TAB)); info.enum_idx = MENU_ENUM_LABEL_HISTORY_TAB; menu_entries_append_enum(menu_stack, diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index abc3be0e43..54ec402b66 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -3992,12 +3992,13 @@ static bool menu_displaylist_push_internal( if (info->exts && !string_is_empty(info->exts)) free(info->exts); + if (info->label && !string_is_empty(info->label)) + free(info->label); - info->exts = strdup( + info->exts = strdup( file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT)); - strlcpy(info->label, - msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST), - sizeof(info->label)); + info->label = strdup( + msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST)); menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); menu_displaylist_ctl(DISPLAYLIST_MUSIC_HISTORY, info); @@ -4010,11 +4011,13 @@ static bool menu_displaylist_push_internal( if (info->exts && !string_is_empty(info->exts)) free(info->exts); - info->exts = strdup( + if (info->label && !string_is_empty(info->label)) + free(info->label); + + info->exts = strdup( file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT)); - strlcpy(info->label, - msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST), - sizeof(info->label)); + info->label = strdup( + msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST)); menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); menu_displaylist_ctl(DISPLAYLIST_VIDEO_HISTORY, info); @@ -4027,11 +4030,13 @@ static bool menu_displaylist_push_internal( if (info->exts && !string_is_empty(info->exts)) free(info->exts); - info->exts = strdup( + if (info->label && !string_is_empty(info->label)) + free(info->label); + + info->exts = strdup( file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT)); - strlcpy(info->label, - msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST), - sizeof(info->label)); + info->label = strdup( + msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST)); menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); @@ -4064,11 +4069,13 @@ static bool menu_displaylist_push_internal( if (info->exts && !string_is_empty(info->exts)) free(info->exts); + if (info->label && !string_is_empty(info->label)) + free(info->label); + info->exts = strdup( file_path_str(FILE_PATH_LPL_EXTENSION_NO_DOT)); - strlcpy(info->label, - msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST), - sizeof(info->label)); + info->label = strdup( + msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST)); if (string_is_empty(settings->paths.directory_playlist)) { @@ -4141,10 +4148,10 @@ bool menu_displaylist_push(menu_displaylist_ctx_entry_t *entry) strlcpy(info.path, path, sizeof(info.path)); if (!string_is_empty(label)) - strlcpy(info.label, label, sizeof(info.label)); + info.label = strdup(label); if (!info.list) - return false; + goto error; if (menu_displaylist_push_internal(label, entry, &info)) return menu_displaylist_process(&info); @@ -4154,10 +4161,15 @@ bool menu_displaylist_push(menu_displaylist_ctx_entry_t *entry) if (cbs && cbs->action_deferred_push) { if (cbs->action_deferred_push(&info) != 0) - return -1; + goto error; } return true; + +error: + if (info.label) + free(info.label); + return false; } static void menu_displaylist_parse_playlist_history( @@ -4317,16 +4329,16 @@ void menu_displaylist_info_free(menu_displaylist_info_t *info) free(info->path_b); if (info->path_c) free(info->path_c); + if (info->label) + free(info->label); info->exts = NULL; info->path_b = NULL; info->path_c = NULL; + info->label = NULL; #if 0 if (info->path) free(info->path); - if (info->label) - free(info->label); info->path = NULL; - info->label = NULL; #endif } @@ -4345,12 +4357,12 @@ void menu_displaylist_info_init(menu_displaylist_info_t *info) info->download_core = false; info->need_navigation_clear = false; info->path[0] = '\0'; - info->label[0] = '\0'; info->type = 0; info->type_default = 0; info->flags = 0; info->label_hash = 0; info->directory_ptr = 0; + info->label = NULL; info->path_b = NULL; info->path_c = NULL; info->exts = NULL; @@ -4439,8 +4451,11 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) strlcpy(info->path_b, str_list->elems[1].data, sizeof(info->path_b)); - strlcpy(info->label, - str_list->elems[0].data, sizeof(info->label)); + + if (info->label && !string_is_empty(info->label)) + free(info->label); + + info->label = strdup(str_list->elems[0].data); string_list_free(str_list); } diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 4dcfc0c411..2a12c9161f 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -188,7 +188,7 @@ typedef struct menu_displaylist_info char *path_b; char *path_c; char *exts; - char label[255]; + char *label; unsigned type; unsigned type_default; unsigned flags; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index 552618fe70..a758531152 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -770,7 +770,7 @@ int menu_action_handle_setting(rarch_setting_t *setting, menu_displaylist_info_init(&info); strlcpy(info.path, setting->default_value.string, sizeof(info.path)); - strlcpy(info.label, name, sizeof(info.label)); + info.label = strdup(name); info.type = type; info.directory_ptr = selection; info.list = menu_stack; @@ -1674,9 +1674,8 @@ void general_write_handler(void *data) menu_displaylist_info_init(&info); info.enum_idx = MENU_ENUM_LABEL_HELP; - strlcpy(info.label, - msg_hash_to_str(MENU_ENUM_LABEL_HELP), - sizeof(info.label)); + info.label = strdup( + msg_hash_to_str(MENU_ENUM_LABEL_HELP)); info.list = menu_stack; if (menu_displaylist_ctl(DISPLAYLIST_GENERIC, &info)) diff --git a/menu/widgets/menu_dialog.c b/menu/widgets/menu_dialog.c index b0710b5673..4e4ecb065b 100644 --- a/menu/widgets/menu_dialog.c +++ b/menu/widgets/menu_dialog.c @@ -263,10 +263,8 @@ void menu_dialog_push(void) info.list = menu_entries_get_menu_stack_ptr(0); info.enum_idx = MENU_ENUM_LABEL_HELP; - - strlcpy(info.label, - msg_hash_to_str(MENU_ENUM_LABEL_HELP), - sizeof(info.label)); + info.label = strdup( + msg_hash_to_str(MENU_ENUM_LABEL_HELP)); menu_displaylist_ctl(DISPLAYLIST_HELP, &info); } diff --git a/menu/widgets/menu_input_bind_dialog.c b/menu/widgets/menu_input_bind_dialog.c index 025e94166f..960110fcb8 100644 --- a/menu/widgets/menu_input_bind_dialog.c +++ b/menu/widgets/menu_input_bind_dialog.c @@ -110,8 +110,8 @@ static int menu_input_key_bind_set_mode_common( info.type = MENU_SETTINGS_CUSTOM_BIND_KEYBOARD; info.directory_ptr = selection; info.enum_idx = MENU_ENUM_LABEL_CUSTOM_BIND; - strlcpy(info.label, - msg_hash_to_str(MENU_ENUM_LABEL_CUSTOM_BIND), sizeof(info.label)); + info.label = strdup( + msg_hash_to_str(MENU_ENUM_LABEL_CUSTOM_BIND)); if (menu_displaylist_ctl(DISPLAYLIST_INFO, &info)) menu_displaylist_process(&info); menu_displaylist_info_free(&info); @@ -125,9 +125,8 @@ static int menu_input_key_bind_set_mode_common( info.type = MENU_SETTINGS_CUSTOM_BIND_KEYBOARD; info.directory_ptr = selection; info.enum_idx = MENU_ENUM_LABEL_CUSTOM_BIND_ALL; - strlcpy(info.label, - msg_hash_to_str(MENU_ENUM_LABEL_CUSTOM_BIND_ALL), - sizeof(info.label)); + info.label = strdup( + msg_hash_to_str(MENU_ENUM_LABEL_CUSTOM_BIND_ALL)); if (menu_displaylist_ctl(DISPLAYLIST_INFO, &info)) menu_displaylist_process(&info); From 8b5f8d8c641be6833ddc4c2b29697305d003aad2 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 03:06:54 +0200 Subject: [PATCH 036/253] menu_displaylist_info - rewrite path --- menu/cbs/menu_cbs_deferred_push.c | 55 +++++++++++++++++++-------- menu/cbs/menu_cbs_ok.c | 2 +- menu/drivers/menu_generic.c | 3 +- menu/drivers/xmb.c | 4 +- menu/menu_displaylist.c | 63 ++++++++++++++++++------------- menu/menu_displaylist.h | 2 +- menu/menu_setting.c | 2 +- menu/widgets/menu_filebrowser.c | 11 +++--- 8 files changed, 88 insertions(+), 54 deletions(-) diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index 967a750fb6..fb2ff52f5c 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -446,7 +446,8 @@ static int deferred_push_cursor_manager_list_deferred( char *query = NULL; char *rdb = NULL; settings_t *settings = config_get_ptr(); - config_file_t *conf = config_file_new(info->path); + const char *path = info->path; + config_file_t *conf = path ? config_file_new(path) : NULL; if (!conf || !settings) goto end; @@ -467,13 +468,14 @@ static int deferred_push_cursor_manager_list_deferred( free(info->path_b); if (info->path_c && !string_is_empty(info->path_c)) free(info->path_c); + if (info->path && !string_is_empty(info->path)) + free(info->path); info->path_b = strdup(info->path); info->path_c = strdup(query); + info->path = strdup(rdb_path); - strlcpy(info->path, rdb_path, sizeof(info->path)); - - ret = deferred_push_dlist(info, DISPLAYLIST_DATABASE_QUERY); + ret = deferred_push_dlist(info, DISPLAYLIST_DATABASE_QUERY); end: if (conf) @@ -488,9 +490,13 @@ end: static int deferred_push_cursor_manager_list_generic( menu_displaylist_info_t *info, enum database_query_type type) { - int ret = -1; char query[PATH_MAX_LENGTH]; - struct string_list *str_list = string_split(info->path, "|"); + int ret = -1; + const char *path = info->path; + struct string_list *str_list = path ? string_split(path, "|") : NULL; + + if (!str_list) + goto end; query[0] = '\0'; @@ -503,9 +509,10 @@ static int deferred_push_cursor_manager_list_generic( free(info->path_b); if (info->path_c && !string_is_empty(info->path_c)) free(info->path_c); + if (info->path && !string_is_empty(info->path)) + free(info->path); - strlcpy(info->path, str_list->elems[1].data, sizeof(info->path)); - + info->path = strdup(str_list->elems[1].data); info->path_b = strdup(str_list->elems[0].data); info->path_c = strdup(query); @@ -630,14 +637,14 @@ static int deferred_push_cursor_manager_list_deferred_query_subsearch( if (string_is_empty(query)) goto end; - strlcpy(info->path, str_list->elems[1].data, sizeof(info->path)); - + if (info->path && !string_is_empty(info->path)) + free(info->path); if (info->path_b && !string_is_empty(info->path_b)) free(info->path_b); - info->path_b = strdup(str_list->elems[0].data); - if (info->path_c && !string_is_empty(info->path_c)) free(info->path_c); + info->path = strdup(str_list->elems[1].data); + info->path_b = strdup(str_list->elems[0].data); info->path_c = strdup(query); ret = deferred_push_dlist(info, DISPLAYLIST_DATABASE_QUERY); @@ -670,10 +677,26 @@ static int general_push(menu_displaylist_info_t *info, case PUSH_DETECT_CORE_LIST: break; default: - fill_pathname_join(info->path, menu->scratch2_buf, - menu->scratch_buf, sizeof(info->path)); - fill_pathname_join(info->label, menu->scratch2_buf, - menu->scratch_buf, sizeof(info->label)); + { + char tmp_str[PATH_MAX_LENGTH]; + char tmp_str2[PATH_MAX_LENGTH]; + + tmp_str[0] = '\0'; + tmp_str2[0] = '\0'; + + fill_pathname_join(tmp_str, menu->scratch2_buf, + menu->scratch_buf, sizeof(tmp_str)); + fill_pathname_join(tmp_str2, menu->scratch2_buf, + menu->scratch_buf, sizeof(tmp_str2)); + + if (info->path && !string_is_empty(info->path)) + free(info->path); + if (info->label && !string_is_empty(info->label)) + free(info->label); + + info->path = strdup(tmp_str); + info->label = strdup(tmp_str2); + } break; } diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index be0015243b..07d5c459b4 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -877,7 +877,7 @@ int generic_action_ok_displaylist_push(const char *path, if (info_label) info.label = strdup(info_label); if (info_path) - strlcpy(info.path, info_path, sizeof(info.path)); + info.path = strdup(info_path); if (menu_displaylist_ctl(dl_type, &info)) { diff --git a/menu/drivers/menu_generic.c b/menu/drivers/menu_generic.c index 39b25f678e..84672c084d 100644 --- a/menu/drivers/menu_generic.c +++ b/menu/drivers/menu_generic.c @@ -270,7 +270,8 @@ bool generic_menu_init_list(void *data) msg_hash_to_str(MENU_ENUM_LABEL_MAIN_MENU)); info.enum_idx = MENU_ENUM_LABEL_MAIN_MENU; - menu_entries_append_enum(menu_stack, info.path, + menu_entries_append_enum(menu_stack, + info.path, info.label, MENU_ENUM_LABEL_MAIN_MENU, info.type, info.flags, 0); diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index ddd6b2fa09..520d63dd51 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1860,8 +1860,8 @@ static void xmb_init_horizontal_list(xmb_handle_t *xmb) menu_displaylist_info_init(&info); info.list = xmb->horizontal_list; - strlcpy(info.path, settings->paths.directory_playlist, sizeof(info.path)); - + info.path = strdup( + settings->paths.directory_playlist); info.label = strdup( msg_hash_to_str(MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST)); info.exts = strdup( diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 54ec402b66..c2a2106114 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1573,9 +1573,10 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, fill_buf[0] = path_copy[0] = '\0'; - strlcpy(path_copy, info->path, path_size); + if (info->path && !string_is_empty(info->path)) + strlcpy(path_copy, info->path, path_size); - path = path_copy; + path = path_copy; playlist_get_index(playlist, i, &path, &label, NULL, &core_name, NULL, NULL); @@ -3558,8 +3559,9 @@ static int menu_displaylist_parse_playlists( struct string_list *str_list = NULL; unsigned items_found = 0; settings_t *settings = config_get_ptr(); + const char *path = info->path; - if (string_is_empty(info->path)) + if (string_is_empty(path)) { if (frontend_driver_parse_drive_list(info->list, true) != 0) menu_entries_append_enum(info->list, "/", "", @@ -3567,7 +3569,7 @@ static int menu_displaylist_parse_playlists( return 0; } - str_list = dir_list_new(info->path, NULL, true, settings->bools.show_hidden_files, true, false); + str_list = dir_list_new(path, NULL, true, settings->bools.show_hidden_files, true, false); if (!str_list) { @@ -3662,7 +3664,7 @@ static int menu_displaylist_parse_playlists( file_type = FILE_TYPE_PLAYLIST_COLLECTION; - if (!string_is_empty(info->path)) + if (!string_is_empty(path)) path = path_basename(path); items_found++; @@ -3695,8 +3697,9 @@ static int menu_displaylist_parse_cores( struct string_list *str_list = NULL; unsigned items_found = 0; settings_t *settings = config_get_ptr(); + const char *path = info->path; - if (string_is_empty(info->path)) + if (string_is_empty(path)) { if (frontend_driver_parse_drive_list(info->list, true) != 0) menu_entries_append_enum(info->list, "/", "", @@ -3704,7 +3707,7 @@ static int menu_displaylist_parse_cores( return 0; } - str_list = dir_list_new(info->path, info->exts, + str_list = dir_list_new(path, info->exts, true, settings->bools.show_hidden_files, true, false); { @@ -3712,14 +3715,14 @@ static int menu_displaylist_parse_cores( out_dir[0] = '\0'; - fill_pathname_parent_dir(out_dir, info->path, + fill_pathname_parent_dir(out_dir, path, PATH_MAX_LENGTH * sizeof(char)); if (string_is_empty(out_dir)) { menu_entries_prepend(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PARENT_DIRECTORY), - info->path, + path, MENU_ENUM_LABEL_PARENT_DIRECTORY, FILE_TYPE_PARENT_DIRECTORY, 0, 0); } @@ -3787,7 +3790,7 @@ static int menu_displaylist_parse_cores( /* Need to preserve slash first time. */ path = str_list->elems[i].data; - if (!string_is_empty(info->path)) + if (!string_is_empty(path)) path = path_basename(path); #ifndef HAVE_DYNAMIC @@ -4094,10 +4097,10 @@ static bool menu_displaylist_push_internal( } else { - strlcpy( - info->path, - settings->paths.directory_playlist, - sizeof(info->path)); + if (info->path && !string_is_empty(info->path)) + free(info->path); + + info->path = strdup(settings->paths.directory_playlist); if (menu_displaylist_ctl( DISPLAYLIST_DATABASE_PLAYLISTS, info)) @@ -4145,7 +4148,7 @@ bool menu_displaylist_push(menu_displaylist_ctx_entry_t *entry) info.enum_idx = enum_idx; if (!string_is_empty(path)) - strlcpy(info.path, path, sizeof(info.path)); + info.path = strdup(path); if (!string_is_empty(label)) info.label = strdup(label); @@ -4167,6 +4170,8 @@ bool menu_displaylist_push(menu_displaylist_ctx_entry_t *entry) return true; error: + if (info.path) + free(info.path); if (info.label) free(info.label); return false; @@ -4331,15 +4336,13 @@ void menu_displaylist_info_free(menu_displaylist_info_t *info) free(info->path_c); if (info->label) free(info->label); + if (info->path) + free(info->path); info->exts = NULL; info->path_b = NULL; info->path_c = NULL; info->label = NULL; -#if 0 - if (info->path) - free(info->path); info->path = NULL; -#endif } void menu_displaylist_info_init(menu_displaylist_info_t *info) @@ -4356,13 +4359,13 @@ void menu_displaylist_info_init(menu_displaylist_info_t *info) info->push_builtin_cores = false; info->download_core = false; info->need_navigation_clear = false; - info->path[0] = '\0'; info->type = 0; info->type_default = 0; info->flags = 0; info->label_hash = 0; info->directory_ptr = 0; info->label = NULL; + info->path = NULL; info->path_b = NULL; info->path_c = NULL; info->exts = NULL; @@ -4449,13 +4452,13 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) if (!str_list) return false; - strlcpy(info->path_b, - str_list->elems[1].data, sizeof(info->path_b)); - + if (info->path_b && !string_is_empty(info->path_b)) + free(info->path_b); if (info->label && !string_is_empty(info->label)) free(info->label); - info->label = strdup(str_list->elems[0].data); + info->path_b = strdup(str_list->elems[1].data); + info->label = strdup(str_list->elems[0].data); string_list_free(str_list); } @@ -4477,7 +4480,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) #else ret = 0; #endif - strlcpy(info->path, info->path_b, sizeof(info->path)); + if (info->path && !string_is_empty(info->path)) + free(info->path); + info->path = strdup(info->path_b); info->need_sort = true; info->need_refresh = true; @@ -6658,7 +6663,9 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) info->enum_idx = MENU_ENUM_LABEL_CONTENT_COLLECTION_LIST; load_content = false; use_filebrowser = true; - strlcpy(info->path, settings->paths.path_content_database, sizeof(info->path)); + if (info->path) + free(info->path); + info->path = strdup(settings->paths.path_content_database); break; case DISPLAYLIST_DATABASE_CURSORS: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); @@ -6668,8 +6675,10 @@ bool menu_displaylist_ctl(enum menu_displaylist_ctl_state type, void *data) use_filebrowser = true; if (info->exts && !string_is_empty(info->exts)) free(info->exts); + if (info->path) + free(info->path); info->exts = strdup("dbc"); - strlcpy(info->path, settings->paths.directory_cursor, sizeof(info->path)); + info->path = strdup(settings->paths.directory_cursor); break; case DISPLAYLIST_CONFIG_FILES: menu_entries_ctl(MENU_ENTRIES_CTL_CLEAR, info->list); diff --git a/menu/menu_displaylist.h b/menu/menu_displaylist.h index 2a12c9161f..2dd05054f3 100644 --- a/menu/menu_displaylist.h +++ b/menu/menu_displaylist.h @@ -184,7 +184,7 @@ typedef struct menu_displaylist_info /* does the navigation index need to be cleared to 0 (first entry) ? */ bool need_navigation_clear; - char path[PATH_MAX_LENGTH]; + char *path; char *path_b; char *path_c; char *exts; diff --git a/menu/menu_setting.c b/menu/menu_setting.c index a758531152..68da07a0dc 100644 --- a/menu/menu_setting.c +++ b/menu/menu_setting.c @@ -769,7 +769,7 @@ int menu_action_handle_setting(rarch_setting_t *setting, menu_displaylist_info_init(&info); - strlcpy(info.path, setting->default_value.string, sizeof(info.path)); + info.path = strdup(setting->default_value.string); info.label = strdup(name); info.type = type; info.directory_ptr = selection; diff --git a/menu/widgets/menu_filebrowser.c b/menu/widgets/menu_filebrowser.c index 0d811bb234..348e86e79c 100644 --- a/menu/widgets/menu_filebrowser.c +++ b/menu/widgets/menu_filebrowser.c @@ -63,7 +63,8 @@ void filebrowser_parse(void *data, unsigned type_data) menu_displaylist_info_t *info = (menu_displaylist_info_t*)data; enum menu_displaylist_ctl_state type = (enum menu_displaylist_ctl_state) type_data; - bool path_is_compressed = path_is_compressed_file(info->path); + const char *path = info->path; + bool path_is_compressed = path ? path_is_compressed_file(path) : false; bool filter_ext = settings->bools.menu_navigation_browser_filter_supported_extensions_enable; @@ -73,9 +74,9 @@ void filebrowser_parse(void *data, unsigned type_data) filter_ext = false; if (path_is_compressed) - str_list = file_archive_get_file_list(info->path, info->exts); + str_list = file_archive_get_file_list(path, info->exts); else - str_list = dir_list_new(info->path, + str_list = dir_list_new(path, filter_ext ? info->exts : NULL, true, settings->bools.show_hidden_files, true, false); @@ -171,7 +172,7 @@ void filebrowser_parse(void *data, unsigned type_data) /* Need to preserve slash first time. */ - if (!string_is_empty(info->path) && !path_is_compressed) + if (!string_is_empty(path) && !path_is_compressed) path = path_basename(path); if (filebrowser_types == FILEBROWSER_SELECT_COLLECTION) @@ -266,7 +267,7 @@ void filebrowser_parse(void *data, unsigned type_data) end: menu_entries_prepend(info->list, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_PARENT_DIRECTORY), - info->path, + path, MENU_ENUM_LABEL_PARENT_DIRECTORY, FILE_TYPE_PARENT_DIRECTORY, 0, 0); } From 59e442419e50f02221f56d32d2a91b7beca3db4e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 03:16:00 +0200 Subject: [PATCH 037/253] Fix some leaks --- menu/menu_displaylist.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index c2a2106114..66f21d8d8c 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -1617,6 +1617,8 @@ static int menu_displaylist_parse_playlist(menu_displaylist_info_t *info, snprintf(tmp, path_size, " (%s)", core_name); strlcat(fill_buf, tmp, path_size); + + free(tmp); } } @@ -4157,7 +4159,13 @@ bool menu_displaylist_push(menu_displaylist_ctx_entry_t *entry) goto error; if (menu_displaylist_push_internal(label, entry, &info)) + { + if (info.path && !string_is_empty(info.path)) + free(info.path); + if (info.label && !string_is_empty(info.label)) + free(info.label); return menu_displaylist_process(&info); + } cbs = menu_entries_get_last_stack_actiondata(); From b28536ba16dc2688059ad21eb1c7f6524fe9ada4 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 03:22:42 +0200 Subject: [PATCH 038/253] Fix leaks in menu_displaylist_push --- menu/menu_displaylist.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 66f21d8d8c..4ebd40b8a0 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -4135,6 +4135,7 @@ bool menu_displaylist_push(menu_displaylist_ctx_entry_t *entry) const char *path = NULL; const char *label = NULL; unsigned type = 0; + bool ret = false; enum msg_hash_enums enum_idx = MSG_UNKNOWN; if (!entry) @@ -4160,11 +4161,8 @@ bool menu_displaylist_push(menu_displaylist_ctx_entry_t *entry) if (menu_displaylist_push_internal(label, entry, &info)) { - if (info.path && !string_is_empty(info.path)) - free(info.path); - if (info.label && !string_is_empty(info.label)) - free(info.label); - return menu_displaylist_process(&info); + ret = menu_displaylist_process(&info); + goto end; } cbs = menu_entries_get_last_stack_actiondata(); @@ -4175,12 +4173,20 @@ bool menu_displaylist_push(menu_displaylist_ctx_entry_t *entry) goto error; } - return true; + ret = true; + +end: + if (info.path && !string_is_empty(info.path)) + free(info.path); + if (info.label && !string_is_empty(info.label)) + free(info.label); + + return ret; error: - if (info.path) + if (info.path && !string_is_empty(info.path)) free(info.path); - if (info.label) + if (info.label && !string_is_empty(info.label)) free(info.label); return false; } From 04bc2fef8c3325411381b3f25a2d512280df283b Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Thu, 28 Sep 2017 03:28:05 +0200 Subject: [PATCH 039/253] Fix more memory leaks --- menu/menu_displaylist.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index 4ebd40b8a0..e5874ac336 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -4176,6 +4176,8 @@ bool menu_displaylist_push(menu_displaylist_ctx_entry_t *entry) ret = true; end: + if (info.exts && !string_is_empty(info.exts)) + free(info.exts); if (info.path && !string_is_empty(info.path)) free(info.path); if (info.label && !string_is_empty(info.label)) @@ -4184,6 +4186,8 @@ end: return ret; error: + if (info.exts && !string_is_empty(info.exts)) + free(info.exts); if (info.path && !string_is_empty(info.path)) free(info.path); if (info.label && !string_is_empty(info.label)) From 8b62a7cb7da9c21d55c1e161d207fe0d20eff7b9 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 03:37:29 +0200 Subject: [PATCH 040/253] Fix crash that could occur upon loading content --- menu/cbs/menu_cbs_ok.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 07d5c459b4..56b21f594c 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1389,7 +1389,8 @@ static int action_ok_file_load(const char *path, if (setting_get_type(setting) == ST_PATH) return action_ok_set_path(path, label, type, idx, entry_idx); - strlcpy(menu_path_new, menu_path, sizeof(menu_path_new)); + if (menu_path && !string_is_empty(menu_path)) + strlcpy(menu_path_new, menu_path, sizeof(menu_path_new)); if ( string_is_equal(menu_label, From 8af2559b2aa5cee89248aa79cb1fc061be765ed8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 03:39:35 +0200 Subject: [PATCH 041/253] Be similarly careful in other functions --- menu/cbs/menu_cbs_ok.c | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 56b21f594c..297a1ca569 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1384,7 +1384,8 @@ static int action_ok_file_load(const char *path, menu_entries_get_last(menu_stack, &menu_path, &menu_label, NULL, NULL); - setting = menu_setting_find(menu_label); + if (menu_label && !string_is_empty(menu_label)) + setting = menu_setting_find(menu_label); if (setting_get_type(setting) == ST_PATH) return action_ok_set_path(path, label, type, idx, entry_idx); @@ -1392,20 +1393,23 @@ static int action_ok_file_load(const char *path, if (menu_path && !string_is_empty(menu_path)) strlcpy(menu_path_new, menu_path, sizeof(menu_path_new)); - if ( - string_is_equal(menu_label, - msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ARCHIVE_OPEN_DETECT_CORE)) || - string_is_equal(menu_label, - msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ARCHIVE_OPEN)) - ) + if (menu_label && !string_is_empty(menu_label)) { - menu_handle_t *menu = NULL; - if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) - return menu_cbs_exit(); + if ( + string_is_equal(menu_label, + msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ARCHIVE_OPEN_DETECT_CORE)) || + string_is_equal(menu_label, + msg_hash_to_str(MENU_ENUM_LABEL_DEFERRED_ARCHIVE_OPEN)) + ) + { + menu_handle_t *menu = NULL; + if (!menu_driver_ctl(RARCH_MENU_CTL_DRIVER_DATA_GET, &menu)) + return menu_cbs_exit(); - fill_pathname_join(menu_path_new, - menu->scratch2_buf, menu->scratch_buf, - sizeof(menu_path_new)); + fill_pathname_join(menu_path_new, + menu->scratch2_buf, menu->scratch_buf, + sizeof(menu_path_new)); + } } switch (type) @@ -2420,8 +2424,9 @@ static int action_ok_file_load_ffmpeg(const char *path, content_info.args = NULL; content_info.environ_get = NULL; - fill_pathname_join(new_path, menu_path, path, - sizeof(new_path)); + if (menu_path && !string_is_empty(menu_path)) + fill_pathname_join(new_path, menu_path, path, + sizeof(new_path)); if (!task_push_load_content_with_core_from_menu( new_path, @@ -2480,8 +2485,9 @@ static int action_ok_file_load_imageviewer(const char *path, content_info.args = NULL; content_info.environ_get = NULL; - fill_pathname_join(fullpath, menu_path, path, - sizeof(fullpath)); + if (menu_path && !string_is_empty(menu_path)) + fill_pathname_join(fullpath, menu_path, path, + sizeof(fullpath)); if (!task_push_load_content_with_core_from_menu( fullpath, @@ -3005,7 +3011,6 @@ static int action_ok_core_content_download(const char *path, menu_entries_get_last_stack(&menu_path, &menu_label, NULL, &enum_idx, NULL); - return action_ok_download_generic(path, label, menu_path, type, idx, entry_idx, MENU_ENUM_LABEL_CB_CORE_CONTENT_DOWNLOAD); From e1a0139164bf9dac7ab7e7905b4170c58d81ec27 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 03:48:49 +0200 Subject: [PATCH 042/253] Cleanups --- menu/menu_displaylist.c | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/menu/menu_displaylist.c b/menu/menu_displaylist.c index e5874ac336..42847c684a 100644 --- a/menu/menu_displaylist.c +++ b/menu/menu_displaylist.c @@ -4176,22 +4176,12 @@ bool menu_displaylist_push(menu_displaylist_ctx_entry_t *entry) ret = true; end: - if (info.exts && !string_is_empty(info.exts)) - free(info.exts); - if (info.path && !string_is_empty(info.path)) - free(info.path); - if (info.label && !string_is_empty(info.label)) - free(info.label); + menu_displaylist_info_free(&info); return ret; error: - if (info.exts && !string_is_empty(info.exts)) - free(info.exts); - if (info.path && !string_is_empty(info.path)) - free(info.path); - if (info.label && !string_is_empty(info.label)) - free(info.label); + menu_displaylist_info_free(&info); return false; } From 7633141bd6d8b1a5e8d4d74b6e9ba7bd7ff415be Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 03:53:48 +0200 Subject: [PATCH 043/253] Try to prevent potential memory leak --- menu/drivers/xmb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 520d63dd51..bbe4b06b6a 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1877,9 +1877,10 @@ static void xmb_init_horizontal_list(xmb_handle_t *xmb) for (i = 0; i < xmb->horizontal_list->size; i++) xmb_node_allocate_userdata(xmb, (unsigned)i); menu_displaylist_process(&info); - menu_displaylist_info_free(&info); } } + + menu_displaylist_info_free(&info); } static void xmb_toggle_horizontal_list(xmb_handle_t *xmb) From afa7d7d8e55fa6e6adce3ef0688226d51ac4921a Mon Sep 17 00:00:00 2001 From: radius Date: Wed, 27 Sep 2017 21:20:39 -0500 Subject: [PATCH 044/253] readd this --- Makefile.wiiu | 1 + 1 file changed, 1 insertion(+) diff --git a/Makefile.wiiu b/Makefile.wiiu index b31b5b7351..65b32fd42f 100644 --- a/Makefile.wiiu +++ b/Makefile.wiiu @@ -52,6 +52,7 @@ else HAVE_ZLIB = 1 HAVE_7ZIP = 1 HAVE_BUILTINZLIB = 1 + HAVE_KEYMAPPER = 1 HAVE_LIBRETRODB = 1 HAVE_ZARCH = 0 HAVE_MATERIALUI = 1 From a616fa16f3deb70c7c3b3f4e12fcb93a45635ae7 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 05:00:00 +0200 Subject: [PATCH 045/253] Small cleanups --- menu/drivers/xmb.c | 50 ++++++++++++++++++++++------------------------ 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index bbe4b06b6a..6546be7dc1 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2348,7 +2348,7 @@ static void xmb_draw_items( core_node = xmb_get_userdata_from_horizontal_list( xmb, (unsigned)(cat_selection_ptr - (xmb->system_tab_end + 1))); - end = file_list_get_size(list); + end = file_list_get_size(list); rotate_draw.matrix = &mymat; rotate_draw.rotation = 0; @@ -2691,10 +2691,6 @@ static void xmb_draw_bg( { menu_display_ctx_draw_t draw; -#if 0 - RARCH_LOG("DRAW BG %d %d \n",width,height); -#endif - bool running = video_info->libretro_running; draw.x = 0; @@ -3103,30 +3099,32 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) menu_display_blend_end(); /* Vertical icons */ - xmb_draw_items( - video_info, - menu_disp_info, - xmb, - xmb->selection_buf_old, - xmb->selection_ptr_old, - (xmb_list_get_size(xmb, MENU_LIST_PLAIN) > 1) - ? xmb->categories.selection_ptr : xmb->categories.selection_ptr_old, - &item_color[0], - width, - height); + if (xmb) + xmb_draw_items( + video_info, + menu_disp_info, + xmb, + xmb->selection_buf_old, + xmb->selection_ptr_old, + (xmb_list_get_size(xmb, MENU_LIST_PLAIN) > 1) + ? xmb->categories.selection_ptr : xmb->categories.selection_ptr_old, + &item_color[0], + width, + height); selection_buf = menu_entries_get_selection_buf_ptr(0); - xmb_draw_items( - video_info, - menu_disp_info, - xmb, - selection_buf, - selection, - xmb->categories.selection_ptr, - &item_color[0], - width, - height); + if (xmb) + xmb_draw_items( + video_info, + menu_disp_info, + xmb, + selection_buf, + selection, + xmb->categories.selection_ptr, + &item_color[0], + width, + height); font_driver_flush(video_info->width, video_info->height, xmb->font); font_driver_bind_block(xmb->font, NULL); From 3f433fe220b431969580bce563263e2d63fb038c Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Thu, 28 Sep 2017 05:06:21 +0200 Subject: [PATCH 046/253] Update README.md --- README.md | 91 +------------------------------------------------------ 1 file changed, 1 insertion(+), 90 deletions(-) diff --git a/README.md b/README.md index a595613265..ea8497767f 100644 --- a/README.md +++ b/README.md @@ -125,94 +125,5 @@ Users only need to configure a certain option if the desired value deviates from To configure joypads, use the built-in menu or the `retroarch-joyconfig` command-line tool. ## Compiling and installing -**Linux** -- Prerequisites: -```bash -sudo apt-get install -y make git-core curl g++ pkg-config libglu1-mesa-dev freeglut3-dev mesa-common-dev libsdl1.2-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev -``` -- Compiling: -```bash -./configure -make -``` - -**Mac** - -- Prerequisites: [XCode](https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0CB4QFjAA&url=https%3A%2F%2Fitunes.apple.com%2Fus%2Fapp%2Fxcode%2Fid497799835%3Fmt%3D12&ei=ZmfeVNPtIILVoASBnoCYBw&usg=AFQjCNGrxKmVtXUdvUU3MhqZhP4MHT6Gtg&sig2=RIXKsWQ79YTQBt_lK5fdKA&bvm=bv.85970519,d.cGU), [Cg](https://developer.nvidia.com/cg-toolkit-download). -- You can open the project (**pkg/apple/RetroArch.xcodeproj**) in the Xcode IDE and build (**⌘-B**) and run (**⌘-R**) it there. Or you can use the command line... -- Debug: -```bash -# Build -xcodebuild -target RetroArch -configuration Debug -project pkg/apple/RetroArch.xcodeproj -# Run -open ./pkg/apple/build/Debug/RetroArch.app/ -``` -- Release: -```bash -# Build -xcodebuild -target RetroArch -configuration Release -project pkg/apple/RetroArch.xcodeproj -# Run -open ./pkg/apple/build/Release/RetroArch.app/ -``` - -**PC** - -Instructions for compiling on PC can be found in the [wiki](https://github.com/Themaister/RetroArch/wiki). - -**PlayStation 3** - -RetroArch PS3 needs to be compiled in the following order: - -1) Compile RetroArch Salamander - - make -f Makefile.ps3.salamander - -2) Finally, compile RetroArch packed together with the GUI: - - make -f Makefile.ps3 - -**PlayStation 3 - Creating a PKG installable file** - -You can add `pkg` as a parameter in order to make a PKG file - for example: - - make -f Makefile.ps3 pkg - -This creates an NPDRM package. This can be installed on debug PS3s. - -To make a non-NPDRM package that can be installed on a jailbroken/CFW PS3 (such as PSGroove or PS3 CFWs and other 3.55 CFW derivatives), do: - - make -f Makefile.ps3 pkg-signed - -If you're using Kmeaw 3.55 firmware, the package needs to be signed: - - make -f Makefile.ps3 pkg-signed-cfw - -NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch PS3. This file needs to be called ***`libretro_ps3.a`***. - -**Xbox 360 (XeXDK)** - -You will need Microsoft Visual Studio 2010 installed (or higher) in order to compile RetroArch 360. - -The solution file can be found at the following location: - - pkg/msvc-360/RetroArch-360.sln - -NOTE: A pre-existing libretro library needs to be present in the `pkg/msvc-360/RetroArch-360/Release` directory in order to link RetroArch 360. This file needs to be -called ***`libretro_xdk360.lib`***. - -**Xbox 360 (Libxenon)** - -You will need to have the libxenon libraries and a working Devkit Xenon toolchain installed in order to compile RetroArch 360 Libxenon. - - make -f Makefile.xenon - -NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch 360 Libxenon. This file needs to be called ***`libretro_xenon360.a`***. - -**Wii** - -You will need to have the libogc libraries and a working Devkit PPC toolchain installed in order to compile RetroArch Wii. - - make -f Makefile.griffin platform=wii - -NOTE: A pre-existing libretro library needs to be present in the root directory in order to link RetroArch Wii. This file needs to be called ***`libretro_wii.a`***. +Instructions for compiling and installing RetroArch can be found in the [Libretro/RetroArch Documentation Center](hhttps://buildbot.libretro.com/docs). From a0552fa4d9b2e30f9d0b452c796b3dd3fa94dc38 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Thu, 28 Sep 2017 05:06:42 +0200 Subject: [PATCH 047/253] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ea8497767f..230bbb950a 100644 --- a/README.md +++ b/README.md @@ -126,4 +126,4 @@ To configure joypads, use the built-in menu or the `retroarch-joyconfig` command ## Compiling and installing -Instructions for compiling and installing RetroArch can be found in the [Libretro/RetroArch Documentation Center](hhttps://buildbot.libretro.com/docs). +Instructions for compiling and installing RetroArch can be found in the [Libretro/RetroArch Documentation Center](https://buildbot.libretro.com/docs). From bb6e4a663395c1db930ac845079793a5f1107f08 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 05:37:02 +0200 Subject: [PATCH 048/253] xmb_draw_items - small cleanups --- menu/drivers/xmb.c | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 6546be7dc1..3801be71a8 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2384,8 +2384,7 @@ static void xmb_draw_items( float icon_x, icon_y, label_offset; menu_animation_ctx_ticker_t ticker; char ticker_str[PATH_MAX_LENGTH]; - char name[255]; - char value[255]; + char tmp[255]; menu_entry_t entry; const float half_size = xmb->icon.size / 2.0f; uintptr_t texture_switch = 0; @@ -2397,18 +2396,18 @@ static void xmb_draw_items( if (!node) continue; - entry.path[0] = '\0'; - entry.label[0] = '\0'; - entry.sublabel[0] = '\0'; - entry.value[0] = '\0'; - entry.rich_label[0] = '\0'; - entry.enum_idx = MSG_UNKNOWN; - entry.entry_idx = 0; - entry.idx = 0; - entry.type = 0; - entry.spacing = 0; + entry.path[0] = '\0'; + entry.label[0] = '\0'; + entry.sublabel[0] = '\0'; + entry.value[0] = '\0'; + entry.rich_label[0] = '\0'; + entry.enum_idx = MSG_UNKNOWN; + entry.entry_idx = 0; + entry.idx = 0; + entry.type = 0; + entry.spacing = 0; - ticker_str[0] = name[0] = value[0] = '\0'; + ticker_str[0] = tmp[0] = '\0'; icon_y = xmb->margins.screen.top + node->y + half_size; @@ -2486,7 +2485,7 @@ static void xmb_draw_items( menu_entry_get_rich_label((unsigned)i, ticker_str, sizeof(ticker_str)); - ticker.s = name; + ticker.s = tmp; ticker.len = ticker_limit; ticker.idx = frame_count / 20; ticker.str = ticker_str; @@ -2514,14 +2513,16 @@ static void xmb_draw_items( width, height, xmb->font2); } - xmb_draw_text(menu_disp_info, xmb, name, + xmb_draw_text(menu_disp_info, xmb, tmp, node->x + xmb->margins.screen.left + xmb->icon.spacing.horizontal + xmb->margins.label.left, xmb->margins.screen.top + node->y + label_offset, 1, node->label_alpha, TEXT_ALIGN_LEFT, width, height, xmb->font); - ticker.s = value; + tmp[0] = '\0'; + + ticker.s = tmp; ticker.len = 35; ticker.idx = frame_count / 20; ticker.str = entry.value; @@ -2530,7 +2531,7 @@ static void xmb_draw_items( menu_animation_ticker(&ticker); if (do_draw_text) - xmb_draw_text(menu_disp_info, xmb, value, + xmb_draw_text(menu_disp_info, xmb, tmp, node->x + + xmb->margins.screen.left + xmb->icon.spacing.horizontal From 2f10fd14d60f24a380a520b9d953e4ddcbfb3798 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 06:02:14 +0200 Subject: [PATCH 049/253] Create menu_entry_init/menu_entry_free --- menu/cbs/menu_cbs_select.c | 17 ++-- menu/drivers/menu_generic.c | 35 ++++---- menu/drivers/nuklear.c | 2 + menu/drivers/xmb.c | 159 ++++++++++++++---------------------- menu/drivers/zarch.c | 9 +- menu/menu_input.c | 14 +--- menu/widgets/menu_entry.c | 138 +++++++------------------------ menu/widgets/menu_entry.h | 4 + 8 files changed, 130 insertions(+), 248 deletions(-) diff --git a/menu/cbs/menu_cbs_select.c b/menu/cbs/menu_cbs_select.c index 6c6cb03e44..57f9d12886 100644 --- a/menu/cbs/menu_cbs_select.c +++ b/menu/cbs/menu_cbs_select.c @@ -39,23 +39,16 @@ static int action_select_default(const char *path, const char *label, unsigned t menu_file_list_cbs_t *cbs = NULL; file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); - entry.path[0] = '\0'; - entry.label[0] = '\0'; - entry.sublabel[0] = '\0'; - entry.value[0] = '\0'; - entry.rich_label[0] = '\0'; - entry.enum_idx = MSG_UNKNOWN; - entry.entry_idx = 0; - entry.idx = 0; - entry.type = 0; - entry.spacing = 0; - + menu_entry_init(&entry); menu_entry_get(&entry, 0, idx, NULL, false); cbs = menu_entries_get_actiondata_at_offset(selection_buf, idx); if (!cbs) + { + menu_entry_free(&entry); return -1; + } if (cbs->setting) { @@ -96,6 +89,8 @@ static int action_select_default(const char *path, const char *label, unsigned t if (action != MENU_ACTION_NOOP) ret = menu_entry_action(&entry, (unsigned)idx, action); + menu_entry_free(&entry); + task_queue_check(); return ret; diff --git a/menu/drivers/menu_generic.c b/menu/drivers/menu_generic.c index 84672c084d..f8e31738d3 100644 --- a/menu/drivers/menu_generic.c +++ b/menu/drivers/menu_generic.c @@ -66,7 +66,6 @@ static enum action_iterate_type action_iterate_type(uint32_t hash) **/ int generic_menu_iterate(void *data, void *userdata, enum menu_action action) { - menu_entry_t entry; enum action_iterate_type iterate_type; unsigned file_type = 0; int ret = 0; @@ -219,24 +218,28 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action) menu_dialog_set_active(false); break; case ITERATE_TYPE_DEFAULT: - /* FIXME: Crappy hack, needed for mouse controls - * to not be completely broken in case we press back. - * - * We need to fix this entire mess, mouse controls - * should not rely on a hack like this in order to work. */ - selection = MAX(MIN(selection, (menu_entries_get_size() - 1)), 0); + { + menu_entry_t entry; + /* FIXME: Crappy hack, needed for mouse controls + * to not be completely broken in case we press back. + * + * We need to fix this entire mess, mouse controls + * should not rely on a hack like this in order to work. */ + selection = MAX(MIN(selection, (menu_entries_get_size() - 1)), 0); - menu_entry_get(&entry, 0, selection, NULL, false); - ret = menu_entry_action(&entry, - (unsigned)selection, (enum menu_action)action); + menu_entry_init(&entry); + menu_entry_get(&entry, 0, selection, NULL, false); + ret = menu_entry_action(&entry, + (unsigned)selection, (enum menu_action)action); + menu_entry_free(&entry); + if (ret) + goto end; - if (ret) - goto end; + BIT64_SET(menu->state, MENU_STATE_POST_ITERATE); - BIT64_SET(menu->state, MENU_STATE_POST_ITERATE); - - /* Have to defer it so we let settings refresh. */ - menu_dialog_push(); + /* Have to defer it so we let settings refresh. */ + menu_dialog_push(); + } break; } diff --git a/menu/drivers/nuklear.c b/menu/drivers/nuklear.c index d863556794..faaaadec9e 100644 --- a/menu/drivers/nuklear.c +++ b/menu/drivers/nuklear.c @@ -501,11 +501,13 @@ static int nk_menu_iterate(void *data, void *userdata, enum menu_action action) if (!nk) return -1; + menu_entry_init(&entry); menu_entry_get(&entry, 0, selection, NULL, false); nk->action = action; ret = menu_entry_action(&entry, selection, action); + menu_entry_free(&entry); if (ret) return -1; return 0; diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 3801be71a8..33b13d50c2 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -984,17 +984,7 @@ static void xmb_update_thumbnail_path(void *data, unsigned i) if (!xmb) goto end; - entry.path[0] = '\0'; - entry.label[0] = '\0'; - entry.sublabel[0] = '\0'; - entry.value[0] = '\0'; - entry.rich_label[0] = '\0'; - entry.enum_idx = MSG_UNKNOWN; - entry.entry_idx = 0; - entry.idx = 0; - entry.type = 0; - entry.spacing = 0; - + menu_entry_init(&entry); menu_entry_get(&entry, 0, i, NULL, true); if (entry.type == FILE_TYPE_IMAGEVIEWER || entry.type == FILE_TYPE_IMAGE) @@ -1070,6 +1060,7 @@ static void xmb_update_thumbnail_path(void *data, unsigned i) sizeof(xmb->thumbnail_file_path)); end: + menu_entry_free(&entry); free(tmp_new); } @@ -1083,17 +1074,7 @@ static void xmb_update_savestate_thumbnail_path(void *data, unsigned i) if (!xmb) return; - entry.path[0] = '\0'; - entry.label[0] = '\0'; - entry.sublabel[0] = '\0'; - entry.value[0] = '\0'; - entry.rich_label[0] = '\0'; - entry.enum_idx = MSG_UNKNOWN; - entry.entry_idx = 0; - entry.idx = 0; - entry.type = 0; - entry.spacing = 0; - + menu_entry_init(&entry); menu_entry_get(&entry, 0, i, NULL, true); menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &playlist); @@ -1133,6 +1114,8 @@ static void xmb_update_savestate_thumbnail_path(void *data, unsigned i) free(path); } + + menu_entry_free(&entry); } static void xmb_update_thumbnail_image(void *data) @@ -1191,7 +1174,7 @@ static void xmb_update_savestate_thumbnail_image(void *data) static void xmb_selection_pointer_changed( xmb_handle_t *xmb, bool allow_animations) { - menu_entry_t e; + menu_entry_t entry; unsigned i, end, height; menu_animation_ctx_tag tag; size_t num = 0; @@ -1206,18 +1189,8 @@ static void xmb_selection_pointer_changed( if (!xmb) return; - e.path[0] = '\0'; - e.label[0] = '\0'; - e.sublabel[0] = '\0'; - e.value[0] = '\0'; - e.rich_label[0] = '\0'; - e.enum_idx = MSG_UNKNOWN; - e.entry_idx = 0; - e.idx = 0; - e.type = 0; - e.spacing = 0; - - menu_entry_get(&e, 0, selection, NULL, true); + menu_entry_init(&entry); + menu_entry_get(&entry, 0, selection, NULL, true); end = (unsigned)menu_entries_get_end(); threshold = xmb->icon.size*10; @@ -1257,15 +1230,15 @@ static void xmb_selection_pointer_changed( if ((xmb_list > XMB_SYSTEM_TAB_SETTINGS && depth == 1) || (xmb_list < XMB_SYSTEM_TAB_SETTINGS && depth == 4)) { - xmb_set_thumbnail_content(xmb, e.path, sizeof(e.path)); + xmb_set_thumbnail_content(xmb, entry.path, sizeof(entry.path)); xmb_update_thumbnail_path(xmb, i); xmb_update_thumbnail_image(xmb); } - else if (((e.type == FILE_TYPE_IMAGE || e.type == FILE_TYPE_IMAGEVIEWER || - e.type == FILE_TYPE_RDB || e.type == FILE_TYPE_RDB_ENTRY) + else if (((entry.type == FILE_TYPE_IMAGE || entry.type == FILE_TYPE_IMAGEVIEWER || + entry.type == FILE_TYPE_RDB || entry.type == FILE_TYPE_RDB_ENTRY) && xmb_list <= XMB_SYSTEM_TAB_SETTINGS)) { - xmb_set_thumbnail_content(xmb, e.path, sizeof(e.path)); + xmb_set_thumbnail_content(xmb, entry.path, sizeof(entry.path)); xmb_update_thumbnail_path(xmb, i); xmb_update_thumbnail_image(xmb); } @@ -1316,6 +1289,8 @@ static void xmb_selection_pointer_changed( menu_animation_push(&entry); } } + + menu_entry_free(&entry); } static void xmb_list_open_old(xmb_handle_t *xmb, @@ -1354,26 +1329,26 @@ static void xmb_list_open_old(xmb_handle_t *xmb, } else { - menu_animation_ctx_entry_t entry; + menu_animation_ctx_entry_t anim_entry; - entry.duration = XMB_DELAY; - entry.target_value = ia; - entry.subject = &node->alpha; - entry.easing_enum = EASING_OUT_QUAD; - entry.tag = (uintptr_t)list; - entry.cb = NULL; + anim_entry.duration = XMB_DELAY; + anim_entry.target_value = ia; + anim_entry.subject = &node->alpha; + anim_entry.easing_enum = EASING_OUT_QUAD; + anim_entry.tag = (uintptr_t)list; + anim_entry.cb = NULL; - menu_animation_push(&entry); + menu_animation_push(&anim_entry); - entry.target_value = 0; - entry.subject = &node->label_alpha; + anim_entry.target_value = 0; + anim_entry.subject = &node->label_alpha; - menu_animation_push(&entry); + menu_animation_push(&anim_entry); - entry.target_value = xmb->icon.size * dir * -2; - entry.subject = &node->x; + anim_entry.target_value = xmb->icon.size * dir * -2; + anim_entry.subject = &node->x; - menu_animation_push(&entry); + menu_animation_push(&anim_entry); } } } @@ -1424,25 +1399,25 @@ static void xmb_list_open_new(xmb_handle_t *xmb, } else { - menu_animation_ctx_entry_t entry; + menu_animation_ctx_entry_t anim_entry; - entry.duration = XMB_DELAY; - entry.target_value = ia; - entry.subject = &node->alpha; - entry.easing_enum = EASING_OUT_QUAD; - entry.tag = (uintptr_t)list; - entry.cb = NULL; + anim_entry.duration = XMB_DELAY; + anim_entry.target_value = ia; + anim_entry.subject = &node->alpha; + anim_entry.easing_enum = EASING_OUT_QUAD; + anim_entry.tag = (uintptr_t)list; + anim_entry.cb = NULL; - menu_animation_push(&entry); + menu_animation_push(&anim_entry); - entry.subject = &node->label_alpha; + anim_entry.subject = &node->label_alpha; - menu_animation_push(&entry); + menu_animation_push(&anim_entry); - entry.target_value = 0; - entry.subject = &node->x; + anim_entry.target_value = 0; + anim_entry.subject = &node->x; - menu_animation_push(&entry); + menu_animation_push(&anim_entry); } } @@ -1735,8 +1710,7 @@ static void xmb_list_switch_horizontal_list(xmb_handle_t *xmb) static void xmb_list_switch(xmb_handle_t *xmb) { - menu_entry_t e; - menu_animation_ctx_entry_t entry; + menu_animation_ctx_entry_t anim_entry; int dir = -1; file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); size_t selection = menu_navigation_get_selection(); @@ -1749,16 +1723,16 @@ static void xmb_list_switch(xmb_handle_t *xmb) xmb_list_switch_horizontal_list(xmb); - entry.duration = XMB_DELAY; - entry.target_value = xmb->icon.spacing.horizontal * -(float)xmb->categories.selection_ptr; - entry.subject = &xmb->categories.x_pos; - entry.easing_enum = EASING_OUT_QUAD; + anim_entry.duration = XMB_DELAY; + anim_entry.target_value = xmb->icon.spacing.horizontal * -(float)xmb->categories.selection_ptr; + anim_entry.subject = &xmb->categories.x_pos; + anim_entry.easing_enum = EASING_OUT_QUAD; /* TODO/FIXME - integer conversion resulted in change of sign */ - entry.tag = -1; - entry.cb = NULL; + anim_entry.tag = -1; + anim_entry.cb = NULL; - if (entry.subject) - menu_animation_push(&entry); + if (anim_entry.subject) + menu_animation_push(&anim_entry); dir = -1; if (xmb->categories.selection_ptr > xmb->categories.selection_ptr_old) @@ -1775,20 +1749,14 @@ static void xmb_list_switch(xmb_handle_t *xmb) if (!string_is_equal(xmb_thumbnails_ident(), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF))) { - e.path[0] = '\0'; - e.label[0] = '\0'; - e.sublabel[0] = '\0'; - e.value[0] = '\0'; - e.rich_label[0] = '\0'; - e.enum_idx = MSG_UNKNOWN; - e.entry_idx = 0; - e.idx = 0; - e.type = 0; - e.spacing = 0; + menu_entry_t entry; - menu_entry_get(&e, 0, selection, NULL, true); + menu_entry_init(&entry); + menu_entry_get(&entry, 0, selection, NULL, true); - xmb_set_thumbnail_content(xmb, e.path, sizeof(e.path)); + xmb_set_thumbnail_content(xmb, entry.path, sizeof(entry.path)); + + menu_entry_free(&entry); xmb_update_thumbnail_path(xmb, 0); xmb_update_thumbnail_image(xmb); @@ -2396,19 +2364,10 @@ static void xmb_draw_items( if (!node) continue; - entry.path[0] = '\0'; - entry.label[0] = '\0'; - entry.sublabel[0] = '\0'; - entry.value[0] = '\0'; - entry.rich_label[0] = '\0'; - entry.enum_idx = MSG_UNKNOWN; - entry.entry_idx = 0; - entry.idx = 0; - entry.type = 0; - entry.spacing = 0; - ticker_str[0] = tmp[0] = '\0'; + menu_entry_init(&entry); + icon_y = xmb->margins.screen.top + node->y + half_size; if (icon_y < half_size) @@ -2600,6 +2559,8 @@ static void xmb_draw_items( 1, &color[0], xmb->shadow_offset); + + menu_entry_free(&entry); } menu_display_blend_end(); diff --git a/menu/drivers/zarch.c b/menu/drivers/zarch.c index 036d07fb8f..c9326d67bd 100644 --- a/menu/drivers/zarch.c +++ b/menu/drivers/zarch.c @@ -516,10 +516,11 @@ static int zarch_zui_render_lay_root_recent( { char rich_label[PATH_MAX_LENGTH]; char entry_value[PATH_MAX_LENGTH]; - menu_entry_t entry = {{0}}; + menu_entry_t entry; rich_label[0] = entry_value[0] = '\0'; + menu_entry_init(&entry); menu_entry_get(&entry, 0, i, NULL, true); menu_entry_get_rich_label(i, rich_label, sizeof(rich_label)); menu_entry_get_value(i, NULL, entry_value,sizeof(entry_value)); @@ -531,10 +532,14 @@ static int zarch_zui_render_lay_root_recent( rich_label, i, entry_value, gamepad_index == (signed)i)) { if (menu_entry_action(&entry, i, MENU_ACTION_OK)) + { + menu_entry_free(&entry); return 1; + } } j++; + menu_entry_free(&entry); } } @@ -1112,11 +1117,13 @@ static int zarch_iterate(void *data, void *userdata, enum menu_action action) if (!zui) return -1; + menu_entry_init(&entry); menu_entry_get(&entry, 0, selection, NULL, false); zui->action = action; ret = menu_entry_action(&entry, selection, action); + menu_entry_free(&entry); if (ret) return -1; return 0; diff --git a/menu/menu_input.c b/menu/menu_input.c index 0405248a79..4aace7f1eb 100644 --- a/menu/menu_input.c +++ b/menu/menu_input.c @@ -571,22 +571,14 @@ void menu_input_post_iterate(int *ret, unsigned action) if (selection_buf) cbs = menu_entries_get_actiondata_at_offset(selection_buf, selection); - entry.path[0] = '\0'; - entry.label[0] = '\0'; - entry.sublabel[0] = '\0'; - entry.value[0] = '\0'; - entry.rich_label[0] = '\0'; - entry.enum_idx = MSG_UNKNOWN; - entry.entry_idx = 0; - entry.idx = 0; - entry.type = 0; - entry.spacing = 0; - + menu_entry_init(&entry); menu_entry_get(&entry, 0, selection, NULL, false); *ret = menu_input_mouse_frame(cbs, &entry, action); if (settings->bools.menu_pointer_enable) *ret |= menu_input_pointer_post_iterate(cbs, &entry, action); + + menu_entry_free(&entry); } diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index 81f341319f..c69767397f 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -75,21 +75,29 @@ enum menu_entry_type menu_entry_get_type(uint32_t i) return MENU_ENTRY_ACTION; } +void menu_entry_free(menu_entry_t *entry) +{ +} + +void menu_entry_init(menu_entry_t *entry) +{ + entry->path[0] = '\0'; + entry->label[0] = '\0'; + entry->sublabel[0] = '\0'; + entry->value[0] = '\0'; + entry->rich_label[0] = '\0'; + entry->enum_idx = MSG_UNKNOWN; + entry->entry_idx = 0; + entry->idx = 0; + entry->type = 0; + entry->spacing = 0; +} + void menu_entry_get_path(uint32_t i, char *s, size_t len) { menu_entry_t entry; - entry.path[0] = '\0'; - entry.label[0] = '\0'; - entry.sublabel[0] = '\0'; - entry.value[0] = '\0'; - entry.rich_label[0] = '\0'; - entry.enum_idx = MSG_UNKNOWN; - entry.entry_idx = 0; - entry.idx = 0; - entry.type = 0; - entry.spacing = 0; - + menu_entry_init(&entry); menu_entry_get(&entry, 0, i, NULL, true); strlcpy(s, entry.path, len); @@ -99,17 +107,7 @@ void menu_entry_get_rich_label(uint32_t i, char *s, size_t len) { menu_entry_t entry; - entry.path[0] = '\0'; - entry.label[0] = '\0'; - entry.sublabel[0] = '\0'; - entry.value[0] = '\0'; - entry.rich_label[0] = '\0'; - entry.enum_idx = MSG_UNKNOWN; - entry.entry_idx = 0; - entry.idx = 0; - entry.type = 0; - entry.spacing = 0; - + menu_entry_init(&entry); menu_entry_get(&entry, 0, i, NULL, true); if (!string_is_empty(entry.rich_label)) @@ -122,17 +120,7 @@ bool menu_entry_get_sublabel(uint32_t i, char *s, size_t len) { menu_entry_t entry; - entry.path[0] = '\0'; - entry.label[0] = '\0'; - entry.sublabel[0] = '\0'; - entry.value[0] = '\0'; - entry.rich_label[0] = '\0'; - entry.enum_idx = MSG_UNKNOWN; - entry.entry_idx = 0; - entry.idx = 0; - entry.type = 0; - entry.spacing = 0; - + menu_entry_init(&entry); menu_entry_get(&entry, 0, i, NULL, true); if (string_is_empty(entry.sublabel)) @@ -146,17 +134,7 @@ void menu_entry_get_label(uint32_t i, char *s, size_t len) { menu_entry_t entry; - entry.path[0] = '\0'; - entry.label[0] = '\0'; - entry.sublabel[0] = '\0'; - entry.value[0] = '\0'; - entry.rich_label[0] = '\0'; - entry.enum_idx = MSG_UNKNOWN; - entry.entry_idx = 0; - entry.idx = 0; - entry.type = 0; - entry.spacing = 0; - + menu_entry_init(&entry); menu_entry_get(&entry, 0, i, NULL, true); strlcpy(s, entry.label, len); @@ -166,17 +144,7 @@ unsigned menu_entry_get_spacing(uint32_t i) { menu_entry_t entry; - entry.path[0] = '\0'; - entry.label[0] = '\0'; - entry.sublabel[0] = '\0'; - entry.value[0] = '\0'; - entry.rich_label[0] = '\0'; - entry.enum_idx = MSG_UNKNOWN; - entry.entry_idx = 0; - entry.idx = 0; - entry.type = 0; - entry.spacing = 0; - + menu_entry_init(&entry); menu_entry_get(&entry, 0, i, NULL, true); return entry.spacing; @@ -186,17 +154,7 @@ unsigned menu_entry_get_type_new(uint32_t i) { menu_entry_t entry; - entry.path[0] = '\0'; - entry.label[0] = '\0'; - entry.sublabel[0] = '\0'; - entry.value[0] = '\0'; - entry.rich_label[0] = '\0'; - entry.enum_idx = MSG_UNKNOWN; - entry.entry_idx = 0; - entry.idx = 0; - entry.type = 0; - entry.spacing = 0; - + menu_entry_init(&entry); menu_entry_get(&entry, 0, i, NULL, true); return entry.type; @@ -291,17 +249,7 @@ void menu_entry_pathdir_get_value(uint32_t i, char *s, size_t len) { menu_entry_t entry; - entry.path[0] = '\0'; - entry.label[0] = '\0'; - entry.sublabel[0] = '\0'; - entry.value[0] = '\0'; - entry.rich_label[0] = '\0'; - entry.enum_idx = MSG_UNKNOWN; - entry.entry_idx = 0; - entry.idx = 0; - entry.type = 0; - entry.spacing = 0; - + menu_entry_init(&entry); menu_entry_get(&entry, 0, i, NULL, true); strlcpy(s, entry.value, len); } @@ -321,17 +269,7 @@ void menu_entry_reset(uint32_t i) { menu_entry_t entry; - entry.path[0] = '\0'; - entry.label[0] = '\0'; - entry.sublabel[0] = '\0'; - entry.value[0] = '\0'; - entry.rich_label[0] = '\0'; - entry.enum_idx = MSG_UNKNOWN; - entry.entry_idx = 0; - entry.idx = 0; - entry.type = 0; - entry.spacing = 0; - + menu_entry_init(&entry); menu_entry_get(&entry, 0, i, NULL, true); menu_entry_action(&entry, i, MENU_ACTION_START); @@ -342,17 +280,7 @@ void menu_entry_get_value(uint32_t i, void *data, char *s, size_t len) menu_entry_t entry; file_list_t *list = (file_list_t*)data; - entry.path[0] = '\0'; - entry.label[0] = '\0'; - entry.sublabel[0] = '\0'; - entry.value[0] = '\0'; - entry.rich_label[0] = '\0'; - entry.enum_idx = MSG_UNKNOWN; - entry.entry_idx = 0; - entry.idx = 0; - entry.type = 0; - entry.spacing = 0; - + menu_entry_init(&entry); menu_entry_get(&entry, 0, i, list, true); strlcpy(s, entry.value, len); } @@ -465,19 +393,9 @@ int menu_entry_select(uint32_t i) { menu_entry_t entry; - entry.path[0] = '\0'; - entry.label[0] = '\0'; - entry.sublabel[0] = '\0'; - entry.value[0] = '\0'; - entry.rich_label[0] = '\0'; - entry.enum_idx = MSG_UNKNOWN; - entry.entry_idx = 0; - entry.idx = 0; - entry.type = 0; - entry.spacing = 0; - menu_navigation_set_selection(i); + menu_entry_init(&entry); menu_entry_get(&entry, 0, i, NULL, false); return menu_entry_action(&entry, i, MENU_ACTION_SELECT); diff --git a/menu/widgets/menu_entry.h b/menu/widgets/menu_entry.h index af8b8b5b8b..57b24ee15c 100644 --- a/menu/widgets/menu_entry.h +++ b/menu/widgets/menu_entry.h @@ -117,6 +117,10 @@ int menu_entry_select(uint32_t i); int menu_entry_action(menu_entry_t *entry, unsigned i, enum menu_action action); +void menu_entry_free(menu_entry_t *entry); + +void menu_entry_init(menu_entry_t *entry); + RETRO_END_DECLS #endif From c5255b1bffd5218f9974fb2fa6b0e3861b203901 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 06:19:34 +0200 Subject: [PATCH 050/253] Simplify menu_entry_get_rich_label --- menu/drivers/materialui.c | 7 ++++++- menu/drivers/rgui.c | 8 +++++++- menu/drivers/xmb.c | 2 +- menu/drivers/zarch.c | 2 +- menu/widgets/menu_entry.c | 22 ++++++++-------------- menu/widgets/menu_entry.h | 2 +- 6 files changed, 24 insertions(+), 19 deletions(-) diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 80796b2888..9c00cb2075 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -996,6 +996,7 @@ static void mui_render_menu_list( for (i = 0; i < entries_end; i++) { + menu_entry_t entry; char rich_label[255]; char entry_value[255]; bool entry_selected = false; @@ -1014,8 +1015,10 @@ static void mui_render_menu_list( if (y > (int)height) break; + menu_entry_init(&entry); + menu_entry_get(&entry, 0, (unsigned)i, NULL, true); menu_entry_get_value((unsigned)i, NULL, entry_value, sizeof(entry_value)); - menu_entry_get_rich_label((unsigned)i, rich_label, sizeof(rich_label)); + menu_entry_get_rich_label(&entry, rich_label, sizeof(rich_label)); entry_selected = selection == i; @@ -1036,6 +1039,8 @@ static void mui_render_menu_list( menu_list_color, sublabel_color ); + + menu_entry_free(&entry); } } diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 959db6ca6b..f4906abda7 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -566,6 +566,7 @@ static void rgui_render(void *data, bool is_idle) for (; i < end; i++, y += FONT_HEIGHT_STRIDE) { + menu_entry_t entry; menu_animation_ctx_ticker_t ticker; char entry_path[255]; char entry_value[255]; @@ -586,8 +587,11 @@ static void rgui_render(void *data, bool is_idle) entry_title_buf[0] = '\0'; type_str_buf[0] = '\0'; + menu_entry_init(&entry); + menu_entry_get(&entry, 0, (unsigned)i, NULL, true); + menu_entry_get_value((unsigned)i, NULL, entry_value, sizeof(entry_value)); - menu_entry_get_rich_label((unsigned)i, entry_path, sizeof(entry_path)); + menu_entry_get_rich_label(&entry, entry_path, sizeof(entry_path)); ticker.s = entry_title_buf; ticker.len = RGUI_TERM_WIDTH(fb_width) - (entry_spacing + 1 + 2); @@ -617,6 +621,8 @@ static void rgui_render(void *data, bool is_idle) if (rgui_framebuf_data) blit_line(x, y, message, entry_selected ? hover_color : normal_color); + + menu_entry_free(&entry); } if (menu_input_dialog_get_display_kb()) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 33b13d50c2..84a52ef04c 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2442,7 +2442,7 @@ static void xmb_draw_items( ticker_limit = 70; } - menu_entry_get_rich_label((unsigned)i, ticker_str, sizeof(ticker_str)); + menu_entry_get_rich_label(&entry, ticker_str, sizeof(ticker_str)); ticker.s = tmp; ticker.len = ticker_limit; diff --git a/menu/drivers/zarch.c b/menu/drivers/zarch.c index c9326d67bd..93b10d9cf1 100644 --- a/menu/drivers/zarch.c +++ b/menu/drivers/zarch.c @@ -522,7 +522,7 @@ static int zarch_zui_render_lay_root_recent( menu_entry_init(&entry); menu_entry_get(&entry, 0, i, NULL, true); - menu_entry_get_rich_label(i, rich_label, sizeof(rich_label)); + menu_entry_get_rich_label(&entry, rich_label, sizeof(rich_label)); menu_entry_get_value(i, NULL, entry_value,sizeof(entry_value)); if (zarch_zui_list_item( diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index c69767397f..8de278f053 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -103,17 +103,14 @@ void menu_entry_get_path(uint32_t i, char *s, size_t len) strlcpy(s, entry.path, len); } -void menu_entry_get_rich_label(uint32_t i, char *s, size_t len) +void menu_entry_get_rich_label(menu_entry_t *entry, char *s, size_t len) { - menu_entry_t entry; - - menu_entry_init(&entry); - menu_entry_get(&entry, 0, i, NULL, true); - - if (!string_is_empty(entry.rich_label)) - strlcpy(s, entry.rich_label, len); + if (!entry) + return; + if (!string_is_empty(entry->rich_label)) + strlcpy(s, entry->rich_label, len); else - strlcpy(s, entry.path, len); + strlcpy(s, entry->path, len); } bool menu_entry_get_sublabel(uint32_t i, char *s, size_t len) @@ -320,10 +317,7 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx, const char *entry_label = NULL; menu_file_list_cbs_t *cbs = NULL; file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(stack_idx); - file_list_t *list = selection_buf; - - if (userdata) - list = (file_list_t*)userdata; + file_list_t *list = (userdata) ? (file_list_t*)userdata : selection_buf; if (!list) return; @@ -338,7 +332,7 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx, const char *label = NULL; enum msg_hash_enums enum_idx = MSG_UNKNOWN; - entry->enum_idx = cbs->enum_idx; + entry->enum_idx = cbs->enum_idx; menu_entries_get_last_stack(NULL, &label, NULL, &enum_idx, NULL); diff --git a/menu/widgets/menu_entry.h b/menu/widgets/menu_entry.h index 57b24ee15c..95d9e834a1 100644 --- a/menu/widgets/menu_entry.h +++ b/menu/widgets/menu_entry.h @@ -93,7 +93,7 @@ void menu_entry_pathdir_extensions(uint32_t i, char *s, size_t len); void menu_entry_reset(uint32_t i); -void menu_entry_get_rich_label(uint32_t i, char *s, size_t len); +void menu_entry_get_rich_label(menu_entry_t *entry, char *s, size_t len); bool menu_entry_get_sublabel(uint32_t i, char *s, size_t len); From b8e900cd3248ce065c27533b2d502381c9e43f03 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 06:32:49 +0200 Subject: [PATCH 051/253] Rewrite menu_entry_get_value --- menu/drivers/materialui.c | 2 +- menu/drivers/rgui.c | 2 +- menu/drivers/xui.cpp | 8 +++++++- menu/drivers/zarch.c | 2 +- menu/widgets/menu_entry.c | 11 ++++------- menu/widgets/menu_entry.h | 2 +- ui/drivers/cocoa/cocoatouch_menu.m | 13 +++++++++++-- 7 files changed, 26 insertions(+), 14 deletions(-) diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 9c00cb2075..d23f313b1e 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -1017,7 +1017,7 @@ static void mui_render_menu_list( menu_entry_init(&entry); menu_entry_get(&entry, 0, (unsigned)i, NULL, true); - menu_entry_get_value((unsigned)i, NULL, entry_value, sizeof(entry_value)); + menu_entry_get_value(&entry, entry_value, sizeof(entry_value)); menu_entry_get_rich_label(&entry, rich_label, sizeof(rich_label)); entry_selected = selection == i; diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index f4906abda7..a6779dc8ba 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -590,7 +590,7 @@ static void rgui_render(void *data, bool is_idle) menu_entry_init(&entry); menu_entry_get(&entry, 0, (unsigned)i, NULL, true); - menu_entry_get_value((unsigned)i, NULL, entry_value, sizeof(entry_value)); + menu_entry_get_value(&entry, entry_value, sizeof(entry_value)); menu_entry_get_rich_label(&entry, entry_path, sizeof(entry_path)); ticker.s = entry_title_buf; diff --git a/menu/drivers/xui.cpp b/menu/drivers/xui.cpp index ff03d20201..ccefb7dd5e 100644 --- a/menu/drivers/xui.cpp +++ b/menu/drivers/xui.cpp @@ -590,17 +590,23 @@ static void xui_render(void *data, bool is_idle) end = menu_entries_get_end(); for (i = 0; i < end; i++) { + menu_entry_t entry; char entry_path[PATH_MAX_LENGTH] = {0}; char entry_value[PATH_MAX_LENGTH] = {0}; wchar_t msg_right[PATH_MAX_LENGTH] = {0}; wchar_t msg_left[PATH_MAX_LENGTH] = {0}; - menu_entry_get_value(i, NULL, entry_value, sizeof(entry_value)); + menu_entry_init(&entry); + menu_entry_get(&entry, 0, i, NULL, true); + + menu_entry_get_value(&entry, entry_value, sizeof(entry_value)); menu_entry_get_path(i, entry_path, sizeof(entry_path)); mbstowcs(msg_left, entry_path, sizeof(msg_left) / sizeof(wchar_t)); mbstowcs(msg_right, entry_value, sizeof(msg_right) / sizeof(wchar_t)); xui_set_list_text(i, msg_left, msg_right); + + menu_entry_free(&entry); } selection = menu_navigation_get_selection(); diff --git a/menu/drivers/zarch.c b/menu/drivers/zarch.c index 93b10d9cf1..82cd00b714 100644 --- a/menu/drivers/zarch.c +++ b/menu/drivers/zarch.c @@ -523,7 +523,7 @@ static int zarch_zui_render_lay_root_recent( menu_entry_init(&entry); menu_entry_get(&entry, 0, i, NULL, true); menu_entry_get_rich_label(&entry, rich_label, sizeof(rich_label)); - menu_entry_get_value(i, NULL, entry_value,sizeof(entry_value)); + menu_entry_get_value(&entry, entry_value,sizeof(entry_value)); if (zarch_zui_list_item( video_info, diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index 8de278f053..7c0be8fb91 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -272,14 +272,11 @@ void menu_entry_reset(uint32_t i) menu_entry_action(&entry, i, MENU_ACTION_START); } -void menu_entry_get_value(uint32_t i, void *data, char *s, size_t len) +void menu_entry_get_value(menu_entry_t *entry, char *s, size_t len) { - menu_entry_t entry; - file_list_t *list = (file_list_t*)data; - - menu_entry_init(&entry); - menu_entry_get(&entry, 0, i, list, true); - strlcpy(s, entry.value, len); + if (!entry) + return; + strlcpy(s, entry->value, len); } void menu_entry_set_value(uint32_t i, const char *s) diff --git a/menu/widgets/menu_entry.h b/menu/widgets/menu_entry.h index 95d9e834a1..22cdc581ed 100644 --- a/menu/widgets/menu_entry.h +++ b/menu/widgets/menu_entry.h @@ -97,7 +97,7 @@ void menu_entry_get_rich_label(menu_entry_t *entry, char *s, size_t len); bool menu_entry_get_sublabel(uint32_t i, char *s, size_t len); -void menu_entry_get_value(uint32_t i, void *data, char *s, size_t len); +void menu_entry_get_value(menu_entry_t *entry, char *s, size_t len); void menu_entry_set_value(uint32_t i, const char *s); diff --git a/ui/drivers/cocoa/cocoatouch_menu.m b/ui/drivers/cocoa/cocoatouch_menu.m index 8378ccfc14..8cfc6cc780 100644 --- a/ui/drivers/cocoa/cocoatouch_menu.m +++ b/ui/drivers/cocoa/cocoatouch_menu.m @@ -111,6 +111,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, - (UITableViewCell*)cellForTableView:(UITableView*)tableView { + menu_entry_t entry; char buffer[PATH_MAX_LENGTH]; char label[PATH_MAX_LENGTH]; static NSString* const cell_id = @"text"; @@ -122,8 +123,10 @@ static void RunActionSheet(const char* title, const struct string_list* items, result = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:cell_id]; + menu_entry_init(&entry); + menu_entry_get(&entry, 0, (unsigned)self.i, NULL, true); menu_entry_get_path(self.i, label, sizeof(label)); - menu_entry_get_value(self.i, NULL, buffer, sizeof(buffer)); + menu_entry_get_value(&entry, buffer, sizeof(buffer)); result.textLabel.text = BOXSTRING(label); @@ -132,6 +135,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), sizeof(buffer)); result.detailTextLabel.text = BOXSTRING(buffer); + menu_entry_free(&entry); return result; } @@ -408,12 +412,15 @@ replacementString:(NSString *)string - (void)wasSelectedOnTableView:(UITableView*)tableView ofController:(UIViewController*)controller { + menu_entry_t entry; char buffer[PATH_MAX_LENGTH]; char label[PATH_MAX_LENGTH]; UIAlertView *alertView = NULL; UITextField *field = NULL; NSString *desc = NULL; + menu_entry_init(&entry); + menu_entry_get(&entry, 0, (unsigned)self.i, NULL, true); menu_entry_get_path(self.i, label, sizeof(label)); desc = BOXSTRING(label); @@ -429,7 +436,7 @@ replacementString:(NSString *)string field = [alertView textFieldAtIndex:0]; field.delegate = self.formatter; - menu_entry_get_value(self.i, NULL, buffer, sizeof(buffer)); + menu_entry_get_value(&entry, buffer, sizeof(buffer)); if (string_is_empty(buffer)) strlcpy(buffer, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), @@ -437,6 +444,8 @@ replacementString:(NSString *)string field.placeholder = BOXSTRING(buffer); + menu_entry_free(&entry); + [alertView show]; } From db7e1a4fdfa50b3d7c8ca5e824bdd64caf92f379 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 06:37:48 +0200 Subject: [PATCH 052/253] Simplify menu_entry_get_sublabel --- menu/drivers/materialui.c | 14 ++++++++++++-- menu/widgets/menu_entry.c | 13 +++++-------- menu/widgets/menu_entry.h | 2 +- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index d23f313b1e..664692b503 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -678,6 +678,7 @@ static void mui_compute_entries_box(mui_handle_t* mui, int width) for (i = 0; i < entries_end; i++) { + menu_entry_t entry; char sublabel_str[255]; unsigned lines = 0; mui_node_t *node = (mui_node_t*) @@ -685,11 +686,14 @@ static void mui_compute_entries_box(mui_handle_t* mui, int width) sublabel_str[0] = '\0'; + menu_entry_init(&entry); + menu_entry_get(&entry, 0, i, NULL, true); + /* set texture_switch2 */ if (node->texture_switch2_set) texture_switch2 = node->texture_switch2; - if (menu_entry_get_sublabel(i, sublabel_str, sizeof(sublabel_str))) + if (menu_entry_get_sublabel(&entry, sublabel_str, sizeof(sublabel_str))) { int icon_margin = texture_switch2 ? mui->icon_size : 0; @@ -814,6 +818,7 @@ static void mui_render_label_value(mui_handle_t *mui, mui_node_t *node, 1.00, 1.00, 1.00, 1.00, }; + menu_entry_t entry; menu_animation_ctx_ticker_t ticker; char label_str[255]; char sublabel_str[255]; @@ -831,6 +836,9 @@ static void mui_render_label_value(mui_handle_t *mui, mui_node_t *node, label_str[0] = value_str[0] = sublabel_str[0] = '\0'; + menu_entry_init(&entry); + menu_entry_get(&entry, 0, i, NULL, true); + if (value_len * mui->glyph_width > usable_width / 2) value_len = (int)((usable_width/2) / mui->glyph_width); @@ -917,7 +925,7 @@ static void mui_render_label_value(mui_handle_t *mui, mui_node_t *node, } /* Sublabel */ - if (menu_entry_get_sublabel(i, sublabel_str, sizeof(sublabel_str))) + if (menu_entry_get_sublabel(&entry, sublabel_str, sizeof(sublabel_str))) { int icon_margin = texture_switch2 ? mui->icon_size : 0; @@ -965,6 +973,8 @@ static void mui_render_label_value(mui_handle_t *mui, mui_node_t *node, 1, switch_is_on ? &label_color[0] : &pure_white[0] ); + + menu_entry_free(&entry); } static void mui_render_menu_list( diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index 7c0be8fb91..fd4782a7fb 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -113,17 +113,14 @@ void menu_entry_get_rich_label(menu_entry_t *entry, char *s, size_t len) strlcpy(s, entry->path, len); } -bool menu_entry_get_sublabel(uint32_t i, char *s, size_t len) +bool menu_entry_get_sublabel(menu_entry_t *entry, char *s, size_t len) { - menu_entry_t entry; - - menu_entry_init(&entry); - menu_entry_get(&entry, 0, i, NULL, true); - - if (string_is_empty(entry.sublabel)) + if (!entry) + return false; + if (string_is_empty(entry->sublabel)) return false; - strlcpy(s, entry.sublabel, len); + strlcpy(s, entry->sublabel, len); return true; } diff --git a/menu/widgets/menu_entry.h b/menu/widgets/menu_entry.h index 22cdc581ed..2fdd5d8f5b 100644 --- a/menu/widgets/menu_entry.h +++ b/menu/widgets/menu_entry.h @@ -95,7 +95,7 @@ void menu_entry_reset(uint32_t i); void menu_entry_get_rich_label(menu_entry_t *entry, char *s, size_t len); -bool menu_entry_get_sublabel(uint32_t i, char *s, size_t len); +bool menu_entry_get_sublabel(menu_entry_t *entry, char *s, size_t len); void menu_entry_get_value(menu_entry_t *entry, char *s, size_t len); From 76277a12b04e131db3b72332864626e0a6f23708 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 06:40:15 +0200 Subject: [PATCH 053/253] Rewrite menu_entry_get_label --- menu/widgets/menu_entry.c | 11 ++++------- menu/widgets/menu_entry.h | 2 +- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index fd4782a7fb..f7635ce99e 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -124,14 +124,11 @@ bool menu_entry_get_sublabel(menu_entry_t *entry, char *s, size_t len) return true; } -void menu_entry_get_label(uint32_t i, char *s, size_t len) +void menu_entry_get_label(menu_entry_t *entry, char *s, size_t len) { - menu_entry_t entry; - - menu_entry_init(&entry); - menu_entry_get(&entry, 0, i, NULL, true); - - strlcpy(s, entry.label, len); + if (!entry) + return; + strlcpy(s, entry->label, len); } unsigned menu_entry_get_spacing(uint32_t i) diff --git a/menu/widgets/menu_entry.h b/menu/widgets/menu_entry.h index 2fdd5d8f5b..5b44abb8e7 100644 --- a/menu/widgets/menu_entry.h +++ b/menu/widgets/menu_entry.h @@ -61,7 +61,7 @@ enum menu_entry_type menu_entry_get_type(uint32_t i); void menu_entry_get_path(uint32_t i, char *s, size_t len); -void menu_entry_get_label(uint32_t i, char *s, size_t len); +void menu_entry_get_label(menu_entry_t *entry, char *s, size_t len); unsigned menu_entry_get_spacing(uint32_t i); From 7adf4ca854db476bd665e04fd19d5ae563a955af Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 06:44:04 +0200 Subject: [PATCH 054/253] Simplify menu_entry_get_spacing --- menu/drivers/rgui.c | 3 ++- menu/widgets/menu_entry.c | 11 ++++------- menu/widgets/menu_entry.h | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index a6779dc8ba..a9abf829c8 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -573,8 +573,8 @@ static void rgui_render(void *data, bool is_idle) char message[255]; char entry_title_buf[255]; char type_str_buf[255]; + unsigned entry_spacing; size_t entry_title_buf_utf8len, entry_title_buf_len; - unsigned entry_spacing = menu_entry_get_spacing((unsigned)i); bool entry_selected = menu_entry_is_currently_selected((unsigned)i); size_t selection = menu_navigation_get_selection(); @@ -590,6 +590,7 @@ static void rgui_render(void *data, bool is_idle) menu_entry_init(&entry); menu_entry_get(&entry, 0, (unsigned)i, NULL, true); + entry_spacing = menu_entry_get_spacing(&entry); menu_entry_get_value(&entry, entry_value, sizeof(entry_value)); menu_entry_get_rich_label(&entry, entry_path, sizeof(entry_path)); diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index f7635ce99e..6047843661 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -131,14 +131,11 @@ void menu_entry_get_label(menu_entry_t *entry, char *s, size_t len) strlcpy(s, entry->label, len); } -unsigned menu_entry_get_spacing(uint32_t i) +unsigned menu_entry_get_spacing(menu_entry_t *entry) { - menu_entry_t entry; - - menu_entry_init(&entry); - menu_entry_get(&entry, 0, i, NULL, true); - - return entry.spacing; + if (!entry) + return 0; + return entry->spacing; } unsigned menu_entry_get_type_new(uint32_t i) diff --git a/menu/widgets/menu_entry.h b/menu/widgets/menu_entry.h index 5b44abb8e7..eed9a7bc62 100644 --- a/menu/widgets/menu_entry.h +++ b/menu/widgets/menu_entry.h @@ -63,7 +63,7 @@ void menu_entry_get_path(uint32_t i, char *s, size_t len); void menu_entry_get_label(menu_entry_t *entry, char *s, size_t len); -unsigned menu_entry_get_spacing(uint32_t i); +unsigned menu_entry_get_spacing(menu_entry_t *entry); unsigned menu_entry_get_type_new(uint32_t i); From decea56c03698aca16b280886ca5c3ec38410bed Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 06:51:48 +0200 Subject: [PATCH 055/253] Rewrite menu_entry_get_path --- menu/drivers/xui.cpp | 2 +- menu/widgets/menu_entry.c | 20 ++++---------------- menu/widgets/menu_entry.h | 4 +--- ui/drivers/cocoa/cocoatouch_menu.m | 22 +++++++++++++++++----- 4 files changed, 23 insertions(+), 25 deletions(-) diff --git a/menu/drivers/xui.cpp b/menu/drivers/xui.cpp index ccefb7dd5e..a565774c05 100644 --- a/menu/drivers/xui.cpp +++ b/menu/drivers/xui.cpp @@ -600,7 +600,7 @@ static void xui_render(void *data, bool is_idle) menu_entry_get(&entry, 0, i, NULL, true); menu_entry_get_value(&entry, entry_value, sizeof(entry_value)); - menu_entry_get_path(i, entry_path, sizeof(entry_path)); + menu_entry_get_path(&entry, entry_path, sizeof(entry_path)); mbstowcs(msg_left, entry_path, sizeof(msg_left) / sizeof(wchar_t)); mbstowcs(msg_right, entry_value, sizeof(msg_right) / sizeof(wchar_t)); diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index 6047843661..14168fb0b3 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -93,14 +93,11 @@ void menu_entry_init(menu_entry_t *entry) entry->spacing = 0; } -void menu_entry_get_path(uint32_t i, char *s, size_t len) +void menu_entry_get_path(menu_entry_t *entry, char *s, size_t len) { - menu_entry_t entry; - - menu_entry_init(&entry); - menu_entry_get(&entry, 0, i, NULL, true); - - strlcpy(s, entry.path, len); + if (!entry) + return; + strlcpy(s, entry->path, len); } void menu_entry_get_rich_label(menu_entry_t *entry, char *s, size_t len) @@ -233,15 +230,6 @@ uint32_t menu_entry_pathdir_for_directory(uint32_t i) return flags & SD_FLAG_PATH_DIR; } -void menu_entry_pathdir_get_value(uint32_t i, char *s, size_t len) -{ - menu_entry_t entry; - - menu_entry_init(&entry); - menu_entry_get(&entry, 0, i, NULL, true); - strlcpy(s, entry.value, len); -} - void menu_entry_pathdir_extensions(uint32_t i, char *s, size_t len) { rarch_setting_t *setting = menu_entries_get_setting(i); diff --git a/menu/widgets/menu_entry.h b/menu/widgets/menu_entry.h index eed9a7bc62..fb5e093271 100644 --- a/menu/widgets/menu_entry.h +++ b/menu/widgets/menu_entry.h @@ -59,7 +59,7 @@ typedef struct menu_entry enum menu_entry_type menu_entry_get_type(uint32_t i); -void menu_entry_get_path(uint32_t i, char *s, size_t len); +void menu_entry_get_path(menu_entry_t *entry, char *s, size_t len); void menu_entry_get_label(menu_entry_t *entry, char *s, size_t len); @@ -87,8 +87,6 @@ bool menu_entry_pathdir_allow_empty(uint32_t i); uint32_t menu_entry_pathdir_for_directory(uint32_t i); -void menu_entry_pathdir_get_value(uint32_t i, char *s, size_t len); - void menu_entry_pathdir_extensions(uint32_t i, char *s, size_t len); void menu_entry_reset(uint32_t i); diff --git a/ui/drivers/cocoa/cocoatouch_menu.m b/ui/drivers/cocoa/cocoatouch_menu.m index 8cfc6cc780..22626fdacb 100644 --- a/ui/drivers/cocoa/cocoatouch_menu.m +++ b/ui/drivers/cocoa/cocoatouch_menu.m @@ -125,7 +125,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, menu_entry_init(&entry); menu_entry_get(&entry, 0, (unsigned)self.i, NULL, true); - menu_entry_get_path(self.i, label, sizeof(label)); + menu_entry_get_path(&entry, label, sizeof(label)); menu_entry_get_value(&entry, buffer, sizeof(buffer)); result.textLabel.text = BOXSTRING(label); @@ -152,6 +152,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, - (UITableViewCell*)cellForTableView:(UITableView*)tableView { + menu_entry_t entry; char label[PATH_MAX_LENGTH]; static NSString* const cell_id = @"boolean_setting"; @@ -166,7 +167,9 @@ static void RunActionSheet(const char* title, const struct string_list* items, result.accessoryView = [UISwitch new]; } - menu_entry_get_path(self.i, label, sizeof(label)); + menu_entry_init(&entry); + menu_entry_get(&entry, 0, (unsigned)self.i, NULL, true); + menu_entry_get_path(&entry, label, sizeof(label)); result.textLabel.text = BOXSTRING(label); [(id)result.accessoryView removeTarget:nil @@ -176,6 +179,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, action:@selector(handleBooleanSwitch:) forControlEvents:UIControlEventValueChanged]; [(id)result.accessoryView setOn:(menu_entry_get_bool_value(self.i))]; + menu_entry_free(&entry); return result; } @@ -210,11 +214,14 @@ static void RunActionSheet(const char* title, const struct string_list* items, - (void)wasSelectedOnTableView:(UITableView*)tableView ofController:(UIViewController*)controller { + menu_entry_t entry; struct string_list* items; char label[PATH_MAX_LENGTH]; RAMenuItemEnum __weak* weakSelf = self; - menu_entry_get_path(self.i, label, sizeof(label)); + menu_entry_init(&entry); + menu_entry_get(&entry, 0, (unsigned)self.i, NULL, true); + menu_entry_get_path(&entry, label, sizeof(label)); items = menu_entry_enum_values(self.i); RunActionSheet(label, items, self.parentTable, @@ -228,6 +235,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, [weakSelf.parentTable reloadData]; }); string_list_free(items); + menu_entry_free(&entry); } @end @@ -241,9 +249,12 @@ static void RunActionSheet(const char* title, const struct string_list* items, - (void)wasSelectedOnTableView:(UITableView *)tableView ofController:(UIViewController *)controller { + menu_entry_t entry; char label[PATH_MAX_LENGTH]; - menu_entry_get_path(self.i, label, sizeof(label)); + menu_entry_init(&entry); + menu_entry_get(&entry, 0, (unsigned)self.i, NULL, true); + menu_entry_get_path(&entry, label, sizeof(label)); self.alert = [[UIAlertView alloc] initWithTitle:BOXSTRING("RetroArch") @@ -263,6 +274,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, selector:@selector(checkBind:) userInfo:nil repeats:YES]; + menu_entry_free(&entry); } - (void)finishWithClickedButton:(bool)clicked @@ -421,7 +433,7 @@ replacementString:(NSString *)string menu_entry_init(&entry); menu_entry_get(&entry, 0, (unsigned)self.i, NULL, true); - menu_entry_get_path(self.i, label, sizeof(label)); + menu_entry_get_path(&entry, label, sizeof(label)); desc = BOXSTRING(label); From f914a919440ade537a42bcb05ab0351f7dd5a394 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 07:15:29 +0200 Subject: [PATCH 056/253] Use menu_entry_get_type_new --- menu/drivers/xmb.c | 20 +++++++++++++------- menu/widgets/menu_entry.c | 11 ++++------- menu/widgets/menu_entry.h | 2 +- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 84a52ef04c..9739d4b732 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -972,6 +972,7 @@ end: static void xmb_update_thumbnail_path(void *data, unsigned i) { menu_entry_t entry; + unsigned entry_type = 0; char *scrub_char_pointer = NULL; settings_t *settings = config_get_ptr(); xmb_handle_t *xmb = (xmb_handle_t*)data; @@ -987,7 +988,9 @@ static void xmb_update_thumbnail_path(void *data, unsigned i) menu_entry_init(&entry); menu_entry_get(&entry, 0, i, NULL, true); - if (entry.type == FILE_TYPE_IMAGEVIEWER || entry.type == FILE_TYPE_IMAGE) + entry_type = menu_entry_get_type_new(&entry); + + if (entry_type == FILE_TYPE_IMAGEVIEWER || entry_type == FILE_TYPE_IMAGE) { file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(0); xmb_node_t *node = (xmb_node_t*) @@ -1218,8 +1221,9 @@ static void xmb_selection_pointer_changed( if (i == selection) { - unsigned depth = (unsigned)xmb_list_get_size(xmb, MENU_LIST_PLAIN); - size_t xmb_list = xmb_list_get_selection(xmb); + unsigned depth = (unsigned)xmb_list_get_size(xmb, MENU_LIST_PLAIN); + size_t xmb_list = xmb_list_get_selection(xmb); + unsigned entry_type = menu_entry_get_type_new(&entry); ia = xmb->items.active.alpha; iz = xmb->items.active.zoom; @@ -1234,8 +1238,8 @@ static void xmb_selection_pointer_changed( xmb_update_thumbnail_path(xmb, i); xmb_update_thumbnail_image(xmb); } - else if (((entry.type == FILE_TYPE_IMAGE || entry.type == FILE_TYPE_IMAGEVIEWER || - entry.type == FILE_TYPE_RDB || entry.type == FILE_TYPE_RDB_ENTRY) + else if (((entry_type == FILE_TYPE_IMAGE || entry_type == FILE_TYPE_IMAGEVIEWER || + entry_type == FILE_TYPE_RDB || entry_type == FILE_TYPE_RDB_ENTRY) && xmb_list <= XMB_SYSTEM_TAB_SETTINGS)) { xmb_set_thumbnail_content(xmb, entry.path, sizeof(entry.path)); @@ -2354,6 +2358,7 @@ static void xmb_draw_items( char ticker_str[PATH_MAX_LENGTH]; char tmp[255]; menu_entry_t entry; + unsigned entry_type = 0; const float half_size = xmb->icon.size / 2.0f; uintptr_t texture_switch = 0; xmb_node_t * node = (xmb_node_t*) @@ -2383,8 +2388,9 @@ static void xmb_draw_items( continue; menu_entry_get(&entry, 0, i, list, true); + entry_type = menu_entry_get_type_new(&entry); - if (entry.type == FILE_TYPE_CONTENTLIST_ENTRY) + if (entry_type == FILE_TYPE_CONTENTLIST_ENTRY) fill_short_pathname_representation(entry.path, entry.path, sizeof(entry.path)); @@ -2510,7 +2516,7 @@ static void xmb_draw_items( math_matrix_4x4 mymat; menu_display_ctx_rotate_draw_t rotate_draw; uintptr_t texture = xmb_icon_get_id(xmb, core_node, node, - entry.enum_idx, entry.type, (i == current)); + entry.enum_idx, entry_type, (i == current)); float x = icon_x; float y = icon_y; float rotation = 0; diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index 14168fb0b3..e23c8d34f0 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -135,14 +135,11 @@ unsigned menu_entry_get_spacing(menu_entry_t *entry) return entry->spacing; } -unsigned menu_entry_get_type_new(uint32_t i) +unsigned menu_entry_get_type_new(menu_entry_t *entry) { - menu_entry_t entry; - - menu_entry_init(&entry); - menu_entry_get(&entry, 0, i, NULL, true); - - return entry.type; + if (!entry) + return 0; + return entry->type; } uint32_t menu_entry_get_bool_value(uint32_t i) diff --git a/menu/widgets/menu_entry.h b/menu/widgets/menu_entry.h index fb5e093271..d1a9f6b9ab 100644 --- a/menu/widgets/menu_entry.h +++ b/menu/widgets/menu_entry.h @@ -65,7 +65,7 @@ void menu_entry_get_label(menu_entry_t *entry, char *s, size_t len); unsigned menu_entry_get_spacing(menu_entry_t *entry); -unsigned menu_entry_get_type_new(uint32_t i); +unsigned menu_entry_get_type_new(menu_entry_t *entry); uint32_t menu_entry_get_bool_value(uint32_t i); From dfe6035aded8e7e19957a31cc6333dab9416e06a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 07:26:43 +0200 Subject: [PATCH 057/253] Put menu_entry_t on heap inside xmb_draw_items --- menu/drivers/xmb.c | 37 +++++++++++++++++++------------------ menu/widgets/menu_entry.c | 8 ++++++++ menu/widgets/menu_entry.h | 2 ++ 3 files changed, 29 insertions(+), 18 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 9739d4b732..79646e13d4 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2357,7 +2357,6 @@ static void xmb_draw_items( menu_animation_ctx_ticker_t ticker; char ticker_str[PATH_MAX_LENGTH]; char tmp[255]; - menu_entry_t entry; unsigned entry_type = 0; const float half_size = xmb->icon.size / 2.0f; uintptr_t texture_switch = 0; @@ -2365,13 +2364,14 @@ static void xmb_draw_items( menu_entries_get_userdata_at_offset(list, i); bool do_draw_text = false; unsigned ticker_limit = 35; + menu_entry_t *entry = menu_entry_alloc(); if (!node) continue; ticker_str[0] = tmp[0] = '\0'; - menu_entry_init(&entry); + menu_entry_init(entry); icon_y = xmb->margins.screen.top + node->y + half_size; @@ -2387,23 +2387,23 @@ static void xmb_draw_items( if (icon_x < -half_size || icon_x > width) continue; - menu_entry_get(&entry, 0, i, list, true); - entry_type = menu_entry_get_type_new(&entry); + menu_entry_get(entry, 0, i, list, true); + entry_type = menu_entry_get_type_new(entry); if (entry_type == FILE_TYPE_CONTENTLIST_ENTRY) - fill_short_pathname_representation(entry.path, entry.path, - sizeof(entry.path)); + fill_short_pathname_representation(entry->path, entry->path, + sizeof(entry->path)); - if (string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_DISABLED)) || - (string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))) + if (string_is_equal(entry->value, msg_hash_to_str(MENU_ENUM_LABEL_DISABLED)) || + (string_is_equal(entry->value, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))) { if (xmb->textures.list[XMB_TEXTURE_SWITCH_OFF]) texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_OFF]; else do_draw_text = true; } - else if (string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_ENABLED)) || - (string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON)))) + else if (string_is_equal(entry->value, msg_hash_to_str(MENU_ENUM_LABEL_ENABLED)) || + (string_is_equal(entry->value, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON)))) { if (xmb->textures.list[XMB_TEXTURE_SWITCH_ON]) texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_ON]; @@ -2412,7 +2412,7 @@ static void xmb_draw_items( } else { - enum msg_file_type type = msg_hash_to_file_type(msg_hash_calculate(entry.value)); + enum msg_file_type type = msg_hash_to_file_type(msg_hash_calculate(entry->value)); switch (type) { @@ -2435,7 +2435,7 @@ static void xmb_draw_items( } } - if (string_is_empty(entry.value)) + if (string_is_empty(entry->value)) { if (xmb->savestate_thumbnail || (!string_is_equal @@ -2448,7 +2448,7 @@ static void xmb_draw_items( ticker_limit = 70; } - menu_entry_get_rich_label(&entry, ticker_str, sizeof(ticker_str)); + menu_entry_get_rich_label(entry, ticker_str, sizeof(ticker_str)); ticker.s = tmp; ticker.len = ticker_limit; @@ -2460,7 +2460,7 @@ static void xmb_draw_items( label_offset = xmb->margins.label.top; if (i == current && width > 320 && height > 240 - && !string_is_empty(entry.sublabel)) + && !string_is_empty(entry->sublabel)) { char entry_sublabel[255]; @@ -2468,7 +2468,7 @@ static void xmb_draw_items( label_offset = - xmb->margins.label.top; - word_wrap(entry_sublabel, entry.sublabel, 50, true); + word_wrap(entry_sublabel, entry->sublabel, 50, true); xmb_draw_text(menu_disp_info, xmb, entry_sublabel, node->x + xmb->margins.screen.left + @@ -2490,7 +2490,7 @@ static void xmb_draw_items( ticker.s = tmp; ticker.len = 35; ticker.idx = frame_count / 20; - ticker.str = entry.value; + ticker.str = entry->value; ticker.selected = (i == current); menu_animation_ticker(&ticker); @@ -2516,7 +2516,7 @@ static void xmb_draw_items( math_matrix_4x4 mymat; menu_display_ctx_rotate_draw_t rotate_draw; uintptr_t texture = xmb_icon_get_id(xmb, core_node, node, - entry.enum_idx, entry_type, (i == current)); + entry->enum_idx, entry_type, (i == current)); float x = icon_x; float y = icon_y; float rotation = 0; @@ -2566,7 +2566,8 @@ static void xmb_draw_items( &color[0], xmb->shadow_offset); - menu_entry_free(&entry); + menu_entry_free(entry); + free(entry); } menu_display_blend_end(); diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index e23c8d34f0..580f42f37f 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -79,6 +79,14 @@ void menu_entry_free(menu_entry_t *entry) { } +menu_entry_t *menu_entry_alloc(void) +{ + menu_entry_t *entry = (menu_entry_t*)malloc(sizeof(menu_entry_t)); + if (!entry) + return NULL; + return entry; +} + void menu_entry_init(menu_entry_t *entry) { entry->path[0] = '\0'; diff --git a/menu/widgets/menu_entry.h b/menu/widgets/menu_entry.h index d1a9f6b9ab..d8e790cc1d 100644 --- a/menu/widgets/menu_entry.h +++ b/menu/widgets/menu_entry.h @@ -117,6 +117,8 @@ int menu_entry_action(menu_entry_t *entry, void menu_entry_free(menu_entry_t *entry); +menu_entry_t *menu_entry_alloc(void); + void menu_entry_init(menu_entry_t *entry); RETRO_END_DECLS From 1fb640377fee5b9ce70bedb5e83269f1b58f4baa Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 08:00:36 +0200 Subject: [PATCH 058/253] Remove hashes --- msg_hash.h | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/msg_hash.h b/msg_hash.h index abda5634bc..ef405d8eb3 100644 --- a/msg_hash.h +++ b/msg_hash.h @@ -1646,7 +1646,6 @@ enum msg_hash_enums /* Deferred */ -#define MENU_LABEL_DEFERRED_BROWSE_URL_LIST 0x6358c2c4U #define MENU_LABEL_DEFERRED_THUMBNAILS_UPDATER_LIST 0x364dfa2bU #define MENU_LABEL_DEFERRED_VIDEO_FILTER 0x966ad201U #define MENU_LABEL_DEFERRED_CORE_LIST_SET 0xa6d5fdb4U @@ -1695,18 +1694,11 @@ enum msg_hash_enums #define MENU_LABEL_CHEEVOS_DESCRIPTION 0x7e00e0f5U -/* Playlist settings */ - -#define MENU_LABEL_PLAYLIST_SETTINGS_BEGIN 0x80a8d2cbU - /* Accounts settings */ #define MENU_LABEL_ACCOUNTS_RETRO_ACHIEVEMENTS 0xe6b7c16cU #define MENU_LABEL_ACCOUNTS_LIST 0x774c15a0U -#define MENU_LABEL_VALUE_ACCOUNTS_LIST_END 0x3d559522U - - #define MENU_LABEL_DOWNLOADED_FILE_DETECT_CORE_LIST 0xb4f82700U /* Scan values */ @@ -1721,8 +1713,6 @@ enum msg_hash_enums /* Information settings */ #define MENU_LABEL_INFORMATION_LIST 0x225e7606U -#define MENU_LABEL_SYSTEM_INFORMATION 0x206ebf0fU -#define MENU_LABEL_NETWORK_INFORMATION 0x73ae3cb4U #define MENU_LABEL_CONTENT_SETTINGS 0xe789f7f6U @@ -1735,9 +1725,6 @@ enum msg_hash_enums /* Video settings */ #define MENU_LABEL_VIDEO_FONT_PATH 0xd0de729eU -#define MENU_LABEL_VIDEO_VI_WIDTH 0x6e4a6d3aU -#define MENU_LABEL_VIDEO_VFILTER 0x664f8397U -#define MENU_LABEL_VIDEO_GAMMA 0x08a951beU #define MENU_LABEL_VIDEO_SHADER_PRESET_SAVE_AS 0x3d6e5ce5U #define MENU_LABEL_VIDEO_SHADER_DEFAULT_FILTER 0x4468cb1bU @@ -1887,9 +1874,6 @@ enum msg_hash_enums #define MENU_LABEL_SETTINGS 0x1304dc16U #define MENU_LABEL_HELP 0x7c97d2eeU #define MENU_VALUE_HORIZONTAL_MENU 0x35761704U -#define MENU_LABEL_QUIT_RETROARCH 0x84b0bc71U - -#define MENU_LABEL_BROWSE_URL_LIST 0xa7d1a004U const char *msg_hash_to_str(enum msg_hash_enums msg); From 270f35753af9abe2f8294915d8abf3c31d2a5cd3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 08:42:12 +0200 Subject: [PATCH 059/253] reorder XMB variables --- menu/drivers/xmb.c | 665 +++++++++++++++++++++------------------------ 1 file changed, 306 insertions(+), 359 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 79646e13d4..db67ffdae1 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -174,132 +174,81 @@ enum typedef struct xmb_handle { - file_list_t *selection_buf_old; - file_list_t *horizontal_list; - size_t selection_ptr_old; + bool mouse_show; + + uint8_t system_tab_end; + uint8_t tabs[8]; + int depth; int old_depth; - char box_message[1024]; - float x; - float alpha; + int icon_size; + int cursor_size; + + size_t categories_selection_ptr; + size_t categories_selection_ptr_old; + size_t selection_ptr_old; + + unsigned categories_active_idx; + unsigned categories_active_idx_old; uintptr_t thumbnail; uintptr_t savestate_thumbnail; + + float x; + float alpha; float thumbnail_width; float thumbnail_height; float savestate_thumbnail_width; float savestate_thumbnail_height; + float above_subitem_offset; + float above_item_offset; + float active_item_factor; + float under_item_offset; + float shadow_offset; + float font_size; + float font2_size; + + float margins_screen_left; + float margins_screen_top; + float margins_setting_left; + float margins_title_left; + float margins_title_top; + float margins_title_bottom; + float margins_label_left; + float margins_label_top; + float icon_spacing_horizontal; + float icon_spacing_vertical; + float items_active_alpha; + float items_active_zoom; + float items_passive_alpha; + float items_passive_zoom; + float margins_dialog; + float margins_slice; + float textures_arrow_alpha; + float categories_x_pos; + float categories_passive_alpha; + float categories_passive_zoom; + float categories_active_zoom; + float categories_active_alpha; + + uint64_t frame_count; + + char title_name[255]; + char box_message[1024]; char background_file_path[PATH_MAX_LENGTH]; char thumbnail_system[PATH_MAX_LENGTH]; char thumbnail_content[PATH_MAX_LENGTH]; char thumbnail_file_path[PATH_MAX_LENGTH]; char savestate_thumbnail_file_path[PATH_MAX_LENGTH]; - uint64_t frame_count; - bool mouse_show; + file_list_t *selection_buf_old; + file_list_t *horizontal_list; struct { - struct - { - float left; - float top; - - } screen; - - struct - { - float left; - } setting; - - struct - { - float left; - float top; - float bottom; - } title; - - struct - { - float left; - float top; - } label; - - float dialog; - float slice; - } margins; - - float above_subitem_offset; - float above_item_offset; - float active_item_factor; - float under_item_offset; - - float shadow_offset; - - char title_name[255]; - - struct - { - struct - { - float alpha; - } arrow; - menu_texture_item bg; menu_texture_item list[XMB_TEXTURE_LAST]; } textures; - struct - { - struct - { - float horizontal; - float vertical; - } spacing; - - int size; - } icon; - - struct - { - int size; - } cursor; - - struct - { - struct - { - unsigned idx; - unsigned idx_old; - float alpha; - float zoom; - } active; - - struct - { - float alpha; - float zoom; - } passive; - - float x_pos; - size_t selection_ptr_old; - size_t selection_ptr; - } categories; - - struct - { - struct - { - float alpha; - float zoom; - } active; - - struct - { - float alpha; - float zoom; - } passive; - } items; - xmb_node_t main_menu_node; #ifdef HAVE_IMAGEVIEWER xmb_node_t images_tab_node; @@ -316,13 +265,8 @@ typedef struct xmb_handle font_data_t *font; font_data_t *font2; - float font_size; - float font2_size; video_font_raster_block_t raster_block; video_font_raster_block_t raster_block2; - - uint8_t tabs[8]; - uint8_t system_tab_end; } xmb_handle_t; static float coord_shadow[] = { @@ -571,7 +515,7 @@ static size_t xmb_list_get_selection(void *data) if (!xmb) return 0; - return xmb->categories.selection_ptr; + return xmb->categories_selection_ptr; } static size_t xmb_list_get_size(void *data, enum menu_list_type type) @@ -623,7 +567,7 @@ static void *xmb_list_get_entry(void *data, enum menu_list_type type, unsigned i static INLINE float xmb_item_y(const xmb_handle_t *xmb, int i, size_t current) { - float iy = xmb->icon.spacing.vertical; + float iy = xmb->icon_spacing_vertical; if (i < (int)current) if (xmb->depth > 1) @@ -634,7 +578,7 @@ static INLINE float xmb_item_y(const xmb_handle_t *xmb, int i, size_t current) iy *= (i - (int)current + xmb->under_item_offset); if (i == (int)current) - iy = xmb->icon.spacing.vertical * xmb->active_item_factor; + iy = xmb->icon_spacing_vertical * xmb->active_item_factor; return iy; } @@ -939,14 +883,14 @@ static void xmb_render_messagebox_internal( menu_display_blend_begin(); menu_display_draw_texture_slice( - x - longest_width/2 - xmb->margins.dialog, - y + xmb->margins.slice - xmb->margins.dialog, + x - longest_width/2 - xmb->margins_dialog, + y + xmb->margins_slice - xmb->margins_dialog, 256, 256, - longest_width + xmb->margins.dialog*2, - line_height * list->size + xmb->margins.dialog*2, + longest_width + xmb->margins_dialog * 2, + line_height * list->size + xmb->margins_dialog * 2, width, height, &coord_white[0], - xmb->margins.slice, 1.0, xmb->textures.list[XMB_TEXTURE_DIALOG_SLICE]); + xmb->margins_slice, 1.0, xmb->textures.list[XMB_TEXTURE_DIALOG_SLICE]); for (i = 0; i < list->size; i++) { @@ -1196,7 +1140,7 @@ static void xmb_selection_pointer_changed( menu_entry_get(&entry, 0, selection, NULL, true); end = (unsigned)menu_entries_get_end(); - threshold = xmb->icon.size*10; + threshold = xmb->icon_size * 10; video_driver_get_size(NULL, &height); @@ -1208,8 +1152,8 @@ static void xmb_selection_pointer_changed( for (i = 0; i < end; i++) { float iy, real_iy; - float ia = xmb->items.passive.alpha; - float iz = xmb->items.passive.zoom; + float ia = xmb->items_passive_alpha; + float iz = xmb->items_passive_zoom; xmb_node_t *node = (xmb_node_t*) menu_entries_get_userdata_at_offset(selection_buf, i); @@ -1217,7 +1161,7 @@ static void xmb_selection_pointer_changed( continue; iy = xmb_item_y(xmb, i, selection); - real_iy = iy + xmb->margins.screen.top; + real_iy = iy + xmb->margins_screen_top; if (i == selection) { @@ -1225,8 +1169,8 @@ static void xmb_selection_pointer_changed( size_t xmb_list = xmb_list_get_selection(xmb); unsigned entry_type = menu_entry_get_type_new(&entry); - ia = xmb->items.active.alpha; - iz = xmb->items.active.zoom; + ia = xmb->items_active_alpha; + iz = xmb->items_active_zoom; if (!string_is_equal(thumb_ident, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF))) @@ -1301,7 +1245,7 @@ static void xmb_list_open_old(xmb_handle_t *xmb, file_list_t *list, int dir, size_t current) { unsigned i, height = 0; - int threshold = xmb->icon.size * 10; + int threshold = xmb->icon_size * 10; size_t end = 0; end = file_list_get_size(list); @@ -1319,17 +1263,17 @@ static void xmb_list_open_old(xmb_handle_t *xmb, continue; if (i == current) - ia = xmb->items.active.alpha; + ia = xmb->items_active_alpha; if (dir == -1) ia = 0; - real_y = node->y + xmb->margins.screen.top; + real_y = node->y + xmb->margins_screen_top; if (real_y < -threshold || real_y > height+threshold) { node->alpha = ia; node->label_alpha = 0; - node->x = xmb->icon.size * dir * -2; + node->x = xmb->icon_size * dir * -2; } else { @@ -1349,7 +1293,7 @@ static void xmb_list_open_old(xmb_handle_t *xmb, menu_animation_push(&anim_entry); - anim_entry.target_value = xmb->icon.size * dir * -2; + anim_entry.target_value = xmb->icon_size * dir * -2; anim_entry.subject = &node->x; menu_animation_push(&anim_entry); @@ -1362,7 +1306,7 @@ static void xmb_list_open_new(xmb_handle_t *xmb, { unsigned i, height; size_t skip = 0; - int threshold = xmb->icon.size * 10; + int threshold = xmb->icon_size * 10; size_t end = file_list_get_size(list); video_driver_get_size(NULL, &height); @@ -1383,18 +1327,18 @@ static void xmb_list_open_new(xmb_handle_t *xmb, if (dir == 1 || dir == -1) node->label_alpha = 0; - node->x = xmb->icon.size * dir * 2; + node->x = xmb->icon_size * dir * 2; node->y = xmb_item_y(xmb, i, current); - node->zoom = xmb->categories.passive.zoom; + node->zoom = xmb->categories_passive_zoom; - real_y = node->y + xmb->margins.screen.top; + real_y = node->y + xmb->margins_screen_top; if (i == current) - node->zoom = xmb->categories.active.zoom; + node->zoom = xmb->categories_active_zoom; - ia = xmb->items.passive.alpha; + ia = xmb->items_passive_alpha; if (i == current) - ia = xmb->items.active.alpha; + ia = xmb->items_active_alpha; if (real_y < -threshold || real_y > height+threshold) { @@ -1448,13 +1392,13 @@ static xmb_node_t *xmb_node_allocate_userdata(xmb_handle_t *xmb, unsigned i) return NULL; } - node->alpha = xmb->categories.passive.alpha; - node->zoom = xmb->categories.passive.zoom; + node->alpha = xmb->categories_passive_alpha; + node->zoom = xmb->categories_passive_zoom; - if ((i + xmb->system_tab_end) == xmb->categories.active.idx) + if ((i + xmb->system_tab_end) == xmb->categories_active_idx) { - node->alpha = xmb->categories.active.alpha; - node->zoom = xmb->categories.active.zoom; + node->alpha = xmb->categories_active_alpha; + node->zoom = xmb->categories_active_zoom; } tmp = (xmb_node_t*)file_list_get_userdata_at_offset(xmb->horizontal_list, i); @@ -1500,7 +1444,7 @@ static void xmb_list_switch_old(xmb_handle_t *xmb, { unsigned i, first, last, height; size_t end = file_list_get_size(list); - float ix = -xmb->icon.spacing.horizontal * dir; + float ix = -xmb->icon_spacing_horizontal * dir; float ia = 0; first = 0; @@ -1586,17 +1530,17 @@ static void xmb_list_switch_new(xmb_handle_t *xmb, { xmb_node_t *node = (xmb_node_t*) menu_entries_get_userdata_at_offset(list, i); - float ia = xmb->items.passive.alpha; + float ia = xmb->items_passive_alpha; if (!node) continue; - node->x = xmb->icon.spacing.horizontal * dir; + node->x = xmb->icon_spacing_horizontal * dir; node->alpha = 0; node->label_alpha = 0; if (i == current) - ia = xmb->items.active.alpha; + ia = xmb->items_active_alpha; if (i >= first && i <= last) xmb_push_animations(node, (uintptr_t)list, ia, 0); @@ -1610,7 +1554,7 @@ static void xmb_list_switch_new(xmb_handle_t *xmb, static void xmb_set_title(xmb_handle_t *xmb) { - if (xmb->categories.selection_ptr <= xmb->system_tab_end) + if (xmb->categories_selection_ptr <= xmb->system_tab_end) { menu_entries_get_title(xmb->title_name, sizeof(xmb->title_name)); } @@ -1619,7 +1563,7 @@ static void xmb_set_title(xmb_handle_t *xmb) const char *path = NULL; menu_entries_get_at_offset( xmb->horizontal_list, - xmb->categories.selection_ptr - (xmb->system_tab_end + 1), + xmb->categories_selection_ptr - (xmb->system_tab_end + 1), &path, NULL, NULL, NULL, NULL); if (!path) @@ -1682,17 +1626,17 @@ static void xmb_list_switch_horizontal_list(xmb_handle_t *xmb) for (j = 0; j <= list_size; j++) { menu_animation_ctx_entry_t entry; - float ia = xmb->categories.passive.alpha; - float iz = xmb->categories.passive.zoom; + float ia = xmb->categories_passive_alpha; + float iz = xmb->categories_passive_zoom; xmb_node_t *node = xmb_get_node(xmb, j); if (!node) continue; - if (j == xmb->categories.active.idx) + if (j == xmb->categories_active_idx) { - ia = xmb->categories.active.alpha; - iz = xmb->categories.active.zoom; + ia = xmb->categories_active_alpha; + iz = xmb->categories_active_zoom; } entry.duration = XMB_DELAY; @@ -1720,16 +1664,16 @@ static void xmb_list_switch(xmb_handle_t *xmb) size_t selection = menu_navigation_get_selection(); settings_t *settings = config_get_ptr(); - if (xmb->categories.selection_ptr > xmb->categories.selection_ptr_old) + if (xmb->categories_selection_ptr > xmb->categories_selection_ptr_old) dir = 1; - xmb->categories.active.idx += dir; + xmb->categories_active_idx += dir; xmb_list_switch_horizontal_list(xmb); anim_entry.duration = XMB_DELAY; - anim_entry.target_value = xmb->icon.spacing.horizontal * -(float)xmb->categories.selection_ptr; - anim_entry.subject = &xmb->categories.x_pos; + anim_entry.target_value = xmb->icon_spacing_horizontal * -(float)xmb->categories_selection_ptr; + anim_entry.subject = &xmb->categories_x_pos; anim_entry.easing_enum = EASING_OUT_QUAD; /* TODO/FIXME - integer conversion resulted in change of sign */ anim_entry.tag = -1; @@ -1739,7 +1683,7 @@ static void xmb_list_switch(xmb_handle_t *xmb) menu_animation_push(&anim_entry); dir = -1; - if (xmb->categories.selection_ptr > xmb->categories.selection_ptr_old) + if (xmb->categories_selection_ptr > xmb->categories_selection_ptr_old) dir = 1; xmb_list_switch_old(xmb, xmb->selection_buf_old, @@ -1748,7 +1692,7 @@ static void xmb_list_switch(xmb_handle_t *xmb) /* Check if we are to have horizontal animations. */ if (settings->bools.menu_horizontal_animation) xmb_list_switch_new(xmb, selection_buf, dir, selection); - xmb->categories.active.idx_old = (unsigned)xmb->categories.selection_ptr; + xmb->categories_active_idx_old = (unsigned)xmb->categories_selection_ptr; if (!string_is_equal(xmb_thumbnails_ident(), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF))) @@ -1782,10 +1726,10 @@ static void xmb_list_open_horizontal_list(xmb_handle_t *xmb) if (!node) continue; - if (j == xmb->categories.active.idx) - ia = xmb->categories.active.alpha; + if (j == xmb->categories_active_idx) + ia = xmb->categories_active_alpha; else if (xmb->depth <= 1) - ia = xmb->categories.passive.alpha; + ia = xmb->categories_passive_alpha; entry.duration = XMB_DELAY; entry.target_value = ia; @@ -1869,15 +1813,15 @@ static void xmb_toggle_horizontal_list(xmb_handle_t *xmb) continue; node->alpha = 0; - node->zoom = xmb->categories.passive.zoom; + node->zoom = xmb->categories_passive_zoom; - if (i == xmb->categories.active.idx) + if (i == xmb->categories_active_idx) { - node->alpha = xmb->categories.active.alpha; - node->zoom = xmb->categories.active.zoom; + node->alpha = xmb->categories_active_alpha; + node->zoom = xmb->categories_active_zoom; } else if (xmb->depth <= 1) - node->alpha = xmb->categories.passive.alpha; + node->alpha = xmb->categories_passive_alpha; } } @@ -1889,11 +1833,11 @@ static void xmb_context_reset_horizontal_list( size_t list_size = xmb_list_get_size(xmb, MENU_LIST_HORIZONTAL); - xmb->categories.x_pos = xmb->icon.spacing.horizontal * - -(float)xmb->categories.selection_ptr; + xmb->categories_x_pos = xmb->icon_spacing_horizontal * + -(float)xmb->categories_selection_ptr; depth = (xmb->depth > 1) ? 2 : 1; - xmb->x = xmb->icon.size * -(depth*2-2); + xmb->x = xmb->icon_size * -(depth*2-2); for (i = 0; i < list_size; i++) { @@ -2054,7 +1998,7 @@ static void xmb_list_open(xmb_handle_t *xmb) entry.duration = XMB_DELAY; - entry.target_value = xmb->icon.size * -(xmb->depth*2-2); + entry.target_value = xmb->icon_size * -(xmb->depth*2-2); entry.subject = &xmb->x; entry.easing_enum = EASING_OUT_QUAD; /* TODO/FIXME - integer conversion resulted in change of sign */ @@ -2067,7 +2011,7 @@ static void xmb_list_open(xmb_handle_t *xmb) menu_animation_push(&entry); entry.target_value = 0; - entry.subject = &xmb->textures.arrow.alpha; + entry.subject = &xmb->textures_arrow_alpha; menu_animation_push(&entry); break; @@ -2075,7 +2019,7 @@ static void xmb_list_open(xmb_handle_t *xmb) menu_animation_push(&entry); entry.target_value = 1; - entry.subject = &xmb->textures.arrow.alpha; + entry.subject = &xmb->textures_arrow_alpha; menu_animation_push(&entry); break; @@ -2106,7 +2050,7 @@ static void xmb_populate_entries(void *data, xmb_set_title(xmb); - if (xmb->categories.selection_ptr != xmb->categories.active.idx_old) + if (xmb->categories_selection_ptr != xmb->categories_active_idx_old) xmb_list_switch(xmb); else xmb_list_open(xmb); @@ -2176,7 +2120,7 @@ static uintptr_t xmb_icon_get_id(xmb_handle_t *xmb, if (core_node) return core_node->content_icon; - switch (xmb_get_system_tab(xmb, (unsigned)xmb->categories.selection_ptr)) + switch (xmb_get_system_tab(xmb, (unsigned)xmb->categories_selection_ptr)) { case XMB_SYSTEM_TAB_FAVORITES: return xmb->textures.list[XMB_TEXTURE_FAVORITE]; @@ -2267,7 +2211,7 @@ static void xmb_calculate_visible_range(const xmb_handle_t *xmb, unsigned *first, unsigned *last) { unsigned j; - float base_y = xmb->margins.screen.top; + float base_y = xmb->margins_screen_top; *first = 0; *last = list_size ? list_size - 1 : 0; @@ -2276,7 +2220,7 @@ static void xmb_calculate_visible_range(const xmb_handle_t *xmb, { for (j = current; j-- > 0; ) { - float bottom = xmb_item_y(xmb, j, current) + base_y + xmb->icon.size; + float bottom = xmb_item_y(xmb, j, current) + base_y + xmb->icon_size; if (bottom < 0) break; @@ -2358,7 +2302,7 @@ static void xmb_draw_items( char ticker_str[PATH_MAX_LENGTH]; char tmp[255]; unsigned entry_type = 0; - const float half_size = xmb->icon.size / 2.0f; + const float half_size = xmb->icon_size / 2.0f; uintptr_t texture_switch = 0; xmb_node_t * node = (xmb_node_t*) menu_entries_get_userdata_at_offset(list, i); @@ -2373,16 +2317,16 @@ static void xmb_draw_items( menu_entry_init(entry); - icon_y = xmb->margins.screen.top + node->y + half_size; + icon_y = xmb->margins_screen_top + node->y + half_size; if (icon_y < half_size) continue; - if (icon_y > height + xmb->icon.size) + if (icon_y > height + xmb->icon_size) break; - icon_x = node->x + xmb->margins.screen.left + - xmb->icon.spacing.horizontal - half_size; + icon_x = node->x + xmb->margins_screen_left + + xmb->icon_spacing_horizontal - half_size; if (icon_x < -half_size || icon_x > width) continue; @@ -2458,7 +2402,7 @@ static void xmb_draw_items( menu_animation_ticker(&ticker); - label_offset = xmb->margins.label.top; + label_offset = xmb->margins_label_top; if (i == current && width > 320 && height > 240 && !string_is_empty(entry->sublabel)) { @@ -2466,22 +2410,22 @@ static void xmb_draw_items( entry_sublabel[0] = '\0'; - label_offset = - xmb->margins.label.top; + label_offset = - xmb->margins_label_top; word_wrap(entry_sublabel, entry->sublabel, 50, true); xmb_draw_text(menu_disp_info, xmb, entry_sublabel, - node->x + xmb->margins.screen.left + - xmb->icon.spacing.horizontal + xmb->margins.label.left, - xmb->margins.screen.top + node->y + xmb->margins.label.top*3.5, + node->x + xmb->margins_screen_left + + xmb->icon_spacing_horizontal + xmb->margins_label_left, + xmb->margins_screen_top + node->y + xmb->margins_label_top*3.5, 1, node->label_alpha, TEXT_ALIGN_LEFT, width, height, xmb->font2); } xmb_draw_text(menu_disp_info, xmb, tmp, - node->x + xmb->margins.screen.left + - xmb->icon.spacing.horizontal + xmb->margins.label.left, - xmb->margins.screen.top + node->y + label_offset, + node->x + xmb->margins_screen_left + + xmb->icon_spacing_horizontal + xmb->margins_label_left, + xmb->margins_screen_top + node->y + label_offset, 1, node->label_alpha, TEXT_ALIGN_LEFT, width, height, xmb->font); @@ -2498,11 +2442,11 @@ static void xmb_draw_items( if (do_draw_text) xmb_draw_text(menu_disp_info, xmb, tmp, node->x + - + xmb->margins.screen.left - + xmb->icon.spacing.horizontal - + xmb->margins.label.left - + xmb->margins.setting.left, - xmb->margins.screen.top + node->y + xmb->margins.label.top, + + xmb->margins_screen_left + + xmb->icon_spacing_horizontal + + xmb->margins_label_left + + xmb->margins_setting_left, + xmb->margins_screen_top + node->y + xmb->margins_label_top, 1, node->label_alpha, TEXT_ALIGN_LEFT, @@ -2533,7 +2477,7 @@ static void xmb_draw_items( xmb_draw_icon( menu_disp_info, - xmb->icon.size, + xmb->icon_size, &mymat, texture, x, @@ -2552,13 +2496,13 @@ static void xmb_draw_items( if (texture_switch != 0 && color[3] != 0) xmb_draw_icon( menu_disp_info, - xmb->icon.size, + xmb->icon_size, &mymat, texture_switch, - node->x + xmb->margins.screen.left - + xmb->icon.spacing.horizontal - + xmb->icon.size / 2.0 + xmb->margins.setting.left, - xmb->margins.screen.top + node->y + xmb->icon.size / 2.0, + node->x + xmb->margins_screen_left + + xmb->icon_spacing_horizontal + + xmb->icon_size / 2.0 + xmb->margins_setting_left, + xmb->margins_screen_top + node->y + xmb->icon_size / 2.0, width, height, node->alpha, 0, @@ -2599,7 +2543,7 @@ static void xmb_render(void *data, bool is_idle) size_t selection = menu_navigation_get_selection(); int16_t pointer_y = menu_input_pointer_state(MENU_POINTER_Y_AXIS); int16_t mouse_y = menu_input_mouse_state(MENU_MOUSE_Y_AXIS) - + (xmb->cursor.size/2); + + (xmb->cursor_size/2); unsigned first = 0, last = end; unsigned height; @@ -2610,9 +2554,9 @@ static void xmb_render(void *data, bool is_idle) for (i = first; i <= last; i++) { - float item_y1 = xmb->margins.screen.top + float item_y1 = xmb->margins_screen_top + xmb_item_y(xmb, (int)i, selection); - float item_y2 = item_y1 + xmb->icon.size; + float item_y2 = item_y1 + xmb->icon_size; if (pointer_enable) { @@ -2845,14 +2789,15 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) /* Title text */ xmb_draw_text(menu_disp_info, xmb, - title_truncated, xmb->margins.title.left, - xmb->margins.title.top, 1, 1, TEXT_ALIGN_LEFT, + title_truncated, xmb->margins_title_left, + xmb->margins_title_top, + 1, 1, TEXT_ALIGN_LEFT, width, height, xmb->font); if (settings->bools.menu_core_enable && menu_entries_get_core_title(title_msg, sizeof(title_msg)) == 0) - xmb_draw_text(menu_disp_info, xmb, title_msg, xmb->margins.title.left, - height - xmb->margins.title.bottom, 1, 1, TEXT_ALIGN_LEFT, + xmb_draw_text(menu_disp_info, xmb, title_msg, xmb->margins_title_left, + height - xmb->margins_title_bottom, 1, 1, TEXT_ALIGN_LEFT, width, height, xmb->font); rotate_draw.matrix = &mymat; @@ -2868,9 +2813,10 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) if (xmb->savestate_thumbnail) xmb_draw_thumbnail(menu_disp_info, xmb, &coord_white[0], width, height, - xmb->margins.screen.left + xmb->icon.spacing.horizontal + - xmb->icon.spacing.horizontal*4 - xmb->icon.size / 4, - xmb->margins.screen.top + xmb->icon.size + xmb->savestate_thumbnail_height, + xmb->margins_screen_left + + xmb->icon_spacing_horizontal + + xmb->icon_spacing_horizontal * 4 - xmb->icon_size / 4, + xmb->margins_screen_top + xmb->icon_size + xmb->savestate_thumbnail_height, xmb->savestate_thumbnail_width, xmb->savestate_thumbnail_height, xmb->savestate_thumbnail); else if (xmb->thumbnail @@ -2884,9 +2830,9 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) xmb_draw_thumbnail(menu_disp_info, xmb, &coord_white[0], width, height, - xmb->margins.screen.left + xmb->icon.spacing.horizontal + - xmb->icon.spacing.horizontal*4 - xmb->icon.size / 4, - xmb->margins.screen.top + xmb->icon.size + xmb->thumbnail_height, + xmb->margins_screen_left + xmb->icon_spacing_horizontal + + xmb->icon_spacing_horizontal*4 - xmb->icon_size / 4, + xmb->margins_screen_top + xmb->icon_size + xmb->thumbnail_height, xmb->thumbnail_width, xmb->thumbnail_height, xmb->thumbnail); } @@ -2916,18 +2862,18 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) if (percent > 0) { - size_t x_pos = xmb->icon.size / 6; - size_t x_pos_icon = xmb->margins.title.left; + size_t x_pos = xmb->icon_size / 6; + size_t x_pos_icon = xmb->margins_title_left; if (coord_white[3] != 0) xmb_draw_icon( menu_disp_info, - xmb->icon.size, + xmb->icon_size, &mymat, xmb->textures.list[charging ? XMB_TEXTURE_BATTERY_CHARGING : XMB_TEXTURE_BATTERY_FULL], - width - (xmb->icon.size / 2) - x_pos_icon, - xmb->icon.size, + width - (xmb->icon_size / 2) - x_pos_icon, + xmb->icon_size, width, height, 1, @@ -2941,8 +2887,8 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) percent_width = (unsigned)font_driver_get_message_width(xmb->font, msg, (unsigned)strlen(msg), 1); xmb_draw_text(menu_disp_info, xmb, msg, - width - xmb->margins.title.left - x_pos, - xmb->margins.title.top, 1, 1, TEXT_ALIGN_RIGHT, + width - xmb->margins_title_left - x_pos, + xmb->margins_title_top, 1, 1, TEXT_ALIGN_RIGHT, width, height, xmb->font); } } @@ -2958,15 +2904,16 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) int x_pos = 0; if (percent_width) - x_pos = percent_width + (xmb->icon.size / 2.5); + x_pos = percent_width + (xmb->icon_size / 2.5); xmb_draw_icon( menu_disp_info, - xmb->icon.size, + xmb->icon_size, &mymat, xmb->textures.list[XMB_TEXTURE_CLOCK], - width - xmb->icon.size - x_pos, - xmb->icon.size,width, + width - xmb->icon_size - x_pos, + xmb->icon_size, + width, height, 1, 0, @@ -2984,31 +2931,31 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) menu_display_timedate(&datetime); if (percent_width) - x_pos = percent_width + (xmb->icon.size / 2.5); + x_pos = percent_width + (xmb->icon_size / 2.5); xmb_draw_text(menu_disp_info, xmb, timedate, - width - xmb->margins.title.left - xmb->icon.size / 4 - x_pos, - xmb->margins.title.top, 1, 1, TEXT_ALIGN_RIGHT, + width - xmb->margins_title_left - xmb->icon_size / 4 - x_pos, + xmb->margins_title_top, 1, 1, TEXT_ALIGN_RIGHT, width, height, xmb->font); } /* Arrow image */ - menu_display_set_alpha(coord_white, MIN(xmb->textures.arrow.alpha, xmb->alpha)); + menu_display_set_alpha(coord_white, MIN(xmb->textures_arrow_alpha, xmb->alpha)); if (coord_white[3] != 0) xmb_draw_icon( menu_disp_info, - xmb->icon.size, + xmb->icon_size, &mymat, xmb->textures.list[XMB_TEXTURE_ARROW], - xmb->x + xmb->margins.screen.left + - xmb->icon.spacing.horizontal - xmb->icon.size / 2.0 + xmb->icon.size, - xmb->margins.screen.top + - xmb->icon.size / 2.0 + xmb->icon.spacing.vertical + xmb->x + xmb->margins_screen_left + + xmb->icon_spacing_horizontal - xmb->icon_size / 2.0 + xmb->icon_size, + xmb->margins_screen_top + + xmb->icon_size / 2.0 + xmb->icon_spacing_vertical * xmb->active_item_factor, width, height, - xmb->textures.arrow.alpha, + xmb->textures_arrow_alpha, 0, 1, &coord_white[0], @@ -3032,10 +2979,10 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) menu_display_ctx_rotate_draw_t rotate_draw; math_matrix_4x4 mymat; uintptr_t texture = node->icon; - float x = xmb->x + xmb->categories.x_pos + - xmb->margins.screen.left + - xmb->icon.spacing.horizontal * (i + 1) - xmb->icon.size / 2.0; - float y = xmb->margins.screen.top + xmb->icon.size / 2.0; + float x = xmb->x + xmb->categories_x_pos + + xmb->margins_screen_left + + xmb->icon_spacing_horizontal * (i + 1) - xmb->icon_size / 2.0; + float y = xmb->margins_screen_top + xmb->icon_size / 2.0; float rotation = 0; float scale_factor = node->zoom; @@ -3050,7 +2997,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) xmb_draw_icon( menu_disp_info, - xmb->icon.size, + xmb->icon_size, &mymat, texture, x, @@ -3076,7 +3023,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) xmb->selection_buf_old, xmb->selection_ptr_old, (xmb_list_get_size(xmb, MENU_LIST_PLAIN) > 1) - ? xmb->categories.selection_ptr : xmb->categories.selection_ptr_old, + ? xmb->categories_selection_ptr : xmb->categories_selection_ptr_old, &item_color[0], width, height); @@ -3090,7 +3037,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) xmb, selection_buf, selection, - xmb->categories.selection_ptr, + xmb->categories_selection_ptr, &item_color[0], width, height); @@ -3131,7 +3078,7 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) menu_display_set_alpha(coord_white, MIN(xmb->alpha, 1.00f)); menu_display_draw_cursor( &coord_white[0], - xmb->cursor.size, + xmb->cursor_size, xmb->textures.list[XMB_TEXTURE_POINTER], menu_input_mouse_state(MENU_MOUSE_X_AXIS), menu_input_mouse_state(MENU_MOUSE_Y_AXIS), @@ -3155,15 +3102,15 @@ static void xmb_layout_ps3(xmb_handle_t *xmb, int width) xmb->active_item_factor = 3.0; xmb->under_item_offset = 5.0; - xmb->categories.active.zoom = 1.0; - xmb->categories.passive.zoom = 0.5; - xmb->items.active.zoom = 1.0; - xmb->items.passive.zoom = 0.5; + xmb->categories_active_zoom = 1.0; + xmb->categories_passive_zoom = 0.5; + xmb->items_active_zoom = 1.0; + xmb->items_passive_zoom = 0.5; - xmb->categories.active.alpha = 1.0; - xmb->categories.passive.alpha = 0.85; - xmb->items.active.alpha = 1.0; - xmb->items.passive.alpha = 0.85; + xmb->categories_active_alpha = 1.0; + xmb->categories_passive_alpha = 0.85; + xmb->items_active_alpha = 1.0; + xmb->items_passive_alpha = 0.85; xmb->shadow_offset = 2.0; @@ -3174,41 +3121,41 @@ static void xmb_layout_ps3(xmb_handle_t *xmb, int width) xmb->thumbnail_width = 460.0 * scale_factor; xmb->savestate_thumbnail_width= 460.0 * scale_factor; - xmb->cursor.size = 64.0; + xmb->cursor_size = 64.0; - xmb->icon.spacing.horizontal = 200.0 * scale_factor; - xmb->icon.spacing.vertical = 64.0 * scale_factor; + xmb->icon_spacing_horizontal = 200.0 * scale_factor; + xmb->icon_spacing_vertical = 64.0 * scale_factor; - xmb->margins.screen.top = (256+32) * scale_factor; - xmb->margins.screen.left = 336.0 * scale_factor; + xmb->margins_screen_top = (256+32) * scale_factor; + xmb->margins_screen_left = 336.0 * scale_factor; - xmb->margins.title.left = 60 * scale_factor; - xmb->margins.title.top = 60 * scale_factor + new_font_size / 3; - xmb->margins.title.bottom = 60 * scale_factor - new_font_size / 3; + xmb->margins_title_left = 60 * scale_factor; + xmb->margins_title_top = 60 * scale_factor + new_font_size / 3; + xmb->margins_title_bottom = 60 * scale_factor - new_font_size / 3; - xmb->margins.label.left = 85.0 * scale_factor; - xmb->margins.label.top = new_font_size / 3.0; + xmb->margins_label_left = 85.0 * scale_factor; + xmb->margins_label_top = new_font_size / 3.0; - xmb->margins.setting.left = 600.0 * scale_factor; - xmb->margins.dialog = 48 * scale_factor; + xmb->margins_setting_left = 600.0 * scale_factor; + xmb->margins_dialog = 48 * scale_factor; - xmb->margins.slice = 16; + xmb->margins_slice = 16; - xmb->icon.size = 128.0 * scale_factor; + xmb->icon_size = 128.0 * scale_factor; xmb->font_size = new_font_size; #ifdef XMB_DEBUG - RARCH_LOG("[XMB] margin screen left: %.2f\n", xmb->margins.screen.left); - RARCH_LOG("[XMB] margin screen top: %.2f\n", xmb->margins.screen.top); - RARCH_LOG("[XMB] margin title left: %.2f\n", xmb->margins.title.left); - RARCH_LOG("[XMB] margin title top: %.2f\n", xmb->margins.title.top); - RARCH_LOG("[XMB] margin title bott: %.2f\n", xmb->margins.title.bottom); - RARCH_LOG("[XMB] margin label left: %.2f\n", xmb->margins.label.left); - RARCH_LOG("[XMB] margin label top: %.2f\n", xmb->margins.label.top); - RARCH_LOG("[XMB] margin sett left: %.2f\n", xmb->margins.setting.left); - RARCH_LOG("[XMB] icon spacing hor: %.2f\n", xmb->icon.spacing.horizontal); - RARCH_LOG("[XMB] icon spacing ver: %.2f\n", xmb->icon.spacing.vertical); - RARCH_LOG("[XMB] icon size: %.2f\n", xmb->icon.size); + RARCH_LOG("[XMB] margin screen left: %.2f\n", xmb->margins_screen_left); + RARCH_LOG("[XMB] margin screen top: %.2f\n", xmb->margins_screen_top); + RARCH_LOG("[XMB] margin title left: %.2f\n", xmb->margins_title_left); + RARCH_LOG("[XMB] margin title top: %.2f\n", xmb->margins_title_top); + RARCH_LOG("[XMB] margin title bott: %.2f\n", xmb->margins_title_bottom); + RARCH_LOG("[XMB] margin label left: %.2f\n", xmb->margins_label_left); + RARCH_LOG("[XMB] margin label top: %.2f\n", xmb->margins_label_top); + RARCH_LOG("[XMB] margin sett left: %.2f\n", xmb->margins_setting_left); + RARCH_LOG("[XMB] icon spacing hor: %.2f\n", xmb->icon_spacing_horizontal); + RARCH_LOG("[XMB] icon spacing ver: %.2f\n", xmb->icon_spacing_vertical); + RARCH_LOG("[XMB] icon size: %.2f\n", xmb->icon_size); #endif menu_display_set_header_height(new_header_height); @@ -3230,54 +3177,54 @@ static void xmb_layout_psp(xmb_handle_t *xmb, int width) xmb->active_item_factor = 2.0; xmb->under_item_offset = 3.0; - xmb->categories.active.zoom = 1.0; - xmb->categories.passive.zoom = 1.0; - xmb->items.active.zoom = 1.0; - xmb->items.passive.zoom = 1.0; + xmb->categories_active_zoom = 1.0; + xmb->categories_passive_zoom = 1.0; + xmb->items_active_zoom = 1.0; + xmb->items_passive_zoom = 1.0; - xmb->categories.active.alpha = 1.0; - xmb->categories.passive.alpha = 0.85; - xmb->items.active.alpha = 1.0; - xmb->items.passive.alpha = 0.85; + xmb->categories_active_alpha = 1.0; + xmb->categories_passive_alpha = 0.85; + xmb->items_active_alpha = 1.0; + xmb->items_passive_alpha = 0.85; xmb->shadow_offset = 1.0; new_font_size = 32.0 * scale_factor; xmb->font2_size = 24.0 * scale_factor; new_header_height = 128.0 * scale_factor; - xmb->margins.screen.top = (256+32) * scale_factor; + xmb->margins_screen_top = (256+32) * scale_factor; xmb->thumbnail_width = 460.0 * scale_factor; xmb->savestate_thumbnail_width= 460.0 * scale_factor; - xmb->cursor.size = 64.0; + xmb->cursor_size = 64.0; - xmb->icon.spacing.horizontal = 250.0 * scale_factor; - xmb->icon.spacing.vertical = 108.0 * scale_factor; + xmb->icon_spacing_horizontal = 250.0 * scale_factor; + xmb->icon_spacing_vertical = 108.0 * scale_factor; - xmb->margins.screen.left = 136.0 * scale_factor; - xmb->margins.title.left = 60 * scale_factor; - xmb->margins.title.top = 60 * scale_factor + new_font_size / 3; - xmb->margins.title.bottom = 60 * scale_factor - new_font_size / 3; - xmb->margins.label.left = 85.0 * scale_factor; - xmb->margins.label.top = new_font_size / 3.0; - xmb->margins.setting.left = 600.0 * scale_factor; - xmb->margins.dialog = 48 * scale_factor; - xmb->margins.slice = 16; - xmb->icon.size = 128.0 * scale_factor; + xmb->margins_screen_left = 136.0 * scale_factor; + xmb->margins_title_left = 60 * scale_factor; + xmb->margins_title_top = 60 * scale_factor + new_font_size / 3; + xmb->margins_title_bottom = 60 * scale_factor - new_font_size / 3; + xmb->margins_label_left = 85.0 * scale_factor; + xmb->margins_label_top = new_font_size / 3.0; + xmb->margins_setting_left = 600.0 * scale_factor; + xmb->margins_dialog = 48 * scale_factor; + xmb->margins_slice = 16; + xmb->icon_size = 128.0 * scale_factor; xmb->font_size = new_font_size; #ifdef XMB_DEBUG - RARCH_LOG("[XMB] margin screen left: %.2f\n", xmb->margins.screen.left); - RARCH_LOG("[XMB] margin screen top: %.2f\n", xmb->margins.screen.top); - RARCH_LOG("[XMB] margin title left: %.2f\n", xmb->margins.title.left); - RARCH_LOG("[XMB] margin title top: %.2f\n", xmb->margins.title.top); - RARCH_LOG("[XMB] margin title bott: %.2f\n", xmb->margins.title.bottom); - RARCH_LOG("[XMB] margin label left: %.2f\n", xmb->margins.label.left); - RARCH_LOG("[XMB] margin label top: %.2f\n", xmb->margins.label.top); - RARCH_LOG("[XMB] margin sett left: %.2f\n", xmb->margins.setting.left); - RARCH_LOG("[XMB] icon spacing hor: %.2f\n", xmb->icon.spacing.horizontal); - RARCH_LOG("[XMB] icon spacing ver: %.2f\n", xmb->icon.spacing.vertical); - RARCH_LOG("[XMB] icon size: %.2f\n", xmb->icon.size); + RARCH_LOG("[XMB] margin screen left: %.2f\n", xmb->margins_screen_left); + RARCH_LOG("[XMB] margin screen top: %.2f\n", xmb->margins_screen_top); + RARCH_LOG("[XMB] margin title left: %.2f\n", xmb->margins_title_left); + RARCH_LOG("[XMB] margin title top: %.2f\n", xmb->margins_title_top); + RARCH_LOG("[XMB] margin title bott: %.2f\n", xmb->margins_title_bottom); + RARCH_LOG("[XMB] margin label left: %.2f\n", xmb->margins_label_left); + RARCH_LOG("[XMB] margin label top: %.2f\n", xmb->margins_label_top); + RARCH_LOG("[XMB] margin sett left: %.2f\n", xmb->margins_setting_left); + RARCH_LOG("[XMB] icon spacing hor: %.2f\n", xmb->icon_spacing_horizontal); + RARCH_LOG("[XMB] icon spacing ver: %.2f\n", xmb->icon_spacing_vertical); + RARCH_LOG("[XMB] icon size: %.2f\n", xmb->icon_size); #endif menu_display_set_header_height(new_header_height); @@ -3302,8 +3249,8 @@ static void xmb_layout(xmb_handle_t *xmb) for (i = 0; i < end; i++) { - float ia = xmb->items.passive.alpha; - float iz = xmb->items.passive.zoom; + float ia = xmb->items_passive_alpha; + float iz = xmb->items_passive_zoom; xmb_node_t *node = (xmb_node_t*)menu_entries_get_userdata_at_offset( selection_buf, i); @@ -3312,8 +3259,8 @@ static void xmb_layout(xmb_handle_t *xmb) if (i == current) { - ia = xmb->items.active.alpha; - iz = xmb->items.active.alpha; + ia = xmb->items_active_alpha; + iz = xmb->items_active_alpha; } node->alpha = ia; @@ -3330,8 +3277,8 @@ static void xmb_layout(xmb_handle_t *xmb) for (i = 0; i < end; i++) { - float ia = 0; - float iz = xmb->items.passive.zoom; + float ia = 0; + float iz = xmb->items_passive_zoom; xmb_node_t *node = (xmb_node_t*)menu_entries_get_userdata_at_offset( xmb->selection_buf_old, i); @@ -3340,15 +3287,15 @@ static void xmb_layout(xmb_handle_t *xmb) if (i == current) { - ia = xmb->items.active.alpha; - iz = xmb->items.active.alpha; + ia = xmb->items_active_alpha; + iz = xmb->items_active_alpha; } node->alpha = ia; node->label_alpha = 0; node->zoom = iz; node->y = xmb_item_y(xmb, i, current); - node->x = xmb->icon.size * 1 * -2; + node->x = xmb->icon_size * 1 * -2; } } @@ -3422,14 +3369,14 @@ static void *xmb_init(void **userdata, bool video_is_threaded) if (!xmb->selection_buf_old) goto error; - xmb->categories.active.idx = 0; - xmb->categories.active.idx_old = 0; - xmb->x = 0; - xmb->categories.x_pos = 0; - xmb->textures.arrow.alpha = 0; - xmb->depth = 1; - xmb->old_depth = 1; - xmb->alpha = 0; + xmb->categories_active_idx = 0; + xmb->categories_active_idx_old = 0; + xmb->x = 0; + xmb->categories_x_pos = 0; + xmb->textures_arrow_alpha = 0; + xmb->depth = 1; + xmb->old_depth = 1; + xmb->alpha = 0; xmb->system_tab_end = 0; xmb->tabs[xmb->system_tab_end] = XMB_SYSTEM_TAB_MAIN; @@ -3714,45 +3661,45 @@ static void xmb_context_reset_textures( menu_display_allocate_white_texture(); xmb->main_menu_node.icon = xmb->textures.list[XMB_TEXTURE_MAIN_MENU]; - xmb->main_menu_node.alpha = xmb->categories.active.alpha; - xmb->main_menu_node.zoom = xmb->categories.active.zoom; + xmb->main_menu_node.alpha = xmb->categories_active_alpha; + xmb->main_menu_node.zoom = xmb->categories_active_zoom; xmb->settings_tab_node.icon = xmb->textures.list[XMB_TEXTURE_SETTINGS]; - xmb->settings_tab_node.alpha = xmb->categories.active.alpha; - xmb->settings_tab_node.zoom = xmb->categories.active.zoom; + xmb->settings_tab_node.alpha = xmb->categories_active_alpha; + xmb->settings_tab_node.zoom = xmb->categories_active_zoom; xmb->history_tab_node.icon = xmb->textures.list[XMB_TEXTURE_HISTORY]; - xmb->history_tab_node.alpha = xmb->categories.active.alpha; - xmb->history_tab_node.zoom = xmb->categories.active.zoom; + xmb->history_tab_node.alpha = xmb->categories_active_alpha; + xmb->history_tab_node.zoom = xmb->categories_active_zoom; xmb->favorites_tab_node.icon = xmb->textures.list[XMB_TEXTURE_FAVORITES]; - xmb->favorites_tab_node.alpha = xmb->categories.active.alpha; - xmb->favorites_tab_node.zoom = xmb->categories.active.zoom; + xmb->favorites_tab_node.alpha = xmb->categories_active_alpha; + xmb->favorites_tab_node.zoom = xmb->categories_active_zoom; xmb->music_tab_node.icon = xmb->textures.list[XMB_TEXTURE_MUSICS]; - xmb->music_tab_node.alpha = xmb->categories.active.alpha; - xmb->music_tab_node.zoom = xmb->categories.active.zoom; + xmb->music_tab_node.alpha = xmb->categories_active_alpha; + xmb->music_tab_node.zoom = xmb->categories_active_zoom; #ifdef HAVE_FFMPEG xmb->video_tab_node.icon = xmb->textures.list[XMB_TEXTURE_MOVIES]; - xmb->video_tab_node.alpha = xmb->categories.active.alpha; - xmb->video_tab_node.zoom = xmb->categories.active.zoom; + xmb->video_tab_node.alpha = xmb->categories_active_alpha; + xmb->video_tab_node.zoom = xmb->categories_active_zoom; #endif #ifdef HAVE_IMAGEVIEWER xmb->images_tab_node.icon = xmb->textures.list[XMB_TEXTURE_IMAGES]; - xmb->images_tab_node.alpha = xmb->categories.active.alpha; - xmb->images_tab_node.zoom = xmb->categories.active.zoom; + xmb->images_tab_node.alpha = xmb->categories_active_alpha; + xmb->images_tab_node.zoom = xmb->categories_active_zoom; #endif xmb->add_tab_node.icon = xmb->textures.list[XMB_TEXTURE_ADD]; - xmb->add_tab_node.alpha = xmb->categories.active.alpha; - xmb->add_tab_node.zoom = xmb->categories.active.zoom; + xmb->add_tab_node.alpha = xmb->categories_active_alpha; + xmb->add_tab_node.zoom = xmb->categories_active_zoom; #ifdef HAVE_NETWORKING - xmb->netplay_tab_node.icon = xmb->textures.list[XMB_TEXTURE_NETPLAY]; - xmb->netplay_tab_node.alpha = xmb->categories.active.alpha; - xmb->netplay_tab_node.zoom = xmb->categories.active.zoom; + xmb->netplay_tab_node.icon = xmb->textures.list[XMB_TEXTURE_NETPLAY]; + xmb->netplay_tab_node.alpha = xmb->categories_active_alpha; + xmb->netplay_tab_node.zoom = xmb->categories_active_zoom; #endif } @@ -3877,17 +3824,17 @@ static void xmb_list_insert(void *userdata, node->fullpath = strdup(fullpath); } - node->alpha = xmb->items.passive.alpha; - node->zoom = xmb->items.passive.zoom; + node->alpha = xmb->items_passive_alpha; + node->zoom = xmb->items_passive_zoom; node->label_alpha = node->alpha; node->y = xmb_item_y(xmb, i, current); node->x = 0; if (i == current) { - node->alpha = xmb->items.active.alpha; - node->label_alpha = xmb->items.active.alpha; - node->zoom = xmb->items.active.alpha; + node->alpha = xmb->items_active_alpha; + node->label_alpha = xmb->items_active_alpha; + node->zoom = xmb->items_active_alpha; } file_list_set_userdata(list, i, node); @@ -3994,27 +3941,27 @@ static void xmb_list_cache(void *data, enum menu_list_type type, unsigned action case MENU_LIST_PLAIN: break; case MENU_LIST_HORIZONTAL: - xmb->categories.selection_ptr_old = xmb->categories.selection_ptr; + xmb->categories_selection_ptr_old = xmb->categories_selection_ptr; switch (action) { case MENU_ACTION_LEFT: - if (xmb->categories.selection_ptr == 0) + if (xmb->categories_selection_ptr == 0) { - xmb->categories.selection_ptr = list_size; - xmb->categories.active.idx = (unsigned)(list_size - 1); + xmb->categories_selection_ptr = list_size; + xmb->categories_active_idx = (unsigned)(list_size - 1); } else - xmb->categories.selection_ptr--; + xmb->categories_selection_ptr--; break; default: - if (xmb->categories.selection_ptr == list_size) + if (xmb->categories_selection_ptr == list_size) { - xmb->categories.selection_ptr = 0; - xmb->categories.active.idx = 1; + xmb->categories_selection_ptr = 0; + xmb->categories_active_idx = 1; } else - xmb->categories.selection_ptr++; + xmb->categories_selection_ptr++; break; } @@ -4024,7 +3971,7 @@ static void xmb_list_cache(void *data, enum menu_list_type type, unsigned action free(menu_stack->list[stack_size - 1].label); menu_stack->list[stack_size - 1].label = NULL; - switch (xmb_get_system_tab(xmb, (unsigned)xmb->categories.selection_ptr)) + switch (xmb_get_system_tab(xmb, (unsigned)xmb->categories_selection_ptr)) { case XMB_SYSTEM_TAB_MAIN: menu_stack->list[stack_size - 1].label = From f444ef109f2c469eb0449fd945d73b85e6c8f2d6 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 08:45:42 +0200 Subject: [PATCH 060/253] (MUI) Reorder variables --- menu/drivers/materialui.c | 72 +++++++++++++++++---------------------- 1 file changed, 31 insertions(+), 41 deletions(-) diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 664692b503..13c4e2e5dc 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -141,9 +141,11 @@ enum typedef struct mui_handle { - char box_message[1024]; bool need_compute; bool mouse_show; + + int cursor_size; + unsigned tabs_height; unsigned line_height; unsigned shadow_height; @@ -152,40 +154,28 @@ typedef struct mui_handle unsigned margin; unsigned glyph_width; unsigned glyph_width2; + unsigned categories_active_idx; + unsigned categories_active_idx_old; + + size_t categories_selection_ptr; + size_t categories_selection_ptr_old; + /* Y position of the vertical scroll */ float scroll_y; float content_height; + float textures_arrow_alpha; + float categories_x_pos; + uint64_t frame_count; - struct - { - int size; - } cursor; + char box_message[1024]; struct { - struct - { - float alpha; - } arrow; - menu_texture_item bg; menu_texture_item list[MUI_TEXTURE_LAST]; } textures; - struct - { - struct - { - unsigned idx; - unsigned idx_old; - } active; - - float x_pos; - size_t selection_ptr_old; - size_t selection_ptr; - } categories; - /* One font for the menu entries, one font for the labels */ font_data_t *font; font_data_t *font2; @@ -388,17 +378,17 @@ static void mui_draw_tab(mui_handle_t *mui, { case MUI_SYSTEM_TAB_MAIN: tab_icon = MUI_TEXTURE_TAB_MAIN; - if (i == mui->categories.selection_ptr) + if (i == mui->categories_selection_ptr) tab_color = active_tab_color; break; case MUI_SYSTEM_TAB_PLAYLISTS: tab_icon = MUI_TEXTURE_TAB_PLAYLISTS; - if (i == mui->categories.selection_ptr) + if (i == mui->categories_selection_ptr) tab_color = active_tab_color; break; case MUI_SYSTEM_TAB_SETTINGS: tab_icon = MUI_TEXTURE_TAB_SETTINGS; - if (i == mui->categories.selection_ptr) + if (i == mui->categories_selection_ptr) tab_color = active_tab_color; break; } @@ -537,7 +527,7 @@ static void mui_draw_tab_end(mui_handle_t *mui, unsigned tab_width = width / (MUI_SYSTEM_TAB_END+1); menu_display_draw_quad( - (int)(mui->categories.selection_ptr * tab_width), + (int)(mui->categories_selection_ptr * tab_width), height - (header_height/16), tab_width, header_height/16, @@ -1627,7 +1617,7 @@ static void mui_frame(void *data, video_frame_info_t *video_info) if (mui->mouse_show) menu_display_draw_cursor( &white_bg[0], - mui->cursor.size, + mui->cursor_size, mui->textures.list[MUI_TEXTURE_POINTER], menu_input_mouse_state(MENU_MOUSE_X_AXIS), menu_input_mouse_state(MENU_MOUSE_Y_AXIS), @@ -1720,7 +1710,7 @@ static void *mui_init(void **userdata, bool video_is_threaded) *userdata = mui; - mui->cursor.size = 64.0; + mui->cursor_size = 64.0; mui->need_compute = false; return menu; @@ -1933,7 +1923,7 @@ static void mui_preswitch_tabs(mui_handle_t *mui, unsigned action) free(menu_stack->list[stack_size - 1].label); menu_stack->list[stack_size - 1].label = NULL; - switch (mui->categories.selection_ptr) + switch (mui->categories_selection_ptr) { case MUI_SYSTEM_TAB_MAIN: menu_stack->list[stack_size - 1].label = @@ -1975,27 +1965,27 @@ static void mui_list_cache(void *data, case MENU_LIST_PLAIN: break; case MENU_LIST_HORIZONTAL: - mui->categories.selection_ptr_old = mui->categories.selection_ptr; + mui->categories_selection_ptr_old = mui->categories_selection_ptr; switch (action) { case MENU_ACTION_LEFT: - if (mui->categories.selection_ptr == 0) + if (mui->categories_selection_ptr == 0) { - mui->categories.selection_ptr = list_size; - mui->categories.active.idx = (unsigned)(list_size - 1); + mui->categories_selection_ptr = list_size; + mui->categories_active_idx = (unsigned)(list_size - 1); } else - mui->categories.selection_ptr--; + mui->categories_selection_ptr--; break; default: - if (mui->categories.selection_ptr == list_size) + if (mui->categories_selection_ptr == list_size) { - mui->categories.selection_ptr = 0; - mui->categories.active.idx = 1; + mui->categories_selection_ptr = 0; + mui->categories_active_idx = 1; } else - mui->categories.selection_ptr++; + mui->categories_selection_ptr++; break; } @@ -2152,7 +2142,7 @@ static size_t mui_list_get_selection(void *data) if (!mui) return 0; - return mui->categories.selection_ptr; + return mui->categories_selection_ptr; } /* The pointer or the mouse is pressed down. We use this callback to @@ -2240,7 +2230,7 @@ static int mui_pointer_up(void *userdata, if ((x >= start) && (x < (start + tab_width))) { - mui->categories.selection_ptr = i; + mui->categories_selection_ptr = i; mui_preswitch_tabs(mui, action); From 9185fb3ed12db0f746faa9674e5c66042df879bc Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 08:51:28 +0200 Subject: [PATCH 061/253] (RGUI) Cleanups --- menu/drivers/rgui.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index a9abf829c8..b518b8254a 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -55,11 +55,11 @@ typedef struct { bool force_redraw; bool mouse_show; - char msgbox[4096]; unsigned last_width; unsigned last_height; unsigned frame_count; float scroll_y; + char msgbox[4096]; } rgui_t; static uint16_t *rgui_framebuf_data = NULL; @@ -276,19 +276,17 @@ static void rgui_set_message(void *data, const char *message) static void rgui_render_messagebox(const char *message) { - size_t i, fb_pitch; int x, y; + uint16_t color; + size_t i, fb_pitch; unsigned fb_width, fb_height; unsigned width, glyphs_width, height; - uint16_t color; struct string_list *list = NULL; settings_t *settings = config_get_ptr(); if (!message || !*message) return; - (void)settings; - list = string_split(message, "\n"); if (!list) return; @@ -544,7 +542,7 @@ static void rgui_render(void *data, bool is_idle) menu_display_ctx_datetime_t datetime; char timedate[255]; - timedate[0] = '\0'; + timedate[0] = '\0'; datetime.s = timedate; datetime.len = sizeof(timedate); @@ -573,8 +571,9 @@ static void rgui_render(void *data, bool is_idle) char message[255]; char entry_title_buf[255]; char type_str_buf[255]; - unsigned entry_spacing; - size_t entry_title_buf_utf8len, entry_title_buf_len; + unsigned entry_spacing = 0; + size_t entry_title_buf_utf8len = 0; + size_t entry_title_buf_len = 0; bool entry_selected = menu_entry_is_currently_selected((unsigned)i); size_t selection = menu_navigation_get_selection(); From 65edb2f06cd47a12f7e9a977b2293f7419b93886 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 08:55:40 +0200 Subject: [PATCH 062/253] Update --- menu/drivers/menu_generic.c | 12 ++++++------ menu/menu_driver.c | 6 +++--- menu/menu_driver.h | 10 +++------- 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/menu/drivers/menu_generic.c b/menu/drivers/menu_generic.c index f8e31738d3..1250ad8aac 100644 --- a/menu/drivers/menu_generic.c +++ b/menu/drivers/menu_generic.c @@ -80,7 +80,7 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action) if (!menu) return 0; - menu->menu_state.msg[0] = '\0'; + menu->menu_state_msg[0] = '\0'; if (!string_is_empty(label)) hash = msg_hash_calculate(label); @@ -99,7 +99,7 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action) { case ITERATE_TYPE_HELP: ret = menu_dialog_iterate( - menu->menu_state.msg, sizeof(menu->menu_state.msg), label); + menu->menu_state_msg, sizeof(menu->menu_state_msg), label); BIT64_SET(menu->state, MENU_STATE_RENDER_MESSAGEBOX); BIT64_SET(menu->state, MENU_STATE_POST_ITERATE); if (ret == 1 || action == MENU_ACTION_OK) @@ -118,8 +118,8 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action) { menu_input_ctx_bind_t bind; - bind.s = menu->menu_state.msg; - bind.len = sizeof(menu->menu_state.msg); + bind.s = menu->menu_state_msg; + bind.len = sizeof(menu->menu_state_msg); if (menu_input_key_bind_iterate(&bind)) { @@ -139,7 +139,7 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action) if (cbs->enum_idx != MSG_UNKNOWN) { ret = menu_hash_get_help_enum(cbs->enum_idx, - menu->menu_state.msg, sizeof(menu->menu_state.msg)); + menu->menu_state_msg, sizeof(menu->menu_state_msg)); } else { @@ -205,7 +205,7 @@ int generic_menu_iterate(void *data, void *userdata, enum menu_action action) if (enum_idx != MSG_UNKNOWN) ret = menu_hash_get_help_enum(enum_idx, - menu->menu_state.msg, sizeof(menu->menu_state.msg)); + menu->menu_state_msg, sizeof(menu->menu_state_msg)); } } diff --git a/menu/menu_driver.c b/menu/menu_driver.c index 95d896efd9..8cc0cdbc4a 100644 --- a/menu/menu_driver.c +++ b/menu/menu_driver.c @@ -1581,17 +1581,17 @@ bool menu_driver_render(bool is_idle, bool rarch_is_inited, menu_display_framebuf_dirty = true; if (BIT64_GET(menu_driver_data->state, MENU_STATE_RENDER_MESSAGEBOX) - && !string_is_empty(menu_driver_data->menu_state.msg)) + && !string_is_empty(menu_driver_data->menu_state_msg)) { if (menu_driver_ctx->render_messagebox) menu_driver_ctx->render_messagebox(menu_userdata, - menu_driver_data->menu_state.msg); + menu_driver_data->menu_state_msg); if (ui_companion_is_on_foreground()) { const ui_companion_driver_t *ui = ui_companion_get_ptr(); if (ui->render_messagebox) - ui->render_messagebox(menu_driver_data->menu_state.msg); + ui->render_messagebox(menu_driver_data->menu_state_msg); } } diff --git a/menu/menu_driver.h b/menu/menu_driver.h index 7910a89396..95ac63ff54 100644 --- a/menu/menu_driver.h +++ b/menu/menu_driver.h @@ -338,6 +338,9 @@ typedef struct menu_display_ctx_driver typedef struct { + uint64_t state; + + char menu_state_msg[1024]; /* Scratchpad variables. These are used for instance * by the filebrowser when having to store intermediary * paths (subdirs/previous dirs/current dir/path, etc). @@ -348,13 +351,6 @@ typedef struct /* path to the currently loaded database playlist file. */ char db_playlist_file[PATH_MAX_LENGTH]; - - uint64_t state; - - struct - { - char msg[1024]; - } menu_state; } menu_handle_t; typedef struct menu_display_ctx_draw From 282782c8290924cc2d0f043dacf22056ae675d1a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 09:09:50 +0200 Subject: [PATCH 063/253] Remove unused command_event_quit --- command.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/command.h b/command.h index b9f49e2c6f..33c408638f 100644 --- a/command.h +++ b/command.h @@ -249,8 +249,6 @@ bool command_set(command_handle_t *handle); bool command_free(command_t *handle); -bool command_event_quit(void); - /** * command_event: * @cmd : Command index. From bb9efe9bf1020a8812566c307db734138427c6e9 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 09:17:58 +0200 Subject: [PATCH 064/253] command.c - cleanups --- command.c | 324 +++++++++++++++++++++++++++--------------------------- 1 file changed, 163 insertions(+), 161 deletions(-) diff --git a/command.c b/command.c index 2b30ccc909..8c7c6aa299 100644 --- a/command.c +++ b/command.c @@ -91,6 +91,26 @@ extern int libui_main(void); +enum cmd_source_t +{ + CMD_NONE = 0, + CMD_STDIN, + CMD_NETWORK +}; + +struct cmd_map +{ + const char *str; + unsigned id; +}; + +struct cmd_action_map +{ + const char *str; + bool (*action)(const char *arg); + const char *arg_desc; +}; + struct command { #ifdef HAVE_STDIN_CMD @@ -106,154 +126,8 @@ struct command bool state[RARCH_BIND_LIST_END]; }; -enum cmd_source_t -{ - CMD_NONE = 0, - CMD_STDIN, - CMD_NETWORK -}; - -#if defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING) -static enum cmd_source_t lastcmd_source; -#endif -#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) -static int lastcmd_net_fd; -static struct sockaddr_storage lastcmd_net_source; -static socklen_t lastcmd_net_source_len; -#endif - -#ifdef HAVE_CHEEVOS -#if defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING) -static bool command_reply(const char * data, size_t len) -{ -#ifdef HAVE_STDIN_CMD - if (lastcmd_source == CMD_STDIN) - { - fwrite(data, 1,len, stdout); - return true; - } -#endif -#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) - if (lastcmd_source == CMD_NETWORK) - { - sendto(lastcmd_net_fd, data, len, 0, - (struct sockaddr*)&lastcmd_net_source, lastcmd_net_source_len); - return true; - } -#endif - return false; -} -#endif -#endif - -struct cmd_map -{ - const char *str; - unsigned id; -}; - -struct cmd_action_map -{ - const char *str; - bool (*action)(const char *arg); - const char *arg_desc; -}; - -bool command_set_shader(const char *arg) -{ - char msg[256]; - enum rarch_shader_type type = RARCH_SHADER_NONE; - - switch (msg_hash_to_file_type(msg_hash_calculate(path_get_extension(arg)))) - { - case FILE_TYPE_SHADER_GLSL: - case FILE_TYPE_SHADER_PRESET_GLSLP: - type = RARCH_SHADER_GLSL; - break; - case FILE_TYPE_SHADER_CG: - case FILE_TYPE_SHADER_PRESET_CGP: - type = RARCH_SHADER_CG; - break; - case FILE_TYPE_SHADER_SLANG: - case FILE_TYPE_SHADER_PRESET_SLANGP: - type = RARCH_SHADER_SLANG; - break; - default: - return false; - } - - snprintf(msg, sizeof(msg), "Shader: \"%s\"", arg); - runloop_msg_queue_push(msg, 1, 120, true); - RARCH_LOG("%s \"%s\".\n", - msg_hash_to_str(MSG_APPLYING_SHADER), - arg); - - return video_driver_set_shader(type, arg); -} - -#ifdef HAVE_COMMAND -#ifdef HAVE_CHEEVOS -static bool command_read_ram(const char *arg) -{ - cheevos_var_t var; - unsigned i; - unsigned nbytes; - char reply[256]; - const uint8_t * data = NULL; - char *reply_at = NULL; - - reply[0] = '\0'; - - strlcpy(reply, "READ_CORE_RAM ", sizeof(reply)); - reply_at = reply + strlen("READ_CORE_RAM "); - strlcpy(reply_at, arg, sizeof(reply)-strlen(reply)); - - cheevos_parse_guest_addr(&var, strtoul(reply_at, (char**)&reply_at, 16)); - data = cheevos_get_memory(&var); - - if (data) - { - unsigned nbytes = strtol(reply_at, NULL, 10); - - for (i=0;i" }, @@ -306,6 +180,141 @@ static const struct cmd_map map[] = { { "MENU_B", RETRO_DEVICE_ID_JOYPAD_B }, }; + +#if defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING) +static enum cmd_source_t lastcmd_source; +#endif +#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) +static int lastcmd_net_fd; +static struct sockaddr_storage lastcmd_net_source; +static socklen_t lastcmd_net_source_len; +#endif + +#ifdef HAVE_CHEEVOS +#if defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING) +static bool command_reply(const char * data, size_t len) +{ +#ifdef HAVE_STDIN_CMD + if (lastcmd_source == CMD_STDIN) + { + fwrite(data, 1,len, stdout); + return true; + } +#endif +#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) + if (lastcmd_source == CMD_NETWORK) + { + sendto(lastcmd_net_fd, data, len, 0, + (struct sockaddr*)&lastcmd_net_source, lastcmd_net_source_len); + return true; + } +#endif + return false; +} +#endif +#endif + +bool command_set_shader(const char *arg) +{ + char msg[256]; + enum rarch_shader_type type = RARCH_SHADER_NONE; + + switch (msg_hash_to_file_type(msg_hash_calculate(path_get_extension(arg)))) + { + case FILE_TYPE_SHADER_GLSL: + case FILE_TYPE_SHADER_PRESET_GLSLP: + type = RARCH_SHADER_GLSL; + break; + case FILE_TYPE_SHADER_CG: + case FILE_TYPE_SHADER_PRESET_CGP: + type = RARCH_SHADER_CG; + break; + case FILE_TYPE_SHADER_SLANG: + case FILE_TYPE_SHADER_PRESET_SLANGP: + type = RARCH_SHADER_SLANG; + break; + default: + return false; + } + + snprintf(msg, sizeof(msg), "Shader: \"%s\"", arg); + runloop_msg_queue_push(msg, 1, 120, true); + RARCH_LOG("%s \"%s\".\n", + msg_hash_to_str(MSG_APPLYING_SHADER), + arg); + + return video_driver_set_shader(type, arg); +} + +static bool command_read_ram(const char *arg) +{ +#if defined(HAVE_COMMAND) && defined(HAVE_CHEEVOS) + cheevos_var_t var; + unsigned i; + unsigned nbytes; + char reply[256]; + const uint8_t * data = NULL; + char *reply_at = NULL; + + reply[0] = '\0'; + + strlcpy(reply, "READ_CORE_RAM ", sizeof(reply)); + reply_at = reply + strlen("READ_CORE_RAM "); + strlcpy(reply_at, arg, sizeof(reply)-strlen(reply)); + + cheevos_parse_guest_addr(&var, strtoul(reply_at, (char**)&reply_at, 16)); + data = cheevos_get_memory(&var); + + if (data) + { + unsigned nbytes = strtol(reply_at, NULL, 10); + + for (i=0;istdin_buf_ptr -= msg_len; } #endif -#endif bool command_poll(command_t *handle) { -#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) -#ifdef HAVE_COMMAND +#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) && defined(HAVE_COMMAND) command_network_poll(handle); #endif -#endif #ifdef HAVE_STDIN_CMD command_stdin_poll(handle); @@ -669,11 +673,9 @@ bool command_set(command_handle_t *handle) bool command_free(command_t *handle) { -#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) -#ifdef HAVE_COMMAND +#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) && defined(HAVE_COMMAND) if (handle && handle->net_fd >= 0) socket_close(handle->net_fd); -#endif #endif free(handle); @@ -1025,9 +1027,9 @@ static void command_event_init_controllers(void) set_controller = true; break; case RETRO_DEVICE_JOYPAD: - /* ideally these checks shouldn't be required but if we always - * call core_set_controller_port_device input won't work on - * cores that don't set port information properly */ + /* Ideally these checks shouldn't be required but if we always + * call core_set_controller_port_device input won't work on + * cores that don't set port information properly */ if (info->ports.size != 0 && i < info->ports.size) set_controller = true; break; @@ -1598,8 +1600,8 @@ static bool command_event_main_state(unsigned cmd) char msg[128]; char *state_path = (char*)malloc(PATH_MAX_LENGTH * sizeof(char)); size_t state_path_size = PATH_MAX_LENGTH * sizeof(char); - bool ret = false; global_t *global = global_get_ptr(); + bool ret = false; bool push_msg = true; state_path[0] = msg[0] = '\0'; From ee8d8e1be6d9bb4fcafe31b5325228308467bb3d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 09:19:43 +0200 Subject: [PATCH 065/253] Buildfix --- command.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/command.c b/command.c index 8c7c6aa299..bd06c9785b 100644 --- a/command.c +++ b/command.c @@ -378,21 +378,6 @@ static void command_parse_sub_msg(command_t *handle, const char *tok) msg_hash_to_str(MSG_RECEIVED)); } -static void command_parse_msg(command_t *handle, char *buf, enum cmd_source_t source) -{ - char *save = NULL; - const char *tok = strtok_r(buf, "\n", &save); - - lastcmd_source = source; - - while (tok) - { - command_parse_sub_msg(handle, tok); - tok = strtok_r(NULL, "\n", &save); - } - lastcmd_source = CMD_NONE; -} - #if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) static bool command_network_init(command_t *handle, uint16_t port) { @@ -448,6 +433,21 @@ static bool command_verify(const char *cmd) } #ifdef HAVE_COMMAND +static void command_parse_msg(command_t *handle, char *buf, enum cmd_source_t source) +{ + char *save = NULL; + const char *tok = strtok_r(buf, "\n", &save); + + lastcmd_source = source; + + while (tok) + { + command_parse_sub_msg(handle, tok); + tok = strtok_r(NULL, "\n", &save); + } + lastcmd_source = CMD_NONE; +} + static void command_network_poll(command_t *handle) { fd_set fds; From bb4a659abb5ade50b1100f4b047b9d120ea8cbf2 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 09:23:30 +0200 Subject: [PATCH 066/253] Update --- command.c | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/command.c b/command.c index bd06c9785b..26230d469b 100644 --- a/command.c +++ b/command.c @@ -181,9 +181,7 @@ static const struct cmd_map map[] = { }; -#if defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING) static enum cmd_source_t lastcmd_source; -#endif #if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) static int lastcmd_net_fd; static struct sockaddr_storage lastcmd_net_source; @@ -194,21 +192,27 @@ static socklen_t lastcmd_net_source_len; #if defined(HAVE_STDIN_CMD) || defined(HAVE_NETWORK_CMD) && defined(HAVE_NETWORKING) static bool command_reply(const char * data, size_t len) { + switch (lastcmd_source) + { + case CMD_NONE: + break; + case CMD_STDIN: #ifdef HAVE_STDIN_CMD - if (lastcmd_source == CMD_STDIN) - { - fwrite(data, 1,len, stdout); - return true; - } + fwrite(data, 1,len, stdout); + return true; +#else + break; #endif + case CMD_NETWORK: #if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) - if (lastcmd_source == CMD_NETWORK) - { - sendto(lastcmd_net_fd, data, len, 0, - (struct sockaddr*)&lastcmd_net_source, lastcmd_net_source_len); - return true; - } + sendto(lastcmd_net_fd, data, len, 0, + (struct sockaddr*)&lastcmd_net_source, lastcmd_net_source_len); + return true; +#else + break; #endif + } + return false; } #endif From f21c520e2884f8a9d3ab826cd82f9bab7bb61ca8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 09:29:36 +0200 Subject: [PATCH 067/253] Cleanups --- command.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/command.c b/command.c index 26230d469b..df1145be11 100644 --- a/command.c +++ b/command.c @@ -89,8 +89,6 @@ #define DEFAULT_NETWORK_CMD_PORT 55355 #define STDIN_BUF_SIZE 4096 -extern int libui_main(void); - enum cmd_source_t { CMD_NONE = 0, @@ -113,27 +111,25 @@ struct cmd_action_map struct command { -#ifdef HAVE_STDIN_CMD bool stdin_enable; + bool state[RARCH_BIND_LIST_END]; +#ifdef HAVE_STDIN_CMD char stdin_buf[STDIN_BUF_SIZE]; size_t stdin_buf_ptr; #endif - #if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) int net_fd; #endif - - bool state[RARCH_BIND_LIST_END]; }; static bool command_read_ram(const char *arg); static bool command_write_ram(const char *arg); static const struct cmd_action_map action_map[] = { - { "SET_SHADER", command_set_shader, "" }, + { "SET_SHADER", command_set_shader, "" }, #ifdef HAVE_CHEEVOS - { "READ_CORE_RAM", command_read_ram, "
" }, - { "WRITE_CORE_RAM", command_write_ram, "
..." }, + { "READ_CORE_RAM", command_read_ram, "
" }, + { "WRITE_CORE_RAM", command_write_ram, "
..." }, #endif }; @@ -180,7 +176,6 @@ static const struct cmd_map map[] = { { "MENU_B", RETRO_DEVICE_ID_JOYPAD_B }, }; - static enum cmd_source_t lastcmd_source; #if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) static int lastcmd_net_fd; @@ -274,9 +269,7 @@ static bool command_read_ram(const char *arg) unsigned nbytes = strtol(reply_at, NULL, 10); for (i=0;i Date: Thu, 28 Sep 2017 09:32:23 +0200 Subject: [PATCH 068/253] Cleanups --- core_info.h | 5 ++--- database_info.h | 26 +++++++++++++------------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/core_info.h b/core_info.h index ca9fd2a229..2800cd2edf 100644 --- a/core_info.h +++ b/core_info.h @@ -37,6 +37,8 @@ typedef struct typedef struct { + bool supports_no_game; + size_t firmware_count; char *path; void *config_data; char *display_name; @@ -57,10 +59,7 @@ typedef struct struct string_list *authors_list; struct string_list *permissions_list; struct string_list *licenses_list; - core_info_firmware_t *firmware; - size_t firmware_count; - bool supports_no_game; void *userdata; } core_info_t; diff --git a/database_info.h b/database_info.h index 04e7ab1589..2664577e6f 100644 --- a/database_info.h +++ b/database_info.h @@ -81,6 +81,18 @@ typedef struct typedef struct { + int analog_supported; + int rumble_supported; + int coop_supported; + uint32_t crc32; + unsigned size; + unsigned famitsu_magazine_rating; + unsigned edge_magazine_rating; + unsigned edge_magazine_issue; + unsigned max_users; + unsigned releasemonth; + unsigned releaseyear; + unsigned tgdb_rating; char *name; char *rom_name; char *serial; @@ -97,27 +109,15 @@ typedef struct char *pegi_rating; char *cero_rating; char *enhancement_hw; - uint32_t crc32; char *sha1; char *md5; - unsigned size; - unsigned famitsu_magazine_rating; - unsigned edge_magazine_rating; - unsigned edge_magazine_issue; - unsigned max_users; - unsigned releasemonth; - unsigned releaseyear; - unsigned tgdb_rating; - int analog_supported; - int rumble_supported; - int coop_supported; void *userdata; } database_info_t; typedef struct { - database_info_t *list; size_t count; + database_info_t *list; } database_info_list_t; database_info_list_t *database_info_list_new(const char *rdb_path, From 28c118c3c1032076bc987b8123d1c91f513f67e2 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 09:47:57 +0200 Subject: [PATCH 069/253] Some C89_BUILD fixes for libFLAC --- deps/libFLAC/bitreader.c | 10 ++--- deps/libFLAC/cpu.c | 56 +++++++++++++------------- deps/libFLAC/include/private/bitmath.h | 18 +++++---- 3 files changed, 42 insertions(+), 42 deletions(-) diff --git a/deps/libFLAC/bitreader.c b/deps/libFLAC/bitreader.c index b7607af178..fc6e89f671 100644 --- a/deps/libFLAC/bitreader.c +++ b/deps/libFLAC/bitreader.c @@ -114,7 +114,7 @@ struct FLAC__BitReader { void *client_data; }; -static inline void crc16_update_word_(FLAC__BitReader *br, brword word) +static INLINE void crc16_update_word_(FLAC__BitReader *br, brword word) { register unsigned crc = br->read_crc16; #if FLAC__BYTES_PER_WORD == 4 @@ -347,17 +347,17 @@ FLAC__uint16 FLAC__bitreader_get_read_crc16(FLAC__BitReader *br) return br->read_crc16; } -inline FLAC__bool FLAC__bitreader_is_consumed_byte_aligned(const FLAC__BitReader *br) +INLINE FLAC__bool FLAC__bitreader_is_consumed_byte_aligned(const FLAC__BitReader *br) { return ((br->consumed_bits & 7) == 0); } -inline unsigned FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br) +INLINE unsigned FLAC__bitreader_bits_left_for_byte_alignment(const FLAC__BitReader *br) { return 8 - (br->consumed_bits & 7); } -inline unsigned FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br) +INLINE unsigned FLAC__bitreader_get_input_bits_unconsumed(const FLAC__BitReader *br) { return (br->words-br->consumed_words)*FLAC__BITS_PER_WORD + br->bytes*8 - br->consumed_bits; } @@ -476,7 +476,7 @@ FLAC__bool FLAC__bitreader_read_raw_uint64(FLAC__BitReader *br, FLAC__uint64 *va return true; } -inline FLAC__bool FLAC__bitreader_read_uint32_little_endian(FLAC__BitReader *br, FLAC__uint32 *val) +INLINE FLAC__bool FLAC__bitreader_read_uint32_little_endian(FLAC__BitReader *br, FLAC__uint32 *val) { FLAC__uint32 x8, x32 = 0; diff --git a/deps/libFLAC/cpu.c b/deps/libFLAC/cpu.c index da76d87d19..3f0a2346db 100644 --- a/deps/libFLAC/cpu.c +++ b/deps/libFLAC/cpu.c @@ -49,11 +49,6 @@ #ifdef DEBUG #include - -#define dfprintf fprintf -#else -/* This is bad practice, it should be a static void empty function */ -#define dfprintf(file, format, ...) #endif @@ -138,21 +133,23 @@ ia32_cpu_info (FLAC__CPUInfo *info) info->ia32.avx2 = (flags_ebx & FLAC__CPUINFO_IA32_CPUID_AVX2 ) ? true : false; } - dfprintf(stderr, "CPU info (IA-32):\n"); - dfprintf(stderr, " CMOV ....... %c\n", info->ia32.cmov ? 'Y' : 'n'); - dfprintf(stderr, " MMX ........ %c\n", info->ia32.mmx ? 'Y' : 'n'); - dfprintf(stderr, " SSE ........ %c\n", info->ia32.sse ? 'Y' : 'n'); - dfprintf(stderr, " SSE2 ....... %c\n", info->ia32.sse2 ? 'Y' : 'n'); - dfprintf(stderr, " SSE3 ....... %c\n", info->ia32.sse3 ? 'Y' : 'n'); - dfprintf(stderr, " SSSE3 ...... %c\n", info->ia32.ssse3 ? 'Y' : 'n'); - dfprintf(stderr, " SSE41 ...... %c\n", info->ia32.sse41 ? 'Y' : 'n'); - dfprintf(stderr, " SSE42 ...... %c\n", info->ia32.sse42 ? 'Y' : 'n'); +#if 0 + fprintf(stderr, "CPU info (IA-32):\n"); + fprintf(stderr, " CMOV ....... %c\n", info->ia32.cmov ? 'Y' : 'n'); + fprintf(stderr, " MMX ........ %c\n", info->ia32.mmx ? 'Y' : 'n'); + fprintf(stderr, " SSE ........ %c\n", info->ia32.sse ? 'Y' : 'n'); + fprintf(stderr, " SSE2 ....... %c\n", info->ia32.sse2 ? 'Y' : 'n'); + fprintf(stderr, " SSE3 ....... %c\n", info->ia32.sse3 ? 'Y' : 'n'); + fprintf(stderr, " SSSE3 ...... %c\n", info->ia32.ssse3 ? 'Y' : 'n'); + fprintf(stderr, " SSE41 ...... %c\n", info->ia32.sse41 ? 'Y' : 'n'); + fprintf(stderr, " SSE42 ...... %c\n", info->ia32.sse42 ? 'Y' : 'n'); if (FLAC__HAS_X86INTRIN && FLAC__AVX_SUPPORTED) { - dfprintf(stderr, " AVX ........ %c\n", info->ia32.avx ? 'Y' : 'n'); - dfprintf(stderr, " FMA ........ %c\n", info->ia32.fma ? 'Y' : 'n'); - dfprintf(stderr, " AVX2 ....... %c\n", info->ia32.avx2 ? 'Y' : 'n'); + fprintf(stderr, " AVX ........ %c\n", info->ia32.avx ? 'Y' : 'n'); + fprintf(stderr, " FMA ........ %c\n", info->ia32.fma ? 'Y' : 'n'); + fprintf(stderr, " AVX2 ....... %c\n", info->ia32.avx2 ? 'Y' : 'n'); } +#endif /* * now have to check for OS support of AVX instructions @@ -164,9 +161,10 @@ ia32_cpu_info (FLAC__CPUInfo *info) info->ia32.fma = false; } - if (FLAC__HAS_X86INTRIN && FLAC__AVX_SUPPORTED) { - dfprintf(stderr, " AVX OS sup . %c\n", info->ia32.avx ? 'Y' : 'n'); - } +#if 0 + if (FLAC__HAS_X86INTRIN && FLAC__AVX_SUPPORTED) + fprintf(stderr, " AVX OS sup . %c\n", info->ia32.avx ? 'Y' : 'n'); +#endif #else info->use_asm = false; #endif @@ -199,16 +197,16 @@ x86_64_cpu_info (FLAC__CPUInfo *info) info->x86.avx2 = (flags_ebx & FLAC__CPUINFO_IA32_CPUID_AVX2 ) ? true : false; } - dfprintf(stderr, "CPU info (x86-64):\n"); - dfprintf(stderr, " SSE3 ....... %c\n", info->x86.sse3 ? 'Y' : 'n'); - dfprintf(stderr, " SSSE3 ...... %c\n", info->x86.ssse3 ? 'Y' : 'n'); - dfprintf(stderr, " SSE41 ...... %c\n", info->x86.sse41 ? 'Y' : 'n'); - dfprintf(stderr, " SSE42 ...... %c\n", info->x86.sse42 ? 'Y' : 'n'); + fprintf(stderr, "CPU info (x86-64):\n"); + fprintf(stderr, " SSE3 ....... %c\n", info->x86.sse3 ? 'Y' : 'n'); + fprintf(stderr, " SSSE3 ...... %c\n", info->x86.ssse3 ? 'Y' : 'n'); + fprintf(stderr, " SSE41 ...... %c\n", info->x86.sse41 ? 'Y' : 'n'); + fprintf(stderr, " SSE42 ...... %c\n", info->x86.sse42 ? 'Y' : 'n'); if (FLAC__AVX_SUPPORTED) { - dfprintf(stderr, " AVX ........ %c\n", info->x86.avx ? 'Y' : 'n'); - dfprintf(stderr, " FMA ........ %c\n", info->x86.fma ? 'Y' : 'n'); - dfprintf(stderr, " AVX2 ....... %c\n", info->x86.avx2 ? 'Y' : 'n'); + fprintf(stderr, " AVX ........ %c\n", info->x86.avx ? 'Y' : 'n'); + fprintf(stderr, " FMA ........ %c\n", info->x86.fma ? 'Y' : 'n'); + fprintf(stderr, " AVX2 ....... %c\n", info->x86.avx2 ? 'Y' : 'n'); } /* @@ -222,7 +220,7 @@ x86_64_cpu_info (FLAC__CPUInfo *info) } if (FLAC__AVX_SUPPORTED) { - dfprintf(stderr, " AVX OS sup . %c\n", info->x86.avx ? 'Y' : 'n'); + fprintf(stderr, " AVX OS sup . %c\n", info->x86.avx ? 'Y' : 'n'); } #else /* Silence compiler warnings. */ diff --git a/deps/libFLAC/include/private/bitmath.h b/deps/libFLAC/include/private/bitmath.h index 9c75f85bf4..2c8ecf53b9 100644 --- a/deps/libFLAC/include/private/bitmath.h +++ b/deps/libFLAC/include/private/bitmath.h @@ -33,6 +33,8 @@ #ifndef FLAC__PRIVATE__BITMATH_H #define FLAC__PRIVATE__BITMATH_H +#include + #include "FLAC/ordinals.h" #include "FLAC/assert.h" @@ -43,7 +45,7 @@ #endif /* Will never be emitted for MSVC, GCC, Intel compilers */ -static inline unsigned int FLAC__clz_soft_uint32(FLAC__uint32 word) +static INLINE unsigned int FLAC__clz_soft_uint32(FLAC__uint32 word) { static const unsigned char byte_to_unary_table[] = { 8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4, @@ -70,7 +72,7 @@ static inline unsigned int FLAC__clz_soft_uint32(FLAC__uint32 word) byte_to_unary_table[word] + 24; } -static inline unsigned int FLAC__clz_uint32(FLAC__uint32 v) +static INLINE unsigned int FLAC__clz_uint32(FLAC__uint32 v) { /* Never used with input 0 */ FLAC__ASSERT(v > 0); @@ -92,13 +94,13 @@ static inline unsigned int FLAC__clz_uint32(FLAC__uint32 v) } /* Used when 64-bit bsr/clz is unavailable; can use 32-bit bsr/clz when possible */ -static inline unsigned int FLAC__clz_soft_uint64(FLAC__uint64 word) +static INLINE unsigned int FLAC__clz_soft_uint64(FLAC__uint64 word) { return (FLAC__uint32)(word>>32) ? FLAC__clz_uint32((FLAC__uint32)(word>>32)) : FLAC__clz_uint32((FLAC__uint32)word) + 32; } -static inline unsigned int FLAC__clz_uint64(FLAC__uint64 v) +static INLINE unsigned int FLAC__clz_uint64(FLAC__uint64 v) { /* Never used with input 0 */ FLAC__ASSERT(v > 0); @@ -116,14 +118,14 @@ static inline unsigned int FLAC__clz_uint64(FLAC__uint64 v) } /* These two functions work with input 0 */ -static inline unsigned int FLAC__clz2_uint32(FLAC__uint32 v) +static INLINE unsigned int FLAC__clz2_uint32(FLAC__uint32 v) { if (!v) return 32; return FLAC__clz_uint32(v); } -static inline unsigned int FLAC__clz2_uint64(FLAC__uint64 v) +static INLINE unsigned int FLAC__clz2_uint64(FLAC__uint64 v) { if (!v) return 64; @@ -153,7 +155,7 @@ static inline unsigned int FLAC__clz2_uint64(FLAC__uint64 v) * ilog2(18) = 4 */ -static inline unsigned FLAC__bitmath_ilog2(FLAC__uint32 v) +static INLINE unsigned FLAC__bitmath_ilog2(FLAC__uint32 v) { FLAC__ASSERT(v > 0); #if defined(__INTEL_COMPILER) @@ -169,7 +171,7 @@ static inline unsigned FLAC__bitmath_ilog2(FLAC__uint32 v) #endif } -static inline unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v) +static INLINE unsigned FLAC__bitmath_ilog2_wide(FLAC__uint64 v) { FLAC__ASSERT(v > 0); #if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) From c828a425e7a2f26d5cf20aed0035df87e810309f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 10:04:48 +0200 Subject: [PATCH 070/253] Start preparing Xaudio driver for C codepaths --- audio/drivers/xaudio.cpp | 90 ++++++++++++++++++++++++++++++++++++++-- audio/drivers/xaudio.h | 3 ++ 2 files changed, 90 insertions(+), 3 deletions(-) diff --git a/audio/drivers/xaudio.cpp b/audio/drivers/xaudio.cpp index f63be65f77..37a9abcd74 100644 --- a/audio/drivers/xaudio.cpp +++ b/audio/drivers/xaudio.cpp @@ -53,8 +53,13 @@ typedef struct size_t bufsize; } xa_t; +#ifdef __cplusplus struct xaudio2 : public IXAudio2VoiceCallback +#else +struct xaudio2 +#endif { +#ifdef __cplusplus xaudio2() : buf(0), pXAudio2(0), pMasterVoice(0), pSourceVoice(0), hEvent(0), buffers(0), bufsize(0), @@ -74,6 +79,9 @@ struct xaudio2 : public IXAudio2VoiceCallback STDMETHOD_(void, OnVoiceError) (void *, HRESULT) {} STDMETHOD_(void, OnVoiceProcessingPassEnd) () {} STDMETHOD_(void, OnVoiceProcessingPassStart) (UINT32) {} +#else + const IXAudio2VoiceCallbackVtbl *lpVtbl; +#endif uint8_t *buf; IXAudio2 *pXAudio2; @@ -87,7 +95,30 @@ struct xaudio2 : public IXAudio2VoiceCallback unsigned write_buffer; }; -#if 0 +#ifndef __cplusplus +static void WINAPI voice_on_buffer_end(void *handle_, void *data) +{ + (void)data; + xaudio2_t *handle = (xaudio2_t*)handle_; + InterlockedDecrement(&handle->buffers); + SetEvent(handle->hEvent); +} + +static void WINAPI dummy_voidp(void *handle, void *data) { (void)handle; (void)data; } +static void WINAPI dummy_nil(void *handle) { (void)handle; } +static void WINAPI dummy_uint32(void *handle, UINT32 dummy) { (void)handle; (void)dummy; } +static void WINAPI dummy_voidp_hresult(void *handle, void *data, HRESULT dummy) { (void)handle; (void)data; (void)dummy; } + +const struct IXAudio2VoiceCallbackVtbl voice_vtable = { + dummy_uint32, + dummy_nil, + dummy_nil, + dummy_voidp, + voice_on_buffer_end, + dummy_voidp, + dummy_voidp_hresult, +}; + static void xaudio2_enumerate_devices(xaudio2_t *xa) { uint32_t dev_count = 0; @@ -130,21 +161,44 @@ static void xaudio2_free(xaudio2_t *handle) if (handle->pSourceVoice) { +#ifdef __cplusplus handle->pSourceVoice->Stop(0, XAUDIO2_COMMIT_NOW); handle->pSourceVoice->DestroyVoice(); +#else + IXAudio2SourceVoice_Stop(handle->pSourceVoice, + 0, XAUDIO2_COMMIT_NOW); + IXAudio2SourceVoice_DestroyVoice(handle->pSourceVoice); +#endif } if (handle->pMasterVoice) + { +#ifdef __cplusplus handle->pMasterVoice->DestroyVoice(); +#else + IXAudio2MasteringVoice_DestroyVoice(handle->pMasterVoice); +#endif + } if (handle->pXAudio2) + { +#ifdef __cplusplus handle->pXAudio2->Release(); +#else + IXAudio2_Release(handle->pXAudio2); +#endif + } if (handle->hEvent) CloseHandle(handle->hEvent); free(handle->buf); + +#ifdef __cplusplus delete handle; +#else + free(handle); +#endif } #ifndef COINIT_MULTITHREADED @@ -154,28 +208,47 @@ static void xaudio2_free(xaudio2_t *handle) static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels, size_t size, unsigned device) { - xaudio2_t *handle; - WAVEFORMATEX wfx = {0}; + xaudio2_t *handle = NULL; + WAVEFORMATEX wfx = {0}; #ifndef _XBOX CoInitializeEx(0, COINIT_MULTITHREADED); #endif +#ifdef __cplusplus handle = new xaudio2; +#else + handle = (xaudio2_t*)calloc(1, sizeof(*handle)); +#endif + + if (!handle) + goto error; if (FAILED(XAudio2Create(&handle->pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR))) goto error; +#ifdef __cplusplus if (FAILED(handle->pXAudio2->CreateMasteringVoice(&handle->pMasterVoice, channels, samplerate, 0, device, NULL))) goto error; +#else + if (FAILED(IXAudio2_CreateMasteringVoice(handle->pXAudio2, &handle->pMasterVoice, channels, samplerate, 0, device, NULL))) + goto error; +#endif xaudio2_set_wavefmt(&wfx, channels, samplerate); +#ifdef __cplusplus if (FAILED(handle->pXAudio2->CreateSourceVoice(&handle->pSourceVoice, &wfx, XAUDIO2_VOICE_NOSRC, XAUDIO2_DEFAULT_FREQ_RATIO, handle))) goto error; +#else + if (FAILED(IXAudio2_CreateSourceVoice(handle->pXAudio2->CreateSourceVoice, &wfx, + XAUDIO2_VOICE_NOSRC, XAUDIO2_DEFAULT_FREQ_RATIO, + (IXAudio2VoiceCallback*)handle, 0, 0))) + goto error; +#endif handle->hEvent = CreateEvent(0, FALSE, FALSE, 0); if (!handle->hEvent) @@ -186,8 +259,14 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels, if (!handle->buf) goto error; +#ifdef __cplusplus if (FAILED(handle->pSourceVoice->Start(0))) goto error; +#else + if (FAILED(IXAudio2SourceVoice_Start(handle->pSourceVoice, 0, + XAUDIO2_COMMIT_NOW))) + goto error; +#endif return handle; @@ -227,8 +306,13 @@ static size_t xaudio2_write(xaudio2_t *handle, const void *buf, size_t bytes_) xa2buffer.AudioBytes = handle->bufsize; xa2buffer.pAudioData = handle->buf + handle->write_buffer * handle->bufsize; +#ifdef __cplusplus if (FAILED(handle->pSourceVoice->SubmitSourceBuffer(&xa2buffer, NULL))) return 0; +#else + if (FAILED(IXAudio2SourceVoice_SubmitSourceBuffer(handle->pSourceVoice, &xa2buffer, NULL))) + return 0; +#endif InterlockedIncrement((LONG volatile*)&handle->buffers); handle->bufptr = 0; diff --git a/audio/drivers/xaudio.h b/audio/drivers/xaudio.h index aa3bd59bcc..2378665da7 100644 --- a/audio/drivers/xaudio.h +++ b/audio/drivers/xaudio.h @@ -29,6 +29,9 @@ #ifdef _XBOX #include +#ifndef __cplusplus +#define OPAQUE interface +#endif #define DEFINE_CLSID(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ DEFINE_GUID(CLSID_##className, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) #define DEFINE_IID(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ From 97f821e7431f7a7eca244fb061afb44e32603d36 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 16:29:45 +0200 Subject: [PATCH 071/253] Fix crash when selecting 'Scan Directory' --- menu/cbs/menu_cbs_deferred_push.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index fb2ff52f5c..27b69731c6 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -735,7 +735,7 @@ static int general_push(menu_displaylist_info_t *info, break; case PUSH_DEFAULT: { - char *new_exts = info->exts; + char *new_exts = NULL; if (menu_setting_get_browser_selection_type(info->setting) == ST_DIR) { @@ -751,6 +751,10 @@ static int general_push(menu_displaylist_info_t *info, new_exts = strdup(system->valid_extensions); } + if (!new_exts) + new_exts = info->exts; + + if (new_exts && !string_is_empty(new_exts)) { union string_list_elem_attr attr; size_t path_size = PATH_MAX_LENGTH * sizeof(char); From 0a29c4711a168b7f3e658a610a5ea27709df8370 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 16:50:30 +0200 Subject: [PATCH 072/253] xaudio file can now compile as both C and C++ --- audio/drivers/{xaudio.cpp => xaudio.c} | 24 ++++++-- audio/drivers/xaudio.h | 78 +++++++++++++++++++++++--- griffin/griffin.c | 4 ++ griffin/griffin_cpp.cpp | 7 --- 4 files changed, 93 insertions(+), 20 deletions(-) rename audio/drivers/{xaudio.cpp => xaudio.c} (94%) diff --git a/audio/drivers/xaudio.cpp b/audio/drivers/xaudio.c similarity index 94% rename from audio/drivers/xaudio.cpp rename to audio/drivers/xaudio.c index 37a9abcd74..ef730aeab1 100644 --- a/audio/drivers/xaudio.cpp +++ b/audio/drivers/xaudio.c @@ -100,7 +100,7 @@ static void WINAPI voice_on_buffer_end(void *handle_, void *data) { (void)data; xaudio2_t *handle = (xaudio2_t*)handle_; - InterlockedDecrement(&handle->buffers); + InterlockedDecrement((__LONG32 volatile*)&handle->buffers); SetEvent(handle->hEvent); } @@ -118,7 +118,9 @@ const struct IXAudio2VoiceCallbackVtbl voice_vtable = { dummy_voidp, dummy_voidp_hresult, }; +#endif +#if 0 static void xaudio2_enumerate_devices(xaudio2_t *xa) { uint32_t dev_count = 0; @@ -128,13 +130,21 @@ static void xaudio2_enumerate_devices(xaudio2_t *xa) (void)i; (void)dev_count; #ifndef _XBOX +#ifdef __cplusplus xa->pXAudio2->GetDeviceCount(&dev_count); +#else + IXAudio2_GetDeviceCount(xa->pXAudio2, &dev_count); +#endif fprintf(stderr, "XAudio2 devices:\n"); for (i = 0; i < dev_count; i++) { XAUDIO2_DEVICE_DETAILS dev_detail; +#ifdef __cplusplus xa->pXAudio2->GetDeviceDetails(i, &dev_detail); +#else + IXAudio2_GetDeviceDetails(xa->pXAudio2, i, &dev_detail); +#endif fwprintf(stderr, L"\t%u: %s\n", i, dev_detail.DisplayName); } #endif @@ -224,6 +234,10 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels, if (!handle) goto error; +#ifndef __cplusplus + handle->lpVtbl = &voice_vtable; +#endif + if (FAILED(XAudio2Create(&handle->pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR))) goto error; @@ -244,8 +258,9 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels, handle))) goto error; #else - if (FAILED(IXAudio2_CreateSourceVoice(handle->pXAudio2->CreateSourceVoice, &wfx, - XAUDIO2_VOICE_NOSRC, XAUDIO2_DEFAULT_FREQ_RATIO, + if (FAILED(IXAudio2_CreateSourceVoice(handle->pXAudio2, + &handle->pSourceVoice, &wfx, + XAUDIO2_VOICE_NOSRC, XAUDIO2_DEFAULT_FREQ_RATIO, (IXAudio2VoiceCallback*)handle, 0, 0))) goto error; #endif @@ -289,7 +304,8 @@ static size_t xaudio2_write(xaudio2_t *handle, const void *buf, size_t bytes_) { unsigned need = MIN(bytes, handle->bufsize - handle->bufptr); - memcpy(handle->buf + handle->write_buffer * handle->bufsize + handle->bufptr, + memcpy(handle->buf + handle->write_buffer * + handle->bufsize + handle->bufptr, buffer, need); handle->bufptr += need; diff --git a/audio/drivers/xaudio.h b/audio/drivers/xaudio.h index 2378665da7..dbb46c5db6 100644 --- a/audio/drivers/xaudio.h +++ b/audio/drivers/xaudio.h @@ -15,16 +15,21 @@ * If not, see . */ -// Kinda stripped down. Only contains the bare essentials used in RetroArch. +/* Kinda stripped down. Only contains the bare essentials used in RetroArch. */ #ifndef XAUDIO2_STRIPPED_H #define XAUDIO2_STRIPPED_H #include -// All structures defined in this file use tight field packing +/* All structures defined in this file use tight field packing */ #pragma pack(push, 1) + +#ifdef __cplusplus #define X2DEFAULT(x) = (x) +#else +#define X2DEFAULT(x) +#endif #ifdef _XBOX #include @@ -41,7 +46,7 @@ DEFINE_CLSID(XAudio2, 3eda9b49, 2085, 498b, 9b, b2, 39, a6, 77, 84, 93, de); DEFINE_CLSID(XAudio2_Debug, 47199894, 7cc2, 444d, 98, 73, ce, d2, 56, 2c, c6, 0e); DEFINE_IID(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb); -#include // Basic audio data types and constants +#include /* Basic audio data types and constants */ #else @@ -51,6 +56,11 @@ DEFINE_IID(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb); #include #include +#ifndef __cplusplus +#undef OPAQUE +#define OPAQUE struct +#endif + #define DEFINE_GUID_X(n, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ static const GUID n = { l, w1, w2, { b1, b2, b3, b4, b5, b6, b7, b8 } } #define DEFINE_CLSID_X(className, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ @@ -58,7 +68,13 @@ DEFINE_IID(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb); #define DEFINE_IID_X(interfaceName, l, w1, w2, b1, b2, b3, b4, b5, b6, b7, b8) \ DEFINE_GUID_X(IID_##interfaceName, 0x##l, 0x##w1, 0x##w2, 0x##b1, 0x##b2, 0x##b3, 0x##b4, 0x##b5, 0x##b6, 0x##b7, 0x##b8) -DEFINE_CLSID_X(XAudio2, 5a508685, a254, 4fba, 9b, 82, 9a, 24, b0, 03, 06, af); // 2.7 +#ifndef __cplusplus +#ifndef INTERFACE +#define INTERFACE void +#endif +#endif + +DEFINE_CLSID_X(XAudio2, 5a508685, a254, 4fba, 9b, 82, 9a, 24, b0, 03, 06, af); /* 2.7 */ DEFINE_IID_X(IXAudio2, 8bcf1f58, 9fe7, 4583, 8a, c6, e2, ad, c4, 65, c8, bb); #endif @@ -121,7 +137,8 @@ typedef struct XAUDIO2_DEVICE_DETAILS WAVEFORMATEXTENSIBLE OutputFormat; } XAUDIO2_DEVICE_DETAILS; -// Forward declarations. +/* Forward declarations. */ +#ifdef __cplusplus struct XAUDIO2_VOICE_DETAILS; struct XAUDIO2_VOICE_SENDS; struct XAUDIO2_EFFECT_DESCRIPTOR; @@ -133,6 +150,20 @@ struct XAUDIO2_PERFORMANCE_DATA; struct XAUDIO2_DEBUG_CONFIGURATION; struct IXAudio2EngineCallback; struct IXAudio2SubmixVoice; +#else +typedef OPAQUE XAUDIO2_VOICE_DETAILS XAUDIO2_VOICE_DETAILS; +typedef OPAQUE XAUDIO2_VOICE_SENDS XAUDIO2_VOICE_SENDS; +typedef OPAQUE XAUDIO2_EFFECT_DESCRIPTOR XAUDIO2_EFFECT_DESCRIPTOR; +typedef OPAQUE XAUDIO2_EFFECT_CHAIN XAUDIO2_EFFECT_CHAIN; +typedef OPAQUE XAUDIO2_FILTER_PARAMETERS XAUDIO2_FILTER_PARAMETERS; +typedef OPAQUE XAUDIO2_BUFFER_WMA XAUDIO2_BUFFER_WMA; +typedef OPAQUE XAUDIO2_VOICE_STATE XAUDIO2_VOICE_STATE; +typedef OPAQUE XAUDIO2_PERFORMANCE_DATA XAUDIO2_PERFORMANCE_DATA; +typedef OPAQUE XAUDIO2_DEBUG_CONFIGURATION XAUDIO2_DEBUG_CONFIGURATION; +typedef OPAQUE IXAudio2EngineCallback IXAudio2EngineCallback; +typedef OPAQUE IXAudio2SubmixVoice IXAudio2SubmixVoice; +#endif + typedef struct XAUDIO2_BUFFER { @@ -256,31 +287,60 @@ DECLARE_INTERFACE_(IXAudio2, IUnknown) void *pReserved X2DEFAULT(NULL)) PURE; }; +#ifndef __cplusplus +/* C hooks */ +#define IXAudio2_Initialize(THIS, ...) (THIS)->lpVtbl->Initialize(THIS, __VA_ARGS__) +#define IXAudio2_Release(THIS) (THIS)->lpVtbl->Release(THIS) +#define IXAudio2_CreateSourceVoice(THIS, ...) (THIS)->lpVtbl->CreateSourceVoice(THIS, __VA_ARGS__) +#define IXAudio2_CreateMasteringVoice(THIS, ...) (THIS)->lpVtbl->CreateMasteringVoice(THIS, __VA_ARGS__) +#define IXAudio2_GetDeviceCount(THIS, ...) (THIS)->lpVtbl->GetDeviceCount(THIS, __VA_ARGS__) +#define IXAudio2_GetDeviceDetails(THIS, ...) (THIS)->lpVtbl->GetDeviceDetails(THIS, __VA_ARGS__) +#define IXAudio2SourceVoice_Start(THIS, ...) (THIS)->lpVtbl->Start(THIS, __VA_ARGS__) +#define IXAudio2SourceVoice_Stop(THIS, ...) (THIS)->lpVtbl->Stop(THIS, __VA_ARGS__) +#define IXAudio2SourceVoice_SubmitSourceBuffer(THIS, ...) (THIS)->lpVtbl->SubmitSourceBuffer(THIS, __VA_ARGS__) +#define IXAudio2SourceVoice_DestroyVoice(THIS) (THIS)->lpVtbl->DestroyVoice(THIS) +#define IXAudio2MasteringVoice_DestroyVoice(THIS) (THIS)->lpVtbl->DestroyVoice(THIS) +#endif + #ifdef _XBOX STDAPI XAudio2Create(__deref_out IXAudio2** ppXAudio2, UINT32 Flags X2DEFAULT(0), XAUDIO2_PROCESSOR XAudio2Processor X2DEFAULT(XAUDIO2_DEFAULT_PROCESSOR)); #else -static INLINE HRESULT XAudio2Create(IXAudio2 **ppXAudio2, UINT32, XAUDIO2_PROCESSOR) +static INLINE HRESULT XAudio2Create(IXAudio2 **ppXAudio2, UINT32 flags, XAUDIO2_PROCESSOR proc) { IXAudio2 *pXAudio2; + (void)flags; + (void)proc; +#ifdef __cplusplus HRESULT hr = CoCreateInstance(CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, IID_IXAudio2, (void**)&pXAudio2); +#else + HRESULT hr = CoCreateInstance(&CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, &IID_IXAudio2, (void**)&pXAudio2); +#endif if (SUCCEEDED(hr)) { - //hr = IXAudio2_Initialize(pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR); +#ifdef __cplusplus hr = pXAudio2->Initialize(0, XAUDIO2_DEFAULT_PROCESSOR); +#else + hr = IXAudio2_Initialize(pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR); +#endif if (SUCCEEDED(hr)) *ppXAudio2 = pXAudio2; else - //IXAudio2_Release(pXAudio2); + { +#ifdef __cplusplus pXAudio2->Release(); +#else + IXAudio2_Release(pXAudio2); +#endif + } } return hr; } #endif -// Undo the #pragma pack(push, 1) directive at the top of this file +/* Undo the #pragma pack(push, 1) directive at the top of this file */ #pragma pack(pop) #endif diff --git a/griffin/griffin.c b/griffin/griffin.c index f6bf342a6f..35d69df7c1 100644 --- a/griffin/griffin.c +++ b/griffin/griffin.c @@ -662,6 +662,10 @@ AUDIO #include "../audio/drivers/ctr_dsp_audio.c" #endif +#ifdef HAVE_XAUDIO +#include "../audio/drivers/xaudio.c" +#endif + #if defined(HAVE_SDL2) #include "../audio/drivers/sdl_audio.c" #endif diff --git a/griffin/griffin_cpp.cpp b/griffin/griffin_cpp.cpp index eb2c7358f6..a39ac7428d 100644 --- a/griffin/griffin_cpp.cpp +++ b/griffin/griffin_cpp.cpp @@ -90,13 +90,6 @@ #endif #endif -/*============================================================ -AUDIO -============================================================ */ -#ifdef HAVE_XAUDIO -#include "../audio/drivers/xaudio.cpp" -#endif - /*============================================================ MENU ============================================================ */ From 51cdf5a6d7c822544cdf82bf1d0e144f7221573b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 16:54:09 +0200 Subject: [PATCH 073/253] Cleanup xaudio.h/xaudio.c --- audio/drivers/xaudio.c | 44 ------------------------------------------ audio/drivers/xaudio.h | 12 +++++++++++- 2 files changed, 11 insertions(+), 45 deletions(-) diff --git a/audio/drivers/xaudio.c b/audio/drivers/xaudio.c index ef730aeab1..17e91b3ea1 100644 --- a/audio/drivers/xaudio.c +++ b/audio/drivers/xaudio.c @@ -130,21 +130,13 @@ static void xaudio2_enumerate_devices(xaudio2_t *xa) (void)i; (void)dev_count; #ifndef _XBOX -#ifdef __cplusplus - xa->pXAudio2->GetDeviceCount(&dev_count); -#else IXAudio2_GetDeviceCount(xa->pXAudio2, &dev_count); -#endif fprintf(stderr, "XAudio2 devices:\n"); for (i = 0; i < dev_count; i++) { XAUDIO2_DEVICE_DETAILS dev_detail; -#ifdef __cplusplus - xa->pXAudio2->GetDeviceDetails(i, &dev_detail); -#else IXAudio2_GetDeviceDetails(xa->pXAudio2, i, &dev_detail); -#endif fwprintf(stderr, L"\t%u: %s\n", i, dev_detail.DisplayName); } #endif @@ -171,32 +163,19 @@ static void xaudio2_free(xaudio2_t *handle) if (handle->pSourceVoice) { -#ifdef __cplusplus - handle->pSourceVoice->Stop(0, XAUDIO2_COMMIT_NOW); - handle->pSourceVoice->DestroyVoice(); -#else IXAudio2SourceVoice_Stop(handle->pSourceVoice, 0, XAUDIO2_COMMIT_NOW); IXAudio2SourceVoice_DestroyVoice(handle->pSourceVoice); -#endif } if (handle->pMasterVoice) { -#ifdef __cplusplus - handle->pMasterVoice->DestroyVoice(); -#else IXAudio2MasteringVoice_DestroyVoice(handle->pMasterVoice); -#endif } if (handle->pXAudio2) { -#ifdef __cplusplus - handle->pXAudio2->Release(); -#else IXAudio2_Release(handle->pXAudio2); -#endif } if (handle->hEvent) @@ -241,29 +220,16 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels, if (FAILED(XAudio2Create(&handle->pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR))) goto error; -#ifdef __cplusplus - if (FAILED(handle->pXAudio2->CreateMasteringVoice(&handle->pMasterVoice, - channels, samplerate, 0, device, NULL))) - goto error; -#else if (FAILED(IXAudio2_CreateMasteringVoice(handle->pXAudio2, &handle->pMasterVoice, channels, samplerate, 0, device, NULL))) goto error; -#endif xaudio2_set_wavefmt(&wfx, channels, samplerate); -#ifdef __cplusplus - if (FAILED(handle->pXAudio2->CreateSourceVoice(&handle->pSourceVoice, &wfx, - XAUDIO2_VOICE_NOSRC, XAUDIO2_DEFAULT_FREQ_RATIO, - handle))) - goto error; -#else if (FAILED(IXAudio2_CreateSourceVoice(handle->pXAudio2, &handle->pSourceVoice, &wfx, XAUDIO2_VOICE_NOSRC, XAUDIO2_DEFAULT_FREQ_RATIO, (IXAudio2VoiceCallback*)handle, 0, 0))) goto error; -#endif handle->hEvent = CreateEvent(0, FALSE, FALSE, 0); if (!handle->hEvent) @@ -274,14 +240,9 @@ static xaudio2_t *xaudio2_new(unsigned samplerate, unsigned channels, if (!handle->buf) goto error; -#ifdef __cplusplus - if (FAILED(handle->pSourceVoice->Start(0))) - goto error; -#else if (FAILED(IXAudio2SourceVoice_Start(handle->pSourceVoice, 0, XAUDIO2_COMMIT_NOW))) goto error; -#endif return handle; @@ -322,13 +283,8 @@ static size_t xaudio2_write(xaudio2_t *handle, const void *buf, size_t bytes_) xa2buffer.AudioBytes = handle->bufsize; xa2buffer.pAudioData = handle->buf + handle->write_buffer * handle->bufsize; -#ifdef __cplusplus - if (FAILED(handle->pSourceVoice->SubmitSourceBuffer(&xa2buffer, NULL))) - return 0; -#else if (FAILED(IXAudio2SourceVoice_SubmitSourceBuffer(handle->pSourceVoice, &xa2buffer, NULL))) return 0; -#endif InterlockedIncrement((LONG volatile*)&handle->buffers); handle->bufptr = 0; diff --git a/audio/drivers/xaudio.h b/audio/drivers/xaudio.h index dbb46c5db6..b2b158f2af 100644 --- a/audio/drivers/xaudio.h +++ b/audio/drivers/xaudio.h @@ -287,7 +287,17 @@ DECLARE_INTERFACE_(IXAudio2, IUnknown) void *pReserved X2DEFAULT(NULL)) PURE; }; -#ifndef __cplusplus +#ifdef __cplusplus +/* C++ hooks */ +#define IXAudio2SourceVoice_SubmitSourceBuffer(handle, a, b) handle->SubmitSourceBuffer(a, b) +#define IXAudio2SourceVoice_Stop(handle, a, b) handle->Stop(a, b) +#define IXAudio2SourceVoice_DestroyVoice(handle) handle->DestroyVoice() +#define IXAudio2MasteringVoice_DestroyVoice(handle) handle->DestroyVoice() +#define IXAudio2_Release(handle) handle->Release() +#define IXAudio2_CreateSourceVoice(handle, a, b, c, d, e, f, g) handle->CreateSourceVoice(a, b, c, d, e, f, g) +#define IXAudio2_CreateMasteringVoice(handle, a, b, c, d, e, f) handle->CreateMasteringVoice(a, b, c, d, e, f) +#define IXAudio2SourceVoice_Start(handle, a, b) handle->Start(a, b) +#else /* C hooks */ #define IXAudio2_Initialize(THIS, ...) (THIS)->lpVtbl->Initialize(THIS, __VA_ARGS__) #define IXAudio2_Release(THIS) (THIS)->lpVtbl->Release(THIS) From 61810cfd828d62cf4c923811d055bf95d4dfcdf3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 17:18:17 +0200 Subject: [PATCH 074/253] (Xaudio2) Get rid of variadic macros so that it can compile as C89 --- audio/drivers/xaudio.c | 2 +- audio/drivers/xaudio.h | 38 +++++++++++++++++++------------------- qb/config.params.sh | 1 + 3 files changed, 21 insertions(+), 20 deletions(-) diff --git a/audio/drivers/xaudio.c b/audio/drivers/xaudio.c index 17e91b3ea1..76121dc1fe 100644 --- a/audio/drivers/xaudio.c +++ b/audio/drivers/xaudio.c @@ -98,8 +98,8 @@ struct xaudio2 #ifndef __cplusplus static void WINAPI voice_on_buffer_end(void *handle_, void *data) { - (void)data; xaudio2_t *handle = (xaudio2_t*)handle_; + (void)data; InterlockedDecrement((__LONG32 volatile*)&handle->buffers); SetEvent(handle->hEvent); } diff --git a/audio/drivers/xaudio.h b/audio/drivers/xaudio.h index b2b158f2af..41e21be09d 100644 --- a/audio/drivers/xaudio.h +++ b/audio/drivers/xaudio.h @@ -21,6 +21,7 @@ #define XAUDIO2_STRIPPED_H #include +#include /* All structures defined in this file use tight field packing */ #pragma pack(push, 1) @@ -118,7 +119,11 @@ typedef enum XAUDIO2_XBOX_HWTHREAD_SPECIFIER #else typedef enum XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER { +#if defined(__STDC_C89__) + XAUDIO2_ANY_PROCESSOR = 0xffff, +#else XAUDIO2_ANY_PROCESSOR = 0xffffffff, +#endif XAUDIO2_DEFAULT_PROCESSOR = XAUDIO2_ANY_PROCESSOR } XAUDIO2_WINDOWS_PROCESSOR_SPECIFIER, XAUDIO2_PROCESSOR; #endif @@ -289,6 +294,7 @@ DECLARE_INTERFACE_(IXAudio2, IUnknown) #ifdef __cplusplus /* C++ hooks */ +#define IXAudio2_Initialize(handle,a,b) handle->Initialize(a, b) #define IXAudio2SourceVoice_SubmitSourceBuffer(handle, a, b) handle->SubmitSourceBuffer(a, b) #define IXAudio2SourceVoice_Stop(handle, a, b) handle->Stop(a, b) #define IXAudio2SourceVoice_DestroyVoice(handle) handle->DestroyVoice() @@ -299,15 +305,15 @@ DECLARE_INTERFACE_(IXAudio2, IUnknown) #define IXAudio2SourceVoice_Start(handle, a, b) handle->Start(a, b) #else /* C hooks */ -#define IXAudio2_Initialize(THIS, ...) (THIS)->lpVtbl->Initialize(THIS, __VA_ARGS__) +#define IXAudio2_Initialize(THIS,a,b) (THIS)->lpVtbl->Initialize(THIS, a, b) #define IXAudio2_Release(THIS) (THIS)->lpVtbl->Release(THIS) -#define IXAudio2_CreateSourceVoice(THIS, ...) (THIS)->lpVtbl->CreateSourceVoice(THIS, __VA_ARGS__) -#define IXAudio2_CreateMasteringVoice(THIS, ...) (THIS)->lpVtbl->CreateMasteringVoice(THIS, __VA_ARGS__) -#define IXAudio2_GetDeviceCount(THIS, ...) (THIS)->lpVtbl->GetDeviceCount(THIS, __VA_ARGS__) -#define IXAudio2_GetDeviceDetails(THIS, ...) (THIS)->lpVtbl->GetDeviceDetails(THIS, __VA_ARGS__) -#define IXAudio2SourceVoice_Start(THIS, ...) (THIS)->lpVtbl->Start(THIS, __VA_ARGS__) -#define IXAudio2SourceVoice_Stop(THIS, ...) (THIS)->lpVtbl->Stop(THIS, __VA_ARGS__) -#define IXAudio2SourceVoice_SubmitSourceBuffer(THIS, ...) (THIS)->lpVtbl->SubmitSourceBuffer(THIS, __VA_ARGS__) +#define IXAudio2_CreateSourceVoice(THIS,ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain) (THIS)->lpVtbl->CreateSourceVoice(THIS, ppSourceVoice,pSourceFormat,Flags,MaxFrequencyRatio,pCallback,pSendList,pEffectChain) +#define IXAudio2_CreateMasteringVoice(THIS,ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain) (THIS)->lpVtbl->CreateMasteringVoice(THIS, ppMasteringVoice,InputChannels,InputSampleRate,Flags,DeviceIndex,pEffectChain) +#define IXAudio2_GetDeviceCount(THIS, puCount) (THIS)->lpVtbl->GetDeviceCount(THIS, puCount) +#define IXAudio2_GetDeviceDetails(THIS, Index,pDeviceDetails) (THIS)->lpVtbl->GetDeviceDetails(THIS, Index, pDeviceDetails) +#define IXAudio2SourceVoice_Start(THIS, Flags, OperationSet) (THIS)->lpVtbl->Start(THIS, Flags, OperationSet) +#define IXAudio2SourceVoice_Stop(THIS, Flags, OperationSet) (THIS)->lpVtbl->Stop(THIS, Flags, OperationSet) +#define IXAudio2SourceVoice_SubmitSourceBuffer(THIS, pBuffer, pBufferWMA) (THIS)->lpVtbl->SubmitSourceBuffer(THIS, pBuffer, pBufferWMA) #define IXAudio2SourceVoice_DestroyVoice(THIS) (THIS)->lpVtbl->DestroyVoice(THIS) #define IXAudio2MasteringVoice_DestroyVoice(THIS) (THIS)->lpVtbl->DestroyVoice(THIS) #endif @@ -318,32 +324,26 @@ STDAPI XAudio2Create(__deref_out IXAudio2** ppXAudio2, UINT32 Flags X2DEFAULT(0) #else static INLINE HRESULT XAudio2Create(IXAudio2 **ppXAudio2, UINT32 flags, XAUDIO2_PROCESSOR proc) { - IXAudio2 *pXAudio2; + HRESULT hr; + IXAudio2 *pXAudio2 = NULL; + (void)flags; (void)proc; #ifdef __cplusplus - HRESULT hr = CoCreateInstance(CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, IID_IXAudio2, (void**)&pXAudio2); + hr = CoCreateInstance(CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, IID_IXAudio2, (void**)&pXAudio2); #else - HRESULT hr = CoCreateInstance(&CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, &IID_IXAudio2, (void**)&pXAudio2); + hr = CoCreateInstance(&CLSID_XAudio2, NULL, CLSCTX_INPROC_SERVER, &IID_IXAudio2, (void**)&pXAudio2); #endif if (SUCCEEDED(hr)) { -#ifdef __cplusplus - hr = pXAudio2->Initialize(0, XAUDIO2_DEFAULT_PROCESSOR); -#else hr = IXAudio2_Initialize(pXAudio2, 0, XAUDIO2_DEFAULT_PROCESSOR); -#endif if (SUCCEEDED(hr)) *ppXAudio2 = pXAudio2; else { -#ifdef __cplusplus - pXAudio2->Release(); -#else IXAudio2_Release(pXAudio2); -#endif } } return hr; diff --git a/qb/config.params.sh b/qb/config.params.sh index d255318482..b030f30040 100644 --- a/qb/config.params.sh +++ b/qb/config.params.sh @@ -83,6 +83,7 @@ HAVE_FLOATHARD=no # Force hard float ABI (for ARM) HAVE_FLOATSOFTFP=no # Force soft float ABI (for ARM) HAVE_7ZIP=yes # Compile in 7z support HAVE_FLAC=yes # Compile in flac support +C89_FLAC=no HAVE_UPDATE_ASSETS=yes # Disable downloading assets with online updater HAVE_PRESERVE_DYLIB=no # Enable dlclose() for Valgrind support HAVE_PARPORT=auto # Parallel port joypad support From 2af4457bec60372cc3a606b311e8cc4852957af3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 18:43:06 +0200 Subject: [PATCH 075/253] (WASAPI) Start adding C++ codepath too --- audio/drivers/wasapi.c | 237 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 227 insertions(+), 10 deletions(-) diff --git a/audio/drivers/wasapi.c b/audio/drivers/wasapi.c index 089bee8978..97c0f67ded 100644 --- a/audio/drivers/wasapi.c +++ b/audio/drivers/wasapi.c @@ -65,9 +65,11 @@ DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0 err_exp; } #define WASAPI_RELEASE(iface)\ - if(iface) {\ + if(iface) \ + { \ iface->lpVtbl->Release(iface);\ - iface = NULL; }\ + iface = NULL; \ + } \ #define WASAPI_FREE(ptr)\ if(ptr) {\ @@ -138,7 +140,11 @@ static bool wasapi_check_device_id(IMMDevice *device, const char *id) id_length = MultiByteToWideChar(CP_ACP, 0, id, -1, dev_cmp_id, id_length); WASAPI_SR_CHECK(id_length > 0, "MultiByteToWideChar", goto error); +#ifdef __cplusplus + hr = device->GetId(&dev_id); +#else hr = device->lpVtbl->GetId(device, &dev_id); +#endif WASAPI_HR_CHECK(hr, "IMMDevice::GetId", goto error); result = lstrcmpW(dev_cmp_id, dev_id) == 0 ? true : false; @@ -168,23 +174,41 @@ static IMMDevice *wasapi_init_device(const char *id) else wasapi_log("Initializing default device .."); +#ifdef __cplusplus + hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, + IID_IMMDeviceEnumerator, (void **)&enumerator); +#else hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &IID_IMMDeviceEnumerator, (void **)&enumerator); +#endif WASAPI_HR_CHECK(hr, "CoCreateInstance", goto error); if (id) { +#ifdef __cplusplus + hr = enumerator->EnumAudioEndpoints( + eRender, DEVICE_STATE_ACTIVE, &collection); +#else hr = enumerator->lpVtbl->EnumAudioEndpoints(enumerator, eRender, DEVICE_STATE_ACTIVE, &collection); +#endif WASAPI_HR_CHECK(hr, "IMMDeviceEnumerator::EnumAudioEndpoints", goto error); +#ifdef __cplusplus + hr = collection->GetCount(&dev_count); +#else hr = collection->lpVtbl->GetCount(collection, &dev_count); +#endif WASAPI_HR_CHECK(hr, "IMMDeviceCollection::GetCount", goto error); for (i = 0; i < dev_count; ++i) { +#ifdef __cplusplus + hr = collection->Item(i, &device); +#else hr = collection->lpVtbl->Item(collection, i, &device); +#endif WASAPI_HR_CHECK(hr, "IMMDeviceCollection::Item", continue); if (wasapi_check_device_id(device, id)) @@ -195,8 +219,13 @@ static IMMDevice *wasapi_init_device(const char *id) } else { +#ifdef __cplusplus + hr = enumerator->GetDefaultAudioEndpoint( + eRender, eConsole, &device); +#else hr = enumerator->lpVtbl->GetDefaultAudioEndpoint(enumerator, eRender, eConsole, &device); +#endif WASAPI_HR_CHECK(hr, "IMMDeviceEnumerator::GetDefaultAudioEndpoint", goto error); } @@ -268,8 +297,13 @@ static IAudioClient *wasapi_init_client_sh(IMMDevice *device, IAudioClient *client = NULL; bool float_fmt_res = *float_fmt; unsigned rate_res = *rate; +#ifdef __cplusplus + HRESULT hr = device->Activate(IID_IAudioClient, + CLSCTX_ALL, NULL, (void**)&client); +#else HRESULT hr = device->lpVtbl->Activate(device, &IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&client); +#endif WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL); /* once for float, once for pcm (requested first) */ @@ -286,19 +320,37 @@ static IAudioClient *wasapi_init_client_sh(IMMDevice *device, float_fmt_res ? "float" : "pcm", rate_res, latency); wasapi_set_format(&wf, float_fmt_res, rate_res); +#ifdef __cplusplus + hr = client->Initialize(AUDCLNT_SHAREMODE_SHARED, + AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST, + 0, 0, (WAVEFORMATEX*)&wf, NULL); +#else hr = client->lpVtbl->Initialize(client, AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST, 0, 0, (WAVEFORMATEX*)&wf, NULL); +#endif + if (hr == AUDCLNT_E_ALREADY_INITIALIZED) { - client->lpVtbl->Release(client); + WASAPI_RELEASE(client); +#ifdef __cplusplus + hr = device->Activate(IID_IAudioClient, + CLSCTX_ALL, NULL, (void**)&client); +#else hr = device->lpVtbl->Activate(device, &IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&client); +#endif WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL); +#ifdef __cplusplus + hr = client->Initialize(AUDCLNT_SHAREMODE_SHARED, + AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST, + 0, 0, (WAVEFORMATEX*)&wf, NULL); +#else hr = client->lpVtbl->Initialize(client, AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST, 0, 0, (WAVEFORMATEX*)&wf, NULL); +#endif } if (hr != AUDCLNT_E_UNSUPPORTED_FORMAT) { @@ -337,12 +389,22 @@ static IAudioClient *wasapi_init_client_ex(IMMDevice *device, REFERENCE_TIME minimum_period = 0; REFERENCE_TIME buffer_duration = 0; UINT32 buffer_length = 0; +#ifdef __cplusplus + HRESULT hr = device->Activate( + IID_IAudioClient, + CLSCTX_ALL, NULL, (void**)&client); +#else HRESULT hr = device->lpVtbl->Activate( device, &IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&client); +#endif WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL); +#ifdef __cplusplus + hr = client->GetDevicePeriod(NULL, &minimum_period); +#else hr = client->lpVtbl->GetDevicePeriod(client, NULL, &minimum_period); +#endif WASAPI_HR_CHECK(hr, "IAudioClient::GetDevicePeriod", goto error); /* buffer_duration is in 100ns units */ @@ -364,34 +426,66 @@ static IAudioClient *wasapi_init_client_ex(IMMDevice *device, float_fmt_res ? "float" : "pcm", rate_res, latency); wasapi_set_format(&wf, float_fmt_res, rate_res); +#ifdef __cplusplus + hr = client->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE, + AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST, + buffer_duration, buffer_duration, (WAVEFORMATEX*)&wf, NULL); +#else hr = client->lpVtbl->Initialize(client, AUDCLNT_SHAREMODE_EXCLUSIVE, AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST, buffer_duration, buffer_duration, (WAVEFORMATEX*)&wf, NULL); +#endif if (hr == AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED) { +#ifdef __cplusplus + hr = client->GetBufferSize(&buffer_length); +#else hr = client->lpVtbl->GetBufferSize(client, &buffer_length); +#endif WASAPI_HR_CHECK(hr, "IAudioClient::GetBufferSize", goto error); - client->lpVtbl->Release(client); + WASAPI_RELEASE(client); +#ifdef __cplusplus + hr = device->Activate(IID_IAudioClient, + CLSCTX_ALL, NULL, (void**)&client); +#else hr = device->lpVtbl->Activate(device, &IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&client); +#endif WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL); buffer_duration = 10000.0 * 1000.0 / rate_res * buffer_length + 0.5; +#ifdef __cplusplus + hr = client->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE, + AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST, + buffer_duration, buffer_duration, (WAVEFORMATEX*)&wf, NULL); +#else hr = client->lpVtbl->Initialize(client, AUDCLNT_SHAREMODE_EXCLUSIVE, AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST, buffer_duration, buffer_duration, (WAVEFORMATEX*)&wf, NULL); +#endif } if (hr == AUDCLNT_E_ALREADY_INITIALIZED) { - client->lpVtbl->Release(client); + WASAPI_RELEASE(client); +#ifdef __cplusplus + hr = device->Activate(IID_IAudioClient, + CLSCTX_ALL, NULL, (void**)&client); +#else hr = device->lpVtbl->Activate(device, &IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&client); +#endif WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL); +#ifdef __cplusplus + hr = client->Initialize(AUDCLNT_SHAREMODE_EXCLUSIVE, + AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST, + buffer_duration, buffer_duration, (WAVEFORMATEX*)&wf, NULL); +#else hr = client->lpVtbl->Initialize(client, AUDCLNT_SHAREMODE_EXCLUSIVE, AUDCLNT_STREAMFLAGS_EVENTCALLBACK | AUDCLNT_STREAMFLAGS_NOPERSIST, buffer_duration, buffer_duration, (WAVEFORMATEX*)&wf, NULL); +#endif } if (hr != AUDCLNT_E_UNSUPPORTED_FORMAT) { @@ -461,20 +555,41 @@ static IAudioClient *wasapi_init_client(IMMDevice *device, bool *exclusive, /* next calls are allowed to fail (we losing info only) */ if (*exclusive) + { +#ifdef __cplusplus + hr = client->GetDevicePeriod(NULL, &device_period); +#else hr = client->lpVtbl->GetDevicePeriod(client, NULL, &device_period); +#endif + } else + { +#ifdef __cplusplus + hr = client->GetDevicePeriod(&device_period, NULL); +#else hr = client->lpVtbl->GetDevicePeriod(client, &device_period, NULL); +#endif + } + if (FAILED(hr)) wasapi_com_warn("IAudioClient::GetDevicePeriod", hr); if (!*exclusive) { +#ifdef __cplusplus + hr = client->GetStreamLatency(&stream_latency); +#else hr = client->lpVtbl->GetStreamLatency(client, &stream_latency); +#endif if (FAILED(hr)) wasapi_com_warn("IAudioClient::GetStreamLatency", hr); } +#ifdef __cplusplus + hr = client->GetBufferSize(&buffer_length); +#else hr = client->lpVtbl->GetBufferSize(client, &buffer_length); +#endif if (FAILED(hr)) wasapi_com_warn("IAudioClient::GetBufferSize", hr); @@ -528,7 +643,11 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency, if (!w->client) goto error; +#ifdef __cplusplus + hr = w->client->GetBufferSize(&frame_count); +#else hr = w->client->lpVtbl->GetBufferSize(w->client, &frame_count); +#endif WASAPI_HR_CHECK(hr, "IAudioClient::GetBufferSize", goto error); w->frame_size = float_format ? 8 : 4; @@ -545,7 +664,11 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency, { if (sh_buffer_length < 0) { +#ifdef __cplusplus + hr = w->client->GetDevicePeriod(&dev_period, NULL); +#else hr = w->client->lpVtbl->GetDevicePeriod(w->client, &dev_period, NULL); +#endif WASAPI_HR_CHECK(hr, "IAudioClient::GetDevicePeriod", goto error); sh_buffer_length = dev_period * rate / 10000000; @@ -563,21 +686,43 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency, w->write_event = CreateEventA(NULL, FALSE, FALSE, NULL); WASAPI_SR_CHECK(w->write_event, "CreateEventA", goto error); +#ifdef __cplusplus + hr = w->client->SetEventHandle(w->write_event); +#else hr = w->client->lpVtbl->SetEventHandle(w->client, w->write_event); +#endif WASAPI_HR_CHECK(hr, "IAudioClient::SetEventHandle", goto error); +#ifdef __cplusplus + hr = w->client->GetService( + IID_IAudioRenderClient, (void**)&w->renderer); +#else hr = w->client->lpVtbl->GetService(w->client, &IID_IAudioRenderClient, (void**)&w->renderer); +#endif WASAPI_HR_CHECK(hr, "IAudioClient::GetService", goto error); +#ifdef __cplusplus + hr = w->renderer->GetBuffer(frame_count, &dest); +#else hr = w->renderer->lpVtbl->GetBuffer(w->renderer, frame_count, &dest); +#endif WASAPI_HR_CHECK(hr, "IAudioRenderClient::GetBuffer", goto error); +#ifdef __cplusplus + hr = w->renderer->ReleaseBuffer(frame_count, + AUDCLNT_BUFFERFLAGS_SILENT); +#else hr = w->renderer->lpVtbl->ReleaseBuffer(w->renderer, frame_count, AUDCLNT_BUFFERFLAGS_SILENT); +#endif WASAPI_HR_CHECK(hr, "IAudioRenderClient::ReleaseBuffer", goto error); +#ifdef __cplusplus + hr = w->client->Start(); +#else hr = w->client->lpVtbl->Start(w->client); +#endif WASAPI_HR_CHECK(hr, "IAudioClient::Start", goto error); w->running = true; w->blocking = settings->bools.audio_sync; @@ -603,12 +748,20 @@ static bool wasapi_flush(wasapi_t * w, const void * data, size_t size) { BYTE *dest = NULL; UINT32 frame_count = size / w->frame_size; +#ifdef __cplusplus + HRESULT hr = w->renderer->GetBuffer(frame_count, &dest); +#else HRESULT hr = w->renderer->lpVtbl->GetBuffer(w->renderer, frame_count, &dest); +#endif WASAPI_HR_CHECK(hr, "IAudioRenderClient::GetBuffer", return false) memcpy(dest, data, size); +#ifdef __cplusplus + hr = w->renderer->ReleaseBuffer(frame_count, 0); +#else hr = w->renderer->lpVtbl->ReleaseBuffer(w->renderer, frame_count, 0); +#endif WASAPI_HR_CHECK(hr, "IAudioRenderClient::ReleaseBuffer", return false); @@ -619,12 +772,20 @@ static bool wasapi_flush_buffer(wasapi_t * w, size_t size) { BYTE *dest = NULL; UINT32 frame_count = size / w->frame_size; +#ifdef __cplusplus + HRESULT hr = w->renderer->GetBuffer(frame_count, &dest); +#else HRESULT hr = w->renderer->lpVtbl->GetBuffer(w->renderer, frame_count, &dest); +#endif WASAPI_HR_CHECK(hr, "IAudioRenderClient::GetBuffer", return false) fifo_read(w->buffer, dest, size); +#ifdef __cplusplus + hr = w->renderer->ReleaseBuffer(frame_count, 0); +#else hr = w->renderer->lpVtbl->ReleaseBuffer(w->renderer, frame_count, 0); +#endif WASAPI_HR_CHECK(hr, "IAudioRenderClient::ReleaseBuffer", return false); @@ -652,7 +813,11 @@ static ssize_t wasapi_write_sh(wasapi_t *w, const void * data, size_t size) WASAPI_SR_CHECK(ir == WAIT_OBJECT_0, "WaitForSingleObject", return -1); } +#ifdef __cplusplus + hr = w->client->GetCurrentPadding(&padding); +#else hr = w->client->lpVtbl->GetCurrentPadding(w->client, &padding); +#endif WASAPI_HR_CHECK(hr, "IAudioClient::GetCurrentPadding", return -1); read_avail = fifo_read_avail(w->buffer); @@ -679,7 +844,11 @@ static ssize_t wasapi_write_sh(wasapi_t *w, const void * data, size_t size) WASAPI_SR_CHECK(ir == WAIT_OBJECT_0, "WaitForSingleObject", return -1); } +#ifdef __cplusplus + hr = w->client->GetCurrentPadding(&padding); +#else hr = w->client->lpVtbl->GetCurrentPadding(w->client, &padding); +#endif WASAPI_HR_CHECK(hr, "IAudioClient::GetCurrentPadding", return -1); write_avail = w->engine_buffer_size - padding * w->frame_size; @@ -701,11 +870,10 @@ static ssize_t wasapi_write_sh(wasapi_t *w, const void * data, size_t size) static ssize_t wasapi_write_ex(wasapi_t *w, const void * data, size_t size) { DWORD ir; - size_t write_avail; - bool br = false; - ssize_t writen = 0; + bool br = false; + ssize_t writen = 0; + size_t write_avail = fifo_write_avail(w->buffer); - write_avail = fifo_write_avail(w->buffer); if (!write_avail) { ir = WaitForSingleObject(w->write_event, w->blocking ? INFINITE : 0); @@ -759,7 +927,11 @@ static ssize_t wasapi_write(void *wh, const void *data, size_t size) static bool wasapi_stop(void *wh) { wasapi_t *w = (wasapi_t*)wh; +#ifdef __cplusplus + HRESULT hr = w->client->Stop(); +#else HRESULT hr = w->client->lpVtbl->Stop(w->client); +#endif WASAPI_HR_CHECK(hr, "IAudioClient::Stop", return !w->running); w->running = false; @@ -770,7 +942,11 @@ static bool wasapi_stop(void *wh) static bool wasapi_start(void *wh, bool u) { wasapi_t *w = (wasapi_t*)wh; +#ifdef __cplusplus + HRESULT hr = w->client->Start(); +#else HRESULT hr = w->client->lpVtbl->Start(w->client); +#endif if (hr == AUDCLNT_E_NOT_STOPPED) return true; @@ -800,13 +976,19 @@ static void wasapi_set_nonblock_state(void *wh, bool nonblock) static void wasapi_free(void *wh) { + DWORD ir; wasapi_t *w = (wasapi_t*)wh; HANDLE write_event = w->write_event; - DWORD ir; WASAPI_RELEASE(w->renderer); if (w->client) + { +#ifdef __cplusplus + w->client->Stop(); +#else w->client->lpVtbl->Stop(w->client); +#endif + } WASAPI_RELEASE(w->client); WASAPI_RELEASE(w->device); CoUninitialize(); @@ -855,23 +1037,45 @@ static void *wasapi_device_list_new(void *u) WASAPI_CHECK(sl, "string_list_new failed", return NULL); attr.i = 0; +#ifdef __cplusplus + hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, + IID_IMMDeviceEnumerator, (void **)&enumerator); +#else hr = CoCreateInstance(&CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, &IID_IMMDeviceEnumerator, (void **)&enumerator); +#endif WASAPI_HR_CHECK(hr, "CoCreateInstance", goto error); +#ifdef __cplusplus + hr = enumerator->EnumAudioEndpoints( + eRender, DEVICE_STATE_ACTIVE, &collection); +#else hr = enumerator->lpVtbl->EnumAudioEndpoints(enumerator, eRender, DEVICE_STATE_ACTIVE, &collection); +#endif WASAPI_HR_CHECK(hr, "IMMDeviceEnumerator::EnumAudioEndpoints", goto error); +#ifdef __cplusplus + hr = collection->GetCount(&dev_count); +#else hr = collection->lpVtbl->GetCount(collection, &dev_count); +#endif WASAPI_HR_CHECK(hr, "IMMDeviceCollection::GetCount", goto error); for (i = 0; i < dev_count; ++i) { +#ifdef __cplusplus + hr = collection->Item(i, &device); +#else hr = collection->lpVtbl->Item(collection, i, &device); +#endif WASAPI_HR_CHECK(hr, "IMMDeviceCollection::Item", goto error); +#ifdef __cplusplus + hr = device->GetId(&dev_id_wstr); +#else hr = device->lpVtbl->GetId(device, &dev_id_wstr); +#endif WASAPI_HR_CHECK(hr, "IMMDevice::GetId", goto error); ir = WideCharToMultiByte(CP_ACP, 0, dev_id_wstr, -1, @@ -885,13 +1089,22 @@ static void *wasapi_device_list_new(void *u) dev_id_str, ir, NULL, NULL); WASAPI_SR_CHECK(ir, "WideCharToMultiByte", goto error); +#ifdef __cplusplus + hr = device->OpenPropertyStore(STGM_READ, &prop_store); +#else hr = device->lpVtbl->OpenPropertyStore(device, STGM_READ, &prop_store); +#endif WASAPI_HR_CHECK(hr, "IMMDevice::OpenPropertyStore", goto error); PropVariantInit(&prop_var); prop_var_init = true; +#ifdef __cplusplus + hr = prop_store->GetValue( + PKEY_Device_FriendlyName, &prop_var); +#else hr = prop_store->lpVtbl->GetValue(prop_store, &PKEY_Device_FriendlyName, &prop_var); +#endif WASAPI_HR_CHECK(hr, "IPropertyStore::GetValue", goto error); ir = WideCharToMultiByte(CP_ACP, 0, prop_var.pwszVal, -1, @@ -960,7 +1173,11 @@ static size_t wasapi_write_avail(void *wh) if (w->buffer) return fifo_write_avail(w->buffer); +#ifdef __cplusplus + hr = w->client->GetCurrentPadding(&padding); +#else hr = w->client->lpVtbl->GetCurrentPadding(w->client, &padding); +#endif WASAPI_HR_CHECK(hr, "IAudioClient::GetCurrentPadding", return 0); return w->engine_buffer_size - padding * w->frame_size; From 7d12eb4a511603e5b1ce3f644b9460dd1c29d436 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 18:47:33 +0200 Subject: [PATCH 076/253] (WASAPI) Compiles now as C++ as well as C --- audio/drivers/wasapi.c | 13 +++++++++++-- menu/menu_animation.c | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/audio/drivers/wasapi.c b/audio/drivers/wasapi.c index 97c0f67ded..328cd282ed 100644 --- a/audio/drivers/wasapi.c +++ b/audio/drivers/wasapi.c @@ -64,12 +64,21 @@ DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0 wasapi_sys_err(fun_str);\ err_exp; } -#define WASAPI_RELEASE(iface)\ +#ifdef __cplusplus +#define WASAPI_RELEASE(iface) \ + if(iface) \ + { \ + iface->Release();\ + iface = NULL; \ + } +#else +#define WASAPI_RELEASE(iface) \ if(iface) \ { \ iface->lpVtbl->Release(iface);\ iface = NULL; \ - } \ + } +#endif #define WASAPI_FREE(ptr)\ if(ptr) {\ diff --git a/menu/menu_animation.c b/menu/menu_animation.c index ce6cfa17dc..63da135b05 100644 --- a/menu/menu_animation.c +++ b/menu/menu_animation.c @@ -19,6 +19,7 @@ #include #include +#include #include #include From 9eba2c8e3932cc9d545e687453d0617f4711a75f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 18:53:09 +0200 Subject: [PATCH 077/253] Fix CXX_BUILD on Windows --- gfx/drivers/gl.c | 1 + gfx/drivers/vulkan.c | 1 + input/drivers/winraw_input.c | 76 ++++++++++++------------------------ 3 files changed, 26 insertions(+), 52 deletions(-) diff --git a/gfx/drivers/gl.c b/gfx/drivers/gl.c index ac3fffcaa3..2ccf23b458 100644 --- a/gfx/drivers/gl.c +++ b/gfx/drivers/gl.c @@ -34,6 +34,7 @@ #include #include #include +#include #include #include diff --git a/gfx/drivers/vulkan.c b/gfx/drivers/vulkan.c index 01e4196e86..b954d34cbe 100644 --- a/gfx/drivers/vulkan.c +++ b/gfx/drivers/vulkan.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include diff --git a/input/drivers/winraw_input.c b/input/drivers/winraw_input.c index a6a85a5160..e30709d15f 100644 --- a/input/drivers/winraw_input.c +++ b/input/drivers/winraw_input.c @@ -22,14 +22,6 @@ #include "../../gfx/video_driver.h" #include "../../verbosity.h" -#define WINRAW_LOG(msg) RARCH_LOG("[WINRAW]: "msg"\n") -#define WINRAW_ERR(err) RARCH_ERR("[WINRAW]: "err"\n") - -#define WINRAW_SYS_WRN(fun)\ - RARCH_WARN("[WINRAW]: "fun" failed with error %lu.\n", GetLastError()) -#define WINRAW_SYS_ERR(fun)\ - RARCH_ERR("[WINRAW]: "fun" failed with error %lu.\n", GetLastError()) - typedef struct { uint8_t keys[256]; @@ -69,7 +61,7 @@ static HWND winraw_create_window(WNDPROC wnd_proc) if (!wc.hInstance) { - WINRAW_SYS_ERR("GetModuleHandleA"); + RARCH_ERR("[WINRAW]: GetModuleHandleA failed with error %lu.\n", GetLastError()); return NULL; } @@ -77,7 +69,7 @@ static HWND winraw_create_window(WNDPROC wnd_proc) wc.lpszClassName = "winraw-input"; if (!RegisterClassA(&wc) && GetLastError() != ERROR_CLASS_ALREADY_EXISTS) { - WINRAW_SYS_ERR("RegisterClassA"); + RARCH_ERR("[WINRAW]: RegisterClassA failed with error %lu.\n", GetLastError()); return NULL; } @@ -85,7 +77,7 @@ static HWND winraw_create_window(WNDPROC wnd_proc) HWND_MESSAGE, NULL, NULL, NULL); if (!wnd) { - WINRAW_SYS_ERR("CreateWindowExA"); + RARCH_ERR("[WINRAW]: CreateWindowExA failed with error %lu.\n", GetLastError()); goto error; } @@ -106,12 +98,16 @@ static void winraw_destroy_window(HWND wnd) r = DestroyWindow(wnd); if (!r) - WINRAW_SYS_WRN("DestroyWindow"); + { + RARCH_WARN("[WINRAW]: DestroyWindow failed with error %lu.\n", GetLastError()); + } r = UnregisterClassA("winraw-input", NULL); if (!r) - WINRAW_SYS_WRN("UnregisterClassA"); + { + RARCH_WARN("[WINRAW]: UnregisterClassA failed with error %lu.\n", GetLastError()); + } } static bool winraw_set_keyboard_input(HWND window) @@ -128,7 +124,7 @@ static bool winraw_set_keyboard_input(HWND window) if (!r) { - WINRAW_SYS_ERR("RegisterRawInputDevices"); + RARCH_ERR("[WINRAW]: RegisterRawInputDevices failed with error %lu.\n", GetLastError()); return false; } @@ -163,21 +159,18 @@ static bool winraw_init_devices(winraw_mouse_t **mice, unsigned *mouse_cnt) r = GetRawInputDeviceList(NULL, &dev_cnt, sizeof(RAWINPUTDEVICELIST)); if (r == (UINT)-1) { - WINRAW_SYS_ERR("GetRawInputDeviceList"); + RARCH_ERR("[WINRAW]: GetRawInputDeviceList failed with error %lu.\n", GetLastError()); goto error; } devs = (RAWINPUTDEVICELIST*)malloc(dev_cnt * sizeof(RAWINPUTDEVICELIST)); if (!devs) - { - WINRAW_ERR("malloc failed"); goto error; - } dev_cnt = GetRawInputDeviceList(devs, &dev_cnt, sizeof(RAWINPUTDEVICELIST)); if (dev_cnt == (UINT)-1) { - WINRAW_SYS_ERR("GetRawInputDeviceList"); + RARCH_ERR("[WINRAW]: GetRawInputDeviceList failed with error %lu.\n", GetLastError()); goto error; } @@ -191,10 +184,7 @@ static bool winraw_init_devices(winraw_mouse_t **mice, unsigned *mouse_cnt) goto error; if (!GetCursorPos(&crs_pos)) - { - WINRAW_SYS_WRN("GetCursorPos"); goto error; - } for (i = 0; i < mouse_cnt_r; ++i) { @@ -243,7 +233,7 @@ static bool winraw_set_mouse_input(HWND window, bool grab) if (!r) { - WINRAW_SYS_ERR("RegisterRawInputDevices"); + RARCH_ERR("[WINRAW]: RegisterRawInputDevice failed with error %lu.\n", GetLastError()); return false; } @@ -356,9 +346,13 @@ static void winraw_update_mouse_state(winraw_mouse_t *mouse, RAWMOUSE *state) InterlockedExchangeAdd(&mouse->dlt_y, state->lLastY); if (!GetCursorPos(&crs_pos)) - WINRAW_SYS_WRN("GetCursorPos"); + { + RARCH_WARN("[WINRAW]: GetCursorPos failed with error %lu.\n", GetLastError()); + } else if (!ScreenToClient((HWND)video_driver_window_get(), &crs_pos)) - WINRAW_SYS_WRN("ScreenToClient"); + { + RARCH_WARN("[WINRAW]: ScreenToClient failed with error %lu.\n", GetLastError()); + } else { mouse->x = crs_pos.x; @@ -407,7 +401,7 @@ static LRESULT CALLBACK winraw_callback(HWND wnd, UINT msg, WPARAM wpar, LPARAM r = GetRawInputData((HRAWINPUT)lpar, RID_INPUT, data, &size, sizeof(RAWINPUTHEADER)); if (r == (UINT)-1) { - WINRAW_SYS_WRN("GetRawInputData"); + RARCH_WARN("[WINRAW]: GetRawInputData failed with error %lu.\n", GetLastError()); goto end; } @@ -444,55 +438,41 @@ static void *winraw_init(const char *joypad_driver) if (!wr || !g_keyboard) goto error; - WINRAW_LOG("Initializing input driver ..."); + RARCH_LOG("[WINRAW]: Initializing input driver... \n"); input_keymaps_init_keyboard_lut(rarch_key_map_winraw); wr->window = winraw_create_window(winraw_callback); if (!wr->window) - { - WINRAW_ERR("winraw_create_window failed."); goto error; - } r = winraw_init_devices(&g_mice, &g_mouse_cnt); if (!r) - { - WINRAW_ERR("winraw_init_devices failed."); goto error; - } if (!g_mouse_cnt) - WINRAW_LOG("Mouse unavailable."); + { + RARCH_LOG("[WINRAW]: Mouse unavailable.\n"); + } else { wr->mice = (winraw_mouse_t*)malloc(g_mouse_cnt * sizeof(winraw_mouse_t)); if (!wr->mice) - { - WINRAW_ERR("malloc failed."); goto error; - } memcpy(wr->mice, g_mice, g_mouse_cnt * sizeof(winraw_mouse_t)); } r = winraw_set_keyboard_input(wr->window); if (!r) - { - WINRAW_ERR("winraw_set_keyboard_input failed."); goto error; - } r = winraw_set_mouse_input(wr->window, false); if (!r) - { - WINRAW_ERR("winraw_set_mouse_input failed."); goto error; - } wr->joypad = input_joypad_init_driver(joypad_driver, wr); - WINRAW_LOG("Input driver initialized."); return wr; error: @@ -507,7 +487,6 @@ error: if (wr) free(wr->mice); free(wr); - WINRAW_ERR("Input driver initialization failed."); return NULL; } @@ -583,8 +562,6 @@ static void winraw_free(void *d) { winraw_input_t *wr = (winraw_input_t*)d; - WINRAW_LOG("Deinitializing input driver ..."); - if (wr->joypad) wr->joypad->destroy(); winraw_set_mouse_input(NULL, false); @@ -596,8 +573,6 @@ static void winraw_free(void *d) free(wr); g_mouse_xy_mapping_ready = false; - - WINRAW_LOG("Input driver deinitialized."); } static uint64_t winraw_get_capabilities(void *u) @@ -618,10 +593,7 @@ static void winraw_grab_mouse(void *d, bool grab) r = winraw_set_mouse_input(wr->window, grab); if (!r) - { - WINRAW_ERR("Mouse grab failed."); return; - } wr->mouse_grab = grab; } From ff48af4d06102d7e07fa4e5797783690f6264bf9 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 18:57:00 +0200 Subject: [PATCH 078/253] Update --- input/drivers/winraw_input.c | 41 +++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 17 deletions(-) diff --git a/input/drivers/winraw_input.c b/input/drivers/winraw_input.c index e30709d15f..6ea23df806 100644 --- a/input/drivers/winraw_input.c +++ b/input/drivers/winraw_input.c @@ -37,12 +37,12 @@ typedef struct typedef struct { - winraw_keyboard_t keyboard; - winraw_mouse_t *mice; - const input_device_driver_t *joypad; - HWND window; bool kbd_mapp_block; bool mouse_grab; + winraw_keyboard_t keyboard; + HWND window; + winraw_mouse_t *mice; + const input_device_driver_t *joypad; } winraw_input_t; static winraw_keyboard_t *g_keyboard = NULL; @@ -133,10 +133,10 @@ static bool winraw_set_keyboard_input(HWND window) static void winraw_log_mice_info(winraw_mouse_t *mice, unsigned mouse_cnt) { - char name[256]; - UINT name_size = sizeof(name); UINT r; unsigned i; + char name[256]; + UINT name_size = sizeof(name); for (i = 0; i < mouse_cnt; ++i) { @@ -149,14 +149,15 @@ static void winraw_log_mice_info(winraw_mouse_t *mice, unsigned mouse_cnt) static bool winraw_init_devices(winraw_mouse_t **mice, unsigned *mouse_cnt) { - UINT r, i; + UINT i; POINT crs_pos; winraw_mouse_t *mice_r = NULL; unsigned mouse_cnt_r = 0; RAWINPUTDEVICELIST *devs = NULL; UINT dev_cnt = 0; + UINT r = GetRawInputDeviceList( + NULL, &dev_cnt, sizeof(RAWINPUTDEVICELIST)); - r = GetRawInputDeviceList(NULL, &dev_cnt, sizeof(RAWINPUTDEVICELIST)); if (r == (UINT)-1) { RARCH_ERR("[WINRAW]: GetRawInputDeviceList failed with error %lu.\n", GetLastError()); @@ -395,13 +396,16 @@ static LRESULT CALLBACK winraw_callback(HWND wnd, UINT msg, WPARAM wpar, LPARAM if (msg != WM_INPUT) return DefWindowProcA(wnd, msg, wpar, lpar); - if (GET_RAWINPUT_CODE_WPARAM(wpar) != RIM_INPUT) /* app is in the background */ + /* app is in the background */ + if (GET_RAWINPUT_CODE_WPARAM(wpar) != RIM_INPUT) goto end; - r = GetRawInputData((HRAWINPUT)lpar, RID_INPUT, data, &size, sizeof(RAWINPUTHEADER)); + r = GetRawInputData((HRAWINPUT)lpar, RID_INPUT, + data, &size, sizeof(RAWINPUTHEADER)); if (r == (UINT)-1) { - RARCH_WARN("[WINRAW]: GetRawInputData failed with error %lu.\n", GetLastError()); + RARCH_WARN("[WINRAW]: GetRawInputData failed with error %lu.\n", + GetLastError()); goto end; } @@ -432,8 +436,10 @@ end: static void *winraw_init(const char *joypad_driver) { bool r; - winraw_input_t *wr = (winraw_input_t *)calloc(1, sizeof(winraw_input_t)); - g_keyboard = (winraw_keyboard_t*)calloc(1, sizeof(winraw_keyboard_t)); + winraw_input_t *wr = (winraw_input_t *) + calloc(1, sizeof(winraw_input_t)); + g_keyboard = (winraw_keyboard_t*) + calloc(1, sizeof(winraw_keyboard_t)); if (!wr || !g_keyboard) goto error; @@ -456,7 +462,8 @@ static void *winraw_init(const char *joypad_driver) } else { - wr->mice = (winraw_mouse_t*)malloc(g_mouse_cnt * sizeof(winraw_mouse_t)); + wr->mice = (winraw_mouse_t*) + malloc(g_mouse_cnt * sizeof(winraw_mouse_t)); if (!wr->mice) goto error; @@ -507,8 +514,8 @@ static void winraw_poll(void *d) for (i = 0; i < g_mouse_cnt; ++i) { - wr->mice[i].x = g_mice[i].x; - wr->mice[i].y = g_mice[i].y; + wr->mice[i].x = g_mice[i].x; + wr->mice[i].y = g_mice[i].y; wr->mice[i].dlt_x = InterlockedExchange(&g_mice[i].dlt_x, 0); wr->mice[i].dlt_y = InterlockedExchange(&g_mice[i].dlt_y, 0); wr->mice[i].whl_u = InterlockedExchange(&g_mice[i].whl_u, 0); @@ -585,8 +592,8 @@ static uint64_t winraw_get_capabilities(void *u) static void winraw_grab_mouse(void *d, bool grab) { + bool r = false; winraw_input_t *wr = (winraw_input_t*)d; - bool r; if (grab == wr->mouse_grab) return; From d9593c7caef36572e19f17027a0ce95edcbbef4e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 19:07:53 +0200 Subject: [PATCH 079/253] (WASAPI) Cleanups --- audio/drivers/wasapi.c | 124 ++++++++++++++++++----------------------- 1 file changed, 53 insertions(+), 71 deletions(-) diff --git a/audio/drivers/wasapi.c b/audio/drivers/wasapi.c index 328cd282ed..679298ef90 100644 --- a/audio/drivers/wasapi.c +++ b/audio/drivers/wasapi.c @@ -39,36 +39,36 @@ DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14); /* DEVPROP_TYPE_STRING */ -#define WASAPI_WARN(bool_exp, err_str, warn_exp)\ - if (!(bool_exp)) {\ - wasapi_warn(err_str);\ +#define WASAPI_WARN(bool_exp, err_str, warn_exp) \ + if (!(bool_exp)) { \ + RARCH_WARN("[WASAPI]: %s.\n", err_str); \ warn_exp; } -#define WASAPI_CHECK(bool_exp, err_str, err_exp)\ - if (!(bool_exp)) {\ - wasapi_err(err_str);\ +#define WASAPI_CHECK(bool_exp, err_str, err_exp) \ + if (!(bool_exp)) { \ + RARCH_ERR("[WASAPI]: %s.\n", err_str); \ err_exp; } -#define WASAPI_HR_CHECK(hr, fun_str, err_exp)\ - if (FAILED(hr)) {\ - wasapi_com_err(fun_str, hr);\ +#define WASAPI_HR_CHECK(hr, fun_str, err_exp) \ + if (FAILED(hr)) { \ + RARCH_ERR("[WASAPI]: %s failed with error 0x%.8X.\n", fun_str, hr); \ err_exp; } -#define WASAPI_HR_WARN(hr, fun_str, warn_exp)\ - if (FAILED(hr)) {\ - wasapi_com_warn(fun_str, hr);\ +#define WASAPI_HR_WARN(hr, fun_str, warn_exp) \ + if (FAILED(hr)) { \ + RARCH_WARN("[WASAPI]: %s failed with error 0x%.8X.\n", fun_str, hr); \ warn_exp; } -#define WASAPI_SR_CHECK(bool_exp, fun_str, err_exp)\ - if (!(bool_exp)) {\ - wasapi_sys_err(fun_str);\ +#define WASAPI_SR_CHECK(bool_exp, fun_str, err_exp) \ + if (!(bool_exp)) { \ + RARCH_ERR("[WASAPI]: %s failed with error %d.\n", fun_str, GetLastError()); \ err_exp; } #ifdef __cplusplus #define WASAPI_RELEASE(iface) \ if(iface) \ { \ - iface->Release();\ + iface->Release(); \ iface = NULL; \ } #else @@ -92,48 +92,18 @@ DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0 typedef struct { - IMMDevice *device; - IAudioClient *client; - IAudioRenderClient *renderer; - HANDLE write_event; - fifo_buffer_t *buffer; /* NULL in unbuffered shared mode */ - size_t frame_size; /* 4 or 8 only */ - size_t engine_buffer_size; bool exclusive; bool blocking; bool running; + size_t frame_size; /* 4 or 8 only */ + size_t engine_buffer_size; + HANDLE write_event; + IMMDevice *device; + IAudioClient *client; + IAudioRenderClient *renderer; + fifo_buffer_t *buffer; /* NULL in unbuffered shared mode */ } wasapi_t; -static void wasapi_log(const char *msg) -{ - RARCH_LOG("[WASAPI]: %s.\n", msg); -} - -static void wasapi_warn(const char *warn) -{ - RARCH_WARN("[WASAPI]: %s.\n", warn); -} - -static void wasapi_err(const char *err) -{ - RARCH_ERR("[WASAPI]: %s.\n", err); -} - -static void wasapi_com_warn(const char *fun, HRESULT hr) -{ - RARCH_WARN("[WASAPI]: %s failed with error 0x%.8X.\n", fun, hr); -} - -static void wasapi_com_err(const char *fun, HRESULT hr) -{ - RARCH_ERR("[WASAPI]: %s failed with error 0x%.8X.\n", fun, hr); -} - -static void wasapi_sys_err(const char *fun) -{ - RARCH_ERR("[WASAPI]: %s failed with error %d.\n", fun, GetLastError()); -} - static bool wasapi_check_device_id(IMMDevice *device, const char *id) { HRESULT hr; @@ -179,9 +149,13 @@ static IMMDevice *wasapi_init_device(const char *id) IMMDeviceCollection *collection = NULL; if (id) + { RARCH_LOG("[WASAPI]: Initializing device %s ...\n", id); + } else - wasapi_log("Initializing default device .."); + { + RARCH_LOG("[WASAPI]: Initializing default device.. \n"); + } #ifdef __cplusplus hr = CoCreateInstance(CLSID_MMDeviceEnumerator, NULL, CLSCTX_ALL, @@ -245,8 +219,6 @@ static IMMDevice *wasapi_init_device(const char *id) WASAPI_RELEASE(collection); WASAPI_RELEASE(enumerator); - wasapi_log("Device initialized"); - return device; error: @@ -254,9 +226,13 @@ error: WASAPI_RELEASE(enumerator); if (id) - wasapi_warn("Failed to initialize device"); + { + RARCH_WARN("[WASAPI]: Failed to initialize device.\n"); + } else - wasapi_err("Failed to initialize device"); + { + RARCH_ERR("[WASAPI]: Failed to initialize device.\n"); + } return NULL; } @@ -367,7 +343,7 @@ static IAudioClient *wasapi_init_client_sh(IMMDevice *device, break; } - wasapi_warn("Unsupported format"); + RARCH_WARN("[WASAPI]: Unsupported format.\n"); rate_res = wasapi_pref_rate(j); if (rate_res == *rate) /* requested rate is allready tested */ rate_res = wasapi_pref_rate(++j); /* skip it */ @@ -508,7 +484,7 @@ static IAudioClient *wasapi_init_client_ex(IMMDevice *device, break; } - wasapi_warn("Unsupported format"); + RARCH_WARN("[WASAPI]: Unsupported format.\n"); rate_res = wasapi_pref_rate(j); if (rate_res == *rate) /* requested rate is allready tested */ rate_res = wasapi_pref_rate(++j); /* skip it */ @@ -581,7 +557,9 @@ static IAudioClient *wasapi_init_client(IMMDevice *device, bool *exclusive, } if (FAILED(hr)) - wasapi_com_warn("IAudioClient::GetDevicePeriod", hr); + { + RARCH_WARN("[WASAPI]: IAudioClient::GetDevicePeriod failed with error 0x%.8X.\n", hr); + } if (!*exclusive) { @@ -591,7 +569,9 @@ static IAudioClient *wasapi_init_client(IMMDevice *device, bool *exclusive, hr = client->lpVtbl->GetStreamLatency(client, &stream_latency); #endif if (FAILED(hr)) - wasapi_com_warn("IAudioClient::GetStreamLatency", hr); + { + RARCH_WARN("[WASAPI]: IAudioClient::GetStreamLatency failed with error 0x%.8X.\n", hr); + } } #ifdef __cplusplus @@ -600,7 +580,9 @@ static IAudioClient *wasapi_init_client(IMMDevice *device, bool *exclusive, hr = client->lpVtbl->GetBufferSize(client, &buffer_length); #endif if (FAILED(hr)) - wasapi_com_warn("IAudioClient::GetBufferSize", hr); + { + RARCH_WARN("[WASAPI]: IAudioClient::GetBufferSize failed with error 0x%.8X.\n", hr); + } if (*exclusive) latency_res = (double)buffer_length * 1000.0 / (*rate); @@ -690,7 +672,9 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency, sh_buffer_length, (double)sh_buffer_length * 1000.0 / rate); } else - wasapi_log("Intermediate buffer is off"); + { + RARCH_LOG("[WASAPI]: Intermediate buffer is off. \n"); + } w->write_event = CreateEventA(NULL, FALSE, FALSE, NULL); WASAPI_SR_CHECK(w->write_event, "CreateEventA", goto error); @@ -888,7 +872,7 @@ static ssize_t wasapi_write_ex(wasapi_t *w, const void * data, size_t size) ir = WaitForSingleObject(w->write_event, w->blocking ? INFINITE : 0); if (ir != WAIT_OBJECT_0 && w->blocking) { - wasapi_sys_err("WaitForSingleObject"); + RARCH_ERR("[WASAPI]: WaitForSingleObject failed with error %d.\n", GetLastError()); return -1; } if (ir != WAIT_OBJECT_0) @@ -1007,7 +991,9 @@ static void wasapi_free(void *wh) ir = WaitForSingleObject(write_event, 20); if (ir == WAIT_FAILED) - wasapi_sys_err("WaitForSingleObject"); + { + RARCH_ERR("[WASAPI]: WaitForSingleObject failed with error %d.\n", GetLastError()); + } /* If event isn't signaled log and leak */ WASAPI_CHECK(ir == WAIT_OBJECT_0, "Memory leak in wasapi_free", return); @@ -1041,8 +1027,6 @@ static void *wasapi_device_list_new(void *u) char *dev_name_str = NULL; struct string_list *sl = string_list_new(); - wasapi_log("Enumerating active devices .."); - WASAPI_CHECK(sl, "string_list_new failed", return NULL); attr.i = 0; @@ -1144,8 +1128,6 @@ static void *wasapi_device_list_new(void *u) WASAPI_RELEASE(collection); WASAPI_RELEASE(enumerator); - wasapi_log("Devices enumerated"); - return sl; error: @@ -1161,7 +1143,7 @@ error: if (sl) string_list_free(sl); - wasapi_err("Device enumeration failed"); + RARCH_ERR("[WASAPI]: Device enumeration failed.\n"); return NULL; } From be333837e9eb70f6b69291765ede869f9aa1256f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 21:45:11 +0200 Subject: [PATCH 080/253] Cleanup wasapi.c --- audio/drivers/wasapi.c | 326 +++++++++++++---------------------------- 1 file changed, 102 insertions(+), 224 deletions(-) diff --git a/audio/drivers/wasapi.c b/audio/drivers/wasapi.c index 679298ef90..714e8fb1c3 100644 --- a/audio/drivers/wasapi.c +++ b/audio/drivers/wasapi.c @@ -38,6 +38,51 @@ DEFINE_PROPERTYKEY(PKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14); /* DEVPROP_TYPE_STRING */ +#ifdef __cplusplus +#define _IMMDeviceCollection_Item(This,nDevice,ppdevice) (This)->Item(nDevice,ppdevice) +#define _IAudioClient_Start(This) ( (This)->Start() ) +#define _IAudioClient_Stop(This) ( (This)->Stop() ) +#define _IAudioClient_GetCurrentPadding(This,pNumPaddingFrames) \ + ( (This)->GetCurrentPadding(pNumPaddingFrames) ) +#define _IAudioRenderClient_GetBuffer(This,NumFramesRequested,ppData) \ + ( (This)->GetBuffer(NumFramesRequested,ppData) ) +#define _IAudioRenderClient_ReleaseBuffer(This,NumFramesWritten,dwFlags) \ + ( (This)->ReleaseBuffer(NumFramesWritten,dwFlags) ) +#define _IAudioClient_GetService(This,riid,ppv) ( (This)->GetService(riid,ppv) ) +#define _IAudioClient_SetEventHandle(This,eventHandle) ( (This)->SetEventHandle(eventHandle) ) +#define _IAudioClient_GetBufferSize(This,pNumBufferFrames) ( (This)->GetBufferSize(pNumBufferFrames) ) +#define _IAudioClient_GetStreamLatency(This,phnsLatency) ( (This)->GetStreamLatency(phnsLatency) ) +#define _IAudioClient_GetDevicePeriod(This,phnsDefaultDevicePeriod,phnsMinimumDevicePeriod) ( (This)->GetDevicePeriod(phnsDefaultDevicePeriod,phnsMinimumDevicePeriod) ) +#define _IMMDevice_Activate(This,iid,dwClsCtx,pActivationParams,ppv) ((This)->Activate(iid,(dwClsCtx),pActivationParams,ppv)) +#define _IMMDeviceEnumerator_EnumAudioEndpoints(This,dataFlow,dwStateMask,ppDevices) (This)->EnumAudioEndpoints(dataFlow,dwStateMask,ppDevices) +#define _IMMDeviceEnumerator_GetDefaultAudioEndpoint(This,dataFlow,role,ppEndpoint) (This)->GetDefaultAudioEndpoint(dataFlow,role,ppEndpoint) +#define _IMMDevice_OpenPropertyStore(This,stgmAccess,ppProperties) (This)->OpenPropertyStore(stgmAccess,ppProperties) +#define _IMMDevice_GetId(This,ppstrId) ((This)->GetId(ppstrId)) +#define _IPropertyStore_GetValue(This,key,pv) ( (This)->GetValue(key,pv) ) +#define _IMMDeviceCollection_GetCount(This,cProps) ( (This)->GetCount(cProps) ) +#else +#define _IMMDeviceCollection_Item(This,nDevice,ppdevice) (This)->lpVtbl->Item(This,nDevice,ppdevice) +#define _IAudioClient_Start(This) ( (This)->lpVtbl -> Start(This) ) +#define _IAudioClient_Stop(This) ( (This)->lpVtbl -> Stop(This) ) +#define _IAudioClient_GetCurrentPadding(This,pNumPaddingFrames) \ + ( (This)->lpVtbl -> GetCurrentPadding(This,pNumPaddingFrames) ) +#define _IAudioRenderClient_GetBuffer(This,NumFramesRequested,ppData) \ + ( (This)->lpVtbl -> GetBuffer(This,NumFramesRequested,ppData) ) +#define _IAudioRenderClient_ReleaseBuffer(This,NumFramesWritten,dwFlags) \ + ( (This)->lpVtbl -> ReleaseBuffer(This,NumFramesWritten,dwFlags) ) +#define _IAudioClient_GetService(This,riid,ppv) ( (This)->lpVtbl -> GetService(This,&(riid),ppv) ) +#define _IAudioClient_SetEventHandle(This,eventHandle) ( (This)->lpVtbl -> SetEventHandle(This,eventHandle) ) +#define _IAudioClient_GetBufferSize(This,pNumBufferFrames) ( (This)->lpVtbl -> GetBufferSize(This,pNumBufferFrames) ) +#define _IAudioClient_GetStreamLatency(This,phnsLatency) ( (This)->lpVtbl -> GetStreamLatency(This,phnsLatency) ) +#define _IAudioClient_GetDevicePeriod(This,phnsDefaultDevicePeriod,phnsMinimumDevicePeriod) ( (This)->lpVtbl -> GetDevicePeriod(This,phnsDefaultDevicePeriod,phnsMinimumDevicePeriod) ) +#define _IMMDevice_Activate(This,iid,dwClsCtx,pActivationParams,ppv) ((This)->lpVtbl->Activate(This,&(iid),dwClsCtx,pActivationParams,ppv)) +#define _IMMDeviceEnumerator_EnumAudioEndpoints(This,dataFlow,dwStateMask,ppDevices) (This)->lpVtbl->EnumAudioEndpoints(This,dataFlow,dwStateMask,ppDevices) +#define _IMMDeviceEnumerator_GetDefaultAudioEndpoint(This,dataFlow,role,ppEndpoint) (This)->lpVtbl->GetDefaultAudioEndpoint(This,dataFlow,role,ppEndpoint) +#define _IMMDevice_OpenPropertyStore(This,stgmAccess,ppProperties) (This)->lpVtbl->OpenPropertyStore(This,stgmAccess,ppProperties) +#define _IMMDevice_GetId(This,ppstrId) (This)->lpVtbl->GetId(This,ppstrId) +#define _IPropertyStore_GetValue(This,key,pv) ( (This)->lpVtbl -> GetValue(This,&(key),pv) ) +#define _IMMDeviceCollection_GetCount(This,cProps) ( (This)->lpVtbl -> GetCount(This,cProps) ) +#endif #define WASAPI_WARN(bool_exp, err_str, warn_exp) \ if (!(bool_exp)) { \ @@ -119,11 +164,7 @@ static bool wasapi_check_device_id(IMMDevice *device, const char *id) id_length = MultiByteToWideChar(CP_ACP, 0, id, -1, dev_cmp_id, id_length); WASAPI_SR_CHECK(id_length > 0, "MultiByteToWideChar", goto error); -#ifdef __cplusplus - hr = device->GetId(&dev_id); -#else - hr = device->lpVtbl->GetId(device, &dev_id); -#endif + hr = _IMMDevice_GetId(device, &dev_id); WASAPI_HR_CHECK(hr, "IMMDevice::GetId", goto error); result = lstrcmpW(dev_cmp_id, dev_id) == 0 ? true : false; @@ -168,30 +209,17 @@ static IMMDevice *wasapi_init_device(const char *id) if (id) { -#ifdef __cplusplus - hr = enumerator->EnumAudioEndpoints( - eRender, DEVICE_STATE_ACTIVE, &collection); -#else - hr = enumerator->lpVtbl->EnumAudioEndpoints(enumerator, - eRender, DEVICE_STATE_ACTIVE, &collection); -#endif + hr = _IMMDeviceEnumerator_EnumAudioEndpoints(enumerator, + eRender, DEVICE_STATE_ACTIVE, &collection); WASAPI_HR_CHECK(hr, "IMMDeviceEnumerator::EnumAudioEndpoints", goto error); -#ifdef __cplusplus - hr = collection->GetCount(&dev_count); -#else - hr = collection->lpVtbl->GetCount(collection, &dev_count); -#endif + hr = _IMMDeviceCollection_GetCount(collection, &dev_count); WASAPI_HR_CHECK(hr, "IMMDeviceCollection::GetCount", goto error); for (i = 0; i < dev_count; ++i) { -#ifdef __cplusplus - hr = collection->Item(i, &device); -#else - hr = collection->lpVtbl->Item(collection, i, &device); -#endif + hr = _IMMDeviceCollection_Item(collection, i, &device); WASAPI_HR_CHECK(hr, "IMMDeviceCollection::Item", continue); if (wasapi_check_device_id(device, id)) @@ -202,13 +230,8 @@ static IMMDevice *wasapi_init_device(const char *id) } else { -#ifdef __cplusplus - hr = enumerator->GetDefaultAudioEndpoint( - eRender, eConsole, &device); -#else - hr = enumerator->lpVtbl->GetDefaultAudioEndpoint(enumerator, - eRender, eConsole, &device); -#endif + hr = _IMMDeviceEnumerator_GetDefaultAudioEndpoint( + enumerator, eRender, eConsole, &device); WASAPI_HR_CHECK(hr, "IMMDeviceEnumerator::GetDefaultAudioEndpoint", goto error); } @@ -282,13 +305,9 @@ static IAudioClient *wasapi_init_client_sh(IMMDevice *device, IAudioClient *client = NULL; bool float_fmt_res = *float_fmt; unsigned rate_res = *rate; -#ifdef __cplusplus - HRESULT hr = device->Activate(IID_IAudioClient, + HRESULT hr = _IMMDevice_Activate(device, + IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&client); -#else - HRESULT hr = device->lpVtbl->Activate(device, &IID_IAudioClient, - CLSCTX_ALL, NULL, (void**)&client); -#endif WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL); /* once for float, once for pcm (requested first) */ @@ -318,13 +337,9 @@ static IAudioClient *wasapi_init_client_sh(IMMDevice *device, if (hr == AUDCLNT_E_ALREADY_INITIALIZED) { WASAPI_RELEASE(client); -#ifdef __cplusplus - hr = device->Activate(IID_IAudioClient, - CLSCTX_ALL, NULL, (void**)&client); -#else - hr = device->lpVtbl->Activate(device, &IID_IAudioClient, - CLSCTX_ALL, NULL, (void**)&client); -#endif + HRESULT hr = _IMMDevice_Activate(device, + IID_IAudioClient, + CLSCTX_ALL, NULL, (void**)&client); WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL); #ifdef __cplusplus @@ -374,22 +389,12 @@ static IAudioClient *wasapi_init_client_ex(IMMDevice *device, REFERENCE_TIME minimum_period = 0; REFERENCE_TIME buffer_duration = 0; UINT32 buffer_length = 0; -#ifdef __cplusplus - HRESULT hr = device->Activate( - IID_IAudioClient, + HRESULT hr = _IMMDevice_Activate(device, + IID_IAudioClient, CLSCTX_ALL, NULL, (void**)&client); -#else - HRESULT hr = device->lpVtbl->Activate( - device, &IID_IAudioClient, - CLSCTX_ALL, NULL, (void**)&client); -#endif WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL); -#ifdef __cplusplus - hr = client->GetDevicePeriod(NULL, &minimum_period); -#else - hr = client->lpVtbl->GetDevicePeriod(client, NULL, &minimum_period); -#endif + hr = _IAudioClient_GetDevicePeriod(client, NULL, &minimum_period); WASAPI_HR_CHECK(hr, "IAudioClient::GetDevicePeriod", goto error); /* buffer_duration is in 100ns units */ @@ -422,21 +427,13 @@ static IAudioClient *wasapi_init_client_ex(IMMDevice *device, #endif if (hr == AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED) { -#ifdef __cplusplus - hr = client->GetBufferSize(&buffer_length); -#else - hr = client->lpVtbl->GetBufferSize(client, &buffer_length); -#endif + hr = _IAudioClient_GetBufferSize(client, &buffer_length); WASAPI_HR_CHECK(hr, "IAudioClient::GetBufferSize", goto error); WASAPI_RELEASE(client); -#ifdef __cplusplus - hr = device->Activate(IID_IAudioClient, - CLSCTX_ALL, NULL, (void**)&client); -#else - hr = device->lpVtbl->Activate(device, &IID_IAudioClient, - CLSCTX_ALL, NULL, (void**)&client); -#endif + hr = _IMMDevice_Activate(device, + IID_IAudioClient, + CLSCTX_ALL, NULL, (void**)&client); WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL); buffer_duration = 10000.0 * 1000.0 / rate_res * buffer_length + 0.5; @@ -453,13 +450,9 @@ static IAudioClient *wasapi_init_client_ex(IMMDevice *device, if (hr == AUDCLNT_E_ALREADY_INITIALIZED) { WASAPI_RELEASE(client); -#ifdef __cplusplus - hr = device->Activate(IID_IAudioClient, - CLSCTX_ALL, NULL, (void**)&client); -#else - hr = device->lpVtbl->Activate(device, &IID_IAudioClient, - CLSCTX_ALL, NULL, (void**)&client); -#endif + hr = _IMMDevice_Activate(device, + IID_IAudioClient, + CLSCTX_ALL, NULL, (void**)&client); WASAPI_HR_CHECK(hr, "IMMDevice::Activate", return NULL); #ifdef __cplusplus @@ -540,21 +533,9 @@ static IAudioClient *wasapi_init_client(IMMDevice *device, bool *exclusive, /* next calls are allowed to fail (we losing info only) */ if (*exclusive) - { -#ifdef __cplusplus - hr = client->GetDevicePeriod(NULL, &device_period); -#else - hr = client->lpVtbl->GetDevicePeriod(client, NULL, &device_period); -#endif - } + hr = _IAudioClient_GetDevicePeriod(client, NULL, &device_period); else - { -#ifdef __cplusplus - hr = client->GetDevicePeriod(&device_period, NULL); -#else - hr = client->lpVtbl->GetDevicePeriod(client, &device_period, NULL); -#endif - } + hr = _IAudioClient_GetDevicePeriod(client, &device_period, NULL); if (FAILED(hr)) { @@ -563,22 +544,14 @@ static IAudioClient *wasapi_init_client(IMMDevice *device, bool *exclusive, if (!*exclusive) { -#ifdef __cplusplus - hr = client->GetStreamLatency(&stream_latency); -#else - hr = client->lpVtbl->GetStreamLatency(client, &stream_latency); -#endif + hr = _IAudioClient_GetStreamLatency(client, &stream_latency); if (FAILED(hr)) { RARCH_WARN("[WASAPI]: IAudioClient::GetStreamLatency failed with error 0x%.8X.\n", hr); } } -#ifdef __cplusplus - hr = client->GetBufferSize(&buffer_length); -#else - hr = client->lpVtbl->GetBufferSize(client, &buffer_length); -#endif + hr = _IAudioClient_GetBufferSize(client, &buffer_length); if (FAILED(hr)) { RARCH_WARN("[WASAPI]: IAudioClient::GetBufferSize failed with error 0x%.8X.\n", hr); @@ -634,11 +607,7 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency, if (!w->client) goto error; -#ifdef __cplusplus - hr = w->client->GetBufferSize(&frame_count); -#else - hr = w->client->lpVtbl->GetBufferSize(w->client, &frame_count); -#endif + hr = _IAudioClient_GetBufferSize(w->client, &frame_count); WASAPI_HR_CHECK(hr, "IAudioClient::GetBufferSize", goto error); w->frame_size = float_format ? 8 : 4; @@ -655,11 +624,7 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency, { if (sh_buffer_length < 0) { -#ifdef __cplusplus - hr = w->client->GetDevicePeriod(&dev_period, NULL); -#else - hr = w->client->lpVtbl->GetDevicePeriod(w->client, &dev_period, NULL); -#endif + hr = _IAudioClient_GetDevicePeriod(w->client, &dev_period, NULL); WASAPI_HR_CHECK(hr, "IAudioClient::GetDevicePeriod", goto error); sh_buffer_length = dev_period * rate / 10000000; @@ -679,43 +644,22 @@ static void *wasapi_init(const char *dev_id, unsigned rate, unsigned latency, w->write_event = CreateEventA(NULL, FALSE, FALSE, NULL); WASAPI_SR_CHECK(w->write_event, "CreateEventA", goto error); -#ifdef __cplusplus - hr = w->client->SetEventHandle(w->write_event); -#else - hr = w->client->lpVtbl->SetEventHandle(w->client, w->write_event); -#endif + hr = _IAudioClient_SetEventHandle(w->client, w->write_event); WASAPI_HR_CHECK(hr, "IAudioClient::SetEventHandle", goto error); -#ifdef __cplusplus - hr = w->client->GetService( + hr = _IAudioClient_GetService(w->client, IID_IAudioRenderClient, (void**)&w->renderer); -#else - hr = w->client->lpVtbl->GetService(w->client, - &IID_IAudioRenderClient, (void**)&w->renderer); -#endif WASAPI_HR_CHECK(hr, "IAudioClient::GetService", goto error); -#ifdef __cplusplus - hr = w->renderer->GetBuffer(frame_count, &dest); -#else - hr = w->renderer->lpVtbl->GetBuffer(w->renderer, frame_count, &dest); -#endif + hr = _IAudioRenderClient_GetBuffer(w->renderer, frame_count, &dest); WASAPI_HR_CHECK(hr, "IAudioRenderClient::GetBuffer", goto error); -#ifdef __cplusplus - hr = w->renderer->ReleaseBuffer(frame_count, + hr = _IAudioRenderClient_ReleaseBuffer( + w->renderer, frame_count, AUDCLNT_BUFFERFLAGS_SILENT); -#else - hr = w->renderer->lpVtbl->ReleaseBuffer(w->renderer, frame_count, - AUDCLNT_BUFFERFLAGS_SILENT); -#endif WASAPI_HR_CHECK(hr, "IAudioRenderClient::ReleaseBuffer", goto error); -#ifdef __cplusplus - hr = w->client->Start(); -#else - hr = w->client->lpVtbl->Start(w->client); -#endif + hr = _IAudioClient_Start(w->client); WASAPI_HR_CHECK(hr, "IAudioClient::Start", goto error); w->running = true; w->blocking = settings->bools.audio_sync; @@ -741,21 +685,14 @@ static bool wasapi_flush(wasapi_t * w, const void * data, size_t size) { BYTE *dest = NULL; UINT32 frame_count = size / w->frame_size; -#ifdef __cplusplus - HRESULT hr = w->renderer->GetBuffer(frame_count, &dest); -#else - HRESULT hr = w->renderer->lpVtbl->GetBuffer(w->renderer, frame_count, &dest); -#endif - + HRESULT hr = _IAudioRenderClient_GetBuffer( + w->renderer, frame_count, &dest); WASAPI_HR_CHECK(hr, "IAudioRenderClient::GetBuffer", return false) memcpy(dest, data, size); -#ifdef __cplusplus - hr = w->renderer->ReleaseBuffer(frame_count, 0); -#else - hr = w->renderer->lpVtbl->ReleaseBuffer(w->renderer, frame_count, 0); -#endif - + hr = _IAudioRenderClient_ReleaseBuffer( + w->renderer, frame_count, + 0); WASAPI_HR_CHECK(hr, "IAudioRenderClient::ReleaseBuffer", return false); return true; @@ -765,21 +702,14 @@ static bool wasapi_flush_buffer(wasapi_t * w, size_t size) { BYTE *dest = NULL; UINT32 frame_count = size / w->frame_size; -#ifdef __cplusplus - HRESULT hr = w->renderer->GetBuffer(frame_count, &dest); -#else - HRESULT hr = w->renderer->lpVtbl->GetBuffer(w->renderer, frame_count, &dest); -#endif - + HRESULT hr = _IAudioRenderClient_GetBuffer( + w->renderer, frame_count, &dest); WASAPI_HR_CHECK(hr, "IAudioRenderClient::GetBuffer", return false) fifo_read(w->buffer, dest, size); -#ifdef __cplusplus - hr = w->renderer->ReleaseBuffer(frame_count, 0); -#else - hr = w->renderer->lpVtbl->ReleaseBuffer(w->renderer, frame_count, 0); -#endif - + hr = _IAudioRenderClient_ReleaseBuffer( + w->renderer, frame_count, + 0); WASAPI_HR_CHECK(hr, "IAudioRenderClient::ReleaseBuffer", return false); return true; @@ -806,11 +736,7 @@ static ssize_t wasapi_write_sh(wasapi_t *w, const void * data, size_t size) WASAPI_SR_CHECK(ir == WAIT_OBJECT_0, "WaitForSingleObject", return -1); } -#ifdef __cplusplus - hr = w->client->GetCurrentPadding(&padding); -#else - hr = w->client->lpVtbl->GetCurrentPadding(w->client, &padding); -#endif + hr = _IAudioClient_GetCurrentPadding(w->client, &padding); WASAPI_HR_CHECK(hr, "IAudioClient::GetCurrentPadding", return -1); read_avail = fifo_read_avail(w->buffer); @@ -837,11 +763,7 @@ static ssize_t wasapi_write_sh(wasapi_t *w, const void * data, size_t size) WASAPI_SR_CHECK(ir == WAIT_OBJECT_0, "WaitForSingleObject", return -1); } -#ifdef __cplusplus - hr = w->client->GetCurrentPadding(&padding); -#else - hr = w->client->lpVtbl->GetCurrentPadding(w->client, &padding); -#endif + hr = _IAudioClient_GetCurrentPadding(w->client, &padding); WASAPI_HR_CHECK(hr, "IAudioClient::GetCurrentPadding", return -1); write_avail = w->engine_buffer_size - padding * w->frame_size; @@ -920,11 +842,7 @@ static ssize_t wasapi_write(void *wh, const void *data, size_t size) static bool wasapi_stop(void *wh) { wasapi_t *w = (wasapi_t*)wh; -#ifdef __cplusplus - HRESULT hr = w->client->Stop(); -#else - HRESULT hr = w->client->lpVtbl->Stop(w->client); -#endif + HRESULT hr = _IAudioClient_Stop(w->client); WASAPI_HR_CHECK(hr, "IAudioClient::Stop", return !w->running); w->running = false; @@ -935,11 +853,7 @@ static bool wasapi_stop(void *wh) static bool wasapi_start(void *wh, bool u) { wasapi_t *w = (wasapi_t*)wh; -#ifdef __cplusplus - HRESULT hr = w->client->Start(); -#else - HRESULT hr = w->client->lpVtbl->Start(w->client); -#endif + HRESULT hr = _IAudioClient_Start(w->client); if (hr == AUDCLNT_E_NOT_STOPPED) return true; @@ -975,13 +889,7 @@ static void wasapi_free(void *wh) WASAPI_RELEASE(w->renderer); if (w->client) - { -#ifdef __cplusplus - w->client->Stop(); -#else - w->client->lpVtbl->Stop(w->client); -#endif - } + _IAudioClient_Stop(w->client); WASAPI_RELEASE(w->client); WASAPI_RELEASE(w->device); CoUninitialize(); @@ -1039,36 +947,19 @@ static void *wasapi_device_list_new(void *u) #endif WASAPI_HR_CHECK(hr, "CoCreateInstance", goto error); -#ifdef __cplusplus - hr = enumerator->EnumAudioEndpoints( + hr = _IMMDeviceEnumerator_EnumAudioEndpoints(enumerator, eRender, DEVICE_STATE_ACTIVE, &collection); -#else - hr = enumerator->lpVtbl->EnumAudioEndpoints(enumerator, - eRender, DEVICE_STATE_ACTIVE, &collection); -#endif WASAPI_HR_CHECK(hr, "IMMDeviceEnumerator::EnumAudioEndpoints", goto error); -#ifdef __cplusplus - hr = collection->GetCount(&dev_count); -#else - hr = collection->lpVtbl->GetCount(collection, &dev_count); -#endif + hr = _IMMDeviceCollection_GetCount(collection, &dev_count); WASAPI_HR_CHECK(hr, "IMMDeviceCollection::GetCount", goto error); for (i = 0; i < dev_count; ++i) { -#ifdef __cplusplus - hr = collection->Item(i, &device); -#else - hr = collection->lpVtbl->Item(collection, i, &device); -#endif + hr = _IMMDeviceCollection_Item(collection, i, &device); WASAPI_HR_CHECK(hr, "IMMDeviceCollection::Item", goto error); -#ifdef __cplusplus - hr = device->GetId(&dev_id_wstr); -#else - hr = device->lpVtbl->GetId(device, &dev_id_wstr); -#endif + hr = _IMMDevice_GetId(device, &dev_id_wstr); WASAPI_HR_CHECK(hr, "IMMDevice::GetId", goto error); ir = WideCharToMultiByte(CP_ACP, 0, dev_id_wstr, -1, @@ -1082,22 +973,13 @@ static void *wasapi_device_list_new(void *u) dev_id_str, ir, NULL, NULL); WASAPI_SR_CHECK(ir, "WideCharToMultiByte", goto error); -#ifdef __cplusplus - hr = device->OpenPropertyStore(STGM_READ, &prop_store); -#else - hr = device->lpVtbl->OpenPropertyStore(device, STGM_READ, &prop_store); -#endif + hr = _IMMDevice_OpenPropertyStore(device, STGM_READ, &prop_store); WASAPI_HR_CHECK(hr, "IMMDevice::OpenPropertyStore", goto error); PropVariantInit(&prop_var); prop_var_init = true; -#ifdef __cplusplus - hr = prop_store->GetValue( - PKEY_Device_FriendlyName, &prop_var); -#else - hr = prop_store->lpVtbl->GetValue(prop_store, - &PKEY_Device_FriendlyName, &prop_var); -#endif + hr = _IPropertyStore_GetValue(prop_store, PKEY_Device_FriendlyName, + &prop_var); WASAPI_HR_CHECK(hr, "IPropertyStore::GetValue", goto error); ir = WideCharToMultiByte(CP_ACP, 0, prop_var.pwszVal, -1, @@ -1164,11 +1046,7 @@ static size_t wasapi_write_avail(void *wh) if (w->buffer) return fifo_write_avail(w->buffer); -#ifdef __cplusplus - hr = w->client->GetCurrentPadding(&padding); -#else - hr = w->client->lpVtbl->GetCurrentPadding(w->client, &padding); -#endif + hr = _IAudioClient_GetCurrentPadding(w->client, &padding); WASAPI_HR_CHECK(hr, "IAudioClient::GetCurrentPadding", return 0); return w->engine_buffer_size - padding * w->frame_size; From 37ca5b06051bb00ed6a4292704b90eb6a149130d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 21:49:23 +0200 Subject: [PATCH 081/253] Cleanups --- audio/drivers/wasapi.c | 53 +++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 26 deletions(-) diff --git a/audio/drivers/wasapi.c b/audio/drivers/wasapi.c index 714e8fb1c3..ec939b9a9f 100644 --- a/audio/drivers/wasapi.c +++ b/audio/drivers/wasapi.c @@ -718,18 +718,19 @@ static bool wasapi_flush_buffer(wasapi_t * w, size_t size) static ssize_t wasapi_write_sh(wasapi_t *w, const void * data, size_t size) { DWORD ir; - size_t read_avail; - size_t write_avail; HRESULT hr; - bool br; - ssize_t writen = -1; - UINT32 padding = 0; + size_t write_avail = 0; + bool br = false; + ssize_t written = -1; + UINT32 padding = 0; if (w->buffer) { write_avail = fifo_write_avail(w->buffer); if (!write_avail) { + size_t read_avail = 0; + if (w->blocking) { ir = WaitForSingleObject(w->write_event, INFINITE); @@ -739,21 +740,21 @@ static ssize_t wasapi_write_sh(wasapi_t *w, const void * data, size_t size) hr = _IAudioClient_GetCurrentPadding(w->client, &padding); WASAPI_HR_CHECK(hr, "IAudioClient::GetCurrentPadding", return -1); - read_avail = fifo_read_avail(w->buffer); + read_avail = fifo_read_avail(w->buffer); write_avail = w->engine_buffer_size - padding * w->frame_size; - writen = read_avail < write_avail ? read_avail : write_avail; - if (writen) + written = read_avail < write_avail ? read_avail : write_avail; + if (written) { - br = wasapi_flush_buffer(w, writen); + br = wasapi_flush_buffer(w, written); if (!br) return -1; } } write_avail = fifo_write_avail(w->buffer); - writen = size < write_avail ? size : write_avail; - if (writen) - fifo_write(w->buffer, data, writen); + written = size < write_avail ? size : write_avail; + if (written) + fifo_write(w->buffer, data, written); } else { @@ -770,28 +771,28 @@ static ssize_t wasapi_write_sh(wasapi_t *w, const void * data, size_t size) if (!write_avail) return 0; - writen = size < write_avail ? size : write_avail; - if (writen) + written = size < write_avail ? size : write_avail; + if (written) { - br = wasapi_flush(w, data, writen); + br = wasapi_flush(w, data, written); if (!br) return -1; } } - return writen; + return written; } static ssize_t wasapi_write_ex(wasapi_t *w, const void * data, size_t size) { - DWORD ir; bool br = false; ssize_t writen = 0; size_t write_avail = fifo_write_avail(w->buffer); if (!write_avail) { - ir = WaitForSingleObject(w->write_event, w->blocking ? INFINITE : 0); + DWORD ir = WaitForSingleObject( + w->write_event, w->blocking ? INFINITE : 0); if (ir != WAIT_OBJECT_0 && w->blocking) { RARCH_ERR("[WASAPI]: WaitForSingleObject failed with error %d.\n", GetLastError()); @@ -815,28 +816,28 @@ static ssize_t wasapi_write_ex(wasapi_t *w, const void * data, size_t size) static ssize_t wasapi_write(void *wh, const void *data, size_t size) { - size_t writen; - ssize_t ir; + size_t written; wasapi_t *w = (wasapi_t*)wh; if (w->blocking) { - for (writen = 0, ir = -1; writen < size; writen += ir) + ssize_t ir; + for (written = 0, ir = -1; written < size; written += ir) { if (w->exclusive) - ir = wasapi_write_ex(w, (char*)data + writen, size - writen); + ir = wasapi_write_ex(w, (char*)data + written, size - written); else - ir = wasapi_write_sh(w, (char*)data + writen, size - writen); + ir = wasapi_write_sh(w, (char*)data + written, size - written); if (ir == -1) return -1; } } else if (w->exclusive) - writen = wasapi_write_ex(w, data, size); + written = wasapi_write_ex(w, data, size); else - writen = wasapi_write_sh(w, data, size); + written = wasapi_write_sh(w, data, size); - return writen; + return written; } static bool wasapi_stop(void *wh) From 0cbd2d4aa195e1a98d7e906bdfae5ebc53054c2f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 21:51:03 +0200 Subject: [PATCH 082/253] Cleanups --- audio/drivers/wasapi.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/audio/drivers/wasapi.c b/audio/drivers/wasapi.c index ec939b9a9f..973be6411c 100644 --- a/audio/drivers/wasapi.c +++ b/audio/drivers/wasapi.c @@ -720,7 +720,6 @@ static ssize_t wasapi_write_sh(wasapi_t *w, const void * data, size_t size) DWORD ir; HRESULT hr; size_t write_avail = 0; - bool br = false; ssize_t written = -1; UINT32 padding = 0; @@ -745,8 +744,7 @@ static ssize_t wasapi_write_sh(wasapi_t *w, const void * data, size_t size) written = read_avail < write_avail ? read_avail : write_avail; if (written) { - br = wasapi_flush_buffer(w, written); - if (!br) + if (!wasapi_flush_buffer(w, written)) return -1; } } @@ -774,8 +772,7 @@ static ssize_t wasapi_write_sh(wasapi_t *w, const void * data, size_t size) written = size < write_avail ? size : write_avail; if (written) { - br = wasapi_flush(w, data, written); - if (!br) + if (!wasapi_flush(w, data, written)) return -1; } } @@ -785,7 +782,6 @@ static ssize_t wasapi_write_sh(wasapi_t *w, const void * data, size_t size) static ssize_t wasapi_write_ex(wasapi_t *w, const void * data, size_t size) { - bool br = false; ssize_t writen = 0; size_t write_avail = fifo_write_avail(w->buffer); @@ -801,8 +797,7 @@ static ssize_t wasapi_write_ex(wasapi_t *w, const void * data, size_t size) if (ir != WAIT_OBJECT_0) return 0; - br = wasapi_flush_buffer(w, w->engine_buffer_size); - if (!br) + if (!wasapi_flush_buffer(w, w->engine_buffer_size)) return -1; write_avail = w->engine_buffer_size; From f1c2800fa41b10d5c6f45208b1349f3503aed9c4 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 28 Sep 2017 22:34:28 +0200 Subject: [PATCH 083/253] Don't do implicit memset --- audio/drivers/xaudio.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/audio/drivers/xaudio.c b/audio/drivers/xaudio.c index 76121dc1fe..de3b93a1b9 100644 --- a/audio/drivers/xaudio.c +++ b/audio/drivers/xaudio.c @@ -275,15 +275,23 @@ static size_t xaudio2_write(xaudio2_t *handle, const void *buf, size_t bytes_) if (handle->bufptr == handle->bufsize) { - XAUDIO2_BUFFER xa2buffer = {0}; + XAUDIO2_BUFFER xa2buffer; while (handle->buffers == MAX_BUFFERS - 1) WaitForSingleObject(handle->hEvent, INFINITE); + xa2buffer.Flags = 0; xa2buffer.AudioBytes = handle->bufsize; xa2buffer.pAudioData = handle->buf + handle->write_buffer * handle->bufsize; + xa2buffer.PlayBegin = 0; + xa2buffer.PlayLength = 0; + xa2buffer.LoopBegin = 0; + xa2buffer.LoopLength = 0; + xa2buffer.LoopCount = 0; + xa2buffer.pContext = NULL; - if (FAILED(IXAudio2SourceVoice_SubmitSourceBuffer(handle->pSourceVoice, &xa2buffer, NULL))) + if (FAILED(IXAudio2SourceVoice_SubmitSourceBuffer( + handle->pSourceVoice, &xa2buffer, NULL))) return 0; InterlockedIncrement((LONG volatile*)&handle->buffers); From 547557d44319eb87d148750feeabe7554a494bfe Mon Sep 17 00:00:00 2001 From: not6 Date: Thu, 28 Sep 2017 23:35:07 +0200 Subject: [PATCH 084/253] fix wiiu build --- command.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/command.c b/command.c index df1145be11..410febaee2 100644 --- a/command.c +++ b/command.c @@ -375,7 +375,7 @@ static void command_parse_sub_msg(command_t *handle, const char *tok) msg_hash_to_str(MSG_RECEIVED)); } -#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) +#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) && defined(HAVE_COMMAND) static bool command_network_init(command_t *handle, uint16_t port) { struct addrinfo *res = NULL; @@ -573,7 +573,7 @@ bool command_network_new( if (!handle) return false; -#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) +#if defined(HAVE_NETWORKING) && defined(HAVE_NETWORK_CMD) && defined(HAVE_COMMAND) handle->net_fd = -1; if (network_enable && !command_network_init(handle, port)) goto error; From 0f1d0ebfa97d345fa066fb2a9aae9a19069154c1 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 03:55:55 +0200 Subject: [PATCH 085/253] config_file.c - use malloc instead of calloc --- libretro-common/file/config_file.c | 73 ++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 23 deletions(-) diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c index 797b84e5a4..049358d7e4 100644 --- a/libretro-common/file/config_file.c +++ b/libretro-common/file/config_file.c @@ -52,10 +52,10 @@ struct config_entry_list /* If we got this from an #include, * do not allow overwrite. */ bool readonly; - char *key; - char *value; uint32_t key_hash; + char *key; + char *value; struct config_entry_list *next; }; @@ -240,7 +240,10 @@ static void add_sub_conf(config_file_t *conf, char *path) char real_path[PATH_MAX_LENGTH]; config_file_t *sub_conf = NULL; struct config_include_list *head = conf->includes; - struct config_include_list *node = (struct config_include_list*)calloc(1, sizeof(*node)); + struct config_include_list *node = (struct config_include_list*)malloc(sizeof(*node)); + + node->path = NULL; + node->next = NULL; if (node) { @@ -365,23 +368,29 @@ error: static config_file_t *config_file_new_internal( const char *path, unsigned depth) { - FILE *file = NULL; - struct config_file *conf = (struct config_file*)calloc(1, sizeof(*conf)); + FILE *file = NULL; + struct config_file *conf = (struct config_file*)malloc(sizeof(*conf)); if (!conf) return NULL; + conf->path = NULL; + conf->entries = NULL; + conf->tail = NULL; + conf->includes = NULL; + conf->include_depth = 0; + if (!path || !*path) return conf; if (path_is_directory(path)) goto error; - conf->path = strdup(path); + conf->path = strdup(path); if (!conf->path) goto error; conf->include_depth = depth; - file = fopen(path, "r"); + file = fopen(path, "r"); if (!file) { @@ -392,9 +401,8 @@ static config_file_t *config_file_new_internal( while (!feof(file)) { - struct config_entry_list *list = (struct config_entry_list*) - calloc(1, sizeof(*list)); - char *line = NULL; + char *line = NULL; + struct config_entry_list *list = (struct config_entry_list*)malloc(sizeof(*list)); if (!list) { @@ -403,7 +411,13 @@ static config_file_t *config_file_new_internal( return NULL; } - line = getaline(file); + list->readonly = false; + list->key_hash = 0; + list->key = NULL; + list->value = NULL; + list->next = NULL; + + line = getaline(file); if (!line) { @@ -500,14 +514,17 @@ config_file_t *config_file_new_from_string(const char *from_string) { size_t i; struct string_list *lines = NULL; - struct config_file *conf = (struct config_file*)calloc(1, sizeof(*conf)); + struct config_file *conf = (struct config_file*)malloc(sizeof(*conf)); if (!conf) return NULL; if (!from_string) return conf; - conf->path = NULL; + conf->path = NULL; + conf->entries = NULL; + conf->tail = NULL; + conf->includes = NULL; conf->include_depth = 0; lines = string_split(from_string, "\n"); @@ -516,9 +533,8 @@ config_file_t *config_file_new_from_string(const char *from_string) for (i = 0; i < lines->size; i++) { - struct config_entry_list *list = (struct config_entry_list*) - calloc(1, sizeof(*list)); - char* line = lines->elems[i].data; + struct config_entry_list *list = (struct config_entry_list*)malloc(sizeof(*list)); + char *line = lines->elems[i].data; if (!list) { @@ -527,6 +543,12 @@ config_file_t *config_file_new_from_string(const char *from_string) return NULL; } + list->readonly = false; + list->key_hash = 0; + list->key = NULL; + list->value = NULL; + list->next = NULL; + if (line && conf) { if (*line && parse_line(conf, list, line)) @@ -761,16 +783,21 @@ void config_set_string(config_file_t *conf, const char *key, const char *val) return; } - if (!val) return; + if (!val) + return; - entry = (struct config_entry_list*)calloc(1, sizeof(*entry)); - if (!entry) return; + entry = (struct config_entry_list*)malloc(sizeof(*entry)); + if (!entry) + return; - entry->key = strdup(key); - entry->value = strdup(val); + entry->readonly = false; + entry->key_hash = 0; + entry->key = strdup(key); + entry->value = strdup(val); + entry->next = NULL; if (last) - last->next = entry; + last->next = entry; else conf->entries = entry; } @@ -875,7 +902,7 @@ bool config_file_write(config_file_t *conf, const char *path) { FILE *file; - if (path) + if (path && !string_is_empty(path)) { file = fopen(path, "w"); if (!file) From 8eb28eaae90c88309136ac9fc4510a1324aee405 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 04:03:13 +0200 Subject: [PATCH 086/253] Add this for Wiiu debugging --- libretro-common/file/config_file.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c index 049358d7e4..78c5c12919 100644 --- a/libretro-common/file/config_file.c +++ b/libretro-common/file/config_file.c @@ -907,7 +907,11 @@ bool config_file_write(config_file_t *conf, const char *path) file = fopen(path, "w"); if (!file) return false; +#ifdef WIIU + setvbuf(file, NULL, _IONBF, 0x4000); +#else setvbuf(file, NULL, _IOFBF, 0x4000); +#endif } else file = stdout; From 3374b0ffde7a35a4c58e6cad4ad668f088b8f9df Mon Sep 17 00:00:00 2001 From: Alcaro Date: Fri, 29 Sep 2017 04:04:51 +0200 Subject: [PATCH 087/253] Add why we're doing this --- libretro-common/file/config_file.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c index 78c5c12919..3c75d929c2 100644 --- a/libretro-common/file/config_file.c +++ b/libretro-common/file/config_file.c @@ -908,6 +908,7 @@ bool config_file_write(config_file_t *conf, const char *path) if (!file) return false; #ifdef WIIU + /* TODO: use FBF everywhere once https://i.imgur.com/muVhNeF.jpg is fixed */ setvbuf(file, NULL, _IONBF, 0x4000); #else setvbuf(file, NULL, _IOFBF, 0x4000); From 6dcbf0eab889928b37e461cfd1e98a8126669edd Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 04:47:51 +0200 Subject: [PATCH 088/253] (menu_list.c) Use malloc --- menu/widgets/menu_list.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/menu/widgets/menu_list.c b/menu/widgets/menu_list.c index 3606475a93..24b6b92505 100644 --- a/menu/widgets/menu_list.c +++ b/menu/widgets/menu_list.c @@ -79,29 +79,33 @@ void menu_list_free(menu_list_t *menu_list) menu_list_t *menu_list_new(void) { unsigned i; - menu_list_t *list = (menu_list_t*)calloc(1, sizeof(*list)); + menu_list_t *list = (menu_list_t*)malloc(sizeof(*list)); if (!list) return NULL; - list->menu_stack = (file_list_t**)calloc(1, sizeof(*list->menu_stack)); + list->menu_stack_size = 1; + list->selection_buf_size = 1; + list->selection_buf = NULL; + list->menu_stack = (file_list_t**) + calloc(list->menu_stack_size, sizeof(*list->menu_stack)); if (!list->menu_stack) goto error; - list->selection_buf = (file_list_t**)calloc(1, sizeof(*list->selection_buf)); + list->selection_buf = (file_list_t**) + calloc(list->selection_buf_size, sizeof(*list->selection_buf)); if (!list->selection_buf) goto error; - list->menu_stack_size = 1; - list->selection_buf_size = 1; - for (i = 0; i < list->menu_stack_size; i++) - list->menu_stack[i] = (file_list_t*)calloc(1, sizeof(*list->menu_stack[i])); + list->menu_stack[i] = (file_list_t*) + calloc(1, sizeof(*list->menu_stack[i])); for (i = 0; i < list->selection_buf_size; i++) - list->selection_buf[i] = (file_list_t*)calloc(1, sizeof(*list->selection_buf[i])); + list->selection_buf[i] = (file_list_t*) + calloc(1, sizeof(*list->selection_buf[i])); return list; From 3564562563a474678090091f86bfc9f82b2d73df Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 05:01:00 +0200 Subject: [PATCH 089/253] database_info.c - use malloc --- database_info.c | 5 ++++- libretro-common/include/file/archive_file.h | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/database_info.c b/database_info.c index 91247d686e..63d46b72b2 100644 --- a/database_info.c +++ b/database_info.c @@ -507,11 +507,14 @@ database_info_list_t *database_info_list_new( goto end; database_info_list = (database_info_list_t*) - calloc(1, sizeof(*database_info_list)); + malloc(sizeof(*database_info_list)); if (!database_info_list) goto end; + database_info_list->count = 0; + database_info_list->list = NULL; + while (ret != -1) { database_info_t db_info = {0}; diff --git a/libretro-common/include/file/archive_file.h b/libretro-common/include/file/archive_file.h index 8abe22116d..b2b5971931 100644 --- a/libretro-common/include/file/archive_file.h +++ b/libretro-common/include/file/archive_file.h @@ -60,13 +60,13 @@ typedef struct file_archive_file_data file_archive_file_data_t; typedef struct file_archive_transfer { + enum file_archive_transfer_type type; + int32_t archive_size; file_archive_file_data_t *handle; void *stream; const uint8_t *footer; const uint8_t *directory; const uint8_t *data; - int32_t archive_size; - enum file_archive_transfer_type type; const struct file_archive_file_backend *backend; } file_archive_transfer_t; From 9fc063cd434b23f3403103291c16fd541e54928e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 05:13:10 +0200 Subject: [PATCH 090/253] playlist.c - use malloc instead of calloc --- playlist.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/playlist.c b/playlist.c index ce12074994..7632ad24bf 100644 --- a/playlist.c +++ b/playlist.c @@ -43,12 +43,12 @@ struct playlist_entry struct content_playlist { - struct playlist_entry *entries; + bool modified; size_t size; size_t cap; - bool modified; char *conf_path; + struct playlist_entry *entries; }; typedef int (playlist_sort_fun_t)( @@ -549,7 +549,7 @@ end: playlist_t *playlist_init(const char *path, size_t size) { struct playlist_entry *entries = NULL; - playlist_t *playlist = (playlist_t*)calloc(1, sizeof(*playlist)); + playlist_t *playlist = (playlist_t*)malloc(sizeof(*playlist)); if (!playlist) return NULL; @@ -560,12 +560,14 @@ playlist_t *playlist_init(const char *path, size_t size) return NULL; } - playlist->entries = entries; + playlist->modified = false; + playlist->size = 0; playlist->cap = size; + playlist->conf_path = strdup(path); + playlist->entries = entries; playlist_read_file(playlist, path); - playlist->conf_path = strdup(path); return playlist; } From 15bb8e2ebeb7b01959d4f822037aa7c4b3193105 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 05:23:33 +0200 Subject: [PATCH 091/253] Fix setting directories --- menu/cbs/menu_cbs_title.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/menu/cbs/menu_cbs_title.c b/menu/cbs/menu_cbs_title.c index 4e67035d0b..f827bdd3a6 100644 --- a/menu/cbs/menu_cbs_title.c +++ b/menu/cbs/menu_cbs_title.c @@ -48,7 +48,10 @@ static void sanitize_to_string(char *s, const char *label, size_t len) static int fill_title(char *s, const char *title, const char *path, size_t len) { - fill_pathname_join_delim(s, title, path, ' ', len); + if ( (path && !string_is_empty(path)) + && + (title && !string_is_empty(title))) + fill_pathname_join_delim(s, title, path, ' ', len); return 0; } From 642818d59c5a8cef31699d2ba01e12785bd54610 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 05:26:48 +0200 Subject: [PATCH 092/253] Make sanitize_to_string safer --- menu/cbs/menu_cbs_title.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/menu/cbs/menu_cbs_title.c b/menu/cbs/menu_cbs_title.c index f827bdd3a6..bbc19f6739 100644 --- a/menu/cbs/menu_cbs_title.c +++ b/menu/cbs/menu_cbs_title.c @@ -41,9 +41,13 @@ static void sanitize_to_string(char *s, const char *label, size_t len) new_label[0] = '\0'; - strlcpy(new_label, label, sizeof(new_label)); - strlcpy(s, new_label, len); - replace_chars(s, '_', ' '); + if (label && !string_is_empty(label)) + strlcpy(new_label, label, sizeof(new_label)); + if (s && !string_is_empty(new_label)) + { + strlcpy(s, new_label, len); + replace_chars(s, '_', ' '); + } } static int fill_title(char *s, const char *title, const char *path, size_t len) From 5379b12e7c16cbd50d130b01296303e80cb0153d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 05:39:06 +0200 Subject: [PATCH 093/253] FIx some new Coverity errors --- libretro-common/file/config_file.c | 4 +-- menu/cbs/menu_cbs_deferred_push.c | 17 ++++++++++--- menu/drivers/xmb.c | 41 +++++++++++++++--------------- menu/widgets/menu_filebrowser.c | 3 ++- 4 files changed, 37 insertions(+), 28 deletions(-) diff --git a/libretro-common/file/config_file.c b/libretro-common/file/config_file.c index 3c75d929c2..18259e319e 100644 --- a/libretro-common/file/config_file.c +++ b/libretro-common/file/config_file.c @@ -242,11 +242,9 @@ static void add_sub_conf(config_file_t *conf, char *path) struct config_include_list *head = conf->includes; struct config_include_list *node = (struct config_include_list*)malloc(sizeof(*node)); - node->path = NULL; - node->next = NULL; - if (node) { + node->next = NULL; /* Add include list */ node->path = strdup(path); diff --git a/menu/cbs/menu_cbs_deferred_push.c b/menu/cbs/menu_cbs_deferred_push.c index 27b69731c6..4489332ece 100644 --- a/menu/cbs/menu_cbs_deferred_push.c +++ b/menu/cbs/menu_cbs_deferred_push.c @@ -735,7 +735,8 @@ static int general_push(menu_displaylist_info_t *info, break; case PUSH_DEFAULT: { - char *new_exts = NULL; + bool new_exts_allocated = false; + char *new_exts = NULL; if (menu_setting_get_browser_selection_type(info->setting) == ST_DIR) { @@ -743,12 +744,18 @@ static int general_push(menu_displaylist_info_t *info, else if (system_menu && system_menu->valid_extensions) { if (*system_menu->valid_extensions) - new_exts = strdup(system_menu->valid_extensions); + { + new_exts = strdup(system_menu->valid_extensions); + new_exts_allocated = true; + } } else { if (!string_is_empty(system->valid_extensions)) - new_exts = strdup(system->valid_extensions); + { + new_exts = strdup(system->valid_extensions); + new_exts_allocated = true; + } } if (!new_exts) @@ -770,7 +777,11 @@ static int general_push(menu_displaylist_info_t *info, string_list_join_concat(newstring2, path_size, str_list3, "|"); string_list_free(str_list3); + } + + if (new_exts_allocated) + free(new_exts); } break; case PUSH_ARCHIVE_OPEN_DETECT_CORE: diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index db67ffdae1..18838d64d9 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2301,21 +2301,21 @@ static void xmb_draw_items( menu_animation_ctx_ticker_t ticker; char ticker_str[PATH_MAX_LENGTH]; char tmp[255]; + menu_entry_t entry; unsigned entry_type = 0; const float half_size = xmb->icon_size / 2.0f; uintptr_t texture_switch = 0; - xmb_node_t * node = (xmb_node_t*) - menu_entries_get_userdata_at_offset(list, i); bool do_draw_text = false; unsigned ticker_limit = 35; - menu_entry_t *entry = menu_entry_alloc(); + xmb_node_t * node = (xmb_node_t*) + menu_entries_get_userdata_at_offset(list, i); if (!node) continue; ticker_str[0] = tmp[0] = '\0'; - menu_entry_init(entry); + menu_entry_init(&entry); icon_y = xmb->margins_screen_top + node->y + half_size; @@ -2331,23 +2331,23 @@ static void xmb_draw_items( if (icon_x < -half_size || icon_x > width) continue; - menu_entry_get(entry, 0, i, list, true); - entry_type = menu_entry_get_type_new(entry); + menu_entry_get(&entry, 0, i, list, true); + entry_type = menu_entry_get_type_new(&entry); if (entry_type == FILE_TYPE_CONTENTLIST_ENTRY) - fill_short_pathname_representation(entry->path, entry->path, - sizeof(entry->path)); + fill_short_pathname_representation(entry.path, entry.path, + sizeof(entry.path)); - if (string_is_equal(entry->value, msg_hash_to_str(MENU_ENUM_LABEL_DISABLED)) || - (string_is_equal(entry->value, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))) + if (string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_DISABLED)) || + (string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))) { if (xmb->textures.list[XMB_TEXTURE_SWITCH_OFF]) texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_OFF]; else do_draw_text = true; } - else if (string_is_equal(entry->value, msg_hash_to_str(MENU_ENUM_LABEL_ENABLED)) || - (string_is_equal(entry->value, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON)))) + else if (string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_ENABLED)) || + (string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON)))) { if (xmb->textures.list[XMB_TEXTURE_SWITCH_ON]) texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_ON]; @@ -2356,7 +2356,7 @@ static void xmb_draw_items( } else { - enum msg_file_type type = msg_hash_to_file_type(msg_hash_calculate(entry->value)); + enum msg_file_type type = msg_hash_to_file_type(msg_hash_calculate(entry.value)); switch (type) { @@ -2379,7 +2379,7 @@ static void xmb_draw_items( } } - if (string_is_empty(entry->value)) + if (string_is_empty(entry.value)) { if (xmb->savestate_thumbnail || (!string_is_equal @@ -2392,7 +2392,7 @@ static void xmb_draw_items( ticker_limit = 70; } - menu_entry_get_rich_label(entry, ticker_str, sizeof(ticker_str)); + menu_entry_get_rich_label(&entry, ticker_str, sizeof(ticker_str)); ticker.s = tmp; ticker.len = ticker_limit; @@ -2404,7 +2404,7 @@ static void xmb_draw_items( label_offset = xmb->margins_label_top; if (i == current && width > 320 && height > 240 - && !string_is_empty(entry->sublabel)) + && !string_is_empty(entry.sublabel)) { char entry_sublabel[255]; @@ -2412,7 +2412,7 @@ static void xmb_draw_items( label_offset = - xmb->margins_label_top; - word_wrap(entry_sublabel, entry->sublabel, 50, true); + word_wrap(entry_sublabel, entry.sublabel, 50, true); xmb_draw_text(menu_disp_info, xmb, entry_sublabel, node->x + xmb->margins_screen_left + @@ -2434,7 +2434,7 @@ static void xmb_draw_items( ticker.s = tmp; ticker.len = 35; ticker.idx = frame_count / 20; - ticker.str = entry->value; + ticker.str = entry.value; ticker.selected = (i == current); menu_animation_ticker(&ticker); @@ -2460,7 +2460,7 @@ static void xmb_draw_items( math_matrix_4x4 mymat; menu_display_ctx_rotate_draw_t rotate_draw; uintptr_t texture = xmb_icon_get_id(xmb, core_node, node, - entry->enum_idx, entry_type, (i == current)); + entry.enum_idx, entry_type, (i == current)); float x = icon_x; float y = icon_y; float rotation = 0; @@ -2510,8 +2510,7 @@ static void xmb_draw_items( &color[0], xmb->shadow_offset); - menu_entry_free(entry); - free(entry); + menu_entry_free(&entry); } menu_display_blend_end(); diff --git a/menu/widgets/menu_filebrowser.c b/menu/widgets/menu_filebrowser.c index 348e86e79c..ca81c2d4de 100644 --- a/menu/widgets/menu_filebrowser.c +++ b/menu/widgets/menu_filebrowser.c @@ -64,7 +64,8 @@ void filebrowser_parse(void *data, unsigned type_data) enum menu_displaylist_ctl_state type = (enum menu_displaylist_ctl_state) type_data; const char *path = info->path; - bool path_is_compressed = path ? path_is_compressed_file(path) : false; + bool path_is_compressed = (path && !string_is_empty(path)) + ? path_is_compressed_file(path) : false; bool filter_ext = settings->bools.menu_navigation_browser_filter_supported_extensions_enable; From 5951bed07d45004079a6416730cc08b1c10cd34b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 06:16:35 +0200 Subject: [PATCH 094/253] Make stdin an option --- tasks/task_autodetect.c | 90 ++++++++++++++++++++++++++++++----------- 1 file changed, 66 insertions(+), 24 deletions(-) diff --git a/tasks/task_autodetect.c b/tasks/task_autodetect.c index b071b94d59..a731832edc 100644 --- a/tasks/task_autodetect.c +++ b/tasks/task_autodetect.c @@ -39,19 +39,19 @@ typedef struct autoconfig_params autoconfig_params_t; struct autoconfig_disconnect { unsigned idx; - char msg[255]; + char *msg; }; struct autoconfig_params { - char name[255]; - char driver[255]; - char display_name[255]; - char autoconfig_directory[4096]; int32_t vid; int32_t pid; unsigned idx; uint32_t max_users; + char *name; + char *driver; + char *display_name; + char *autoconfig_directory; }; static bool input_autoconfigured[MAX_USERS]; @@ -132,7 +132,9 @@ static int input_autoconfigure_joypad_try_from_conf(config_file_t *conf, score += 3; /* Check for name match */ - if (string_is_equal(ident, params->name)) + if (params->name && + !string_is_empty(params->name) + && string_is_equal(ident, params->name)) score += 2; return score; @@ -146,7 +148,7 @@ static void input_autoconfigure_joypad_add(config_file_t *conf, * No reason to spam autoconfigure messages every time. */ bool block_osd_spam = input_autoconfigured[params->idx] - && !string_is_empty(params->name); + && params->name && !string_is_empty(params->name); msg[0] = display_name[0] = device_type[0] = '\0'; @@ -165,7 +167,8 @@ static void input_autoconfigure_joypad_add(config_file_t *conf, static bool remote_is_bound = false; snprintf(msg, sizeof(msg), "%s configured.", - string_is_empty(display_name) ? params->name : display_name); + (string_is_empty(display_name) && + (params->name && !string_is_empty(params->name))) ? params->name : display_name); if(!remote_is_bound) { @@ -180,7 +183,9 @@ static void input_autoconfigure_joypad_add(config_file_t *conf, { bool tmp = false; snprintf(msg, sizeof(msg), "%s %s #%u.", - string_is_empty(display_name) ? params->name : display_name, + (string_is_empty(display_name) && + params->name && !string_is_empty(params->name)) + ? params->name : display_name, msg_hash_to_str(MSG_DEVICE_CONFIGURED_IN_PORT), params->idx); @@ -240,8 +245,10 @@ static bool input_autoconfigure_joypad_from_conf_dir( { if (list) string_list_free(list); - list = dir_list_new_special(params->autoconfig_directory, - DIR_LIST_AUTOCONFIG, "cfg"); + if (params->autoconfig_directory && + !string_is_empty(params->autoconfig_directory)) + list = dir_list_new_special(params->autoconfig_directory, + DIR_LIST_AUTOCONFIG, "cfg"); } if(!list) @@ -306,11 +313,34 @@ static bool input_autoconfigure_joypad_from_conf_internal( return true; } - if (string_is_empty(params->autoconfig_directory)) + if (!params->autoconfig_directory || + string_is_empty(params->autoconfig_directory)) return true; return false; } +static void input_autoconfigure_params_free(autoconfig_params_t *params) +{ + if (!params) + return; + if (params->name + && !string_is_empty(params->name)) + free(params->name); + if (params->driver + && !string_is_empty(params->driver)) + free(params->name); + if (params->display_name + && !string_is_empty(params->display_name)) + free(params->display_name); + if (params->autoconfig_directory + && !string_is_empty(params->autoconfig_directory)) + free(params->autoconfig_directory); + params->name = NULL; + params->driver = NULL; + params->display_name = NULL; + params->autoconfig_directory = NULL; +} + static void input_autoconfigure_connect_handler(retro_task_t *task) { autoconfig_params_t *params = (autoconfig_params_t*)task->state; @@ -325,7 +355,8 @@ static void input_autoconfigure_connect_handler(retro_task_t *task) msg[0] = '\0'; #ifdef ANDROID - strlcpy(params->name, "Android Gamepad", sizeof(params->name)); + params->name = strdup("Android Gamepad"); + if(input_autoconfigure_joypad_from_conf_internal(params, task)) { RARCH_LOG("[Autoconf]: no profiles found for %s (%d/%d). Using fallback\n", @@ -348,7 +379,11 @@ static void input_autoconfigure_connect_handler(retro_task_t *task) } end: - free(params); + if (params) + { + input_autoconfigure_params_free(params); + free(params); + } task_set_finished(task, true); } @@ -362,6 +397,8 @@ static void input_autoconfigure_disconnect_handler(retro_task_t *task) RARCH_LOG("%s: %s\n", msg_hash_to_str(MSG_AUTODETECT), params->msg); + if (params->msg && !string_is_empty(params->msg)) + free(params->msg); free(params); } @@ -369,20 +406,21 @@ bool input_autoconfigure_disconnect(unsigned i, const char *ident) { char msg[255]; retro_task_t *task = (retro_task_t*)calloc(1, sizeof(*task)); - autoconfig_disconnect_t *state = (autoconfig_disconnect_t*)calloc(1, sizeof(*state)); + autoconfig_disconnect_t *state = (autoconfig_disconnect_t*)malloc(sizeof(*state)); if (!state || !task) goto error; msg[0] = '\0'; + state->msg = NULL; state->idx = i; snprintf(msg, sizeof(msg), "%s #%u (%s).", msg_hash_to_str(MSG_DEVICE_DISCONNECTED_FROM_PORT), i, ident); - strlcpy(state->msg, msg, sizeof(state->msg)); + state->msg = strdup(msg); input_config_clear_device_name(state->idx); @@ -395,7 +433,11 @@ bool input_autoconfigure_disconnect(unsigned i, const char *ident) error: if (state) + { + if (state->msg && !string_is_empty(state->msg)) + free(state->msg); free(state); + } if (task) free(task); @@ -440,7 +482,7 @@ bool input_autoconfigure_connect( { unsigned i; retro_task_t *task = (retro_task_t*)calloc(1, sizeof(*task)); - autoconfig_params_t *state = (autoconfig_params_t*)calloc(1, sizeof(*state)); + autoconfig_params_t *state = (autoconfig_params_t*)malloc(sizeof(*state)); settings_t *settings = config_get_ptr(); const char *dir_autoconf = settings->paths.directory_autoconfig; @@ -448,19 +490,16 @@ bool input_autoconfigure_connect( goto error; if (!string_is_empty(display_name)) - strlcpy(state->display_name, display_name, - sizeof(state->display_name)); + state->display_name = strdup(display_name); if (!string_is_empty(name)) - strlcpy(state->name, name, sizeof(state->name)); + state->name = strdup(name); if (!string_is_empty(driver)) - strlcpy(state->driver, driver, sizeof(state->driver)); + state->driver = strdup(driver); if (!string_is_empty(dir_autoconf)) - strlcpy(state->autoconfig_directory, - dir_autoconf, - sizeof(state->autoconfig_directory)); + state->autoconfig_directory = strdup(dir_autoconf); state->idx = idx; state->vid = vid; @@ -496,7 +535,10 @@ bool input_autoconfigure_connect( error: if (state) + { + input_autoconfigure_params_free(state); free(state); + } if (task) free(task); From f713a3070524eb3fcf3bfde7c4b06ba9d68ac520 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Fri, 29 Sep 2017 15:08:09 +0200 Subject: [PATCH 095/253] Update task_autodetect.c --- tasks/task_autodetect.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/task_autodetect.c b/tasks/task_autodetect.c index a731832edc..6c4e240b26 100644 --- a/tasks/task_autodetect.c +++ b/tasks/task_autodetect.c @@ -328,7 +328,7 @@ static void input_autoconfigure_params_free(autoconfig_params_t *params) free(params->name); if (params->driver && !string_is_empty(params->driver)) - free(params->name); + free(params->driver); if (params->display_name && !string_is_empty(params->display_name)) free(params->display_name); From b2932d527088d427e8eddbf838c73a82bf1e9c56 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 16:32:30 +0200 Subject: [PATCH 096/253] Split up function into two - create xmb_draw_item --- menu/drivers/xmb.c | 454 ++++++++++++++++++++++++--------------------- 1 file changed, 241 insertions(+), 213 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 18838d64d9..1d77bbb083 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2240,6 +2240,239 @@ static void xmb_calculate_visible_range(const xmb_handle_t *xmb, } } +static int xmb_draw_item( + menu_display_frame_info_t menu_disp_info, + math_matrix_4x4 *mymat, + xmb_handle_t *xmb, + xmb_node_t *core_node, + file_list_t *list, + float *color, + const char *thumb_ident, + uint64_t frame_count, + size_t i, + size_t current, + unsigned width, + unsigned height + ) +{ + float icon_x, icon_y, label_offset; + menu_animation_ctx_ticker_t ticker; + char ticker_str[PATH_MAX_LENGTH]; + char tmp[255]; + menu_entry_t entry; + unsigned entry_type = 0; + const float half_size = xmb->icon_size / 2.0f; + uintptr_t texture_switch = 0; + bool do_draw_text = false; + unsigned ticker_limit = 35; + xmb_node_t * node = (xmb_node_t*) + menu_entries_get_userdata_at_offset(list, i); + + if (!node) + return 0; + + ticker_str[0] = tmp[0] = '\0'; + + menu_entry_init(&entry); + + icon_y = xmb->margins_screen_top + node->y + half_size; + + if (icon_y < half_size) + return 0; + + if (icon_y > height + xmb->icon_size) + return -1; + + icon_x = node->x + xmb->margins_screen_left + + xmb->icon_spacing_horizontal - half_size; + + if (icon_x < -half_size || icon_x > width) + return 0; + + menu_entry_get(&entry, 0, i, list, true); + entry_type = menu_entry_get_type_new(&entry); + + if (entry_type == FILE_TYPE_CONTENTLIST_ENTRY) + fill_short_pathname_representation(entry.path, entry.path, + sizeof(entry.path)); + + if (string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_DISABLED)) || + (string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))) + { + if (xmb->textures.list[XMB_TEXTURE_SWITCH_OFF]) + texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_OFF]; + else + do_draw_text = true; + } + else if (string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_ENABLED)) || + (string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON)))) + { + if (xmb->textures.list[XMB_TEXTURE_SWITCH_ON]) + texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_ON]; + else + do_draw_text = true; + } + else + { + enum msg_file_type type = msg_hash_to_file_type(msg_hash_calculate(entry.value)); + + switch (type) + { + case FILE_TYPE_IN_CARCHIVE: + case FILE_TYPE_COMPRESSED: + case FILE_TYPE_MORE: + case FILE_TYPE_CORE: + case FILE_TYPE_DIRECT_LOAD: + case FILE_TYPE_RDB: + case FILE_TYPE_CURSOR: + case FILE_TYPE_PLAIN: + case FILE_TYPE_DIRECTORY: + case FILE_TYPE_MUSIC: + case FILE_TYPE_IMAGE: + case FILE_TYPE_MOVIE: + break; + default: + do_draw_text = true; + break; + } + } + + if (string_is_empty(entry.value)) + { + if (xmb->savestate_thumbnail || + (!string_is_equal + (thumb_ident, + msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)) + && xmb->thumbnail) + ) + ticker_limit = 40; + else + ticker_limit = 70; + } + + menu_entry_get_rich_label(&entry, ticker_str, sizeof(ticker_str)); + + ticker.s = tmp; + ticker.len = ticker_limit; + ticker.idx = frame_count / 20; + ticker.str = ticker_str; + ticker.selected = (i == current); + + menu_animation_ticker(&ticker); + + label_offset = xmb->margins_label_top; + if (i == current && width > 320 && height > 240 + && !string_is_empty(entry.sublabel)) + { + char entry_sublabel[255]; + + entry_sublabel[0] = '\0'; + + label_offset = - xmb->margins_label_top; + + word_wrap(entry_sublabel, entry.sublabel, 50, true); + + xmb_draw_text(menu_disp_info, xmb, entry_sublabel, + node->x + xmb->margins_screen_left + + xmb->icon_spacing_horizontal + xmb->margins_label_left, + xmb->margins_screen_top + node->y + xmb->margins_label_top*3.5, + 1, node->label_alpha, TEXT_ALIGN_LEFT, + width, height, xmb->font2); + } + + xmb_draw_text(menu_disp_info, xmb, tmp, + node->x + xmb->margins_screen_left + + xmb->icon_spacing_horizontal + xmb->margins_label_left, + xmb->margins_screen_top + node->y + label_offset, + 1, node->label_alpha, TEXT_ALIGN_LEFT, + width, height, xmb->font); + + tmp[0] = '\0'; + + ticker.s = tmp; + ticker.len = 35; + ticker.idx = frame_count / 20; + ticker.str = entry.value; + ticker.selected = (i == current); + + menu_animation_ticker(&ticker); + + if (do_draw_text) + xmb_draw_text(menu_disp_info, xmb, tmp, + node->x + + + xmb->margins_screen_left + + xmb->icon_spacing_horizontal + + xmb->margins_label_left + + xmb->margins_setting_left, + xmb->margins_screen_top + node->y + xmb->margins_label_top, + 1, + node->label_alpha, + TEXT_ALIGN_LEFT, + width, height, xmb->font); + + + menu_display_set_alpha(color, MIN(node->alpha, xmb->alpha)); + + if (color[3] != 0) + { + math_matrix_4x4 mymat_tmp; + menu_display_ctx_rotate_draw_t rotate_draw; + uintptr_t texture = xmb_icon_get_id(xmb, core_node, node, + entry.enum_idx, entry_type, (i == current)); + float x = icon_x; + float y = icon_y; + float rotation = 0; + float scale_factor = node->zoom; + + rotate_draw.matrix = &mymat_tmp; + rotate_draw.rotation = rotation; + rotate_draw.scale_x = scale_factor; + rotate_draw.scale_y = scale_factor; + rotate_draw.scale_z = 1; + rotate_draw.scale_enable = true; + + menu_display_rotate_z(&rotate_draw); + + xmb_draw_icon( + menu_disp_info, + xmb->icon_size, + &mymat_tmp, + texture, + x, + y, + width, + height, + 1.0, + rotation, + scale_factor, + &color[0], + xmb->shadow_offset); + } + + menu_display_set_alpha(color, MIN(node->alpha, xmb->alpha)); + + if (texture_switch != 0 && color[3] != 0) + xmb_draw_icon( + menu_disp_info, + xmb->icon_size, + mymat, + texture_switch, + node->x + xmb->margins_screen_left + + xmb->icon_spacing_horizontal + + xmb->icon_size / 2.0 + xmb->margins_setting_left, + xmb->margins_screen_top + node->y + xmb->icon_size / 2.0, + width, height, + node->alpha, + 0, + 1, + &color[0], + xmb->shadow_offset); + + menu_entry_free(&entry); + + return 0; +} + static void xmb_draw_items( video_frame_info_t *video_info, menu_display_frame_info_t menu_disp_info, @@ -2297,220 +2530,15 @@ static void xmb_draw_items( for (i = first; i <= last; i++) { - float icon_x, icon_y, label_offset; - menu_animation_ctx_ticker_t ticker; - char ticker_str[PATH_MAX_LENGTH]; - char tmp[255]; - menu_entry_t entry; - unsigned entry_type = 0; - const float half_size = xmb->icon_size / 2.0f; - uintptr_t texture_switch = 0; - bool do_draw_text = false; - unsigned ticker_limit = 35; - xmb_node_t * node = (xmb_node_t*) - menu_entries_get_userdata_at_offset(list, i); - - if (!node) - continue; - - ticker_str[0] = tmp[0] = '\0'; - - menu_entry_init(&entry); - - icon_y = xmb->margins_screen_top + node->y + half_size; - - if (icon_y < half_size) - continue; - - if (icon_y > height + xmb->icon_size) + int ret = xmb_draw_item(menu_disp_info, + &mymat, + xmb, core_node, + list, color, thumb_ident, + frame_count, + i, current, + width, height); + if (ret == -1) break; - - icon_x = node->x + xmb->margins_screen_left + - xmb->icon_spacing_horizontal - half_size; - - if (icon_x < -half_size || icon_x > width) - continue; - - menu_entry_get(&entry, 0, i, list, true); - entry_type = menu_entry_get_type_new(&entry); - - if (entry_type == FILE_TYPE_CONTENTLIST_ENTRY) - fill_short_pathname_representation(entry.path, entry.path, - sizeof(entry.path)); - - if (string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_DISABLED)) || - (string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))) - { - if (xmb->textures.list[XMB_TEXTURE_SWITCH_OFF]) - texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_OFF]; - else - do_draw_text = true; - } - else if (string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_ENABLED)) || - (string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON)))) - { - if (xmb->textures.list[XMB_TEXTURE_SWITCH_ON]) - texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_ON]; - else - do_draw_text = true; - } - else - { - enum msg_file_type type = msg_hash_to_file_type(msg_hash_calculate(entry.value)); - - switch (type) - { - case FILE_TYPE_IN_CARCHIVE: - case FILE_TYPE_COMPRESSED: - case FILE_TYPE_MORE: - case FILE_TYPE_CORE: - case FILE_TYPE_DIRECT_LOAD: - case FILE_TYPE_RDB: - case FILE_TYPE_CURSOR: - case FILE_TYPE_PLAIN: - case FILE_TYPE_DIRECTORY: - case FILE_TYPE_MUSIC: - case FILE_TYPE_IMAGE: - case FILE_TYPE_MOVIE: - break; - default: - do_draw_text = true; - break; - } - } - - if (string_is_empty(entry.value)) - { - if (xmb->savestate_thumbnail || - (!string_is_equal - (thumb_ident, - msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)) - && xmb->thumbnail) - ) - ticker_limit = 40; - else - ticker_limit = 70; - } - - menu_entry_get_rich_label(&entry, ticker_str, sizeof(ticker_str)); - - ticker.s = tmp; - ticker.len = ticker_limit; - ticker.idx = frame_count / 20; - ticker.str = ticker_str; - ticker.selected = (i == current); - - menu_animation_ticker(&ticker); - - label_offset = xmb->margins_label_top; - if (i == current && width > 320 && height > 240 - && !string_is_empty(entry.sublabel)) - { - char entry_sublabel[255]; - - entry_sublabel[0] = '\0'; - - label_offset = - xmb->margins_label_top; - - word_wrap(entry_sublabel, entry.sublabel, 50, true); - - xmb_draw_text(menu_disp_info, xmb, entry_sublabel, - node->x + xmb->margins_screen_left + - xmb->icon_spacing_horizontal + xmb->margins_label_left, - xmb->margins_screen_top + node->y + xmb->margins_label_top*3.5, - 1, node->label_alpha, TEXT_ALIGN_LEFT, - width, height, xmb->font2); - } - - xmb_draw_text(menu_disp_info, xmb, tmp, - node->x + xmb->margins_screen_left + - xmb->icon_spacing_horizontal + xmb->margins_label_left, - xmb->margins_screen_top + node->y + label_offset, - 1, node->label_alpha, TEXT_ALIGN_LEFT, - width, height, xmb->font); - - tmp[0] = '\0'; - - ticker.s = tmp; - ticker.len = 35; - ticker.idx = frame_count / 20; - ticker.str = entry.value; - ticker.selected = (i == current); - - menu_animation_ticker(&ticker); - - if (do_draw_text) - xmb_draw_text(menu_disp_info, xmb, tmp, - node->x + - + xmb->margins_screen_left - + xmb->icon_spacing_horizontal - + xmb->margins_label_left - + xmb->margins_setting_left, - xmb->margins_screen_top + node->y + xmb->margins_label_top, - 1, - node->label_alpha, - TEXT_ALIGN_LEFT, - width, height, xmb->font); - - - menu_display_set_alpha(color, MIN(node->alpha, xmb->alpha)); - - if (color[3] != 0) - { - math_matrix_4x4 mymat; - menu_display_ctx_rotate_draw_t rotate_draw; - uintptr_t texture = xmb_icon_get_id(xmb, core_node, node, - entry.enum_idx, entry_type, (i == current)); - float x = icon_x; - float y = icon_y; - float rotation = 0; - float scale_factor = node->zoom; - - rotate_draw.matrix = &mymat; - rotate_draw.rotation = rotation; - rotate_draw.scale_x = scale_factor; - rotate_draw.scale_y = scale_factor; - rotate_draw.scale_z = 1; - rotate_draw.scale_enable = true; - - menu_display_rotate_z(&rotate_draw); - - xmb_draw_icon( - menu_disp_info, - xmb->icon_size, - &mymat, - texture, - x, - y, - width, - height, - 1.0, - rotation, - scale_factor, - &color[0], - xmb->shadow_offset); - } - - menu_display_set_alpha(color, MIN(node->alpha, xmb->alpha)); - - if (texture_switch != 0 && color[3] != 0) - xmb_draw_icon( - menu_disp_info, - xmb->icon_size, - &mymat, - texture_switch, - node->x + xmb->margins_screen_left - + xmb->icon_spacing_horizontal - + xmb->icon_size / 2.0 + xmb->margins_setting_left, - xmb->margins_screen_top + node->y + xmb->icon_size / 2.0, - width, height, - node->alpha, - 0, - 1, - &color[0], - xmb->shadow_offset); - - menu_entry_free(&entry); } menu_display_blend_end(); From dc11a02e61917d84c9ecded94cceb9cb85f0c68a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 16:34:20 +0200 Subject: [PATCH 097/253] Cleanup --- menu/drivers/xmb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 1d77bbb083..8264edb9f0 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2487,7 +2487,7 @@ static void xmb_draw_items( menu_display_ctx_rotate_draw_t rotate_draw; xmb_node_t *core_node = NULL; size_t end = 0; - uint64_t frame_count = xmb->frame_count; + uint64_t frame_count = xmb ? xmb->frame_count : 0; const char *thumb_ident = xmb_thumbnails_ident(); if (!list || !list->size) From 8bf741257c99ffdcfc56c1fb5c189f54bbe49fa6 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 16:47:30 +0200 Subject: [PATCH 098/253] (XMB) Reduce stack usage --- menu/drivers/xmb.c | 142 +++++++++++++++++++++----------------- menu/widgets/menu_entry.h | 10 +-- 2 files changed, 85 insertions(+), 67 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 8264edb9f0..9aafffba55 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -915,7 +915,7 @@ end: static void xmb_update_thumbnail_path(void *data, unsigned i) { - menu_entry_t entry; + menu_entry_t *entry = menu_entry_alloc(); unsigned entry_type = 0; char *scrub_char_pointer = NULL; settings_t *settings = config_get_ptr(); @@ -929,10 +929,10 @@ static void xmb_update_thumbnail_path(void *data, unsigned i) if (!xmb) goto end; - menu_entry_init(&entry); - menu_entry_get(&entry, 0, i, NULL, true); + menu_entry_init(entry); + menu_entry_get(entry, 0, i, NULL, true); - entry_type = menu_entry_get_type_new(&entry); + entry_type = menu_entry_get_type_new(entry); if (entry_type == FILE_TYPE_IMAGEVIEWER || entry_type == FILE_TYPE_IMAGE) { @@ -945,7 +945,7 @@ static void xmb_update_thumbnail_path(void *data, unsigned i) fill_pathname_join( xmb->thumbnail_file_path, node->fullpath, - entry.path, + entry->path, sizeof(xmb->thumbnail_file_path)); goto end; @@ -967,7 +967,7 @@ static void xmb_update_thumbnail_path(void *data, unsigned i) if (string_is_equal(core_name, "imageviewer")) { - strlcpy(xmb->thumbnail_file_path, entry.label, + strlcpy(xmb->thumbnail_file_path, entry->label, sizeof(xmb->thumbnail_file_path)); goto end; } @@ -1007,31 +1007,37 @@ static void xmb_update_thumbnail_path(void *data, unsigned i) sizeof(xmb->thumbnail_file_path)); end: - menu_entry_free(&entry); + menu_entry_free(entry); + if (entry) + free(entry); free(tmp_new); } static void xmb_update_savestate_thumbnail_path(void *data, unsigned i) { - menu_entry_t entry; + menu_entry_t *entry = menu_entry_alloc(); settings_t *settings = config_get_ptr(); xmb_handle_t *xmb = (xmb_handle_t*)data; playlist_t *playlist = NULL; if (!xmb) + { + if (entry) + free(entry); return; + } - menu_entry_init(&entry); - menu_entry_get(&entry, 0, i, NULL, true); + menu_entry_init(entry); + menu_entry_get(entry, 0, i, NULL, true); menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &playlist); xmb->savestate_thumbnail_file_path[0] = '\0'; if ( (settings->bools.savestate_thumbnail_enable) - && ((string_is_equal_fast(entry.label, "state_slot", 10)) - || (string_is_equal_fast(entry.label, "loadstate", 9)) - || (string_is_equal_fast(entry.label, "savestate", 9)))) + && ((string_is_equal_fast(entry->label, "state_slot", 10)) + || (string_is_equal_fast(entry->label, "loadstate", 9)) + || (string_is_equal_fast(entry->label, "savestate", 9)))) { size_t path_size = 8024 * sizeof(char); char *path = (char*)malloc(8204 * sizeof(char)); @@ -1062,7 +1068,8 @@ static void xmb_update_savestate_thumbnail_path(void *data, unsigned i) free(path); } - menu_entry_free(&entry); + menu_entry_free(entry); + free(entry); } static void xmb_update_thumbnail_image(void *data) @@ -1121,9 +1128,9 @@ static void xmb_update_savestate_thumbnail_image(void *data) static void xmb_selection_pointer_changed( xmb_handle_t *xmb, bool allow_animations) { - menu_entry_t entry; unsigned i, end, height; menu_animation_ctx_tag tag; + menu_entry_t *entry = menu_entry_alloc(); size_t num = 0; int threshold = 0; menu_list_t *menu_list = NULL; @@ -1134,10 +1141,10 @@ static void xmb_selection_pointer_changed( menu_entries_ctl(MENU_ENTRIES_CTL_LIST_GET, &menu_list); if (!xmb) - return; + goto end; - menu_entry_init(&entry); - menu_entry_get(&entry, 0, selection, NULL, true); + menu_entry_init(entry); + menu_entry_get(entry, 0, selection, NULL, true); end = (unsigned)menu_entries_get_end(); threshold = xmb->icon_size * 10; @@ -1167,7 +1174,7 @@ static void xmb_selection_pointer_changed( { unsigned depth = (unsigned)xmb_list_get_size(xmb, MENU_LIST_PLAIN); size_t xmb_list = xmb_list_get_selection(xmb); - unsigned entry_type = menu_entry_get_type_new(&entry); + unsigned entry_type = menu_entry_get_type_new(entry); ia = xmb->items_active_alpha; iz = xmb->items_active_zoom; @@ -1178,7 +1185,7 @@ static void xmb_selection_pointer_changed( if ((xmb_list > XMB_SYSTEM_TAB_SETTINGS && depth == 1) || (xmb_list < XMB_SYSTEM_TAB_SETTINGS && depth == 4)) { - xmb_set_thumbnail_content(xmb, entry.path, sizeof(entry.path)); + xmb_set_thumbnail_content(xmb, entry->path, sizeof(entry->path)); xmb_update_thumbnail_path(xmb, i); xmb_update_thumbnail_image(xmb); } @@ -1186,7 +1193,7 @@ static void xmb_selection_pointer_changed( entry_type == FILE_TYPE_RDB || entry_type == FILE_TYPE_RDB_ENTRY) && xmb_list <= XMB_SYSTEM_TAB_SETTINGS)) { - xmb_set_thumbnail_content(xmb, entry.path, sizeof(entry.path)); + xmb_set_thumbnail_content(xmb, entry->path, sizeof(entry->path)); xmb_update_thumbnail_path(xmb, i); xmb_update_thumbnail_image(xmb); } @@ -1211,34 +1218,37 @@ static void xmb_selection_pointer_changed( } else { - menu_animation_ctx_entry_t entry; + menu_animation_ctx_entry_t anim_entry; - entry.duration = XMB_DELAY; - entry.target_value = ia; - entry.subject = &node->alpha; - entry.easing_enum = EASING_OUT_QUAD; - entry.tag = tag; - entry.cb = NULL; + anim_entry.duration = XMB_DELAY; + anim_entry.target_value = ia; + anim_entry.subject = &node->alpha; + anim_entry.easing_enum = EASING_OUT_QUAD; + anim_entry.tag = tag; + anim_entry.cb = NULL; - menu_animation_push(&entry); + menu_animation_push(&anim_entry); - entry.subject = &node->label_alpha; + anim_entry.subject = &node->label_alpha; - menu_animation_push(&entry); + menu_animation_push(&anim_entry); - entry.target_value = iz; - entry.subject = &node->zoom; + anim_entry.target_value = iz; + anim_entry.subject = &node->zoom; - menu_animation_push(&entry); + menu_animation_push(&anim_entry); - entry.target_value = iy; - entry.subject = &node->y; + anim_entry.target_value = iy; + anim_entry.subject = &node->y; - menu_animation_push(&entry); + menu_animation_push(&anim_entry); } } - menu_entry_free(&entry); +end: + menu_entry_free(entry); + if (entry) + free(entry); } static void xmb_list_open_old(xmb_handle_t *xmb, @@ -2259,53 +2269,53 @@ static int xmb_draw_item( menu_animation_ctx_ticker_t ticker; char ticker_str[PATH_MAX_LENGTH]; char tmp[255]; - menu_entry_t entry; unsigned entry_type = 0; const float half_size = xmb->icon_size / 2.0f; uintptr_t texture_switch = 0; bool do_draw_text = false; unsigned ticker_limit = 35; + menu_entry_t *entry = menu_entry_alloc(); xmb_node_t * node = (xmb_node_t*) menu_entries_get_userdata_at_offset(list, i); if (!node) - return 0; + goto iterate; ticker_str[0] = tmp[0] = '\0'; - menu_entry_init(&entry); + menu_entry_init(entry); icon_y = xmb->margins_screen_top + node->y + half_size; if (icon_y < half_size) - return 0; + goto iterate; if (icon_y > height + xmb->icon_size) - return -1; + goto end; icon_x = node->x + xmb->margins_screen_left + xmb->icon_spacing_horizontal - half_size; if (icon_x < -half_size || icon_x > width) - return 0; + goto iterate; - menu_entry_get(&entry, 0, i, list, true); - entry_type = menu_entry_get_type_new(&entry); + menu_entry_get(entry, 0, i, list, true); + entry_type = menu_entry_get_type_new(entry); if (entry_type == FILE_TYPE_CONTENTLIST_ENTRY) - fill_short_pathname_representation(entry.path, entry.path, - sizeof(entry.path)); + fill_short_pathname_representation(entry->path, entry->path, + sizeof(entry->path)); - if (string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_DISABLED)) || - (string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))) + if (string_is_equal(entry->value, msg_hash_to_str(MENU_ENUM_LABEL_DISABLED)) || + (string_is_equal(entry->value, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF)))) { if (xmb->textures.list[XMB_TEXTURE_SWITCH_OFF]) texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_OFF]; else do_draw_text = true; } - else if (string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_ENABLED)) || - (string_is_equal(entry.value, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON)))) + else if (string_is_equal(entry->value, msg_hash_to_str(MENU_ENUM_LABEL_ENABLED)) || + (string_is_equal(entry->value, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_ON)))) { if (xmb->textures.list[XMB_TEXTURE_SWITCH_ON]) texture_switch = xmb->textures.list[XMB_TEXTURE_SWITCH_ON]; @@ -2314,7 +2324,7 @@ static int xmb_draw_item( } else { - enum msg_file_type type = msg_hash_to_file_type(msg_hash_calculate(entry.value)); + enum msg_file_type type = msg_hash_to_file_type(msg_hash_calculate(entry->value)); switch (type) { @@ -2337,7 +2347,7 @@ static int xmb_draw_item( } } - if (string_is_empty(entry.value)) + if (string_is_empty(entry->value)) { if (xmb->savestate_thumbnail || (!string_is_equal @@ -2350,7 +2360,7 @@ static int xmb_draw_item( ticker_limit = 70; } - menu_entry_get_rich_label(&entry, ticker_str, sizeof(ticker_str)); + menu_entry_get_rich_label(entry, ticker_str, sizeof(ticker_str)); ticker.s = tmp; ticker.len = ticker_limit; @@ -2362,7 +2372,7 @@ static int xmb_draw_item( label_offset = xmb->margins_label_top; if (i == current && width > 320 && height > 240 - && !string_is_empty(entry.sublabel)) + && !string_is_empty(entry->sublabel)) { char entry_sublabel[255]; @@ -2370,7 +2380,7 @@ static int xmb_draw_item( label_offset = - xmb->margins_label_top; - word_wrap(entry_sublabel, entry.sublabel, 50, true); + word_wrap(entry_sublabel, entry->sublabel, 50, true); xmb_draw_text(menu_disp_info, xmb, entry_sublabel, node->x + xmb->margins_screen_left + @@ -2387,12 +2397,12 @@ static int xmb_draw_item( 1, node->label_alpha, TEXT_ALIGN_LEFT, width, height, xmb->font); - tmp[0] = '\0'; + tmp[0] = '\0'; ticker.s = tmp; ticker.len = 35; ticker.idx = frame_count / 20; - ticker.str = entry.value; + ticker.str = entry->value; ticker.selected = (i == current); menu_animation_ticker(&ticker); @@ -2418,7 +2428,7 @@ static int xmb_draw_item( math_matrix_4x4 mymat_tmp; menu_display_ctx_rotate_draw_t rotate_draw; uintptr_t texture = xmb_icon_get_id(xmb, core_node, node, - entry.enum_idx, entry_type, (i == current)); + entry->enum_idx, entry_type, (i == current)); float x = icon_x; float y = icon_y; float rotation = 0; @@ -2468,9 +2478,17 @@ static int xmb_draw_item( &color[0], xmb->shadow_offset); - menu_entry_free(&entry); - +iterate: + menu_entry_free(entry); + if (entry) + free(entry); return 0; + +end: + menu_entry_free(entry); + if (entry) + free(entry); + return -1; } static void xmb_draw_items( diff --git a/menu/widgets/menu_entry.h b/menu/widgets/menu_entry.h index d8e790cc1d..b4500fd590 100644 --- a/menu/widgets/menu_entry.h +++ b/menu/widgets/menu_entry.h @@ -46,15 +46,15 @@ enum menu_entry_type typedef struct menu_entry { enum msg_hash_enums enum_idx; - char path[255]; - char label[255]; - char sublabel[255]; - char rich_label[255]; - char value[255]; unsigned idx; unsigned type; unsigned spacing; size_t entry_idx; + char path[255]; + char label[255]; + char sublabel[255]; + char rich_label[255]; + char value[255]; } menu_entry_t; enum menu_entry_type menu_entry_get_type(uint32_t i); From 476f7e560b30836535dc33a9164e053b5f912690 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 16:49:41 +0200 Subject: [PATCH 099/253] Reorder some struct members --- menu/menu_animation.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/menu/menu_animation.h b/menu/menu_animation.h index e4a0e6e4d9..2f6c8aefbb 100644 --- a/menu/menu_animation.h +++ b/menu/menu_animation.h @@ -103,21 +103,21 @@ typedef struct menu_animation_ctx_subject typedef struct menu_animation_ctx_entry { + enum menu_animation_easing_type easing_enum; + uintptr_t tag; float duration; float target_value; float *subject; - enum menu_animation_easing_type easing_enum; - uintptr_t tag; tween_cb cb; } menu_animation_ctx_entry_t; typedef struct menu_animation_ctx_ticker { - char *s; + bool selected; size_t len; uint64_t idx; + char *s; const char *str; - bool selected; } menu_animation_ctx_ticker_t; bool menu_animation_update(float delta_time); From 51d98ef0c0106327e0b6dca6f17c4df9771fab33 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 16:54:57 +0200 Subject: [PATCH 100/253] (XMB) Reduce stack usage --- menu/drivers/xmb.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 9aafffba55..e9207c310f 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1707,14 +1707,16 @@ static void xmb_list_switch(xmb_handle_t *xmb) if (!string_is_equal(xmb_thumbnails_ident(), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF))) { - menu_entry_t entry; + menu_entry_t *entry = menu_entry_alloc(); - menu_entry_init(&entry); - menu_entry_get(&entry, 0, selection, NULL, true); + menu_entry_init(entry); + menu_entry_get(entry, 0, selection, NULL, true); - xmb_set_thumbnail_content(xmb, entry.path, sizeof(entry.path)); + xmb_set_thumbnail_content(xmb, + entry->path, sizeof(entry->path)); - menu_entry_free(&entry); + menu_entry_free(entry); + free(entry); xmb_update_thumbnail_path(xmb, 0); xmb_update_thumbnail_image(xmb); @@ -1729,7 +1731,7 @@ static void xmb_list_open_horizontal_list(xmb_handle_t *xmb) for (j = 0; j <= list_size; j++) { - menu_animation_ctx_entry_t entry; + menu_animation_ctx_entry_t anim_entry; float ia = 0; xmb_node_t *node = xmb_get_node(xmb, j); @@ -1741,16 +1743,16 @@ static void xmb_list_open_horizontal_list(xmb_handle_t *xmb) else if (xmb->depth <= 1) ia = xmb->categories_passive_alpha; - entry.duration = XMB_DELAY; - entry.target_value = ia; - entry.subject = &node->alpha; - entry.easing_enum = EASING_OUT_QUAD; + anim_entry.duration = XMB_DELAY; + anim_entry.target_value = ia; + anim_entry.subject = &node->alpha; + anim_entry.easing_enum = EASING_OUT_QUAD; /* TODO/FIXME - integer conversion resulted in change of sign */ - entry.tag = -1; - entry.cb = NULL; + anim_entry.tag = -1; + anim_entry.cb = NULL; - if (entry.subject) - menu_animation_push(&entry); + if (anim_entry.subject) + menu_animation_push(&anim_entry); } } From 819e3fb02aec6948a04232fa92342fcd316cd8a5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 17:06:38 +0200 Subject: [PATCH 101/253] Initialize struct --- tasks/task_autodetect.c | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/tasks/task_autodetect.c b/tasks/task_autodetect.c index 6c4e240b26..b8cd523bfb 100644 --- a/tasks/task_autodetect.c +++ b/tasks/task_autodetect.c @@ -489,22 +489,28 @@ bool input_autoconfigure_connect( if (!task || !state || !settings->bools.input_autodetect_enable) goto error; + state->display_name = NULL; + state->name = NULL; + state->driver = NULL; + state->autoconfig_directory = NULL; + if (!string_is_empty(display_name)) - state->display_name = strdup(display_name); + state->display_name = strdup(display_name); if (!string_is_empty(name)) - state->name = strdup(name); + state->name = strdup(name); if (!string_is_empty(driver)) - state->driver = strdup(driver); + state->driver = strdup(driver); if (!string_is_empty(dir_autoconf)) state->autoconfig_directory = strdup(dir_autoconf); - state->idx = idx; - state->vid = vid; - state->pid = pid; - state->max_users = *(input_driver_get_uint(INPUT_ACTION_MAX_USERS)); + state->idx = idx; + state->vid = vid; + state->pid = pid; + state->max_users = *( + input_driver_get_uint(INPUT_ACTION_MAX_USERS)); input_config_set_device_name(state->idx, state->name); input_config_set_pid(state->idx, state->pid); From 5b9f90dd9acb325acd3b4624008c60351045cae8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 17:11:42 +0200 Subject: [PATCH 102/253] (input overlay) Reorder variables in struct --- input/input_overlay.h | 62 ++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/input/input_overlay.h b/input/input_overlay.h index af4305702a..ba81955f38 100644 --- a/input/input_overlay.h +++ b/input/input_overlay.h @@ -96,27 +96,34 @@ enum overlay_image_transfer_status struct overlay { - unsigned id; + bool full_screen; + bool block_scale; - struct overlay_desc *descs; - size_t size; - size_t pos; + unsigned load_images_size; + unsigned id; unsigned pos_increment; - struct texture_image image; + size_t size; + size_t pos; - bool block_scale; float mod_x, mod_y, mod_w, mod_h; float x, y, w, h; float scale; float center_x, center_y; - bool full_screen; + struct overlay_desc *descs; + struct texture_image *load_images; + + struct texture_image image; char name[64]; struct { + bool normalized; + float alpha_mod; + float range_mod; + struct { char key[64]; @@ -140,41 +147,36 @@ struct overlay unsigned size; } descs; - bool normalized; - float alpha_mod; - float range_mod; } config; - struct texture_image *load_images; - unsigned load_images_size; }; struct overlay_desc { - float x; - float y; - enum overlay_hitbox hitbox; - float range_x, range_y; - float range_x_mod, range_y_mod; - float mod_x, mod_y, mod_w, mod_h; - float delta_x, delta_y; - enum overlay_type type; - uint64_t key_mask; - float analog_saturate_pct; + + bool updated; + bool movable; unsigned next_index; - char next_index_name[64]; - - struct texture_image image; unsigned image_index; float alpha_mod; float range_mod; + float analog_saturate_pct; + float range_x, range_y; + float range_x_mod, range_y_mod; + float mod_x, mod_y, mod_w, mod_h; + float delta_x, delta_y; + float x; + float y; - bool updated; - bool movable; + uint64_t key_mask; + + char next_index_name[64]; + + struct texture_image image; }; typedef struct overlay_desc overlay_desc_t; @@ -183,13 +185,13 @@ typedef struct input_overlay input_overlay_t; typedef struct { - struct overlay *overlays; - struct overlay *active; - size_t size; bool hide_in_menu; bool overlay_enable; + size_t size; float overlay_opacity; float overlay_scale; + struct overlay *overlays; + struct overlay *active; } overlay_task_data_t; /** From 9ca4b9baf02a09297079b4ce85b89b96fc4adac5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 17:32:06 +0200 Subject: [PATCH 103/253] Implement more D3D C codepaths --- gfx/common/d3d_common.cpp | 69 ++++++++++++++++++++++++++++++++++----- 1 file changed, 60 insertions(+), 9 deletions(-) diff --git a/gfx/common/d3d_common.cpp b/gfx/common/d3d_common.cpp index 71e0d2ea83..5c81645d11 100644 --- a/gfx/common/d3d_common.cpp +++ b/gfx/common/d3d_common.cpp @@ -33,6 +33,9 @@ bool d3d_swap(void *data, LPDIRECT3DDEVICE dev) #elif defined(HAVE_D3D9) && !defined(__cplusplus) if (IDirect3DDevice9_Present(dev, NULL, NULL, NULL, NULL) == D3DERR_DEVICE_LOST) return false; +#elif defined(HAVE_D3D8) && !defined(__cplusplus) + if (IDirect3DDevice8_Present(dev, NULL, NULL, NULL, NULL) == D3DERR_DEVICE_LOST) + return false; #else if (dev->Present(NULL, NULL, NULL, NULL) != D3D_OK) return false; @@ -50,6 +53,8 @@ void d3d_set_transform(LPDIRECT3DDEVICE dev, #if defined(HAVE_D3D9) && !defined(__cplusplus) IDirect3DDevice9_SetTransform(dev, state, matrix); +#if defined(HAVE_D3D8) && !defined(__cplusplus) + IDirect3DDevice8_SetTransform(dev, state, matrix); #else dev->SetTransform(state, matrix); #endif @@ -75,12 +80,17 @@ LPDIRECT3DTEXTURE d3d_texture_new(LPDIRECT3DDEVICE dev, palette, &buf); else { +#if defined(HAVE_D3D8) && !defined(__cplusplus) + hr = IDirect3DDevice8_CreateTexture(dev, width, height, miplevels, usage, + format, pool, &buf); +#else hr = dev->CreateTexture(width, height, miplevels, usage, format, pool, &buf #ifndef HAVE_D3D8 , NULL #endif ); +#endif } if (FAILED(hr)) @@ -95,6 +105,8 @@ void d3d_texture_free(LPDIRECT3DTEXTURE tex) { #if defined(HAVE_D3D9) && !defined(__cplusplus) IDirect3DTexture9_Release(tex); +#if defined(HAVE_D3D8) && !defined(__cplusplus) + IDirect3DTexture8_Release(tex); #else tex->Release(); #endif @@ -131,12 +143,12 @@ LPDIRECT3DVERTEXBUFFER d3d_vertex_buffer_new(LPDIRECT3DDEVICE dev, #endif #endif -#if defined(HAVE_D3D8) - hr = IDirect3DDevice8_CreateVertexBuffer(dev, length, usage, fvf, pool, - &buf); -#elif defined(HAVE_D3D9) +#if defined(HAVE_D3D9) && !defined(__cplusplus) hr = IDirect3DDevice9_CreateVertexBuffer(dev, length, usage, fvf, pool, &buf, NULL); +#elif defined(HAVE_D3D8) && !defined(__cplusplus) + hr = IDirect3DDevice8_CreateVertexBuffer(dev, length, usage, fvf, pool, + &buf); #else hr = dev->CreateVertexBuffer(length, usage, fvf, pool, &buf, NULL); #endif @@ -155,7 +167,9 @@ void d3d_vertex_buffer_unlock(void *vertbuf_ptr) D3DVertexBuffer_Unlock(vertbuf); #elif defined(HAVE_D3D9) && !defined(__cplusplus) IDirect3DVertexBuffer9_Unlock(vertbuf); -#elif defined(HAVE_D3D9) +#elif defined(HAVE_D3D8) && !defined(__cplusplus) + IDirect3DVertexBuffer8_Unlock(vertbuf); +#else vertbuf->Unlock(); #endif } @@ -169,7 +183,7 @@ void *d3d_vertex_buffer_lock(void *vertbuf_ptr) buf = (void*)D3DVertexBuffer_Lock2(vertbuf, 0); #elif defined(_XBOX360) buf = D3DVertexBuffer_Lock(vertbuf, 0, 0, 0); -#elif defined(HAVE_D3D9) +#else vertbuf->Lock(0, sizeof(buf), &buf, 0); #endif @@ -203,14 +217,15 @@ void d3d_set_stream_source(LPDIRECT3DDEVICE dev, unsigned stream_no, unsigned stride) { LPDIRECT3DVERTEXBUFFER stream_vertbuf = (LPDIRECT3DVERTEXBUFFER)stream_vertbuf_ptr; -#if defined(HAVE_D3D8) - IDirect3DDevice8_SetStreamSource(dev, stream_no, stream_vertbuf, stride); #elif defined(_XBOX360) D3DDevice_SetStreamSource_Inline(dev, stream_no, stream_vertbuf, offset_bytes, stride); #elif defined(HAVE_D3D9) && !defined(__cplusplus) - IDirect3DDevice9_SetStreamSource(dev, stream_no, stream_vertbuf, offset_bytes, + IDirect3DDevice9_SetStreamSource(dev, stream_no, stream_vertbuf, + offset_bytes, stride); +#elif defined(HAVE_D3D8) && !defined(__cplusplus) + IDirect3DDevice8_SetStreamSource(dev, stream_no, stream_vertbuf, stride); #else dev->SetStreamSource(stream_no, stream_vertbuf, offset_bytes, stride); #endif @@ -226,6 +241,8 @@ void d3d_set_sampler_address_u(LPDIRECT3DDEVICE dev, D3DDevice_SetSamplerState_AddressU_Inline(dev, sampler, value); #elif defined(HAVE_D3D9) && !defined(__cplusplus) IDirect3DDevice9_SetSamplerState(dev, sampler, D3DSAMP_ADDRESSU, value); +#elif defined(HAVE_D3D8) && !defined(__cplusplus) + IDirect3DDevice8_SetTextureStageState(dev, sampler, D3DTSS_ADDRESSU, value); #elif defined(HAVE_D3D8) dev->SetTextureStageState(sampler, D3DTSS_ADDRESSU, value); #else @@ -243,6 +260,8 @@ void d3d_set_sampler_address_v(LPDIRECT3DDEVICE dev, D3DDevice_SetSamplerState_AddressV_Inline(dev, sampler, value); #elif defined(HAVE_D3D9) && !defined(__cplusplus) IDirect3DDevice9_SetSamplerState(dev, sampler, D3DSAMP_ADDRESSV, value); +#elif defined(HAVE_D3D8) && !defined(__cplusplus) + IDirect3DDevice8_SetTextureStageState(dev, sampler, D3DTSS_ADDRESSV, value); #elif defined(HAVE_D3D8) dev->SetTextureStageState(sampler, D3DTSS_ADDRESSV, value); #else @@ -260,6 +279,8 @@ void d3d_set_sampler_minfilter(LPDIRECT3DDEVICE dev, D3DDevice_SetSamplerState_MinFilter(dev, sampler, value); #elif defined(HAVE_D3D9) && !defined(__cplusplus) IDirect3DDevice9_SetSamplerState(dev, sampler, D3DSAMP_MINFILTER, value); +#elif defined(HAVE_D3D8) && !defined(__cplusplus) + IDirect3DDevice8_SetTextureStageState(dev, sampler, D3DTSS_MINFILTER, value); #elif defined(HAVE_D3D8) dev->SetTextureStageState(sampler, D3DTSS_MINFILTER, value); #else @@ -277,6 +298,8 @@ void d3d_set_sampler_magfilter(LPDIRECT3DDEVICE dev, D3DDevice_SetSamplerState_MagFilter(dev, sampler, value); #elif defined(HAVE_D3D9) && !defined(__cplusplus) IDirect3DDevice9_SetSamplerState(dev, sampler, D3DSAMP_MAGFILTER, value); +#elif defined(HAVE_D3D8) && !defined(__cplusplus) + IDirect3DDevice8_SetTextureStageState(dev, sampler, D3DTSS_MAGFILTER, value); #elif defined(HAVE_D3D8) dev->SetTextureStageState(sampler, D3DTSS_MAGFILTER, value); #else @@ -295,6 +318,10 @@ void d3d_draw_primitive(LPDIRECT3DDEVICE dev, IDirect3DDevice9_BeginScene(dev); IDirect3DDevice9_DrawPrimitive(dev, type, start, count); IDirect3DDevice9_EndScene(dev); +#elif defined(HAVE_D3D8) && !defined(__cplusplus) + IDirect3DDevice8_BeginScene(dev); + IDirect3DDevice8_DrawPrimitive(dev, type, start, count); + IDirect3DDevice8_EndScene(dev); #else if (SUCCEEDED(dev->BeginScene())) { @@ -316,6 +343,9 @@ void d3d_clear(LPDIRECT3DDEVICE dev, #elif defined(HAVE_D3D9) && !defined(__cplusplus) IDirect3DDevice9_Clear(dev, count, rects, flags, color, z, stencil); +#elif defined(HAVE_D3D8) && !defined(__cplusplus) + IDirect3DDevice8_Clear(dev, count, rects, flags, + color, z, stencil); #else dev->Clear(count, rects, flags, color, z, stencil); #endif @@ -330,6 +360,9 @@ bool d3d_lock_rectangle(LPDIRECT3DTEXTURE tex, #elif defined(HAVE_D3D9) && !defined(__cplusplus) if (IDirect3DSurface9_LockRect(tex, lock_rect, rect, flags) != D3D_OK) return false; +#elif defined(HAVE_D3D8) && !defined(__cplusplus) + if (IDirect3DSurface8_LockRect(tex, lock_rect, rect, flags) != D3D_OK) + return false; #else if (FAILED(tex->LockRect(level, lock_rect, rect, flags))) return false; @@ -343,6 +376,8 @@ void d3d_unlock_rectangle(LPDIRECT3DTEXTURE tex) D3DTexture_UnlockRect(tex, 0); #elif defined(HAVE_D3D9) && !defined(__cplusplus) IDirect3DSurface9_UnlockRect(tex); +#elif defined(HAVE_D3D8) && !defined(__cplusplus) + IDirect3DSurface8_UnlockRect(tex); #else tex->UnlockRect(0); #endif @@ -367,6 +402,8 @@ void d3d_set_viewports(LPDIRECT3DDEVICE dev, D3DVIEWPORT *vp) D3DDevice_SetViewport(vp); #elif defined(HAVE_D3D9) && !defined(__cplusplus) IDirect3DDevice9_SetViewport(dev, vp); +#elif defined(HAVE_D3D8) && !defined(__cplusplus) + IDirect3DDevice8_SetViewport(dev, vp); #else dev->SetViewport(vp); #endif @@ -388,6 +425,8 @@ void d3d_set_texture(LPDIRECT3DDEVICE dev, unsigned sampler, D3DDevice_SetTexture(dev, sampler, tex, pendingMask3); #elif defined(HAVE_D3D9) && !defined(__cplusplus) IDirect3DDevice9_SetTexture(dev, sampler, tex); +#elif defined(HAVE_D3D8) && !defined(__cplusplus) + IDirect3DDevice8_SetTexture(dev, sampler, tex); #else dev->SetTexture(sampler, tex); #endif @@ -444,6 +483,8 @@ void d3d_set_render_state(void *data, D3DRENDERSTATETYPE state, DWORD value) #if defined(HAVE_D3D9) && !defined(__cplusplus) IDirect3DDevice9_SetRenderState(dev, state, value); +#if defined(HAVE_D3D8) && !defined(__cplusplus) + IDirect3DDevice8_SetRenderState(dev, state, value); #else dev->SetRenderState(state, value); #endif @@ -534,7 +575,13 @@ bool d3d_reset(LPDIRECT3DDEVICE dev, D3DPRESENT_PARAMETERS *d3dpp) /* Try to recreate the device completely. */ #ifndef _XBOX +#if defined(HAVE_D3D9) && !defined(__cplusplus) + res = IDirect3DDevice9_TestCooperativeLevel(dev); +#elif defined(HAVE_D3D8) && !defined(__cplusplus) + res = IDirect3DDevice8_TestCooperativeLevel(dev); +#else res = dev->TestCooperativeLevel(); +#endif switch (res) { @@ -568,6 +615,8 @@ void d3d_device_free(LPDIRECT3DDEVICE dev, LPDIRECT3D pd3d) { #if defined(HAVE_D3D9) && !defined(__cplusplus) IDirect3DDevice9_Release(dev); +#if defined(HAVE_D3D8) && !defined(__cplusplus) + IDirect3DDevice8_Release(dev); #else dev->Release(); #endif @@ -576,6 +625,8 @@ void d3d_device_free(LPDIRECT3DDEVICE dev, LPDIRECT3D pd3d) { #if defined(HAVE_D3D9) && !defined(__cplusplus) IDirect3D9_Release(pd3d); +#if defined(HAVE_D3D8) && !defined(__cplusplus) + IDirect3D8_Release(pd3d); #else pd3d->Release(); #endif From 028c04f35885848a4747a833a05b4b2523986c1c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 17:34:08 +0200 Subject: [PATCH 104/253] Buildfixes --- gfx/common/d3d_common.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gfx/common/d3d_common.cpp b/gfx/common/d3d_common.cpp index 5c81645d11..6575be0a16 100644 --- a/gfx/common/d3d_common.cpp +++ b/gfx/common/d3d_common.cpp @@ -46,14 +46,14 @@ bool d3d_swap(void *data, LPDIRECT3DDEVICE dev) void d3d_set_transform(LPDIRECT3DDEVICE dev, D3DTRANSFORMSTATETYPE state, CONST D3DMATRIX *matrix) { -#ifdef _XBOX1 +#if defined(_XBOX1) D3DDevice_SetTransform(state, matrix); #elif !defined(_XBOX360) /* XBox 360 D3D9 does not support fixed-function pipeline. */ #if defined(HAVE_D3D9) && !defined(__cplusplus) IDirect3DDevice9_SetTransform(dev, state, matrix); -#if defined(HAVE_D3D8) && !defined(__cplusplus) +#elif defined(HAVE_D3D8) && !defined(__cplusplus) IDirect3DDevice8_SetTransform(dev, state, matrix); #else dev->SetTransform(state, matrix); @@ -105,7 +105,7 @@ void d3d_texture_free(LPDIRECT3DTEXTURE tex) { #if defined(HAVE_D3D9) && !defined(__cplusplus) IDirect3DTexture9_Release(tex); -#if defined(HAVE_D3D8) && !defined(__cplusplus) +#elif defined(HAVE_D3D8) && !defined(__cplusplus) IDirect3DTexture8_Release(tex); #else tex->Release(); @@ -217,7 +217,7 @@ void d3d_set_stream_source(LPDIRECT3DDEVICE dev, unsigned stream_no, unsigned stride) { LPDIRECT3DVERTEXBUFFER stream_vertbuf = (LPDIRECT3DVERTEXBUFFER)stream_vertbuf_ptr; -#elif defined(_XBOX360) +#if defined(_XBOX360) D3DDevice_SetStreamSource_Inline(dev, stream_no, stream_vertbuf, offset_bytes, stride); #elif defined(HAVE_D3D9) && !defined(__cplusplus) @@ -483,7 +483,7 @@ void d3d_set_render_state(void *data, D3DRENDERSTATETYPE state, DWORD value) #if defined(HAVE_D3D9) && !defined(__cplusplus) IDirect3DDevice9_SetRenderState(dev, state, value); -#if defined(HAVE_D3D8) && !defined(__cplusplus) +#elif defined(HAVE_D3D8) && !defined(__cplusplus) IDirect3DDevice8_SetRenderState(dev, state, value); #else dev->SetRenderState(state, value); @@ -615,7 +615,7 @@ void d3d_device_free(LPDIRECT3DDEVICE dev, LPDIRECT3D pd3d) { #if defined(HAVE_D3D9) && !defined(__cplusplus) IDirect3DDevice9_Release(dev); -#if defined(HAVE_D3D8) && !defined(__cplusplus) +#elif defined(HAVE_D3D8) && !defined(__cplusplus) IDirect3DDevice8_Release(dev); #else dev->Release(); @@ -625,7 +625,7 @@ void d3d_device_free(LPDIRECT3DDEVICE dev, LPDIRECT3D pd3d) { #if defined(HAVE_D3D9) && !defined(__cplusplus) IDirect3D9_Release(pd3d); -#if defined(HAVE_D3D8) && !defined(__cplusplus) +#elif defined(HAVE_D3D8) && !defined(__cplusplus) IDirect3D8_Release(pd3d); #else pd3d->Release(); From a40692f0c46ecd9a5a0bedd1074c5d5781c28dc9 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 17:40:27 +0200 Subject: [PATCH 105/253] More fleshing out of d3d_common.cpp --- gfx/common/d3d_common.cpp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/gfx/common/d3d_common.cpp b/gfx/common/d3d_common.cpp index 6575be0a16..b0848dfb66 100644 --- a/gfx/common/d3d_common.cpp +++ b/gfx/common/d3d_common.cpp @@ -120,7 +120,11 @@ bool d3d_vertex_declaration_new(LPDIRECT3DDEVICE dev, const D3DVERTEXELEMENT *vertex_elements = (const D3DVERTEXELEMENT*)vertex_data; LPDIRECT3DVERTEXDECLARATION **vertex_decl = (LPDIRECT3DVERTEXDECLARATION**)decl_data; +#if defined(__cplusplus) if (SUCCEEDED(dev->CreateVertexDeclaration(vertex_elements, (IDirect3DVertexDeclaration9**)vertex_decl))) +#else + if (SUCCEEDED(IDirect3DDevice9_CreateVertexDeclaration(dev, vertex_elements, (IDirect3DVertexDeclaration9**)vertex_decl))) +#endif return true; #endif return false; @@ -134,14 +138,18 @@ LPDIRECT3DVERTEXBUFFER d3d_vertex_buffer_new(LPDIRECT3DDEVICE dev, LPDIRECT3DVERTEXBUFFER buf; #ifndef _XBOX -#ifndef HAVE_D3D8 if (usage == 0) { +#if defined(HAVE_D3D9) && !defined(__cplusplus) + if (IDirect3DDevice9_GetSoftwareVertexProcessing(dev)) +#elif defined(HAVE_D3D8) && !defined(__cplusplus) + if (IDirect3DDevice8_GetSoftwareVertexProcessing(dev)) +#else if (dev->GetSoftwareVertexProcessing()) +#endif usage = D3DUSAGE_SOFTWAREPROCESSING; } #endif -#endif #if defined(HAVE_D3D9) && !defined(__cplusplus) hr = IDirect3DDevice9_CreateVertexBuffer(dev, length, usage, fvf, pool, @@ -183,6 +191,8 @@ void *d3d_vertex_buffer_lock(void *vertbuf_ptr) buf = (void*)D3DVertexBuffer_Lock2(vertbuf, 0); #elif defined(_XBOX360) buf = D3DVertexBuffer_Lock(vertbuf, 0, 0, 0); +#elif defined(HAVE_D3D9) && !defined(__cplusplus) + IDirect3DVertexBuffer9_Lock(vertbuf, 0, sizeof(buf), &buf, 0); #else vertbuf->Lock(0, sizeof(buf), &buf, 0); #endif @@ -198,7 +208,11 @@ void d3d_vertex_buffer_free(void *vertex_data, void *vertex_declaration) if (vertex_data) { LPDIRECT3DVERTEXBUFFER buf = (LPDIRECT3DVERTEXBUFFER)vertex_data; +#if defined(HAVE_D3D9) && !defined(__cplusplus) + IDirect3DVertexBuffer9_Release(buf); +#else buf->Release(); +#endif buf = NULL; } @@ -206,7 +220,11 @@ void d3d_vertex_buffer_free(void *vertex_data, void *vertex_declaration) if (vertex_declaration) { LPDIRECT3DVERTEXDECLARATION vertex_decl = (LPDIRECT3DVERTEXDECLARATION)vertex_declaration; +#if defined(HAVE_D3D9) && !defined(__cplusplus) + IDirect3DVertexDeclaration9_Release(vertex_decl); +#else vertex_decl->Release(); +#endif vertex_decl = NULL; } #endif From 851af0532d0a14cd0ed976b6385655d9abf0fce9 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 17:46:57 +0200 Subject: [PATCH 106/253] d3d_set_vertex_shader - add D3D9 C codepath --- gfx/common/d3d_common.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gfx/common/d3d_common.cpp b/gfx/common/d3d_common.cpp index b0848dfb66..dc24db08c8 100644 --- a/gfx/common/d3d_common.cpp +++ b/gfx/common/d3d_common.cpp @@ -461,6 +461,9 @@ HRESULT d3d_set_vertex_shader(LPDIRECT3DDEVICE dev, unsigned index, return S_OK; #elif defined(HAVE_D3D8) return E_FAIL; +#elif defined(HAVE_D3D9) && !defined(__cplusplus) + LPDIRECT3DVERTEXSHADER shader = (LPDIRECT3DVERTEXSHADER)data; + return IDirect3DDevice9_SetVertexShader(dev, shader); #else LPDIRECT3DVERTEXSHADER shader = (LPDIRECT3DVERTEXSHADER)data; return dev->SetVertexShader(shader); From 9b279ca96880d78f8eeca55fce11c512eea1050a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 18:03:29 +0200 Subject: [PATCH 107/253] (XDK360) Buildfix --- menu/drivers/xui.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/menu/drivers/xui.cpp b/menu/drivers/xui.cpp index a565774c05..ae2c27cb6d 100644 --- a/menu/drivers/xui.cpp +++ b/menu/drivers/xui.cpp @@ -42,6 +42,7 @@ #include "../../configuration.h" #include "../../retroarch.h" +#include "../../verbosity.h" #include "../../gfx/drivers/d3d.h" From a90d0a2117e1fe0414b105afd1ffff571f187678 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 18:05:40 +0200 Subject: [PATCH 108/253] (360) Fix Salamander build --- .../RetroArch-360-Salamander/RetroArch-Salamander.vcxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/msvc/RetroArch-360-Salamander/RetroArch-Salamander.vcxproj b/pkg/msvc/RetroArch-360-Salamander/RetroArch-Salamander.vcxproj index cb0a5241e9..4fe54edcd1 100644 --- a/pkg/msvc/RetroArch-360-Salamander/RetroArch-Salamander.vcxproj +++ b/pkg/msvc/RetroArch-360-Salamander/RetroArch-Salamander.vcxproj @@ -286,7 +286,7 @@ CompileAsC CompileAsC - + CompileAsC CompileAsC CompileAsC @@ -322,7 +322,7 @@ CompileAsC CompileAsC - + CompileAsC CompileAsC CompileAsC From 05d5def6c2e912273aba03104173c9b4016b0e1a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 18:12:17 +0200 Subject: [PATCH 109/253] Simplify xmb_draw_item --- menu/drivers/xmb.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index e9207c310f..ffdd5ec375 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2254,6 +2254,7 @@ static void xmb_calculate_visible_range(const xmb_handle_t *xmb, static int xmb_draw_item( menu_display_frame_info_t menu_disp_info, + menu_entry_t *entry, math_matrix_4x4 *mymat, xmb_handle_t *xmb, xmb_node_t *core_node, @@ -2276,7 +2277,6 @@ static int xmb_draw_item( uintptr_t texture_switch = 0; bool do_draw_text = false; unsigned ticker_limit = 35; - menu_entry_t *entry = menu_entry_alloc(); xmb_node_t * node = (xmb_node_t*) menu_entries_get_userdata_at_offset(list, i); @@ -2481,15 +2481,9 @@ static int xmb_draw_item( xmb->shadow_offset); iterate: - menu_entry_free(entry); - if (entry) - free(entry); return 0; end: - menu_entry_free(entry); - if (entry) - free(entry); return -1; } @@ -2550,13 +2544,17 @@ static void xmb_draw_items( for (i = first; i <= last; i++) { - int ret = xmb_draw_item(menu_disp_info, + menu_entry_t *entry = menu_entry_alloc(); + int ret = xmb_draw_item(menu_disp_info, + entry, &mymat, xmb, core_node, list, color, thumb_ident, frame_count, i, current, width, height); + menu_entry_free(entry); + free(entry); if (ret == -1) break; } From 08f9e4aaf982ca9cc38179e09dae9cfe08f99752 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 18:22:11 +0200 Subject: [PATCH 110/253] Refactor menu_entry --- menu/widgets/menu_entry.c | 63 ++++++++++++++++++++++++++++++--------- menu/widgets/menu_entry.h | 10 +++---- 2 files changed, 54 insertions(+), 19 deletions(-) diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index 580f42f37f..865bba11d1 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -77,6 +77,18 @@ enum menu_entry_type menu_entry_get_type(uint32_t i) void menu_entry_free(menu_entry_t *entry) { + if (!entry) + return; + if (entry->label && !string_is_empty(entry->label)) + free(entry->label); + if (entry->rich_label && !string_is_empty(entry->rich_label)) + free(entry->rich_label); + if (entry->sublabel && !string_is_empty(entry->sublabel)) + free(entry->sublabel); + if (entry->path && !string_is_empty(entry->path)) + free(entry->path); + if (entry->value && !string_is_empty(entry->value)) + free(entry->value); } menu_entry_t *menu_entry_alloc(void) @@ -89,11 +101,11 @@ menu_entry_t *menu_entry_alloc(void) void menu_entry_init(menu_entry_t *entry) { - entry->path[0] = '\0'; - entry->label[0] = '\0'; - entry->sublabel[0] = '\0'; - entry->value[0] = '\0'; - entry->rich_label[0] = '\0'; + entry->path = NULL; + entry->label = NULL; + entry->value = NULL; + entry->sublabel = NULL; + entry->rich_label = NULL; entry->enum_idx = MSG_UNKNOWN; entry->entry_idx = 0; entry->idx = 0; @@ -294,12 +306,15 @@ float menu_entry_num_max(uint32_t i) void menu_entry_get(menu_entry_t *entry, size_t stack_idx, size_t i, void *userdata, bool use_representation) { + char newpath[255]; const char *path = NULL; const char *entry_label = NULL; menu_file_list_cbs_t *cbs = NULL; file_list_t *selection_buf = menu_entries_get_selection_buf_ptr(stack_idx); file_list_t *list = (userdata) ? (file_list_t*)userdata : selection_buf; + newpath[0] = '\0'; + if (!list) return; @@ -318,38 +333,58 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx, menu_entries_get_last_stack(NULL, &label, NULL, &enum_idx, NULL); if (cbs->action_get_value && use_representation) + { + entry->value = (char*)malloc(255 * + sizeof(char)); + entry->value[0] = '\0'; cbs->action_get_value(list, &entry->spacing, entry->type, (unsigned)i, label, - entry->value, sizeof(entry->value), + entry->value, + 255 * sizeof(char), entry_label, path, - entry->path, sizeof(entry->path)); + newpath, + sizeof(newpath) + ); + } if (cbs->action_label) + { + entry->rich_label = (char*)malloc(255 * + sizeof(char)); + entry->rich_label[0] = '\0'; cbs->action_label(list, entry->type, (unsigned)i, label, path, entry->rich_label, - sizeof(entry->rich_label)); + 255 * sizeof(char)); + } if (cbs->action_sublabel) + { + entry->sublabel = (char*)malloc(255 * + sizeof(char)); + entry->sublabel[0] = '\0'; cbs->action_sublabel(list, entry->type, (unsigned)i, label, path, entry->sublabel, - sizeof(entry->sublabel)); + 255 * sizeof(char)); + } } entry->idx = (unsigned)i; if (path && !use_representation) - strlcpy(entry->path, path, sizeof(entry->path)); - - if (cbs && cbs->setting && cbs->setting->enum_value_idx != MSG_UNKNOWN + strlcpy(newpath, path, sizeof(newpath)); + else if (cbs && cbs->setting && cbs->setting->enum_value_idx != MSG_UNKNOWN && !cbs->setting->dont_use_enum_idx_representation) - strlcpy(entry->path, msg_hash_to_str(cbs->setting->enum_value_idx), sizeof(entry->path)); + strlcpy(newpath, msg_hash_to_str(cbs->setting->enum_value_idx), sizeof(newpath)); + + if (!string_is_empty(newpath)) + entry->path = strdup(newpath); if (entry_label) - strlcpy(entry->label, entry_label, sizeof(entry->label)); + entry->label = strdup(entry_label); } bool menu_entry_is_currently_selected(unsigned id) diff --git a/menu/widgets/menu_entry.h b/menu/widgets/menu_entry.h index b4500fd590..9fd3be13b8 100644 --- a/menu/widgets/menu_entry.h +++ b/menu/widgets/menu_entry.h @@ -50,11 +50,11 @@ typedef struct menu_entry unsigned type; unsigned spacing; size_t entry_idx; - char path[255]; - char label[255]; - char sublabel[255]; - char rich_label[255]; - char value[255]; + char *path; + char *label; + char *sublabel; + char *rich_label; + char *value; } menu_entry_t; enum menu_entry_type menu_entry_get_type(uint32_t i); From 9c90f97792270ff135540d4d357979c1ac839947 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 18:37:04 +0200 Subject: [PATCH 111/253] No longer use menu_entry_alloc --- menu/drivers/xmb.c | 147 +++++++++++++++++++------------------- menu/widgets/menu_entry.c | 8 --- menu/widgets/menu_entry.h | 2 - 3 files changed, 74 insertions(+), 83 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index ffdd5ec375..a47760bba1 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -236,7 +236,7 @@ typedef struct xmb_handle char box_message[1024]; char background_file_path[PATH_MAX_LENGTH]; char thumbnail_system[PATH_MAX_LENGTH]; - char thumbnail_content[PATH_MAX_LENGTH]; + char *thumbnail_content; char thumbnail_file_path[PATH_MAX_LENGTH]; char savestate_thumbnail_file_path[PATH_MAX_LENGTH]; @@ -915,7 +915,7 @@ end: static void xmb_update_thumbnail_path(void *data, unsigned i) { - menu_entry_t *entry = menu_entry_alloc(); + menu_entry_t entry; unsigned entry_type = 0; char *scrub_char_pointer = NULL; settings_t *settings = config_get_ptr(); @@ -929,10 +929,10 @@ static void xmb_update_thumbnail_path(void *data, unsigned i) if (!xmb) goto end; - menu_entry_init(entry); - menu_entry_get(entry, 0, i, NULL, true); + menu_entry_init(&entry); + menu_entry_get(&entry, 0, i, NULL, true); - entry_type = menu_entry_get_type_new(entry); + entry_type = menu_entry_get_type_new(&entry); if (entry_type == FILE_TYPE_IMAGEVIEWER || entry_type == FILE_TYPE_IMAGE) { @@ -942,11 +942,12 @@ static void xmb_update_thumbnail_path(void *data, unsigned i) if (node && node->fullpath) { - fill_pathname_join( - xmb->thumbnail_file_path, - node->fullpath, - entry->path, - sizeof(xmb->thumbnail_file_path)); + if (entry.path && !string_is_empty(entry.path)) + fill_pathname_join( + xmb->thumbnail_file_path, + node->fullpath, + entry.path, + sizeof(xmb->thumbnail_file_path)); goto end; } @@ -967,8 +968,9 @@ static void xmb_update_thumbnail_path(void *data, unsigned i) if (string_is_equal(core_name, "imageviewer")) { - strlcpy(xmb->thumbnail_file_path, entry->label, - sizeof(xmb->thumbnail_file_path)); + if (entry.label && !string_is_empty(entry.label)) + strlcpy(xmb->thumbnail_file_path, entry.label, + sizeof(xmb->thumbnail_file_path)); goto end; } } @@ -987,57 +989,58 @@ static void xmb_update_thumbnail_path(void *data, unsigned i) * http://datomatic.no-intro.org/stuff/The%20Official%20No-Intro%20Convention%20(20071030).zip * Replace these characters in the entry name with underscores. */ - tmp = strdup(xmb->thumbnail_content); + if (xmb->thumbnail_content && !string_is_empty(xmb->thumbnail_content)) + tmp = strdup(xmb->thumbnail_content); - while((scrub_char_pointer = strpbrk(tmp, "&*/:`<>?\\|"))) - *scrub_char_pointer = '_'; + if (tmp && !string_is_empty(tmp)) + { + while((scrub_char_pointer = strpbrk(tmp, "&*/:`<>?\\|"))) + *scrub_char_pointer = '_'; + } /* Look for thumbnail file with this scrubbed filename */ tmp_new[0] = '\0'; - fill_pathname_join(tmp_new, - xmb->thumbnail_file_path, - tmp, PATH_MAX_LENGTH * sizeof(char)); - strlcpy(xmb->thumbnail_file_path, - tmp_new, sizeof(xmb->thumbnail_file_path)); - free(tmp); + if (tmp && !string_is_empty(tmp)) + { + fill_pathname_join(tmp_new, + xmb->thumbnail_file_path, + tmp, PATH_MAX_LENGTH * sizeof(char)); + strlcpy(xmb->thumbnail_file_path, + tmp_new, sizeof(xmb->thumbnail_file_path)); + free(tmp); + } strlcat(xmb->thumbnail_file_path, file_path_str(FILE_PATH_PNG_EXTENSION), sizeof(xmb->thumbnail_file_path)); end: - menu_entry_free(entry); - if (entry) - free(entry); + menu_entry_free(&entry); free(tmp_new); } static void xmb_update_savestate_thumbnail_path(void *data, unsigned i) { - menu_entry_t *entry = menu_entry_alloc(); + menu_entry_t entry; settings_t *settings = config_get_ptr(); xmb_handle_t *xmb = (xmb_handle_t*)data; playlist_t *playlist = NULL; if (!xmb) - { - if (entry) - free(entry); return; - } - menu_entry_init(entry); - menu_entry_get(entry, 0, i, NULL, true); + menu_entry_init(&entry); + menu_entry_get(&entry, 0, i, NULL, true); menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &playlist); xmb->savestate_thumbnail_file_path[0] = '\0'; if ( (settings->bools.savestate_thumbnail_enable) - && ((string_is_equal_fast(entry->label, "state_slot", 10)) - || (string_is_equal_fast(entry->label, "loadstate", 9)) - || (string_is_equal_fast(entry->label, "savestate", 9)))) + && ((string_is_equal_fast(entry.label, "state_slot", 10)) + || (string_is_equal_fast(entry.label, "loadstate", 9)) + || (string_is_equal_fast(entry.label, "savestate", 9)))) { size_t path_size = 8024 * sizeof(char); char *path = (char*)malloc(8204 * sizeof(char)); @@ -1068,8 +1071,7 @@ static void xmb_update_savestate_thumbnail_path(void *data, unsigned i) free(path); } - menu_entry_free(entry); - free(entry); + menu_entry_free(&entry); } static void xmb_update_thumbnail_image(void *data) @@ -1099,8 +1101,9 @@ static void xmb_reset_thumbnail_content(void *data) xmb_handle_t *xmb = (xmb_handle_t*)data; if (!xmb) return; - memset(xmb->thumbnail_content, 0, sizeof(xmb->thumbnail_content)); - xmb->thumbnail_content[0] = '\0'; + if (xmb->thumbnail_content && !string_is_empty(xmb->thumbnail_content)) + free(xmb->thumbnail_content); + xmb->thumbnail_content = NULL; } static void xmb_set_thumbnail_content(void *data, char *s, size_t len) @@ -1109,7 +1112,7 @@ static void xmb_set_thumbnail_content(void *data, char *s, size_t len) if (!xmb) return; - strlcpy(xmb->thumbnail_content, s, len); + xmb->thumbnail_content = strdup(s); } static void xmb_update_savestate_thumbnail_image(void *data) @@ -1130,7 +1133,7 @@ static void xmb_selection_pointer_changed( { unsigned i, end, height; menu_animation_ctx_tag tag; - menu_entry_t *entry = menu_entry_alloc(); + menu_entry_t entry; size_t num = 0; int threshold = 0; menu_list_t *menu_list = NULL; @@ -1143,8 +1146,8 @@ static void xmb_selection_pointer_changed( if (!xmb) goto end; - menu_entry_init(entry); - menu_entry_get(entry, 0, selection, NULL, true); + menu_entry_init(&entry); + menu_entry_get(&entry, 0, selection, NULL, true); end = (unsigned)menu_entries_get_end(); threshold = xmb->icon_size * 10; @@ -1174,7 +1177,7 @@ static void xmb_selection_pointer_changed( { unsigned depth = (unsigned)xmb_list_get_size(xmb, MENU_LIST_PLAIN); size_t xmb_list = xmb_list_get_selection(xmb); - unsigned entry_type = menu_entry_get_type_new(entry); + unsigned entry_type = menu_entry_get_type_new(&entry); ia = xmb->items_active_alpha; iz = xmb->items_active_zoom; @@ -1185,7 +1188,8 @@ static void xmb_selection_pointer_changed( if ((xmb_list > XMB_SYSTEM_TAB_SETTINGS && depth == 1) || (xmb_list < XMB_SYSTEM_TAB_SETTINGS && depth == 4)) { - xmb_set_thumbnail_content(xmb, entry->path, sizeof(entry->path)); + if (entry.path && !string_is_empty(entry.path)) + xmb_set_thumbnail_content(xmb, entry.path, 0 /* will be ignored */); xmb_update_thumbnail_path(xmb, i); xmb_update_thumbnail_image(xmb); } @@ -1193,7 +1197,8 @@ static void xmb_selection_pointer_changed( entry_type == FILE_TYPE_RDB || entry_type == FILE_TYPE_RDB_ENTRY) && xmb_list <= XMB_SYSTEM_TAB_SETTINGS)) { - xmb_set_thumbnail_content(xmb, entry->path, sizeof(entry->path)); + if (entry.path && !string_is_empty(entry.path)) + xmb_set_thumbnail_content(xmb, entry.path, 0 /* will be ignored */); xmb_update_thumbnail_path(xmb, i); xmb_update_thumbnail_image(xmb); } @@ -1246,9 +1251,7 @@ static void xmb_selection_pointer_changed( } end: - menu_entry_free(entry); - if (entry) - free(entry); + menu_entry_free(&entry); } static void xmb_list_open_old(xmb_handle_t *xmb, @@ -1428,25 +1431,25 @@ static xmb_node_t* xmb_get_userdata_from_horizontal_list( static void xmb_push_animations(xmb_node_t *node, uintptr_t tag, float ia, float ix) { - menu_animation_ctx_entry_t entry; + menu_animation_ctx_entry_t anim_entry; - entry.duration = XMB_DELAY; - entry.target_value = ia; - entry.subject = &node->alpha; - entry.easing_enum = EASING_OUT_QUAD; - entry.tag = tag; - entry.cb = NULL; + anim_entry.duration = XMB_DELAY; + anim_entry.target_value = ia; + anim_entry.subject = &node->alpha; + anim_entry.easing_enum = EASING_OUT_QUAD; + anim_entry.tag = tag; + anim_entry.cb = NULL; - menu_animation_push(&entry); + menu_animation_push(&anim_entry); - entry.subject = &node->label_alpha; + anim_entry.subject = &node->label_alpha; - menu_animation_push(&entry); + menu_animation_push(&anim_entry); - entry.target_value = ix; - entry.subject = &node->x; + anim_entry.target_value = ix; + anim_entry.subject = &node->x; - menu_animation_push(&entry); + menu_animation_push(&anim_entry); } static void xmb_list_switch_old(xmb_handle_t *xmb, @@ -1707,16 +1710,15 @@ static void xmb_list_switch(xmb_handle_t *xmb) if (!string_is_equal(xmb_thumbnails_ident(), msg_hash_to_str(MENU_ENUM_LABEL_VALUE_OFF))) { - menu_entry_t *entry = menu_entry_alloc(); + menu_entry_t entry; - menu_entry_init(entry); - menu_entry_get(entry, 0, selection, NULL, true); + menu_entry_init(&entry); + menu_entry_get(&entry, 0, selection, NULL, true); - xmb_set_thumbnail_content(xmb, - entry->path, sizeof(entry->path)); + if (entry.path && !string_is_empty(entry.path)) + xmb_set_thumbnail_content(xmb, entry.path, 0 /* will be ignored */); - menu_entry_free(entry); - free(entry); + menu_entry_free(&entry); xmb_update_thumbnail_path(xmb, 0); xmb_update_thumbnail_image(xmb); @@ -2544,17 +2546,16 @@ static void xmb_draw_items( for (i = first; i <= last; i++) { - menu_entry_t *entry = menu_entry_alloc(); - int ret = xmb_draw_item(menu_disp_info, - entry, + menu_entry_t entry; + int ret = xmb_draw_item(menu_disp_info, + &entry, &mymat, xmb, core_node, list, color, thumb_ident, frame_count, i, current, width, height); - menu_entry_free(entry); - free(entry); + menu_entry_free(&entry); if (ret == -1) break; } diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index 865bba11d1..aa339d553d 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -91,14 +91,6 @@ void menu_entry_free(menu_entry_t *entry) free(entry->value); } -menu_entry_t *menu_entry_alloc(void) -{ - menu_entry_t *entry = (menu_entry_t*)malloc(sizeof(menu_entry_t)); - if (!entry) - return NULL; - return entry; -} - void menu_entry_init(menu_entry_t *entry) { entry->path = NULL; diff --git a/menu/widgets/menu_entry.h b/menu/widgets/menu_entry.h index 9fd3be13b8..2fe2090151 100644 --- a/menu/widgets/menu_entry.h +++ b/menu/widgets/menu_entry.h @@ -117,8 +117,6 @@ int menu_entry_action(menu_entry_t *entry, void menu_entry_free(menu_entry_t *entry); -menu_entry_t *menu_entry_alloc(void); - void menu_entry_init(menu_entry_t *entry); RETRO_END_DECLS From efde859e17af314ff1c03a91237b176bc6ee6874 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 18:46:53 +0200 Subject: [PATCH 112/253] Rewrite menu_entry_get_rich_label --- menu/drivers/materialui.c | 10 ++++++---- menu/drivers/rgui.c | 8 +++++--- menu/drivers/xmb.c | 10 +++++++--- menu/drivers/zarch.c | 10 +++++++--- menu/widgets/menu_entry.c | 9 ++++----- menu/widgets/menu_entry.h | 2 +- 6 files changed, 30 insertions(+), 19 deletions(-) diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 13c4e2e5dc..71f335ad19 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -997,15 +997,14 @@ static void mui_render_menu_list( for (i = 0; i < entries_end; i++) { menu_entry_t entry; - char rich_label[255]; char entry_value[255]; + char *rich_label = NULL; bool entry_selected = false; mui_node_t *node = (mui_node_t*) menu_entries_get_userdata_at_offset(list, i); size_t selection = menu_navigation_get_selection(); int y = header_height - mui->scroll_y + sum; - rich_label[0] = - entry_value[0] = '\0'; + entry_value[0] = '\0'; sum += node->line_height; @@ -1018,7 +1017,7 @@ static void mui_render_menu_list( menu_entry_init(&entry); menu_entry_get(&entry, 0, (unsigned)i, NULL, true); menu_entry_get_value(&entry, entry_value, sizeof(entry_value)); - menu_entry_get_rich_label(&entry, rich_label, sizeof(rich_label)); + rich_label = menu_entry_get_rich_label(&entry); entry_selected = selection == i; @@ -1040,6 +1039,9 @@ static void mui_render_menu_list( sublabel_color ); + if (rich_label && !string_is_empty(rich_label)) + free(rich_label); + menu_entry_free(&entry); } } diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index b518b8254a..4f2ad22619 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -566,11 +566,11 @@ static void rgui_render(void *data, bool is_idle) { menu_entry_t entry; menu_animation_ctx_ticker_t ticker; - char entry_path[255]; char entry_value[255]; char message[255]; char entry_title_buf[255]; char type_str_buf[255]; + char *entry_path = NULL; unsigned entry_spacing = 0; size_t entry_title_buf_utf8len = 0; size_t entry_title_buf_len = 0; @@ -580,7 +580,6 @@ static void rgui_render(void *data, bool is_idle) if (i > (selection + 100)) continue; - entry_path[0] = '\0'; entry_value[0] = '\0'; message[0] = '\0'; entry_title_buf[0] = '\0'; @@ -591,7 +590,7 @@ static void rgui_render(void *data, bool is_idle) entry_spacing = menu_entry_get_spacing(&entry); menu_entry_get_value(&entry, entry_value, sizeof(entry_value)); - menu_entry_get_rich_label(&entry, entry_path, sizeof(entry_path)); + entry_path = menu_entry_get_rich_label(&entry); ticker.s = entry_title_buf; ticker.len = RGUI_TERM_WIDTH(fb_width) - (entry_spacing + 1 + 2); @@ -623,6 +622,8 @@ static void rgui_render(void *data, bool is_idle) entry_selected ? hover_color : normal_color); menu_entry_free(&entry); + if (entry_path && !string_is_empty(entry_path)) + free(entry_path); } if (menu_input_dialog_get_display_kb()) @@ -650,6 +651,7 @@ static void rgui_render(void *data, bool is_idle) if (settings->bools.menu_mouse_enable && cursor_visible) rgui_blit_cursor(); } + } static void rgui_framebuffer_free(void) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index a47760bba1..a99d327d80 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2272,8 +2272,8 @@ static int xmb_draw_item( { float icon_x, icon_y, label_offset; menu_animation_ctx_ticker_t ticker; - char ticker_str[PATH_MAX_LENGTH]; char tmp[255]; + char *ticker_str = NULL; unsigned entry_type = 0; const float half_size = xmb->icon_size / 2.0f; uintptr_t texture_switch = 0; @@ -2285,7 +2285,7 @@ static int xmb_draw_item( if (!node) goto iterate; - ticker_str[0] = tmp[0] = '\0'; + tmp[0] = '\0'; menu_entry_init(entry); @@ -2364,7 +2364,7 @@ static int xmb_draw_item( ticker_limit = 70; } - menu_entry_get_rich_label(entry, ticker_str, sizeof(ticker_str)); + ticker_str = menu_entry_get_rich_label(entry); ticker.s = tmp; ticker.len = ticker_limit; @@ -2483,9 +2483,13 @@ static int xmb_draw_item( xmb->shadow_offset); iterate: + if (ticker_str && !string_is_empty(ticker_str)) + free(ticker_str); return 0; end: + if (ticker_str && !string_is_empty(ticker_str)) + free(ticker_str); return -1; } diff --git a/menu/drivers/zarch.c b/menu/drivers/zarch.c index 82cd00b714..3473ed85cd 100644 --- a/menu/drivers/zarch.c +++ b/menu/drivers/zarch.c @@ -514,15 +514,15 @@ static int zarch_zui_render_lay_root_recent( for (i = zui->recent_dlist_first; i < size; ++i) { - char rich_label[PATH_MAX_LENGTH]; char entry_value[PATH_MAX_LENGTH]; menu_entry_t entry; + char *rich_label = NULL; - rich_label[0] = entry_value[0] = '\0'; + entry_value[0] = '\0'; menu_entry_init(&entry); menu_entry_get(&entry, 0, i, NULL, true); - menu_entry_get_rich_label(&entry, rich_label, sizeof(rich_label)); + rich_label = menu_entry_get_rich_label(&entry); menu_entry_get_value(&entry, entry_value,sizeof(entry_value)); if (zarch_zui_list_item( @@ -534,12 +534,16 @@ static int zarch_zui_render_lay_root_recent( if (menu_entry_action(&entry, i, MENU_ACTION_OK)) { menu_entry_free(&entry); + if (rich_label && !string_is_empty(rich_label)) + free(rich_label); return 1; } } j++; menu_entry_free(&entry); + if (rich_label && !string_is_empty(rich_label)) + free(rich_label); } } diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index aa339d553d..01844ea054 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -112,14 +112,13 @@ void menu_entry_get_path(menu_entry_t *entry, char *s, size_t len) strlcpy(s, entry->path, len); } -void menu_entry_get_rich_label(menu_entry_t *entry, char *s, size_t len) +char *menu_entry_get_rich_label(menu_entry_t *entry) { if (!entry) - return; + return NULL; if (!string_is_empty(entry->rich_label)) - strlcpy(s, entry->rich_label, len); - else - strlcpy(s, entry->path, len); + return strdup(entry->rich_label); + return strdup(entry->path); } bool menu_entry_get_sublabel(menu_entry_t *entry, char *s, size_t len) diff --git a/menu/widgets/menu_entry.h b/menu/widgets/menu_entry.h index 2fe2090151..8d8affe448 100644 --- a/menu/widgets/menu_entry.h +++ b/menu/widgets/menu_entry.h @@ -91,7 +91,7 @@ void menu_entry_pathdir_extensions(uint32_t i, char *s, size_t len); void menu_entry_reset(uint32_t i); -void menu_entry_get_rich_label(menu_entry_t *entry, char *s, size_t len); +char *menu_entry_get_rich_label(menu_entry_t *entry); bool menu_entry_get_sublabel(menu_entry_t *entry, char *s, size_t len); From 1c477ca00728254aed07cd0d6eb6267579e7e333 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 18:52:15 +0200 Subject: [PATCH 113/253] Rewrite menu_entry_get_sublabel --- menu/drivers/materialui.c | 49 +++++++++++++++++++++++---------------- menu/widgets/menu_entry.c | 10 ++++---- menu/widgets/menu_entry.h | 2 +- 3 files changed, 34 insertions(+), 27 deletions(-) diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 71f335ad19..b328f98b10 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -669,13 +669,11 @@ static void mui_compute_entries_box(mui_handle_t* mui, int width) for (i = 0; i < entries_end; i++) { menu_entry_t entry; - char sublabel_str[255]; - unsigned lines = 0; - mui_node_t *node = (mui_node_t*) + char *sublabel_str = NULL; + unsigned lines = 0; + mui_node_t *node = (mui_node_t*) menu_entries_get_userdata_at_offset(list, i); - sublabel_str[0] = '\0'; - menu_entry_init(&entry); menu_entry_get(&entry, 0, i, NULL, true); @@ -683,12 +681,18 @@ static void mui_compute_entries_box(mui_handle_t* mui, int width) if (node->texture_switch2_set) texture_switch2 = node->texture_switch2; - if (menu_entry_get_sublabel(&entry, sublabel_str, sizeof(sublabel_str))) - { - int icon_margin = texture_switch2 ? mui->icon_size : 0; + sublabel_str = menu_entry_get_sublabel(&entry); - word_wrap(sublabel_str, sublabel_str, (int)((usable_width - icon_margin) / mui->glyph_width2), false); - lines = mui_count_lines(sublabel_str); + if (sublabel_str) + { + if (!string_is_empty(sublabel_str)) + { + int icon_margin = texture_switch2 ? mui->icon_size : 0; + + word_wrap(sublabel_str, sublabel_str, (int)((usable_width - icon_margin) / mui->glyph_width2), false); + lines = mui_count_lines(sublabel_str); + } + free(sublabel_str); } node->line_height = (scale_factor / 3) + (lines * mui->font->size); @@ -811,8 +815,8 @@ static void mui_render_label_value(mui_handle_t *mui, mui_node_t *node, menu_entry_t entry; menu_animation_ctx_ticker_t ticker; char label_str[255]; - char sublabel_str[255]; char value_str[255]; + char *sublabel_str = NULL; bool switch_is_on = true; int value_len = (int)utf8len(value); int ticker_limit = 0; @@ -823,8 +827,7 @@ static void mui_render_label_value(mui_handle_t *mui, mui_node_t *node, enum msg_file_type hash_type = msg_hash_to_file_type(msg_hash_calculate(value)); float scale_factor = menu_display_get_dpi(); - label_str[0] = value_str[0] = - sublabel_str[0] = '\0'; + label_str[0] = value_str[0] = '\0'; menu_entry_init(&entry); menu_entry_get(&entry, 0, i, NULL, true); @@ -914,17 +917,23 @@ static void mui_render_label_value(mui_handle_t *mui, mui_node_t *node, } } + sublabel_str = menu_entry_get_sublabel(&entry); + /* Sublabel */ - if (menu_entry_get_sublabel(&entry, sublabel_str, sizeof(sublabel_str))) + if (sublabel_str) { - int icon_margin = texture_switch2 ? mui->icon_size : 0; + if (!string_is_empty(sublabel_str)) + { + int icon_margin = texture_switch2 ? mui->icon_size : 0; - word_wrap(sublabel_str, sublabel_str, (int)((usable_width - icon_margin) / mui->glyph_width2), false); + word_wrap(sublabel_str, sublabel_str, (int)((usable_width - icon_margin) / mui->glyph_width2), false); - menu_display_draw_text(mui->font2, sublabel_str, - mui->margin + (texture_switch2 ? mui->icon_size : 0), - y + (scale_factor / 4) + mui->font->size, - width, height, sublabel_color, TEXT_ALIGN_LEFT, 1.0f, false, 0); + menu_display_draw_text(mui->font2, sublabel_str, + mui->margin + (texture_switch2 ? mui->icon_size : 0), + y + (scale_factor / 4) + mui->font->size, + width, height, sublabel_color, TEXT_ALIGN_LEFT, 1.0f, false, 0); + } + free(sublabel_str); } menu_display_draw_text(mui->font, label_str, diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index 01844ea054..4f59f771b4 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -121,15 +121,13 @@ char *menu_entry_get_rich_label(menu_entry_t *entry) return strdup(entry->path); } -bool menu_entry_get_sublabel(menu_entry_t *entry, char *s, size_t len) +char *menu_entry_get_sublabel(menu_entry_t *entry) { if (!entry) - return false; + return NULL; if (string_is_empty(entry->sublabel)) - return false; - - strlcpy(s, entry->sublabel, len); - return true; + return NULL; + return strdup(entry->sublabel); } void menu_entry_get_label(menu_entry_t *entry, char *s, size_t len) diff --git a/menu/widgets/menu_entry.h b/menu/widgets/menu_entry.h index 8d8affe448..bec3a67674 100644 --- a/menu/widgets/menu_entry.h +++ b/menu/widgets/menu_entry.h @@ -93,7 +93,7 @@ void menu_entry_reset(uint32_t i); char *menu_entry_get_rich_label(menu_entry_t *entry); -bool menu_entry_get_sublabel(menu_entry_t *entry, char *s, size_t len); +char *menu_entry_get_sublabel(menu_entry_t *entry); void menu_entry_get_value(menu_entry_t *entry, char *s, size_t len); From 4639b2547da74a0e49f181100cd684f48d84d4cf Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 19:09:11 +0200 Subject: [PATCH 114/253] Rewrite another function --- menu/drivers/xui.cpp | 6 ++-- menu/widgets/menu_entry.c | 8 ++--- menu/widgets/menu_entry.h | 2 +- ui/drivers/cocoa/cocoatouch_menu.m | 51 +++++++++++++++++++++--------- 4 files changed, 45 insertions(+), 22 deletions(-) diff --git a/menu/drivers/xui.cpp b/menu/drivers/xui.cpp index ae2c27cb6d..1da440c27c 100644 --- a/menu/drivers/xui.cpp +++ b/menu/drivers/xui.cpp @@ -592,7 +592,7 @@ static void xui_render(void *data, bool is_idle) for (i = 0; i < end; i++) { menu_entry_t entry; - char entry_path[PATH_MAX_LENGTH] = {0}; + char *entry_path = NULL; char entry_value[PATH_MAX_LENGTH] = {0}; wchar_t msg_right[PATH_MAX_LENGTH] = {0}; wchar_t msg_left[PATH_MAX_LENGTH] = {0}; @@ -601,13 +601,15 @@ static void xui_render(void *data, bool is_idle) menu_entry_get(&entry, 0, i, NULL, true); menu_entry_get_value(&entry, entry_value, sizeof(entry_value)); - menu_entry_get_path(&entry, entry_path, sizeof(entry_path)); + entry_path = menu_entry_get_path(&entry); mbstowcs(msg_left, entry_path, sizeof(msg_left) / sizeof(wchar_t)); mbstowcs(msg_right, entry_value, sizeof(msg_right) / sizeof(wchar_t)); xui_set_list_text(i, msg_left, msg_right); menu_entry_free(&entry); + if (entry_path && !string_is_empty(entry_path)) + free(entry_path); } selection = menu_navigation_get_selection(); diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index 4f59f771b4..f49f7ddeee 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -105,11 +105,11 @@ void menu_entry_init(menu_entry_t *entry) entry->spacing = 0; } -void menu_entry_get_path(menu_entry_t *entry, char *s, size_t len) +char *menu_entry_get_path(menu_entry_t *entry) { - if (!entry) - return; - strlcpy(s, entry->path, len); + if (!entry || string_is_empty(entry->path)) + return NULL; + return strdup(entry->path); } char *menu_entry_get_rich_label(menu_entry_t *entry) diff --git a/menu/widgets/menu_entry.h b/menu/widgets/menu_entry.h index bec3a67674..b32ec148ee 100644 --- a/menu/widgets/menu_entry.h +++ b/menu/widgets/menu_entry.h @@ -59,7 +59,7 @@ typedef struct menu_entry enum menu_entry_type menu_entry_get_type(uint32_t i); -void menu_entry_get_path(menu_entry_t *entry, char *s, size_t len); +char *menu_entry_get_path(menu_entry_t *entry); void menu_entry_get_label(menu_entry_t *entry, char *s, size_t len); diff --git a/ui/drivers/cocoa/cocoatouch_menu.m b/ui/drivers/cocoa/cocoatouch_menu.m index 22626fdacb..1f098ebd2f 100644 --- a/ui/drivers/cocoa/cocoatouch_menu.m +++ b/ui/drivers/cocoa/cocoatouch_menu.m @@ -113,7 +113,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, { menu_entry_t entry; char buffer[PATH_MAX_LENGTH]; - char label[PATH_MAX_LENGTH]; + char *label = NULL; static NSString* const cell_id = @"text"; self.parentTable = tableView; @@ -125,17 +125,22 @@ static void RunActionSheet(const char* title, const struct string_list* items, menu_entry_init(&entry); menu_entry_get(&entry, 0, (unsigned)self.i, NULL, true); - menu_entry_get_path(&entry, label, sizeof(label)); + label = menu_entry_get_path(&entry); menu_entry_get_value(&entry, buffer, sizeof(buffer)); - result.textLabel.text = BOXSTRING(label); - if (string_is_empty(label)) strlcpy(buffer, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NOT_AVAILABLE), sizeof(buffer)); + + if (label && !string_is_empty(label)) + result.textLabel.text = BOXSTRING(label); result.detailTextLabel.text = BOXSTRING(buffer); + menu_entry_free(&entry); + if (label && !string_is_empty(label)) + free(label); + return result; } @@ -153,7 +158,7 @@ static void RunActionSheet(const char* title, const struct string_list* items, - (UITableViewCell*)cellForTableView:(UITableView*)tableView { menu_entry_t entry; - char label[PATH_MAX_LENGTH]; + char *label = NULL; static NSString* const cell_id = @"boolean_setting"; UITableViewCell* result = @@ -169,9 +174,12 @@ static void RunActionSheet(const char* title, const struct string_list* items, menu_entry_init(&entry); menu_entry_get(&entry, 0, (unsigned)self.i, NULL, true); - menu_entry_get_path(&entry, label, sizeof(label)); - result.textLabel.text = BOXSTRING(label); + label = menu_entry_get_path(&entry); + + if (label && !string_is_empty(label)) + result.textLabel.text = BOXSTRING(label); + [(id)result.accessoryView removeTarget:nil action:NULL forControlEvents:UIControlEventValueChanged]; @@ -180,6 +188,8 @@ static void RunActionSheet(const char* title, const struct string_list* items, forControlEvents:UIControlEventValueChanged]; [(id)result.accessoryView setOn:(menu_entry_get_bool_value(self.i))]; menu_entry_free(&entry); + if (label && !string_is_empty(label)) + free(label); return result; } @@ -215,16 +225,18 @@ static void RunActionSheet(const char* title, const struct string_list* items, ofController:(UIViewController*)controller { menu_entry_t entry; - struct string_list* items; - char label[PATH_MAX_LENGTH]; + struct string_list* items = NULL; + char *label = NULL; RAMenuItemEnum __weak* weakSelf = self; menu_entry_init(&entry); menu_entry_get(&entry, 0, (unsigned)self.i, NULL, true); - menu_entry_get_path(&entry, label, sizeof(label)); + label = menu_entry_get_path(&entry); items = menu_entry_enum_values(self.i); - RunActionSheet(label, items, self.parentTable, + if (label && !string_is_empty(label)) + { + RunActionSheet(label, items, self.parentTable, ^(UIActionSheet* actionSheet, NSInteger buttonIndex) { if (buttonIndex == actionSheet.cancelButtonIndex) @@ -234,8 +246,11 @@ static void RunActionSheet(const char* title, const struct string_list* items, (self.i, [[actionSheet buttonTitleAtIndex:buttonIndex] UTF8String]); [weakSelf.parentTable reloadData]; }); + } string_list_free(items); menu_entry_free(&entry); + if (label && !string_is_empty(label)) + free(label); } @end @@ -250,13 +265,14 @@ static void RunActionSheet(const char* title, const struct string_list* items, ofController:(UIViewController *)controller { menu_entry_t entry; - char label[PATH_MAX_LENGTH]; + char *label = NULL; menu_entry_init(&entry); menu_entry_get(&entry, 0, (unsigned)self.i, NULL, true); - menu_entry_get_path(&entry, label, sizeof(label)); + label = menu_entry_get_path(&entry); self.alert = [[UIAlertView alloc] + initWithTitle:BOXSTRING("RetroArch") message:BOXSTRING(label) delegate:self @@ -275,6 +291,8 @@ static void RunActionSheet(const char* title, const struct string_list* items, userInfo:nil repeats:YES]; menu_entry_free(&entry); + if (label && !string_is_empty(label)) + free(label); } - (void)finishWithClickedButton:(bool)clicked @@ -426,14 +444,14 @@ replacementString:(NSString *)string { menu_entry_t entry; char buffer[PATH_MAX_LENGTH]; - char label[PATH_MAX_LENGTH]; + char *label = NULL; UIAlertView *alertView = NULL; UITextField *field = NULL; NSString *desc = NULL; menu_entry_init(&entry); menu_entry_get(&entry, 0, (unsigned)self.i, NULL, true); - menu_entry_get_path(&entry, label, sizeof(label)); + label = menu_entry_get_path(&entry); desc = BOXSTRING(label); @@ -458,6 +476,9 @@ replacementString:(NSString *)string menu_entry_free(&entry); + if (label && !string_is_empty(label)) + free(label); + [alertView show]; } From 8e01424450eca669b21f801beb8ed2da0c7c8544 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 19:55:06 +0200 Subject: [PATCH 115/253] Refactor and rewrite big char arrays --- menu/drivers/xmb.c | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index a99d327d80..a709cf5743 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -233,12 +233,12 @@ typedef struct xmb_handle uint64_t frame_count; char title_name[255]; - char box_message[1024]; - char background_file_path[PATH_MAX_LENGTH]; - char thumbnail_system[PATH_MAX_LENGTH]; + char *box_message; + char *thumbnail_system; char *thumbnail_content; + char *savestate_thumbnail_file_path; + char background_file_path[PATH_MAX_LENGTH]; char thumbnail_file_path[PATH_MAX_LENGTH]; - char savestate_thumbnail_file_path[PATH_MAX_LENGTH]; file_list_t *selection_buf_old; file_list_t *horizontal_list; @@ -747,7 +747,7 @@ static void xmb_messagebox(void *data, const char *message) if (!xmb || string_is_empty(message)) return; - strlcpy(xmb->box_message, message, sizeof(xmb->box_message)); + xmb->box_message = strdup(message); } static void xmb_render_keyboard(xmb_handle_t *xmb, @@ -975,6 +975,8 @@ static void xmb_update_thumbnail_path(void *data, unsigned i) } } + if (xmb->thumbnail_system && + !string_is_empty(xmb->thumbnail_system)) fill_pathname_join( xmb->thumbnail_file_path, settings->paths.directory_thumbnails, @@ -1035,7 +1037,8 @@ static void xmb_update_savestate_thumbnail_path(void *data, unsigned i) menu_driver_ctl(RARCH_MENU_CTL_PLAYLIST_GET, &playlist); - xmb->savestate_thumbnail_file_path[0] = '\0'; + if (xmb->savestate_thumbnail_file_path) + free(xmb->savestate_thumbnail_file_path); if ( (settings->bools.savestate_thumbnail_enable) && ((string_is_equal_fast(entry.label, "state_slot", 10)) @@ -1063,10 +1066,7 @@ static void xmb_update_savestate_thumbnail_path(void *data, unsigned i) strlcat(path, file_path_str(FILE_PATH_PNG_EXTENSION), path_size); if (path_file_exists(path)) - { - strlcpy(xmb->savestate_thumbnail_file_path, path, - sizeof(xmb->savestate_thumbnail_file_path)); - } + xmb->savestate_thumbnail_file_path = strdup(path); free(path); } @@ -1093,7 +1093,10 @@ static void xmb_set_thumbnail_system(void *data, char*s, size_t len) if (!xmb) return; - strlcpy(xmb->thumbnail_system, s, len); + if (xmb->thumbnail_system && + !string_is_empty(xmb->thumbnail_system)) + free(xmb->thumbnail_system); + xmb->thumbnail_system = strdup(s); } static void xmb_reset_thumbnail_content(void *data) @@ -1121,7 +1124,9 @@ static void xmb_update_savestate_thumbnail_image(void *data) if (!xmb) return; - if (path_file_exists(xmb->savestate_thumbnail_file_path)) + if (xmb->savestate_thumbnail_file_path + && !string_is_empty(xmb->savestate_thumbnail_file_path) + && path_file_exists(xmb->savestate_thumbnail_file_path)) task_push_image_load(xmb->savestate_thumbnail_file_path, menu_display_handle_savestate_thumbnail_upload, NULL); else @@ -3107,11 +3112,13 @@ static void xmb_frame(void *data, video_frame_info_t *video_info) render_background = true; } - if (!string_is_empty(xmb->box_message)) + if (xmb->box_message && + !string_is_empty(xmb->box_message)) { strlcpy(msg, xmb->box_message, sizeof(msg)); - xmb->box_message[0] = '\0'; + free(xmb->box_message); + xmb->box_message = NULL; render_background = true; } From 7f80ecbe9376667cb1f6fa210470b73e52039f4a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 19:57:23 +0200 Subject: [PATCH 116/253] (XMB) xmb_free - prevent memory leaks --- menu/drivers/xmb.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index a709cf5743..0263190999 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -3524,6 +3524,19 @@ static void xmb_free(void *data) video_coord_array_free(&xmb->raster_block.carr); video_coord_array_free(&xmb->raster_block2.carr); + + if (xmb->box_message && + !string_is_empty(xmb->box_message)) + free(xmb->box_message); + if (xmb->thumbnail_system && + !string_is_empty(xmb->thumbnail_system)) + free(xmb->thumbnail_system); + if (xmb->thumbnail_content && + !string_is_empty(xmb->thumbnail_content)) + free(xmb->thumbnail_content); + if (xmb->savestate_thumbnail_file_path && + !string_is_empty(xmb->savestate_thumbnail_file_path)) + free(xmb->savestate_thumbnail_file_path); } font_driver_bind_block(NULL, NULL); From 5da54b6f887b2a2bd7263b8b176ff6bf4faea6f8 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 19:59:19 +0200 Subject: [PATCH 117/253] (MUI) Rewrite box_message --- menu/drivers/materialui.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index b328f98b10..352360d2c7 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -168,7 +168,7 @@ typedef struct mui_handle uint64_t frame_count; - char box_message[1024]; + char *box_message; struct { @@ -572,7 +572,10 @@ static void mui_get_message(void *data, const char *message) if (!mui || !message || !*message) return; - strlcpy(mui->box_message, message, sizeof(mui->box_message)); + if (mui->box_message && + !string_is_empty(mui->box_message)) + free(mui->box_message); + mui->box_message = strdup(message); } /* Draw the modal */ @@ -1615,14 +1618,15 @@ static void mui_frame(void *data, video_frame_info_t *video_info) msg, &body_bg_color[0], font_hover_color); } - if (!string_is_empty(mui->box_message)) + if (mui->box_message && !string_is_empty(mui->box_message)) { menu_display_draw_quad(0, 0, width, height, width, height, &black_bg[0]); mui_render_messagebox(mui, video_info, mui->box_message, &body_bg_color[0], font_hover_color); - mui->box_message[0] = '\0'; + free(mui->box_message); + mui->box_message = NULL; } if (mui->mouse_show) From 4db14dca9a9aefcb3720bef4351822abe5c38fa0 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 20:01:00 +0200 Subject: [PATCH 118/253] (RGUI) Rewrite msgbox --- menu/drivers/rgui.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/menu/drivers/rgui.c b/menu/drivers/rgui.c index 4f2ad22619..3e663d8e25 100644 --- a/menu/drivers/rgui.c +++ b/menu/drivers/rgui.c @@ -59,7 +59,7 @@ typedef struct unsigned last_height; unsigned frame_count; float scroll_y; - char msgbox[4096]; + char *msgbox; } rgui_t; static uint16_t *rgui_framebuf_data = NULL; @@ -270,7 +270,10 @@ static void rgui_set_message(void *data, const char *message) if (!rgui || !message || !*message) return; - strlcpy(rgui->msgbox, message, sizeof(rgui->msgbox)); + if (rgui->msgbox && + !string_is_empty(rgui->msgbox)) + free(rgui->msgbox); + rgui->msgbox = strdup(message); rgui->force_redraw = true; } @@ -635,10 +638,11 @@ static void rgui_render(void *data, bool is_idle) rgui_render_messagebox(msg); } - if (!string_is_empty(rgui->msgbox)) + if (rgui->msgbox && !string_is_empty(rgui->msgbox)) { rgui_render_messagebox(rgui->msgbox); - rgui->msgbox[0] = '\0'; + free(rgui->msgbox); + rgui->msgbox = NULL; rgui->force_redraw = true; } From 3090f3ff3ad13e92743c480bce1f0ada371e4a48 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 20:47:54 +0200 Subject: [PATCH 119/253] (task_database.c) Rewrite char arrays --- input/input_remapping.c | 11 +++-- libretro-db/libretrodb.c | 20 ++++++-- menu/cbs/menu_cbs_get_value.c | 3 +- retroarch.c | 6 +++ retroarch.h | 2 +- tasks/task_database.c | 90 +++++++++++++++++++++-------------- 6 files changed, 87 insertions(+), 45 deletions(-) diff --git a/input/input_remapping.c b/input/input_remapping.c index 9f147bbf8c..ae68ab69e3 100644 --- a/input/input_remapping.c +++ b/input/input_remapping.c @@ -46,8 +46,10 @@ bool input_remapping_load_file(void *data, const char *path) if (!conf || string_is_empty(path)) return false; - strlcpy(global->name.remapfile, path, - sizeof(global->name.remapfile)); + if (global->name.remapfile + && !string_is_empty(global->name.remapfile)) + free(global->name.remapfile); + global->name.remapfile = strdup(path); for (i = 0; i < MAX_USERS; i++) { @@ -257,7 +259,10 @@ void input_remapping_set_defaults(bool deinit) if (deinit) { - global->name.remapfile[0] = '\0'; + if (global->name.remapfile + && !string_is_empty(global->name.remapfile)) + free(global->name.remapfile); + global->name.remapfile = NULL; rarch_ctl(RARCH_CTL_UNSET_REMAPS_CORE_ACTIVE, NULL); rarch_ctl(RARCH_CTL_UNSET_REMAPS_GAME_ACTIVE, NULL); } diff --git a/libretro-db/libretrodb.c b/libretro-db/libretrodb.c index 6667527c05..567d1be803 100644 --- a/libretro-db/libretrodb.c +++ b/libretro-db/libretrodb.c @@ -23,7 +23,7 @@ #include #include #ifdef _WIN32 -#include +#include #else #include #endif @@ -34,6 +34,7 @@ #include #include +#include #include #include "libretrodb.h" @@ -57,7 +58,7 @@ struct libretrodb uint64_t root; uint64_t count; uint64_t first_index_offset; - char path[1024]; + char *path; }; struct libretrodb_index @@ -205,7 +206,10 @@ void libretrodb_close(libretrodb_t *db) { if (db->fd) filestream_close(db->fd); - db->fd = NULL; + if (db->path && !string_is_empty(db->path)) + free(db->path); + db->path = NULL; + db->fd = NULL; } int libretrodb_open(const char *path, libretrodb_t *db) @@ -218,8 +222,11 @@ int libretrodb_open(const char *path, libretrodb_t *db) if (!fd) return -errno; - strlcpy(db->path, path, sizeof(db->path)); - db->root = filestream_seek(fd, 0, SEEK_CUR); + if (db->path && !string_is_empty(db->path)) + free(db->path); + + db->path = strdup(path); + db->root = filestream_seek(fd, 0, SEEK_CUR); if ((rv = (int)filestream_read(fd, &header, sizeof(header))) == -1) { @@ -421,6 +428,9 @@ void libretrodb_cursor_close(libretrodb_cursor_t *cursor) int libretrodb_cursor_open(libretrodb_t *db, libretrodb_cursor_t *cursor, libretrodb_query_t *q) { + if (!db || !db->path || string_is_empty(db->path)) + return -errno; + cursor->fd = filestream_open(db->path, RFILE_MODE_READ | RFILE_HINT_MMAP, -1); if (!cursor->fd) diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index d9bdc9a51c..94a3876b52 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -107,7 +107,8 @@ static void menu_action_setting_disp_set_label_remap_file_load( *w = 19; strlcpy(s2, path, len2); - if (global) + if (global && global->name.remapfile + && !string_is_empty(global->name.remapfile)) fill_pathname_base(s, global->name.remapfile, len); } diff --git a/retroarch.c b/retroarch.c index db45deaea9..08dfa2dd99 100644 --- a/retroarch.c +++ b/retroarch.c @@ -323,6 +323,12 @@ static void global_free(void) global = global_get_ptr(); path_clear_all(); dir_clear_all(); + if (global) + { + if (global->name.remapfile + && !string_is_empty(global->name.remapfile)) + free(global->name.remapfile); + } memset(global, 0, sizeof(struct global)); retroarch_override_setting_free_state(); } diff --git a/retroarch.h b/retroarch.h index 3e25a61630..badb2e000b 100644 --- a/retroarch.h +++ b/retroarch.h @@ -225,7 +225,7 @@ typedef struct global char ups[8192]; char bps[8192]; char ips[8192]; - char remapfile[8192]; + char *remapfile; } name; /* Recording. */ diff --git a/tasks/task_database.c b/tasks/task_database.c index 0d0d66e726..84c17c25b7 100644 --- a/tasks/task_database.c +++ b/tasks/task_database.c @@ -57,15 +57,14 @@ typedef struct database_state_handle typedef struct db_handle { - database_state_handle_t state; - database_info_handle_t *handle; - unsigned status; - char playlist_directory[4096]; - char content_database_path[4096]; - bool is_directory; - char fullpath[4096]; bool scan_started; + unsigned status; + char *playlist_directory; + char *content_database_path; + char *fullpath; + database_info_handle_t *handle; + database_state_handle_t state; } db_handle_t; int cue_find_track(const char *cue_path, bool first, size_t *offset, size_t *size, @@ -787,8 +786,11 @@ static int database_info_list_iterate_found_match( strlcat(db_playlist_base_str, file_path_str(FILE_PATH_LPL_EXTENSION), PATH_MAX_LENGTH * sizeof(char)); - fill_pathname_join(db_playlist_path, _db->playlist_directory, - db_playlist_base_str, PATH_MAX_LENGTH * sizeof(char)); + + if (_db->playlist_directory && + !string_is_empty(_db->playlist_directory)) + fill_pathname_join(db_playlist_path, _db->playlist_directory, + db_playlist_base_str, PATH_MAX_LENGTH * sizeof(char)); playlist = playlist_init(db_playlist_path, COLLECTION_SIZE); @@ -957,10 +959,12 @@ static int task_database_iterate_playlist_lutro( db_playlist_path[0] = '\0'; - fill_pathname_join(db_playlist_path, - _db->playlist_directory, - file_path_str(FILE_PATH_LUTRO_PLAYLIST), - PATH_MAX_LENGTH * sizeof(char)); + if (_db->playlist_directory && + !string_is_empty(_db->playlist_directory)) + fill_pathname_join(db_playlist_path, + _db->playlist_directory, + file_path_str(FILE_PATH_LUTRO_PLAYLIST), + PATH_MAX_LENGTH * sizeof(char)); playlist = playlist_init(db_playlist_path, COLLECTION_SIZE); @@ -1119,10 +1123,13 @@ static void task_database_handler(retro_task_t *task) { db->scan_started = true; - if (db->is_directory) - db->handle = database_info_dir_init(db->fullpath, DATABASE_TYPE_ITERATE, task); - else - db->handle = database_info_file_init(db->fullpath, DATABASE_TYPE_ITERATE, task); + if (db->fullpath && !string_is_empty(db->fullpath)) + { + if (db->is_directory) + db->handle = database_info_dir_init(db->fullpath, DATABASE_TYPE_ITERATE, task); + else + db->handle = database_info_file_init(db->fullpath, DATABASE_TYPE_ITERATE, task); + } task_free_title(task); @@ -1141,20 +1148,26 @@ static void task_database_handler(retro_task_t *task) case DATABASE_STATUS_ITERATE_BEGIN: if (dbstate && !dbstate->list) { - dbstate->list = dir_list_new_special( - db->content_database_path, - DIR_LIST_DATABASES, NULL); + if (db->content_database_path && + !string_is_empty(db->content_database_path)) + dbstate->list = dir_list_new_special( + db->content_database_path, + DIR_LIST_DATABASES, NULL); /* If the scan path matches a database path exactly then * save time by only processing that database. */ if (dbstate->list && db->is_directory) { - size_t i; - char *dirname = find_last_slash(db->fullpath) + 1; + size_t i; + char *dirname = NULL; + + if (db->fullpath && + !string_is_empty(db->fullpath)) + dirname = find_last_slash(db->fullpath) + 1; for (i = 0; i < dbstate->list->size; i++) { - char *dbname; + char *dbname; char *dbpath = strdup(dbstate->list->elems[i].data); path_remove_extension(dbpath); @@ -1166,7 +1179,7 @@ static void task_database_handler(retro_task_t *task) free(dbpath); single_list = string_list_new(); string_list_append(single_list, dbstate->list->elems[i].data, - dbstate->list->elems[i].attr); + dbstate->list->elems[i].attr); dir_list_free(dbstate->list); dbstate->list = single_list; break; @@ -1227,6 +1240,15 @@ task_finished: if (db) { + if (db->playlist_directory && + !string_is_empty(db->playlist_directory)) + free(db->playlist_directory); + if (db->content_database_path && + !string_is_empty(db->content_database_path)) + free(db->content_database_path); + if (db->fullpath && + !string_is_empty(db->fullpath)) + free(db->fullpath); if (db->state.buf) free(db->state.buf); @@ -1251,18 +1273,16 @@ bool task_push_dbscan( if (!t || !db) goto error; - t->handler = task_database_handler; - t->state = db; - t->callback = cb; - t->title = strdup(msg_hash_to_str(MSG_PREPARING_FOR_CONTENT_SCAN)); + t->handler = task_database_handler; + t->state = db; + t->callback = cb; + t->title = strdup(msg_hash_to_str(MSG_PREPARING_FOR_CONTENT_SCAN)); - db->is_directory = directory; - - strlcpy(db->fullpath, fullpath, sizeof(db->fullpath)); - strlcpy(db->playlist_directory, playlist_directory, - sizeof(db->playlist_directory)); - strlcpy(db->content_database_path, content_database, - sizeof(db->content_database_path)); + db->is_directory = directory; + db->playlist_directory = NULL; + db->fullpath = strdup(fullpath); + db->playlist_directory = strdup(playlist_directory); + db->content_database_path = strdup(content_database); task_queue_push(t); From 3490c3dbc5313a36c6f55352d3a67de2cc0ebd77 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 20:51:20 +0200 Subject: [PATCH 120/253] Cleanups --- tasks/task_database.c | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/tasks/task_database.c b/tasks/task_database.c index 84c17c25b7..65e7f5e962 100644 --- a/tasks/task_database.c +++ b/tasks/task_database.c @@ -44,15 +44,15 @@ typedef struct database_state_handle { - database_info_list_t *info; - struct string_list *list; - size_t list_index; - size_t entry_index; uint32_t crc; uint32_t archive_crc; + size_t list_index; + size_t entry_index; uint8_t *buf; char archive_name[511]; char serial[4096]; + database_info_list_t *info; + struct string_list *list; } database_state_handle_t; typedef struct db_handle @@ -67,14 +67,18 @@ typedef struct db_handle database_state_handle_t state; } db_handle_t; -int cue_find_track(const char *cue_path, bool first, size_t *offset, size_t *size, - char *track_path, size_t max_len); +int cue_find_track(const char *cue_path, bool first, + size_t *offset, size_t *size, + char *track_path, size_t max_len); -bool cue_next_file(intfstream_t *fd, const char *cue_path, char *path, size_t max_len); +bool cue_next_file(intfstream_t *fd, const char *cue_path, + char *path, size_t max_len); -int gdi_find_track(const char *gdi_path, bool first, char *track_path, size_t max_len); +int gdi_find_track(const char *gdi_path, bool first, + char *track_path, size_t max_len); -bool gdi_next_file(intfstream_t *fd, const char *gdi_path, char *path, size_t max_len); +bool gdi_next_file(intfstream_t *fd, const char *gdi_path, + char *path, size_t max_len); int detect_system(intfstream_t *fd, const char** system_name); @@ -266,7 +270,8 @@ static int intfstream_get_serial(intfstream_t *fd, char *serial) return 1; } -static bool intfstream_file_get_serial(const char *name, size_t offset, size_t size, char *serial) +static bool intfstream_file_get_serial(const char *name, + size_t offset, size_t size, char *serial) { int rv; uint8_t *data = NULL; @@ -775,10 +780,10 @@ static int database_info_list_iterate_found_match( database_info_t *db_info_entry = &db_state->info->list[db_state->entry_index]; - db_crc[0] = '\0'; - db_playlist_path[0] = '\0'; - db_playlist_base_str[0] = '\0'; - entry_path_str[0] = '\0'; + db_crc[0] = '\0'; + db_playlist_path[0] = '\0'; + db_playlist_base_str[0] = '\0'; + entry_path_str[0] = '\0'; fill_short_pathname_representation_noext(db_playlist_base_str, db_path, PATH_MAX_LENGTH * sizeof(char)); From 238de4aa5755118673d1af6e815f01c0578f45f5 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 20:56:54 +0200 Subject: [PATCH 121/253] Prevent memory leak --- menu/drivers/xmb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index 0263190999..dd1a2892da 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -1114,7 +1114,8 @@ static void xmb_set_thumbnail_content(void *data, char *s, size_t len) xmb_handle_t *xmb = (xmb_handle_t*)data; if (!xmb) return; - + if (xmb->thumbnail_content && !string_is_empty(xmb->thumbnail_content)) + free(xmb->thumbnail_content); xmb->thumbnail_content = strdup(s); } From f398f44253b361125dcf768c01a52f510915b7b3 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 21:00:56 +0200 Subject: [PATCH 122/253] Rewrite xmb_draw_item --- menu/drivers/xmb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index dd1a2892da..b13ab53401 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2293,8 +2293,6 @@ static int xmb_draw_item( tmp[0] = '\0'; - menu_entry_init(entry); - icon_y = xmb->margins_screen_top + node->y + half_size; if (icon_y < half_size) @@ -2309,7 +2307,6 @@ static int xmb_draw_item( if (icon_x < -half_size || icon_x > width) goto iterate; - menu_entry_get(entry, 0, i, list, true); entry_type = menu_entry_get_type_new(entry); if (entry_type == FILE_TYPE_CONTENTLIST_ENTRY) @@ -2556,8 +2553,11 @@ static void xmb_draw_items( for (i = first; i <= last; i++) { + int ret; menu_entry_t entry; - int ret = xmb_draw_item(menu_disp_info, + menu_entry_init(&entry); + menu_entry_get(&entry, 0, i, list, true); + ret = xmb_draw_item(menu_disp_info, &entry, &mymat, xmb, core_node, From 3551ac825c761c36691a8c0518346b6d39cf600e Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 21:05:23 +0200 Subject: [PATCH 123/253] Rewrite rich label allocation --- menu/widgets/menu_entry.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index f49f7ddeee..1c86f376f6 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -89,6 +89,11 @@ void menu_entry_free(menu_entry_t *entry) free(entry->path); if (entry->value && !string_is_empty(entry->value)) free(entry->value); + entry->path = NULL; + entry->label = NULL; + entry->value = NULL; + entry->sublabel = NULL; + entry->rich_label = NULL; } void menu_entry_init(menu_entry_t *entry) @@ -338,14 +343,17 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx, if (cbs->action_label) { - entry->rich_label = (char*)malloc(255 * - sizeof(char)); - entry->rich_label[0] = '\0'; + char richlabeltmp[255]; + richlabeltmp[0] = '\0'; + cbs->action_label(list, entry->type, (unsigned)i, label, path, - entry->rich_label, - 255 * sizeof(char)); + richlabeltmp, + sizeof(richlabeltmp)); + + if (!string_is_empty(richlabeltmp)) + entry->rich_label = strdup(richlabeltmp); } if (cbs->action_sublabel) From 01099d526cf2677d7a69cf67a2d903106c494b6d Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 21:10:03 +0200 Subject: [PATCH 124/253] Fix the other leaks in menu_entry_get --- menu/widgets/menu_entry.c | 38 ++++++++++++++++++++++---------------- 1 file changed, 22 insertions(+), 16 deletions(-) diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index 1c86f376f6..e7c8cf9ebf 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -328,44 +328,50 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx, if (cbs->action_get_value && use_representation) { - entry->value = (char*)malloc(255 * - sizeof(char)); - entry->value[0] = '\0'; + char tmp[255]; + tmp[0] = '\0'; + cbs->action_get_value(list, &entry->spacing, entry->type, (unsigned)i, label, entry->value, 255 * sizeof(char), entry_label, path, - newpath, - sizeof(newpath) + tmp, + sizeof(tmp) ); + + if (!string_is_empty(tmp)) + entry->value = strdup(tmp); } if (cbs->action_label) { - char richlabeltmp[255]; - richlabeltmp[0] = '\0'; + char tmp[255]; + tmp[0] = '\0'; cbs->action_label(list, entry->type, (unsigned)i, label, path, - richlabeltmp, - sizeof(richlabeltmp)); + tmp, + sizeof(tmp)); - if (!string_is_empty(richlabeltmp)) - entry->rich_label = strdup(richlabeltmp); + if (!string_is_empty(tmp)) + entry->rich_label = strdup(tmp); } if (cbs->action_sublabel) { - entry->sublabel = (char*)malloc(255 * - sizeof(char)); - entry->sublabel[0] = '\0'; + char tmp[255]; + tmp[0] = '\0'; + cbs->action_sublabel(list, entry->type, (unsigned)i, label, path, - entry->sublabel, - 255 * sizeof(char)); + tmp, + sizeof(tmp)); + + if (!string_is_empty(tmp)) + entry->sublabel = strdup(tmp); } } From 66de49c9878ddb4123085f34f813128ddd9634a9 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Fri, 29 Sep 2017 21:19:07 +0200 Subject: [PATCH 125/253] Fix memory leaks and crashes --- menu/cbs/menu_cbs_get_value.c | 6 ++++-- menu/drivers/xmb.c | 12 +++++++++--- menu/widgets/menu_entry.c | 10 +++++----- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/menu/cbs/menu_cbs_get_value.c b/menu/cbs/menu_cbs_get_value.c index 94a3876b52..26335824d9 100644 --- a/menu/cbs/menu_cbs_get_value.c +++ b/menu/cbs/menu_cbs_get_value.c @@ -626,7 +626,8 @@ static void menu_action_setting_disp_set_label_menu_more( { strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MORE), len); *w = 19; - strlcpy(s2, path, len2); + if (path && !string_is_empty(path)) + strlcpy(s2, path, len2); } static void menu_action_setting_disp_set_label_db_entry( @@ -640,7 +641,8 @@ static void menu_action_setting_disp_set_label_db_entry( { strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_MORE), len); *w = 10; - strlcpy(s2, path, len2); + if (path && !string_is_empty(path)) + strlcpy(s2, path, len2); } static void menu_action_setting_disp_set_label_entry( diff --git a/menu/drivers/xmb.c b/menu/drivers/xmb.c index b13ab53401..88a863a35f 100755 --- a/menu/drivers/xmb.c +++ b/menu/drivers/xmb.c @@ -2331,7 +2331,10 @@ static int xmb_draw_item( } else { - enum msg_file_type type = msg_hash_to_file_type(msg_hash_calculate(entry->value)); + enum msg_file_type type = FILE_TYPE_NONE; + + if (entry->value && !string_is_empty(entry->value)) + type = msg_hash_to_file_type(msg_hash_calculate(entry->value)); switch (type) { @@ -2409,10 +2412,13 @@ static int xmb_draw_item( ticker.s = tmp; ticker.len = 35; ticker.idx = frame_count / 20; - ticker.str = entry->value; ticker.selected = (i == current); - menu_animation_ticker(&ticker); + if (entry->value && !string_is_empty(entry->value)) + { + ticker.str = entry->value; + menu_animation_ticker(&ticker); + } if (do_draw_text) xmb_draw_text(menu_disp_info, xmb, tmp, diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index e7c8cf9ebf..2b9a0fca8e 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -264,7 +264,7 @@ void menu_entry_reset(uint32_t i) void menu_entry_get_value(menu_entry_t *entry, char *s, size_t len) { - if (!entry) + if (!entry || !entry->value || string_is_empty(entry->value)) return; strlcpy(s, entry->value, len); } @@ -333,11 +333,11 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx, cbs->action_get_value(list, &entry->spacing, entry->type, (unsigned)i, label, - entry->value, - 255 * sizeof(char), - entry_label, path, tmp, - sizeof(tmp) + sizeof(tmp), + entry_label, path, + newpath, + sizeof(newpath) ); if (!string_is_empty(tmp)) From 4fd00ac146f359c5efd7706c4f992de8f2fe5253 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 21:22:01 +0200 Subject: [PATCH 126/253] Be safer with this --- menu/widgets/menu_entry.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/menu/widgets/menu_entry.c b/menu/widgets/menu_entry.c index 2b9a0fca8e..7a4c51f7cb 100644 --- a/menu/widgets/menu_entry.c +++ b/menu/widgets/menu_entry.c @@ -386,7 +386,7 @@ void menu_entry_get(menu_entry_t *entry, size_t stack_idx, if (!string_is_empty(newpath)) entry->path = strdup(newpath); - if (entry_label) + if (entry_label && !string_is_empty(entry_label)) entry->label = strdup(entry_label); } From 542f87bf559e123988adbda6b86d8dedef0d243a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 21:29:34 +0200 Subject: [PATCH 127/253] Prevent leaks --- libretro-common/streams/file_stream.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libretro-common/streams/file_stream.c b/libretro-common/streams/file_stream.c index 7a911bc4b5..d022c04366 100644 --- a/libretro-common/streams/file_stream.c +++ b/libretro-common/streams/file_stream.c @@ -62,6 +62,7 @@ #endif #include +#include #include #include @@ -567,7 +568,7 @@ int filestream_close(RFILE *stream) if (!stream) goto error; - if (stream->ext) + if (stream->ext && !string_is_empty(stream->ext)) free(stream->ext); #if defined(PSP) From bae31a318d02aff07034a9ee283e35f3b7c93d1b Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 21:32:05 +0200 Subject: [PATCH 128/253] Prevent memory leak --- tasks/task_database.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/tasks/task_database.c b/tasks/task_database.c index 65e7f5e962..d1af350801 100644 --- a/tasks/task_database.c +++ b/tasks/task_database.c @@ -105,8 +105,11 @@ static intfstream_t* intfstream_open_file(const char *path) return fd; error: - intfstream_close(fd); - free(fd); + if (fd) + { + intfstream_close(fd); + free(fd); + } return NULL; } @@ -131,8 +134,11 @@ static intfstream_t *open_memory(void *data, size_t size) return fd; error: - intfstream_close(fd); - free(fd); + if (fd) + { + intfstream_close(fd); + free(fd); + } return NULL; } @@ -156,8 +162,11 @@ open_chd_track(const char *path, int32_t track) return fd; error: - intfstream_close(fd); - free(fd); + if (fd) + { + intfstream_close(fd); + free(fd); + } return NULL; } @@ -548,8 +557,11 @@ static bool task_database_chd_get_crc(const char *name, uint32_t *crc) { RARCH_LOG("CHD '%s' crc: %x\n", name, *crc); } - intfstream_close(fd); - free(fd); + if (fd) + { + intfstream_close(fd); + free(fd); + } return rv; } @@ -579,7 +591,10 @@ static void task_database_cue_prune(database_info_handle_t *db, end: if (fd) + { + intfstream_close(fd); free(fd); + } free(path); } From fc79569682a86cc14957065fe5e80bf86d796137 Mon Sep 17 00:00:00 2001 From: Twinaphex Date: Fri, 29 Sep 2017 21:38:27 +0200 Subject: [PATCH 129/253] (MaterialUI) Fix memory leak --- menu/drivers/materialui.c | 1 + 1 file changed, 1 insertion(+) diff --git a/menu/drivers/materialui.c b/menu/drivers/materialui.c index 352360d2c7..379d21b4f6 100644 --- a/menu/drivers/materialui.c +++ b/menu/drivers/materialui.c @@ -685,6 +685,7 @@ static void mui_compute_entries_box(mui_handle_t* mui, int width) texture_switch2 = node->texture_switch2; sublabel_str = menu_entry_get_sublabel(&entry); + menu_entry_free(&entry); if (sublabel_str) { From 35376a7961c7bf6bcbbb216de3832bd828cf8d4f Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 22:03:26 +0200 Subject: [PATCH 130/253] Cleanups --- core_info.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/core_info.c b/core_info.c index a815d2dd31..659a71fc6d 100644 --- a/core_info.c +++ b/core_info.c @@ -46,9 +46,6 @@ static void core_info_list_resolve_all_extensions( size_t all_ext_len = 0; char *all_ext = NULL; - if (!core_info_list) - return; - for (i = 0; i < core_info_list->count; i++) { if (core_info_list->list[i].supported_extensions) @@ -405,10 +402,11 @@ static core_info_list_t *core_info_list_new(const char *path) strdup(path_basename(core_info[i].path)); } - core_info_list_resolve_all_extensions(core_info_list); - if (core_info_list) + { + core_info_list_resolve_all_extensions(core_info_list); core_info_list_resolve_all_firmware(core_info_list); + } dir_list_free(contents); return core_info_list; From 127d98fb687bf29df2680c16efcb2d553e7c5e2c Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 29 Sep 2017 22:16:17 +0200 Subject: [PATCH 131/253] Rewrite path from nbio struct --- tasks/task_audio_mixer.c | 7 ++++++- tasks/task_image.c | 11 ++++++++++- tasks/tasks_internal.h | 16 ++++++++-------- 3 files changed, 24 insertions(+), 10 deletions(-) diff --git a/tasks/task_audio_mixer.c b/tasks/task_audio_mixer.c index ee5d70f0c1..1c2afea44e 100644 --- a/tasks/task_audio_mixer.c +++ b/tasks/task_audio_mixer.c @@ -23,6 +23,7 @@ #include #include