4 years ago[libcompat] Removed vlc_getopt. switch-from-getopt-to-popt github/switch-from-getopt-to-popt
David Korth [Mon, 24 Aug 2015 00:13:50 +0000 (20:13 -0400)] 
[libcompat] Removed vlc_getopt.

mcd_pcm has been switched over to popt.

test_VdpPalette_DAC_generate.c still uses getopt_long(), but it wasn't
ported to vlc_getopt, so it's still in the same condition it was in

TODO: Port test_VdpPalette_DAC_generate.c to popt.

4 years ago[popt] popthelp.c: Added a Win32 equivalent of TIOCGWINSZ.
David Korth [Mon, 24 Aug 2015 00:10:06 +0000 (20:10 -0400)] 
[popt] popthelp.c: Added a Win32 equivalent of TIOCGWINSZ.

GetConsoleScreenBufferInfo() is available starting with:
- Windows NT 3.1
- Windows 95

4 years ago[tools] mcd_pcm.c: Removed a few extraneous newlines from fprintf() messages.
David Korth [Sun, 23 Aug 2015 23:59:57 +0000 (19:59 -0400)] 
[tools] mcd_pcm.c: Removed a few extraneous newlines from fprintf() messages.

4 years ago[tools] CMakeLists.txt: Added the popt include directory to the include path.
David Korth [Sun, 23 Aug 2015 23:58:20 +0000 (19:58 -0400)] 
[tools] CMakeLists.txt: Added the popt include directory to the include path.

This is needed when using the internal copy of popt, and possibly
on Windows when using a copy of popt installed in a weird place.

4 years ago[tools] mcd_pcm.c: TODO: Add a popt alias context?
David Korth [Sun, 23 Aug 2015 23:54:14 +0000 (19:54 -0400)] 
[tools] mcd_pcm.c: TODO: Add a popt alias context?

4 years ago[tools] mcd_pcm.c: Alias '-h' to '-?'.
David Korth [Sun, 23 Aug 2015 23:53:33 +0000 (19:53 -0400)] 
[tools] mcd_pcm.c: Alias '-h' to '-?'.

The getopt_long() code used '-h' for help. popt defaults to '?',
so use '?' as the default one, but still accept '-h'.

4 years ago[tools] mcd_pcm.c: Removed POPT_AUTOHELP; added manual help and usage options.
David Korth [Sun, 23 Aug 2015 23:47:55 +0000 (19:47 -0400)] 
[tools] mcd_pcm.c: Removed POPT_AUTOHELP; added manual help and usage options.

print_help() prints our own custom help information, plus the standard
poptPrintHelp() table.

4 years ago[tools] mcd_pcm.c: Re-implemented '--version'.
David Korth [Sun, 23 Aug 2015 23:32:55 +0000 (19:32 -0400)] 
[tools] mcd_pcm.c: Re-implemented '--version'.

4 years ago[tools] mcd_pcm.c: Initial port from getopt() to popt.
David Korth [Sun, 23 Aug 2015 22:58:21 +0000 (18:58 -0400)] 
[tools] mcd_pcm.c: Initial port from getopt() to popt.

- Add "--version".
- Improve the help screen to provide the information that was prsent
  in the original version.

4 years agoCheckPopt.cmake: s/zlibstatic/popt/
David Korth [Sun, 23 Aug 2015 22:09:04 +0000 (18:09 -0400)] 
CheckPopt.cmake: s/zlibstatic/popt/

Copypasta from CheckZLIB.cmake.

4 years agoCheckPopt.cmake: Check for libpopt.
David Korth [Sun, 23 Aug 2015 22:07:25 +0000 (18:07 -0400)] 
CheckPopt.cmake: Check for libpopt.

The system popt will be used if available. If it isn't, the internal
copy of popt will be compiled and used instead.

Note that unlike zlib, minizip, libpng, and GLEW, we're going to check
for the system popt on Windows. I should probably use the system
versions for the other libraries on Windows, but maybe later.

4 years ago[popt] INCLUDE(CheckSymbolExists)
David Korth [Sun, 23 Aug 2015 22:05:12 +0000 (18:05 -0400)] 
[popt] INCLUDE(CheckSymbolExists)

Due to some reorganization in extlib/CMakeLists.txt (not committed yet),
CHECK_SYMBOL_EXISTS() wasn't available here. Include it to make sure that
it's available.

4 years ago[cmake] libs/: Check if the required variable is defined.
David Korth [Sun, 23 Aug 2015 22:03:54 +0000 (18:03 -0400)] 
[cmake] libs/: Check if the required variable is defined.

If it's defined, we've already checked for the library, regardless
of whether or not it was found.

4 years ago[popt] system.h: #include <process.h> and #define execvp() on Windows.
David Korth [Sun, 23 Aug 2015 21:55:45 +0000 (17:55 -0400)] 
[popt] system.h: #include <process.h> and #define execvp() on Windows.

FIXME: Does execvp() work correctly on Windows?

4 years ago[popt] system.h: strtoll() and strtoull() were first added in MSVC 2013.
David Korth [Sun, 23 Aug 2015 21:51:22 +0000 (17:51 -0400)] 
[popt] system.h: strtoll() and strtoull() were first added in MSVC 2013.

Older versions have _strtoi64() and strtoui64().

Copied from msvc-c99-compat.h.

4 years ago[popt] popt.c: Use _access() on Windows.
David Korth [Sun, 23 Aug 2015 21:50:19 +0000 (17:50 -0400)] 
[popt] popt.c: Use _access() on Windows.

system.h: Moved #include <io.h> from poptconfig.c to here.

4 years ago[popt] system.h: MSVC complains about const casts when calling free(), realloc()...
David Korth [Sun, 23 Aug 2015 21:47:56 +0000 (17:47 -0400)] 
[popt] system.h: MSVC complains about const casts when calling free(), realloc(), and memcpy() with const pointers.

Some of popt's structs have const pointers, since they're not supposed
to be modified by the user. They *are* modified by popt itself, though.

Also, #include <wchar.h> here to prevent redefinitions later.

4 years ago[popt] popthelp.c: Use inttypes.h for PRId64.
David Korth [Sun, 23 Aug 2015 21:42:17 +0000 (17:42 -0400)] 
[popt] popthelp.c: Use inttypes.h for PRId64.

MinGW-w64 and MSVC use %I64d instead of %lld.
inttypes.h provides the correct format string on all platforms.

If inttypes.h isn't available, default to %lld, since most
Unix and Unix-like platforms use that.

4 years ago[popt] Fixed compilation on MSVC and MinGW-w64.
David Korth [Sun, 23 Aug 2015 21:38:06 +0000 (17:38 -0400)] 
[popt] Fixed compilation on MSVC and MinGW-w64.

There's a bunch of warnings that still need to be fixed, and I have
no idea if popt actually works properly on Windows right now.

4 years ago[popt] poptint.h: libintl.h is required even if ENABLE_NLS is disabled.
David Korth [Sun, 23 Aug 2015 21:04:31 +0000 (17:04 -0400)] 
[popt] poptint.h: libintl.h is required even if ENABLE_NLS is disabled.

Otherwise, we end up with a bunch of implicit function declaration warnings.

4 years ago[popt] system.h: secure_getenv() requires _GNU_SOURCE.
David Korth [Sun, 23 Aug 2015 21:03:34 +0000 (17:03 -0400)] 
[popt] system.h: secure_getenv() requires _GNU_SOURCE.

4 years ago[popt] Added support for glibc-2.17's secure_getenv() function.
David Korth [Sun, 23 Aug 2015 20:59:13 +0000 (16:59 -0400)] 
[popt] Added support for glibc-2.17's secure_getenv() function.

It was renamed from __secure_getenv() in glibc-2.17.
The symbol for __secure_getenv() is still available, but the
headers no longer declare it.

4 years ago[popt] CMakeLists.txt: Fix SET_MSVC_DEBUG_PATH().
David Korth [Sun, 23 Aug 2015 20:57:06 +0000 (16:57 -0400)] 
[popt] CMakeLists.txt: Fix SET_MSVC_DEBUG_PATH().

Copypasta from libcompat.

4 years ago[extlib] Initial internal copy of popt-1.16.
David Korth [Sun, 23 Aug 2015 20:54:51 +0000 (16:54 -0400)] 
[extlib] Initial internal copy of popt-1.16.

The autoconf infrastructure was removed.

- Check for some Mac OS X-specific functions. (Not actually used
  by popt, but was present in the autoconf system.)
- Fix a bunch of warnings.
- Fix the MinGW-w64 build.
- __secure_getenv() was renamed to secure_getenv() in glibc-2.17.

4 years ago[libcompat] CMakeLists.txt: Added W32U_alloca.h.
David Korth [Sun, 23 Aug 2015 16:25:58 +0000 (12:25 -0400)] 
[libcompat] CMakeLists.txt: Added W32U_alloca.h.

4 years ago[libcompat] W32U_libc.c: Removed some debugging code.
David Korth [Sun, 23 Aug 2015 16:20:45 +0000 (12:20 -0400)] 
[libcompat] W32U_libc.c: Removed some debugging code.

4 years ago[libcompat] W32U_alloca.h: UtoW_filename(): Convert slashes to backslashes.
David Korth [Sun, 23 Aug 2015 16:20:37 +0000 (12:20 -0400)] 
[libcompat] W32U_alloca.h: UtoW_filename(): Convert slashes to backslashes.

CreateFileW() doesn't like slashes in long filenames.

Note that we're doing this for both absolute and relative paths,
since Windows prefers backslashses to slashes regardless.

4 years ago[libcompat] W32U_alloca.h: New conversion functions for filenames.
David Korth [Sun, 23 Aug 2015 16:15:38 +0000 (12:15 -0400)] 
[libcompat] W32U_alloca.h: New conversion functions for filenames.

CreateFileW() supports ab solute paths longer than MAX_PATH (260)
characters when prefixed by "\\?\". UtoW_filename() will prefix
absolute paths (paths that start with "?:\" or "?:/", where ? is
a letter) with "\\?\" in order to allow longer paths to work.

Similarly, WtoA_filename() will remove "\\?\" if present, since the
ANSI functions don't support it.

4 years ago[libcompat] W32U_alloca.h: New header with alloca()-based text conversion.
David Korth [Sun, 23 Aug 2015 16:05:29 +0000 (12:05 -0400)] 
[libcompat] W32U_alloca.h: New header with alloca()-based text conversion.

This reduces the number of heap allocations.

Based on KernelEx's WtoA and AtoW code:

W32U_libc.c: Use UtoW() and WtoA() for internal string conversions.

4 years ago[cmake] platform/win32-gcc.cmake: Generate and keep the .reloc section.
David Korth [Sun, 23 Aug 2015 16:04:59 +0000 (12:04 -0400)] 
[cmake] platform/win32-gcc.cmake: Generate and keep the .reloc section.

This is required for proper ASLR support on Windows Vista and later.

Note that there's a bug in GNU `ld` (2.25.1 and earlier; possibly
later versions, assuming they don't bother to fix it) where enabling
--pic-executable causes it to forget the entry point. We have to
manually specify _mainCRTStartup (or mainCRTStartup on 64-bit)
in order to get the executable to work.

Based on a libav patch:

4 years ago[libgens] EmuContextFactory::createContext(): Return nullptr on error, not false.
David Korth [Sun, 23 Aug 2015 15:53:17 +0000 (11:53 -0400)] 
[libgens] EmuContextFactory::createContext(): Return nullptr on error, not false.

Copypasta from the other functions.

4 years ago[cmake] CheckSystemX8632.cmake: Save the result to an internal variable.
David Korth [Sun, 23 Aug 2015 15:44:57 +0000 (11:44 -0400)] 
[cmake] CheckSystemX8632.cmake: Save the result to an internal variable.

This prevents us from having to run the same check multiple times
if the macro is used in multiple places.

4 years ago[libgens] VdpRend_m5.cpp: Removed FORCE_INLINE from T_Update_Sprite_Line_Cache_m5...
David Korth [Fri, 21 Aug 2015 02:38:12 +0000 (22:38 -0400)] 
[libgens] VdpRend_m5.cpp: Removed FORCE_INLINE from T_Update_Sprite_Line_Cache_m5<>().

Undefined reference errors occur in the release build if it's there.

See commit 79d03576139648d3875b42a3bf64c652d534bf44.
([libgens] Vdp_p.hpp: Remove FORCE_INLINE from T_Update_Sprite_Line_Cache_m5<>().)

4 years ago[gens-qt4] AboutDialog: Added more flags and "slow" flags.
David Korth [Fri, 21 Aug 2015 00:05:45 +0000 (20:05 -0400)] 
[gens-qt4] AboutDialog: Added more flags and "slow" flags.

If a flag is sometimes slow, it's displayed in bold gray.
If a flag is always slow, it's displayed in bold red.

Other changes:
- Added MSVC support in the #if guard.
- Use a char array to store the flag names instead of pointers.
  Although it ends up taking a bit more space due to padding, it saves
  a pointer indirection.

4 years ago[libgens] cpuflags.c: Added "slow" CPU flags.
David Korth [Thu, 20 Aug 2015 23:56:20 +0000 (19:56 -0400)] 
[libgens] cpuflags.c: Added "slow" CPU flags.

Based on code from FFmpeg:
- https://ffmpeg.org/pipermail/ffmpeg-devel/2011-February/102911.html
- https://github.com/FFmpeg/FFmpeg/blob/440fa7758b687bbb0007f85497eed8bb9aec96bd/libavutil/cpu.h
- https://github.com/FFmpeg/FFmpeg/blob/7206b94fb893c63b187bcdfe26422b4e026a3ea0/libavutil/x86/cpu.c

Intel Pentium M and Core 1 CPUs support SSE2, but SSE2 instructions are
almost always slower than the equivalent MMX instructions. Therefore, we
should prefer MMX on those CPUs. This is done by disabling the SSE2 flag
and enabling SSE2SLOW. Same for SSE3 on Core 1.

Early AMD64 CPUs have a similar issue, but it only affects "some" SSE2
instructions. Instead of disabling SSE2 outright, we're setting both
the SSE2 and SSE2SLOW flags. Individual routines will need to be
benchmarked on the affected processors.

AMD Bulldozer CPUs support AVX, but only have 128-bit execution units.
SSE2 is usually faster in that case, though 128-bit AVX instructions
will also work.

Intel Atom CPUs support SSSE3, but similar to AMD, sometimes SSSE3 is
faster than SSE2/SSE3, but sometimes it isn't.

4 years ago[gens-sdl] SdlHandler: Request AUDIO_S16SYS instead of AUDIO_S16LSB.
David Korth [Thu, 20 Aug 2015 23:40:59 +0000 (19:40 -0400)] 
[gens-sdl] SdlHandler: Request AUDIO_S16SYS instead of AUDIO_S16LSB.

We're using host-endian for the audio.

4 years ago[libgens] SoundMgr: Align the segment buffers on 16-byte boundaries.
David Korth [Wed, 19 Aug 2015 02:30:17 +0000 (22:30 -0400)] 
[libgens] SoundMgr: Align the segment buffers on 16-byte boundaries.

The MMX code (which isn't in use by gens-sdl right now) could use a few
optimizations, but in addition, we can now write an SSE version, which
may run slightly faster because it can process 128 bits at a time instead
of 64 bits.

4 years ago[libcompat] aligned_malloc.h: Added an ALIGN() macro for statically-allocated data.
David Korth [Wed, 19 Aug 2015 02:30:05 +0000 (22:30 -0400)] 
[libcompat] aligned_malloc.h: Added an ALIGN() macro for statically-allocated data.

4 years ago[libgens] MdFb: Use aligned_malloc().
David Korth [Wed, 19 Aug 2015 02:26:00 +0000 (22:26 -0400)] 
[libgens] MdFb: Use aligned_malloc().

This will allow for the use of SSE-optimized algorithms for various
effects, including the Paused Effect and (possibly) Fast Blur.

4 years ago[libcompat] aligned_malloc.h: New wrapper function for aligned mallocs.
David Korth [Wed, 19 Aug 2015 02:22:33 +0000 (22:22 -0400)] 
[libcompat] aligned_malloc.h: New wrapper function for aligned mallocs.

libcompat selects from one of four functions, in priority order:
- _aligned_malloc(): MSVC-specific. (also used by MinGW-w64)
- aligned_alloc(): C11 standard.
- posix_memalign(): POSIX.1d
- memalign(): SunOS 4.1.3

Note that of these four functions, _aligned_malloc() requires the use
of _aligned_free() to free the allocated block, whereas the other three
use free(). Hence, we also define aligned_free(), which calls the
appropriate function.

- Define the appropriate feature test macros for aligned_alloc()
  and posix_memalign().
- Implement a custom aligned_malloc() if none of those four functions
  are available.

4 years ago[libgens] macros/common.h: FIXME: gcc always complains when using FORCE_INLINE.
David Korth [Wed, 19 Aug 2015 02:19:39 +0000 (22:19 -0400)] 
[libgens] macros/common.h: FIXME: gcc always complains when using FORCE_INLINE.

Temporarily replace it with __inline.

cpuflags_x86.h: Use FORCE_INLINE_DEBUG.

4 years ago[libgens] cpuflags.c: Added MSVC support.
David Korth [Wed, 19 Aug 2015 01:49:25 +0000 (21:49 -0400)] 
[libgens] cpuflags.c: Added MSVC support.

Inline assembler is used for some i386-only stuff.

The MSVC __cpuid() intrinsic is used for actually executing the 'cpuid'
instruction. As such, our cpuid macro is now CPUID(). Note that the
intrinsic uses an array as a return value instead of individual registers.
MSVC optimizes it away in the release build, so that's not a problem.

4 years ago[libgens] cpuflags_x86.h: Also mark "cc" as clobbered.
David Korth [Wed, 19 Aug 2015 01:35:23 +0000 (21:35 -0400)] 
[libgens] cpuflags_x86.h: Also mark "cc" as clobbered.

Probably not necessary, since gcc always assumes the condition codes
are clobbered when using inline asm, but since we're explicitly
manipulating EFLAGS, we might as well mark it as clobbered.

4 years ago[gens-sdl] VBackend: Initialize m_pausedEffect and m_fastBlur.
David Korth [Wed, 19 Aug 2015 01:28:02 +0000 (21:28 -0400)] 
[gens-sdl] VBackend: Initialize m_pausedEffect and m_fastBlur.

MSVC initializes "uninitialized" variables to 0xCC, so these ended
up getting "enabled" by default on startup.

4 years ago[libgens] cpuflags.c: Moved the CPUID check into an inline function in cpuflags_x86.h.
David Korth [Wed, 19 Aug 2015 01:18:21 +0000 (21:18 -0400)] 
[libgens] cpuflags.c: Moved the CPUID check into an inline function in cpuflags_x86.h.

This function always returns 1 on amd64, and returns 0 or 1 on i386
depending on the result of the test.

4 years ago[libgens] macros/common.h: New macro FORCE_INLINE_DEBUG.
David Korth [Wed, 19 Aug 2015 01:16:45 +0000 (21:16 -0400)] 
[libgens] macros/common.h: New macro FORCE_INLINE_DEBUG.

This macro forces inlining in both debug and release builds,
whereas FORCE_INLINE only forces inlining in release builds.

4 years ago[libgens] cpuflags.c: Added %edx to the clobber list.
David Korth [Wed, 19 Aug 2015 01:09:47 +0000 (21:09 -0400)] 
[libgens] cpuflags.c: Added %edx to the clobber list.

4 years ago[libgens] cpuflags_x86.h: Split the internal x86 CPU flags out of cpuflags.c.
David Korth [Wed, 19 Aug 2015 01:08:45 +0000 (21:08 -0400)] 
[libgens] cpuflags_x86.h: Split the internal x86 CPU flags out of cpuflags.c.

4 years ago[libgens] cpuflags.c: Added some more CPU flags.
David Korth [Wed, 19 Aug 2015 01:06:51 +0000 (21:06 -0400)] 
[libgens] cpuflags.c: Added some more CPU flags.

These flags weren't present in MDP v1.0, so they'll need to be added
to the next revision.

Renamed a bunch of the internal CPUFLAG_IA32_* macros to match the
Intel Software Manual.

- Test this on a system with the new CPU flags.
- Check for XSAVE correctly. We can't read from cr0/cr4 in user mode.

4 years ago[doc] TODO.txt: Qt4 UI can be enabled usind -DENABLE_GENS_QT4=1.
David Korth [Sun, 16 Aug 2015 17:30:41 +0000 (13:30 -0400)] 
[doc] TODO.txt: Qt4 UI can be enabled usind -DENABLE_GENS_QT4=1.

4 years ago[libgens] FastBlur: Added 2-fb versions of the MMX code.
David Korth [Sun, 16 Aug 2015 17:20:48 +0000 (13:20 -0400)] 
[libgens] FastBlur: Added 2-fb versions of the MMX code.

- Do more pixels at once, and/or use SSE2?
- Does MMX actually improve performance that much?

4 years ago[libgens] FastBlur: 1-fb code should be before 2-fb code.
David Korth [Sun, 16 Aug 2015 17:14:27 +0000 (13:14 -0400)] 
[libgens] FastBlur: 1-fb code should be before 2-fb code.

This matches PausedEffect.

4 years ago[libgens] FastBlur: Added a new T_DoFastBlur() implementation that avoids memcpy().
David Korth [Sun, 16 Aug 2015 17:11:22 +0000 (13:11 -0400)] 
[libgens] FastBlur: Added a new T_DoFastBlur() implementation that avoids memcpy().

This version reads pixels from one framebuffer and writes them to another.

The two-framebuffer DoFastBlur() function now calls this version
of T_DoFastBlur(), which makes the memcpy() unnecessary.

TODO: Add two-framebuffer versions of the MMX code.

4 years ago[libgens] FastBlur.cpp: Fix pixel count and starting offset.
David Korth [Sun, 16 Aug 2015 17:02:20 +0000 (13:02 -0400)] 
[libgens] FastBlur.cpp: Fix pixel count and starting offset.

MdFb::fb16() and MdFb::fb32() return pointers to the first visible pixel
in the framebuffer. Hence, we don't need to adjust the mdScreen pointer
to compensate for the 8px left border. The adjustment caused the first
8 pixels of the framebuffer to not get blurred. (This probably isn't too
noticeable, but it's still an error.)

Removed the hard-coded pixel count and changed it to a parameter.

Added asserts to the MMX code to ensure that pxCount is a multiple of
4 (15/16-bit) or 2 (32-bit).

4 years ago[gens-sdl] Split the pause and screenshot code into separate functions.
David Korth [Sun, 16 Aug 2015 16:42:32 +0000 (12:42 -0400)] 
[gens-sdl] Split the pause and screenshot code into separate functions.

4 years ago[gens-sdl] Split stretch mode code into doStretchMode() and show an OSD message.
David Korth [Sun, 16 Aug 2015 16:40:10 +0000 (12:40 -0400)] 
[gens-sdl] Split stretch mode code into doStretchMode() and show an OSD message.

4 years ago[gens-sdl] GLBackend: Split effect code into separate functions.
David Korth [Sun, 16 Aug 2015 15:28:07 +0000 (11:28 -0400)] 
[gens-sdl] GLBackend: Split effect code into separate functions.

Three new functions:
- applySoftwareEffects(): Apply effects to the internal framebuffer.
- startShaderEffects(): Enable shaders.
- stopShaderEffects(): Disable shaders.

The shader functions are currently stubs.

TODO: Port the shader code to gens-sdl.

4 years ago[gens-sdl] VBackend: Implemented the Fast Blur effect.
David Korth [Sun, 16 Aug 2015 15:14:42 +0000 (11:14 -0400)] 
[gens-sdl] VBackend: Implemented the Fast Blur effect.

If both Fast Blur and Paused Effect are active, Fast Blur is applied
before the Paused Effect.

gens-sdl.cpp: Added a hotkey for Fast Blur (F9), along with an
OSD message.

4 years ago[libgens] FastBlurEffect: Updated to not require the Vdp object.
David Korth [Sun, 16 Aug 2015 15:08:05 +0000 (11:08 -0400)] 
[libgens] FastBlurEffect: Updated to not require the Vdp object.

Similar to PausedEffect. Note that FastBlurEffect doesn't actually support
copying from source to destination while applying the effect, so we're
actually doing a memcpy() first. The effect is applied after the memcpy()
is completed.

TODO: Implement a version that doesn't require memcpy().

4 years ago[libgens] MdFb: Allocate an extra 16 pixels to prevent overruns.
David Korth [Sun, 16 Aug 2015 14:59:22 +0000 (10:59 -0400)] 
[libgens] MdFb: Allocate an extra 16 pixels to prevent overruns.

fb16() and fb32() return the first pixel; however, this is actually
8 pixels into the buffer, so adding pxPitch after the last line
will overrun the buffer. The extra 16 pixels should help prevent that.

TODO: Maybe it should only be 8?

4 years ago[libgens] FastBlur: Moved the templated and internal functions into a private class.
David Korth [Sun, 16 Aug 2015 14:53:44 +0000 (10:53 -0400)] 
[libgens] FastBlur: Moved the templated and internal functions into a private class.

Also the MMX constants.

4 years ago[libgens] PausedEffect: Disable the copy and assign constructors.
David Korth [Sun, 16 Aug 2015 14:50:21 +0000 (10:50 -0400)] 
[libgens] PausedEffect: Disable the copy and assign constructors.

4 years ago[libgens] PausedEffect.hpp: Don't #define RESTRICT if it's already defined.
David Korth [Sun, 16 Aug 2015 14:48:45 +0000 (10:48 -0400)] 
[libgens] PausedEffect.hpp: Don't #define RESTRICT if it's already defined.

4 years ago[libgens] PausedEffect: TODO: Keep the LSB?
David Korth [Sun, 16 Aug 2015 14:46:21 +0000 (10:46 -0400)] 
[libgens] PausedEffect: TODO: Keep the LSB?

4 years ago[libgens] PausedEffect: Improved precision for 16-bit and 32-bit color.
David Korth [Sun, 16 Aug 2015 14:42:58 +0000 (10:42 -0400)] 
[libgens] PausedEffect: Improved precision for 16-bit and 32-bit color.

Process the RGB values as if they're always 32-bit color,
then shift them back to the required positions.

Reduced the template parameters from 7 to 3. Instead of specifying
mask and shift, only bits are specified; mask and shift are calculated
within the function. (This should be done at compile time.)

4 years ago[libgens] PausedEffect: Moved the templated functions into a private class.
David Korth [Sun, 16 Aug 2015 14:20:20 +0000 (10:20 -0400)] 
[libgens] PausedEffect: Moved the templated functions into a private class.

4 years ago[gens-sdl] VBackend: Implemented the paused effect.
David Korth [Sun, 16 Aug 2015 14:15:27 +0000 (10:15 -0400)] 
[gens-sdl] VBackend: Implemented the paused effect.

VBackend::setPausedEffect() immediately enables the effect.
VBackend does not maintain the emulator's 'paused' state, so the
caller should make sure it only sets it if both the emulator is
paused and the user enabled the paused effect.

VBackend now has a "force FB dirty" flag that forces a reupload
of the framebuffer. This might not be necessary if shaders are
in use for e.g. Fast Blur.

VBackend also has an internal framebuffer that's used to apply
effects. This internal framebuffer is only allocated if it's
needed for an effect.

gens-sdl.cpp: Set the paused effect when emulation is paused.

4 years ago[libgens] PausedEffect.hpp: Added '__restrict' for MSVC builds.
David Korth [Sun, 16 Aug 2015 14:01:54 +0000 (10:01 -0400)] 
[libgens] PausedEffect.hpp: Added '__restrict' for MSVC builds.

4 years ago[libgens] PausedEffect: Updated to not require the Vdp object.
David Korth [Sun, 16 Aug 2015 13:59:13 +0000 (09:59 -0400)] 
[libgens] PausedEffect: Updated to not require the Vdp object.

There are now two versions of DoPausedEffect():
- One argument: Applies paused effect to a single MdFb.
- Two argument: Copies mdScreen to outScreen while applying the paused effect.

[gens-qt4] Updated VBackend for the DoPausedEfect() changes.
This fixes the Paused Effect on systems where shaders are unavailable.

TODO: I'm probably going to remove the shader version later.
More specifically, I won't port it to gens-sdl's backend, which will
eventually be used for gens-qt4 as well. It's only rendered for one
frame, whereas Fast Blur is rendered for every frame while emulation
is running.

4 years ago[doc] TODO.txt: '--tsaware' is added to linker flags in MinGW builds.
David Korth [Sun, 16 Aug 2015 13:40:43 +0000 (09:40 -0400)] 
[doc] TODO.txt: '--tsaware' is added to linker flags in MinGW builds.

4 years ago[doc] TODO.txt: Windows 8.1+ version number is now checked correctly.
David Korth [Sun, 16 Aug 2015 13:40:12 +0000 (09:40 -0400)] 
[doc] TODO.txt: Windows 8.1+ version number is now checked correctly.

4 years ago[doc] TODO.txt: OSD aspect ratio constraint and preview image are done.
David Korth [Sun, 16 Aug 2015 13:39:40 +0000 (09:39 -0400)] 
[doc] TODO.txt: OSD aspect ratio constraint and preview image are done.

4 years ago[libgens] RomPrivate::DetectSystem(): Marked pico_magic[] as static.
David Korth [Sun, 16 Aug 2015 13:38:21 +0000 (09:38 -0400)] 
[libgens] RomPrivate::DetectSystem(): Marked pico_magic[] as static.

4 years ago[doc] TODO.txt: CMAKE_CREATE_CONSOLE_EXE and CMAKE_CREATE_WIN32_EXE are set.
David Korth [Sun, 16 Aug 2015 13:37:41 +0000 (09:37 -0400)] 

4 years ago[doc] TODO.txt: clock_gettime() and iconv() library checks are done.
David Korth [Sun, 16 Aug 2015 13:37:01 +0000 (09:37 -0400)] 
[doc] TODO.txt: clock_gettime() and iconv() library checks are done.

4 years ago[libgenstext] Link to ${ICONV_LIBRARY} if set; don't set it if iconv() is in libc.
David Korth [Sun, 16 Aug 2015 13:36:09 +0000 (09:36 -0400)] 
[libgenstext] Link to ${ICONV_LIBRARY} if set; don't set it if iconv() is in libc.

libc is always linked in regardless, so we don't need to explicitly
specify it. Also, don't specify "-l" in the library name for libiconv.

4 years ago[doc] TODO.txt: LFS and libcompat are done.
David Korth [Sun, 16 Aug 2015 13:33:07 +0000 (09:33 -0400)] 
[doc] TODO.txt: LFS and libcompat are done.

4 years ago[doc] TODO.txt: Preliminary TODO list.
David Korth [Sun, 16 Aug 2015 13:32:00 +0000 (09:32 -0400)] 
[doc] TODO.txt: Preliminary TODO list.

Some of the entries on here are old and should be removed,
and some should be added.

4 years ago[starscream] Moved the jump table into the .rodata section.
David Korth [Sun, 16 Aug 2015 06:54:36 +0000 (02:54 -0400)] 
[starscream] Moved the jump table into the .rodata section.

There's no reason for the jump table to be writable at runtime.

Copied macros from mdZ80 to ensure that .rodata is renamed to .rdata
on Windows as per convention.

4 years ago[starscream] Added colons after several labels.
David Korth [Sun, 16 Aug 2015 06:47:03 +0000 (02:47 -0400)] 
[starscream] Added colons after several labels.

This eliminates a bunch of nasm warnings that looked like this:
libgens/starscream/main68k.asm:142: warning: label alone on a line without a colon might be in error

Two warnings are left, and I think they might be false positives due to
starscream's generated jump table:
- libgens/starscream/main68k.asm:141706
- libgens/starscream/sub68k.asm:141335

4 years agoFixed a bunch of warnings flagged by cppcheck-1.69.
David Korth [Sun, 16 Aug 2015 06:38:48 +0000 (02:38 -0400)] 
Fixed a bunch of warnings flagged by cppcheck-1.69.

- OsdGLPrivate::reallocOsdTexture(): Added extra parentheses to the
  image decoder to ensure proper order of operations.

- EmuPico::T_execLine<>(): Removed bufL and bufR. These were used
  in EmuMD for YM2612 emulation. I'll eventually rmeove it entirely
  after switching to Blip_Buffer, but that will take a while.
- SRam: Use uint8_t values for m_on and m_write. This eliminates
  unnecessary boolean casting. Added assertions to ensure that
  these variables are only 0 or 1.

The SRam change should eliminate a ton of warnings regarding implicit
bool to int casting and vice-versa.

gcc-5.2.0 warnings before this fix:
In file included from libgens/Save/SRam.cpp:24:0:
libgens/Save/SRam.hpp: In member function ‘uint8_t LibGens::SRam::zomgReadCtrl() const’:
libgens/Save/SRam.hpp:199:19: warning: suggest parentheses around operand of ‘!’ or change ‘|’ to ‘||’ or ‘!’ to ‘~’ [-Wparentheses]
  { return (!!m_on | (!m_write << 1)); }

I could've sworn MSVC 2010 also had similar warnings, but I couldn't
get them to show up in either the debug or release builds...

4 years ago[libzomg] Metadata_unix.cpp: #include "libcompat/reentrant.h"; remove getpwuid()...
David Korth [Sun, 16 Aug 2015 06:28:49 +0000 (02:28 -0400)] 
[libzomg] Metadata_unix.cpp: #include "libcompat/reentrant.h"; remove getpwuid() path.

This should have been done in 91c11c468fa4314a94a6265033893f69d189543d.
I updated Metadata.cpp, but forgot about Metadata_unix.cpp.

Commit 91c11c468fa4314a94a6265033893f69d189543d was:
[libcompat] reentrant.h: Added a placeholder for HAVE_GETPWUID_R.

This error was found using cppcheck-1.69.

4 years ago[gens-sdl] Config.cpp: #include "libcompat/reentrant.h"; remove getpwuid() path.
David Korth [Sun, 16 Aug 2015 06:25:39 +0000 (02:25 -0400)] 
[gens-sdl] Config.cpp: #include "libcompat/reentrant.h"; remove getpwuid() path.

libcompat should implement a getpwuid_r() implementation for systems
that don't have it. Currently, it doesn't, since I don't know of any
current Unix or Linux systems that don't have it. If I encounter one,
libcompat/reentrant.h will #error out immediately, so I can implement
getpwuid_r() at that time.

4 years ago[libgens] SRam.cpp: Added notes about RomCartridgeMD handling write-protection and...
David Korth [Sun, 16 Aug 2015 06:14:49 +0000 (02:14 -0400)] 
[libgens] SRam.cpp: Added notes about RomCartridgeMD handling write-protection and SRAM enabled bits.

These should probably be moved to SRam later.

4 years ago[libgens] SRam::zomgReadCtrl(): Fixed the bit position of m_write.
David Korth [Sun, 16 Aug 2015 06:12:27 +0000 (02:12 -0400)] 
[libgens] SRam::zomgReadCtrl(): Fixed the bit position of m_write.

Should be bit 1, not bit 2.

Interestingly, this probably won't cause any issues in older versions
because SRAM is usually write-protected when it's not explicitly being
written to.

4 years ago[glew] Updated the internal GLEW to version 1.13.0.
David Korth [Sun, 16 Aug 2015 01:04:06 +0000 (21:04 -0400)] 
[glew] Updated the internal GLEW to version 1.13.0.

4 years ago[libpng] Updated the internal libpng to version 1.6.18.
David Korth [Sun, 16 Aug 2015 00:56:10 +0000 (20:56 -0400)] 
[libpng] Updated the internal libpng to version 1.6.18.

4 years ago[libgens] macros/common.h: Removed utf8_str.
David Korth [Sun, 16 Aug 2015 00:37:26 +0000 (20:37 -0400)] 
[libgens] macros/common.h: Removed utf8_str.

This macro was originally added 5 years ago in commit
83b1f9cb9c77029cc97bfb6e7c3a468f3327d0e5, but it turns out it's not
really necessary. Among other things, most modern OSes use UTF-8
strings, and C++ 2011 says 8-bit strings should be encoded using
UTF-8. The only OS that doesn't use UTF-8, Windows, is handled
using either Qt or the Win32 Unicode Translation Layer in libcompat.

This typedef just gets in the way of a lot of things.

Other changes:
- gqt4_main.hpp: Moved gens_main() into extern "C".

4 years ago[gens-qt4] translations/*.ts: Updated the translation files using lupdate.sh.
David Korth [Sat, 15 Aug 2015 23:58:06 +0000 (19:58 -0400)] 
[gens-qt4] translations/*.ts: Updated the translation files using lupdate.sh.

GeneralConfigWindow: Need to add a lot of translation comments here.
GensWindow: Also here for menu shortcuts. (NOTE: I don't think the
menu shortcuts in the QActions are used anyway...)

Translation-specific notes:
- fr, fr_CA: Changed "Megadrive" to "Mega Drive".
- ja: Added a few accelerator keys that match the base translation.

4 years ago[gens-qt4] GensWindow.ui: Disable translations for the SoundTest menu.
David Korth [Sat, 15 Aug 2015 23:46:20 +0000 (19:46 -0400)] 
[gens-qt4] GensWindow.ui: Disable translations for the SoundTest menu.

This menu will probably be moved to GeneralConfigWindow later.

4 years ago[gens-qt4] GensWindow.ui: Prefix the class name with the GensQt4 namespace.
David Korth [Sat, 15 Aug 2015 23:22:50 +0000 (19:22 -0400)] 
[gens-qt4] GensWindow.ui: Prefix the class name with the GensQt4 namespace.

This ensures that the UI class is in the GensQt4 namespace, and it's
also needed to ensure the proper context is used for UI translations.

4 years ago[gens-qt4] AboutDialog: Fixed the position of a translator comment.
David Korth [Sat, 15 Aug 2015 23:12:49 +0000 (19:12 -0400)] 
[gens-qt4] AboutDialog: Fixed the position of a translator comment.

There can't be any statements in between the translator comment and the
tr() invocation. That includes the declaration of the 'timing' object.

4 years ago[gens-qt4] AboutDialog: Use W32U_IsUnicode() instead of GetModuleHandleW().
David Korth [Sat, 15 Aug 2015 23:00:02 +0000 (19:00 -0400)] 
[gens-qt4] AboutDialog: Use W32U_IsUnicode() instead of GetModuleHandleW().

CMakeLists.txt: Added libcompat to TARGET_LINK_LIBRARIES().

4 years ago[libgens] DcZip.cpp: Fixed a typo in the W32U comment.
David Korth [Sat, 15 Aug 2015 22:58:16 +0000 (18:58 -0400)] 
[libgens] DcZip.cpp: Fixed a typo in the W32U comment.

Somehow a stray #ifdef _WIN32 overwrote the last two characters
of the comment.

4 years ago[libcompat] reentrant.h: Adjusted the localtime_r() implementation a bit.
David Korth [Sat, 15 Aug 2015 22:52:29 +0000 (18:52 -0400)] 
[libcompat] reentrant.h: Adjusted the localtime_r() implementation a bit.

- Use struct assignment instead of memcpy().

- Return NULL if _Tm is NULL. This is an unlikely condition, so we
  don't check for _Tm == NULL before calling localtime().

4 years ago[gens-qt4] Fixed some errors cauesd by merging gens-sdl-basic-frontend.
David Korth [Sat, 15 Aug 2015 22:42:16 +0000 (18:42 -0400)] 
[gens-qt4] Fixed some errors cauesd by merging gens-sdl-basic-frontend.

libgens/MD/SysVersion.hpp was moved to libgens/EmuContext/SysVersion.hpp.

4 years agoMerge branch 'gens-sdl-basic-frontend'
David Korth [Sat, 15 Aug 2015 22:30:50 +0000 (18:30 -0400)] 
Merge branch 'gens-sdl-basic-frontend'

There are now CMake options to specify which UIs to compile, and mcd_pcm
compiles with MSVC, so we might as well merge everything back to master.

gens-sdl is not quite done, though. Among other things, I need to revert
some DMA stuff that broke "The Adventures of Batman & Robin" and I need
to add Pico tablet support.

4 years ago[tools] mcd_pcm.c: Rearranged variables to compile with MSVC 2010. gens-sdl-basic-frontend github/gens-sdl-basic-frontend
David Korth [Sat, 15 Aug 2015 22:28:57 +0000 (18:28 -0400)] 
[tools] mcd_pcm.c: Rearranged variables to compile with MSVC 2010.

MSVC 2010 doesn't support C99, so it requires all variables to be
declared before any statements or function calls.

4 years agomsvc-c99-compat.h: Clarify that MSVC 2013 is 12.0.
David Korth [Sat, 15 Aug 2015 22:20:43 +0000 (18:20 -0400)] 
msvc-c99-compat.h: Clarify that MSVC 2013 is 12.0.

4 years agoSplit MSVC-specific C99 compatibility macros from c++11-compat.h into msvc-c99-compat.h.
David Korth [Sat, 15 Aug 2015 22:15:51 +0000 (18:15 -0400)] 
Split MSVC-specific C99 compatibility macros from c++11-compat.h into msvc-c99-compat.h.

These macros are for functions that exist in MSVCRT, but have a different
name compared to POSIX or C99, e.g. _snprintf() instead of snprintf().

Moved strtoll() and strtoull() from W32U_libc.h to msvc-c99-compat.h.
W32U is for functions that need character set conversion, not for
functions that simply have a different name.