Options used by the core emulator were set with global variables. This
moves all of the options used by the core emulator into a new struct,
shared by all 3 frontends.
Add the Catch2 headers to third_party/include/catch2.
Add Catch.cmake and CatchAddTests.cmake to cmake/.
Add unit tests src/wx/tests/strutils.cpp using Catch2 to test
src/wx/strutils.cpp.
Make some code changes to strutils.cpp to make the tests pass.
See src/wx/tests/CMakeLists.txt for how to set up unit test files; they
plug into the normal CTest mechanism in cmake.
The test binaries are written to the tests/ subdirectory of the build
directory.
Building the tests and enabling the CTest support can be turned off by
passing -DBUILD_TESTING=OFF to cmake, the default is ON, this is the
standard mechanism.
Start running ctest on travis and appveyor.
Move stb to third_party/include where Catch2 is now as well.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
We have some issues when trying to open files on Windows that contains
characters not included in the current codepage. Using `fopen` fails
when that happens.
One example is using the `pt_BR` codepage and then using a name with
japanese chars for the battery file.
The games and BIOS work since they use `blargg_open`. It converts a
`const char *` to `const wchat_t *` and uses `_wfopen` for windows.
(doing a multibyte to widechar conversion)
Since we want to avoid doing many code changes on our cores, we need
some `util*` functions for the matter.
Replace `mb_fn_str` by UTF-8 strings.
Replace all occurrences of `fopen` for `utilOpenFile` on GBA core.
Replace all occurrences of `fopen` for `utilOpenFile` on GBA e-reader.
Adjust e-readers calls on wx frontend.
Replace all occurrences of `fopen` for `utilOpenFile` on Patcher files.
Always apply UTF-8 when dealing with path strings.
On our wx frontend we should always send UTF-8 `char *` to our cores
functions. This way we can have consistency when dealing with them for
each platform.
On Windows, we will convert all multibyte to wide chars and use proper
functions for I/O operation.
Create function to deal with unicode calls of `gzopen`.
We use `gzopen_w` (`zlib>=1.27`).
Replace all occurrences of `fopen` for `utilOpenFile` on Config Manager.
Replace all occurrences of `fopen` for `utilOpenFile` on Cheat files.
Use proper functions for unicode on GB core.
Use function instead of macro for `UTF8()`.
Use `nullptr` instead of `NULL`.
Print wide char strings on status bar.
Limit the utilLoad() function in src/Util.cpp to 32 MiB.
This function loads a file from disk and returns a memory image of it.
This is only used to load ROMs currently.
Check for the APPDATA environment variable if there is no LOCALAPPDATA
environment variable for things like reading the config file.
Fix#407.
Signed-off-by: Rafael Kitover <rkitover@gmail.com>
* Add XDG Base Dir Spec for other Unix alike platform.
* Add XDG Base Dir support for the fallback on SDL port.
* Add migration for Unix configuration file.
We migrate from 'vbam.conf' to 'vbam.ini' automatically.
* Refactor code for portability of dir creation functions.
* Fix for MacOS compilation directive.