Merge pull request #1 from libretro/master

Update master
This commit is contained in:
Adolfo Ketzer 2017-08-24 00:05:01 -03:00 committed by GitHub
commit 0454e72e49
843 changed files with 220906 additions and 5763 deletions

View File

@ -1,100 +1,170 @@
# 1.6.2 (future)
- IOS: Fix GL regression - 32bit color format cores were no longer rendering
# 1.6.8 (future)
- GUI: (MaterialUI) Skip querying and drawing items that are not visible; Cache content height and bbox calculation.
- GUI: (XMB) Skip drawing the fading list when it is already transparent. Optimization.
- GUI: (XMB) Comment out visible item calculation in xmb_draw_items().
- GUI: (RGUI) Prevent crashes when using a non-English language reliant on UTF8.
- LINUX/PI: Broadcom VC4: Add Videocore config option
- NETPLAY: Fix disconnection not fully deinitializing Netplay.
- COMMON: Fix clear/free loop conditionals in playlists.
- WINDOWS/GDI: Fix flickering of text.
- WINDOWS/WGL: Try to use wglSwapLayerBuffers instead of SwapBuffers if possible (for more optimal performance).
- WII: Use custom, embedded libogc SDK.
- WIIU: Initial touchscreen support for WiiU gamepad.
# 1.6.7
- SCANNER: Fix directory scanning.
- SCANNER: Fix file scanning.
- COMMON: Fix 'Disk Image Append' option.
- FREEBSD: Compatibility fixes for Video4Linux2 camera driver.
- GUI: (MaterialUI) Add disk image append icons.
- GUI: (MaterialUI) Improve word wrapping when menu icons are enabled.
- GUI: (MaterialUI) Add User Interface -> Appearance -> Menu Icons Enable. You can turn on/off the icons on the lefthand side of the menu entries.
- GUI: Performance optimizations for XMB menu driver - only calculates visible items.
- LOCALIZATION: Update Italian translation.
# 1.6.6 (future)
- 3DS: Fixes serious performance regression that affected every core; rewind was always implicitly enabled.
- AUDIO: MOD/S3M/XM sound should now be properly mixed in with the core's sound.
- GUI: Visual makeover of MaterialUI.
- GUI: Added 'Music', 'Images' and 'Video' collection options to RGUI/MaterialUI.
- GUI: Allow the user to add 'Favorites'.
- GUI: Allow the user to rename entries.
- GUI: Performance optimizations for XMB menu driver.
- LOCALIZATION: Update Italian translation
- INPUT: Overlay controller response - when we press buttons on the gamepad or keyboard, the corresponding buttons on the overlay will be highlighted as well.
- NETBSD: Silence some compilation warnings.
- COMMON: Fixed bug 'Deleting an entry from a playlist would not update the list view inside XMB'.
- COMMON: Fix inet_ntop_compat on *nix
- LOBBY: Add skeleton to add help descriptions to lobbies
# 1.6.5
Skipped this one.
# 1.6.4
- ANDROID: Fire Stick & Fire TV remote overrides gamepad port 0 on button press and viceversa like SHIELD devices
- ANDROID: Provide default save / system / state / screenshot locations
- AUDIO: Audio mixer supports MOD/S3M/XM file types now!
- INPUT: input swap override flag (for remotes) is cleared correctly
- INPUT: allow specifying libretro device in remap files
- INPUT: allow specifying analog dpad mode in remap files
- INPUT: allow saving libretro device to remap files
- INPUT: allow saving analog dpad mode to remap files
- INPUT: allow removing core and game remap files from the menu
- COMMON: Cores can now request to set a 'shared context'. You no longer need to explicitly enable 'Shared Hardware Context' for Citra/OpenLara/Dolphin.
- COMMON: Add 'Delete Core' option to Core Information menu.
- COMMON: Allow Max Timing Skew to be set to 0.
- COMMON: Change the "content dir" behavior so it works on either a flag or an empty directory setting, now platform drivers can provide defaults for save / system / state / screenshot dirs and still allow the content dir functionality, these settings are under settings / saving and flagged as advanced
- GUI: You can turn on/off 'Horizontal Animation' now for the XMB menu. Turning animations off can result in a performance boost.
- GUI: Fix sublabel word-wrapping in XMB where multi-byte languages were cut off too soon
- LOCALIZATION: Update Dutch translation
- LOCALIZATION: Update Traditional Chinese translation
- LOCALIZATION: Update Italian translation
- LOCALIZATION: Update Russian translation
- WINDOWS: Provide default save / system / state / screenshot locations
- LOBBIES: Show what country the host is in
- MENU: Enable OSD text rendering for gdi and libcaca drivers
- WINDOWS 98/ME/2K: Set default directory for MSVC 2005 RetroArch version.
- WII: Better V-Sync handling, backported from SuperrSonic.
- WIIU: Exception handler rewritten.
# 1.6.3
- IOS: Fix GL regression - 32bit color format cores were no longer rendering
- CHEEVOS: Add support for N64 cheevos and other small fixes.
- CHEEVOS: Add 'Achievements -> Achievements Verbose Mode'. Ability to display cheevos related messages in OSD, useful for RetroAchievements users.
- AUDIO: Mute now no longer disables/enables audio but instead properly mutes the audio volume.
Mute is also independent from the audio mixer volume.
- AUDIO: Audio mixer's volume can now be independently increased/decreased, and muted.
- SDL2: Fix 'SDL2 driver does not see the hat on wired Xbox 360 controller"
- SCANNING: Fix PS1 game scanning
- SCANNING: Move content list builder into scanner task with progress, fixes menu freeze with large playlists
- VITA: Add support for external USB if mounted
- VITA: Add cheevos support
- MENU: Add 'User Interface -> Views'. Ability to display/hide online updater and core updater
options.
- LINUX: Add a tinyalsa audio driver. Doesn't require asoundlib, should be self-contained and
lower-level.
- AUDIO: Mute now no longer disables/enables audio but instead properly mutes the audio volume. Mute is also independent from the audio mixer volume.
- INPUT: Add mouse index selection; ability now to select between different mice
- INPUT: Fix 'All Users Control Menu' setting
- LINUX: Add a tinyalsa audio driver. Doesn't require asoundlib, should be self-contained and lower-level.
- LOBBIES: Announce the RetroArch version too
- LOCALIZATION: Add Traditional Chinese translation
- LOCALIZATION: Update French translation
- LOCALIZATION: Update Italian translation
- LOCALIZATION: Update Japanese translation
- LOCALIZATION: Update Russian translation
- MENU: Add 'User Interface -> Views'. Ability to display/hide online updater and core updater options.
- NETPLAY: Disconnecting one client shouldn't cause everyone to disconnect anymore
- NETWORK: SSL/TLS support, disabled by default
- SCANNER: Fix PS1 game scanning
- SCANNER: Move content list builder into scanner task with progress, fixes menu freeze with large playlists
- SDL2: Fix 'SDL2 driver does not see the hat on wired Xbox 360 controller"
- SETTINGS: Fix regression 'Custom Viewport is no longer overridable per-core or per-game'
- VITA: Add cheevos support
- VITA: Add support for external USB if mounted
- WAYLAND: Fix menu mouse input
- WII: Add support for single-port 'PS1/PS2 to USB controller adapter'
- INPUT: Fix 'All Users Control Menu' setting
- INPUT: Add mouse index selection; ability now to select between different mice
- SETTINGS: Fix regression 'Custom Viewport is no longer overridable per-core or per-game'
# 1.6.0
- AUTOSAVE/SRAM - Fix bug #3829 / #4820 (https://github.com/libretro/RetroArch/issues/3829)
- ENDIANNESS: Fixed database scanning. Should fix scanning on PS3/WiiU/Wii, etc.
- NET: Fix bug #4703 (https://github.com/libretro/RetroArch/issues/4703)
- ANDROID: Runtime permission checking
- ANDROID: Allow remotes to retain OK/Cancel position when menu_swap_ok_cancel is enabled
- ANDROID: Improve autoconf fallback
- ANDROID: Improve shield portable/gamepad device grouping workaround
- ANDROID: Allow remotes to retain OK/Cancel position when menu_swap_ok_cancel is enabled
- LOCALIZATION: Update/finish French translation
- LOCALIZATION: Update German translation
- LOCALIZATION: Update Japanese translation
- LOCALIZATION/GUI: Korean font should display properly now with XMB/MaterialUI's default font
- LOCALIZATION: Update Russian translation
- MENU: Improved rendering for XMB ribbon; using additive blending (Vulkan/GL)
- OSX/MACOS: Fixes serious memory leak
- WINDOWS: Added WASAPI audio driver for low-latency audio. Both shared and exclusive mode.
- WINDOWS: Added RawInput input driver for low-latency, low-level input.
- WINDOWS: Core mouse input should be relative again in cores
- MISC: Various frontend optimizations.
- VIDEO: Fix threaded video regression; tickering of menu entries would no longer work.
- WII: Fix crashing issues which could occur with the dummy core
- WIIU: HID Controller support
- WIIU: XMB/MaterialUI menu driver support
- WIIU: Initial network/netplay support
- ANDROID: Runtime permission checking
- AUDIO: Audio mixer support. Mix up to 8 streams with the game's audio.
- AUTOSAVE/SRAM - Fix bug #3829 / #4820 (https://github.com/libretro/RetroArch/issues/3829)
- ENDIANNESS: Fixed database scanning. Should fix scanning on PS3/WiiU/Wii, etc.
- LOBBIES: Fallback to filename based matching if no CRC matches are found (for people making playlists by hand)
- LOBBIES: GUI refinement, show stop hosting when a host has been started, show disconnect when playing as client
- LOBBIES: if the game is already loaded it will try to connect directly instead of re-loading content (non-fullpath cores only)
- LOBBIES: unify both netplay menus
- LOCALIZATION/GUI: Korean font should display properly now with XMB/MaterialUI's default font
- LOCALIZATION: Update German translation
- LOCALIZATION: Update Japanese translation
- LOCALIZATION: Update Russian translation
- LOCALIZATION: Update/finish French translation
- MENU: Improved rendering for XMB ribbon; using additive blending (Vulkan/GL)
- MISC: Various frontend optimizations.
- NET: Fix bug #4703 (https://github.com/libretro/RetroArch/issues/4703)
- OSX/MACOS: Fixes serious memory leak
- THUMBNAILS: Thumbnails show up now in Load Content -> Collection, Information -> Database
- VITA: Fix slow I/O
- VIDEO: Fix threaded video regression; tickering of menu entries would no longer work.
- VITA: Fix 30fps menu (poke into input now instead of reading the entire input buffer which apparently is slow)
- VITA: Fix frame throttle
- VULKAN: Unicode font rendering support. Should fix bad character encoding for French characters, etc.
- VITA: Fix slow I/O
- VULKAN: Fix some crashes on loading some thumbnails
- AUDIO: Audio mixer support. Mix up to 8 streams with the game's audio.
- VULKAN: Unicode font rendering support. Should fix bad character encoding for French characters, etc.
- WII: Fix crashing issues which could occur with the dummy core
- WIIU: HID Controller support
- WIIU: Initial network/netplay support
- WIIU: XMB/MaterialUI menu driver support
- WINDOWS: Added RawInput input driver for low-latency, low-level input.
- WINDOWS: Added WASAPI audio driver for low-latency audio. Both shared and exclusive mode.
- WINDOWS: Core mouse input should be relative again in cores
# 1.5.0
- MOBILE: Single-tap for menu entry selection
- MOBILE: Long-tap a setting to reset to default
- ANDROID: Autoconf fallback
- ANDROID: Mouse support / Emulated mouse support
- AUTOCONF: Fix partial matches for pad name
- CHEEVOS: Fix crashes in the cheevos description menu
- CHEEVOS: WIP leaderboards support
- COMMON: Threading fixes
- COMMON: 9-slice texture drawing support
- COMMON: Threading fixes
- CORETEXT/APPLE: Ability to load menu display font drivers and loading of custom font.
- DOS: Add keyboard driver
- DOS: Improve color accuracy and scaling
- GUI: Various settings are now only visible when advanced settings is enabled
- GUI: Allow changing icon theme on the fly
- GUI: Add a symbol page in the OSK
- GUI: Allow changing icon theme on the fly
- GUI: Better dialogs for XMB
- GUI: Various settings are now only visible when advanced settings is enabled
- LOCALIZATION: Add/update Korean translation
- LOCALIZATION: Rewrite German translation
- LOCALIZATION: Update several English sublabels
- LOCALIZATION: Update several Japanese labels
- MOBILE: Long-tap a setting to reset to default
- MOBILE: Single-tap for menu entry selection
- NET: Allow manual netplay content loading
- NET: Announcing network games to the public lobby is optional now
- NET: Bake in miniupnpc
- NET: Fix netplay join for contentless cores
- NET: Fix netplay rooms being pushed on the wrong tab
- NET: Lan games show next to lobbies with (lan) and connect via the private IP address
- NET: Use new lobby system with MITM support
- NET: Fix netplay rooms being pushed on the wrong tab
- NUKLEAR: Update to current version
- SCANNER: Always add 7z & zip to supported extensions
- VULKAN: Find supported composite alpha in swapchain
- VULKAN: Add snow/bokeh shader pipeline effects - at parity with GL now
- VULKAN: Find supported composite alpha in swapchain
- WIIU: Keyboard support
- WINDOWS: Logging to file no longer spawns an empty window
- WINDOWS: Fix loading of core/content via file menu
- WINDOWS: Logging to file no longer spawns an empty window
# 1.4.1

View File

@ -91,7 +91,7 @@ ifeq ($(HAVE_SHADERPIPELINE), 1)
CFLAGS += -DHAVE_SHADERPIPELINE
endif
CFLAGS += -I$(LIBRETRO_COMM_DIR)/include
CFLAGS += -I$(LIBRETRO_COMM_DIR)/include -I$(DEPS_DIR)
# Switches
@ -175,6 +175,7 @@ OBJ += frontend/frontend.o \
$(LIBRETRO_COMM_DIR)/file/retro_dirent.o \
$(LIBRETRO_COMM_DIR)/streams/stdin_stream.o \
$(LIBRETRO_COMM_DIR)/streams/file_stream.o \
$(LIBRETRO_COMM_DIR)/streams/file_stream_transforms.o \
$(LIBRETRO_COMM_DIR)/streams/interface_stream.o \
$(LIBRETRO_COMM_DIR)/streams/memory_stream.o \
$(LIBRETRO_COMM_DIR)/lists/string_list.o \
@ -338,107 +339,103 @@ ifneq ($(C89_BUILD), 1)
HAVE_LIBUI = 0
HAVE_GTKPLUS = 0
ifeq ($(HAVE_SSL), 1)
DEFINES += -DHAVE_SSL
DEFINES += -DMBEDTLS_SSL_DEBUG_ALL
# MinGW requires this for some reason, even though the include paths are relative to the source
INCLUDE_DIRS += -Ideps/mbedtls
OBJS_TLS_CRYPTO = deps/mbedtls/aes.o deps/mbedtls/aesni.o deps/mbedtls/arc4.o \
deps/mbedtls/asn1parse.o deps/mbedtls/asn1write.o deps/mbedtls/base64.o \
deps/mbedtls/bignum.o deps/mbedtls/blowfish.o deps/mbedtls/camellia.o \
deps/mbedtls/ccm.o deps/mbedtls/cipher.o deps/mbedtls/cipher_wrap.o \
deps/mbedtls/cmac.o deps/mbedtls/ctr_drbg.o deps/mbedtls/des.o \
deps/mbedtls/dhm.o deps/mbedtls/ecdh.o deps/mbedtls/ecdsa.o \
deps/mbedtls/ecjpake.o deps/mbedtls/ecp.o \
deps/mbedtls/ecp_curves.o deps/mbedtls/entropy.o deps/mbedtls/entropy_poll.o \
deps/mbedtls/error.o deps/mbedtls/gcm.o deps/mbedtls/havege.o \
deps/mbedtls/hmac_drbg.o deps/mbedtls/md.o deps/mbedtls/md2.o \
deps/mbedtls/md4.o deps/mbedtls/md5.o deps/mbedtls/md_wrap.o \
deps/mbedtls/memory_buffer_alloc.o deps/mbedtls/oid.o \
deps/mbedtls/padlock.o deps/mbedtls/pem.o deps/mbedtls/pk.o \
deps/mbedtls/pk_wrap.o deps/mbedtls/pkcs12.o deps/mbedtls/pkcs5.o \
deps/mbedtls/pkparse.o deps/mbedtls/pkwrite.o deps/mbedtls/platform.o \
deps/mbedtls/ripemd160.o deps/mbedtls/rsa.o deps/mbedtls/sha1.o \
deps/mbedtls/sha256.o deps/mbedtls/sha512.o deps/mbedtls/threading.o \
deps/mbedtls/timing.o deps/mbedtls/version.o \
deps/mbedtls/version_features.o deps/mbedtls/xtea.o
OBJS_TLS_X509 = deps/mbedtls/certs.o deps/mbedtls/pkcs11.o deps/mbedtls/x509.o \
deps/mbedtls/x509_create.o deps/mbedtls/x509_crl.o deps/mbedtls/x509_crt.o \
deps/mbedtls/x509_csr.o deps/mbedtls/x509write_crt.o deps/mbedtls/x509write_csr.o
OBJS_TLS = deps/mbedtls/debug.o deps/mbedtls/net_sockets.o \
deps/mbedtls/ssl_cache.o deps/mbedtls/ssl_ciphersuites.o \
deps/mbedtls/ssl_cli.o deps/mbedtls/ssl_cookie.o \
deps/mbedtls/ssl_srv.o deps/mbedtls/ssl_ticket.o \
deps/mbedtls/ssl_tls.o
OBJ += $(OBJS_TLS_CRYPTO) $(OBJS_TLS_X509) $(OBJS_TLS)
endif
ifeq ($(HAVE_LIBUI), 1)
ifeq ($(HAVE_GTKPLUS), 1)
CFLAGS += -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/atk-1.0
LIBS += -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
OBJ += deps/libui/gtk/alloc.o \
deps/libui/gtk/area.o \
deps/libui/gtk/box.o \
deps/libui/gtk/button.o \
deps/libui/gtk/cellrendererbutton.o \
deps/libui/gtk/checkbox.o \
deps/libui/gtk/child.o \
deps/libui/gtk/colorbutton.o \
deps/libui/gtk/combobox.o \
deps/libui/gtk/control.o \
deps/libui/gtk/datetimepicker.o \
deps/libui/gtk/debug.o \
deps/libui/gtk/draw.o \
deps/libui/gtk/drawmatrix.o \
deps/libui/gtk/drawpath.o \
deps/libui/gtk/drawtext.o \
deps/libui/gtk/editablecombo.o \
deps/libui/gtk/entry.o \
deps/libui/gtk/fontbutton.o \
deps/libui/gtk/form.o \
deps/libui/gtk/future.o \
deps/libui/gtk/graphemes.o \
deps/libui/gtk/grid.o \
deps/libui/gtk/group.o \
deps/libui/gtk/image.o \
deps/libui/gtk/label.o \
deps/libui/gtk/main.o \
deps/libui/gtk/menu.o \
deps/libui/gtk/multilineentry.o \
deps/libui/gtk/progressbar.o \
deps/libui/gtk/radiobuttons.o \
deps/libui/gtk/separator.o \
deps/libui/gtk/slider.o \
deps/libui/gtk/spinbox.o \
deps/libui/gtk/stddialogs.o \
deps/libui/gtk/tab.o \
deps/libui/gtk/text.o \
deps/libui/gtk/util.o \
deps/libui/gtk/window.o
endif
DEFINES += -DHAVE_LIBUI
ifneq ($(findstring Win32,$(OS)),)
OBJ += deps/libui/win32/alloc.o \
deps/libui/win32/area.o \
deps/libui/win32/areadraw.o \
deps/libui/win32/areaevents.o \
deps/libui/win32/areascroll.o \
deps/libui/win32/areautil.o \
deps/libui/win32/box.o \
deps/libui/win32/button.o \
deps/libui/win32/checkbox.o \
deps/libui/win32/colorbutton.o \
deps/libui/win32/colordialog.o \
deps/libui/win32/combobox.o \
deps/libui/win32/container.o \
deps/libui/win32/control.o \
deps/libui/win32/d2dscratch.o \
deps/libui/win32/datetimepicker.o \
deps/libui/win32/debug.o \
deps/libui/win32/draw.o \
deps/libui/win32/drawmatrix.o \
deps/libui/win32/drawpath.o \
deps/libui/win32/drawtext.o \
deps/libui/win32/dwrite.o \
deps/libui/win32/editablecombo.o \
deps/libui/win32/entry.o \
deps/libui/win32/events.o \
deps/libui/win32/fontbutton.o \
deps/libui/win32/fontdialog.o \
deps/libui/win32/form.o \
deps/libui/win32/graphemes.o \
deps/libui/win32/grid.o \
deps/libui/win32/group.o \
deps/libui/win32/init.o \
deps/libui/win32/label.o \
deps/libui/win32/main.o \
deps/libui/win32/menu.o \
deps/libui/win32/multilineentry.o \
deps/libui/win32/parent.o \
deps/libui/win32/progressbar.o \
deps/libui/win32/radiobuttons.o \
deps/libui/win32/separator.o \
deps/libui/win32/sizing.o \
deps/libui/win32/slider.o \
deps/libui/win32/spinbox.o \
deps/libui/win32/stddialogs.o \
deps/libui/win32/tab.o \
deps/libui/win32/tabpage.o \
deps/libui/win32/text.o \
deps/libui/win32/utf16.o \
deps/libui/win32/utilwin.o \
deps/libui/win32/window.o \
deps/libui/win32/winpublic.o \
deps/libui/win32/winutil.o
OBJ += deps/libui/windows/alloc.o \
deps/libui/windows/area.o \
deps/libui/windows/areadraw.o \
deps/libui/windows/areaevents.o \
deps/libui/windows/areascroll.o \
deps/libui/windows/areautil.o \
deps/libui/windows/box.o \
deps/libui/windows/button.o \
deps/libui/windows/checkbox.o \
deps/libui/windows/colorbutton.o \
deps/libui/windows/colordialog.o \
deps/libui/windows/combobox.o \
deps/libui/windows/container.o \
deps/libui/windows/control.o \
deps/libui/windows/d2dscratch.o \
deps/libui/windows/datetimepicker.o \
deps/libui/windows/debug.o \
deps/libui/windows/draw.o \
deps/libui/windows/drawmatrix.o \
deps/libui/windows/drawpath.o \
deps/libui/windows/drawtext.o \
deps/libui/windows/dwrite.o \
deps/libui/windows/editablecombo.o \
deps/libui/windows/entry.o \
deps/libui/windows/events.o \
deps/libui/windows/fontbutton.o \
deps/libui/windows/fontdialog.o \
deps/libui/windows/form.o \
deps/libui/windows/graphemes.o \
deps/libui/windows/grid.o \
deps/libui/windows/group.o \
deps/libui/windows/init.o \
deps/libui/windows/label.o \
deps/libui/windows/main.o \
deps/libui/windows/menu.o \
deps/libui/windows/multilineentry.o \
deps/libui/windows/parent.o \
deps/libui/windows/progressbar.o \
deps/libui/windows/radiobuttons.o \
deps/libui/windows/separator.o \
deps/libui/windows/sizing.o \
deps/libui/windows/slider.o \
deps/libui/windows/spinbox.o \
deps/libui/windows/stddialogs.o \
deps/libui/windows/tab.o \
deps/libui/windows/tabpage.o \
deps/libui/windows/text.o \
deps/libui/windows/utf16.o \
deps/libui/windows/utilwin.o \
deps/libui/windows/window.o \
deps/libui/windows/winpublic.o \
deps/libui/windows/winutil.o
LIBS += -luxtheme -ld2d1 -ldwrite -lusp10
endif
else
ifneq ($(findstring Darwin,$(OS)),)
OBJ += deps/libui/darwin/alloc.o \
deps/libui/darwin/area.o \
@ -478,6 +475,49 @@ OBJ += deps/libui/darwin/alloc.o \
deps/libui/darwin/util.o \
deps/libui/darwin/window.o \
deps/libui/darwin/winmoveresize.o
else
CFLAGS += -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/atk-1.0
LIBS += -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0
OBJ += deps/libui/unix/alloc.o \
deps/libui/unix/area.o \
deps/libui/unix/box.o \
deps/libui/unix/button.o \
deps/libui/unix/cellrendererbutton.o \
deps/libui/unix/checkbox.o \
deps/libui/unix/child.o \
deps/libui/unix/colorbutton.o \
deps/libui/unix/combobox.o \
deps/libui/unix/control.o \
deps/libui/unix/datetimepicker.o \
deps/libui/unix/debug.o \
deps/libui/unix/draw.o \
deps/libui/unix/drawmatrix.o \
deps/libui/unix/drawpath.o \
deps/libui/unix/drawtext.o \
deps/libui/unix/editablecombo.o \
deps/libui/unix/entry.o \
deps/libui/unix/fontbutton.o \
deps/libui/unix/form.o \
deps/libui/unix/future.o \
deps/libui/unix/graphemes.o \
deps/libui/unix/grid.o \
deps/libui/unix/group.o \
deps/libui/unix/image.o \
deps/libui/unix/label.o \
deps/libui/unix/main.o \
deps/libui/unix/menu.o \
deps/libui/unix/multilineentry.o \
deps/libui/unix/progressbar.o \
deps/libui/unix/radiobuttons.o \
deps/libui/unix/separator.o \
deps/libui/unix/slider.o \
deps/libui/unix/spinbox.o \
deps/libui/unix/stddialogs.o \
deps/libui/unix/tab.o \
deps/libui/unix/text.o \
deps/libui/unix/util.o \
deps/libui/unix/window.o
endif
endif
OBJ += deps/libui/common/areaevents.o \
@ -1283,6 +1323,11 @@ ifeq ($(HAVE_RBMP), 1)
OBJ += $(LIBRETRO_COMM_DIR)/formats/bmp/rbmp.o
endif
ifeq ($(HAVE_IBXM), 1)
DEFINES += -DHAVE_IBXM
OBJ += $(DEPS_DIR)/ibxm/ibxm.o
endif
OBJ += $(LIBRETRO_COMM_DIR)/formats/bmp/rbmp_encode.o \
$(LIBRETRO_COMM_DIR)/formats/json/jsonsax.o \
$(LIBRETRO_COMM_DIR)/formats/json/jsonsax_full.o \
@ -1341,6 +1386,10 @@ ifeq ($(HAVE_NETWORKING), 1)
tasks/task_wifi.o \
tasks/task_netplay_find_content.o
ifeq ($(HAVE_SSL), 1)
OBJ += $(LIBRETRO_COMM_DIR)/net/net_socket_ssl.o
endif
ifneq ($(HAVE_SOCKET_LEGACY),1)
OBJ += $(LIBRETRO_COMM_DIR)/net/net_ifinfo.o
endif

View File

@ -25,6 +25,7 @@ OBJ := ctr/ctr_system.o \
frontend/frontend_driver.o \
frontend/drivers/platform_ctr.o \
frontend/drivers/platform_null.o \
libretro-common/encodings/encoding_utf.o \
libretro-common/compat/compat_strcasestr.o \
libretro-common/file/file_path.o \
libretro-common/string/stdstring.o \

View File

@ -82,6 +82,7 @@ else ifeq ($(platform), ps3-cobra)
# NGC/Wii - libogc
else ifeq ($(libogc_platform), 1)
EXTERNAL_LIBOGC=0
CC = $(DEVKITPPC)/bin/powerpc-eabi-gcc$(EXE_EXT)
CXX = $(DEVKITPPC)/bin/powerpc-eabi-g++$(EXE_EXT)
LD = $(DEVKITPPC)/bin/powerpc-eabi-ld$(EXE_EXT)
@ -89,15 +90,36 @@ else ifeq ($(libogc_platform), 1)
EXT_TARGET := $(TARGET_NAME)_$(platform).dol
EXT_INTER_TARGET := $(TARGET_NAME)_$(platform).elf
INCLUDE += -I. -I$(DEVKITPRO)/libogc/include -Ideps/libz
INCLUDE += -I. -I$(DEVKITPRO)/libogc/include -Ideps/libz -Iwii/libogc/include
ifeq ($(EXTERNAL_LIBOGC), 1)
CFLAGS += -DEXTERNAL_LIBOGC
CXXFLAGS += -DEXTERNAL_LIBOGC
ifeq ($(platform), ngc)
LIBDIRS += -L$(DEVKITPRO)/libogc/lib/cube
else ifeq ($(platform), wii)
LIBDIRS += -L$(DEVKITPRO)/libogc/lib/wii
endif
else
CFLAGS += -DINTERNAL_LIBOGC
CXXFLAGS += -DINTERNAL_LIBOGC
ifeq ($(platform), ngc)
LIBDIRS += -Lwii/libogc/libs/cube
else ifeq ($(platform), wii)
LIBDIRS += -Lwii/libogc/libs/wii
endif
endif
ifeq ($(platform), ngc)
LIBDIRS += -L$(DEVKITPRO)/libogc/lib/cube
MACHDEP := -DHW_DOL -mogc
else ifeq ($(platform), wii)
LIBDIRS += -L$(DEVKITPRO)/libogc/lib/wii
MACHDEP := -DHW_RVL -mrvl
endif
LIBDIRS += -L.
MACHDEP += -DGEKKO -mcpu=750 -meabi -mhard-float -DMSB_FIRST
@ -112,7 +134,10 @@ ifeq ($(BIG_STACK), 1)
LDFLAGS += -T bootstrap/gx/rvl.ld
endif
endif
LIBS += -lfat -logc
LIBS += -logc
ifeq ($(EXTERNAL_LIBOGC), 1)
LIBS += -lfat
endif
ifeq ($(platform), wii)
LIBS += -lwiiuse -lbte
@ -133,6 +158,7 @@ endif
HAVE_RJPEG := 1
HAVE_RBMP := 1
HAVE_RTGA := 1
HAVE_IBXM := 1
HAVE_OVERLAY := 1
HAVE_ZLIB := 1
WANT_ZLIB := 1

358
Makefile.libogc Normal file
View File

@ -0,0 +1,358 @@
#---------------------------------------------------------------------------------
.SUFFIXES:
#---------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>devkitPro")
endif
ifeq ($(strip $(DEVKITPPC)),)
$(error "Please set DEVKITPPC in your environment. export DEVKITPPC=<path to>devkitPPC")
endif
export PATH := $(DEVKITPPC)/bin:$(PATH)
ifeq ($(PLATFORM),)
PLATFORM=wii
endif
#---------------------------------------------------------------------------------
# change shell on Snow Leopard
#---------------------------------------------------------------------------------
UNAME_S := $(shell uname -s)
UNAME_R := $(shell uname -r)
ifneq (,$(findstring Darwin,$(UNAME_S)))
ifneq (,$(findstring 10.8.0,$(UNAME_R)))
export SHELL=/bin/bash
endif
endif
#---------------------------------------------------------------------------------
# path to tools
#---------------------------------------------------------------------------------
export PORTLIBS := $(DEVKITPRO)/portlibs/ppc
export PATH := $(DEVKITPPC)/bin:$(PORTLIBS)/bin:$(PATH)
#---------------------------------------------------------------------------------
# the prefix on the compiler executables
#---------------------------------------------------------------------------------
PREFIX := powerpc-eabi-
export AS := $(PREFIX)as
export CC := $(PREFIX)gcc
export CXX := $(PREFIX)g++
export AR := $(PREFIX)ar
export OBJCOPY := $(PREFIX)objcopy
ISVC=$(or $(VCBUILDHELPER_COMMAND),$(MSBUILDEXTENSIONSPATH32),$(MSBUILDEXTENSIONSPATH))
#---------------------------------------------------------------------------------
%.a:
#---------------------------------------------------------------------------------
@rm -f $@
$(AR) -rc $@ $^
#---------------------------------------------------------------------------------
%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
#---------------------------------------------------------------------------------
%.o: %.c
$(CC) $(CFLAGS) -c $< -o $@
#---------------------------------------------------------------------------------
%.o: %.m
$(CC) $(OBJCFLAGS) -c $< -o $@
#---------------------------------------------------------------------------------
%.o: %.s
$(CC) -x assembler-with-cpp $(ASFLAGS) -c $< -o $@
#---------------------------------------------------------------------------------
%.o: %.S
$(CC) -x assembler-with-cpp $(ASFLAGS) -c $< -o $@
#---------------------------------------------------------------------------------
# canned command sequence for binary data
#---------------------------------------------------------------------------------
define bin2o
bin2s -a 32 $< | $(AS) -o $(@)
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"_end[];" > `(echo $(<F) | tr . _)`.h
echo "extern const u8" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`"[];" >> `(echo $(<F) | tr . _)`.h
echo "extern const u32" `(echo $(<F) | sed -e 's/^\([0-9]\)/_\1/' | tr . _)`_size";" >> `(echo $(<F) | tr . _)`.h
endef
BUILD := build
BUILD_LITE = 1
CURDIR = .
export BASEDIR := $(CURDIR)
export DEPSDIR := $(BASEDIR)/wii/libogc/deps
export LWIPDIR := $(BASEDIR)/wii/libogc/lwip
export OGCDIR := $(BASEDIR)/wii/libogc/libogc
export DBDIR := $(BASEDIR)/wii/libogc/libdb
export BTEDIR := $(BASEDIR)/wii/libogc/lwbt
export WIIUSEDIR := $(BASEDIR)/wii/libogc/wiiuse
export LIBWIIKEYB := $(BASEDIR)/wii/libogc/libwiikeyboard
export STUBSDIR := $(BASEDIR)/wii/libogc/lockstubs
export LIBS := $(BASEDIR)/wii/libogc/libs
export INCDIR := $(BASEDIR)/wii/libogc/include
export LIBDIR := $(LIBS)/$(PLATFORM)
#---------------------------------------------------------------------------------
BBALIB := $(LIBDIR)/libbba
OGCLIB := $(LIBDIR)/libogc
DBLIB := $(LIBDIR)/libdb
BTELIB := $(LIBDIR)/libbte
WIIUSELIB := $(LIBDIR)/libwiiuse
WIIKEYBLIB := $(LIBDIR)/libwiikeyboard
STUBSLIB := $(LIBDIR)/libgclibstubs
#---------------------------------------------------------------------------------
DEFAULTINCDIR := $(BASEDIR)/wii/libogc/include
DEFINCS := -I$(DEFAULTINCDIR)
INCLUDES := $(DEFINCS) \
-I$(BASEDIR)/wii/libogc \
-I$(DEFAULTINCDIR)/netif \
-I$(DEFAULTINCDIR)/ipv4 \
-I$(DEFAULTINCDIR)/sdcard \
-I$(DEFAULTINCDIR)/ogc \
-I$(DEFAULTINCDIR)/ogc/machine \
-I$(DEFAULTINCDIR)/bte \
-I$(DEFAULTINCDIR)/sdcard \
-I$(DEFAULTINCDIR)/wiikeyboard \
-I$(DEFAULTINCDIR)/wiiuse \
-I$(DEFAULTINCDIR)/di
MACHDEP := -DBIGENDIAN -DGEKKO -mcpu=750 -meabi -msdata=eabi -mhard-float -ffunction-sections -fdata-sections
ifeq ($(PLATFORM),wii)
MACHDEP += -DHW_RVL
endif
ifeq ($(PLATFORM),cube)
MACHDEP += -DHW_DOL
endif
CFLAGS := -DLIBOGC_INTERNAL -DNDEBUG -O2 -fno-strict-aliasing -mregnames -Wall $(MACHDEP) $(INCLUDES)
ASFLAGS := $(MACHDEP) -mregnames -D_LANGUAGE_ASSEMBLY $(INCLUDES)
#---------------------------------------------------------------------------------
VPATH := $(LWIPDIR) \
$(LWIPDIR)/arch/gc \
$(LWIPDIR)/arch/gc/netif \
$(LWIPDIR)/core \
$(LWIPDIR)/core/ipv4 \
$(LWIPDIR)/netif \
$(OGCDIR) \
$(DBDIR) \
$(DBDIR)/uIP \
$(BTEDIR) \
$(WIIUSEDIR) \
$(SDCARDDIR) \
$(LIBWIIKEYB) \
$(STUBSDIR)
#---------------------------------------------------------------------------------
SOURCES_LWIP := $(LWIPDIR)/network.c \
$(LWIPDIR)/netio.c \
$(LWIPDIR)/arch/gc/netif/gcif.c \
$(LWIPDIR)/core/inet.c \
$(LWIPDIR)/core/mem.c \
$(LWIPDIR)/core/dhcp.c \
$(LWIPDIR)/core/raw.c \
$(LWIPDIR)/core/memp.c \
$(LWIPDIR)/core/netif.c \
$(LWIPDIR)/core/pbuf.c \
$(LWIPDIR)/core/stats.c \
$(LWIPDIR)/core/sys.c \
$(LWIPDIR)/core/tcp.c \
$(LWIPDIR)/core/tcp_in.c \
$(LWIPDIR)/core/tcp_out.c \
$(LWIPDIR)/core/udp.c \
$(LWIPDIR)/core/ipv4/icmp.c \
$(LWIPDIR)/core/ipv4/ip.c \
$(LWIPDIR)/core/ipv4/ip_frag.c \
$(LWIPDIR)/core/ipv4/ip_addr.c \
$(LWIPDIR)/netif/etharp.c \
$(LWIPDIR)/netif/loopif.c
LWIPOBJ := $(SOURCES_LWIP:.c=.o)
#---------------------------------------------------------------------------------
SOURCES_OGC := \
$(OGCDIR)/console.c \
$(OGCDIR)/lwp_priority.c \
$(OGCDIR)/lwp_queue.c \
$(OGCDIR)/lwp_threadq.c \
$(OGCDIR)/lwp_threads.c \
$(OGCDIR)/lwp_sema.c \
$(OGCDIR)/lwp_messages.c \
$(OGCDIR)/lwp.c \
$(OGCDIR)/lwp_stack.c \
$(OGCDIR)/lwp_mutex.c \
$(OGCDIR)/lwp_watchdog.c \
$(OGCDIR)/lwp_wkspace.c \
$(OGCDIR)/lwp_objmgr.c \
$(OGCDIR)/lwp_heap.c \
$(OGCDIR)/sys_state.c \
$(OGCDIR)/exception.c \
$(OGCDIR)/irq.c \
$(OGCDIR)/semaphore.c \
$(OGCDIR)/video.c \
$(OGCDIR)/pad.c \
$(OGCDIR)/exi.c \
$(OGCDIR)/mutex.c \
$(OGCDIR)/arqueue.c \
$(OGCDIR)/arqmgr.c \
$(OGCDIR)/system.c \
$(OGCDIR)/cond.c \
$(OGCDIR)/gx.c \
$(OGCDIR)/gu.c \
$(OGCDIR)/audio.c \
$(OGCDIR)/cache.c \
$(OGCDIR)/decrementer.c \
$(OGCDIR)/message.c \
$(OGCDIR)/card.c \
$(OGCDIR)/aram.c \
$(OGCDIR)/depackrnc1.c \
$(OGCDIR)/dsp.c \
$(OGCDIR)/si.c \
$(OGCDIR)/tpl.c \
$(OGCDIR)/ipc.c \
$(OGCDIR)/console_font_8x16.c \
$(OGCDIR)/timesupp.c \
$(OGCDIR)/lock_supp.c \
$(OGCDIR)/newlibc.c \
$(OGCDIR)/usbgecko.c \
$(OGCDIR)/usbmouse.c \
$(OGCDIR)/sbrk.c \
$(OGCDIR)/malloc_lock.c \
$(OGCDIR)/kprintf.c \
$(OGCDIR)/stm.c \
$(OGCDIR)/ios.c \
$(OGCDIR)/es.c \
$(OGCDIR)/isfs.c \
$(OGCDIR)/usb.c \
$(OGCDIR)/network_common.c \
$(OGCDIR)/sdgecko_io.c \
$(OGCDIR)/sdgecko_buf.c \
$(OGCDIR)/gcsd.c \
$(OGCDIR)/argv.c \
$(OGCDIR)/network_wii.c \
$(OGCDIR)/wiisd.c \
$(OGCDIR)/conf.c \
$(OGCDIR)/usbstorage.c \
$(OGCDIR)/texconv.c \
$(OGCDIR)/wiilaunch.c
SOURCES_OGC_ASM := $(OGCDIR)/cache_asm.S \
$(OGCDIR)/decrementer_handler.S \
$(OGCDIR)/depackrnc.S \
$(OGCDIR)/exception_handler.S \
$(OGCDIR)/gu_psasm.S \
$(OGCDIR)/irq_handler.S \
$(OGCDIR)/lwp_handler.S \
$(OGCDIR)/ogc_crt0.S \
$(OGCDIR)/system_asm.S \
$(OGCDIR)/video_asm.S
ifneq ($(BUILD_LITE), 1)
SOURCES_OGC += $(OGCDIR)/dvd.c
endif
OGCOBJ := $(SOURCES_OGC:.c=.o) $(SOURCES_OGC_ASM:.S=.o)
#---------------------------------------------------------------------------------
SOURCES_DB := \
$(DBDIR)/uIP/uip_ip.c \
$(DBDIR)/uIP/uip_tcp.c \
$(DBDIR)/uIP/uip_pbuf.c \
$(DBDIR)/uIP/uip_netif.c \
$(DBDIR)/uIP/uip_arp.c \
$(DBDIR)/uIP/uip_arch.c \
$(DBDIR)/uIP/uip_icmp.c \
$(DBDIR)/uIP/memb.c \
$(DBDIR)/uIP/memr.c \
$(DBDIR)/uIP/bba.c \
$(DBDIR)/tcpip.c \
$(DBDIR)/debug.c \
$(DBDIR)/debug_handler.c \
$(DBDIR)/debug_supp.c \
$(DBDIR)/geckousb.c
DBOBJ := $(SOURCES_DB:.c=.o)
#---------------------------------------------------------------------------------
SOURCES_BTE := \
$(BTEDIR)/bte.c \
$(BTEDIR)/hci.c \
$(BTEDIR)/l2cap.c \
$(BTEDIR)/btmemb.c \
$(BTEDIR)/btmemr.c \
$(BTEDIR)/btpbuf.c \
$(BTEDIR)/physbusif.c
BTEOBJ := $(SOURCES_BTE:.c=.o)
#---------------------------------------------------------------------------------
SOURCES_WIIUSE := \
$(WIIUSEDIR)/classic.c \
$(WIIUSEDIR)/dynamics.c \
$(WIIUSEDIR)/events.c \
$(WIIUSEDIR)/io.c \
$(WIIUSEDIR)/io_wii.c \
$(WIIUSEDIR)/ir.c \
$(WIIUSEDIR)/nunchuk.c \
$(WIIUSEDIR)/wiiuse.c \
$(WIIUSEDIR)/speaker.c \
$(WIIUSEDIR)/wpad.c \
$(WIIUSEDIR)/motion_plus.c
WIIUSEOBJ := $(SOURCES_WIIUSE:.c=.o)
#---------------------------------------------------------------------------------
SOURCES_WIIKEYB = $(LIBWIIKEYB)/usbkeyboard.c \
$(LIBWIIKEYB)/keyboard.c \
$(LIBWIIKEYB)/ukbdmap.c \
$(LIBWIIKEYB)/wskbdutil.c
WIIKEYBLIBOBJ := $(SOURCES_WIIKEYB:.c=.o)
LIBRARIES := $(OGCLIB).a $(DBLIB).a
ifeq ($(PLATFORM),cube)
LIBRARIES += $(BBALIB).a
endif
ifeq ($(PLATFORM),wii)
LIBRARIES += $(BTELIB).a $(WIIUSELIB).a $(WIIKEYBLIB).a
endif
all: $(LIBRARIES)
#---------------------------------------------------------------------------------
$(BBALIB).a: $(LWIPOBJ)
#---------------------------------------------------------------------------------
$(OGCLIB).a: $(OGCOBJ)
#---------------------------------------------------------------------------------
$(DBLIB).a: $(DBOBJ)
#---------------------------------------------------------------------------------
$(WIIKEYBLIB).a: $(WIIKEYBLIBOBJ)
#---------------------------------------------------------------------------------
$(BTELIB).a: $(BTEOBJ)
#---------------------------------------------------------------------------------
$(WIIUSELIB).a: $(WIIUSEOBJ)
#---------------------------------------------------------------------------------
#---------------------------------------------------------------------------------
clean:
#---------------------------------------------------------------------------------
rm -fr $(LWIPOBJ) $(OGCOBJ) $(DBOBJ) $(BTEOBJ) $(WIIUSEOBJ) $(WIIKEYBLIBOBJ)
rm -f *.map

View File

@ -1,4 +1,4 @@
RARCH_VERSION = "0.9.9.3"
RARCH_VERSION = "1.6.7.0"
DEBUG = 0

View File

@ -1,4 +1,4 @@
RARCH_VERSION = "0.9.9.3"
RARCH_VERSION = "1.6.7.0"
#which compiler to build with - GCC or SNC
#set to GCC for debug builds for use with debugger

View File

@ -1,4 +1,4 @@
RARCH_VERSION = "0.9.9.3"
RARCH_VERSION = "1.6.7.0"
#which compiler to build with - GCC or SNC
#set to GCC for debug builds for use with debugger

View File

@ -16,9 +16,20 @@ else ifneq ($(findstring MINGW,$(shell uname -a)),)
system_platform = win
endif
ifeq ($(DEBUG), 1)
PPU_OPTIMIZE_LV := -O0 -g
else
PPU_OPTIMIZE_LV := -O2 -DNDEBUG
endif
STRIP = $(CELL_SDK)/host-win32/ppu/bin/ppu-lv2-strip.exe
PPU_CFLAGS += -I. -Ilibretro-common/include -Ideps/libz -D__CELLOS_LV2__ -DIS_SALAMANDER -DRARCH_CONSOLE -DHAVE_SYSUTILS -DHAVE_SYSMODULES -DHAVE_RARCH_EXEC
INCFLAGS = -I. -Idefines -Ilibretro-common/include -Ideps/libz
DEFINES = -D__CELLOS_LV2__ -DIS_SALAMANDER -DRARCH_CONSOLE -DHAVE_SYSUTILS -DHAVE_SYSMODULES -DHAVE_RARCH_EXEC
PPU_CFLAGS := $(PPU_OPTIMIZE_LV) $(INCFLAGS) $(DEFINES)
PPU_CXXFLAGS := $(PPU_OPTIMIZE_LV) $(INCFLAGS) $(DEFINES)
PPU_SRCS = frontend/frontend_salamander.c \
frontend/frontend_driver.c \
frontend/drivers/platform_ps3.c \
@ -29,6 +40,7 @@ PPU_SRCS = frontend/frontend_salamander.c \
libretro-common/file/retro_dirent.c \
libretro-common/hash/rhash.c \
libretro-common/string/stdstring.c \
libretro-common/encodings/encoding_utf.c \
libretro-common/compat/compat_strl.c \
libretro-common/compat/compat_strcasestr.c \
libretro-common/streams/file_stream.c \
@ -60,8 +72,6 @@ endif
PPU_LDLIBS += -lm -lnet_stub -lnetctl_stub -lio_stub -lsysmodule_stub -lsysutil_stub -lsysutil_game_stub -lfs_stub -lsysutil_np_stub
PPU_OPTIMIZE_LV := -O2
MAKE_FSELF = $(CELL_SDK)/host-win32/bin/make_fself.exe
include $(CELL_MK_DIR)/sdk.target.mk

View File

@ -1,4 +1,4 @@
RARCH_VERSION = "0.9.9.3"
RARCH_VERSION = "1.6.7.0"
DEBUG = 0
HAVE_LOGGER = 0

View File

@ -40,6 +40,7 @@ OBJS = frontend/frontend_salamander.o \
libretro-common/lists/string_list.o \
libretro-common/lists/dir_list.o \
libretro-common/file/retro_dirent.o \
libretro-common/encodings/encoding_utf.o \
libretro-common/compat/compat_strl.o \
libretro-common/compat/compat_strcasestr.o \
libretro-common/file/config_file.o \

View File

@ -41,6 +41,7 @@ OBJS = frontend/frontend_salamander.o \
libretro-common/lists/string_list.o \
libretro-common/lists/dir_list.o \
libretro-common/file/retro_dirent.o \
libretro-common/encodings/encoding_utf.o \
libretro-common/compat/compat_strl.o \
libretro-common/compat/compat_strcasestr.o \
libretro-common/file/config_file.o \

View File

@ -6,6 +6,7 @@
DEBUG = 0
HAVE_LOGGER = 0
HAVE_FILE_LOGGER = 0
EXTERNAL_LIBOGC = 0
# system platform
system_platform = unix
@ -29,13 +30,23 @@ ELF2DOL = $(DEVKITPPC)/bin/elf2dol$(EXE_EXT)
DOL_TARGET := retroarch-salamander_wii.dol
ELF_TARGET := retroarch-salamander_wii.elf
INCLUDE := -I. -I$(DEVKITPRO)/libogc/include -Ilibretro-common/include -Ideps/libz
INCLUDE := -I. -Ilibretro-common/include -Ideps/libz
ifeq ($(EXTERNAL_LIBOGC), 1)
INCLUDE += -I$(DEVKITPRO)/libogc/include
LIBDIRS := -L$(DEVKITPRO)/libogc/lib/wii -L.
else
INCLUDE += -Iwii/libogc/include
LIBDIRS := -Lwii/libogc/libs/wii -L.
endif
MACHDEP := -DGEKKO -DHW_RVL -mrvl -mcpu=750 -meabi -mhard-float
CFLAGS += -Wall -std=gnu99 $(MACHDEP) $(INCLUDE)
LDFLAGS := $(MACHDEP) -Wl,-Map,$(notdir $(ELF_TARGET)).map
LIBS := -lfat -lwiiuse -logc -lbte
LIBS := -lwiiuse -logc -lbte
ifeq ($(EXTERNAL_LIBOGC), 1)
LIBS += -lfat
endif
APP_BOOTER_DIR = wii/app_booter
@ -51,6 +62,7 @@ OBJ = frontend/frontend_salamander.o \
libretro-common/lists/dir_list.o \
libretro-common/streams/file_stream.o \
libretro-common/file/retro_dirent.o \
libretro-common/encodings/encoding_utf.o \
libretro-common/compat/compat_strl.o \
libretro-common/compat/compat_strcasestr.o \
libretro-common/file/config_file.o \
@ -58,6 +70,20 @@ OBJ = frontend/frontend_salamander.o \
verbosity.o \
$(APP_BOOTER_DIR)/app_booter.binobj
ifeq ($(EXTERNAL_LIBOGC), 1)
else
OBJ += wii/libogc/libfat/cache.o \
wii/libogc/libfat/directory.o \
wii/libogc/libfat/disc.o \
wii/libogc/libfat/fatdir.o \
wii/libogc/libfat/fatfile.o \
wii/libogc/libfat/file_allocation_table.o \
wii/libogc/libfat/filetime.o \
wii/libogc/libfat/libfat.o \
wii/libogc/libfat/lock.o \
wii/libogc/libfat/partition.o
endif
ifeq ($(HAVE_LOGGER), 1)
CFLAGS += -DHAVE_LOGGER
CFLAGS += -DPC_DEVELOPMENT_IP_ADDRESS=\"$(PC_DEVELOPMENT_IP_ADDRESS)\" -DPC_DEVELOPMENT_UDP_PORT=$(PC_DEVELOPMENT_UDP_PORT)

View File

@ -16,6 +16,7 @@ OBJ += frontend/frontend_salamander.o
OBJ += frontend/frontend_driver.o
OBJ += frontend/drivers/platform_wiiu.o
OBJ += frontend/drivers/platform_null.o
OBJ += libretro-common/encodings/encoding_utf.o
OBJ += libretro-common/compat/compat_strcasestr.o
OBJ += libretro-common/file/file_path.o
OBJ += libretro-common/string/stdstring.o

View File

@ -914,6 +914,11 @@ bool audio_driver_mixer_extension_supported(const char *ext)
#ifdef HAVE_STB_VORBIS
string_list_append(str_list, "ogg", attr);
#endif
#ifdef HAVE_IBXM
string_list_append(str_list, "mod", attr);
string_list_append(str_list, "s3m", attr);
string_list_append(str_list, "xm", attr);
#endif
string_list_append(str_list, "wav", attr);
@ -1008,6 +1013,9 @@ bool audio_driver_mixer_add_stream(audio_mixer_stream_params_t *params)
case AUDIO_MIXER_TYPE_OGG:
handle = audio_mixer_load_ogg(buf, (int32_t)params->bufsize);
break;
case AUDIO_MIXER_TYPE_MOD:
handle = audio_mixer_load_mod(buf, (int32_t)params->bufsize);
break;
case AUDIO_MIXER_TYPE_NONE:
free(buf);
return false;

View File

@ -322,7 +322,11 @@ static void *dsound_init(const char *device, unsigned rate, unsigned latency,
RARCH_LOG("DirectSound devices:\n");
#ifndef _XBOX
DirectSoundEnumerate(enumerate_cb, &dev);
#ifdef UNICODE
DirectSoundEnumerate((LPDSENUMCALLBACKW)enumerate_cb, &dev);
#else
DirectSoundEnumerate((LPDSENUMCALLBACKA)enumerate_cb, &dev);
#endif
#endif
if (DirectSoundCreate(dev.guid, &ds->ds, NULL) != DS_OK)

View File

@ -1523,7 +1523,7 @@ static struct pcm_params *pcm_params_get(unsigned int card, unsigned int device,
snprintf(fn, sizeof(fn), "/dev/snd/pcmC%uD%u%c", card, device,
flags & PCM_IN ? 'c' : 'p');
fd = open(fn, O_RDWR);
fd = open(fn, O_RDWR|O_NONBLOCK);
if (fd < 0)
{
fprintf(stderr, "cannot open device '%s'\n", fn);
@ -2203,12 +2203,12 @@ static void * tinyalsa_init(const char *devicestr, unsigned rate,
{
RARCH_WARN("[TINYALSA]: Sample rate cannot be larger than %uHz "\
"or smaller than %uHz.\n", max_rate, min_rate);
RARCH_WARN("[TINYALSA]: Trying the default rate or else max rate.\n");
if (max_rate >= 48000)
rate = 48000;
else
RARCH_WARN("[TINYALSA]: Trying to set a valid sample rate.\n");
if (rate > max_rate)
rate = max_rate;
else if (rate < min_rate)
rate = min_rate;
}
if (orig_rate != rate)

View File

@ -741,9 +741,9 @@ static ssize_t wasapi_write(void *wh, const void *data, size_t size)
for (writen = 0, ir = -1; writen < size; writen += ir)
{
if (w->exclusive)
ir = wasapi_write_ex(w, data + writen, size - writen);
ir = wasapi_write_ex(w, (char*)data + writen, size - writen);
else
ir = wasapi_write_sh(w, data + writen, size - writen);
ir = wasapi_write_sh(w, (char*)data + writen, size - writen);
if (ir == -1)
return -1;
}

View File

@ -16,7 +16,9 @@
*/
#include <stdio.h>
#if !defined(__FreeBSD__) || __FreeBSD__ < 5
#include <malloc.h>
#endif
#include <string.h>
#include <assert.h>
#include <stddef.h>
@ -28,7 +30,9 @@
#include <sys/time.h>
#include <sys/ioctl.h>
#ifndef __FreeBSD__
#include <asm/types.h>
#endif
#include <linux/videodev2.h>
#include <memmap.h>

View File

@ -921,7 +921,7 @@ static unsigned cheevos_prefix_to_comp_size(char prefix)
{
/* Careful not to use ABCDEF here, this denotes part of an actual variable! */
switch( toupper( prefix ) )
switch( toupper( (unsigned char)prefix ) )
{
case 'M':
return CHEEVOS_VAR_SIZE_BIT_0;
@ -1141,13 +1141,13 @@ static void cheevos_parse_var(cheevos_var_t *var, const char **memaddr)
const char *str = *memaddr;
unsigned base = 16;
if (toupper(*str) == 'D' && str[1] == '0' && toupper(str[2]) == 'X')
if (toupper((unsigned char)*str) == 'D' && str[1] == '0' && toupper((unsigned char)str[2]) == 'X')
{
/* d0x + 4 hex digits */
str += 3;
var->type = CHEEVOS_VAR_TYPE_DELTA_MEM;
}
else if (*str == '0' && toupper(str[1]) == 'X')
else if (*str == '0' && toupper((unsigned char)str[1]) == 'X')
{
/* 0x + 4 hex digits */
str += 2;
@ -1157,11 +1157,11 @@ static void cheevos_parse_var(cheevos_var_t *var, const char **memaddr)
{
var->type = CHEEVOS_VAR_TYPE_VALUE_COMP;
if (toupper(*str) == 'H')
if (toupper((unsigned char)*str) == 'H')
str++;
else
{
if (toupper(*str) == 'V')
if (toupper((unsigned char)*str) == 'V')
str++;
base = 10;
@ -1372,9 +1372,7 @@ static void cheevos_free_condition(cheevos_condition_t* condition)
if (condition->condsets)
{
for (i = 0; i < condition->count; i++)
{
free((void*)condition->condsets[i].conds);
}
free((void*)condition->condsets);
}
@ -2074,7 +2072,7 @@ static void cheevos_url_encode(const char *str, char *encoded, size_t len)
{
while (*str)
{
if ( isalnum(*str) || *str == '-'
if ( isalnum((unsigned char)*str) || *str == '-'
|| *str == '_' || *str == '.'
|| *str == '~')
{
@ -2652,44 +2650,45 @@ bool cheevos_toggle_hardcore_mode(void)
static void cheevos_patch_addresses(cheevoset_t* set)
{
unsigned i, j, k;
cheevo_t* cheevo = set->cheevos;
for (unsigned i = set->count; i != 0; i--, cheevo++)
for (i = set->count; i != 0; i--, cheevo++)
{
cheevos_condset_t* condset = cheevo->condition.condsets;
for (unsigned j = cheevo->condition.count; j != 0; j--, condset++)
for (j = cheevo->condition.count; j != 0; j--, condset++)
{
cheevos_cond_t* cond = condset->conds;
for (unsigned k = condset->count; k != 0; k--, cond++)
for (k = condset->count; k != 0; k--, cond++)
{
switch (cond->source.type)
{
case CHEEVOS_VAR_TYPE_ADDRESS:
case CHEEVOS_VAR_TYPE_DELTA_MEM:
cheevos_parse_guest_addr(&cond->source, cond->source.value);
#ifdef CHEEVOS_DUMP_ADDRS
RARCH_LOG("CHEEVOS var %03d:%08X\n", cond->source.bank_id + 1, cond->source.value);
#endif
break;
case CHEEVOS_VAR_TYPE_ADDRESS:
case CHEEVOS_VAR_TYPE_DELTA_MEM:
cheevos_parse_guest_addr(&cond->source, cond->source.value);
#ifdef CHEEVOS_DUMP_ADDRS
RARCH_LOG("CHEEVOS var %03d:%08X\n", cond->source.bank_id + 1, cond->source.value);
#endif
break;
default:
break;
default:
break;
}
switch (cond->target.type)
{
case CHEEVOS_VAR_TYPE_ADDRESS:
case CHEEVOS_VAR_TYPE_DELTA_MEM:
cheevos_parse_guest_addr(&cond->target, cond->target.value);
#ifdef CHEEVOS_DUMP_ADDRS
RARCH_LOG("CHEEVOS var %03d:%08X\n", cond->target.bank_id + 1, cond->target.value);
#endif
break;
case CHEEVOS_VAR_TYPE_ADDRESS:
case CHEEVOS_VAR_TYPE_DELTA_MEM:
cheevos_parse_guest_addr(&cond->target, cond->target.value);
#ifdef CHEEVOS_DUMP_ADDRS
RARCH_LOG("CHEEVOS var %03d:%08X\n", cond->target.bank_id + 1, cond->target.value);
#endif
break;
default:
break;
default:
break;
}
}
}

117
command.c
View File

@ -1,5 +1,6 @@
/* RetroArch - A frontend for libretro.
* Copyright (C) 2011-2017 - Daniel De Matteis
* Copyright (C) 2015-2017 - Andrés Suárez
* Copyright (C) 2016-2017 - Brad Parker
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
@ -1053,6 +1054,7 @@ static void command_event_deinit_core(bool reinit)
command_event(CMD_EVENT_DISABLE_OVERRIDES, NULL);
command_event(CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET, NULL);
command_event(CMD_EVENT_RESTORE_REMAPS, NULL);
}
static void command_event_init_cheats(void)
@ -1226,7 +1228,7 @@ static bool command_event_init_core(enum rarch_core_type *data)
rarch_ctl(RARCH_CTL_UNSET_OVERRIDES_ACTIVE, NULL);
}
/* Auto-remap: apply shader preset files */
/* Auto-shaders: apply shader preset files */
if(settings->bools.auto_shaders_enable)
config_load_shader_preset();
@ -1287,6 +1289,12 @@ static void command_event_restore_default_shader_preset(void)
path_clear(RARCH_PATH_DEFAULT_SHADER_PRESET);
}
static void command_event_restore_remaps(void)
{
if (rarch_ctl(RARCH_CTL_IS_REMAPS_GAME_ACTIVE, NULL))
input_remapping_set_defaults();
}
static bool command_event_save_auto_state(void)
{
char savestate_name_auto[PATH_MAX_LENGTH] = {0};
@ -1797,6 +1805,7 @@ bool command_event(enum event_command cmd, void *data)
command_event(CMD_EVENT_AUTOSAVE_STATE, NULL);
command_event(CMD_EVENT_DISABLE_OVERRIDES, NULL);
command_event(CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET, NULL);
command_event(CMD_EVENT_RESTORE_REMAPS, NULL);
if (is_inited)
if (!task_push_start_dummy_core(&content_info))
@ -1856,9 +1865,17 @@ bool command_event(enum event_command cmd, void *data)
if (settings->bools.cheevos_hardcore_mode_enable)
return false;
#endif
if (settings->bools.rewind_enable)
state_manager_event_init((unsigned)settings->rewind_buffer_size);
{
#ifdef HAVE_NETWORKING
/* Only enable state manager if netplay is not underway
TODO: Add a setting for these tweaks */
if (!netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL))
#endif
{
state_manager_event_init((unsigned)settings->rewind_buffer_size);
}
}
}
break;
case CMD_EVENT_REWIND_TOGGLE:
@ -1880,10 +1897,21 @@ bool command_event(enum event_command cmd, void *data)
case CMD_EVENT_AUTOSAVE_INIT:
command_event(CMD_EVENT_AUTOSAVE_DEINIT, NULL);
#ifdef HAVE_THREADS
if (autosave_init())
runloop_set(RUNLOOP_ACTION_AUTOSAVE);
else
runloop_unset(RUNLOOP_ACTION_AUTOSAVE);
{
#ifdef HAVE_NETWORKING
/* Only enable state manager if netplay is not underway
TODO: Add a setting for these tweaks */
settings_t *settings = config_get_ptr();
if (settings->uints.autosave_interval != 0
&& !netplay_driver_ctl(RARCH_NETPLAY_CTL_IS_ENABLED, NULL))
#endif
{
if (autosave_init())
runloop_set(RUNLOOP_ACTION_AUTOSAVE);
else
runloop_unset(RUNLOOP_ACTION_AUTOSAVE);
}
}
#endif
break;
case CMD_EVENT_AUTOSAVE_STATE:
@ -1967,6 +1995,13 @@ bool command_event(enum event_command cmd, void *data)
}
g_defaults.content_history = NULL;
if (g_defaults.content_favorites)
{
playlist_write_file(g_defaults.content_favorites);
playlist_free(g_defaults.content_favorites);
}
g_defaults.content_favorites = NULL;
if (g_defaults.music_history)
{
playlist_write_file(g_defaults.music_history);
@ -2010,6 +2045,13 @@ bool command_event(enum event_command cmd, void *data)
settings->paths.path_content_history,
content_history_size);
RARCH_LOG("%s: [%s].\n",
msg_hash_to_str(MSG_LOADING_HISTORY_FILE),
settings->paths.path_content_favorites);
g_defaults.content_favorites = playlist_init(
settings->paths.path_content_favorites,
content_history_size);
RARCH_LOG("%s: [%s].\n",
msg_hash_to_str(MSG_LOADING_HISTORY_FILE),
settings->paths.path_content_music_history);
@ -2109,7 +2151,7 @@ bool command_event(enum event_command cmd, void *data)
* need to make sure to keep a copy */
struct retro_hw_render_callback hwr_copy;
struct retro_hw_render_callback *hwr = video_driver_get_hw_context();
const struct retro_hw_render_context_negotiation_interface *iface =
const struct retro_hw_render_context_negotiation_interface *iface =
video_driver_get_context_negotiation_interface();
memcpy(&hwr_copy, hwr, sizeof(hwr_copy));
@ -2142,6 +2184,19 @@ bool command_event(enum event_command cmd, void *data)
if (ui_companion_is_on_foreground())
ui_companion_driver_toggle();
break;
case CMD_EVENT_ADD_TO_FAVORITES:
playlist_push(
g_defaults.content_favorites,
path_get(RARCH_PATH_CONTENT),
NULL,
file_path_str(FILE_PATH_DETECT),
file_path_str(FILE_PATH_DETECT),
NULL,
NULL
);
playlist_write_file(g_defaults.content_favorites);
runloop_msg_queue_push(msg_hash_to_str(MSG_ADDED_TO_FAVORITES), 1, 180, true);
break;
case CMD_EVENT_RESTART_RETROARCH:
if (!frontend_driver_set_fork(FRONTEND_FORK_RESTART))
return false;
@ -2182,7 +2237,7 @@ bool command_event(enum event_command cmd, void *data)
RARCH_LOG("%s\n", msg_hash_to_str(MSG_PAUSED));
command_event(CMD_EVENT_AUDIO_STOP, NULL);
runloop_msg_queue_push(msg_hash_to_str(MSG_PAUSED), 1,
runloop_msg_queue_push(msg_hash_to_str(MSG_PAUSED), 1,
1, true);
if (!is_idle)
@ -2265,13 +2320,20 @@ bool command_event(enum event_command cmd, void *data)
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
if (!init_netplay(NULL, hostname ? hostname :
if (!init_netplay(NULL, hostname ? hostname :
settings->paths.netplay_server,
settings->uints.netplay_port))
{
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
return false;
}
/* Disable rewind & sram autosave if it was enabled
TODO: Add a setting for these tweaks */
state_manager_event_deinit();
#ifdef HAVE_THREADS
autosave_deinit();
#endif
}
break;
/* init netplay via lobby when content is loaded */
@ -2284,12 +2346,12 @@ bool command_event(enum event_command cmd, void *data)
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
RARCH_LOG("[netplay] connecting to %s:%d\n",
hostname->elems[0].data, !string_is_empty(hostname->elems[1].data)
RARCH_LOG("[netplay] connecting to %s:%d\n",
hostname->elems[0].data, !string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : 55435);
if (!init_netplay(NULL, hostname->elems[0].data,
!string_is_empty(hostname->elems[1].data)
if (!init_netplay(NULL, hostname->elems[0].data,
!string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : 55435))
{
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
@ -2298,6 +2360,13 @@ bool command_event(enum event_command cmd, void *data)
}
string_list_free(hostname);
/* Disable rewind if it was enabled
TODO: Add a setting for these tweaks */
state_manager_event_deinit();
#ifdef HAVE_THREADS
autosave_deinit();
#endif
}
break;
/* init netplay via lobby when content is not loaded */
@ -2310,12 +2379,12 @@ bool command_event(enum event_command cmd, void *data)
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
RARCH_LOG("[netplay] connecting to %s:%d\n",
hostname->elems[0].data, !string_is_empty(hostname->elems[1].data)
RARCH_LOG("[netplay] connecting to %s:%d\n",
hostname->elems[0].data, !string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : 55435);
if (!init_netplay_deferred(hostname->elems[0].data,
!string_is_empty(hostname->elems[1].data)
!string_is_empty(hostname->elems[1].data)
? atoi(hostname->elems[1].data) : 55435))
{
command_event(CMD_EVENT_NETPLAY_DEINIT, NULL);
@ -2324,6 +2393,13 @@ bool command_event(enum event_command cmd, void *data)
}
string_list_free(hostname);
/* Disable rewind if it was enabled
TODO: Add a setting for these tweaks */
state_manager_event_deinit();
#ifdef HAVE_THREADS
autosave_deinit();
#endif
}
break;
case CMD_EVENT_NETPLAY_FLIP_PLAYERS:
@ -2495,7 +2571,7 @@ bool command_event(enum event_command cmd, void *data)
{
static bool game_focus_state = false;
intptr_t mode = (intptr_t)data;
/* mode = -1: restores current game focus state
* mode = 1: force set game focus, instead of toggling
* any other: toggle
@ -2553,11 +2629,14 @@ bool command_event(enum event_command cmd, void *data)
case CMD_EVENT_DISABLE_OVERRIDES:
command_event_disable_overrides();
break;
case CMD_EVENT_RESTORE_REMAPS:
command_event_restore_remaps();
break;
case CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET:
command_event_restore_default_shader_preset();
break;
case CMD_EVENT_LIBUI_TEST:
#if 0
#if HAVE_LIBUI
libui_main();
#endif
break;

View File

@ -134,6 +134,8 @@ enum event_command
CMD_EVENT_REBOOT,
/* Resume RetroArch when in menu. */
CMD_EVENT_RESUME,
/* Add a playlist entry to favorites. */
CMD_EVENT_ADD_TO_FAVORITES,
/* Toggles pause. */
CMD_EVENT_PAUSE_TOGGLE,
/* Pauses RetroArch. */
@ -218,6 +220,7 @@ enum event_command
CMD_EVENT_MIXER_VOLUME_UP,
CMD_EVENT_MIXER_VOLUME_DOWN,
CMD_EVENT_DISABLE_OVERRIDES,
CMD_EVENT_RESTORE_REMAPS,
CMD_EVENT_RESTORE_DEFAULT_SHADER_PRESET,
CMD_EVENT_LIBUI_TEST
};

View File

@ -58,6 +58,10 @@ static bool bundle_assets_extract_enable = true;
static bool bundle_assets_extract_enable = false;
#endif
#ifdef HAVE_MATERIALUI
static bool materialui_icons_enable = true;
#endif
static const bool def_history_list_enable = true;
static const bool def_playlist_entry_remove = true;
@ -250,6 +254,7 @@ static bool xmb_shadows_enable = false;
static bool xmb_shadows_enable = true;
#endif
static bool xmb_show_settings = true;
static bool xmb_show_favorites = true;
#ifdef HAVE_IMAGEVIEWER
static bool xmb_show_images = true;
#endif
@ -266,6 +271,8 @@ static bool xmb_show_add = true;
#endif
#endif
static float menu_framebuffer_opacity = 0.900;
static float menu_wallpaper_opacity = 0.300;
static float menu_footer_opacity = 1.000;
@ -295,6 +302,11 @@ static bool default_auto_shaders_enable = true;
static bool default_sort_savefiles_enable = false;
static bool default_sort_savestates_enable = false;
static bool default_savestates_in_content_dir = false;
static bool default_savefiles_in_content_dir = false;
static bool default_systemfiles_in_content_dir = false;
static bool default_screenshots_in_content_dir = false;
#if defined(__CELLOS_LV2__) || defined(_XBOX1) || defined(_XBOX360)
static unsigned menu_toggle_gamepad_combo = INPUT_TOGGLE_L3_R3;
#elif defined(VITA)
@ -308,6 +320,8 @@ static unsigned input_backtouch_enable = false;
static unsigned input_backtouch_toggle = false;
#endif
static bool show_physical_inputs = true;
static bool all_users_control_menu = false;
#if defined(ANDROID) || defined(_WIN32)
@ -610,11 +624,17 @@ static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/window
#elif defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(_M_IX86) || defined(_M_IA64)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2010/x86/latest/";
#endif
#elif _MSC_VER == 1400
#if defined(__x86_64__)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2005/x86_64/latest/";
#elif defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(_M_IX86) || defined(_M_IA64)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows-msvc2005/x86/latest/";
#endif
#else
#if defined(__x86_64__)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/win-x86_64/latest/";
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows/x86_64/latest/";
#elif defined(__i386__) || defined(__i486__) || defined(__i686__) || defined(_M_IX86) || defined(_M_IA64)
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/win-x86/latest/";
static char buildbot_server_url[] = "http://buildbot.libretro.com/nightly/windows/x86/latest/";
#endif
#endif
#elif defined(__linux__)

View File

@ -2,6 +2,7 @@
* Copyright (C) 2010-2014 - Hans-Kristian Arntzen
* Copyright (C) 2011-2017 - Daniel De Matteis
* Copyright (C) 2014-2017 - Jean-André Santoni
* Copyright (C) 2015-2017 - Andrés Suárez
* Copyright (C) 2016-2017 - Brad Parker
*
* RetroArch is free software: you can redistribute it and/or modify it under the terms
@ -52,7 +53,7 @@
/* All config related settings go here. */
struct config_bool_setting
{
{
const char *ident;
bool *ptr;
bool def_enable;
@ -61,7 +62,7 @@ struct config_bool_setting
};
struct config_int_setting
{
{
const char *ident;
int *ptr;
bool def_enable;
@ -70,7 +71,7 @@ struct config_int_setting
};
struct config_uint_setting
{
{
const char *ident;
unsigned *ptr;
bool def_enable;
@ -79,7 +80,7 @@ struct config_uint_setting
};
struct config_float_setting
{
{
const char *ident;
float *ptr;
bool def_enable;
@ -88,7 +89,7 @@ struct config_float_setting
};
struct config_array_setting
{
{
const char *ident;
char *ptr;
bool def_enable;
@ -97,7 +98,7 @@ struct config_array_setting
};
struct config_path_setting
{
{
const char *ident;
char *ptr;
bool def_enable;
@ -485,7 +486,7 @@ static enum menu_driver_enum MENU_DEFAULT_DRIVER = MENU_NULL;
tmp[count].def = default_setting; \
tmp[count].handle = handle_setting; \
count++; \
}
}
#define SETTING_BOOL(key, configval, default_enable, default_setting, handle_setting) \
GENERAL_SETTING(key, configval, default_enable, default_setting, struct config_bool_setting, handle_setting)
@ -1014,11 +1015,13 @@ static struct config_path_setting *populate_settings_path(settings_t *settings,
SETTING_PATH("cheat_database_path",
settings->paths.path_cheat_database, false, NULL, true);
#ifdef HAVE_MENU
SETTING_PATH("menu_wallpaper",
SETTING_PATH("menu_wallpaper",
settings->paths.path_menu_wallpaper, false, NULL, true);
#endif
SETTING_PATH("content_history_path",
settings->paths.path_content_history, false, NULL, true);
SETTING_PATH("content_favorites_path",
settings->paths.path_content_favorites, false, NULL, true);
SETTING_PATH("content_music_history_path",
settings->paths.path_content_music_history, false, NULL, true);
SETTING_PATH("content_video_history_path",
@ -1033,7 +1036,7 @@ static struct config_path_setting *populate_settings_path(settings_t *settings,
settings->paths.path_font, false, NULL, true);
SETTING_PATH("cursor_directory",
settings->paths.directory_cursor, false, NULL, true);
SETTING_PATH("content_history_dir",
SETTING_PATH("content_history_dir",
settings->paths.directory_content_history, false, NULL, true);
SETTING_PATH("screenshot_directory",
settings->paths.directory_screenshot, true, NULL, true);
@ -1063,7 +1066,7 @@ static struct config_path_setting *populate_settings_path(settings_t *settings,
settings->paths.directory_autoconfig, false, NULL, true);
SETTING_PATH("audio_filter_dir",
settings->paths.directory_audio_filter, true, NULL, true);
SETTING_PATH("savefile_directory",
SETTING_PATH("savefile_directory",
dir_get_ptr(RARCH_DIR_SAVEFILE), true, NULL, false);
SETTING_PATH("savestate_directory",
dir_get_ptr(RARCH_DIR_SAVESTATE), true, NULL, false);
@ -1078,11 +1081,11 @@ static struct config_path_setting *populate_settings_path(settings_t *settings,
settings->paths.directory_overlay, true, NULL, true);
#endif
#ifndef HAVE_DYNAMIC
SETTING_PATH("libretro_path",
SETTING_PATH("libretro_path",
path_get_ptr(RARCH_PATH_CORE), false, NULL, false);
#endif
SETTING_PATH(
"screenshot_directory",
"screenshot_directory",
settings->paths.directory_screenshot, true, NULL, false);
if (global)
@ -1180,6 +1183,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
#endif
SETTING_BOOL("menu_throttle_framerate", &settings->bools.menu_throttle_framerate, true, true, false);
SETTING_BOOL("menu_linear_filter", &settings->bools.menu_linear_filter, true, true, false);
SETTING_BOOL("menu_horizontal_animation", &settings->bools.menu_horizontal_animation, true, true, false);
SETTING_BOOL("dpi_override_enable", &settings->bools.menu_dpi_override_enable, true, menu_dpi_override_enable, false);
SETTING_BOOL("menu_pause_libretro", &settings->bools.menu_pause_libretro, true, true, false);
SETTING_BOOL("menu_mouse_enable", &settings->bools.menu_mouse_enable, true, def_mouse_enable, false);
@ -1188,9 +1192,13 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("menu_battery_level_enable", &settings->bools.menu_battery_level_enable, true, true, false);
SETTING_BOOL("menu_core_enable", &settings->bools.menu_core_enable, true, true, false);
SETTING_BOOL("menu_dynamic_wallpaper_enable", &settings->bools.menu_dynamic_wallpaper_enable, true, false, false);
#ifdef HAVE_MATERIALUI
SETTING_BOOL("materialui_icons_enable", &settings->bools.menu_materialui_icons_enable, true, materialui_icons_enable, false);
#endif
#ifdef HAVE_XMB
SETTING_BOOL("xmb_shadows_enable", &settings->bools.menu_xmb_shadows_enable, true, xmb_shadows_enable, false);
SETTING_BOOL("xmb_show_settings", &settings->bools.menu_xmb_show_settings, true, xmb_show_settings, false);
SETTING_BOOL("xmb_show_favorites", &settings->bools.menu_xmb_show_favorites, true, xmb_show_favorites, false);
#ifdef HAVE_IMAGEVIEWER
SETTING_BOOL("xmb_show_images", &settings->bools.menu_xmb_show_images, true, xmb_show_images, false);
#endif
@ -1204,14 +1212,14 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("xmb_show_netplay", &settings->bools.menu_xmb_show_netplay, true, xmb_show_netplay, false);
#endif
SETTING_BOOL("xmb_show_history", &settings->bools.menu_xmb_show_history, true, xmb_show_history, false);
#ifdef HAVE_LIBRETRODB
#ifdef HAVE_LIBRETRODB
SETTING_BOOL("xmb_show_add", &settings->bools.menu_xmb_show_add, true, xmb_show_add, false);
#endif
#endif
SETTING_BOOL("filter_by_current_core", &settings->bools.filter_by_current_core, false, false /* TODO */, false);
SETTING_BOOL("rgui_show_start_screen", &settings->bools.menu_show_start_screen, false, false /* TODO */, false);
SETTING_BOOL("menu_navigation_wraparound_enable", &settings->bools.menu_navigation_wraparound_enable, true, true, false);
SETTING_BOOL("menu_navigation_browser_filter_supported_extensions_enable",
SETTING_BOOL("menu_navigation_browser_filter_supported_extensions_enable",
&settings->bools.menu_navigation_browser_filter_supported_extensions_enable, true, true, false);
SETTING_BOOL("menu_show_advanced_settings", &settings->bools.menu_show_advanced_settings, true, show_advanced_settings, false);
#endif
@ -1224,6 +1232,7 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
#ifdef HAVE_OVERLAY
SETTING_BOOL("input_overlay_enable", &settings->bools.input_overlay_enable, true, config_overlay_enable_default(), false);
SETTING_BOOL("input_overlay_enable_autopreferred", &settings->bools.input_overlay_enable_autopreferred, true, true, false);
SETTING_BOOL("input_overlay_show_physical_inputs", &settings->bools.input_overlay_show_physical_inputs, true, false, false);
SETTING_BOOL("input_overlay_hide_in_menu", &settings->bools.input_overlay_hide_in_menu, true, overlay_hide_in_menu, false);
#endif
#ifdef HAVE_COMMAND
@ -1258,6 +1267,11 @@ static struct config_bool_setting *populate_settings_bool(settings_t *settings,
SETTING_BOOL("audio_wasapi_float_format", &settings->bools.audio_wasapi_float_format, true, wasapi_float_format, false);
#endif
SETTING_BOOL("savestates_in_content_dir", &settings->bools.savestates_in_content_dir, true, default_savestates_in_content_dir, false);
SETTING_BOOL("savefiles_in_content_dir", &settings->bools.savefiles_in_content_dir, true, default_savefiles_in_content_dir, false);
SETTING_BOOL("systemfiles_in_content_dir", &settings->bools.systemfiles_in_content_dir, true, default_systemfiles_in_content_dir, false);
SETTING_BOOL("screenshots_in_content_dir", &settings->bools.screenshots_in_content_dir, true, default_screenshots_in_content_dir, false);
if (global)
{
SETTING_BOOL("custom_bgm_enable", &global->console.sound.system_bgm_enable, true, false, false);
@ -1286,6 +1300,7 @@ static struct config_float_setting *populate_settings_float(settings_t *settings
#endif
#ifdef HAVE_MENU
SETTING_FLOAT("menu_wallpaper_opacity", &settings->floats.menu_wallpaper_opacity, true, menu_wallpaper_opacity, false);
SETTING_FLOAT("menu_framebuffer_opacity", &settings->floats.menu_framebuffer_opacity, true, menu_framebuffer_opacity, false);
SETTING_FLOAT("menu_footer_opacity", &settings->floats.menu_footer_opacity, true, menu_footer_opacity, false);
SETTING_FLOAT("menu_header_opacity", &settings->floats.menu_header_opacity, true, menu_header_opacity, false);
#endif
@ -1366,6 +1381,7 @@ static struct config_uint_setting *populate_settings_uint(settings_t *settings,
#endif
SETTING_UINT("bundle_assets_extract_version_current", &settings->uints.bundle_assets_extract_version_current, true, 0, false);
SETTING_UINT("bundle_assets_extract_last_version", &settings->uints.bundle_assets_extract_last_version, true, 0, false);
SETTING_UINT("input_overlay_show_physical_inputs_port", &settings->uints.input_overlay_show_physical_inputs_port, true, 0, false);
*size = count;
@ -1646,6 +1662,7 @@ static void config_set_defaults(void)
*settings->paths.path_core_options = '\0';
*settings->paths.path_content_history = '\0';
*settings->paths.path_content_favorites = '\0';
*settings->paths.path_content_music_history = '\0';
*settings->paths.path_content_image_history = '\0';
*settings->paths.path_content_video_history = '\0';
@ -1923,7 +1940,7 @@ static config_file_t *open_default_config_file(void)
RARCH_WARN("Created new config file in: \"%s\".\n", conf_path);
}
#elif !defined(RARCH_CONSOLE)
bool has_application_data =
bool has_application_data =
fill_pathname_application_data(application_data,
sizeof(application_data));
@ -2099,7 +2116,7 @@ static bool check_shader_compatibility(enum file_path_enum enum_idx)
return true;
}
if (string_is_equal_fast(settings->arrays.video_driver, "gl", 2) ||
if (string_is_equal_fast(settings->arrays.video_driver, "gl", 2) ||
string_is_equal_fast(settings->arrays.video_driver, "d3d", 3)
)
{
@ -2170,7 +2187,7 @@ static void config_get_hex_base(config_file_t *conf,
* Loads a config file and reads all the values into memory.
*
*/
static bool config_load_file(const char *path, bool set_defaults,
static bool config_load_file(const char *path, bool set_defaults,
settings_t *settings)
{
unsigned i;
@ -2473,6 +2490,25 @@ static bool config_load_file(const char *path, bool set_defaults,
}
}
if (string_is_empty(settings->paths.path_content_favorites))
{
if (string_is_empty(settings->paths.directory_content_history))
{
fill_pathname_resolve_relative(
settings->paths.path_content_favorites,
path_get(RARCH_PATH_CONFIG),
file_path_str(FILE_PATH_CONTENT_FAVORITES),
sizeof(settings->paths.path_content_favorites));
}
else
{
fill_pathname_join(settings->paths.path_content_favorites,
settings->paths.directory_content_history,
file_path_str(FILE_PATH_CONTENT_FAVORITES),
sizeof(settings->paths.path_content_favorites));
}
}
if (string_is_empty(settings->paths.path_content_music_history))
{
if (string_is_empty(settings->paths.directory_content_history))
@ -2706,10 +2742,10 @@ end:
* This function only has an effect if a game-specific or core-specific
* configuration file exists at respective locations.
*
* core-specific: $CONFIG_DIR/$CORE_NAME/$CORE_NAME.cfg
* core-specific: $CONFIG_DIR/$CORE_NAME/$CORE_NAME.cfg
* fallback: $CURRENT_CFG_LOCATION/$CORE_NAME/$CORE_NAME.cfg
*
* game-specific: $CONFIG_DIR/$CORE_NAME/$ROM_NAME.cfg
* game-specific: $CONFIG_DIR/$CORE_NAME/$ROM_NAME.cfg
* fallback: $CURRENT_CFG_LOCATION/$CORE_NAME/$GAME_NAME.cfg
*
* Returns: false if there was an error or no action was performed.
@ -2805,7 +2841,7 @@ bool config_load_override(void)
/* Re-load the configuration with any overrides that might have been found */
buf[0] = '\0';
/* Store the libretro_path we're using since it will be
/* Store the libretro_path we're using since it will be
* overwritten by the override when reloading. */
strlcpy(buf, path_get(RARCH_PATH_CORE), sizeof(buf));
@ -2925,6 +2961,7 @@ bool config_load_remap(void)
if (input_remapping_load_file(new_conf, game_path))
{
runloop_msg_queue_push("Game remap file loaded.", 1, 100, true);
rarch_ctl(RARCH_CTL_SET_REMAPS_GAME_ACTIVE, NULL);
return true;
}
}
@ -2944,6 +2981,7 @@ bool config_load_remap(void)
if (input_remapping_load_file(new_conf, core_path))
{
runloop_msg_queue_push("Core remap file loaded.", 1, 100, true);
rarch_ctl(RARCH_CTL_SET_REMAPS_CORE_ACTIVE, NULL);
return true;
}
}
@ -3252,7 +3290,7 @@ static void save_keybinds_user(config_file_t *conf, unsigned user)
*/
void config_load(void)
{
/* Flush out some states that could have been
/* Flush out some states that could have been
* set by core environment variables */
core_unset_input_descriptors();
@ -3442,7 +3480,7 @@ bool config_save_file(const char *path)
#ifdef HAVE_MENU
config_set_path(conf, "xmb_font",
!string_is_empty(settings->paths.path_menu_xmb_font)
!string_is_empty(settings->paths.path_menu_xmb_font)
? settings->paths.path_menu_xmb_font : "");
#endif
@ -3633,7 +3671,7 @@ bool config_save_overrides(int override_type)
fill_pathname_application_special(config_directory, sizeof(config_directory),
APPLICATION_SPECIAL_DIRECTORY_CONFIG);
fill_pathname_join(override_directory, config_directory, core_name,
fill_pathname_join(override_directory, config_directory, core_name,
sizeof(override_directory));
if(!path_file_exists(override_directory))
@ -3690,9 +3728,9 @@ bool config_save_overrides(int override_type)
{
if ((*bool_settings[i].ptr) != (*bool_overrides[i].ptr))
{
RARCH_LOG(" original: %s=%d\n",
RARCH_LOG(" original: %s=%d\n",
bool_settings[i].ident, (*bool_settings[i].ptr));
RARCH_LOG(" override: %s=%d\n",
RARCH_LOG(" override: %s=%d\n",
bool_overrides[i].ident, (*bool_overrides[i].ptr));
config_set_bool(conf, bool_overrides[i].ident,
(*bool_overrides[i].ptr));
@ -3702,9 +3740,9 @@ bool config_save_overrides(int override_type)
{
if ((*int_settings[i].ptr) != (*int_overrides[i].ptr))
{
RARCH_LOG(" original: %s=%d\n",
RARCH_LOG(" original: %s=%d\n",
int_settings[i].ident, (*int_settings[i].ptr));
RARCH_LOG(" override: %s=%d\n",
RARCH_LOG(" override: %s=%d\n",
int_overrides[i].ident, (*int_overrides[i].ptr));
config_set_int(conf, int_overrides[i].ident,
(*int_overrides[i].ptr));
@ -3714,9 +3752,9 @@ bool config_save_overrides(int override_type)
{
if ((*uint_settings[i].ptr) != (*uint_overrides[i].ptr))
{
RARCH_LOG(" original: %s=%d\n",
RARCH_LOG(" original: %s=%d\n",
uint_settings[i].ident, (*uint_settings[i].ptr));
RARCH_LOG(" override: %s=%d\n",
RARCH_LOG(" override: %s=%d\n",
uint_overrides[i].ident, (*uint_overrides[i].ptr));
config_set_int(conf, uint_overrides[i].ident,
(*uint_overrides[i].ptr));
@ -3726,9 +3764,9 @@ bool config_save_overrides(int override_type)
{
if ((*float_settings[i].ptr) != (*float_overrides[i].ptr))
{
RARCH_LOG(" original: %s=%f\n",
RARCH_LOG(" original: %s=%f\n",
float_settings[i].ident, *float_settings[i].ptr);
RARCH_LOG(" override: %s=%f\n",
RARCH_LOG(" override: %s=%f\n",
float_overrides[i].ident, *float_overrides[i].ptr);
config_set_float(conf, float_overrides[i].ident,
*float_overrides[i].ptr);
@ -3739,9 +3777,9 @@ bool config_save_overrides(int override_type)
{
if (!string_is_equal(array_settings[i].ptr, array_overrides[i].ptr))
{
RARCH_LOG(" original: %s=%s\n",
RARCH_LOG(" original: %s=%s\n",
array_settings[i].ident, array_settings[i].ptr);
RARCH_LOG(" override: %s=%s\n",
RARCH_LOG(" override: %s=%s\n",
array_overrides[i].ident, array_overrides[i].ptr);
config_set_string(conf, array_overrides[i].ident,
array_overrides[i].ptr);
@ -3752,9 +3790,9 @@ bool config_save_overrides(int override_type)
{
if (!string_is_equal(path_settings[i].ptr, path_overrides[i].ptr))
{
RARCH_LOG(" original: %s=%s\n",
RARCH_LOG(" original: %s=%s\n",
path_settings[i].ident, path_settings[i].ptr);
RARCH_LOG(" override: %s=%s\n",
RARCH_LOG(" override: %s=%s\n",
path_overrides[i].ident, path_overrides[i].ptr);
config_set_path(conf, path_overrides[i].ident,
path_overrides[i].ptr);
@ -3776,7 +3814,8 @@ bool config_save_overrides(int override_type)
snprintf(cfg, sizeof(cfg), "input_player%u_joypad_index", i + 1);
config_set_int(conf, cfg, overrides->uints.input_joypad_map[i]);
}
if (input_config_get_device(i) != overrides->uints.input_libretro_device[i])
if (settings->uints.input_libretro_device[i] != overrides->uints.input_libretro_device[i])
{
snprintf(cfg, sizeof(cfg), "input_libretro_device_p%u", i + 1);
config_set_int(conf, cfg, overrides->uints.input_libretro_device[i]);

View File

@ -88,6 +88,7 @@ typedef struct settings
bool input_overlay_enable;
bool input_overlay_enable_autopreferred;
bool input_overlay_hide_in_menu;
bool input_overlay_show_physical_inputs;
bool input_descriptor_label_show;
bool input_descriptor_hide_unbound;
bool input_all_users_control_menu;
@ -119,10 +120,13 @@ typedef struct settings
bool menu_show_advanced_settings;
bool menu_throttle_framerate;
bool menu_linear_filter;
bool menu_horizontal_animation;
bool menu_show_online_updater;
bool menu_show_core_updater;
bool menu_materialui_icons_enable;
bool menu_xmb_shadows_enable;
bool menu_xmb_show_settings;
bool menu_xmb_show_favorites;
bool menu_xmb_show_images;
bool menu_xmb_show_music;
bool menu_xmb_show_video;
@ -209,6 +213,11 @@ typedef struct settings
bool sort_savestates_enable;
bool config_save_on_exit;
bool show_hidden_files;
bool savefiles_in_content_dir;
bool savestates_in_content_dir;
bool screenshots_in_content_dir;
bool systemfiles_in_content_dir;
#ifdef HAVE_LAKKA
bool ssh_enable;
bool samba_enable;
@ -230,6 +239,7 @@ typedef struct settings
float video_msg_color_b;
float menu_wallpaper_opacity;
float menu_framebuffer_opacity;
float menu_footer_opacity;
float menu_header_opacity;
@ -322,6 +332,8 @@ typedef struct settings
unsigned camera_width;
unsigned camera_height;
unsigned input_overlay_show_physical_inputs_port;
} uints;
struct
@ -373,6 +385,7 @@ typedef struct settings
char path_softfilter_plugin[PATH_MAX_LENGTH];
char path_core_options[PATH_MAX_LENGTH];
char path_content_history[PATH_MAX_LENGTH];
char path_content_favorites[PATH_MAX_LENGTH];
char path_content_music_history[PATH_MAX_LENGTH];
char path_content_image_history[PATH_MAX_LENGTH];
char path_content_video_history[PATH_MAX_LENGTH];
@ -389,6 +402,7 @@ typedef struct settings
char directory_video_filter[PATH_MAX_LENGTH];
char directory_video_shader[PATH_MAX_LENGTH];
char directory_content_history[PATH_MAX_LENGTH];
char directory_content_favorites[PATH_MAX_LENGTH];
char directory_libretro[PATH_MAX_LENGTH];
char directory_cursor[PATH_MAX_LENGTH];
char directory_input_remapping[PATH_MAX_LENGTH];

View File

@ -102,6 +102,7 @@ struct defaults
#ifndef IS_SALAMANDER
playlist_t *content_history;
playlist_t *content_favorites;
#ifdef HAVE_IMAGEVIEWER
playlist_t *image_history;
#endif

21
deps/ibxm/README vendored Normal file
View File

@ -0,0 +1,21 @@
Micromod (c)2017 mumart@gmail.com
A good-quality player library for the ProTracker MOD music format
for Javascript (HTML5 Web Audio), Java, ANSI C (SDL) and Pascal (SDL).
Also hosted here is IBXM, a player library for the ProTracker MOD,
Scream Tracker 3 S3M, and FastTracker 2 XM music formats for Javascript
(HTML5 Web Audio), Java and ANSI C.
The Java version of Micromod contains a powerful command-line tool for
the creation of MOD files from textual MT files and WAV samples.
There is some basic documentation built-in to the tool and some example
MT files are contained in the songs directory. Some knowledge of the
ProTracker MOD format, audio synthesis and "tracking" is assumed.
If you have any questions or feedback please feel free to
contact me at the above email address!
Cheers,
Martin

1922
deps/ibxm/ibxm.c vendored Normal file

File diff suppressed because it is too large Load Diff

71
deps/ibxm/ibxm.h vendored Normal file
View File

@ -0,0 +1,71 @@
/* ibxm/ac mod/xm/s3m replay (c)mumart@gmail.com */
#ifndef __IBXM_H__
#define __IBXM_H__
extern const char *IBXM_VERSION;
struct data {
char *buffer;
int length;
};
struct sample {
char name[ 32 ];
int loop_start, loop_length;
short volume, panning, rel_note, fine_tune, *data;
};
struct envelope {
char enabled, sustain, looped, num_points;
short sustain_tick, loop_start_tick, loop_end_tick;
short points_tick[ 16 ], points_ampl[ 16 ];
};
struct instrument {
int num_samples, vol_fadeout;
char name[ 32 ], key_to_sample[ 97 ];
char vib_type, vib_sweep, vib_depth, vib_rate;
struct envelope vol_env, pan_env;
struct sample *samples;
};
struct pattern {
int num_channels, num_rows;
char *data;
};
struct module {
char name[ 32 ];
int num_channels, num_instruments;
int num_patterns, sequence_len, restart_pos;
int default_gvol, default_speed, default_tempo, c2_rate, gain;
int linear_periods, fast_vol_slides;
unsigned char *default_panning, *sequence;
struct pattern *patterns;
struct instrument *instruments;
};
/* Allocate and initialize a module from the specified data, returns NULL on error.
Message should point to a 64-character buffer to receive error messages. */
struct module* module_load( struct data *data, char *message );
/* Deallocate the specified module. */
void dispose_module( struct module *module );
/* Allocate and initialize a replay with the specified module and sampling rate. */
struct replay* new_replay( struct module *module, int sample_rate, int interpolation );
/* Deallocate the specified replay. */
void dispose_replay( struct replay *replay );
/* Returns the song duration in samples at the current sampling rate. */
int replay_calculate_duration( struct replay *replay );
/* Seek to approximately the specified sample position.
The actual sample position reached is returned. */
int replay_seek( struct replay *replay, int sample_pos );
/* Set the pattern in the sequence to play. The tempo is reset to the default. */
void replay_set_sequence_pos( struct replay *replay, int pos );
/* Generates audio and returns the number of stereo samples written into mix_buf. */
int replay_get_audio( struct replay *replay, int *mix_buf );
/* Returns the length of the output buffer required by replay_get_audio(). */
int calculate_mix_buf_len( int sample_rate );
#endif

37
deps/ibxm/licence.txt vendored Normal file
View File

@ -0,0 +1,37 @@
---
Copyright (c) 2015, Martin Cameron
All rights reserved.
Redistribution and use in source and binary forms, with or
without modification, are permitted provided that the
following conditions are met:
* Redistributions of source code must retain the above
copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the
above copyright notice, this list of conditions and the
following disclaimer in the documentation and/or other
materials provided with the distribution.
* Neither the name of the organization nor the names of
its contributors may be used to endorse or promote
products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
---

9
deps/libui/LICENSE vendored Normal file
View File

@ -0,0 +1,9 @@
Copyright (c) 2014 Pietro Gagliardi
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
(this is called the MIT License or Expat License; see http://www.opensource.org/licenses/MIT)

16
deps/libui/common/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,16 @@
# 3 june 2016
list(APPEND _LIBUI_SOURCES
common/areaevents.c
common/control.c
common/debug.c
common/matrix.c
common/shouldquit.c
common/userbugs.c
)
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
list(APPEND _LIBUI_INCLUDEDIRS
common
)
set(_LIBUI_INCLUDEDIRS ${_LIBUI_INCLUDEDIRS} PARENT_SCOPE)

View File

@ -61,9 +61,11 @@ void uiControlDisable(uiControl *c)
uiControl *uiAllocControl(size_t size, uint32_t OSsig, uint32_t typesig, const char *typenamestr)
{
uiControl *c = (uiControl *) uiAlloc(size, typenamestr);
c->Signature = uiControlSignature;
c->OSSignature = OSsig;
uiControl *c;
c = (uiControl *) uiAlloc(size, typenamestr);
c->Signature = uiControlSignature;
c->OSSignature = OSsig;
c->TypeSignature = typesig;
return c;
}
@ -90,11 +92,10 @@ void uiControlVerifySetParent(uiControl *c, uiControl *parent)
int uiControlEnabledToUser(uiControl *c)
{
while (c != NULL)
{
if (!uiControlEnabled(c))
return 0;
c = uiControlParent(c);
}
while (c != NULL) {
if (!uiControlEnabled(c))
return 0;
c = uiControlParent(c);
}
return 1;
}

View File

@ -1,4 +1,4 @@
/* 24 april 2016 */
// 24 april 2016
#define uiAreaSignature 0x41726561
#define uiBoxSignature 0x426F784C

View File

@ -1,4 +1,4 @@
/* 11 october 2015 */
// 11 october 2015
#include <math.h>
#include "../ui.h"
#include "uipriv.h"
@ -13,17 +13,17 @@ void uiDrawMatrixSetIdentity(uiDrawMatrix *m)
m->M32 = 0;
}
/* The rest of this file provides basic utilities in case the platform doesn't provide any of its own for these tasks.
* Keep these as minimal as possible. They should generally not call other fallbacks.
// The rest of this file provides basic utilities in case the platform doesn't provide any of its own for these tasks.
// Keep these as minimal as possible. They should generally not call other fallbacks.
* see https://msdn.microsoft.com/en-us/library/windows/desktop/ff684171%28v=vs.85%29.aspx#skew_transform
* TODO see if there's a way we can avoid the multiplication */
// see https://msdn.microsoft.com/en-us/library/windows/desktop/ff684171%28v=vs.85%29.aspx#skew_transform
// TODO see if there's a way we can avoid the multiplication
void fallbackSkew(uiDrawMatrix *m, double x, double y, double xamount, double yamount)
{
uiDrawMatrix n;
uiDrawMatrixSetIdentity(&n);
/* TODO explain this */
// TODO explain this
n.M12 = tan(yamount);
n.M21 = tan(xamount);
n.M31 = -y * tan(xamount);
@ -37,13 +37,13 @@ void scaleCenter(double xCenter, double yCenter, double *x, double *y)
*y = yCenter - (*y * yCenter);
}
/* the basic algorithm is from cairo
* but it's the same algorithm as the transform point,
* just without M31 and M32 taken into account, so let's just do that instead */
// the basic algorithm is from cairo
// but it's the same algorithm as the transform point, just without M31 and M32 taken into account, so let's just do that instead
void fallbackTransformSize(uiDrawMatrix *m, double *x, double *y)
{
uiDrawMatrix m2 = *m;
uiDrawMatrix m2;
m2 = *m;
m2.M31 = 0;
m2.M32 = 0;
uiDrawMatrixTransformPoint(&m2, x, y);

View File

@ -1,4 +1,4 @@
/* 6 april 2015 */
// 6 april 2015
#ifdef __cplusplus
extern "C" {
#endif
@ -13,7 +13,7 @@ extern void *uiAlloc(size_t, const char *);
extern void *uiRealloc(void *, size_t, const char *);
extern void uiFree(void *);
/* ugh, this was only introduced in MSVC 2015... */
// ugh, this was only introduced in MSVC 2015...
#ifdef _MSC_VER
#define __func__ __FUNCTION__
#endif
@ -25,17 +25,16 @@ extern void _implbug(const char *file, const char *line, const char *func, const
extern void _userbug(const char *file, const char *line, const char *func, const char *format, ...);
#define userbug(...) _userbug(__FILE__, _ns(__LINE__), __func__, __VA_ARGS__)
/* control.c */
// control.c
extern uiControl *newControl(size_t size, uint32_t OSsig, uint32_t typesig, const char *typenamestr);
/* shouldquit.c */
// shouldquit.c
extern int shouldQuit(void);
/* areaevents.c */
// areaevents.c
typedef struct clickCounter clickCounter;
/* you should call Reset() to zero-initialize a new instance
* it doesn't matter that all the non-count fields are zero: the first click will fail the curButton test straightaway, so it'll return 1 and set the rest of the structure accordingly */
// you should call Reset() to zero-initialize a new instance
// it doesn't matter that all the non-count fields are zero: the first click will fail the curButton test straightaway, so it'll return 1 and set the rest of the structure accordingly
struct clickCounter {
int curButton;
int rectX0;
@ -49,7 +48,7 @@ int clickCounterClick(clickCounter *c, int button, int x, int y, uintptr_t time,
extern void clickCounterReset(clickCounter *);
extern int fromScancode(uintptr_t, uiAreaKeyEvent *);
/* matrix.c */
// matrix.c
extern void fallbackSkew(uiDrawMatrix *, double, double, double, double);
extern void scaleCenter(double, double, double *, double *);
extern void fallbackTransformSize(uiDrawMatrix *, double *, double *);

79
deps/libui/darwin/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,79 @@
# 3 june 2016
list(APPEND _LIBUI_SOURCES
darwin/alloc.m
darwin/area.m
darwin/areaevents.m
darwin/autolayout.m
darwin/box.m
darwin/button.m
darwin/checkbox.m
darwin/colorbutton.m
darwin/combobox.m
darwin/control.m
darwin/datetimepicker.m
darwin/debug.m
darwin/draw.m
darwin/drawtext.m
darwin/editablecombo.m
darwin/entry.m
darwin/fontbutton.m
darwin/form.m
darwin/grid.m
darwin/group.m
darwin/image.m
darwin/label.m
darwin/main.m
darwin/map.m
darwin/menu.m
darwin/multilineentry.m
darwin/progressbar.m
darwin/radiobuttons.m
darwin/scrollview.m
darwin/separator.m
darwin/slider.m
darwin/spinbox.m
darwin/stddialogs.m
darwin/tab.m
darwin/text.m
darwin/util.m
darwin/window.m
darwin/winmoveresize.m
)
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
list(APPEND _LIBUI_INCLUDEDIRS
darwin
)
set(_LIBUI_INCLUDEDIRS _LIBUI_INCLUDEDIRS PARENT_SCOPE)
set(_LIBUINAME libui PARENT_SCOPE)
if(NOT BUILD_SHARED_LIBS)
set(_LIBUINAME libui-temporary PARENT_SCOPE)
endif()
# thanks to Mr-Hide in irc.freenode.net/#cmake
macro(_handle_static)
set_target_properties(${_LIBUINAME} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(_aname $<TARGET_FILE:${_LIBUINAME}>)
set(_lname libui-combined.list)
set(_oname libui-combined.o)
add_custom_command(
OUTPUT ${_oname}
COMMAND
nm -m ${_aname} | sed -E -n "'s/^[0-9a-f]* \\([A-Z_]+,[a-z_]+\\) external //p'" > ${_lname}
COMMAND
ld -exported_symbols_list ${_lname} -r -all_load ${_aname} -o ${_oname}
COMMENT "Removing hidden symbols")
add_library(libui STATIC ${_oname})
# otherwise cmake won't know which linker to use
set_target_properties(libui PROPERTIES
LINKER_LANGUAGE C)
set(_aname)
set(_lname)
set(_oname)
endmacro()
set(_LIBUI_LIBS
objc "-framework Foundation" "-framework AppKit"
PARENT_SCOPE)

86
deps/libui/ui.h vendored
View File

@ -1,6 +1,6 @@
/* 6 april 2015 */
// 6 april 2015
/* TODO add a uiVerifyControlType() function that can be used by control implementations to verify controls */
// TODO add a uiVerifyControlType() function that can be used by control implementations to verify controls
#ifndef __LIBUI_UI_H__
#define __LIBUI_UI_H__
@ -12,7 +12,7 @@
extern "C" {
#endif
/* this macro is generated by cmake */
// this macro is generated by cmake
#ifdef libui_EXPORTS
#ifdef _WIN32
#define _UI_EXTERN __declspec(dllexport) extern
@ -20,19 +20,19 @@ extern "C" {
#define _UI_EXTERN __attribute__((visibility("default"))) extern
#endif
#else
/* TODO add __declspec(dllimport) on windows, but only if not static */
// TODO add __declspec(dllimport) on windows, but only if not static
#define _UI_EXTERN extern
#endif
/* C++ is really really really really really really dumb about enums, so screw that and just make them anonymous
* This has the advantage of being ABI-able should we ever need an ABI... */
// C++ is really really really really really really dumb about enums, so screw that and just make them anonymous
// This has the advantage of being ABI-able should we ever need an ABI...
#define _UI_ENUM(s) typedef unsigned int s; enum
/* This constant is provided because M_PI is nonstandard.
* This comes from Go's math.Pi, which in turn comes from http://oeis.org/A000796. */
// This constant is provided because M_PI is nonstandard.
// This comes from Go's math.Pi, which in turn comes from http://oeis.org/A000796.
#define uiPi 3.14159265358979323846264338327950288419716939937510582097494459
/* TODO uiBool? */
// TODO uiBool?
typedef struct uiInitOptions uiInitOptions;
@ -73,7 +73,7 @@ struct uiControl {
void (*Enable)(uiControl *);
void (*Disable)(uiControl *);
};
/* TOOD add argument names to all arguments */
// TOOD add argument names to all arguments
#define uiControl(this) ((uiControl *) (this))
_UI_EXTERN void uiControlDestroy(uiControl *);
_UI_EXTERN uintptr_t uiControlHandle(uiControl *);
@ -90,7 +90,7 @@ _UI_EXTERN void uiControlDisable(uiControl *);
_UI_EXTERN uiControl *uiAllocControl(size_t n, uint32_t OSsig, uint32_t typesig, const char *typenamestr);
_UI_EXTERN void uiFreeControl(uiControl *);
/* TODO make sure all controls have these */
// TODO make sure all controls have these
_UI_EXTERN void uiControlVerifySetParent(uiControl *, uiControl *);
_UI_EXTERN int uiControlEnabledToUser(uiControl *);
@ -174,11 +174,10 @@ _UI_EXTERN int uiGroupMargined(uiGroup *g);
_UI_EXTERN void uiGroupSetMargined(uiGroup *g, int margined);
_UI_EXTERN uiGroup *uiNewGroup(const char *title);
/* spinbox/slider rules:
* setting value outside of range will automatically clamp
* initial value is minimum
* complaint if min >= max?
*/
// spinbox/slider rules:
// setting value outside of range will automatically clamp
// initial value is minimum
// complaint if min >= max?
typedef struct uiSpinbox uiSpinbox;
#define uiSpinbox(this) ((uiSpinbox *) (this))
@ -218,7 +217,7 @@ typedef struct uiEditableCombobox uiEditableCombobox;
_UI_EXTERN void uiEditableComboboxAppend(uiEditableCombobox *c, const char *text);
_UI_EXTERN char *uiEditableComboboxText(uiEditableCombobox *c);
_UI_EXTERN void uiEditableComboboxSetText(uiEditableCombobox *c, const char *text);
/* TODO what do we call a function that sets the currently selected item and fills the text field with it? editable comboboxes have no consistent concept of selected item */
// TODO what do we call a function that sets the currently selected item and fills the text field with it? editable comboboxes have no consistent concept of selected item
_UI_EXTERN void uiEditableComboboxOnChanged(uiEditableCombobox *c, void (*f)(uiEditableCombobox *c, void *data), void *data);
_UI_EXTERN uiEditableCombobox *uiNewEditableCombobox(void);
@ -236,7 +235,7 @@ _UI_EXTERN uiDateTimePicker *uiNewDateTimePicker(void);
_UI_EXTERN uiDateTimePicker *uiNewDatePicker(void);
_UI_EXTERN uiDateTimePicker *uiNewTimePicker(void);
/* TODO provide a facility for entering tab stops? */
// TODO provide a facility for entering tab stops?
typedef struct uiMultilineEntry uiMultilineEntry;
#define uiMultilineEntry(this) ((uiMultilineEntry *) (this))
_UI_EXTERN char *uiMultilineEntryText(uiMultilineEntry *e);
@ -292,8 +291,7 @@ struct uiAreaHandler {
// TODO RTL layouts?
// TODO reconcile edge and corner naming
_UI_ENUM(uiWindowResizeEdge)
{
_UI_ENUM(uiWindowResizeEdge) {
uiWindowResizeEdgeLeft,
uiWindowResizeEdgeTop,
uiWindowResizeEdgeRight,
@ -301,10 +299,10 @@ _UI_ENUM(uiWindowResizeEdge)
uiWindowResizeEdgeTopLeft,
uiWindowResizeEdgeTopRight,
uiWindowResizeEdgeBottomLeft,
uiWindowResizeEdgeBottomRight
/* TODO have one for keyboard resizes?
* TODO GDK doesn't seem to have any others, including for keyboards...
* TODO way to bring up the system menu instead? */
uiWindowResizeEdgeBottomRight,
// TODO have one for keyboard resizes?
// TODO GDK doesn't seem to have any others, including for keyboards...
// TODO way to bring up the system menu instead?
};
#define uiArea(this) ((uiArea *) (this))
@ -348,29 +346,29 @@ _UI_ENUM(uiDrawBrushType) {
uiDrawBrushTypeSolid,
uiDrawBrushTypeLinearGradient,
uiDrawBrushTypeRadialGradient,
uiDrawBrushTypeImage
uiDrawBrushTypeImage,
};
_UI_ENUM(uiDrawLineCap) {
uiDrawLineCapFlat,
uiDrawLineCapRound,
uiDrawLineCapSquare
uiDrawLineCapSquare,
};
_UI_ENUM(uiDrawLineJoin) {
uiDrawLineJoinMiter,
uiDrawLineJoinRound,
uiDrawLineJoinBevel
uiDrawLineJoinBevel,
};
/* this is the default for botoh cairo and Direct2D (in the latter case, from the C++ helper functions)
* Core Graphics doesn't explicitly specify a default, but NSBezierPath allows you to choose one, and this is the initial value
* so we're good to use it too! */
// this is the default for botoh cairo and Direct2D (in the latter case, from the C++ helper functions)
// Core Graphics doesn't explicitly specify a default, but NSBezierPath allows you to choose one, and this is the initial value
// so we're good to use it too!
#define uiDrawDefaultMiterLimit 10.0
_UI_ENUM(uiDrawFillMode) {
uiDrawFillModeWinding,
uiDrawFillModeAlternate
uiDrawFillModeAlternate,
};
struct uiDrawMatrix {
@ -385,13 +383,13 @@ struct uiDrawMatrix {
struct uiDrawBrush {
uiDrawBrushType Type;
/* solid brushes */
// solid brushes
double R;
double G;
double B;
double A;
/* gradient brushes */
// gradient brushes
double X0; // linear: start X, radial: start X
double Y0; // linear: start Y, radial: start Y
double X1; // linear: end X, radial: outer circle center X
@ -504,13 +502,13 @@ _UI_ENUM(uiDrawTextWeight) {
uiDrawTextWeightBold,
uiDrawTextWeightUltraBold,
uiDrawTextWeightHeavy,
uiDrawTextWeightUltraHeavy
uiDrawTextWeightUltraHeavy,
};
_UI_ENUM(uiDrawTextItalic) {
uiDrawTextItalicNormal,
uiDrawTextItalicOblique,
uiDrawTextItalicItalic
uiDrawTextItalicItalic,
};
_UI_ENUM(uiDrawTextStretch) {
@ -522,7 +520,7 @@ _UI_ENUM(uiDrawTextStretch) {
uiDrawTextStretchSemiExpanded,
uiDrawTextStretchExpanded,
uiDrawTextStretchExtraExpanded,
uiDrawTextStretchUltraExpanded
uiDrawTextStretchUltraExpanded,
};
struct uiDrawTextFontDescriptor {
@ -563,10 +561,10 @@ _UI_EXTERN void uiDrawTextLayoutSetColor(uiDrawTextLayout *layout, int startChar
_UI_EXTERN void uiDrawText(uiDrawContext *c, double x, double y, uiDrawTextLayout *layout);
_UI_ENUM(uiModifiers) {
uiModifierCtrl = 1 << 0,
uiModifierAlt = 1 << 1,
uiModifierCtrl = 1 << 0,
uiModifierAlt = 1 << 1,
uiModifierShift = 1 << 2,
uiModifierSuper = 1 << 3
uiModifierSuper = 1 << 3,
};
// TODO document drag captures
@ -628,7 +626,7 @@ _UI_ENUM(uiExtKey) {
uiExtKeyNAdd,
uiExtKeyNSubtract,
uiExtKeyNMultiply,
uiExtKeyNDivide
uiExtKeyNDivide,
};
struct uiAreaKeyEvent {
@ -643,9 +641,9 @@ struct uiAreaKeyEvent {
typedef struct uiFontButton uiFontButton;
#define uiFontButton(this) ((uiFontButton *) (this))
/* TODO document this returns a new font */
// TODO document this returns a new font
_UI_EXTERN uiDrawTextFont *uiFontButtonFont(uiFontButton *b);
/* TOOD SetFont, mechanics */
// TOOD SetFont, mechanics
_UI_EXTERN void uiFontButtonOnChanged(uiFontButton *b, void (*f)(uiFontButton *, void *), void *data);
_UI_EXTERN uiFontButton *uiNewFontButton(void);
@ -668,14 +666,14 @@ _UI_ENUM(uiAlign) {
uiAlignFill,
uiAlignStart,
uiAlignCenter,
uiAlignEnd
uiAlignEnd,
};
_UI_ENUM(uiAt) {
uiAtLeading,
uiAtTop,
uiAtTrailing,
uiAtBottom
uiAtBottom,
};
typedef struct uiGrid uiGrid;

12
deps/libui/ui_unix.h vendored
View File

@ -1,4 +1,4 @@
/* 7 april 2015 */
// 7 april 2015
/*
This file assumes that you have included <gtk/gtk.h> and "ui.h" beforehand. It provides API-specific functions for interfacing with foreign controls on Unix systems that use GTK+ to provide their UI (currently all except Mac OS X).
@ -19,7 +19,7 @@ struct uiUnixControl {
void (*SetContainer)(uiUnixControl *, GtkContainer *, gboolean);
};
#define uiUnixControl(this) ((uiUnixControl *) (this))
/* TODO document */
// TODO document
_UI_EXTERN void uiUnixControlSetContainer(uiUnixControl *, GtkContainer *, gboolean);
#define uiUnixControlDefaultDestroy(type) \
@ -80,7 +80,7 @@ _UI_EXTERN void uiUnixControlSetContainer(uiUnixControl *, GtkContainer *, gbool
{ \
gtk_widget_set_sensitive(type(c)->widget, FALSE); \
}
/* TODO this whole addedBefore stuff is a MASSIVE HACK. */
// TODO this whole addedBefore stuff is a MASSIVE HACK.
#define uiUnixControlDefaultSetContainer(type) \
static void type ## SetContainer(uiUnixControl *c, GtkContainer *container, gboolean remove) \
{ \
@ -112,7 +112,7 @@ _UI_EXTERN void uiUnixControlSetContainer(uiUnixControl *, GtkContainer *, gbool
uiUnixControlDefaultDestroy(type) \
uiUnixControlAllDefaultsExceptDestroy(type)
/* TODO document */
// TODO document
#define uiUnixNewControl(type, var) \
var = type(uiUnixAllocControl(sizeof (type), type ## Signature, #type)); \
uiControl(var)->Destroy = type ## Destroy; \
@ -127,10 +127,10 @@ _UI_EXTERN void uiUnixControlSetContainer(uiUnixControl *, GtkContainer *, gbool
uiControl(var)->Enable = type ## Enable; \
uiControl(var)->Disable = type ## Disable; \
uiUnixControl(var)->SetContainer = type ## SetContainer;
/* TODO document */
// TODO document
_UI_EXTERN uiUnixControl *uiUnixAllocControl(size_t n, uint32_t typesig, const char *typenamestr);
/* uiUnixStrdupText() takes the given string and produces a copy of it suitable for being freed by uiFreeText(). */
// uiUnixStrdupText() takes the given string and produces a copy of it suitable for being freed by uiFreeText().
_UI_EXTERN char *uiUnixStrdupText(const char *);
#ifdef __cplusplus

85
deps/libui/unix/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,85 @@
# 3 june 2016
find_package(PkgConfig REQUIRED)
pkg_check_modules(GTK REQUIRED gtk+-3.0)
list(APPEND _LIBUI_SOURCES
unix/alloc.c
unix/area.c
unix/box.c
unix/button.c
unix/cellrendererbutton.c
unix/checkbox.c
unix/child.c
unix/colorbutton.c
unix/combobox.c
unix/control.c
unix/datetimepicker.c
unix/debug.c
unix/draw.c
unix/drawmatrix.c
unix/drawpath.c
unix/drawtext.c
unix/editablecombo.c
unix/entry.c
unix/fontbutton.c
unix/form.c
unix/future.c
unix/graphemes.c
unix/grid.c
unix/group.c
unix/image.c
unix/label.c
unix/main.c
unix/menu.c
unix/multilineentry.c
unix/progressbar.c
unix/radiobuttons.c
unix/separator.c
unix/slider.c
unix/spinbox.c
unix/stddialogs.c
unix/tab.c
unix/text.c
unix/util.c
unix/window.c
)
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
list(APPEND _LIBUI_INCLUDEDIRS
unix
)
set(_LIBUI_INCLUDEDIRS _LIBUI_INCLUDEDIRS PARENT_SCOPE)
set(_LIBUINAME libui PARENT_SCOPE)
if(NOT BUILD_SHARED_LIBS)
set(_LIBUINAME libui-temporary PARENT_SCOPE)
endif()
macro(_handle_static)
set_target_properties(${_LIBUINAME} PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(_aname $<TARGET_FILE:${_LIBUINAME}>)
set(_oname libui-combined.o)
add_custom_command(
OUTPUT ${_oname}
COMMAND
ld -r --whole-archive ${_aname} -o ${_oname}
COMMAND
objcopy --localize-hidden ${_oname}
COMMENT "Removing hidden symbols")
add_library(libui STATIC ${_oname})
# otherwise cmake won't know which linker to use
set_target_properties(libui PROPERTIES
LINKER_LANGUAGE C)
set(_aname)
set(_oname)
endmacro()
# TODO the other variables don't work?
set(_LIBUI_CFLAGS
${GTK_CFLAGS}
PARENT_SCOPE)
set(_LIBUI_LIBS
${GTK_LDFLAGS} m ${CMAKE_DL_LIBS}
PARENT_SCOPE)

View File

@ -1,4 +1,4 @@
/* 7 april 2015 */
// 7 april 2015
#include <string.h>
#include "uipriv_unix.h"
@ -20,8 +20,8 @@ void initAlloc(void)
static void uninitComplain(gpointer ptr, gpointer data)
{
char *str2 = NULL;
char **str = (char **)data;
char **str = (char **) data;
char *str2;
if (*str == NULL)
*str = g_strdup_printf("");
@ -34,12 +34,10 @@ void uninitAlloc(void)
{
char *str = NULL;
if (allocations->len == 0)
{
g_ptr_array_free(allocations, TRUE);
return;
}
if (allocations->len == 0) {
g_ptr_array_free(allocations, TRUE);
return;
}
g_ptr_array_foreach(allocations, uninitComplain, &str);
userbug("Some data was leaked; either you left a uiControl lying around or there's a bug in libui itself. Leaked data:\n%s", str);
g_free(str);
@ -47,8 +45,9 @@ void uninitAlloc(void)
void *uiAlloc(size_t size, const char *type)
{
void *out = g_malloc0(EXTRA + size);
void *out;
out = g_malloc0(EXTRA + size);
*SIZE(out) = size;
*TYPE(out) = type;
g_ptr_array_add(allocations, out);

View File

@ -114,10 +114,10 @@ static void loadAreaSize(uiArea *a, double *width, double *height)
static gboolean areaWidget_draw(GtkWidget *w, cairo_t *cr)
{
areaWidget *aw = areaWidget(w);
uiArea *a = aw->a;
uiAreaDrawParams dp;
double clipX0, clipY0, clipX1, clipY1;
areaWidget *aw = areaWidget(w);
uiArea *a = aw->a;
dp.Context = newContext(cr);
@ -129,30 +129,25 @@ static gboolean areaWidget_draw(GtkWidget *w, cairo_t *cr)
dp.ClipWidth = clipX1 - clipX0;
dp.ClipHeight = clipY1 - clipY0;
/* no need to save or restore the graphics state
* to reset transformations; GTK+ does that for us */
// no need to save or restore the graphics state to reset transformations; GTK+ does that for us
(*(a->ah->Draw))(a->ah, a, &dp);
freeContext(dp.Context);
return FALSE;
}
/* to do this properly for scrolling areas, we need to
* - return the same value for min and nat
* - call gtk_widget_queue_resize() when the size changes
* thanks to Company in irc.gimp.net/#gtk+ */
static void areaWidget_get_preferred_height(GtkWidget *w,
gint *min, gint *nat)
// to do this properly for scrolling areas, we need to
// - return the same value for min and nat
// - call gtk_widget_queue_resize() when the size changes
// thanks to Company in irc.gimp.net/#gtk+
static void areaWidget_get_preferred_height(GtkWidget *w, gint *min, gint *nat)
{
areaWidget *aw = areaWidget(w);
uiArea *a = aw->a;
// always chain up just in case
GTK_WIDGET_CLASS(areaWidget_parent_class)->
get_preferred_height(w, min, nat);
if (a->scrolling)
{
GTK_WIDGET_CLASS(areaWidget_parent_class)->get_preferred_height(w, min, nat);
if (a->scrolling) {
*min = a->scrollHeight;
*nat = a->scrollHeight;
}
@ -163,54 +158,51 @@ static void areaWidget_get_preferred_width(GtkWidget *w, gint *min, gint *nat)
areaWidget *aw = areaWidget(w);
uiArea *a = aw->a;
/* always chain up just in case */
// always chain up just in case
GTK_WIDGET_CLASS(areaWidget_parent_class)->get_preferred_width(w, min, nat);
if (a->scrolling)
{
*min = a->scrollWidth;
*nat = a->scrollWidth;
}
if (a->scrolling) {
*min = a->scrollWidth;
*nat = a->scrollWidth;
}
}
static guint translateModifiers(guint state, GdkWindow *window)
{
GdkModifierType statetype;
GdkModifierType statetype;
/* GDK doesn't initialize the modifier flags fully; we have to
* explicitly tell it to (thanks to Daniel_S and daniels
* (two different people) in irc.gimp.net/#gtk+) */
statetype = state;
gdk_keymap_add_virtual_modifiers(
gdk_keymap_get_for_display(gdk_window_get_display(window)),
&statetype);
return statetype;
// GDK doesn't initialize the modifier flags fully; we have to explicitly tell it to (thanks to Daniel_S and daniels (two different people) in irc.gimp.net/#gtk+)
statetype = state;
gdk_keymap_add_virtual_modifiers(
gdk_keymap_get_for_display(gdk_window_get_display(window)),
&statetype);
return statetype;
}
static uiModifiers toModifiers(guint state)
{
uiModifiers m = 0;
uiModifiers m;
if ((state & GDK_CONTROL_MASK) != 0)
m |= uiModifierCtrl;
if ((state & GDK_META_MASK) != 0)
m |= uiModifierAlt;
/* GTK+ itself requires this to be Alt (just read through gtkaccelgroup.c) */
if ((state & GDK_MOD1_MASK) != 0)
m |= uiModifierAlt;
if ((state & GDK_SHIFT_MASK) != 0)
m |= uiModifierShift;
if ((state & GDK_SUPER_MASK) != 0)
m |= uiModifierSuper;
return m;
m = 0;
if ((state & GDK_CONTROL_MASK) != 0)
m |= uiModifierCtrl;
if ((state & GDK_META_MASK) != 0)
m |= uiModifierAlt;
if ((state & GDK_MOD1_MASK) != 0) // GTK+ itself requires this to be Alt (just read through gtkaccelgroup.c)
m |= uiModifierAlt;
if ((state & GDK_SHIFT_MASK) != 0)
m |= uiModifierShift;
if ((state & GDK_SUPER_MASK) != 0)
m |= uiModifierSuper;
return m;
}
/* capture on drag is done automatically on GTK+ */
// capture on drag is done automatically on GTK+
static void finishMouseEvent(uiArea *a, uiAreaMouseEvent *me, guint mb, gdouble x, gdouble y, guint state, GdkWindow *window)
{
/* on GTK+, mouse buttons 4-7 are for scrolling; if we got here, that's a mistake */
// on GTK+, mouse buttons 4-7 are for scrolling; if we got here, that's a mistake
if (mb >= 4 && mb <= 7)
return;
/* if the button ID >= 8, continue counting from 4, as in the MouseEvent spec */
// if the button ID >= 8, continue counting from 4, as in the MouseEvent spec
if (me->Down >= 8)
me->Down -= 4;
if (me->Up >= 8)
@ -219,7 +211,7 @@ static void finishMouseEvent(uiArea *a, uiAreaMouseEvent *me, guint mb, gdouble
state = translateModifiers(state, window);
me->Modifiers = toModifiers(state);
/* the mb != # checks exclude the Up/Down button from Held */
// the mb != # checks exclude the Up/Down button from Held
me->Held1To64 = 0;
if (mb != 1 && (state & GDK_BUTTON1_MASK) != 0)
me->Held1To64 |= 1 << 0;
@ -227,19 +219,12 @@ static void finishMouseEvent(uiArea *a, uiAreaMouseEvent *me, guint mb, gdouble
me->Held1To64 |= 1 << 1;
if (mb != 3 && (state & GDK_BUTTON3_MASK) != 0)
me->Held1To64 |= 1 << 2;
// don't check GDK_BUTTON4_MASK or GDK_BUTTON5_MASK because those are for the scrolling buttons mentioned above
// GDK expressly does not support any more buttons in the GdkModifierType; see https://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkdevice-xi2.c#n763 (thanks mclasen in irc.gimp.net/#gtk+)
/* don't check GDK_BUTTON4_MASK or GDK_BUTTON5_MASK because those
* are for the scrolling buttons mentioned above
*
* GDK expressly does not support any more buttons in the
* GdkModifierType; see
* https://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkdevice-xi2.c#n763
* (thanks mclasen in irc.gimp.net/#gtk+)
*/
/* these are already in drawing space coordinates
* the size of drawing space has the same value as the widget allocation
* thanks to tristan in irc.gimp.net/#gtk+ */
// these are already in drawing space coordinates
// the size of drawing space has the same value as the widget allocation
// thanks to tristan in irc.gimp.net/#gtk+
me->X = x;
me->Y = y;
@ -250,43 +235,37 @@ static void finishMouseEvent(uiArea *a, uiAreaMouseEvent *me, guint mb, gdouble
static gboolean areaWidget_button_press_event(GtkWidget *w, GdkEventButton *e)
{
areaWidget *aw = areaWidget(w);
uiArea *a = aw->a;
gint maxTime, maxDistance;
GtkSettings *settings;
uiAreaMouseEvent me;
areaWidget *aw = areaWidget(w);
uiArea *a = aw->a;
GtkSettings *settings = NULL;
/* clicking doesn't automatically transfer keyboard focus;
* we must do so manually (thanks tristan in irc.gimp.net/#gtk+) */
// clicking doesn't automatically transfer keyboard focus; we must do so manually (thanks tristan in irc.gimp.net/#gtk+)
gtk_widget_grab_focus(w);
/* we handle multiple clicks ourselves here,
* in the same way as we do on Windows */
/* ignore GDK's generated double-clicks and beyond */
// we handle multiple clicks ourselves here, in the same way as we do on Windows
if (e->type != GDK_BUTTON_PRESS)
// ignore GDK's generated double-clicks and beyond
return GDK_EVENT_PROPAGATE;
settings = gtk_widget_get_settings(w);
g_object_get(settings,
"gtk-double-click-time", &maxTime,
"gtk-double-click-distance", &maxDistance,
NULL);
/* don't unref settings; it's transfer-none (thanks gregier in irc.gimp.net/#gtk+)
* e->time is guint32
* e->x and e->y are floating-point; just make them 32-bit integers
* maxTime and maxDistance... are gint, which *should* fit, hopefully... */
// don't unref settings; it's transfer-none (thanks gregier in irc.gimp.net/#gtk+)
// e->time is guint32
// e->x and e->y are floating-point; just make them 32-bit integers
// maxTime and maxDistance... are gint, which *should* fit, hopefully...
me.Count = clickCounterClick(a->cc, me.Down,
e->x, e->y,
e->time, maxTime,
maxDistance, maxDistance);
me.Down = e->button;
me.Up = 0;
me.Up = 0;
/* and set things up for window drags */
// and set things up for window drags
a->dragevent = e;
finishMouseEvent(a, &me, e->button, e->x, e->y, e->state, e->window);
a->dragevent = NULL;
@ -295,37 +274,32 @@ static gboolean areaWidget_button_press_event(GtkWidget *w, GdkEventButton *e)
static gboolean areaWidget_button_release_event(GtkWidget *w, GdkEventButton *e)
{
uiAreaMouseEvent me;
areaWidget *aw = areaWidget(w);
uiArea *a = aw->a;
areaWidget *aw = areaWidget(w);
uiArea *a = aw->a;
uiAreaMouseEvent me;
me.Down = 0;
me.Up = e->button;
me.Count = 0;
finishMouseEvent(a, &me, e->button, e->x, e->y, e->state, e->window);
return GDK_EVENT_PROPAGATE;
me.Down = 0;
me.Up = e->button;
me.Count = 0;
finishMouseEvent(a, &me, e->button, e->x, e->y, e->state, e->window);
return GDK_EVENT_PROPAGATE;
}
static gboolean areaWidget_motion_notify_event(GtkWidget *w, GdkEventMotion *e)
{
uiAreaMouseEvent me;
areaWidget *aw = areaWidget(w);
uiArea *a = aw->a;
uiArea *a = aw->a;
uiAreaMouseEvent me;
me.Down = 0;
me.Up = 0;
me.Count = 0;
me.Down = 0;
me.Up = 0;
me.Count = 0;
finishMouseEvent(a, &me, 0, e->x, e->y, e->state, e->window);
return GDK_EVENT_PROPAGATE;
}
/* we want switching away from the control to reset the double-click counter,
* like with WM_ACTIVATE on Windows
*
* according to tristan in irc.gimp.net/#gtk+, doing this on both
* enter-notify-event and leave-notify-event is correct (and it seems to be
* true in my own tests; plus the events DO get sent when switching programs
* with the keyboard (just pointing that out)) */
// we want switching away from the control to reset the double-click counter, like with WM_ACTIVATE on Windows
// according to tristan in irc.gimp.net/#gtk+, doing this on both enter-notify-event and leave-notify-event is correct (and it seems to be true in my own tests; plus the events DO get sent when switching programs with the keyboard (just pointing that out))
static gboolean onCrossing(areaWidget *aw, int left)
{
uiArea *a = aw->a;
@ -345,15 +319,11 @@ static gboolean areaWidget_leave_notify_event(GtkWidget *w, GdkEventCrossing *e)
return onCrossing(areaWidget(w), 1);
}
/* note: there is no equivalent to WM_CAPTURECHANGED on GTK+; there literally
* is no way to break a grab like that (at least not on X11 and Wayland)
*
* even if I invoke the task switcher and switch processes, the mouse grab will
* still be held until I let go of all buttons
* therefore, no DragBroken()
*
* we use GDK_KEY_Print as a sentinel because libui will never support the print screen key; that key belongs to the user
*/
// note: there is no equivalent to WM_CAPTURECHANGED on GTK+; there literally is no way to break a grab like that (at least not on X11 and Wayland)
// even if I invoke the task switcher and switch processes, the mouse grab will still be held until I let go of all buttons
// therefore, no DragBroken()
// we use GDK_KEY_Print as a sentinel because libui will never support the print screen key; that key belongs to the user
static const struct {
guint keyval;
@ -382,7 +352,7 @@ static const struct {
{ GDK_KEY_F10, uiExtKeyF10 },
{ GDK_KEY_F11, uiExtKeyF11 },
{ GDK_KEY_F12, uiExtKeyF12 },
/* numpad numeric keys and . are handled in events.c */
// numpad numeric keys and . are handled in events.c
{ GDK_KEY_KP_Enter, uiExtKeyNEnter },
{ GDK_KEY_KP_Add, uiExtKeyNAdd },
{ GDK_KEY_KP_Subtract, uiExtKeyNSubtract },
@ -424,25 +394,23 @@ static int areaKeyEvent(uiArea *a, int up, GdkEventKey *e)
ke.Up = up;
for (i = 0; extKeys[i].keyval != GDK_KEY_Print; i++)
if (extKeys[i].keyval == e->keyval)
{
if (extKeys[i].keyval == e->keyval) {
ke.ExtKey = extKeys[i].extkey;
goto keyFound;
}
for (i = 0; modKeys[i].keyval != GDK_KEY_Print; i++)
if (modKeys[i].keyval == e->keyval)
{
ke.Modifier = modKeys[i].mod;
/* don't include the modifier in ke.Modifiers */
ke.Modifiers &= ~ke.Modifier;
goto keyFound;
}
if (modKeys[i].keyval == e->keyval) {
ke.Modifier = modKeys[i].mod;
// don't include the modifier in ke.Modifiers
ke.Modifiers &= ~ke.Modifier;
goto keyFound;
}
if (fromScancode(e->hardware_keycode - 8, &ke))
goto keyFound;
/* no supported key found; treat as unhandled */
// no supported key found; treat as unhandled
return 0;
keyFound:
@ -452,7 +420,7 @@ keyFound:
static gboolean areaWidget_key_press_event(GtkWidget *w, GdkEventKey *e)
{
areaWidget *aw = areaWidget(w);
uiArea *a = aw->a;
uiArea *a = aw->a;
if (areaKeyEvent(a, 0, e))
return GDK_EVENT_STOP;
@ -478,16 +446,15 @@ static GParamSpec *pspecArea;
static void areaWidget_set_property(GObject *obj, guint prop, const GValue *value, GParamSpec *pspec)
{
areaWidget *aw = areaWidget(obj);
areaWidget *aw = areaWidget(obj);
switch (prop)
{
case pArea:
aw->a = (uiArea *) g_value_get_pointer(value);
aw->a->cc = &(aw->cc);
return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, prop, pspec);
switch (prop) {
case pArea:
aw->a = (uiArea *) g_value_get_pointer(value);
aw->a->cc = &(aw->cc);
return;
}
G_OBJECT_WARN_INVALID_PROPERTY_ID(obj, prop, pspec);
}
static void areaWidget_get_property(GObject *obj, guint prop, GValue *value, GParamSpec *pspec)
@ -541,8 +508,8 @@ void uiAreaQueueRedrawAll(uiArea *a)
void uiAreaScrollTo(uiArea *a, double x, double y, double width, double height)
{
/* TODO
* TODO adjust adjustments and find source for that */
// TODO
// TODO adjust adjustments and find source for that
}
void uiAreaBeginUserWindowMove(uiArea *a)
@ -551,23 +518,25 @@ void uiAreaBeginUserWindowMove(uiArea *a)
if (a->dragevent == NULL)
userbug("cannot call uiAreaBeginUserWindowMove() outside of a Mouse() with Down != 0");
/* TODO don't we have a libui function for this? did I scrap it?
* TODO widget or areaWidget? */
// TODO don't we have a libui function for this? did I scrap it?
// TODO widget or areaWidget?
toplevel = gtk_widget_get_toplevel(a->widget);
// TODO
if (toplevel == NULL)
if (toplevel == NULL) {
// TODO
return;
/* the docs say to do this */
/* TODO */
if (!gtk_widget_is_toplevel(toplevel))
}
// the docs say to do this
if (!gtk_widget_is_toplevel(toplevel)) {
// TODO
return;
/* TODO */
if (!GTK_IS_WINDOW(toplevel))
}
if (!GTK_IS_WINDOW(toplevel)) {
// TODO
return;
}
gtk_window_begin_move_drag(GTK_WINDOW(toplevel),
a->dragevent->button,
a->dragevent->x_root, /* TODO are these correct? */
a->dragevent->x_root, // TODO are these correct?
a->dragevent->y_root,
a->dragevent->time);
}
@ -589,25 +558,26 @@ void uiAreaBeginUserWindowResize(uiArea *a, uiWindowResizeEdge edge)
if (a->dragevent == NULL)
userbug("cannot call uiAreaBeginUserWindowResize() outside of a Mouse() with Down != 0");
/* TODO don't we have a libui function for this? did I scrap it?
* TODO widget or areaWidget? */
// TODO don't we have a libui function for this? did I scrap it?
// TODO widget or areaWidget?
toplevel = gtk_widget_get_toplevel(a->widget);
/* TODO */
if (toplevel == NULL)
if (toplevel == NULL) {
// TODO
return;
/* the docs say to do this */
/* TODO */
if (!gtk_widget_is_toplevel(toplevel))
}
// the docs say to do this
if (!gtk_widget_is_toplevel(toplevel)) {
// TODO
return;
/* TODO */
if (!GTK_IS_WINDOW(toplevel))
}
if (!GTK_IS_WINDOW(toplevel)) {
// TODO
return;
}
gtk_window_begin_resize_drag(GTK_WINDOW(toplevel),
edges[edge],
a->dragevent->button,
a->dragevent->x_root, /* TODO are these correct? */
a->dragevent->x_root, // TODO are these correct?
a->dragevent->y_root,
a->dragevent->time);
}
@ -656,8 +626,7 @@ uiArea *uiNewScrollingArea(uiAreaHandler *ah, int width, int height)
a->widget = a->swidget;
gtk_container_add(a->scontainer, a->areaWidget);
/* and make the area visible; only the scrolled
* window's visibility is controlled by libui */
// and make the area visible; only the scrolled window's visibility is controlled by libui
gtk_widget_show(a->areaWidget);
return a;

View File

@ -1,26 +1,24 @@
// 7 april 2015
#include "uipriv_unix.h"
struct boxChild
{
uiControl *c;
int stretchy;
gboolean oldhexpand;
GtkAlign oldhalign;
gboolean oldvexpand;
GtkAlign oldvalign;
struct boxChild {
uiControl *c;
int stretchy;
gboolean oldhexpand;
GtkAlign oldhalign;
gboolean oldvexpand;
GtkAlign oldvalign;
};
struct uiBox
{
uiUnixControl c;
GtkWidget *widget;
GtkContainer *container;
GtkBox *box;
GArray *controls;
int vertical;
int padded;
GtkSizeGroup *stretchygroup; /* ensures all stretchy controls have the same size */
struct uiBox {
uiUnixControl c;
GtkWidget *widget;
GtkContainer *container;
GtkBox *box;
GArray *controls;
int vertical;
int padded;
GtkSizeGroup *stretchygroup; // ensures all stretchy controls have the same size
};
uiUnixControlAllDefaultsExceptDestroy(uiBox)
@ -33,19 +31,18 @@ static void uiBoxDestroy(uiControl *c)
struct boxChild *bc;
guint i;
/* kill the size group */
// kill the size group
g_object_unref(b->stretchygroup);
/* free all controls */
for (i = 0; i < b->controls->len; i++)
{
bc = ctrl(b, i);
uiControlSetParent(bc->c, NULL);
/* and make sure the widget itself stays alive */
uiUnixControlSetContainer(uiUnixControl(bc->c), b->container, TRUE);
uiControlDestroy(bc->c);
}
// free all controls
for (i = 0; i < b->controls->len; i++) {
bc = ctrl(b, i);
uiControlSetParent(bc->c, NULL);
// and make sure the widget itself stays alive
uiUnixControlSetContainer(uiUnixControl(bc->c), b->container, TRUE);
uiControlDestroy(bc->c);
}
g_array_free(b->controls, TRUE);
/* and then ourselves */
// and then ourselves
g_object_unref(b->widget);
uiFreeControl(uiControl(b));
}
@ -53,7 +50,7 @@ static void uiBoxDestroy(uiControl *c)
void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
{
struct boxChild bc;
GtkWidget *widget = NULL;
GtkWidget *widget;
bc.c = c;
bc.stretchy = stretchy;
@ -77,7 +74,7 @@ void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
gtk_widget_set_vexpand(widget, FALSE);
else
gtk_widget_set_hexpand(widget, FALSE);
/* and make them fill the opposite direction */
// and make them fill the opposite direction
if (b->vertical) {
gtk_widget_set_hexpand(widget, TRUE);
gtk_widget_set_halign(widget, GTK_ALIGN_FILL);
@ -93,8 +90,11 @@ void uiBoxAppend(uiBox *b, uiControl *c, int stretchy)
void uiBoxDelete(uiBox *b, int index)
{
struct boxChild *bc = ctrl(b, index);
GtkWidget *widget = GTK_WIDGET(uiControlHandle(bc->c));
struct boxChild *bc;
GtkWidget *widget;
bc = ctrl(b, index);
widget = GTK_WIDGET(uiControlHandle(bc->c));
uiControlSetParent(bc->c, NULL);
uiUnixControlSetContainer(uiUnixControl(bc->c), b->container, TRUE);

View File

@ -1,8 +1,7 @@
// 10 june 2015
#include "uipriv_unix.h"
struct uiButton
{
struct uiButton {
uiUnixControl c;
GtkWidget *widget;
GtkButton *button;
@ -21,7 +20,7 @@ static void onClicked(GtkButton *button, gpointer data)
static void defaultOnClicked(uiButton *b, void *data)
{
/* do nothing */
// do nothing
}
char *uiButtonText(uiButton *b)
@ -36,7 +35,7 @@ void uiButtonSetText(uiButton *b, const char *text)
void uiButtonOnClicked(uiButton *b, void (*f)(uiButton *, void *), void *data)
{
b->onClicked = f;
b->onClicked = f;
b->onClickedData = data;
}

View File

@ -28,7 +28,7 @@ struct child {
struct child *newChild(uiControl *child, uiControl *parent, GtkContainer *parentContainer)
{
struct child *c = NULL;
struct child *c;
if (child == NULL)
return NULL;
@ -51,8 +51,8 @@ struct child *newChild(uiControl *child, uiControl *parent, GtkContainer *parent
struct child *newChildWithBox(uiControl *child, uiControl *parent, GtkContainer *parentContainer, int margined)
{
struct child *c = NULL;
GtkWidget *box = NULL;
struct child *c;
GtkWidget *box;
if (child == NULL)
return NULL;
@ -87,11 +87,11 @@ void childRemove(struct child *c)
void childDestroy(struct child *c)
{
uiControl *child = NULL;
uiControl *child;
child = c->c;
childRemove(c);
uiControlDestroy(child);
child = c->c;
childRemove(c);
uiControlDestroy(child);
}
GtkWidget *childWidget(struct child *c)

View File

@ -14,31 +14,30 @@
typedef struct dateTimePickerWidget dateTimePickerWidget;
typedef struct dateTimePickerWidgetClass dateTimePickerWidgetClass;
struct dateTimePickerWidget
{
GtkToggleButton parent_instance;
struct dateTimePickerWidget {
GtkToggleButton parent_instance;
gulong toggledSignal;
gulong toggledSignal;
gboolean hasTime;
gboolean hasDate;
gboolean hasTime;
gboolean hasDate;
GtkWidget *window;
GtkWidget *box;
GtkWidget *calendar;
GtkWidget *timebox;
GtkWidget *hours;
GtkWidget *minutes;
GtkWidget *seconds;
GtkWidget *ampm;
GtkWidget *window;
GtkWidget *box;
GtkWidget *calendar;
GtkWidget *timebox;
GtkWidget *hours;
GtkWidget *minutes;
GtkWidget *seconds;
GtkWidget *ampm;
gulong hoursBlock;
gulong minutesBlock;
gulong secondsBlock;
gulong ampmBlock;
gulong hoursBlock;
gulong minutesBlock;
gulong secondsBlock;
gulong ampmBlock;
GdkDevice *keyboard;
GdkDevice *mouse;
GdkDevice *keyboard;
GdkDevice *mouse;
};
struct dateTimePickerWidgetClass {
@ -49,7 +48,9 @@ G_DEFINE_TYPE(dateTimePickerWidget, dateTimePickerWidget, GTK_TYPE_TOGGLE_BUTTON
static int realSpinValue(GtkSpinButton *spinButton)
{
GtkAdjustment *adj = gtk_spin_button_get_adjustment(spinButton);
GtkAdjustment *adj;
adj = gtk_spin_button_get_adjustment(spinButton);
return (int) gtk_adjustment_get_value(adj);
}
@ -69,14 +70,11 @@ static GDateTime *selected(dateTimePickerWidget *d)
guint year = 1970, month = 1, day = 1;
guint hour = 0, minute = 0, second = 0;
if (d->hasDate)
{
if (d->hasDate) {
gtk_calendar_get_date(GTK_CALENDAR(d->calendar), &year, &month, &day);
month++; /* GtkCalendar/GDateTime differences */
month++; // GtkCalendar/GDateTime differences
}
if (d->hasTime)
{
if (d->hasTime) {
hour = realSpinValue(GTK_SPIN_BUTTON(d->hours));
if (realSpinValue(GTK_SPIN_BUTTON(d->ampm)) != 0)
hour += 12;
@ -88,22 +86,21 @@ static GDateTime *selected(dateTimePickerWidget *d)
static void setLabel(dateTimePickerWidget *d)
{
char *fmt = NULL;
char *msg = NULL;
GDateTime *dt = selected(d);
gboolean free = FALSE;
GDateTime *dt;
char *fmt;
char *msg;
gboolean free;
if (d->hasDate && d->hasTime)
{
/* don't use D_T_FMT; that's too verbose */
fmt = g_strdup_printf("%s %s", nl_langinfo(D_FMT), nl_langinfo(T_FMT));
dt = selected(d);
free = FALSE;
if (d->hasDate && d->hasTime) {
// don't use D_T_FMT; that's too verbose
fmt = g_strdup_printf("%s %s", nl_langinfo(D_FMT), nl_langinfo(T_FMT));
free = TRUE;
}
else if (d->hasDate)
fmt = nl_langinfo(D_FMT);
} else if (d->hasDate)
fmt = nl_langinfo(D_FMT);
else
fmt = nl_langinfo(T_FMT);
msg = g_date_time_format(dt, fmt);
gtk_button_set_label(GTK_BUTTON(d), msg);
g_free(msg);
@ -147,31 +144,32 @@ static void hidePopup(dateTimePickerWidget *d)
// this consolidates a good chunk of what GtkComboBox does
static gboolean startGrab(dateTimePickerWidget *d)
{
GdkDevice *dev;
guint32 time;
GdkWindow *window = NULL;
GdkDevice *keyboard = NULL;
GdkDevice *mouse = NULL;
GdkDevice *dev = gtk_get_current_event_device();
GdkWindow *window;
GdkDevice *keyboard, *mouse;
if (dev == NULL)
{
dev = gtk_get_current_event_device();
if (dev == NULL) {
// this is what GtkComboBox does
// since no device was set, just use the first available "master device"
GdkDisplay *disp = gtk_widget_get_display(GTK_WIDGET(d));
GdkDeviceManager *dm = gdk_display_get_device_manager(disp);
GList *list = gdk_device_manager_list_devices(dm, GDK_DEVICE_TYPE_MASTER);
GdkDisplay *disp;
GdkDeviceManager *dm;
GList *list;
disp = gtk_widget_get_display(GTK_WIDGET(d));
dm = gdk_display_get_device_manager(disp);
list = gdk_device_manager_list_devices(dm, GDK_DEVICE_TYPE_MASTER);
dev = (GdkDevice *) (list->data);
g_list_free(list);
}
time = gtk_get_current_event_time();
time = gtk_get_current_event_time();
keyboard = dev;
mouse = gdk_device_get_associated_device(dev);
if (gdk_device_get_source(dev) != GDK_SOURCE_KEYBOARD)
{
dev = mouse;
mouse = keyboard;
mouse = gdk_device_get_associated_device(dev);
if (gdk_device_get_source(dev) != GDK_SOURCE_KEYBOARD) {
dev = mouse;
mouse = keyboard;
keyboard = dev;
}
@ -198,7 +196,7 @@ static gboolean startGrab(dateTimePickerWidget *d)
return TRUE;
}
/* based on gtk_combo_box_list_position() in the GTK+ source code */
// based on gtk_combo_box_list_position() in the GTK+ source code
static void allocationToScreen(dateTimePickerWidget *d, gint *x, gint *y)
{
GdkWindow *window;
@ -279,17 +277,15 @@ static gboolean grabBroken(GtkWidget *w, GdkEventGrabBroken *e, gpointer data)
static gboolean buttonReleased(GtkWidget *w, GdkEventButton *e, gpointer data)
{
dateTimePickerWidget *d = dateTimePickerWidget(data);
int winx, winy;
GtkAllocation wina;
gboolean in;
dateTimePickerWidget *d = dateTimePickerWidget(data);
gtk_widget_get_allocation(d->window, &wina);
winx = 0;
winy = 0;
if (!gtk_widget_get_has_window(d->window))
{
if (!gtk_widget_get_has_window(d->window)) {
winx = wina.x;
winy = wina.y;
}
@ -311,9 +307,11 @@ static gboolean buttonReleased(GtkWidget *w, GdkEventButton *e, gpointer data)
static gint hoursSpinboxInput(GtkSpinButton *sb, gpointer ptr, gpointer data)
{
double *out = (double *) ptr;
const gchar *text = gtk_entry_get_text(GTK_ENTRY(sb));
int value = (int) g_strtod(text, NULL);
const gchar *text;
int value;
text = gtk_entry_get_text(GTK_ENTRY(sb));
value = (int) g_strtod(text, NULL);
if (value < 0 || value > 12)
return GTK_INPUT_ERROR;
if (value == 12) // 12 to the user is 0 internally
@ -324,9 +322,10 @@ static gint hoursSpinboxInput(GtkSpinButton *sb, gpointer ptr, gpointer data)
static gboolean hoursSpinboxOutput(GtkSpinButton *sb, gpointer data)
{
gchar *text = NULL;
int value = realSpinValue(sb);
gchar *text;
int value;
value = realSpinValue(sb);
if (value == 0) // 0 internally is 12 to the user
value = 12;
text = g_strdup_printf("%d", value);
@ -337,9 +336,11 @@ static gboolean hoursSpinboxOutput(GtkSpinButton *sb, gpointer data)
static gboolean zeroPadSpinbox(GtkSpinButton *sb, gpointer data)
{
int value = realSpinValue(sb);
gchar *text = g_strdup_printf("%02d", value);
gchar *text;
int value;
value = realSpinValue(sb);
text = g_strdup_printf("%02d", value);
gtk_entry_set_text(GTK_ENTRY(sb), text);
g_free(text);
return TRUE;
@ -348,20 +349,19 @@ static gboolean zeroPadSpinbox(GtkSpinButton *sb, gpointer data)
// this is really hacky but we can't use GtkCombobox here :(
static gint ampmSpinboxInput(GtkSpinButton *sb, gpointer ptr, gpointer data)
{
double *out = (double *) ptr;
const gchar *text = gtk_entry_get_text(GTK_ENTRY(sb));
// LONGTERM don't use ASCII here for case insensitivity
char firstAM = g_ascii_tolower(nl_langinfo(AM_STR)[0]);
char firstPM = g_ascii_tolower(nl_langinfo(PM_STR)[0]);
double *out = (double *) ptr;
const gchar *text;
char firstAM, firstPM;
text = gtk_entry_get_text(GTK_ENTRY(sb));
// LONGTERM don't use ASCII here for case insensitivity
firstAM = g_ascii_tolower(nl_langinfo(AM_STR)[0]);
firstPM = g_ascii_tolower(nl_langinfo(PM_STR)[0]);
for (; *text != '\0'; text++)
if (g_ascii_tolower(*text) == firstAM)
{
if (g_ascii_tolower(*text) == firstAM) {
*out = 0;
return TRUE;
}
else if (g_ascii_tolower(*text) == firstPM)
{
} else if (g_ascii_tolower(*text) == firstPM) {
*out = 1;
return TRUE;
}
@ -387,21 +387,20 @@ static void spinboxChanged(GtkSpinButton *sb, gpointer data)
dateTimeChanged(d);
}
static GtkWidget *newSpinbox(dateTimePickerWidget *d, int min, int max,
gint (*input)(GtkSpinButton *, gpointer, gpointer),
gboolean (*output)(GtkSpinButton *, gpointer), gulong *block)
static GtkWidget *newSpinbox(dateTimePickerWidget *d, int min, int max, gint (*input)(GtkSpinButton *, gpointer, gpointer), gboolean (*output)(GtkSpinButton *, gpointer), gulong *block)
{
GtkWidget *sb = gtk_spin_button_new_with_range(min, max, 1);
GtkWidget *sb;
gtk_spin_button_set_digits(GTK_SPIN_BUTTON(sb), 0);
gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(sb), TRUE);
gtk_orientable_set_orientation(GTK_ORIENTABLE(sb), GTK_ORIENTATION_VERTICAL);
*block = g_signal_connect(sb, "value-changed", G_CALLBACK(spinboxChanged), d);
if (input != NULL)
g_signal_connect(sb, "input", G_CALLBACK(input), NULL);
if (output != NULL)
g_signal_connect(sb, "output", G_CALLBACK(output), NULL);
return sb;
sb = gtk_spin_button_new_with_range(min, max, 1);
gtk_spin_button_set_digits(GTK_SPIN_BUTTON(sb), 0);
gtk_spin_button_set_wrap(GTK_SPIN_BUTTON(sb), TRUE);
gtk_orientable_set_orientation(GTK_ORIENTABLE(sb), GTK_ORIENTATION_VERTICAL);
*block = g_signal_connect(sb, "value-changed", G_CALLBACK(spinboxChanged), d);
if (input != NULL)
g_signal_connect(sb, "input", G_CALLBACK(input), NULL);
if (output != NULL)
g_signal_connect(sb, "output", G_CALLBACK(output), NULL);
return sb;
}
static void dateChanged(GtkCalendar *c, gpointer data)
@ -537,14 +536,18 @@ static void dateTimePickerWidget_class_init(dateTimePickerWidgetClass *class)
static GtkWidget *newDTP(void)
{
GtkWidget *w = GTK_WIDGET(g_object_new(dateTimePickerWidgetType, "label", "", NULL));
GtkWidget *w;
w = GTK_WIDGET(g_object_new(dateTimePickerWidgetType, "label", "", NULL));
setLabel(dateTimePickerWidget(w));
return w;
}
static GtkWidget *newDP(void)
{
GtkWidget *w = GTK_WIDGET(g_object_new(dateTimePickerWidgetType, "label", "", NULL));
GtkWidget *w;
w = GTK_WIDGET(g_object_new(dateTimePickerWidgetType, "label", "", NULL));
setDateOnly(dateTimePickerWidget(w));
setLabel(dateTimePickerWidget(w));
return w;
@ -552,17 +555,18 @@ static GtkWidget *newDP(void)
static GtkWidget *newTP(void)
{
GtkWidget *w = GTK_WIDGET(g_object_new(dateTimePickerWidgetType, "label", "", NULL));
GtkWidget *w;
w = GTK_WIDGET(g_object_new(dateTimePickerWidgetType, "label", "", NULL));
setTimeOnly(dateTimePickerWidget(w));
setLabel(dateTimePickerWidget(w));
return w;
}
struct uiDateTimePicker
{
uiUnixControl c;
GtkWidget *widget;
dateTimePickerWidget *d;
struct uiDateTimePicker {
uiUnixControl c;
GtkWidget *widget;
dateTimePickerWidget *d;
};
uiUnixControlAllDefaults(uiDateTimePicker)
@ -574,7 +578,7 @@ uiDateTimePicker *finishNewDateTimePicker(GtkWidget *(*fn)(void))
uiUnixNewControl(uiDateTimePicker, d);
d->widget = (*fn)();
d->d = dateTimePickerWidget(d->widget);
d->d = dateTimePickerWidget(d->widget);
return d;
}

View File

@ -1,27 +1,25 @@
// 8 june 2016
#include "uipriv_unix.h"
struct formChild
{
uiControl *c;
int stretchy;
GtkWidget *label;
gboolean oldhexpand;
GtkAlign oldhalign;
gboolean oldvexpand;
GtkAlign oldvalign;
GBinding *labelBinding;
struct formChild {
uiControl *c;
int stretchy;
GtkWidget *label;
gboolean oldhexpand;
GtkAlign oldhalign;
gboolean oldvexpand;
GtkAlign oldvalign;
GBinding *labelBinding;
};
struct uiForm
{
uiUnixControl c;
GtkWidget *widget;
GtkContainer *container;
GtkGrid *grid;
GArray *children;
int padded;
GtkSizeGroup *stretchygroup; /* ensures all stretchy controls have the same size */
struct uiForm {
uiUnixControl c;
GtkWidget *widget;
GtkContainer *container;
GtkGrid *grid;
GArray *children;
int padded;
GtkSizeGroup *stretchygroup; // ensures all stretchy controls have the same size
};
uiUnixControlAllDefaultsExceptDestroy(uiForm)
@ -34,19 +32,18 @@ static void uiFormDestroy(uiControl *c)
struct formChild *fc;
guint i;
/* kill the size group */
// kill the size group
g_object_unref(f->stretchygroup);
/* free all controls */
for (i = 0; i < f->children->len; i++)
{
fc = ctrl(f, i);
uiControlSetParent(fc->c, NULL);
uiUnixControlSetContainer(uiUnixControl(fc->c), f->container, TRUE);
uiControlDestroy(fc->c);
gtk_widget_destroy(fc->label);
}
// free all controls
for (i = 0; i < f->children->len; i++) {
fc = ctrl(f, i);
uiControlSetParent(fc->c, NULL);
uiUnixControlSetContainer(uiUnixControl(fc->c), f->container, TRUE);
uiControlDestroy(fc->c);
gtk_widget_destroy(fc->label);
}
g_array_free(f->children, TRUE);
/* and then ourselves */
// and then ourselves
g_object_unref(f->widget);
uiFreeControl(uiControl(f));
}
@ -71,7 +68,7 @@ void uiFormAppend(uiForm *f, const char *label, uiControl *c, int stretchy)
gtk_size_group_add_widget(f->stretchygroup, widget);
} else
gtk_widget_set_vexpand(widget, FALSE);
/* and make them fill horizontally */
// and make them fill horizontally
gtk_widget_set_hexpand(widget, TRUE);
gtk_widget_set_halign(widget, GTK_ALIGN_FILL);
@ -88,7 +85,7 @@ void uiFormAppend(uiForm *f, const char *label, uiControl *c, int stretchy)
gtk_grid_attach(f->grid, fc.label,
0, row,
1, 1);
/* and make them share visibility so if the control is hidden, so is its label */
// and make them share visibility so if the control is hidden, so is its label
fc.labelBinding = g_object_bind_property(GTK_WIDGET(uiControlHandle(fc.c)), "visible",
fc.label, "visible",
G_BINDING_SYNC_CREATE);
@ -97,7 +94,7 @@ void uiFormAppend(uiForm *f, const char *label, uiControl *c, int stretchy)
uiUnixControlSetContainer(uiUnixControl(fc.c), f->container, FALSE);
g_array_append_val(f->children, fc);
/* move the widget to the correct place */
// move the widget to the correct place
gtk_container_child_set(f->container, widget,
"left-attach", 1,
"top-attach", row,

View File

@ -52,10 +52,8 @@ void uiImageAppend(uiImage *i, void *pixels, int pixelWidth, int pixelHeight, in
cs = cairo_image_surface_create_for_data(buf, CAIRO_FORMAT_ARGB32,
pixelWidth, pixelHeight,
cstride);
/* TODO */
if (cairo_surface_status(cs) != CAIRO_STATUS_SUCCESS) { }
if (cairo_surface_status(cs) != CAIRO_STATUS_SUCCESS)
/* TODO */;
cairo_surface_flush(cs);
g_ptr_array_add(i->images, cs);
}
@ -69,7 +67,7 @@ struct matcher {
gboolean foundLarger;
};
/* TODO is this the right algorithm? */
// TODO is this the right algorithm?
static void match(gpointer surface, gpointer data)
{
cairo_surface_t *cs = (cairo_surface_t *) surface;
@ -83,11 +81,11 @@ static void match(gpointer surface, gpointer data)
goto writeMatch;
if (x < m->targetX && y < m->targetY)
if (m->foundLarger) /* always prefer larger ones */
if (m->foundLarger)
// always prefer larger ones
return;
/* we set foundLarger below */
if (x >= m->targetX && y >= m->targetY && !m->foundLarger)
// we set foundLarger below
goto writeMatch;
x2 = abs(m->targetX - x);
@ -95,11 +93,11 @@ static void match(gpointer surface, gpointer data)
if (x2 < m->distX && y2 < m->distY)
goto writeMatch;
/* TODO weight one dimension? threshhold? */
// TODO weight one dimension? threshhold?
return;
writeMatch:
/* must set this here too; otherwise the first image will never have ths set */
// must set this here too; otherwise the first image will never have ths set
if (x >= m->targetX && y >= m->targetY && !m->foundLarger)
m->foundLarger = TRUE;
m->best = cs;

View File

@ -6,15 +6,14 @@ uiInitOptions options;
const char *uiInit(uiInitOptions *o)
{
GError *err = NULL;
const char *msg;
options = *o;
if (gtk_init_with_args(NULL, NULL, NULL, NULL, NULL, &err) == FALSE)
{
const char *msg = g_strdup(err->message);
g_error_free(err);
return msg;
}
options = *o;
if (gtk_init_with_args(NULL, NULL, NULL, NULL, NULL, &err) == FALSE) {
msg = g_strdup(err->message);
g_error_free(err);
return msg;
}
initAlloc();
loadFutures();
return NULL;
@ -41,9 +40,8 @@ void uiMain(void)
static gboolean stepsQuit = FALSE;
/* the only difference is we ignore the return value from gtk_main_iteration_do(),
* since it will always be TRUE if gtk_main() was never called
* gtk_main_iteration_do() will still run the main loop regardless */
// the only difference is we ignore the return value from gtk_main_iteration_do(), since it will always be TRUE if gtk_main() was never called
// gtk_main_iteration_do() will still run the main loop regardless
static gboolean stepsIteration(gboolean block)
{
gtk_main_iteration_do(block);
@ -57,7 +55,9 @@ void uiMainSteps(void)
int uiMainStep(int wait)
{
gboolean block = FALSE;
gboolean block;
block = FALSE;
if (wait)
block = TRUE;
return (*iteration)(block) == FALSE;
@ -70,8 +70,7 @@ static gboolean quit(gpointer data)
{
if (iteration == stepsIteration)
stepsQuit = TRUE;
/* TODO run a gtk_main() here just to do the cleanup steps of
* syncing the clipboard and other stuff gtk_main() does before it returns */
// TODO run a gtk_main() here just to do the cleanup steps of syncing the clipboard and other stuff gtk_main() does before it returns
else
gtk_main_quit();
return FALSE;
@ -98,12 +97,12 @@ static gboolean doqueued(gpointer data)
void uiQueueMain(void (*f)(void *data), void *data)
{
struct queued *q = g_new0(struct queued, 1);
struct queued *q;
/* we have to use g_new0()/g_free() because uiAlloc()
* is only safe to call on the main thread
* for some reason it didn't affect me, but it did affect krakjoe */
q->f = f;
// we have to use g_new0()/g_free() because uiAlloc() is only safe to call on the main thread
// for some reason it didn't affect me, but it did affect krakjoe
q = g_new0(struct queued, 1);
q->f = f;
q->data = data;
gdk_threads_add_idle(doqueued, q);
}

View File

@ -121,8 +121,10 @@ int uiMenuItemChecked(uiMenuItem *item)
void uiMenuItemSetChecked(uiMenuItem *item, int checked)
{
/* use explicit values */
gboolean c = FALSE;
gboolean c;
// use explicit values
c = FALSE;
if (checked)
c = TRUE;
setChecked(item, c);
@ -130,55 +132,55 @@ void uiMenuItemSetChecked(uiMenuItem *item, int checked)
static uiMenuItem *newItem(uiMenu *m, int type, const char *name)
{
uiMenuItem *item;
uiMenuItem *item;
if (menusFinalized)
userbug("You cannot create a new menu item after menus have been finalized.");
if (menusFinalized)
userbug("You cannot create a new menu item after menus have been finalized.");
item = uiNew(uiMenuItem);
item = uiNew(uiMenuItem);
g_array_append_val(m->items, item);
g_array_append_val(m->items, item);
item->type = type;
switch (item->type) {
case typeQuit:
item->name = g_strdup("Quit");
break;
case typePreferences:
item->name = g_strdup("Preferences...");
break;
case typeAbout:
item->name = g_strdup("About");
break;
case typeSeparator:
break;
default:
item->name = g_strdup(name);
break;
}
item->type = type;
switch (item->type) {
case typeQuit:
item->name = g_strdup("Quit");
break;
case typePreferences:
item->name = g_strdup("Preferences...");
break;
case typeAbout:
item->name = g_strdup("About");
break;
case typeSeparator:
break;
default:
item->name = g_strdup(name);
break;
}
if (item->type == typeQuit) {
// can't call uiMenuItemOnClicked() here
item->onClicked = onQuitClicked;
item->onClickedData = NULL;
} else
uiMenuItemOnClicked(item, defaultOnClicked, NULL);
if (item->type == typeQuit) {
// can't call uiMenuItemOnClicked() here
item->onClicked = onQuitClicked;
item->onClickedData = NULL;
} else
uiMenuItemOnClicked(item, defaultOnClicked, NULL);
switch (item->type) {
case typeCheckbox:
item->gtype = GTK_TYPE_CHECK_MENU_ITEM;
break;
case typeSeparator:
item->gtype = GTK_TYPE_SEPARATOR_MENU_ITEM;
break;
default:
item->gtype = GTK_TYPE_MENU_ITEM;
break;
}
switch (item->type) {
case typeCheckbox:
item->gtype = GTK_TYPE_CHECK_MENU_ITEM;
break;
case typeSeparator:
item->gtype = GTK_TYPE_SEPARATOR_MENU_ITEM;
break;
default:
item->gtype = GTK_TYPE_MENU_ITEM;
break;
}
item->windows = g_hash_table_new(g_direct_hash, g_direct_equal);
item->windows = g_hash_table_new(g_direct_hash, g_direct_equal);
return item;
return item;
}
uiMenuItem *uiMenuAppendItem(uiMenu *m, const char *name)

View File

@ -32,10 +32,9 @@ int uiSpinboxValue(uiSpinbox *s)
void uiSpinboxSetValue(uiSpinbox *s, int value)
{
/* we need to inhibit sending of ::value-changed
* because this WILL send a ::value-changed otherwise */
// we need to inhibit sending of ::value-changed because this WILL send a ::value-changed otherwise
g_signal_handler_block(s->spinButton, s->onChangedSignal);
/* this clamps for us */
// this clamps for us
gtk_spin_button_set_value(s->spinButton, (gdouble) value);
g_signal_handler_unblock(s->spinButton, s->onChangedSignal);
}
@ -48,23 +47,22 @@ void uiSpinboxOnChanged(uiSpinbox *s, void (*f)(uiSpinbox *, void *), void *data
uiSpinbox *uiNewSpinbox(int min, int max)
{
uiSpinbox *s;
int temp;
uiSpinbox *s = NULL;
if (min >= max)
{
temp = min;
min = max;
max = temp;
}
if (min >= max) {
temp = min;
min = max;
max = temp;
}
uiUnixNewControl(uiSpinbox, s);
s->widget = gtk_spin_button_new_with_range(min, max, 1);
s->entry = GTK_ENTRY(s->widget);
s->widget = gtk_spin_button_new_with_range(min, max, 1);
s->entry = GTK_ENTRY(s->widget);
s->spinButton = GTK_SPIN_BUTTON(s->widget);
/* ensure integers, just to be safe */
// ensure integers, just to be safe
gtk_spin_button_set_digits(s->spinButton, 0);
s->onChangedSignal = g_signal_connect(s->spinButton, "value-changed", G_CALLBACK(onChanged), s);

View File

@ -15,18 +15,16 @@ uiUnixControlAllDefaultsExceptDestroy(uiTab)
static void uiTabDestroy(uiControl *c)
{
uiTab *t = uiTab(c);
guint i;
uiTab *t = uiTab(c);
struct child *page = NULL;
struct child *page;
for (i = 0; i < t->pages->len; i++)
{
for (i = 0; i < t->pages->len; i++) {
page = g_array_index(t->pages, struct child *, i);
childDestroy(page);
}
g_array_free(t->pages, TRUE);
/* and free ourselves */
// and free ourselves
g_object_unref(t->widget);
uiFreeControl(uiControl(t));
}
@ -38,8 +36,10 @@ void uiTabAppend(uiTab *t, const char *name, uiControl *child)
void uiTabInsertAt(uiTab *t, const char *name, int n, uiControl *child)
{
/* this will create a tab, because of gtk_container_add() */
struct child *page = newChildWithBox(child, uiControl(t), t->container, 0);
struct child *page;
// this will create a tab, because of gtk_container_add()
page = newChildWithBox(child, uiControl(t), t->container, 0);
gtk_notebook_set_tab_label_text(t->notebook, childBox(page), name);
gtk_notebook_reorder_child(t->notebook, childBox(page), n);
@ -49,10 +49,10 @@ void uiTabInsertAt(uiTab *t, const char *name, int n, uiControl *child)
void uiTabDelete(uiTab *t, int n)
{
struct child *page = g_array_index(t->pages, struct child *, n);
/* this will remove the tab,
* because gtk_widget_destroy() calls gtk_container_remove() */
struct child *page;
page = g_array_index(t->pages, struct child *, n);
// this will remove the tab, because gtk_widget_destroy() calls gtk_container_remove()
childRemove(page);
g_array_remove_index(t->pages, n);
}
@ -64,28 +64,30 @@ int uiTabNumPages(uiTab *t)
int uiTabMargined(uiTab *t, int n)
{
struct child *page = g_array_index(t->pages, struct child *, n);
struct child *page;
page = g_array_index(t->pages, struct child *, n);
return childFlag(page);
}
void uiTabSetMargined(uiTab *t, int n, int margined)
{
struct child *page = g_array_index(t->pages, struct child *, n);
struct child *page;
page = g_array_index(t->pages, struct child *, n);
childSetFlag(page, margined);
childSetMargined(page, childFlag(page));
}
uiTab *uiNewTab(void)
{
uiTab *t = NULL;;
uiTab *t;
uiUnixNewControl(uiTab, t);
t->widget = gtk_notebook_new();
t->widget = gtk_notebook_new();
t->container = GTK_CONTAINER(t->widget);
t->notebook = GTK_NOTEBOOK(t->widget);
t->notebook = GTK_NOTEBOOK(t->widget);
gtk_notebook_set_scrollable(t->notebook, TRUE);

View File

@ -1,11 +1,11 @@
/* 22 april 2015 */
// 22 april 2015
#define GLIB_VERSION_MIN_REQUIRED GLIB_VERSION_2_40
#define GLIB_VERSION_MAX_ALLOWED GLIB_VERSION_2_40
#define GDK_VERSION_MIN_REQUIRED GDK_VERSION_3_10
#define GDK_VERSION_MAX_ALLOWED GDK_VERSION_3_10
#include <gtk/gtk.h>
#include <math.h>
#include <dlfcn.h> /* see drawtext.c */
#include <dlfcn.h> // see drawtext.c
#include <langinfo.h>
#include <string.h>
#include <stdlib.h>
@ -18,19 +18,19 @@
#define gtkXPadding 12
#define gtkYPadding 6
/* menu.c */
// menu.c
extern GtkWidget *makeMenubar(uiWindow *);
extern void freeMenubar(GtkWidget *);
extern void uninitMenus(void);
/* alloc.c */
// alloc.c
extern void initAlloc(void);
extern void uninitAlloc(void);
/* util.c */
// util.c
extern void setMargined(GtkContainer *, int);
/* child.c */
// child.c
extern struct child *newChild(uiControl *child, uiControl *parent, GtkContainer *parentContainer);
extern struct child *newChildWithBox(uiControl *child, uiControl *parent, GtkContainer *parentContainer, int margined);
extern void childRemove(struct child *c);
@ -41,25 +41,25 @@ extern void childSetFlag(struct child *c, int flag);
extern GtkWidget *childBox(struct child *c);
extern void childSetMargined(struct child *c, int margined);
/* draw.c */
// draw.c
extern uiDrawContext *newContext(cairo_t *);
extern void freeContext(uiDrawContext *);
/* drawtext.c */
// drawtext.c
extern uiDrawTextFont *mkTextFont(PangoFont *f, gboolean add);
extern PangoFont *pangoDescToPangoFont(PangoFontDescription *pdesc);
/* graphemes.c */
// graphemes.c
extern ptrdiff_t *graphemes(const char *text, PangoContext *context);
/* image.c */
// image.c
/*TODO remove this*/typedef struct uiImage uiImage;
extern cairo_surface_t *imageAppropriateSurface(uiImage *i, GtkWidget *w);
/* cellrendererbutton.c */
// cellrendererbutton.c
extern GtkCellRenderer *newCellRendererButton(void);
/* future.c */
// future.c
extern void loadFutures(void);
extern PangoAttribute *FUTURE_pango_attr_foreground_alpha_new(guint16 alpha);
extern gboolean FUTURE_gtk_widget_path_iter_set_object_name(GtkWidgetPath *path, gint pos, const char *name);

View File

@ -1,43 +1,40 @@
// 11 june 2015
#include "uipriv_unix.h"
struct uiWindow
{
uiUnixControl c;
struct uiWindow {
uiUnixControl c;
GtkWidget *widget;
GtkContainer *container;
GtkWindow *window;
GtkWidget *widget;
GtkContainer *container;
GtkWindow *window;
GtkWidget *vboxWidget;
GtkContainer *vboxContainer;
GtkBox *vbox;
GtkWidget *vboxWidget;
GtkContainer *vboxContainer;
GtkBox *vbox;
GtkWidget *childHolderWidget;
GtkContainer *childHolderContainer;
GtkWidget *childHolderWidget;
GtkContainer *childHolderContainer;
GtkWidget *menubar;
GtkWidget *menubar;
uiControl *child;
int margined;
uiControl *child;
int margined;
int (*onClosing)(uiWindow *, void *);
void *onClosingData;
void (*onContentSizeChanged)(uiWindow *, void *);
void *onContentSizeChangedData;
gboolean fullscreen;
int (*onClosing)(uiWindow *, void *);
void *onClosingData;
void (*onContentSizeChanged)(uiWindow *, void *);
void *onContentSizeChangedData;
gboolean fullscreen;
};
static gboolean onClosing(GtkWidget *win, GdkEvent *e, gpointer data)
{
uiWindow *w = uiWindow(data);
/* manually destroy the window ourselves; don't let
* the delete-event handler do it */
// manually destroy the window ourselves; don't let the delete-event handler do it
if ((*(w->onClosing))(w, w->onClosingData))
uiControlDestroy(uiControl(w));
/* don't continue to the default delete-event handler;
* we destroyed the window by now */
// don't continue to the default delete-event handler; we destroyed the window by now
return TRUE;
}
@ -45,7 +42,7 @@ static void onSizeAllocate(GtkWidget *widget, GdkRectangle *allocation, gpointer
{
uiWindow *w = uiWindow(data);
/* TODO deal with spurious size-allocates */
// TODO deal with spurious size-allocates
(*(w->onContentSizeChanged))(w, w->onContentSizeChangedData);
}
@ -56,30 +53,28 @@ static int defaultOnClosing(uiWindow *w, void *data)
static void defaultOnPositionContentSizeChanged(uiWindow *w, void *data)
{
/* do nothing */
// do nothing
}
static void uiWindowDestroy(uiControl *c)
{
uiWindow *w = uiWindow(c);
/* first hide ourselves */
// first hide ourselves
gtk_widget_hide(w->widget);
/* now destroy the child */
if (w->child != NULL)
{
uiControlSetParent(w->child, NULL);
uiUnixControlSetContainer(uiUnixControl(w->child), w->childHolderContainer, TRUE);
uiControlDestroy(w->child);
}
/* now destroy the menus, if any */
// now destroy the child
if (w->child != NULL) {
uiControlSetParent(w->child, NULL);
uiUnixControlSetContainer(uiUnixControl(w->child), w->childHolderContainer, TRUE);
uiControlDestroy(w->child);
}
// now destroy the menus, if any
if (w->menubar != NULL)
freeMenubar(w->menubar);
gtk_widget_destroy(w->childHolderWidget);
gtk_widget_destroy(w->vboxWidget);
/* and finally free ourselves
* use gtk_widget_destroy() instead of g_object_unref()
* because GTK+ has internal references (see #165) */
// and finally free ourselves
// use gtk_widget_destroy() instead of g_object_unref() because GTK+ has internal references (see #165)
gtk_widget_destroy(w->widget);
uiFreeControl(uiControl(w));
}
@ -107,11 +102,9 @@ static void uiWindowShow(uiControl *c)
{
uiWindow *w = uiWindow(c);
/* don't use gtk_widget_show_all() as that
* will show all children, regardless of user settings
* don't use gtk_widget_show(); that doesn't bring to
* front or give keyboard focus
* (gtk_window_present() does call gtk_widget_show() though) */
// don't use gtk_widget_show_all() as that will show all children, regardless of user settings
// don't use gtk_widget_show(); that doesn't bring to front or give keyboard focus
// (gtk_window_present() does call gtk_widget_show() though)
gtk_window_present(w->window);
}
@ -119,8 +112,7 @@ uiUnixControlDefaultHide(uiWindow)
uiUnixControlDefaultEnabled(uiWindow)
uiUnixControlDefaultEnable(uiWindow)
uiUnixControlDefaultDisable(uiWindow)
/* TODO? */
// TODO?
uiUnixControlDefaultSetContainer(uiWindow)
char *uiWindowTitle(uiWindow *w)

View File

@ -1,198 +0,0 @@
/* 22 may 2015 */
#include "uipriv_windows.hpp"
struct uiDateTimePicker {
uiWindowsControl c;
HWND hwnd;
};
#ifndef DTM_GETIDEALSIZE
#define DTM_GETIDEALSIZE 0x100f
#endif
/* utility functions */
#define GLI(what, buf, n) GetLocaleInfoEx(LOCALE_NAME_USER_DEFAULT, what, buf, n)
/* The real date/time picker does a manual replacement of "yy" with "yyyy" for DTS_SHORTDATECENTURYFORMAT.
* Because we're also duplicating its functionality (see below), we have to do it too. */
static WCHAR *expandYear(WCHAR *dts, int n)
{
WCHAR *p = NULL;
int ny = 0;
/* allocate more than we need to be safe */
WCHAR *out = (WCHAR *) uiAlloc((n * 3) * sizeof (WCHAR), "WCHAR[]");
WCHAR *q = out;
for (p = dts; *p != L'\0'; p++)
{
/* first, if the current character is a y, increment the number of consecutive ys
* otherwise, stop counting, and if there were only two, add two more to make four */
if (*p != L'y') {
if (ny == 2) {
*q++ = L'y';
*q++ = L'y';
}
ny = 0;
} else
ny++;
/* next, handle quoted blocks
* we do this AFTER the above so yy'abc' becomes yyyy'abc' and not yy'abc'yy
* this handles the case of 'a''b' elegantly as well */
if (*p == L'\'') {
/* copy the opening quote */
*q++ = *p;
/* copy the contents */
for (;;) {
p++;
if (*p == L'\'')
break;
if (*p == L'\0')
implbug("unterminated quote in system-provided locale date string in expandYear()");
*q++ = *p;
}
/* and fall through to copy the closing quote */
}
/* copy the current character */
*q++ = *p;
}
/* handle trailing yy */
if (ny == 2) {
*q++ = L'y';
*q++ = L'y';
}
*q++ = L'\0';
return out;
}
/* Windows has no combined date/time prebuilt constant;
* we have to build the format string ourselves
* TODO use a default format if one fails */
static void setDateTimeFormat(HWND hwnd)
{
WCHAR *unexpandedDate, *date;
WCHAR *time;
WCHAR *datetime;
int ntime;
int ndate = GLI(LOCALE_SSHORTDATE, NULL, 0);
if (ndate == 0)
logLastError(L"error getting date string length");
date = (WCHAR *) uiAlloc(ndate * sizeof (WCHAR), "WCHAR[]");
if (GLI(LOCALE_SSHORTDATE, date, ndate) == 0)
logLastError(L"error geting date string");
unexpandedDate = date; /* so we can free it */
date = expandYear(unexpandedDate, ndate);
uiFree(unexpandedDate);
ntime = GLI(LOCALE_STIMEFORMAT, NULL, 0);
if (ndate == 0)
logLastError(L"error getting time string length");
time = (WCHAR *) uiAlloc(ntime * sizeof (WCHAR), "WCHAR[]");
if (GLI(LOCALE_STIMEFORMAT, time, ntime) == 0)
logLastError(L"error geting time string");
datetime = strf(L"%s %s", date, time);
if (SendMessageW(hwnd, DTM_SETFORMAT, 0, (LPARAM) datetime) == 0)
logLastError(L"error applying format string to date/time picker");
uiFree(datetime);
uiFree(time);
uiFree(date);
}
/* control implementation */
static void uiDateTimePickerDestroy(uiControl *c)
{
uiDateTimePicker *d = uiDateTimePicker(c);
uiWindowsUnregisterReceiveWM_WININICHANGE(d->hwnd);
uiWindowsEnsureDestroyWindow(d->hwnd);
uiFreeControl(uiControl(d));
}
uiWindowsControlAllDefaultsExceptDestroy(uiDateTimePicker)
/* the height returned from DTM_GETIDEALSIZE is unreliable; see http://stackoverflow.com/questions/30626549/what-is-the-proper-use-of-dtm-getidealsize-treating-the-returned-size-as-pixels
* from http://msdn.microsoft.com/en-us/library/windows/desktop/dn742486.aspx#sizingandspacing */
#define entryHeight 14
static void uiDateTimePickerMinimumSize(uiWindowsControl *c, int *width, int *height)
{
SIZE s;
uiWindowsSizing sizing;
uiDateTimePicker *d = uiDateTimePicker(c);
int y;
s.cx = 0;
s.cy = 0;
SendMessageW(d->hwnd, DTM_GETIDEALSIZE, 0, (LPARAM) (&s));
*width = s.cx;
y = entryHeight;
uiWindowsGetSizing(d->hwnd, &sizing);
uiWindowsSizingDlgUnitsToPixels(&sizing, NULL, &y);
*height = y;
}
static uiDateTimePicker *finishNewDateTimePicker(DWORD style)
{
uiDateTimePicker *d;
uiWindowsNewControl(uiDateTimePicker, d);
d->hwnd = uiWindowsEnsureCreateControlHWND(WS_EX_CLIENTEDGE,
DATETIMEPICK_CLASSW, L"",
style | WS_TABSTOP,
hInstance, NULL,
TRUE);
/* automatically update date/time format when user changes locale settings
* for the standard styles, this is in the date-time picker itself
* for our date/time mode, we do it in a subclass assigned in uiNewDateTimePicker() */
uiWindowsRegisterReceiveWM_WININICHANGE(d->hwnd);
return d;
}
static LRESULT CALLBACK datetimepickerSubProc(HWND hwnd, UINT uMsg, WPARAM wParam,
LPARAM lParam, UINT_PTR uIdSubclass, DWORD_PTR dwRefData)
{
switch (uMsg)
{
case WM_WININICHANGE:
// we can optimize this by only doing it when the real date/time picker does it
// unfortunately, I don't know when that is :/
// hopefully this won't hurt
setDateTimeFormat(hwnd);
return 0;
case WM_NCDESTROY:
if (RemoveWindowSubclass(hwnd, datetimepickerSubProc, uIdSubclass) == FALSE)
logLastError(L"error removing date-time picker locale change handling subclass");
break;
}
return DefSubclassProc(hwnd, uMsg, wParam, lParam);
}
uiDateTimePicker *uiNewDateTimePicker(void)
{
uiDateTimePicker *d = finishNewDateTimePicker(0);
setDateTimeFormat(d->hwnd);
if (SetWindowSubclass(d->hwnd, datetimepickerSubProc, 0, (DWORD_PTR) d) == FALSE)
logLastError(L"error subclassing date-time-picker to assist in locale change handling");
/* TODO set a suitable default in this case */
return d;
}
uiDateTimePicker *uiNewDatePicker(void)
{
return finishNewDateTimePicker(DTS_SHORTDATECENTURYFORMAT);
}
uiDateTimePicker *uiNewTimePicker(void)
{
return finishNewDateTimePicker(DTS_TIMEFORMAT);
}

View File

@ -1,105 +0,0 @@
/* 9 april 2015 */
#include "uipriv_windows.hpp"
WCHAR *windowTextAndLen(HWND hwnd, LRESULT *len)
{
WCHAR *text = NULL;
LRESULT n = SendMessageW(hwnd, WM_GETTEXTLENGTH, 0, 0);
if (len != NULL)
*len = n;
/* WM_GETTEXTLENGTH does not include the null terminator */
text = (WCHAR *) uiAlloc((n + 1) * sizeof (WCHAR), "WCHAR[]");
/* note the comparison: the size includes the
* null terminator, but the return does not */
if (GetWindowTextW(hwnd, text, n + 1) != n)
{
logLastError(L"error getting window text");
/* on error, return an empty string to be safe */
*text = L'\0';
if (len != NULL)
*len = 0;
}
return text;
}
WCHAR *windowText(HWND hwnd)
{
return windowTextAndLen(hwnd, NULL);
}
void setWindowText(HWND hwnd, WCHAR *wtext)
{
if (SetWindowTextW(hwnd, wtext) == 0)
logLastError(L"error setting window text");
}
void uiFreeText(char *text)
{
uiFree(text);
}
int uiWindowsWindowTextWidth(HWND hwnd)
{
LRESULT len;
HDC dc;
HFONT prevfont;
SIZE size;
WCHAR *text = windowTextAndLen(hwnd, &len);
size.cx = 0;
size.cy = 0;
if (len == 0) /* no text; nothing to do */
goto noTextOrError;
/* now we can do the calculations */
dc = GetDC(hwnd);
if (dc == NULL)
{
logLastError(L"error getting DC");
/* on any error, assume no text */
goto noTextOrError;
}
prevfont = (HFONT) SelectObject(dc, hMessageFont);
if (prevfont == NULL)
{
logLastError(L"error loading control font into device context");
ReleaseDC(hwnd, dc);
goto noTextOrError;
}
if (GetTextExtentPoint32W(dc, text, len, &size) == 0)
{
logLastError(L"error getting text extent point");
/* continue anyway, assuming size is 0 */
size.cx = 0;
size.cy = 0;
}
/* continue on errors; we got what we want */
if (SelectObject(dc, prevfont) != hMessageFont)
logLastError(L"error restoring previous font into device context");
if (ReleaseDC(hwnd, dc) == 0)
logLastError(L"error releasing DC");
uiFree(text);
return size.cx;
noTextOrError:
uiFree(text);
return 0;
}
char *uiWindowsWindowText(HWND hwnd)
{
WCHAR *wtext = windowText(hwnd);
char *text = toUTF8(wtext);
uiFree(wtext);
return text;
}
void uiWindowsSetWindowText(HWND hwnd, const char *text)
{
WCHAR *wtext = toUTF16(text);
setWindowText(hwnd, wtext);
uiFree(wtext);
}

View File

@ -1,87 +0,0 @@
/* 14 may 2015 */
#include "uipriv_windows.hpp"
#include "../../verbosity.h"
/* The utility window is a special window that performs certain tasks internal to libui.
* It is not a message-only window, and it is always hidden and disabled.
* Its roles:
* - It is the initial parent of all controls. When a control loses its parent, it also becomes that control's parent.
* - It handles WM_QUERYENDSESSION and console end session requests.
* - It handles WM_WININICHANGE and forwards the message to any child windows that request it.
* - It handles executing functions queued to run by uiQueueMain().
*/
#define utilWindowClass L"libui_utilWindowClass"
HWND utilWindow;
static LRESULT CALLBACK utilWindowWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
void (*qf)(void *);
LRESULT lResult;
if (handleParentMessages(hwnd, uMsg, wParam, lParam, &lResult) != FALSE)
return lResult;
switch (uMsg)
{
case WM_QUERYENDSESSION:
/* TODO block handler */
if (shouldQuit())
{
uiQuit();
return TRUE;
}
return FALSE;
case WM_WININICHANGE:
issueWM_WININICHANGE(wParam, lParam);
return 0;
case msgQueued:
qf = (void (*)(void *)) wParam;
(*qf)((void *) lParam);
return 0;
}
return DefWindowProcW(hwnd, uMsg, wParam, lParam);
}
const char *initUtilWindow(HICON hDefaultIcon, HCURSOR hDefaultCursor)
{
WNDCLASSW wc;
ZeroMemory(&wc, sizeof (WNDCLASSW));
wc.lpszClassName = utilWindowClass;
wc.lpfnWndProc = utilWindowWndProc;
wc.hInstance = hInstance;
wc.hIcon = hDefaultIcon;
wc.hCursor = hDefaultCursor;
wc.hbrBackground = (HBRUSH) (COLOR_BTNFACE + 1);
if (RegisterClass(&wc) == 0)
{
RARCH_ERR("Cannot register class.\n");
/* see init.cpp for an explanation of the =s */
return "=registering utility window class";
}
utilWindow = CreateWindowExW(0,
utilWindowClass, L"libui utility window",
WS_OVERLAPPEDWINDOW,
0, 0, 100, 100,
NULL, NULL, hInstance, NULL);
if (utilWindow == NULL)
{
RARCH_ERR("Cannot create window.\n");
return "=creating utility window";
}
/* and just to be safe */
EnableWindow(utilWindow, FALSE);
return NULL;
}
void uninitUtilWindow(void)
{
if (DestroyWindow(utilWindow) == 0)
logLastError(L"error destroying utility window");
if (UnregisterClass(utilWindowClass, hInstance) == 0)
logLastError(L"error unregistering utility window class");
}

View File

@ -1,150 +0,0 @@
/* This file contains some Vista SDK stuff that is missing from the current
mingw-w64 headers */
#ifndef WINEXTRA_H
#define WINEXTRA_H
/* winuser.h */
#if (_WIN32_WINNT >= 0x0600)
WINUSERAPI WINBOOL WINAPI SetProcessDPIAware(VOID);
WINUSERAPI WINBOOL WINAPI IsProcessDPIAware(VOID);
#endif
/* commctrl.h */
#ifndef NOTASKDIALOG
#if (NTDDI_VERSION >= NTDDI_VISTA)
#include <pshpack1.h>
#define TD_WARNING_ICON MAKEINTRESOURCEW(-1)
#define TD_ERROR_ICON MAKEINTRESOURCEW(-2)
#define TD_INFORMATION_ICON MAKEINTRESOURCEW(-3)
#define TD_SHIELD_ICON MAKEINTRESOURCEW(-4)
typedef HRESULT (CALLBACK *PFTASKDIALOGCALLBACK)(HWND hwnd,UINT uNotification,WPARAM wParam,LPARAM lParam,LONG_PTR dwRefData);
enum _TASKDIALOG_FLAGS {
TDF_ENABLE_HYPERLINKS = 0x0001,
TDF_USE_HICON_MAIN = 0x0002,
TDF_USE_HICON_FOOTER = 0x0004,
TDF_ALLOW_DIALOG_CANCELLATION = 0x0008,
TDF_USE_COMMAND_LINKS = 0x0010,
TDF_USE_COMMAND_LINKS_NO_ICON = 0x0020,
TDF_EXPAND_FOOTER_AREA = 0x0040,
TDF_EXPANDED_BY_DEFAULT = 0x0080,
TDF_VERIFICATION_FLAG_CHECKED = 0x0100,
TDF_SHOW_PROGRESS_BAR = 0x0200,
TDF_SHOW_MARQUEE_PROGRESS_BAR = 0x0400,
TDF_CALLBACK_TIMER = 0x0800,
TDF_POSITION_RELATIVE_TO_WINDOW = 0x1000,
TDF_RTL_LAYOUT = 0x2000,
TDF_NO_DEFAULT_RADIO_BUTTON = 0x4000,
TDF_CAN_BE_MINIMIZED = 0x8000,
TDIF_SIZE_TO_CONTENT = 0x1000000,
TDF_SIZE_TO_CONTENT = 0x1000000
};
typedef int TASKDIALOG_FLAGS;
enum _TASKDIALOG_COMMON_BUTTON_FLAGS {
TDCBF_OK_BUTTON = 0x01,
TDCBF_YES_BUTTON = 0x02,
TDCBF_NO_BUTTON = 0x04,
TDCBF_CANCEL_BUTTON = 0x08,
TDCBF_RETRY_BUTTON = 0x10,
TDCBF_CLOSE_BUTTON = 0x20
};
typedef int TASKDIALOG_COMMON_BUTTON_FLAGS;
typedef enum _TASKDIALOG_NOTIFICATIONS {
TDN_CREATED = 0,
TDN_NAVIGATED = 1,
TDN_BUTTON_CLICKED = 2,
TDN_HYPERLINK_CLICKED = 3,
TDN_TIMER = 4,
TDN_DESTROYED = 5,
TDN_RADIO_BUTTON_CLICKED = 6,
TDN_DIALOG_CONSTRUCTED = 7,
TDN_VERIFICATION_CLICKED = 8,
TDN_HELP = 9,
TDN_EXPANDO_BUTTON_CLICKED = 10
} TASKDIALOG_NOTIFICATIONS;
typedef enum _TASKDIALOG_MESSAGES {
TDM_NAVIGATE_PAGE = WM_USER + 101,
TDM_CLICK_BUTTON = WM_USER + 102,
TDM_SET_MARQUEE_PROGRESS_BAR = WM_USER + 103,
TDM_SET_PROGRESS_BAR_STATE = WM_USER + 104,
TDM_SET_PROGRESS_BAR_RANGE = WM_USER + 105,
TDM_SET_PROGRESS_BAR_POS = WM_USER + 106,
TDM_SET_PROGRESS_BAR_MARQUEE = WM_USER + 107,
TDM_SET_ELEMENT_TEXT = WM_USER + 108,
TDM_CLICK_RADIO_BUTTON = WM_USER + 110,
TDM_ENABLE_BUTTON = WM_USER + 111,
TDM_ENABLE_RADIO_BUTTON = WM_USER + 112,
TDM_CLICK_VERIFICATION = WM_USER + 113,
TDM_UPDATE_ELEMENT_TEXT = WM_USER + 114,
TDM_SET_BUTTON_ELEVATION_REQUIRED_STATE = WM_USER + 115,
TDM_UPDATE_ICON = WM_USER + 116
} TASKDIALOG_MESSAGES;
typedef enum _TASKDIALOG_ELEMENTS {
TDE_CONTENT,
TDE_EXPANDED_INFORMATION,
TDE_FOOTER,
TDE_MAIN_INSTRUCTION
} TASKDIALOG_ELEMENTS;
typedef enum _TASKDIALOG_ICON_ELEMENTS {
TDIE_ICON_MAIN,
TDIE_ICON_FOOTER
} TASKDIALOG_ICON_ELEMENTS;
typedef struct _TASKDIALOG_BUTTON {
int nButtonID;
PCWSTR pszButtonText;
} TASKDIALOG_BUTTON;
typedef struct _TASKDIALOGCONFIG {
UINT cbSize;
HWND hwndParent;
HINSTANCE hInstance;
TASKDIALOG_FLAGS dwFlags;
TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons;
PCWSTR pszWindowTitle;
__C89_NAMELESS union {
HICON hMainIcon;
PCWSTR pszMainIcon;
} DUMMYUNIONNAME;
PCWSTR pszMainInstruction;
PCWSTR pszContent;
UINT cButtons;
const TASKDIALOG_BUTTON *pButtons;
int nDefaultButton;
UINT cRadioButtons;
const TASKDIALOG_BUTTON *pRadioButtons;
int nDefaultRadioButton;
PCWSTR pszVerificationText;
PCWSTR pszExpandedInformation;
PCWSTR pszExpandedControlText;
PCWSTR pszCollapsedControlText;
__C89_NAMELESS union {
HICON hFooterIcon;
PCWSTR pszFooterIcon;
} DUMMYUNIONNAME2;
PCWSTR pszFooter;
PFTASKDIALOGCALLBACK pfCallback;
LONG_PTR lpCallbackData;
UINT cxWidth;
} TASKDIALOGCONFIG;
WINCOMMCTRLAPI HRESULT WINAPI TaskDialog(HWND hwndParent,HINSTANCE hInstance,PCWSTR pszWindowTitle,PCWSTR pszMainInstruction,PCWSTR pszContent,TASKDIALOG_COMMON_BUTTON_FLAGS dwCommonButtons,PCWSTR pszIcon,int *pnButton);
WINCOMMCTRLAPI HRESULT WINAPI TaskDialogIndirect(const TASKDIALOGCONFIG *pTaskConfig,int *pnButton,int *pnRadioButton,BOOL *pfVerificationFlagChecked);
#include <poppack.h>
#endif
#endif
/* dwmapi.h */
HRESULT WINAPI DwmFlush(VOID);
#endif

91
deps/libui/windows/CMakeLists.txt vendored Normal file
View File

@ -0,0 +1,91 @@
# 3 june 2016
list(APPEND _LIBUI_SOURCES
windows/alloc.cpp
windows/area.cpp
windows/areadraw.cpp
windows/areaevents.cpp
windows/areascroll.cpp
windows/areautil.cpp
windows/box.cpp
windows/button.cpp
windows/checkbox.cpp
windows/colorbutton.cpp
windows/colordialog.cpp
windows/combobox.cpp
windows/container.cpp
windows/control.cpp
windows/d2dscratch.cpp
windows/datetimepicker.cpp
windows/debug.cpp
windows/draw.cpp
windows/drawmatrix.cpp
windows/drawpath.cpp
windows/drawtext.cpp
windows/dwrite.cpp
windows/editablecombo.cpp
windows/entry.cpp
windows/events.cpp
windows/fontbutton.cpp
windows/fontdialog.cpp
windows/form.cpp
windows/graphemes.cpp
windows/grid.cpp
windows/group.cpp
windows/init.cpp
windows/label.cpp
windows/main.cpp
windows/menu.cpp
windows/multilineentry.cpp
windows/parent.cpp
windows/progressbar.cpp
windows/radiobuttons.cpp
windows/separator.cpp
windows/sizing.cpp
windows/slider.cpp
windows/spinbox.cpp
windows/stddialogs.cpp
windows/tab.cpp
windows/tabpage.cpp
windows/text.cpp
windows/utf16.cpp
windows/utilwin.cpp
windows/window.cpp
windows/winpublic.cpp
windows/winutil.cpp
windows/resources.rc
)
set(_LIBUI_SOURCES ${_LIBUI_SOURCES} PARENT_SCOPE)
list(APPEND _LIBUI_INCLUDEDIRS
windows
)
set(_LIBUI_INCLUDEDIRS _LIBUI_INCLUDEDIRS PARENT_SCOPE)
# Windows won't link resources in static libraries; we need to provide the libui.res file in this case.
set(_LIBUINAME libui PARENT_SCOPE)
if(NOT BUILD_SHARED_LIBS)
set(_LIBUI_STATIC_RES ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libui.res PARENT_SCOPE)
endif()
macro(_handle_static)
# TODO this full path feels hacky
add_custom_command(
TARGET libui POST_BUILD
COMMAND
${CMAKE_COMMAND} -E copy $<TARGET_PROPERTY:libui,BINARY_DIR>/CMakeFiles/libui.dir/windows/resources.rc.* ${_LIBUI_STATIC_RES}
COMMENT "Copying libui.res")
endmacro()
# notice that usp10 comes before gdi32
# TODO prune this list
set(_LIBUI_LIBS
user32 kernel32 usp10 gdi32 comctl32 uxtheme msimg32 comdlg32 d2d1 dwrite ole32 oleaut32 oleacc uuid
PARENT_SCOPE)
if(NOT MSVC)
if(BUILD_SHARED_LIBS)
message(FATAL_ERROR
"Sorry, but libui for Windows can currently only be built as a static library with MinGW. You will need to either build as a static library or switch to MSVC."
)
endif()
endif()

View File

@ -100,10 +100,11 @@ static void scroll(uiArea *a, int which, struct scrollParams *p, WPARAM wParam,
static void wheelscroll(uiArea *a, int which, struct scrollParams *p, WPARAM wParam, LPARAM lParam)
{
int delta;
int lines;
UINT scrollAmount;
int delta = GET_WHEEL_DELTA_WPARAM(wParam);
delta = GET_WHEEL_DELTA_WPARAM(wParam);
if (SystemParametersInfoW(p->wheelSPIAction, 0, &scrollAmount, 0) == 0)
// TODO use scrollAmount == 3 (for both v and h) instead?
logLastError(L"error getting area wheel scroll amount");

Some files were not shown because too many files have changed in this diff Show More