Commit 7732d3fa authored by CeRiAl's avatar CeRiAl

COMMON: Several fixes

Fixes for sdl-gui, gfx-curses and od-macosx (when used wo/cocoa-gui)
parent 13fcdca5
......@@ -1218,12 +1218,13 @@ if [[ "x$WANT_UI" = "xno" ]]; then
GUI_DEP=gui-none
GUI_LIBS=
GUI_NAME=none
fi
else
dnl
dnl Hack for building Cocoa gui on OS X
dnl We really should reall check for the presence of objc and Cocoa first
if [[ "$HOST_OS" = "darwin" ]]; then
if [[ "x$WANT_COCOA_UI" != "xno" -o "x$HAVE_GTK" = "xno" ]]; then
dnl We really should really check for the presence of objc and Cocoa first
dnl
if [[ "x$HOST_OS" = "xdarwin" ]]; then
if [[ "x$WANT_COCOA_UI" != "xno" ]]; then
GUI_DEP=gui-cocoa
GUI_CFLAGS="$CFLAGS -DNO_MAIN_IN_MAIN_C"
GUI_LIBS="-framework Cocoa"
......@@ -1231,9 +1232,9 @@ fi
fi
fi
dnl
dnl QT GUI
dnl
dnl
dnl QT GUI
dnl
if [[ "x$WANT_QT" = "xyes" ]]; then
if [[ "x$HAVE_QT" = "xyes" ]]; then
GUI_DEP=gui-qt
......@@ -1248,19 +1249,13 @@ dnl
fi
fi
if [[ "$GUI_DEP" = "gui-none" ]]; then
if [[ "x$HAVE_GTK" = "xno" ]]; then
if [[ "x$HAVE_SDL" = "xno" ]]; then
AC_MSG_WARN([UI wanted, but no UI useable target found])
NR_ERRORS=`expr $NR_ERRORS + 1`
WANT_UI=no
else
GUI_DEP=gui-sdl
GUI_LIBS="-lSDL_image -lSDL_ttf $SDL_LIBS"
GUI_NAME="SDL"
GUI_CFLAGS="$CFLAGS"
fi
else
dnl
dnl GTK GUI
dnl
if [[ "x$HAVE_GTK" = "xyes" ]]; then
GUI_DEP=gui-gtk
GUI_LIBS="$GTK_LIBS"
GUI_NAME="GTK+"
......@@ -1270,8 +1265,35 @@ dnl
AC_MSG_ERROR([Thread support disabled, but GTK+ UI requires threads])
fi
fi
dnl
dnl SDL GUI
dnl We really should really check for the presence of SDL_image and SDL_ttf first
dnl
if [[ "x$WANT_SDL_UI" = "xyes" -o "x$GUI_DEP" = "xgui-none" ]]; then
if [[ "x$HAVE_SDL" = "xyes" ]]; then
WANT_SDL_UI=yes
GUI_DEP=gui-sdl
GUI_NAME="SDL"
if [[ "$HOST_OS" = "darwin" ]]; then
dnl Assume this is MacOS X and try to use SDL_ttf and SDL_image frameworks
GUI_LIBS="$SDL_LIBS -framework SDL_image -framework SDL_ttf"
GUI_CFLAGS="$CFLAGS -I/Library/Frameworks/SDL_image.framework/Headers -I/Library/Frameworks/SDL_ttf.framework/Headers"
WANT_COCOA_UI=no
else
GUI_LIBS="$SDL_LIBS -lSDL_image -lSDL_ttf"
GUI_CFLAGS="$CFLAGS"
fi
fi
fi
if [[ "$GUI_DEP" = "gui-none" ]]; then
AC_MSG_WARN([UI wanted, but no UI useable target found])
NR_ERRORS=`expr $NR_ERRORS + 1`
WANT_UI=no
fi
fi
AC_MSG_RESULT("$GUI_NAME")
......@@ -1650,6 +1672,14 @@ if [[ "x$WANT_SDL" = "xyes" ]]; then
fi
dnl
dnl Are we using a Cocoa GUI?
dnl
if [[ "x$WANT_COCOA_UI" == "xyes" ]]; then
UAE_DEFINES="$UAE_DEFINES -DUSE_COCOA_GUI"
fi
dnl
dnl Check for CAPS API
dnl
......
......@@ -95,8 +95,8 @@ if SDL_UI
cp -R $(srcdir)/gui-sdl/fonts $(bundle_contents)/MacOS
cp -R $(srcdir)/gui-sdl/images $(bundle_contents)/MacOS
endif
$(INSTALL_DATA) od-macosx/puae.icns $(bundle_contents)/Resources/
$(INSTALL_DATA) od-macosx/Credits.rtf $(bundle_contents)/Resources/
$(INSTALL_DATA) $(srcdir)/od-macosx/puae.icns $(bundle_contents)/Resources/
$(INSTALL_DATA) $(srcdir)/od-macosx/Credits.rtf $(bundle_contents)/Resources/
endif
noinst_LIBRARIES = \
......
......@@ -8,3 +8,5 @@
#define GFX_NAME "curses"
#define USE_CURSES_GFX
#define PICASSO96_SUPPORTED
#define PICASSO96
......@@ -31,8 +31,11 @@
#include "inputdevice.h"
#include "keyboard.h"
#include "keybuf.h"
#include "../keymap/keymap.h"
#include "disk.h"
#include "debug.h"
#include "picasso96.h"
#ifdef HAVE_NCURSES_H
#include <ncurses.h>
......@@ -323,10 +326,10 @@ static int getgraycol (int x, int y)
xl = x_map[x+1] - (xs = x_map[x]);
yl = y_map[y+1] - (ys = y_map[y]);
bufpt = ((uae_u8 *)gfxvidinfo.bufmem) + ys*currprefs.gfx_width + xs;
bufpt = ((uae_u8 *)gfxvidinfo.bufmem) + ys*currprefs.gfx_size.width + xs;
cm = c = 0;
for(y = 0; y < yl; y++, bufpt += currprefs.gfx_width)
for(y = 0; y < yl; y++, bufpt += currprefs.gfx_size.width)
for(x = 0; x < xl; x++) {
c += bufpt[x];
++cm;
......@@ -350,10 +353,10 @@ static int getcol (int x, int y)
xl = x_map[x+1] - (xs = x_map[x]);
yl = y_map[y+1] - (ys = y_map[y]);
bufpt = ((uae_u16 *)gfxvidinfo.bufmem) + ys*currprefs.gfx_width + xs;
bufpt = ((uae_u16 *)gfxvidinfo.bufmem) + ys*currprefs.gfx_size.width + xs;
cm = c = 0;
for(y = 0; y < yl; y++, bufpt += currprefs.gfx_width)
for(y = 0; y < yl; y++, bufpt += currprefs.gfx_size.width)
for(x = 0; x < xl; x++) {
int v = bufpt[x];
int cnt;
......@@ -464,17 +467,17 @@ int graphics_init (void)
/* we have a 320x256x8 pseudo screen */
currprefs.gfx_width = 320;
currprefs.gfx_height = 256;
currprefs.gfx_lores = 1;
currprefs.gfx_size.width = 320;
currprefs.gfx_size.height = 256;
currprefs.gfx_lores_mode = 1;
currprefs.gfx_vresolution = 0;
gfxvidinfo.width = currprefs.gfx_width;
gfxvidinfo.height = currprefs.gfx_height;
gfxvidinfo.width = currprefs.gfx_size.width;
gfxvidinfo.height = currprefs.gfx_size.height;
gfxvidinfo.maxblocklines = MAXBLOCKLINES_MAX;
gfxvidinfo.pixbytes = currprefs.color_mode < 2 ? 1 : 2;
gfxvidinfo.rowbytes = gfxvidinfo.pixbytes * currprefs.gfx_width;
gfxvidinfo.bufmem = (uae_u8 *)calloc(gfxvidinfo.rowbytes, currprefs.gfx_height+1);
gfxvidinfo.rowbytes = gfxvidinfo.pixbytes * currprefs.gfx_size.width;
gfxvidinfo.bufmem = (uae_u8 *)calloc(gfxvidinfo.rowbytes, currprefs.gfx_size.height+1);
gfxvidinfo.linemem = 0;
gfxvidinfo.emergmem = 0;
switch (gfxvidinfo.pixbytes) {
......@@ -493,9 +496,9 @@ int graphics_init (void)
}
for (i = 0; i < sizeof x_map / sizeof *x_map; i++)
x_map[i] = (i * currprefs.gfx_width) / COLS;
x_map[i] = (i * currprefs.gfx_size.width) / COLS;
for (i = 0; i < sizeof y_map / sizeof *y_map; i++)
y_map[i] = (i * currprefs.gfx_height) / LINES;
y_map[i] = (i * currprefs.gfx_size.height) / LINES;
for (i = 0; i < sizeof y_map / sizeof *y_map - 1; i++) {
int l1 = y_map[i];
int l2 = y_map[i+1];
......@@ -921,3 +924,53 @@ int gfx_parse_option (struct uae_prefs *p, const char *option, const char *value
{
return (cfgfile_yesno (option, value, "reverse_video", &p->curses_reverse_video));
}
int DX_Fill (int dstx, int dsty, int width, int height, uae_u32 color, RGBFTYPE rgbtype)
{
/* not implemented yet */
return 0;
}
void gfx_set_picasso_modeinfo (uae_u32 w, uae_u32 h, uae_u32 depth, RGBFTYPE rgbfmt)
{
}
void DX_Invalidate (int first, int last)
{
}
int DX_FillResolutions (uae_u16 *ppixel_format)
{
/* not implemented yet */
return 0;
}
uae_u8 *gfx_lock_picasso (void)
{
/* not implemented yet */
return 0;
}
void gfx_unlock_picasso (void)
{
}
void gfx_set_picasso_state (int on)
{
}
int picasso_palette (void)
{
/* not implemented yet */
return 0;
}
int WIN32GFX_IsPicassoScreen (void)
{
return false;
}
void gfx_set_picasso_colors (RGBFTYPE rgbfmt)
{
}
......@@ -78,8 +78,8 @@ unsigned int shading_enabled = 0;
#define DEBUG_LOG(...) do ; while(0)
#endif
static SDL_Surface *display;
static SDL_Surface *screen;
SDL_Surface *display;
SDL_Surface *screen;
/* Standard P96 screen modes */
#define MAX_SCREEN_MODES 12
......@@ -312,7 +312,7 @@ static int init_colors (void)
if (currprefs.use_gl) {
DEBUG_LOG ("SDLGFX: bitdepth = %d\n", bitdepth);
if (bitdepth <= 8) {
write_log ("SDLGFX: bitdepth %d to small\n", bitdepth);
write_log ("SDLGFX: bitdepth %d too small\n", bitdepth);
abort();
}
}
......
......@@ -8,7 +8,10 @@
#include "menu.h"
#include "sysconfig.h"
#include "sysdeps.h"
#include "options.h"
#include "uae.h"
#include "gui.h"
#include "zfile.h"
......@@ -25,7 +28,9 @@
#define VIDEO_FLAGS SDL_HWSURFACE
SDL_Surface* tmpSDLScreen = NULL;
SDL_Surface* display = NULL;
extern SDL_Surface* display;
bool sdlGuiInitialized = false;
int menuSelection = 0;
char yol[256];
......@@ -63,14 +68,14 @@ void blit_image (SDL_Surface* img, int x, int y) {
SDL_BlitSurface(img, 0, tmpSDLScreen, &dest);
}
void secilimi (int ix, int iy, int mx, int my, SDL_Surface* img, int hangi) {
int secili = 0;
void drawMenuIcon (int ix, int iy, int mx, int my, SDL_Surface* img, int hangi) {
int selection = 0;
if (mx >= ix && mx <= ix + iconsizex) {
if (my >= iy && my <= iy + iconsizey) {
secili = 1;
selection = 1;
}
}
if (secili == 1) {
if (selection == 1) {
SDL_SetAlpha(img, SDL_SRCALPHA, 100);
menuSelection = hangi;
} else {
......@@ -79,9 +84,6 @@ void secilimi (int ix, int iy, int mx, int my, SDL_Surface* img, int hangi) {
}
int gui_init (void) {
if (display == NULL) {
display = SDL_GetVideoSurface();
}
if (display) {
SDL_JoystickEventState(SDL_ENABLE);
SDL_JoystickOpen(0);
......@@ -111,6 +113,7 @@ int gui_init (void) {
#ifdef TOUCHUI
SDL_TUI_Init("sdl_touchui.xml", "keyboard-off");
#endif
sdlGuiInitialized = true;
return 1;
}
return 0;
......@@ -151,7 +154,7 @@ void gui_display (int shortcut){
int iconpos_x = 0;
int iconpos_y = 0;
if (display == NULL) {
if (!sdlGuiInitialized) {
gui_init();
}
......@@ -267,48 +270,47 @@ void gui_display (int shortcut){
iconpos_x = 10;
iconpos_y = 23;
secilimi (iconpos_x,iconpos_y,mouse_x,mouse_y,icon_floppy, menu_sel_floppy);
drawMenuIcon (iconpos_x,iconpos_y,mouse_x,mouse_y,icon_floppy, menu_sel_floppy);
blit_image (icon_floppy, iconpos_x, iconpos_y);
iconpos_x += iconsizex + bosluk;
secilimi (iconpos_x,iconpos_y,mouse_x,mouse_y, icon_preferences, menu_sel_prefs);
drawMenuIcon (iconpos_x,iconpos_y,mouse_x,mouse_y, icon_preferences, menu_sel_prefs);
blit_image (icon_preferences, iconpos_x, iconpos_y);
iconpos_x += iconsizex + bosluk;
secilimi (iconpos_x,iconpos_y,mouse_x,mouse_y, icon_tweaks, menu_sel_tweaks);
drawMenuIcon (iconpos_x,iconpos_y,mouse_x,mouse_y, icon_tweaks, menu_sel_tweaks);
blit_image (icon_tweaks, iconpos_x, iconpos_y);
iconpos_x += iconsizex + bosluk;
secilimi (iconpos_x,iconpos_y,mouse_x,mouse_y, icon_keymaps, menu_sel_keymaps);
drawMenuIcon (iconpos_x,iconpos_y,mouse_x,mouse_y, icon_keymaps, menu_sel_keymaps);
blit_image (icon_keymaps, iconpos_x, iconpos_y);
iconpos_x += iconsizex + bosluk;
secilimi (iconpos_x,iconpos_y,mouse_x,mouse_y, icon_expansion, menu_sel_expansion);
drawMenuIcon (iconpos_x,iconpos_y,mouse_x,mouse_y, icon_expansion, menu_sel_expansion);
blit_image (icon_expansion, iconpos_x, iconpos_y);
iconpos_x = 10;
iconpos_y = 93;
secilimi (iconpos_x,iconpos_y,mouse_x,mouse_y,icon_storage, menu_sel_storage);
drawMenuIcon (iconpos_x,iconpos_y,mouse_x,mouse_y,icon_storage, menu_sel_storage);
blit_image (icon_storage, iconpos_x, iconpos_y);
iconpos_x += iconsizex + bosluk;
secilimi (iconpos_x,iconpos_y,mouse_x,mouse_y, icon_reset, menu_sel_reset);
drawMenuIcon (iconpos_x,iconpos_y,mouse_x,mouse_y, icon_reset, menu_sel_reset);
blit_image (icon_reset, iconpos_x, iconpos_y);
iconpos_x += iconsizex + bosluk;
secilimi (iconpos_x,iconpos_y,mouse_x,mouse_y, icon_run, menu_sel_run);
drawMenuIcon (iconpos_x,iconpos_y,mouse_x,mouse_y, icon_run, menu_sel_run);
blit_image (icon_run, iconpos_x, iconpos_y);
iconpos_x += iconsizex + bosluk;
secilimi (iconpos_x,iconpos_y,mouse_x,mouse_y, icon_exit, menu_sel_exit);
drawMenuIcon (iconpos_x,iconpos_y,mouse_x,mouse_y, icon_exit, menu_sel_exit);
blit_image (icon_exit, iconpos_x, iconpos_y);
// texts
//char tmpMsg[50];
//sprintf(tmpMsg, "P-UAE %d.%d.%d", UAEMAJOR, UAEMINOR, UAESUBREV);
//write_text (26, 3, tmpMsg);
write_text (26, 3, "P-UAE 2.3.0");
char tmpMsg[50];
sprintf(tmpMsg, "P-UAE %d.%d.%d", UAEMAJOR, UAEMINOR, UAESUBREV);
write_text (26, 3, tmpMsg);
// mouse pointer ------------------------------
if (kleft == 1) {
......@@ -343,7 +345,7 @@ void gui_display (int shortcut){
#ifdef TOUCHUI
SDL_TUI_UpdateAll();
#endif
SDL_Flip(display);
redraw_frame();
} //while done
}
......
......@@ -184,7 +184,7 @@ int dirz (int parametre) {
#ifdef TOUCHUI
SDL_TUI_UpdateAll();
#endif
SDL_Flip(display);
redraw_frame();
} //while done
free(filez);
......
......@@ -201,7 +201,7 @@ int prefz (int parametre) {
#ifdef TOUCHUI
SDL_TUI_UpdateAll();
#endif
SDL_Flip(display);
redraw_frame();
} //while done
/*
if (defaults[0] == 4) { }
......
#include "sysconfig.h"
#include "sysdeps.h"
#include "options.h"
#include "SDL.h"
#include <stdlib.h>
......@@ -188,7 +193,7 @@ int tweakz (int parametre) {
#ifdef TOUCHUI
SDL_TUI_UpdateAll();
#endif
SDL_Flip(display);
redraw_frame();
} //while done
pMenu_Surface = SDL_LoadBMP("images/menu.bmp");
......
......@@ -44,8 +44,10 @@ extern OSErr CPSSetFrontProcess (CPSProcessSerNum *psn);
#endif /* SDL_USE_CPS */
#ifdef USE_COCOA_GUI
// Function found in gui-cocoa/cocoaui.m
extern void cocoa_gui_early_setup (void);
#endif
static int gArgc;
static char **gArgv;
......@@ -229,8 +231,10 @@ static void CustomApplicationMain (int argc, char **argv)
setApplicationMenu ();
setupWindowMenu ();
#ifdef USE_COCOA_GUI
/* Set up the UAE menus */
cocoa_gui_early_setup();
#endif /* USE_COCOA_GUI */
/* Create SDLMain and make it the app delegate */
puae_main = [[PUAE_Main alloc] init];
......@@ -299,6 +303,7 @@ NSString *finderLaunchFilename = nil;
myArgv[1] = &arg1[0];
myArgv[2] = &arg2[0];
#ifdef USE_COCOA_GUI
/* If we were launched from the Finder, but without a config file
* being selected, we need to ask for one now.
*/
......@@ -325,6 +330,7 @@ NSString *finderLaunchFilename = nil;
exit(EXIT_SUCCESS);
}
}
#endif
/* Check the extension of the file that was double-clicked.
* If it's ".uaerc" then we keep the switch argument set to "-f",
......
/* src/sysconfig.h.in. Generated from configure.in by autoheader. */
/* Define if building universal (internal helper macro) */
#undef AC_APPLE_UNIVERSAL_BUILD
/* CPU is 64bit */
#undef CPU_64_BIT
......@@ -171,7 +168,7 @@
/* Define to 1 if you have the `strstr' function. */
#undef HAVE_STRSTR
/* Define to 1 if `st_blocks' is a member of `struct stat'. */
/* Define to 1 if `st_blocks' is member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BLOCKS
/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use
......@@ -306,9 +303,6 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the home page for this package. */
#undef PACKAGE_URL
/* Define to the version of this package. */
#undef PACKAGE_VERSION
......@@ -380,62 +374,29 @@
/* Define to 1 if your <sys/time.h> declares `struct tm'. */
#undef TM_IN_SYS_TIME
/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif
/* Version number of package */
#undef VERSION
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
significant byte first (like Motorola and SPARC, unlike Intel). */
#if defined AC_APPLE_UNIVERSAL_BUILD
# if defined __BIG_ENDIAN__
# define WORDS_BIGENDIAN 1
# endif
#else
# ifndef WORDS_BIGENDIAN
# undef WORDS_BIGENDIAN
# endif
#endif
/* Define to 1 if your processor stores words with the most significant byte
first (like Motorola and SPARC, unlike Intel and VAX). */
#undef WORDS_BIGENDIAN
/* Define to 1 if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING
/* Define to 1 if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Number of bits in a file offset, on hosts where this is settable. */
#undef _FILE_OFFSET_BITS
/* Define for large files, on AIX-style hosts. */
#undef _LARGE_FILES
/* Define to 1 if on MINIX. */
#undef _MINIX
/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* Define to empty if `const' does not conform to ANSI C. */
#undef const
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment