Interface: Posix: Switched to SDL2 and Meson

This commit is contained in:
Parakoopa 2021-03-05 10:28:28 +01:00
parent f62318ced4
commit 34b4fc3d72
8 changed files with 279 additions and 521 deletions

View File

@ -1,219 +0,0 @@
AM_CFLAGS =
AM_CPPFLAGS = -I$(top_srcdir)/../../../src/ -I$(top_srcdir)/../../../src/libretro-common/include
AM_CPPFLAGS += $(SDL_CFLAGS) $(GLIB_CFLAGS) $(GTHREAD_CFLAGS) $(LIBAGG_CFLAGS) $(LIBSOUNDTOUCH_CFLAGS)
SUBDIRS = $(PO_DIR)
lib_LTLIBRARIES = libdesmume.la
libdesmume_la_LDFLAGS = -module -avoid-version -shared -rdynamic $(INTLLIBS)
libdesmume_la_LIBADD = \
$(SDL_LIBS) $(GTHREAD_LIBS) $(LIBAGG_LIBS) \
$(LIBSOUNDTOUCH_LIBS) $(GLIB_LIBS)
libdesmume_la_SOURCES = interface.cpp draw_sdl_window.cpp interface.h
libdesmume_la_SOURCES += \
../../armcpu.cpp ../../armcpu.h \
../../arm_instructions.cpp \
../../agg2d.h ../../agg2d.inl \
../../bios.cpp ../../bios.h ../../bits.h ../../cp15.cpp ../../cp15.h \
../../commandline.h ../../commandline.cpp \
../../common.cpp ../../common.h \
../../debug.cpp ../../debug.h \
../../driver.cpp ../../driver.h \
../../Database.cpp ../../Database.h \
../../emufile.h ../../emufile.cpp ../../encrypt.h ../../encrypt.cpp ../../FIFO.cpp ../../FIFO.h \
../../firmware.cpp ../../firmware.h ../../GPU.cpp ../../GPU.h \
../../GPU_osd.h \
../../instructions.h \
../../mem.h ../../mc.cpp ../../mc.h \
../../path.cpp ../../path.h \
../../readwrite.cpp ../../readwrite.h \
../../wifi.cpp ../../wifi.h \
../../mic.h \
../../MMU.cpp ../../MMU.h ../../MMU_timing.h ../../NDSSystem.cpp ../../NDSSystem.h ../../registers.h \
../../OGLRender.h ../../OGLRender_3_2.h \
../../ROMReader.cpp ../../ROMReader.h \
../../render3D.cpp ../../render3D.h \
../../rtc.cpp ../../rtc.h \
../../saves.cpp ../../saves.h \
../../slot1.cpp ../../slot1.h \
../../slot2.cpp ../../slot2.h \
../../SPU.cpp ../../SPU.h \
../../matrix.cpp ../../matrix.h \
../../gfx3d.cpp ../../gfx3d.h \
../../thumb_instructions.cpp ../../types.h \
../../movie.cpp ../../movie.h \
../../PACKED.h ../../PACKED_END.h \
../../frontend/modules/Disassembler.cpp ../../frontend/modules/Disassembler.h \
../../utils/advanscene.cpp ../../utils/advanscene.h \
../../utils/datetime.cpp ../../utils/datetime.h \
../../utils/guid.cpp ../../utils/guid.h \
../../utils/emufat.cpp ../../utils/emufat.h utils/emufat_types.h \
../../utils/fsnitro.cpp ../../utils/fsnitro.h \
../../utils/xstring.cpp ../../utils/xstring.h \
../../utils/decrypt/crc.cpp ../../utils/decrypt/crc.h ../../utils/decrypt/decrypt.cpp \
../../utils/decrypt/decrypt.h ../../utils/decrypt/header.cpp ../../utils/decrypt/header.h \
../../utils/task.cpp ../../utils/task.h \
../../utils/vfat.h ../../utils/vfat.cpp \
../../utils/dlditool.cpp \
../../utils/libfat/bit_ops.h \
../../utils/libfat/cache.cpp \
../../utils/libfat/cache.h \
../../utils/libfat/common.h \
../../utils/libfat/directory.cpp \
../../utils/libfat/directory.h \
../../utils/libfat/disc.cpp \
../../utils/libfat/disc.h \
../../utils/libfat/disc_io.h \
../../utils/libfat/fat.h \
../../utils/libfat/fatdir.cpp \
../../utils/libfat/fatdir.h \
../../utils/libfat/fatfile.cpp \
../../utils/libfat/fatfile.h \
../../utils/libfat/filetime.cpp \
../../utils/libfat/filetime.h \
../../utils/libfat/file_allocation_table.cpp \
../../utils/libfat/file_allocation_table.h \
../../utils/libfat/libfat.cpp \
../../utils/libfat/libfat_pc.h \
../../utils/libfat/libfat_public_api.cpp \
../../utils/libfat/libfat_public_api.h \
../../utils/libfat/lock.cpp \
../../utils/libfat/lock.h \
../../utils/libfat/mem_allocate.h \
../../utils/libfat/partition.cpp \
../../utils/libfat/partition.h \
../../utils/tinyxml/tinystr.cpp \
../../utils/tinyxml/tinystr.h \
../../utils/tinyxml/tinyxml.cpp \
../../utils/tinyxml/tinyxml.h \
../../utils/tinyxml/tinyxmlerror.cpp \
../../utils/tinyxml/tinyxmlparser.cpp \
../../utils/glcorearb.h \
../../utils/colorspacehandler/colorspacehandler.cpp ../../utils/colorspacehandler/colorspacehandler.h \
../../addons/slot2_auto.cpp ../../addons/slot2_mpcf.cpp ../../addons/slot2_paddle.cpp ../../addons/slot2_gbagame.cpp ../../addons/slot2_none.cpp ../../addons/slot2_rumblepak.cpp ../../addons/slot2_guitarGrip.cpp ../../addons/slot2_expMemory.cpp ../../addons/slot2_piano.cpp ../../addons/slot2_passme.cpp ../../addons/slot1_none.cpp ../../addons/slot1_r4.cpp ../../addons/slot1_retail_nand.cpp ../../addons/slot1_retail_auto.cpp ../../addons/slot1_retail_mcrom.cpp ../../addons/slot1_retail_mcrom_debug.cpp ../../addons/slot1comp_mc.cpp ../../addons/slot1comp_mc.h ../../addons/slot1comp_rom.h ../../addons/slot1comp_rom.cpp ../../addons/slot1comp_protocol.h ../../addons/slot1comp_protocol.cpp \
../../cheatSystem.cpp ../../cheatSystem.h \
../../texcache.cpp ../../texcache.h ../../rasterize.cpp ../../rasterize.h \
../../metaspu/metaspu.cpp ../../metaspu/metaspu.h \
../../filter/2xsai.cpp ../../filter/bilinear.cpp ../../filter/deposterize.cpp ../../filter/epx.cpp ../../filter/filter.h \
../../filter/hq2x.cpp ../../filter/hq2x.h \
../../filter/hq3x.cpp ../../filter/hq3x.dat \
../../filter/hq4x.cpp ../../filter/hq4x.dat \
../../filter/interp.h ../../filter/lq2x.cpp ../../filter/lq2x.h ../../filter/scanline.cpp \
../../filter/videofilter.cpp ../../filter/videofilter.h \
../../filter/xbrz.cpp ../../filter/xbrz.h \
../../version.cpp ../../version.h \
../../libretro-common/compat/compat_getopt.c \
../../libretro-common/file/file_path.c \
../../libretro-common/compat/compat_strl.c \
../../libretro-common/features/features_cpu.c \
../../libretro-common/file/retro_dirent.c \
../../libretro-common/file/retro_stat.c \
../../libretro-common/rthreads/async_job.c \
../../libretro-common/rthreads/rsemaphore.c \
../../libretro-common/rthreads/rthreads.c \
../../libretro-common/encodings/encoding_utf.c
if HAVE_JIT
libdesmume_la_SOURCES += \
../../arm_jit.cpp ../../arm_jit.h ../../instruction_attributes.h \
../../utils/AsmJit/AsmJit.h \
../../utils/AsmJit/Config.h \
../../utils/AsmJit/core.h \
../../utils/AsmJit/x86.h \
../../utils/AsmJit/core/apibegin.h \
../../utils/AsmJit/core/apiend.h \
../../utils/AsmJit/core/assembler.cpp \
../../utils/AsmJit/core/assembler.h \
../../utils/AsmJit/core/assert.cpp \
../../utils/AsmJit/core/assert.h \
../../utils/AsmJit/core/buffer.cpp \
../../utils/AsmJit/core/buffer.h \
../../utils/AsmJit/core/build.h \
../../utils/AsmJit/core/compiler.cpp \
../../utils/AsmJit/core/compiler.h \
../../utils/AsmJit/core/compilercontext.cpp \
../../utils/AsmJit/core/compilercontext.h \
../../utils/AsmJit/core/compilerfunc.cpp \
../../utils/AsmJit/core/compilerfunc.h \
../../utils/AsmJit/core/compileritem.cpp \
../../utils/AsmJit/core/compileritem.h \
../../utils/AsmJit/core/context.cpp \
../../utils/AsmJit/core/context.h \
../../utils/AsmJit/core/cpuinfo.cpp \
../../utils/AsmJit/core/cpuinfo.h \
../../utils/AsmJit/core/defs.cpp \
../../utils/AsmJit/core/defs.h \
../../utils/AsmJit/core/func.cpp \
../../utils/AsmJit/core/func.h \
../../utils/AsmJit/core/intutil.h \
../../utils/AsmJit/core/lock.h \
../../utils/AsmJit/core/logger.cpp \
../../utils/AsmJit/core/logger.h \
../../utils/AsmJit/core/memorymanager.cpp \
../../utils/AsmJit/core/memorymanager.h \
../../utils/AsmJit/core/memorymarker.cpp \
../../utils/AsmJit/core/memorymarker.h \
../../utils/AsmJit/core/operand.cpp \
../../utils/AsmJit/core/operand.h \
../../utils/AsmJit/core/podvector.h \
../../utils/AsmJit/core/stringbuilder.cpp \
../../utils/AsmJit/core/stringbuilder.h \
../../utils/AsmJit/core/stringutil.cpp \
../../utils/AsmJit/core/stringutil.h \
../../utils/AsmJit/core/virtualmemory.cpp \
../../utils/AsmJit/core/virtualmemory.h \
../../utils/AsmJit/core/zonememory.cpp \
../../utils/AsmJit/core/zonememory.h \
../../utils/AsmJit/x86/x86assembler.cpp \
../../utils/AsmJit/x86/x86assembler.h \
../../utils/AsmJit/x86/x86compiler.cpp \
../../utils/AsmJit/x86/x86compiler.h \
../../utils/AsmJit/x86/x86compilercontext.cpp \
../../utils/AsmJit/x86/x86compilercontext.h \
../../utils/AsmJit/x86/x86compilerfunc.cpp \
../../utils/AsmJit/x86/x86compilerfunc.h \
../../utils/AsmJit/x86/x86compileritem.cpp \
../../utils/AsmJit/x86/x86compileritem.h \
../../utils/AsmJit/x86/x86cpuinfo.cpp \
../../utils/AsmJit/x86/x86cpuinfo.h \
../../utils/AsmJit/x86/x86defs.cpp \
../../utils/AsmJit/x86/x86defs.h \
../../utils/AsmJit/x86/x86func.cpp \
../../utils/AsmJit/x86/x86func.h \
../../utils/AsmJit/x86/x86operand.cpp \
../../utils/AsmJit/x86/x86operand.h \
../../utils/AsmJit/x86/x86util.cpp \
../../utils/AsmJit/x86/x86util.h
endif
#libdesmume_la_SOURCES += shared/desmume_config.cpp shared/desmume_config.h
if HAVE_GL
libdesmume_la_SOURCES += ../../OGLRender.cpp ../../OGLRender_3_2.cpp
endif
libdesmume_la_SOURCES += ../posix/shared/sndsdl.cpp ../posix/shared/sndsdl.h
libdesmume_la_SOURCES += ../posix/shared/ctrlssdl.cpp ../posix/shared/ctrlssdl.h
if HAVE_OPENAL
libdesmume_la_SOURCES += ../posix/shared/mic_openal.cpp
else
libdesmume_la_SOURCES += ../../mic.cpp ../../mic.h
endif
if HAVE_LIBSOUNDTOUCH
libdesmume_la_SOURCES += ../../metaspu/SndOut.cpp ../../metaspu/SndOut.h ../../metaspu/Timestretcher.cpp
endif
if HAVE_LIBAGG
libdesmume_la_SOURCES += ../../frontend/modules/osd/agg/aggdraw.cpp ../../frontend/modules/osd/agg/aggdraw.h ../../frontend/modules/osd/agg/agg_osd.cpp
endif
if HAVE_GDB_STUB
libdesmume_la_SOURCES += ../../gdbstub/gdbstub.cpp
libdesmume_la_SOURCES += ../../gdbstub/gdbstub_internal.h
libdesmume_la_SOURCES += ../../gdbstub.h
endif

View File

@ -1,3 +0,0 @@
#!/bin/sh
autoreconf --install --force --verbose

View File

@ -1,249 +0,0 @@
dnl --- Package name is first argument to AC_INIT
dnl --- Release version is second argument to AC_INIT
AC_INIT(desmume, [git])
LT_INIT
dnl -- find host architecture for some os specific libraries
AC_CANONICAL_HOST
case $host in
*linux*) desmume_arch=linux;;
*mingw*) desmume_arch=windows;;
*darwin*) desmume_arch=linux;;
*bsd*) desmume_arch=linux;;
esac
AC_SUBST(desmume_arch)
AC_CONFIG_AUX_DIR([.])
AM_INIT_AUTOMAKE([subdir-objects tar-pax foreign])
dnl -- make sure we have a c++ compiler
AC_PROG_CXX
dnl -- check for endianess
AC_C_BIGENDIAN
COMMIT="unknown"
GIT=`which git 2>/dev/null`
if ( test -d ../../../../.git; ) && test "x${GIT}" != "x" -a -x "${GIT}" ; then
COMMIT=`$GIT rev-parse HEAD`
echo "$COMMIT"
fi
AC_DEFINE_UNQUOTED([GIT_COMMIT], ["$COMMIT"], [git commit hash])
AC_DEFINE([TARGET_INTERFACE])
dnl - Check for zlib
AC_CHECK_LIB(z, gzopen, [], [AC_MSG_ERROR([zlib was not found, we can't go further. Please install it or specify the location where it's installed.])])
dnl - Check for libpcap
AC_CHECK_LIB(pcap, main, [LIBS="$LIBS -lpcap"], [AC_MSG_ERROR([libpcap was not found, we can't go further. Please install it or specify the location where it's installed.])])
dnl - Check for zziplib
AC_CHECK_LIB(zzip, zzip_open, [
LIBS="-lzzip $LIBS"
AC_DEFINE([HAVE_LIBZZIP])
AC_MSG_CHECKING([[whether zzip use void * as second parameter]])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <zzip/lib.h>]], [[
void * v;
zzip_read(NULL, v, 0);]])],
AC_MSG_RESULT(yes),
AC_DEFINE([ZZIP_OLD_READ])
AC_MSG_RESULT(no))
])
dnl - Check for SDL
AC_PATH_PROGS(SDLCONFIG, [sdl-config sdl11-config])
if test ! "x$SDLCONFIG" = "x" ; then
SDL_CFLAGS=`$SDLCONFIG --cflags`
SDL_LIBS=`$SDLCONFIG --libs`
AC_SUBST(SDL_CFLAGS)
AC_SUBST(SDL_LIBS)
else
AC_MSG_ERROR([sdl is required to build desmume])
fi
dnl - Check for the OpenGL includes
AC_CHECK_HEADERS([GL/gl.h],
[AC_CHECK_HEADERS([GL/glu.h], [have_gl_h=yes LIBS="$LIBS -lGL -lGLU"], [have_gl_h=no])],
[have_gl_h=no])
if test "have_gl_h" = "no" ; then
AC_MSG_WARN([Building without GL support because of missing headers.])
fi
AM_CONDITIONAL([HAVE_GL], [test "${have_gl_h}" = "yes"])
dnl - make the usage of libagg for HUD rendering configurable
AC_ARG_ENABLE([hud],
[AC_HELP_STRING([--enable-hud], [Enable HUD rendering, requires libagg])],
[libagg=yes])
HAVE_OPENAL=no
dnl - openal support
AC_ARG_ENABLE(openal,
[AC_HELP_STRING(--enable-openal, enable experimental OpenAL microphone input)],
[openal=yes])
if test "x$openal" = "xyes" ; then
AC_CHECK_LIB([openal], [main],[
HAVE_OPENAL=yes
LIBS="$LIBS -lopenal"
])
fi
AM_CONDITIONAL([HAVE_OPENAL], [test "${HAVE_OPENAL}" = "yes"])
dnl - Looking for glib
FOUND_GLIB=no
GLIB_VER=2.8
PKG_CHECK_MODULES(GLIB,
glib-2.0 >= $GLIB_VER,
FOUND_GLIB=yes,
FOUND_GLIB=no)
dnl -- force lua disabled
HAVE_LUA=no
PKG_CHECK_MODULES(LIBAGG, libagg >= 2.4.0, FOUND_LIBAGG=yes, FOUND_LIBAGG=no)
AM_CONDITIONAL([HAVE_LIBAGG], [test "x$libagg" = "xyes" -a "${FOUND_LIBAGG}" = "yes"])
if test "x$libagg" = "xyes" ; then
if test "x$FOUND_LIBAGG" = "xyes" ; then
AC_SUBST(LIBAGG_CFLAGS)
AC_SUBST(LIBAGG_LIBS)
AC_DEFINE([HAVE_LIBAGG])
else
AC_MSG_ERROR([HUD rendering enabled, but libagg not found])
fi
fi
PKG_CHECK_MODULES(LIBSOUNDTOUCH, soundtouch >= 1.5.0, HAVE_LIBSOUNDTOUCH=yes, HAVE_LIBSOUNDTOUCH=no)
AC_SUBST(LIBSOUNDTOUCH_CFLAGS)
AC_SUBST(LIBSOUNDTOUCH_LIBS)
AM_CONDITIONAL([HAVE_LIBSOUNDTOUCH], [test "${HAVE_LIBSOUNDTOUCH}" = "yes"])
if test "x$HAVE_LIBSOUNDTOUCH" = "xyes"; then
AC_DEFINE([HAVE_LIBSOUNDTOUCH])
else
AC_MSG_WARN([SoundTouch library not found, pcsx2 resampler will be disabled])
fi
if test "x$HAVE_OPENAL" = "xno"; then
AC_DEFINE([FAKE_MIC])
fi
dnl - jit support
case $host_cpu in
x86|x86_64|i386|i486|i586|i686)
HAVE_JIT=yes
AC_DEFINE(HAVE_JIT)
;;
esac
AM_CONDITIONAL([HAVE_JIT], [test "x$HAVE_JIT" = "xyes"])
dnl - wifi support
AC_ARG_ENABLE(wifi,
[AC_HELP_STRING(--enable-wifi, enable wifi support)],
[wifisupport=yes])
if test "x$wifisupport" = "xyes" ; then
AC_DEFINE(EXPERIMENTAL_WIFI_COMM)
fi
dnl Set compiler library flags per host architecture
case $host in
*mingw*)
LIBS="$LIBS -ldxguid -ldxerr8 -ldsound -lopengl32 -lws2_32 -mwindows"
;;
*darwin*)
dnl - openal is required on mac os x and we are not able to figure out if it's installed or not
AC_DEFINE(HAVE_OPENAL)
LIBS="$LIBS -framework OpenGL -framework OpenAL"
CPPFLAGS="$CPPFLAGS -I/System/Library/Frameworks/OpenAL.framework/Headers"
AC_SUBST(CPPFLAGS)
;;
esac
# Detect the host platform and architecture and feed them to the compiler as
# defines
AS_CASE([$host],
[*linux*], [AC_DEFINE(HOST_LINUX)],
[*bsd*] , [AC_DEFINE(HOST_BSD)],
[*mingw*], [AC_DEFINE(HOST_WINDOWS)],
[*darwin*],[AC_DEFINE(HOST_DARWIN)],
[AC_DEFINE(HOST_UNK)]
)
AS_CASE([$host_cpu],
[x86_64], [AC_DEFINE(HOST_64)],
[amd64], [AC_DEFINE(HOST_64)],
[AC_DEFINE(HOST_32)]
)
AC_CHECK_DECL([__SSE2__])
AM_CONDITIONAL([SUPPORT_SSE2], [test "x$ac_cv_have_decl___SSE2__" = xyes])
AC_CHECK_DECL([__AVX2__])
AM_CONDITIONAL([SUPPORT_AVX2], [test "x$ac_cv_have_decl___AVX2__" = xyes])
AC_CHECK_DECL([__ALTIVEC__])
AM_CONDITIONAL([SUPPORT_ALTIVEC], [test "x$ac_cv_have_decl___ALTIVEC__" = xyes])
AC_SUBST(PO_DIR)
dnl - Gdb stub
AC_ARG_ENABLE(gdb-stub,
[AC_HELP_STRING(--enable-gdb-stub, enable gdb stub)],
[
AC_DEFINE(GDB_STUB)
wantgdbstub=yes
])
AM_CONDITIONAL([HAVE_GDB_STUB], [test "${wantgdbstub}" = "yes"])
dnl - Compiler warnings
# for developer use, enable lots of compile warnings,
# but don't require this generally, because some system's
# header files (BSD) can't handle it
#
# NB: must add -Werror after AC_PROG_CC, etc., so do this last
AC_ARG_ENABLE(hardcore,
[AC_HELP_STRING(--enable-hardcore, turn on -W -Wall -Werror)],
[case "${enableval}" in
yes) ENABLE_HARDCORE=1 ;;
no) ENABLE_HARDCORE=0 ;;
*) AC_MSG_ERROR(bad value ${enableval} for --enable-hardcore) ;; esac],
[ENABLE_HARDCORE=0])
if test "x[$]ENABLE_HARDCORE" = "x1"; then
AC_MSG_WARN(enable hardcore compile warnings)
if test "x$CXX" = "x"; then
dnl - only valid for C with newer gcc's
CPPFLAGS="[$]CPPFLAGS -Wmissing-prototypes"
fi
dnl - -Wshadow
CPPFLAGS="[$]CPPFLAGS -Wall -Wextra -D_FORTIFY_SOURCE=2 -Wno-missing-field-initializers -Wpointer-arith -Wcast-align -Wwrite-strings -Wno-unused-parameter -Wmissing-declarations -Wundef -Wmissing-noreturn -Wredundant-decls -Wformat-nonliteral -Wformat-security -Winit-self -Wno-reorder"
fi
dnl - Enable debug mode
AC_ARG_ENABLE(debug,
AC_HELP_STRING(--enable-debug, enable debug information),
AC_DEFINE(DEBUG))
AC_ARG_ENABLE(gpu-debug,
AC_HELP_STRING(--enable-gpu-debug, enable gpu debug information),
AC_DEFINE(GPUDEBUG))
AC_ARG_ENABLE(div-debug,
AC_HELP_STRING(--enable-div-debug, enable div debug information),
AC_DEFINE(DIVDEBUG))
AC_ARG_ENABLE(sqrt-debug,
AC_HELP_STRING(--enable-sqrt-debug, enable sqrt debug information),
AC_DEFINE(SQRTDEBUG))
AC_ARG_ENABLE(dma-debug,
AC_HELP_STRING(--enable-dma-debug, enable dma debug information),
AC_DEFINE(DMADEBUG))
dnl -- set maintainer mode
AM_MAINTAINER_MODE
AC_SUBST(USE_MAINTAINER_MODE)
dnl --- Finally, output the makefile
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

View File

@ -19,6 +19,7 @@
// This entire file is basically a copy of the Posix CLI rendering / input processing.
#include <SDL.h>
#include "interface.h"
#include "../../NDSSystem.h"
#include "../../GPU.h"
@ -31,7 +32,8 @@
#endif
// SDL drawing & input processing
static SDL_Surface *surface;
static SDL_Window *window;
static SDL_Renderer *renderer;
static int sdl_videoFlags;
struct ctrls_event_config ctrls_cfg;
static float nds_screen_size_ratio = 1.0f;
@ -67,10 +69,6 @@ static void resizeWindow_stub(u16 width, u16 height, void *sdl_ogl_screen_textur
static void sdl_draw_no_opengl()
{
#ifdef HAVE_LIBAGG
//TODO : osd->update();
//TODO : DrawHUD();
#endif
const NDSDisplayInfo &displayInfo = GPU->GetDisplayInfo();
const size_t pixCount = GPU_FRAMEBUFFER_NATIVE_WIDTH * GPU_FRAMEBUFFER_NATIVE_HEIGHT;
ColorspaceApplyIntensityToBuffer16<false, false>((u16 *)displayInfo.masterNativeBuffer, pixCount, displayInfo.backlightIntensity[NDSDisplayID_Main]);
@ -79,12 +77,10 @@ static void sdl_draw_no_opengl()
SDL_Surface *rawImage = SDL_CreateRGBSurfaceFrom(displayInfo.masterNativeBuffer, GPU_FRAMEBUFFER_NATIVE_WIDTH, GPU_FRAMEBUFFER_NATIVE_HEIGHT * 2, 16, GPU_FRAMEBUFFER_NATIVE_WIDTH * sizeof(u16), 0x001F, 0x03E0, 0x7C00, 0);
if(rawImage == NULL) return;
SDL_BlitSurface(rawImage, 0, surface, 0);
SDL_UpdateRect(surface, 0, 0, 0, 0);
SDL_FreeSurface(rawImage);
#ifdef HAVE_LIBAGG
//TODO : osd->clear();
#endif
SDL_Texture *texture = SDL_CreateTextureFromSurface(renderer, rawImage);
SDL_FreeSurface(rawImage);
SDL_RenderCopy(renderer, texture, NULL, NULL);
SDL_RenderPresent(renderer);
}
#ifdef INCLUDE_OPENGL_2D
@ -155,7 +151,6 @@ static void resizeWindow(u16 width, u16 height, GLuint *screen_texture) {
int comp_height = 2 * height;
GLenum errCode;
surface = SDL_SetVideoMode(width, height, 32, sdl_videoFlags);
initGL(screen_texture);
#ifdef HAVE_LIBAGG
@ -206,45 +201,24 @@ EXPORTED int desmume_draw_window_init(BOOL auto_pause, BOOL use_opengl_if_possib
// SDL_Init is called in desmume_init.
SDL_WM_SetCaption("Desmume SDL", NULL);
const SDL_VideoInfo *videoInfo;
videoInfo = SDL_GetVideoInfo();
if (!videoInfo) {
fprintf(stderr, "Video query failed: %s\n", SDL_GetError());
return -1;
}
if ( videoInfo->blit_hw ) {
sdl_videoFlags |= SDL_HWACCEL;
}
#ifdef INCLUDE_OPENGL_2D
if (opengl_2d) {
/* the flags to pass to SDL_SetVideoMode */
sdl_videoFlags = SDL_OPENGL; /* Enable OpenGL in SDL */
sdl_videoFlags |= SDL_HWPALETTE; /* Store the palette in hardware */
sdl_videoFlags |= SDL_RESIZABLE; /* Enable window resizing */
/* This checks to see if surfaces can be stored in memory */
if ( videoInfo->hw_available )
sdl_videoFlags |= SDL_HWSURFACE;
else
sdl_videoFlags |= SDL_SWSURFACE;
/* Sets up OpenGL double buffering */
SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER, 1 );
surface = SDL_SetVideoMode( 256, 192 * 2, 32,
sdl_videoFlags );
window = SDL_CreateWindow( "Desmume SDL", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 256, 192 * 2,
sdl_videoFlags );
/* Verify there is a surface */
if (!surface) {
fprintf(stderr, "Video mode set failed: %s\n", SDL_GetError( ));
return -1;
}
/* Verify there is a window */
if ( !window ) {
fprintf( stderr, "Window creation failed: %s\n", SDL_GetError( ) );
exit( -1);
}
/* initialize OpenGL */
@ -257,13 +231,15 @@ EXPORTED int desmume_draw_window_init(BOOL auto_pause, BOOL use_opengl_if_possib
if (!opengl_2d) {
#endif
sdl_videoFlags |= SDL_SWSURFACE;
surface = SDL_SetVideoMode(256, 384, 32, sdl_videoFlags);
sdl_videoFlags |= SDL_SWSURFACE;
window = SDL_CreateWindow( "Desmume SDL", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 256, 384, sdl_videoFlags );
if (!surface) {
fprintf( stderr, "Video mode set failed: %s\n", SDL_GetError( ) );
return -1;
}
if ( !window ) {
fprintf( stderr, "Window creation failed: %s\n", SDL_GetError( ) );
exit( -1);
}
renderer = SDL_CreateRenderer(window, -1, SDL_RENDERER_ACCELERATED);
#ifdef INCLUDE_OPENGL_2D
}

View File

@ -17,13 +17,12 @@
along with the this software. If not, see <http://www.gnu.org/licenses/>.
*/
#include <SDL.h>
#include "interface.h"
#include <stdio.h>
#include "../../NDSSystem.h"
#include "../../GPU.h"
// TODO: OSD Support isn't really done yet! Test!
#include "../modules/osd/agg/agg_osd.h"
#include "../../SPU.h"
#include "../../MMU.h"
#include "../../rasterize.h"

View File

@ -20,8 +20,7 @@
#ifndef DESMUME_INTERFACE_H
#define DESMUME_INTERFACE_H
#include <SDL.h>
#include <../../types.h>
#include "../../types.h"
#include "../../movie.h"
#ifdef HAVE_GL_GL_H

View File

@ -0,0 +1,230 @@
project('libdesmume',
['c', 'cpp'],
version: '2.7.10',
meson_version: '>=0.45',
default_options: [
'warning_level=1',
'c_std=c11',
'cpp_std=c++14',
],
license: 'GPL2+',
)
dep_glib2 = dependency('glib-2.0')
dep_sdl = dependency('sdl2')
dep_pcap = dependency('pcap')
dep_zlib = dependency('zlib')
dep_threads = dependency('threads')
dep_gl = dependency('gl', required: false)
dep_openal = dependency('openal', required: get_option('openal'))
dep_alsa = dependency('alsa', required: false)
dep_soundtouch = dependency('soundtouch', required: false)
if get_option('wifi')
add_global_arguments('-DEXPERIMENTAL_WIFI_COMM', language: ['c', 'cpp'])
endif
add_global_arguments('-DTARGET_INTERFACE', language: ['c', 'cpp'])
dependencies = [dep_glib2, dep_sdl, dep_pcap, dep_zlib, dep_threads]
if target_machine.cpu() == 'x86_64'
add_global_arguments('-DHAVE_JIT', language: ['c', 'cpp'])
add_global_arguments('-DHOST_64', language: ['c', 'cpp'])
have_jit = true
elif target_machine.cpu() == 'i686'
add_global_arguments('-DHAVE_JIT', language: ['c', 'cpp'])
add_global_arguments('-DHOST_32', language: ['c', 'cpp'])
have_jit = true
else
have_jit = false
endif
includes = include_directories(
'../../../src',
'../../../src/libretro-common/include',
'../../../src/frontend',
)
libdesmume_src = ['interface.cpp', 'draw_sdl_window.cpp']
libdesmume_src += [
'../../armcpu.cpp',
'../../arm_instructions.cpp',
'../../bios.cpp',
'../../cp15.cpp',
'../../commandline.cpp',
'../../common.cpp',
'../../debug.cpp',
'../../driver.cpp',
'../../Database.cpp',
'../../emufile.cpp', '../../encrypt.cpp', '../../FIFO.cpp',
'../../firmware.cpp', '../../GPU.cpp',
'../../mc.cpp',
'../../path.cpp',
'../../readwrite.cpp',
'../../wifi.cpp',
'../../MMU.cpp', '../../NDSSystem.cpp',
'../../ROMReader.cpp',
'../../render3D.cpp',
'../../rtc.cpp',
'../../saves.cpp',
'../../slot1.cpp',
'../../slot2.cpp',
'../../SPU.cpp',
'../../matrix.cpp',
'../../gfx3d.cpp',
'../../thumb_instructions.cpp',
'../../movie.cpp',
'../../frontend/modules/Disassembler.cpp',
'../../utils/advanscene.cpp',
'../../utils/datetime.cpp',
'../../utils/guid.cpp',
'../../utils/emufat.cpp',
'../../utils/fsnitro.cpp',
'../../utils/xstring.cpp',
'../../utils/decrypt/crc.cpp', '../../utils/decrypt/decrypt.cpp',
'../../utils/decrypt/header.cpp',
'../../utils/task.cpp',
'../../utils/vfat.cpp',
'../../utils/dlditool.cpp',
'../../utils/libfat/cache.cpp',
'../../utils/libfat/directory.cpp',
'../../utils/libfat/disc.cpp',
'../../utils/libfat/fatdir.cpp',
'../../utils/libfat/fatfile.cpp',
'../../utils/libfat/filetime.cpp',
'../../utils/libfat/file_allocation_table.cpp',
'../../utils/libfat/libfat.cpp',
'../../utils/libfat/libfat_public_api.cpp',
'../../utils/libfat/lock.cpp',
'../../utils/libfat/partition.cpp',
'../../utils/tinyxml/tinystr.cpp',
'../../utils/tinyxml/tinyxml.cpp',
'../../utils/tinyxml/tinyxmlerror.cpp',
'../../utils/tinyxml/tinyxmlparser.cpp',
'../../utils/colorspacehandler/colorspacehandler.cpp',
'../../addons/slot2_auto.cpp', '../../addons/slot2_mpcf.cpp', '../../addons/slot2_paddle.cpp', '../../addons/slot2_gbagame.cpp', '../../addons/slot2_none.cpp', '../../addons/slot2_rumblepak.cpp', '../../addons/slot2_guitarGrip.cpp', '../../addons/slot2_expMemory.cpp', '../../addons/slot2_piano.cpp', '../../addons/slot2_passme.cpp', '../../addons/slot1_none.cpp', '../../addons/slot1_r4.cpp', '../../addons/slot1_retail_nand.cpp', '../../addons/slot1_retail_auto.cpp', '../../addons/slot1_retail_mcrom.cpp', '../../addons/slot1_retail_mcrom_debug.cpp', '../../addons/slot1comp_mc.cpp', '../../addons/slot1comp_rom.cpp', '../../addons/slot1comp_protocol.cpp',
'../../cheatSystem.cpp',
'../../texcache.cpp', '../../rasterize.cpp',
'../../metaspu/metaspu.cpp',
'../../filter/2xsai.cpp', '../../filter/bilinear.cpp', '../../filter/deposterize.cpp', '../../filter/epx.cpp',
'../../filter/hq2x.cpp',
'../../filter/hq3x.cpp',
'../../filter/hq4x.cpp',
'../../filter/lq2x.cpp', '../../filter/scanline.cpp',
'../../filter/videofilter.cpp',
'../../filter/xbrz.cpp',
'../../version.cpp',
'../../libretro-common/compat/compat_getopt.c',
'../../libretro-common/file/file_path.c',
'../../libretro-common/compat/compat_strl.c',
'../../libretro-common/features/features_cpu.c',
'../../libretro-common/file/retro_dirent.c',
'../../libretro-common/file/retro_stat.c',
'../../libretro-common/rthreads/async_job.c',
'../../libretro-common/rthreads/rsemaphore.c',
'../../libretro-common/rthreads/rthreads.c',
'../../libretro-common/encodings/encoding_utf.c',
]
libdesmume_src += [
'../posix/shared/sndsdl.cpp',
'../posix/shared/ctrlssdl.cpp'
]
if have_jit
libdesmume_src += [
'../../arm_jit.cpp',
'../../utils/AsmJit/core/assembler.cpp',
'../../utils/AsmJit/core/assert.cpp',
'../../utils/AsmJit/core/buffer.cpp',
'../../utils/AsmJit/core/compiler.cpp',
'../../utils/AsmJit/core/compilercontext.cpp',
'../../utils/AsmJit/core/compilerfunc.cpp',
'../../utils/AsmJit/core/compileritem.cpp',
'../../utils/AsmJit/core/context.cpp',
'../../utils/AsmJit/core/cpuinfo.cpp',
'../../utils/AsmJit/core/defs.cpp',
'../../utils/AsmJit/core/func.cpp',
'../../utils/AsmJit/core/logger.cpp',
'../../utils/AsmJit/core/memorymanager.cpp',
'../../utils/AsmJit/core/memorymarker.cpp',
'../../utils/AsmJit/core/operand.cpp',
'../../utils/AsmJit/core/stringbuilder.cpp',
'../../utils/AsmJit/core/stringutil.cpp',
'../../utils/AsmJit/core/virtualmemory.cpp',
'../../utils/AsmJit/core/zonememory.cpp',
'../../utils/AsmJit/x86/x86assembler.cpp',
'../../utils/AsmJit/x86/x86compiler.cpp',
'../../utils/AsmJit/x86/x86compilercontext.cpp',
'../../utils/AsmJit/x86/x86compilerfunc.cpp',
'../../utils/AsmJit/x86/x86compileritem.cpp',
'../../utils/AsmJit/x86/x86cpuinfo.cpp',
'../../utils/AsmJit/x86/x86defs.cpp',
'../../utils/AsmJit/x86/x86func.cpp',
'../../utils/AsmJit/x86/x86operand.cpp',
'../../utils/AsmJit/x86/x86util.cpp',
]
endif
if dep_gl.found()
dependencies += dep_gl
libdesmume_src += [
'../../OGLRender.cpp',
'../../OGLRender_3_2.cpp',
]
endif
if dep_openal.found()
dependencies += dep_openal
libdesmume_src += [
'../posix/shared/mic_openal.cpp',
]
elif dep_alsa.found()
dependencies += dep_alsa
libdesmume_src += [
'../posix/shared/mic_alsa.cpp',
]
else
libdesmume_src += [
'../../mic.cpp',
]
endif
if dep_soundtouch.found()
dependencies += dep_soundtouch
add_global_arguments('-DHAVE_LIBSOUNDTOUCH', language: ['c', 'cpp'])
libdesmume_src += [
'../../metaspu/SndOut.cpp',
'../../metaspu/Timestretcher.cpp',
]
endif
if get_option('gdb-stub')
add_global_arguments('-DGDB_STUB', language: ['c', 'cpp'])
libdesmume_src += [
'../../gdbstub/gdbstub.cpp',
]
endif
simd = import('unstable-simd')
cxx = meson.get_compiler('cpp')
rval = simd.check('colorspacehandler',
sse2: '../../utils/colorspacehandler/colorspacehandler_SSE2.cpp',
# TODO: add these two even in generic builds.
#avx2: '../../utils/colorspacehandler/colorspacehandler_AVX2.cpp',
#avx512: '../../utils/colorspacehandler/colorspacehandler_AVX512.cpp',
# TODO: add support for this in meson.
#altivec: '../../utils/colorspacehandler/colorspacehandler_AltiVec.cpp',
compiler: cxx,
include_directories: includes,
)
colorspacehandler_simd = rval[0]
library('libdesmume',
libdesmume_src,
dependencies: dependencies,
include_directories: includes,
link_with: colorspacehandler_simd,
)

View File

@ -0,0 +1,25 @@
option('openal',
type: 'boolean',
value: false,
description: 'Enable experimental OpenAL microphone input',
)
option('frontend-gtk',
type: 'boolean',
value: true,
description: 'Enable GTK frontend',
)
option('frontend-cli',
type: 'boolean',
value: true,
description: 'Enable CLI frontend',
)
option('wifi',
type: 'boolean',
value: false,
description: 'Enable wifi support',
)
option('gdb-stub',
type: 'boolean',
value: false,
description: 'Enable gdb stub',
)