0
0
Fork 0
haikuports/app-emulation/zesarux/patches/zesarux-9.2.patchset

333 lines
12 KiB
Plaintext

From 341ce1b8721392081848b08594ab1408915ea3cf Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 6 Sep 2021 21:58:38 +1000
Subject: Fixes for Haiku
diff --git a/src/configure b/src/configure
index 924d161..444b9d3 100755
--- a/src/configure
+++ b/src/configure
@@ -1643,7 +1643,7 @@ clean:
rm -f ZEsarUX-\$(EMULATOR_VERSION)-windows.zip
rm -f ZEsarUX-\$(EMULATOR_VERSION)-extras.zip
-COMMONFILES=ACKNOWLEDGEMENTS LICENSE LICENSES_info licenses Changelog TODO* README HISTORY FEATURES EXCLUSIVEFEATURES INSTALL INSTALLWINDOWS ALTERNATEROMS INCLUDEDTAPES DONATE FAQ *.odt mantransfev3.bin *.rom zxuno.flash tbblue.mmc speech_filters my_soft zesarux.mp3 zesarux.xcf editionnamegame.tap editionnamegame.tap.config bin_sprite_to_c.sh keyboard_*.bmp salamanquesa.bmp
+COMMONFILES=ACKNOWLEDGEMENTS LICENSE LICENSES_info licenses Changelog TODO* README HISTORY FEATURES EXCLUSIVEFEATURES INSTALL INSTALLWINDOWS ALTERNATEROMS INCLUDEDTAPES DONATE FAQ *.odt mantransfev3.bin *.rom zxuno.flash tbblue.mmc speech_filters my_soft zesarux.mp3 zesarux.xcf editionnamegame.tap editionnamegame.tap.config bin_sprite_to_c.sh keyboard_*.bmp salamanquesa.bmp cursor.bmp
ONLYSOURCEFILES=macos *.c *.m *.h *.tpl DEVELOPMENT CHECKLIST configure generate_install_sh.sh join_tzx.sh testsound.sh txt_to_basic_lines.sh automatic_tests.sh zxuno_roms_bin_a_flash.sh *.asm benchmark_*.txt current_checklist.txt patches prism_change_boot.txt
diff --git a/src/cpu.c b/src/cpu.c
index 2ab0c4b..b2a0ae6 100644
--- a/src/cpu.c
+++ b/src/cpu.c
@@ -261,8 +261,13 @@ driver_struct audio_driver_array[MAX_SCR_INIT];
int num_audio_driver_array=0;
//Los inicializamos a cadena vacia... No poner NULL, dado que hay varios strcmp que se comparan contra esto
+#ifdef __HAIKU__
+char *driver_screen="sdl";
+char *driver_audio="sdl";
+#else
char *driver_screen="";
char *driver_audio="";
+#endif
//porcentaje de velocidad de la cpu
@@ -9047,4 +9052,4 @@ void end_emulator_saveornot_config(int saveconfig)
void end_emulator(void)
{
end_emulator_saveornot_config(1);
-}
\ No newline at end of file
+}
diff --git a/src/cpu.h b/src/cpu.h
index a41f5aa..e123893 100644
--- a/src/cpu.h
+++ b/src/cpu.h
@@ -183,7 +183,7 @@ extern z80_bit core_end_frame_check_zrcp_zeng_snap;
//Para haiku
-#ifdef HAIKU_OS
+#ifdef __HAIKU__
//Para incluir PATH_MAX
#include <limits.h>
#endif
diff --git a/src/cursor.bmp b/src/cursor.bmp
new file mode 100644
index 0000000000000000000000000000000000000000..9841220b84366bb7024d3a0a18b4c6afca45290b
GIT binary patch
literal 1306
zcmd7Qv8~-Y3;<9E$OTgTE?p)F(h|r3zt0-niG9Xl{}#v|%%SY}W{8X<(6lVklK=np
z?RA~@^Ye9m7yZXqK3!i<{*V6mkDKH^I4$%^(F~VlkQB|Z1B0Y!hJ86mie}gegQRGN
zT_i|~W{^Es>WgOBVuGY-hAl8iie}iNgQRGN{g5CjnqfaKNQ!2#fYtL{rEiAagdi!J
zVK*j7ie}i&3X-B3b_0W?XolU?ASs%`MC#c}>RhcKcJqUzXofwIASs$*4=G5BX4r!Z
zlA;;*FoUFM1}~^*cV#Q-bB%rvJxGdX*dHNCie}iKBS?y7*dHcHie}KMN1mb?JW$V`
z(C*4sGUqZ_J@ORIU;_2XQ#6A~)gw>Q3>H$4JVi5D+!FE>&G4_c*WIq`30|-3?aj@d
zc;b^d>HF!O-uUeaPrSFM37&TCn7du?WA6DsvS-D;J0;xX?`lr`6t?jb-Zi`z{*isJ
M`T3xa?|Hrc0-Q97Gynhq
literal 0
HcmV?d00001
diff --git a/src/generate_install_sh.sh b/src/generate_install_sh.sh
index 4483009..54662b9 100755
--- a/src/generate_install_sh.sh
+++ b/src/generate_install_sh.sh
@@ -13,7 +13,7 @@ mkdir -p $INSTALLPREFIX
mkdir -p $INSTALLPREFIX/bin
mkdir -p $INSTALLPREFIX/share/zesarux/
-COMMONFILES="ACKNOWLEDGEMENTS LICENSE LICENSES_info licenses Changelog TODO* README HISTORY FEATURES EXCLUSIVEFEATURES INSTALL INSTALLWINDOWS ALTERNATEROMS INCLUDEDTAPES DONATE FAQ *.odt mantransfev3.bin *.rom zxuno.flash tbblue.mmc speech_filters my_soft zesarux.mp3 zesarux.xcf editionnamegame.tap editionnamegame.tap.config bin_sprite_to_c.sh keyboard_*.bmp salamanquesa.bmp"
+COMMONFILES="ACKNOWLEDGEMENTS LICENSE LICENSES_info licenses Changelog TODO* README HISTORY FEATURES EXCLUSIVEFEATURES INSTALL INSTALLWINDOWS ALTERNATEROMS INCLUDEDTAPES DONATE FAQ *.odt mantransfev3.bin *.rom zxuno.flash tbblue.mmc speech_filters my_soft zesarux.mp3 zesarux.xcf editionnamegame.tap editionnamegame.tap.config bin_sprite_to_c.sh keyboard_*.bmp salamanquesa.bmp cursor.bmp"
cp -a \$COMMONFILES $INSTALLPREFIX/share/zesarux/
diff --git a/src/m68kcpu.h b/src/m68kcpu.h
index 4a6e9a7..70d92a9 100644
--- a/src/m68kcpu.h
+++ b/src/m68kcpu.h
@@ -75,7 +75,7 @@
//Para haiku
-#ifdef HAIKU_OS
+#ifdef __HAIKU__
typedef unsigned int uint;
#else
diff --git a/src/menu.c b/src/menu.c
index b98a0e0..df86709 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1438,7 +1438,11 @@ void menu_chdir_sharedfiles(void)
zvfs_chdir("../Resources");
char installshare[PATH_MAX];
+#ifdef __HAIKU__
+ sprintf (installshare,"%s/%s",INSTALL_PREFIX,"/data/");
+#else
sprintf (installshare,"%s/%s",INSTALL_PREFIX,"/share/zesarux/");
+#endif
debug_printf(VERBOSE_INFO,"Trying %s",installshare);
zvfs_chdir(installshare);
diff --git a/src/scrsdl2.c b/src/scrsdl2.c
index 172bab5..c53b981 100644
--- a/src/scrsdl2.c
+++ b/src/scrsdl2.c
@@ -65,10 +65,14 @@ int scrsdl_debe_redimensionar=0;
unsigned char *scrsdl_pixeles;
SDL_Texture *scrsdl_texture;
-
+SDL_Texture *cursor_texture;
SDL_Renderer *renderer;
+float zoom_width = 1.0;
+float zoom_height = 1.0;
+Uint32 mouse_timer = 0;
+
//#define screen_get_window_size_width_zoom_border_en() screen_get_window_size_width_zoom_border_en()
#define SDL_ALTO_VENTANA screen_get_window_size_height_zoom_border_en()
@@ -84,7 +88,7 @@ int scrsdl_crea_ventana(void)
flags=SDL_WINDOW_RESIZABLE;
if (ventana_fullscreen) {
- flags |=SDL_WINDOW_FULLSCREEN;
+ flags |=SDL_WINDOW_FULLSCREEN_DESKTOP;
}
@@ -112,6 +116,7 @@ int scrsdl_crea_ventana(void)
SDL_SetWindowTitle(window,"ZEsarUX "EMULATOR_VERSION);
+ SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "1");
scrsdl_texture = SDL_CreateTexture(renderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STATIC, ancho, SDL_ALTO_VENTANA);
//Uint32 *pixels = new Uint32[screen_get_window_size_width_zoom_border_en() * SDL_ALTO_VENTANA];
@@ -122,7 +127,7 @@ int scrsdl_crea_ventana(void)
scr_reallocate_layers_menu(ancho,alto);
- if (mouse_pointer_shown.v==0) SDL_ShowCursor(0);
+ SDL_ShowCursor(SDL_DISABLE);
modificado_border.v=1;
@@ -130,7 +135,15 @@ int scrsdl_crea_ventana(void)
menu_init_footer();
-
+#ifdef __HAIKU__
+ SDL_Surface *cursor = SDL_LoadBMP(INSTALL_PREFIX "/data/cursor.bmp");
+#else
+ SDL_Surface *cursor = SDL_LoadBMP(INSTALL_PREFIX "/share/zesarux/cursor.bmp");
+#endif
+ SDL_SetColorKey(cursor, SDL_TRUE, SDL_MapRGB(cursor->format, 0, 0, 255));
+ cursor_texture = SDL_CreateTextureFromSurface(renderer, cursor);
+ SDL_SetTextureBlendMode(cursor_texture, SDL_BLENDMODE_BLEND);
+ SDL_FreeSurface(cursor);
return 0;
@@ -283,13 +296,39 @@ void scrsdl_refresca_border(void)
void scrsdl_refresca_pantalla_solo_driver(void)
{
+ int window_width, window_height;
+ int texture_width, texture_height;
+ SDL_Rect texture_frame;
int ancho=screen_get_window_size_width_zoom_border_en();
ancho +=screen_get_ext_desktop_width_zoom();
SDL_UpdateTexture(scrsdl_texture, NULL, scrsdl_pixeles, ancho * 4);
+ SDL_GetWindowSize(window, &window_width, &window_height);
+ SDL_QueryTexture(scrsdl_texture, NULL, NULL, &texture_width, &texture_height);
+
+ zoom_width = (float)window_width / (float)texture_width;
+ zoom_height = (float)window_height / (float)texture_height;
+
+ if (window_width >= window_height) {
+ texture_frame.w = (float)texture_width * zoom_height;
+ texture_frame.h = (float)texture_height * zoom_height;
+ texture_frame.x = (window_width - texture_frame.w) / 2;
+ texture_frame.y = 0;
+ } else {
+ texture_frame.w = (float)texture_width * zoom_width;
+ texture_frame.h = (float)texture_height * zoom_width;
+ texture_frame.x = 0;
+ texture_frame.y = (window_height - texture_frame.h) / 2;
+ }
SDL_RenderClear(renderer);
- SDL_RenderCopy(renderer, scrsdl_texture, NULL, NULL);
+ SDL_RenderCopy(renderer, scrsdl_texture, NULL, &texture_frame);
+ if (mouse_pointer_shown.v != 0 && cursor_texture!=NULL) {
+ if (SDL_GetTicks() - mouse_timer < 2000) {
+ SDL_Rect mouse_rect = {mouse_x * zoom_width, mouse_y * zoom_height, 12, 19};
+ SDL_RenderCopy(renderer, cursor_texture, NULL, &mouse_rect);
+ }
+ }
SDL_RenderPresent(renderer);
}
@@ -1443,23 +1482,11 @@ See the SDL documentation. Scancodes represent the physical position of the keys
}
-
-
- //resize
- //if (event.type==SDL_WINDOWEVENT_SIZE_CHANGED) {
- if (scrsdl_recibido_resize(&event)) {
-
- scrsdl_resize(event.window.data1, event.window.data2);
-
- }
-
-
//mouse motion
if (event.type==SDL_MOUSEMOTION) {
- mouse_x=event.motion.x;
- mouse_y=event.motion.y;
-
-
+ mouse_timer = SDL_GetTicks();
+ mouse_x=(float)event.motion.x / zoom_width;
+ mouse_y=(float)event.motion.y / zoom_height;
kempston_mouse_x=mouse_x/zoom_x;
kempston_mouse_y=255-mouse_y/zoom_y;
@@ -1471,7 +1498,7 @@ See the SDL documentation. Scancodes represent the physical position of the keys
//mouse button
if (event.type==SDL_MOUSEBUTTONDOWN) {
-
+ mouse_timer = SDL_GetTicks();
debug_printf (VERBOSE_DEBUG,"Mouse Button Press. x=%d y=%d", event.button.x, event.button.y);
if ( event.button.button == SDL_BUTTON_LEFT ) {
@@ -1496,6 +1523,7 @@ See the SDL documentation. Scancodes represent the physical position of the keys
}
if (event.type==SDL_MOUSEBUTTONUP) {
+ mouse_timer = SDL_GetTicks();
debug_printf (VERBOSE_DEBUG,"Mouse Button release. x=%d y=%d", event.button.x, event.button.y);
if ( event.button.button == SDL_BUTTON_LEFT ) {
//mouse_left=0;
diff --git a/src/utils.c b/src/utils.c
index 2c04911..d0f5144 100644
--- a/src/utils.c
+++ b/src/utils.c
@@ -1197,7 +1197,11 @@ void old_open_sharedfile(char *archivo,FILE **f)
//sino, en INSTALLPREFIX/share/zesarux
if (!(*f)) {
+#ifdef __HAIKU__
+ sprintf(buffer_nombre,"%s/%s/%s",INSTALL_PREFIX,"/data/",archivo);
+#else
sprintf(buffer_nombre,"%s/%s/%s",INSTALL_PREFIX,"/share/zesarux/",archivo);
+#endif
debug_printf(VERBOSE_INFO,"Looking for file %s",buffer_nombre);
*f=fopen(buffer_nombre,"rb");
}
@@ -1232,7 +1236,11 @@ int find_sharedfile(char *archivo,char *ruta_final)
//sino, en INSTALLPREFIX/share/zesarux
if (!existe) {
+#ifdef __HAIKU__
+ sprintf(buffer_nombre,"%s/%s/%s",INSTALL_PREFIX,"/data/",archivo);
+#else
sprintf(buffer_nombre,"%s/%s/%s",INSTALL_PREFIX,"/share/zesarux/",archivo);
+#endif
debug_printf(VERBOSE_INFO,"Looking for file %s",buffer_nombre);
existe=si_existe_archivo(buffer_nombre);
}
@@ -1303,7 +1311,11 @@ void open_sharedfile_write(char *archivo,FILE **f)
//sino, en INSTALLPREFIX/share/zesarux
if (!(*f)) {
+#ifdef __HAIKU__
+ sprintf(buffer_nombre,"%s/%s/%s",INSTALL_PREFIX,"/data/",archivo);
+#else
sprintf(buffer_nombre,"%s/%s/%s",INSTALL_PREFIX,"/share/zesarux/",archivo);
+#endif
debug_printf(VERBOSE_INFO,"Looking for file %s",buffer_nombre);
open_sharedfile_write_open(buffer_nombre,f);
}
diff --git a/src/utils.h b/src/utils.h
index b35b224..6c8d6d7 100644
--- a/src/utils.h
+++ b/src/utils.h
@@ -22,7 +22,7 @@
#ifndef UTILS_H
#define UTILS_H
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__HAIKU__)
#include <limits.h>
#endif
@@ -612,7 +612,11 @@ extern void convert_numeros_letras_puerto_teclado_continue(z80_byte tecla,int pr
extern int util_tape_tap_get_info(z80_byte *tape,char *texto);
+#ifdef __HAIKU__
+#define DEFAULT_ZESARUX_CONFIG_FILE "config/settings/zesaruxrc"
+#else
#define DEFAULT_ZESARUX_CONFIG_FILE ".zesaruxrc"
+#endif
extern char *customconfigfile;
--
2.30.2