aboutsummaryrefslogtreecommitdiff
path: root/src/libui_sdl
diff options
context:
space:
mode:
Diffstat (limited to 'src/libui_sdl')
-rw-r--r--src/libui_sdl/CMakeLists.txt58
-rw-r--r--src/libui_sdl/libui/darwin/stddialogs.m4
-rw-r--r--src/libui_sdl/libui/ui.h4
-rw-r--r--src/libui_sdl/libui/unix/draw.c2
-rw-r--r--src/libui_sdl/libui/unix/stddialogs.c6
-rw-r--r--src/libui_sdl/libui/windows/stddialogs.cpp6
-rw-r--r--src/libui_sdl/main.cpp4
7 files changed, 72 insertions, 12 deletions
diff --git a/src/libui_sdl/CMakeLists.txt b/src/libui_sdl/CMakeLists.txt
new file mode 100644
index 0000000..40019db
--- /dev/null
+++ b/src/libui_sdl/CMakeLists.txt
@@ -0,0 +1,58 @@
+project(libui_sdl)
+
+SET(SOURCES_LIBUI
+ main.cpp
+ Platform.cpp
+ PlatformConfig.cpp
+ LAN_Socket.cpp
+ LAN_PCap.cpp
+ DlgAudioSettings.cpp
+ DlgEmuSettings.cpp
+ DlgInputConfig.cpp
+ DlgWifiSettings.cpp
+)
+
+option(BUILD_SHARED_LIBS "Whether to build libui as a shared library or a static library" ON)
+set(BUILD_SHARED_LIBS OFF)
+add_subdirectory(libui)
+
+find_package(SDL2 REQUIRED)
+include_directories(${SDL2_INCLUDE_DIR})
+#string(STRIP ${SDL2_LIBRARIES} SDL2_LIBRARIES)
+
+add_executable(melonDS ${SOURCES_LIBUI})
+target_link_libraries(melonDS
+ core ${SDL2_LIBRARIES} libui)
+
+if (UNIX)
+ find_package(PkgConfig REQUIRED)
+ pkg_check_modules(GTK3 REQUIRED gtk+-3.0)
+ pkg_check_modules(SDL2 REQUIRED sdl2)
+
+ target_include_directories(melonDS
+ PRIVATE ${GTK3_INCLUDE_DIRS} ${SDL2_INCLUDE_DIRS}
+ )
+ target_link_libraries(melonDS ${GTK3_LIBRARIES} ${SDL2_LIBRARIES})
+
+ ADD_DEFINITIONS(${GTK3_CFLAGS_OTHER})
+
+ add_custom_command(OUTPUT melon_grc.c
+ COMMAND glib-compile-resources --sourcedir="${CMAKE_SOURCE_DIR}"
+ --target="${CMAKE_CURRENT_BINARY_DIR}/melon_grc.c"
+ --generate-source "${CMAKE_SOURCE_DIR}/melon_grc.xml"
+ COMMAND glib-compile-resources --sourcedir="${CMAKE_SOURCE_DIR}"
+ --target="${CMAKE_CURRENT_BINARY_DIR}/melon_grc.h"
+ --generate-header "${CMAKE_SOURCE_DIR}/melon_grc.xml")
+
+ if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ target_link_libraries(melonDS dl)
+ endif ()
+
+ target_sources(melonDS PUBLIC melon_grc.c)
+elseif (WIN32)
+ target_sources(melonDS PUBLIC "${CMAKE_SOURCE_DIR}/melon.rc")
+ target_include_directories(melonDS PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/..")
+ target_link_libraries(melonDS comctl32 d2d1 dwrite uxtheme ws2_32 iphlpapi)
+endif ()
+
+install(TARGETS melonDS RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
diff --git a/src/libui_sdl/libui/darwin/stddialogs.m b/src/libui_sdl/libui/darwin/stddialogs.m
index 42cb94c..c826035 100644
--- a/src/libui_sdl/libui/darwin/stddialogs.m
+++ b/src/libui_sdl/libui/darwin/stddialogs.m
@@ -32,7 +32,7 @@ static char *runSavePanel(NSWindow *parent, NSSavePanel *s)
return filename;
}
-char *uiOpenFile(uiWindow *parent, char* filter, char* initpath)
+char *uiOpenFile(uiWindow *parent, const char* filter, const char* initpath)
{
NSOpenPanel *o;
@@ -46,7 +46,7 @@ char *uiOpenFile(uiWindow *parent, char* filter, char* initpath)
return runSavePanel(windowWindow(parent), o);
}
-char *uiSaveFile(uiWindow *parent, char* filter, char* initpath)
+char *uiSaveFile(uiWindow *parent, const char* filter, const char* initpath)
{
NSSavePanel *s;
diff --git a/src/libui_sdl/libui/ui.h b/src/libui_sdl/libui/ui.h
index 5b163af..d2e9960 100644
--- a/src/libui_sdl/libui/ui.h
+++ b/src/libui_sdl/libui/ui.h
@@ -285,8 +285,8 @@ _UI_EXTERN uiMenuItem *uiMenuAppendSubmenu(uiMenu *m, uiMenu* child);
_UI_EXTERN void uiMenuAppendSeparator(uiMenu *m);
_UI_EXTERN uiMenu *uiNewMenu(const char *name);
-_UI_EXTERN char *uiOpenFile(uiWindow *parent, char* filter, char* initpath);
-_UI_EXTERN char *uiSaveFile(uiWindow *parent, char* filter, char* initpath);
+_UI_EXTERN char *uiOpenFile(uiWindow *parent, const char* filter, const char* initpath);
+_UI_EXTERN char *uiSaveFile(uiWindow *parent, const char* filter, const char* initpath);
_UI_EXTERN void uiMsgBox(uiWindow *parent, const char *title, const char *description);
_UI_EXTERN void uiMsgBoxError(uiWindow *parent, const char *title, const char *description);
diff --git a/src/libui_sdl/libui/unix/draw.c b/src/libui_sdl/libui/unix/draw.c
index 72d4202..e55397e 100644
--- a/src/libui_sdl/libui/unix/draw.c
+++ b/src/libui_sdl/libui/unix/draw.c
@@ -163,7 +163,7 @@ uiDrawBitmap* uiDrawNewBitmap(uiDrawContext* c, int width, int height)
void uiDrawBitmapUpdate(uiDrawBitmap* bmp, const void* data)
{
- unsigned char* src = data;
+ const unsigned char* src = data;
unsigned char* dst = cairo_image_surface_get_data(bmp->bmp);
if (bmp->Stride == bmp->Width*4)
diff --git a/src/libui_sdl/libui/unix/stddialogs.c b/src/libui_sdl/libui/unix/stddialogs.c
index d2b89b9..3daeffa 100644
--- a/src/libui_sdl/libui/unix/stddialogs.c
+++ b/src/libui_sdl/libui/unix/stddialogs.c
@@ -6,7 +6,7 @@
#define windowWindow(w) ((w)?(GTK_WINDOW(uiControlHandle(uiControl(w)))):NULL)
-static char *filedialog(GtkWindow *parent, GtkFileChooserAction mode, const gchar *confirm, char* filter, char* initpath)
+static char *filedialog(GtkWindow *parent, GtkFileChooserAction mode, const gchar *confirm, const char* filter, const char* initpath)
{
GtkWidget *fcd;
GtkFileChooser *fc;
@@ -83,12 +83,12 @@ static char *filedialog(GtkWindow *parent, GtkFileChooserAction mode, const gcha
return filename;
}
-char *uiOpenFile(uiWindow *parent, char* filter, char* initpath)
+char *uiOpenFile(uiWindow *parent, const char* filter, const char* initpath)
{
return filedialog(windowWindow(parent), GTK_FILE_CHOOSER_ACTION_OPEN, "_Open", filter, initpath);
}
-char *uiSaveFile(uiWindow *parent, char* filter, char* initpath)
+char *uiSaveFile(uiWindow *parent, const char* filter, const char* initpath)
{
return filedialog(windowWindow(parent), GTK_FILE_CHOOSER_ACTION_SAVE, "_Save", filter, initpath);
}
diff --git a/src/libui_sdl/libui/windows/stddialogs.cpp b/src/libui_sdl/libui/windows/stddialogs.cpp
index eb535cb..d0fd506 100644
--- a/src/libui_sdl/libui/windows/stddialogs.cpp
+++ b/src/libui_sdl/libui/windows/stddialogs.cpp
@@ -16,7 +16,7 @@
#define windowHWND(w) (w ? (HWND) uiControlHandle(uiControl(w)) : NULL)
-char *commonItemDialog(HWND parent, REFCLSID clsid, REFIID iid, char* filter, char* initpath, FILEOPENDIALOGOPTIONS optsadd)
+char *commonItemDialog(HWND parent, REFCLSID clsid, REFIID iid, const char* filter, const char* initpath, FILEOPENDIALOGOPTIONS optsadd)
{
IFileDialog *d = NULL;
FILEOPENDIALOGOPTIONS opts;
@@ -108,7 +108,7 @@ out:
return name;
}
-char *uiOpenFile(uiWindow *parent, char* filter, char* initpath)
+char *uiOpenFile(uiWindow *parent, const char* filter, const char* initpath)
{
char *res;
@@ -121,7 +121,7 @@ char *uiOpenFile(uiWindow *parent, char* filter, char* initpath)
return res;
}
-char *uiSaveFile(uiWindow *parent, char* filter, char* initpath)
+char *uiSaveFile(uiWindow *parent, const char* filter, const char* initpath)
{
char *res;
diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp
index 874d8ff..c086bbf 100644
--- a/src/libui_sdl/main.cpp
+++ b/src/libui_sdl/main.cpp
@@ -873,7 +873,9 @@ int EmuThreadFunc(void* burp)
u32 diff = tick - lastmeasuretick;
lastmeasuretick = tick;
- u32 fps = (nframes * 1000) / diff;
+ u32 fps;
+ if (diff < 1) fps = 77777;
+ else fps = (nframes * 1000) / diff;
nframes = 0;
float fpstarget;