From 053c0f65b4148d3539fa855aa8b64e5c06576ee3 Mon Sep 17 00:00:00 2001 From: Lucian Poston Date: Thu, 23 Apr 2020 17:45:58 -0500 Subject: [PATCH 1/7] Larger unemphasized screen, when possible --- src/libui_sdl/main.cpp | 40 ++++++++++++++++++++++++---------------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp index 8e8bf9ec..ede2576a 100644 --- a/src/libui_sdl/main.cpp +++ b/src/libui_sdl/main.cpp @@ -1398,6 +1398,7 @@ void SetupScreenRects(int width, int height) // side-by-side int heightreq; + int emph_smaller_width; int startX = 0; width -= gap; @@ -1416,23 +1417,26 @@ void SetupScreenRects(int width, int height) else // emph. top/bottom { heightreq = ((width - screenW) * screenH) / screenW; + emph_smaller_width = screenW; if (heightreq > height) { - int newwidth = ((height * (width - screenW)) / heightreq) + screenW; - startX = (width - newwidth) / 2; + int maximal_width = 2 * (height * screenW / screenH); + maximal_width = maximal_width > width ? width : maximal_width; + emph_smaller_width = maximal_width - (height * screenW / screenH); + startX = (width - maximal_width) / 2; heightreq = height; - width = newwidth; + width = maximal_width; } } if (sizemode == 2) { - topscreen->Width = screenW; - topscreen->Height = screenH; + topscreen->Width = emph_smaller_width; + topscreen->Height = emph_smaller_width * screenH / screenW; } else { - topscreen->Width = (sizemode==0) ? (width / 2) : (width - screenW); + topscreen->Width = (sizemode==0) ? (width / 2) : (width - emph_smaller_width); topscreen->Height = heightreq; } topscreen->X = startX; @@ -1442,8 +1446,8 @@ void SetupScreenRects(int width, int height) if (sizemode == 1) { - bottomscreen->Width = screenW; - bottomscreen->Height = screenH; + bottomscreen->Width = emph_smaller_width; + bottomscreen->Height = emph_smaller_width * screenH / screenW; } else { @@ -1457,6 +1461,7 @@ void SetupScreenRects(int width, int height) // top then bottom int widthreq; + int emph_smaller_height; int startY = 0; height -= gap; @@ -1475,24 +1480,27 @@ void SetupScreenRects(int width, int height) else // emph. top/bottom { widthreq = ((height - screenH) * screenW) / screenH; + emph_smaller_height = screenH; if (widthreq > width) { - int newheight = ((width * (height - screenH)) / widthreq) + screenH; - startY = (height - newheight) / 2; + int maximal_height = 2 * (width * screenH / screenW); + maximal_height = maximal_height > height ? height : maximal_height; + emph_smaller_height = maximal_height - (width * screenH / screenW); + startY = (height - maximal_height) / 2; widthreq = width; - height = newheight; + height = maximal_height; } } if (sizemode == 2) { - topscreen->Width = screenW; - topscreen->Height = screenH; + topscreen->Width = emph_smaller_height * screenW / screenH; + topscreen->Height = emph_smaller_height; } else { topscreen->Width = widthreq; - topscreen->Height = (sizemode==0) ? (height / 2) : (height - screenH); + topscreen->Height = (sizemode==0) ? (height / 2) : (height - emph_smaller_height); } topscreen->Y = startY; topscreen->X = (width - topscreen->Width) / 2; @@ -1501,8 +1509,8 @@ void SetupScreenRects(int width, int height) if (sizemode == 1) { - bottomscreen->Width = screenW; - bottomscreen->Height = screenH; + bottomscreen->Width = emph_smaller_height * screenW / screenH; + bottomscreen->Height = emph_smaller_height; } else { From d3f14b7a8bcba9a71b7008a5b78abdfd4b70cb34 Mon Sep 17 00:00:00 2001 From: RSDuck Date: Mon, 27 Apr 2020 00:56:36 +0200 Subject: [PATCH 2/7] fix #584 --- src/libui_sdl/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp index 8e8bf9ec..9dea9f17 100644 --- a/src/libui_sdl/main.cpp +++ b/src/libui_sdl/main.cpp @@ -904,8 +904,6 @@ void UpdateFPSLimit(void* data) int EmuThreadFunc(void* burp) { - NDS::Init(); - MainScreenPos[0] = 0; MainScreenPos[1] = 0; MainScreenPos[2] = 0; @@ -2958,6 +2956,8 @@ int main(int argc, char** argv) Joystick = NULL; OpenJoystick(); + NDS::Init(); + EmuRunning = 2; RunningSomething = false; EmuThread = SDL_CreateThread(EmuThreadFunc, "melonDS magic", NULL); From 5c5d280dd547958a37824809b7a038efbb3aee3b Mon Sep 17 00:00:00 2001 From: Nadia Holmquist Pedersen Date: Sun, 10 May 2020 23:09:17 +0200 Subject: [PATCH 3/7] Add -flto as link flag, also fix missing include in main.cpp causing a build failure with gcc10 --- CMakeLists.txt | 1 + src/libui_sdl/libui/unix/CMakeLists.txt | 2 +- src/libui_sdl/main.cpp | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 048dd44a..e3f9cb63 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -22,6 +22,7 @@ endif() if(ENABLE_LTO) add_compile_options(-O3 -flto) + add_link_options(-flto) set(CMAKE_AR "gcc-ar") set(CMAKE_C_ARCHIVE_CREATE " qcs ") set(CMAKE_C_ARCHIVE_FINISH true) diff --git a/src/libui_sdl/libui/unix/CMakeLists.txt b/src/libui_sdl/libui/unix/CMakeLists.txt index c69081ee..39f6c0a0 100644 --- a/src/libui_sdl/libui/unix/CMakeLists.txt +++ b/src/libui_sdl/libui/unix/CMakeLists.txt @@ -65,7 +65,7 @@ macro(_handle_static) OUTPUT ${_oname} DEPENDS ${_LIBUINAME} COMMAND - ld -r --whole-archive ${_aname} -o ${_oname} + ${CMAKE_LINKER} -r --whole-archive ${_aname} -o ${_oname} COMMAND objcopy --localize-hidden ${_oname} COMMENT "Removing hidden symbols") diff --git a/src/libui_sdl/main.cpp b/src/libui_sdl/main.cpp index 9dea9f17..80b86651 100644 --- a/src/libui_sdl/main.cpp +++ b/src/libui_sdl/main.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #ifndef __WIN32__ #include From 675b3f882ff1c0cc66a34e571a64e028f269f4bc Mon Sep 17 00:00:00 2001 From: Nadia Holmquist Pedersen Date: Sun, 10 May 2020 23:29:47 +0200 Subject: [PATCH 4/7] Fix building with Clang --- CMakeLists.txt | 13 ++++++++++++- src/libui_sdl/OSD.cpp | 4 ++-- src/libui_sdl/libui/unix/CMakeLists.txt | 20 +------------------- 3 files changed, 15 insertions(+), 22 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e3f9cb63..aa33d4b7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,7 +23,18 @@ endif() if(ENABLE_LTO) add_compile_options(-O3 -flto) add_link_options(-flto) - set(CMAKE_AR "gcc-ar") + + if (${CMAKE_CXX_COMPILER_ID} STREQUAL Clang) + find_program(LLD ld.lld) + if (LLD) + add_link_options(-fuse-ld=lld) + else() + add_link_options(-fuse-linker-plugin) + endif() + set(CMAKE_AR "llvm-ar") + else() + set(CMAKE_AR "gcc-ar") + endif() set(CMAKE_C_ARCHIVE_CREATE " qcs ") set(CMAKE_C_ARCHIVE_FINISH true) set(CMAKE_CXX_ARCHIVE_CREATE " qcs ") diff --git a/src/libui_sdl/OSD.cpp b/src/libui_sdl/OSD.cpp index a01e39b9..02418ccb 100644 --- a/src/libui_sdl/OSD.cpp +++ b/src/libui_sdl/OSD.cpp @@ -419,8 +419,8 @@ void Update(bool opengl, uiAreaDrawParams* params) item.DrawBitmapLoaded = true; } - uiRect rc_src = {0, 0, item.Width, item.Height}; - uiRect rc_dst = {kOSDMargin, y, item.Width, item.Height}; + uiRect rc_src = {0, 0, (int) item.Width, (int) item.Height}; + uiRect rc_dst = {kOSDMargin, (int) y, (int) item.Width, (int) item.Height}; uiDrawBitmapDraw(params->Context, item.DrawBitmap, &rc_src, &rc_dst, 0); } diff --git a/src/libui_sdl/libui/unix/CMakeLists.txt b/src/libui_sdl/libui/unix/CMakeLists.txt index 39f6c0a0..1f4ab865 100644 --- a/src/libui_sdl/libui/unix/CMakeLists.txt +++ b/src/libui_sdl/libui/unix/CMakeLists.txt @@ -54,27 +54,9 @@ set(_LIBUI_INCLUDEDIRS _LIBUI_INCLUDEDIRS PARENT_SCOPE) set(_LIBUINAME libui PARENT_SCOPE) if(NOT BUILD_SHARED_LIBS) - set(_LIBUINAME libui-temporary PARENT_SCOPE) + # set(_LIBUINAME libui-temporary PARENT_SCOPE) endif() macro(_handle_static) - set_target_properties(${_LIBUINAME} PROPERTIES - ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}") - set(_aname $) - set(_oname libui-combined.o) - add_custom_command( - OUTPUT ${_oname} - DEPENDS ${_LIBUINAME} - COMMAND - ${CMAKE_LINKER} -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? From b341514a221c49b0b444b6185947e4a4c00e9aeb Mon Sep 17 00:00:00 2001 From: Nadia Holmquist Pedersen Date: Sun, 10 May 2020 23:45:59 +0200 Subject: [PATCH 5/7] Use -Og for debug builds --- CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index aa33d4b7..0aa558d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -20,6 +20,10 @@ else() option(ENABLE_LTO "Enable link-time optimization" OFF) endif() +if (CMAKE_BUILD_TYPE STREQUAL Debug) + add_compile_options(-Og) +endif() + if(ENABLE_LTO) add_compile_options(-O3 -flto) add_link_options(-flto) From 57f33c208c5d02aba5cad74c539882e35b61e539 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Araujo?= Date: Mon, 11 May 2020 23:20:45 -0400 Subject: [PATCH 6/7] fix package name in readme --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a34b7ea4..cae06fa0 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ As for the rest, the interface should be pretty straightforward. If you have a q * Install dependencies: ```sh -sudo apt-get install gtk+-3.0 libcurl4-gnutls-dev libpcap0.8-dev libsdl2-dev +sudo apt-get install libgtk-3-dev libcurl4-gnutls-dev libpcap0.8-dev libsdl2-dev ``` * Compile: From d6d49a9f708aa7fbba0556e0caf779b940498f73 Mon Sep 17 00:00:00 2001 From: lucasjome <15149319+lucasjome@users.noreply.github.com> Date: Thu, 14 May 2020 01:51:39 -0300 Subject: [PATCH 7/7] Removing CodeBlocks reference from README.md Removing CodeBlocks reference from README.md --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index a34b7ea4..c3d5fe8f 100644 --- a/README.md +++ b/README.md @@ -52,10 +52,6 @@ make -j$(nproc --all) ### Windows: - * use CodeBlocks - -#### MSYS2 and CMake - 1. Install [MSYS2](https://www.msys2.org/) 2. Open the **MSYS2 MinGW 64-bit** terminal 3. Update the packages using `pacman -Syu` and reopen the terminal if it asks you to