From 12553d1d253460e612bc54dab590ae121af23a22 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Thu, 21 Jan 2021 12:45:30 +1000 Subject: [PATCH] Julius: bump version --- ...ulius-1.3.1.recipe => julius-1.6.0.recipe} | 4 +- .../julius/patches/julius-1.3.1.patchset | 345 ------------------ .../julius/patches/julius-1.6.0.patchset | 102 ++++++ 3 files changed, 105 insertions(+), 346 deletions(-) rename games-strategy/julius/{julius-1.3.1.recipe => julius-1.6.0.recipe} (95%) delete mode 100644 games-strategy/julius/patches/julius-1.3.1.patchset create mode 100644 games-strategy/julius/patches/julius-1.6.0.patchset diff --git a/games-strategy/julius/julius-1.3.1.recipe b/games-strategy/julius/julius-1.6.0.recipe similarity index 95% rename from games-strategy/julius/julius-1.3.1.recipe rename to games-strategy/julius/julius-1.6.0.recipe index c213355f8..c266ac166 100644 --- a/games-strategy/julius/julius-1.3.1.recipe +++ b/games-strategy/julius/julius-1.6.0.recipe @@ -13,7 +13,7 @@ COPYRIGHT="Bianca van Schaik" LICENSE="GNU GPL v3" REVISION="1" SOURCE_URI="https://github.com/bvschaik/julius/archive/v$portVersion.tar.gz" -CHECKSUM_SHA256="7ffbee8f05c6e4b03615853b366c4e3a7037e22c63929fdeae1bedb1f1ebea73" +CHECKSUM_SHA256="f50eade82c1f011a642a89ec526fe9e9589ac44ffa6041e072577336233b8166" srcGitRev2="0eaa8f0d4c7e92d522974a3530da8e5d63a722de" SOURCE_URI_2="https://github.com/EXL/BeGameLauncher/archive/$srcGitRev2.tar.gz" CHECKSUM_SHA256_2="85e94ba8174879d986f3a9d35898bfa5eb67728c3910a41aca2ad143db803a88" @@ -32,6 +32,7 @@ REQUIRES=" haiku$secondaryArchSuffix lib:libgl$secondaryArchSuffix lib:libintl$secondaryArchSuffix + lib:libpng16$secondaryArchSuffix lib:libsdl2_2.0$secondaryArchSuffix lib:libsdl2_mixer_2.0$secondaryArchSuffix lib:libz$secondaryArchSuffix @@ -41,6 +42,7 @@ BUILD_REQUIRES=" haiku${secondaryArchSuffix}_devel devel:libgl$secondaryArchSuffix devel:libintl$secondaryArchSuffix + devel:libpng16$secondaryArchSuffix devel:libsdl2_2.0$secondaryArchSuffix devel:libsdl2_mixer_2.0$secondaryArchSuffix devel:libz$secondaryArchSuffix diff --git a/games-strategy/julius/patches/julius-1.3.1.patchset b/games-strategy/julius/patches/julius-1.3.1.patchset deleted file mode 100644 index 171e59f32..000000000 --- a/games-strategy/julius/patches/julius-1.3.1.patchset +++ /dev/null @@ -1,345 +0,0 @@ -From 86840c5c8d290d2e66df7f2c22b10c7314bb8d4a Mon Sep 17 00:00:00 2001 -From: Gerasim Troeglazov <3dEyes@gmail.com> -Date: Fri, 1 May 2020 21:01:19 +1000 -Subject: Add Haiku support - - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 1ec88a2..ff9e355 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -188,6 +188,12 @@ elseif (SWITCH_BUILD) - ${PROJECT_SOURCE_DIR}/src/platform/switch/switch_touch.c - ${PROJECT_SOURCE_DIR}/src/platform/switch/switch_keyboard.c - ) -+elseif (HAIKU_BUILD) -+ set(PLATFORM_FILES -+ ${PLATFORM_FILES} -+ ${PROJECT_SOURCE_DIR}/src/platform/haiku/cursor.c -+ ${PROJECT_SOURCE_DIR}/src/platform/haiku/screen.c -+ ) - else() - set(PLATFORM_FILES - ${PLATFORM_FILES} -diff --git a/src/core/backtrace.c b/src/core/backtrace.c -index b676e38..20ff0ee 100644 ---- a/src/core/backtrace.c -+++ b/src/core/backtrace.c -@@ -2,7 +2,7 @@ - - #include "core/log.h" - --#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(__OpenBSD__) && !defined(__vita__) && !defined(__SWITCH__) -+#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(__OpenBSD__) && !defined(__vita__) && !defined(__SWITCH__) && !defined(__HAIKU__) - - #include - -diff --git a/src/game/settings.c b/src/game/settings.c -index fc206c8..ecba257 100644 ---- a/src/game/settings.c -+++ b/src/game/settings.c -@@ -41,7 +41,7 @@ static struct { - - static void load_default_settings(void) - { -- data.fullscreen = 1; -+ data.fullscreen = 0; - data.window_width = 800; - data.window_height = 600; - -@@ -70,7 +70,7 @@ static void load_default_settings(void) - static void load_settings(buffer *buf) - { - buffer_skip(buf, 4); -- data.fullscreen = buffer_read_i32(buf); -+ data.fullscreen = 0; - buffer_skip(buf, 3); - data.sound_effects.enabled = buffer_read_u8(buf); - data.sound_music.enabled = buffer_read_u8(buf); -@@ -127,7 +127,7 @@ void settings_load(void) - buffer_init(&buf, data.inf_file, size); - load_settings(&buf); - -- if (data.window_width + data.window_height < 500) { -+ if (data.window_width < 800 || data.window_height < 600) { - // most likely migration from Caesar 3 - data.window_width = 800; - data.window_height = 600; -diff --git a/src/platform/haiku/cursor.c b/src/platform/haiku/cursor.c -new file mode 100644 -index 0000000..953b4e8 ---- /dev/null -+++ b/src/platform/haiku/cursor.c -@@ -0,0 +1,64 @@ -+#include "graphics/color.h" -+#include "game/system.h" -+#include "input/cursor.h" -+#include "platform/cursor.h" -+ -+#include "haiku.h" -+ -+#include "SDL.h" -+ -+#define CURSOR_SIZE 32 -+#define ALPHA_OPAQUE (0xFFu << 24) -+ -+static haiku_cursor cursors[CURSOR_MAX]; -+haiku_cursor *current_cursor; -+ -+extern struct { -+ SDL_Window *window; -+ SDL_Renderer *renderer; -+ SDL_Texture *texture; -+} SDL; -+ -+static SDL_Texture *init_cursor(const cursor *c) -+{ -+ SDL_Texture *tex = SDL_CreateTexture(SDL.renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STATIC, CURSOR_SIZE, CURSOR_SIZE); -+ -+ uint32_t pixels[CURSOR_SIZE * CURSOR_SIZE] = { 0 }; -+ -+ for (int y = 0; y < c->height; y++) { -+ for (int x = 0; x < c->width; x++) { -+ switch (c->data[y * c->width + x]) { -+ case '#': -+ pixels[y * CURSOR_SIZE + x] = COLOR_BLACK | ALPHA_OPAQUE; -+ break; -+ case '\'': -+ pixels[y * CURSOR_SIZE + x] = COLOR_WHITE | ALPHA_OPAQUE; -+ break; -+ case ' ': -+ pixels[y * CURSOR_SIZE + x] = 0x00000000; // transparent -+ break; -+ } -+ } -+ } -+ -+ SDL_UpdateTexture(tex, NULL, pixels, CURSOR_SIZE * 4); -+ SDL_SetTextureBlendMode(tex, SDL_BLENDMODE_BLEND); -+ -+ return tex; -+} -+ -+void platform_init_cursors(int scale_percentage) -+{ -+ for (int i = 0; i < CURSOR_MAX; i++) { -+ const cursor *c = input_cursor_data(i, CURSOR_SCALE_1); -+ cursors[i].texture = init_cursor(c); -+ cursors[i].hotspot_x = c->hotspot_x; -+ cursors[i].hotspot_y = c->hotspot_y; -+ } -+ system_set_cursor(CURSOR_ARROW); -+} -+ -+void system_set_cursor(int cursor_id) -+{ -+ current_cursor = &cursors[cursor_id]; -+} -diff --git a/src/platform/haiku/haiku.h b/src/platform/haiku/haiku.h -new file mode 100644 -index 0000000..4d8179a ---- /dev/null -+++ b/src/platform/haiku/haiku.h -@@ -0,0 +1,17 @@ -+#ifndef PLATFORM_HAIKU_H -+#define PLATFORM_HAIKU_H -+ -+#include "SDL.h" -+ -+extern int last_mouse_x; -+extern int last_mouse_y; -+ -+typedef struct { -+ SDL_Texture *texture; -+ int hotspot_x; -+ int hotspot_y; -+} haiku_cursor; -+ -+extern haiku_cursor *current_cursor; -+ -+#endif -diff --git a/src/platform/haiku/screen.c b/src/platform/haiku/screen.c -new file mode 100644 -index 0000000..f737ceb ---- /dev/null -+++ b/src/platform/haiku/screen.c -@@ -0,0 +1,176 @@ -+#include "platform/screen.h" -+ -+#include "SDL.h" -+ -+#include "game/settings.h" -+#include "graphics/graphics.h" -+#include "graphics/screen.h" -+#include "input/mouse.h" -+ -+#include "haiku.h" -+ -+struct { -+ SDL_Window *window; -+ SDL_Renderer *renderer; -+ SDL_Texture *texture; -+} SDL = {0, 0, 0}; -+ -+static struct { -+ int x; -+ int y; -+} window_pos = { 100, 100 }; -+ -+static struct { -+ const int WIDTH; -+ const int HEIGHT; -+} MINIMUM = { 800, 600 }; -+ -+int platform_screen_create(const char *title, int display_scale_percentage) -+{ -+ int width, height; -+ int fullscreen = 0; -+ SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "best"); -+ -+ if (fullscreen) { -+ SDL_DisplayMode mode; -+ SDL_GetDesktopDisplayMode(0, &mode); -+ width = mode.w; -+ height = mode.h; -+ } else { -+ setting_window(&width, &height); -+ } -+ -+ platform_screen_destroy(); -+ -+ SDL_Log("Creating screen %d x %d, fullscreen? %d\n", width, height, fullscreen); -+ Uint32 flags = SDL_WINDOW_RESIZABLE; -+ if (fullscreen) { -+ flags |= SDL_WINDOW_FULLSCREEN_DESKTOP; -+ } -+ SDL.window = SDL_CreateWindow(title, -+ window_pos.x, window_pos.y, -+ width, height, flags); -+ if (!SDL.window) { -+ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create window: %s", SDL_GetError()); -+ return 0; -+ } -+ -+ SDL.renderer = SDL_CreateRenderer(SDL.window, -1, SDL_RENDERER_PRESENTVSYNC); -+ if (!SDL.renderer) { -+ SDL_Log("Unable to create renderer, trying software renderer: %s", SDL_GetError()); -+ SDL.renderer = SDL_CreateRenderer(SDL.window, -1, SDL_RENDERER_PRESENTVSYNC | SDL_RENDERER_SOFTWARE); -+ if (!SDL.renderer) { -+ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create renderer: %s", SDL_GetError()); -+ return 0; -+ } -+ } -+ -+ SDL_ShowCursor(SDL_DISABLE); -+ -+ SDL_SetWindowMinimumSize(SDL.window, MINIMUM.WIDTH, MINIMUM.HEIGHT); -+ -+ return platform_screen_resize(width, height); -+} -+ -+void platform_screen_destroy(void) -+{ -+ if (SDL.texture) { -+ SDL_DestroyTexture(SDL.texture); -+ SDL.texture = 0; -+ } -+ if (SDL.renderer) { -+ SDL_DestroyRenderer(SDL.renderer); -+ SDL.renderer = 0; -+ } -+ if (SDL.window) { -+ SDL_DestroyWindow(SDL.window); -+ SDL.window = 0; -+ } -+} -+ -+int platform_screen_resize(int width, int height) -+{ -+ if (SDL.texture) { -+ SDL_DestroyTexture(SDL.texture); -+ SDL.texture = 0; -+ } -+ -+ setting_set_display(setting_fullscreen(), width, height); -+ SDL.texture = SDL_CreateTexture(SDL.renderer, -+ SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, -+ width, height); -+ if (SDL.texture) { -+ SDL_Log("Texture created (%d x %d)", width, height); -+ screen_set_resolution(width, height); -+ return 1; -+ } else { -+ SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Unable to create texture: %s", SDL_GetError()); -+ return 0; -+ } -+} -+ -+void platform_screen_set_fullscreen(void) -+{ -+ SDL_GetWindowPosition(SDL.window, &window_pos.x, &window_pos.y); -+ int orig_w, orig_h; -+ SDL_GetWindowSize(SDL.window, &orig_w, &orig_h); -+ SDL_DisplayMode mode; -+ SDL_GetDesktopDisplayMode(SDL_GetWindowDisplayIndex(SDL.window), &mode); -+ SDL_Log("User to fullscreen %d x %d\n", mode.w, mode.h); -+ if (0 != SDL_SetWindowFullscreen(SDL.window, SDL_WINDOW_FULLSCREEN_DESKTOP)) { -+ SDL_Log("Unable to enter fullscreen: %s\n", SDL_GetError()); -+ return; -+ } -+ SDL_SetWindowDisplayMode(SDL.window, &mode); -+ setting_set_display(1, mode.w, mode.h); -+} -+ -+void platform_screen_set_windowed(void) -+{ -+ int width, height; -+ setting_window(&width, &height); -+ SDL_Log("User to windowed %d x %d\n", width, height); -+ SDL_SetWindowFullscreen(SDL.window, 0); -+ SDL_SetWindowSize(SDL.window, width, height); -+ SDL_SetWindowPosition(SDL.window, window_pos.x, window_pos.y); -+ setting_set_display(0, width, height); -+} -+ -+void platform_screen_set_window_size(int width, int height) -+{ -+ if (setting_fullscreen()) { -+ SDL_SetWindowFullscreen(SDL.window, 0); -+ } -+ SDL_SetWindowSize(SDL.window, width, height); -+ SDL_SetWindowPosition(SDL.window, window_pos.x, window_pos.y); -+ SDL_Log("User resize to %d x %d\n", width, height); -+ setting_set_display(0, width, height); -+} -+ -+void platform_screen_center_window(void) -+{ -+ SDL_SetWindowPosition(SDL.window, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED); -+} -+ -+void platform_screen_render(void) -+{ -+ SDL_UpdateTexture(SDL.texture, NULL, graphics_canvas(), screen_width() * 4); -+ SDL_RenderCopy(SDL.renderer, SDL.texture, NULL, NULL); -+ -+ const mouse *mouse = mouse_get(); -+ SDL_Rect dst; -+ dst.x = mouse->x - current_cursor->hotspot_x; -+ dst.y = mouse->y - current_cursor->hotspot_y; -+ dst.w = 32; -+ dst.h = 32; -+ SDL_RenderCopy(SDL.renderer, current_cursor->texture, NULL, &dst); -+ -+ SDL_RenderPresent(SDL.renderer); -+} -+ -+void platform_screen_move(int x, int y) -+{ -+ window_pos.x = x; -+ window_pos.y = y; -+ SDL_SetWindowPosition(SDL.window, x, y); -+} --- -2.26.0 - diff --git a/games-strategy/julius/patches/julius-1.6.0.patchset b/games-strategy/julius/patches/julius-1.6.0.patchset new file mode 100644 index 000000000..bd3339da7 --- /dev/null +++ b/games-strategy/julius/patches/julius-1.6.0.patchset @@ -0,0 +1,102 @@ +From 964acc1dafc8dbf527f1af8afdba1b3f995ac025 Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Thu, 21 Jan 2021 12:26:08 +1000 +Subject: Add Haiku support + + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c4d8582..68defec 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -813,6 +813,8 @@ elseif(SWITCH_BUILD) + COMMAND ${DEVKITPRO}/tools/bin/nacptool --create "${SHORT_NAME}" "rsn8887" ${SWITCH_VERSION} ${SHORT_NAME}.nacp + COMMAND ${DEVKITPRO}/tools/bin/elf2nro ${SHORT_NAME} ${SHORT_NAME}.nro --icon=${CMAKE_SOURCE_DIR}/res/switch/icon0.jpg --nacp=${SHORT_NAME}.nacp + ) ++elseif (HAIKU_BUILD) ++ target_link_libraries (${SHORT_NAME} ${SDL2_LIBRARY} ${SDL2_MIXER_LIBRARY}) + else() + if (UNIX AND NOT APPLE AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID STREQUAL "Clang")) + target_link_libraries(${SHORT_NAME} m) +diff --git a/src/core/backtrace.c b/src/core/backtrace.c +index 75f35fe..374fcdd 100644 +--- a/src/core/backtrace.c ++++ b/src/core/backtrace.c +@@ -2,7 +2,7 @@ + + #include "core/log.h" + +-#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(__OpenBSD__) && !defined(__vita__) && !defined(__SWITCH__) && !defined(__ANDROID__) ++#if defined(__GNUC__) && !defined(__MINGW32__) && !defined(__OpenBSD__) && !defined(__vita__) && !defined(__SWITCH__) && !defined(__ANDROID__) && !defined(__HAIKU__) + + #include + +diff --git a/src/game/settings.c b/src/game/settings.c +index 074c6b7..8a67224 100644 +--- a/src/game/settings.c ++++ b/src/game/settings.c +@@ -41,7 +41,7 @@ static struct { + + static void load_default_settings(void) + { +- data.fullscreen = 1; ++ data.fullscreen = 0; + data.window_width = 800; + data.window_height = 600; + +@@ -70,7 +70,7 @@ static void load_default_settings(void) + static void load_settings(buffer *buf) + { + buffer_skip(buf, 4); +- data.fullscreen = buffer_read_i32(buf); ++ data.fullscreen = 0; + buffer_skip(buf, 3); + data.sound_effects.enabled = buffer_read_u8(buf); + data.sound_music.enabled = buffer_read_u8(buf); +@@ -127,7 +127,7 @@ void settings_load(void) + buffer_init(&buf, data.inf_file, size); + load_settings(&buf); + +- if (data.window_width + data.window_height < 500) { ++ if (data.window_width < 800 || data.window_height < 600) { + // most likely migration from Caesar 3 + data.window_width = 800; + data.window_height = 600; +diff --git a/src/platform/cursor.c b/src/platform/cursor.c +index cde3ba2..04d65cb 100644 +--- a/src/platform/cursor.c ++++ b/src/platform/cursor.c +@@ -4,6 +4,7 @@ + #include "graphics/color.h" + #include "input/cursor.h" + #include "platform/screen.h" ++#include "platform/haiku/haiku.h" + #include "platform/switch/switch.h" + #include "platform/vita/vita.h" + +diff --git a/src/platform/haiku/haiku.h b/src/platform/haiku/haiku.h +new file mode 100644 +index 0000000..e4f9d40 +--- /dev/null ++++ b/src/platform/haiku/haiku.h +@@ -0,0 +1,6 @@ ++#ifndef PLATFORM_HAIKU_H ++#define PLATFORM_HAIKU_H ++ ++#define PLATFORM_USE_SOFTWARE_CURSOR ++ ++#endif +diff --git a/src/platform/screen.c b/src/platform/screen.c +index 071dbb8..840f9e7 100644 +--- a/src/platform/screen.c ++++ b/src/platform/screen.c +@@ -11,6 +11,7 @@ + #include "platform/cursor.h" + #include "platform/switch/switch.h" + #include "platform/vita/vita.h" ++#include "platform/haiku/haiku.h" + + #include "SDL.h" + +-- +2.30.0 +