diff --git a/Makefile b/Makefile index d7a1fe60..93f67933 100644 --- a/Makefile +++ b/Makefile @@ -84,7 +84,7 @@ OBJS = \ src/uaelib.o \ src/unzip.o \ src/zfile.o \ - src/machdep/support.o \ + src/md-pandora/support.o \ src/od-pandora/neon_helper.o \ src/od-pandora/fsdb_host.o \ src/od-pandora/joystick.o \ diff --git a/src/audio.cpp b/src/audio.cpp index 21e3b4c6..5f14bc63 100644 --- a/src/audio.cpp +++ b/src/audio.cpp @@ -21,7 +21,7 @@ #include "newcpu.h" #include "autoconf.h" #include "gensound.h" -#include "sounddep/sound.h" +#include "sd-pandora/sound.h" #include "events.h" #include "audio.h" #include "savestate.h" diff --git a/src/cfgfile.cpp b/src/cfgfile.cpp index 80e55f7b..2367789e 100644 --- a/src/cfgfile.cpp +++ b/src/cfgfile.cpp @@ -25,7 +25,7 @@ #include "zfile.h" #include "filesys.h" #include "fsdb.h" -#include "sounddep/sound.h" +#include "sd-pandora/sound.h" static int config_newfilesystem; static struct strlist *temp_lines; diff --git a/src/custom.cpp b/src/custom.cpp index f21ba737..0ac9a939 100644 --- a/src/custom.cpp +++ b/src/custom.cpp @@ -18,7 +18,7 @@ #include "options.h" #include "uae.h" #include "gensound.h" -#include "sounddep/sound.h" +#include "sd-pandora/sound.h" #include "events.h" #include "memory.h" #include "custom.h" diff --git a/src/drawing.cpp b/src/drawing.cpp index c3297156..02372222 100644 --- a/src/drawing.cpp +++ b/src/drawing.cpp @@ -32,7 +32,7 @@ #include #include #include "options.h" -#include "threaddep/thread.h" +#include "td-sdl/thread.h" #include "uae.h" #include "memory.h" #include "custom.h" @@ -43,7 +43,7 @@ #include "picasso96.h" #include "drawing.h" #include "savestate.h" -#include "sounddep/sound.h" +#include "sd-pandora/sound.h" #include #include diff --git a/src/filesys.cpp b/src/filesys.cpp index a07de7d0..0a1c553a 100644 --- a/src/filesys.cpp +++ b/src/filesys.cpp @@ -27,7 +27,7 @@ #include "sysconfig.h" #include "sysdeps.h" -#include "threaddep/thread.h" +#include "td-sdl/thread.h" #include "options.h" #include "uae.h" #include "memory.h" diff --git a/src/fpp.cpp b/src/fpp.cpp index 43235d2c..80f6797a 100644 --- a/src/fpp.cpp +++ b/src/fpp.cpp @@ -20,7 +20,7 @@ #include "events.h" #include "newcpu.h" #include "ersatz.h" -#include "machdep/md-fpp.h" +#include "md-pandora/md-fpp.h" #include "savestate.h" #define DEBUG_FPP 0 diff --git a/src/hardfile.cpp b/src/hardfile.cpp index bb9c650d..ecd1e169 100644 --- a/src/hardfile.cpp +++ b/src/hardfile.cpp @@ -10,7 +10,7 @@ #include "sysconfig.h" #include "sysdeps.h" -#include "threaddep/thread.h" +#include "td-sdl/thread.h" #include "options.h" #include "memory.h" #include "custom.h" diff --git a/src/include/drawing.h b/src/include/drawing.h index 54146eb0..ba412047 100644 --- a/src/include/drawing.h +++ b/src/include/drawing.h @@ -4,7 +4,7 @@ * Copyright 1996-1998 Bernd Schmidt */ -#include "osdep/inputmode.h" +#include "od-pandora/inputmode.h" #define MAX_PLANES 8 diff --git a/src/include/events.h b/src/include/events.h index 9647732b..ab5a3b76 100644 --- a/src/include/events.h +++ b/src/include/events.h @@ -12,7 +12,7 @@ * Copyright 1995-1998 Bernd Schmidt */ -#include "machdep/rpt.h" +#include "md-pandora/rpt.h" extern volatile frame_time_t vsynctime, vsyncmintime; extern void reset_frame_rate_hack (void); diff --git a/src/include/memory.h b/src/include/memory.h index 8250fec2..01a250b2 100644 --- a/src/include/memory.h +++ b/src/include/memory.h @@ -53,7 +53,7 @@ extern uae_u32 allocated_a3000mem; extern void wait_cpu_cycle (void); #undef DIRECT_MEMFUNCS_SUCCESSFUL -#include "machdep/maccess.h" +#include "md-pandora/maccess.h" #define chipmem_start 0x00000000 #define bogomem_start 0x00C00000 diff --git a/src/include/newcpu.h b/src/include/newcpu.h index 61702f5d..cb3c668d 100644 --- a/src/include/newcpu.h +++ b/src/include/newcpu.h @@ -31,7 +31,7 @@ */ #include "readcpu.h" -#include "machdep/m68k.h" +#include "md-pandora/m68k.h" #include "events.h" #ifndef SET_CFLG diff --git a/src/machdep/m68k.h b/src/machdep/m68k.h deleted file mode 100644 index d36f12c2..00000000 --- a/src/machdep/m68k.h +++ /dev/null @@ -1,468 +0,0 @@ -/* - * m68k.h - machine dependent bits - * - * Copyright (c) 2001-2004 Milan Jurik of ARAnyM dev team (see AUTHORS) - * - * Inspired by Christian Bauer's Basilisk II - * - * This file is part of the ARAnyM project which builds a new and powerful - * TOS/FreeMiNT compatible virtual machine running on almost any hardware. - * - * ARAnyM is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * ARAnyM is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ARAnyM; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ -/* - * UAE - The Un*x Amiga Emulator - * - * MC68000 emulation - machine dependent bits - * - * Copyright 1996 Bernd Schmidt - * Copyright 2004-2005 Richard Drummond - */ - -#if (defined(CPU_i386) && defined(X86_ASSEMBLY)) || (defined(CPU_x86_64) && defined(X86_64_ASSEMBLY)) - - /* - * Machine dependent structure for holding the 68k CCR flags - */ -struct flag_struct { - unsigned int cznv; - unsigned int x; -}; - - -/* - * The bits in the cznv field in the above structure are assigned to - * allow the easy mirroring of the x86 condition flags. (For example, - * from the AX register - the x86 overflow flag can be copied to AL - * with a setto %AL instr and the other flags copied to AH with an - * lahf instr). - * - * The 68k CZNV flags are thus assinged in cznv as: - * - * <--AL--> <--AH--> - * 76543210 FEDCBA98 --------- --------- - * xxxxxxxV NZxxxxxC xxxxxxxxx xxxxxxxxx - */ - -#define FLAGBIT_N 15 -#define FLAGBIT_Z 14 -#define FLAGBIT_C 8 -#define FLAGBIT_V 0 -#define FLAGBIT_X 8 - -#define FLAGVAL_N (1 << FLAGBIT_N) -#define FLAGVAL_Z (1 << FLAGBIT_Z) -#define FLAGVAL_C (1 << FLAGBIT_C) -#define FLAGVAL_V (1 << FLAGBIT_V) -#define FLAGVAL_X (1 << FLAGBIT_X) - -#define SET_ZFLG(flags, y) ((flags)->cznv = ((flags)->cznv & ~FLAGVAL_Z) | (((y) & 1) << FLAGBIT_Z)) -#define SET_CFLG(flags, y) ((flags)->cznv = ((flags)->cznv & ~FLAGVAL_C) | (((y) & 1) << FLAGBIT_C)) -#define SET_VFLG(flags, y) ((flags)->cznv = ((flags)->cznv & ~FLAGVAL_V) | (((y) & 1) << FLAGBIT_V)) -#define SET_NFLG(flags, y) ((flags)->cznv = ((flags)->cznv & ~FLAGVAL_N) | (((y) & 1) << FLAGBIT_N)) -#define SET_XFLG(flags, y) ((flags)->x = (y) << FLAGBIT_X) - -#define GET_ZFLG(flags) (((flags)->cznv >> FLAGBIT_Z) & 1) -#define GET_CFLG(flags) (((flags)->cznv >> FLAGBIT_C) & 1) -#define GET_VFLG(flags) (((flags)->cznv >> FLAGBIT_V) & 1) -#define GET_NFLG(flags) (((flags)->cznv >> FLAGBIT_N) & 1) -#define GET_XFLG(flags) (((flags)->x >> FLAGBIT_X) & 1) - -#define CLEAR_CZNV(flags) ((flags)->cznv = 0) -#define GET_CZNV(flags) ((flags)->cznv) -#define IOR_CZNV(flags, X) ((flags)->cznv |= (X)) -#define SET_CZNV(flags, X) ((flags)->cznv = (X)) - -#define COPY_CARRY(flags) ((flags)->x = (flags)->cznv) - - -/* - * Test CCR condition - */ -STATIC_INLINE int cctrue (struct flag_struct *flags, int cc) -{ - uae_u32 cznv = flags->cznv; - - switch (cc) { - case 0: return 1; /* T */ - case 1: return 0; /* F */ - case 2: return (cznv & (FLAGVAL_C | FLAGVAL_Z)) == 0; /* !CFLG && !ZFLG HI */ - case 3: return (cznv & (FLAGVAL_C | FLAGVAL_Z)) != 0; /* CFLG || ZFLG LS */ - case 4: return (cznv & FLAGVAL_C) == 0; /* !CFLG CC */ - case 5: return (cznv & FLAGVAL_C) != 0; /* CFLG CS */ - case 6: return (cznv & FLAGVAL_Z) == 0; /* !ZFLG NE */ - case 7: return (cznv & FLAGVAL_Z) != 0; /* ZFLG EQ */ - case 8: return (cznv & FLAGVAL_V) == 0; /* !VFLG VC */ - case 9: return (cznv & FLAGVAL_V) != 0; /* VFLG VS */ - case 10: return (cznv & FLAGVAL_N) == 0; /* !NFLG PL */ - case 11: return (cznv & FLAGVAL_N) != 0; /* NFLG MI */ - case 12: return (((cznv << (FLAGBIT_N - FLAGBIT_V)) ^ cznv) & FLAGVAL_N) == 0; /* NFLG == VFLG GE */ - case 13: return (((cznv << (FLAGBIT_N - FLAGBIT_V)) ^ cznv) & FLAGVAL_N) != 0; /* NFLG != VFLG LT */ - case 14: cznv &= (FLAGVAL_N | FLAGVAL_Z | FLAGVAL_V); /* ZFLG && (NFLG == VFLG) GT */ - return (((cznv << (FLAGBIT_N - FLAGBIT_V)) ^ cznv) & (FLAGVAL_N | FLAGVAL_Z)) == 0; - case 15: cznv &= (FLAGVAL_N | FLAGVAL_Z | FLAGVAL_V); /* ZFLG && (NFLG != VFLG) LE */ - return (((cznv << (FLAGBIT_N - FLAGBIT_V)) ^ cznv) & (FLAGVAL_N | FLAGVAL_Z)) != 0; - } - abort (); - return 0; -} - -#elif defined(CPU_arm) && defined(ARM_ASSEMBLY) - -struct flag_struct { - uae_u32 nzcv; - uae_u32 x; -}; - -#define FLAGVAL_Q 0x08000000 -#define FLAGVAL_V 0x10000000 -#define FLAGVAL_C 0x20000000 -#define FLAGVAL_Z 0x40000000 -#define FLAGVAL_N 0x80000000 - -#define SET_NFLG(flags, y) ((flags)->nzcv = ((flags)->nzcv & ~0x80000000) | ((y) << 31)) -#define SET_ZFLG(flags, y) ((flags)->nzcv = ((flags)->nzcv & ~0x40000000) | (((y) & 1) << 30)) -#define SET_CFLG(flags, y) ((flags)->nzcv = ((flags)->nzcv & ~0x20000000) | (((y) & 1) << 29)) -#define SET_VFLG(flags, y) ((flags)->nzcv = ((flags)->nzcv & ~0x10000000) | (((y) & 1) << 28)) - -#define SET_XFLG(flags, y) ((flags)->x = (y)) - -#define GET_NFLG(flags) (((flags)->nzcv >> 31) & 1) -#define GET_ZFLG(flags) (((flags)->nzcv >> 30) & 1) -#define GET_CFLG(flags) (((flags)->nzcv >> 29) & 1) -#define GET_VFLG(flags) (((flags)->nzcv >> 28) & 1) -#define GET_XFLG(flags) ((flags)->x & 1) - -#define CLEAR_CZNV(flags) ((flags)->nzcv = 0) -#define GET_CZNV(flags) ((flags)->nzcv) -#define IOR_CZNV(flags,X) ((flags)->nzcv |= (X)) -#define SET_CZNV(flags,X) ((flags)->nzcv = (X)) - -#define COPY_CARRY(flags) ((flags)->x = ((flags)->nzcv)>>29) - -extern struct flag_struct regflags __asm__ ("regflags"); - -static inline int cctrue(struct flag_struct *flags, int cc) -{ - unsigned int nzcv = flags->nzcv; - switch(cc){ - case 0: return 1; /* T */ - case 1: return 0; /* F */ - case 2: return (nzcv & 0x60000000) == 0; /* !GET_CFLG && !GET_ZFLG; HI */ - case 3: return (nzcv & 0x60000000) != 0; /* GET_CFLG || GET_ZFLG; LS */ - case 4: return (nzcv & 0x20000000) == 0; /* !GET_CFLG; CC */ - case 5: return (nzcv & 0x20000000) != 0; /* GET_CFLG; CS */ - case 6: return (nzcv & 0x40000000) == 0; /* !GET_ZFLG; NE */ - case 7: return (nzcv & 0x40000000) != 0; /* GET_ZFLG; EQ */ - case 8: return (nzcv & 0x10000000) == 0; /* !GET_VFLG; VC */ - case 9: return (nzcv & 0x10000000) != 0; /* GET_VFLG; VS */ - case 10:return (nzcv & 0x80000000) == 0; /* !GET_NFLG; PL */ - case 11:return (nzcv & 0x80000000) != 0; /* GET_NFLG; MI */ - case 12:return (((nzcv << 3) ^ nzcv) & 0x80000000) == 0; /* GET_NFLG == GET_VFLG; GE */ - case 13:return (((nzcv << 3) ^ nzcv) & 0x80000000) != 0; /* GET_NFLG != GET_VFLG; LT */ - case 14: - nzcv &= 0xd0000000; - return (((nzcv << 3) ^ nzcv) & 0xc0000000) == 0; /* !GET_ZFLG && (GET_NFLG == GET_VFLG); GT */ - case 15: - nzcv &= 0xd0000000; - return (((nzcv << 3) ^ nzcv) & 0xc0000000) != 0; /* GET_ZFLG || (GET_NFLG != GET_VFLG); LE */ - } - return 0; -} - -#define optflag_testl(v) do {\ - __asm__ __volatile__ ("tst %[rv],%[rv]\n\t" \ - "mrs %[nzcv],cpsr\n\t" \ - "bic %[nzcv],#0x30000000\n\t" \ - : [nzcv] "=r" (regflags.nzcv) \ - : [rv] "r" (v) \ - : "cc"); \ - } while(0) - -#define optflag_addl(v, s, d) do { \ - __asm__ __volatile__ ("adds %[rv],%[rd],%[rs]\n\t" \ - "mrs %[nzcv],cpsr\n\t" \ - : [nzcv] "=r" (regflags.nzcv), [rv] "=r" (v) \ - : [rs] "ri" (s), [rd] "1" (d) \ - : "cc"); \ - COPY_CARRY; \ - } while(0) - -#define optflag_subl(v, s, d) do { \ - __asm__ __volatile__ ("subs %[rv],%[rd],%[rs]\n\t" \ - "mrs %[nzcv],cpsr\n\t" \ - "eor %[nzcv],#0x20000000\n\t" \ - : [nzcv] "=r" (regflags.nzcv), [rv] "=r" (v) \ - : [rs] "ri" (s), [rd] "1" (d) \ - : "cc"); \ - COPY_CARRY; \ - } while(0) - -#define optflag_cmpl(s, d) do { \ - __asm__ __volatile__ ("cmp %[rd],%[rs]\n\t" \ - "mrs %[nzcv],cpsr\n\t" \ - "eor %[nzcv],#0x20000000\n\t" \ - : [nzcv] "=r" (regflags.nzcv) \ - : [rs] "ri" (s), [rd] "0" (d) \ - : "cc"); \ - } while(0) - -#if defined(ARMV6_ASSEMBLY) - -// #pragma message "ARM/v6 Assembly optimized flags" - -#define optflag_testw(v) do { \ - __asm__ __volatile__ ("sxth %[rv],%[rv]\n\t" \ - "tst %[rv],%[rv]\n\t" \ - "mrs %[nzcv],cpsr\n\t" \ - "bic %[nzcv],#0x30000000\n\t" \ - : [nzcv] "=r" (regflags.nzcv) \ - : [rv] "0" (v) \ - : "cc"); \ - }while(0) - -#define optflag_testb(v) do {\ - __asm__ __volatile__ ("sxtb %[rv],%[rv]\n\t" \ - "tst %[rv],%[rv]\n\t" \ - "mrs %[nzcv],cpsr\n\t" \ - "bic %[nzcv],#0x30000000\n\t" \ - : [nzcv] "=r" (regflags.nzcv) \ - : [rv] "0" (v) \ - : "cc"); \ - }while(0) - -#define optflag_addw(v, s, d) do { \ - __asm__ __volatile__ ("sxth %[rd],%[rd]\n\t" \ - "sxth %[rs],%[rs]\n\t" \ - "adds %[rd],%[rd],%[rs]\n\t" \ - "mrs %[nzcv],cpsr\n\t" \ - : [nzcv] "=r" (regflags.nzcv), [rv] "=r" (v) \ - : [rs] "ri" (s), [rd] "1" (d) \ - : "cc"); \ - COPY_CARRY; \ - } while(0) - -#define optflag_addb(v, s, d) do { \ - __asm__ __volatile__ ("sxtb %[rd],%[rd]\n\t" \ - "sxtb %[rs],%[rs]\n\t" \ - "adds %[rd],%[rd],%[rs]\n\t" \ - "mrs %[nzcv],cpsr\n\t" \ - : [nzcv] "=r" (regflags.nzcv), [rv] "=r" (v) \ - : [rs] "ri" (s), [rd] "1" (d) \ - : "cc"); \ - COPY_CARRY; \ - } while(0) - -#define optflag_subw(v, s, d) do { \ - __asm__ __volatile__ ("sxth %[rd],%[rd]\n\t" \ - "sxth %[rs],%[rs]\n\t" \ - "subs %[rd],%[rd],%[rs]\n\t" \ - "mrs %[nzcv],cpsr\n\t" \ - "eor %[nzcv],#0x20000000\n\t" \ - : [nzcv] "=r" (regflags.nzcv), [rv] "=r" (v) \ - : [rs] "ri" (s), [rd] "1" (d) \ - : "cc"); \ - COPY_CARRY; \ - } while(0) - -#define optflag_subb(v, s, d) do { \ - __asm__ __volatile__ ("sxtb %[rd],%[rd]\n\t" \ - "sxtb %[rs],%[rs]\n\t" \ - "subs %[rd],%[rd],%[rs]\n\t" \ - "mrs %[nzcv],cpsr\n\t" \ - "eor %[nzcv],#0x20000000\n\t" \ - : [nzcv] "=r" (regflags.nzcv), [rv] "=r" (v) \ - : [rs] "ri" (s), [rd] "1" (d) \ - : "cc"); \ - COPY_CARRY; \ - } while(0) - -#define optflag_cmpw(s, d) do { \ - __asm__ __volatile__ ("sxth %[rd],%[rd]\n\t" \ - "sxth %[rs],%[rs]\n\t" \ - "cmp %[rd],%[rs]\n\t" \ - "mrs %[nzcv],cpsr\n\t" \ - "eor %[nzcv],#0x20000000\n\t" \ - : [nzcv] "=r" (regflags.nzcv) \ - : [rs] "ri" (s), [rd] "0" (d) \ - : "cc"); \ - } while(0) - -#define optflag_cmpb(s, d) do { \ - __asm__ __volatile__ ("sxtb %[rd],%[rd]\n\t" \ - "sxtb %[rs],%[rs]\n\t" \ - "cmp %[rd],%[rs]\n\t" \ - "mrs %[nzcv],cpsr\n\t" \ - "eor %[nzcv],#0x20000000\n\t" \ - : [nzcv] "=r" (regflags.nzcv) \ - : [rs] "ri" (s), [rd] "0" (d) \ - : "cc"); \ - } while(0) - -#else - -// #pragma message "ARM/generic Assembly optimized flags" - -#define optflag_testw(v) do { \ - __asm__ __volatile__ ("lsl %[rv],%[rv],#16\n\t" \ - "tst %[rv],%[rv]\n\t" \ - "mrs %[nzcv],cpsr\n\t" \ - "bic %[nzcv],#0x30000000\n\t" \ - : [nzcv] "=r" (regflags.nzcv) \ - : [rv] "0" (v) \ - : "cc"); \ - }while(0) - -#define optflag_testb(v) do {\ - __asm__ __volatile__ ("lsl %[rv],%[rv],#24\n\t" \ - "tst %[rv],%[rv]\n\t" \ - "mrs %[nzcv],cpsr\n\t" \ - "bic %[nzcv],#0x30000000\n\t" \ - : [nzcv] "=r" (regflags.nzcv) \ - : [rv] "0" (v) \ - : "cc"); \ - }while(0) - -#define optflag_addw(v, s, d) do { \ - __asm__ __volatile__ ("lsl %[rd],%[rd],#16\n\t" \ - "adds %[rd],%[rd],%[rs],lsl #16\n\t" \ - "mrs %[nzcv],cpsr\n\t" \ - "lsr %[rv],%[rd],#16\n\t" \ - : [nzcv] "=r" (regflags.nzcv), [rv] "=r" (v) \ - : [rs] "ri" (s), [rd] "1" (d) \ - : "cc"); \ - COPY_CARRY; \ - } while(0) - -#define optflag_addb(v, s, d) do { \ - __asm__ __volatile__ ("lsl %[rd],%[rd],#24\n\t" \ - "adds %[rd],%[rd],%[rs],lsl #24\n\t" \ - "mrs %[nzcv],cpsr\n\t" \ - "lsr %[rv],%[rd],#24\n\t" \ - : [nzcv] "=r" (regflags.nzcv), [rv] "=r" (v) \ - : [rs] "ri" (s), [rd] "1" (d) \ - : "cc"); \ - COPY_CARRY; \ - } while(0) - -#define optflag_subw(v, s, d) do { \ - __asm__ __volatile__ ("lsl %[rd],%[rd],#16\n\t" \ - "subs %[rd],%[rd],%[rs],lsl #16\n\t" \ - "mrs %[nzcv],cpsr\n\t" \ - "eor %[nzcv],#0x20000000\n\t" \ - "lsr %[rv],%[rd],#16\n\t" \ - : [nzcv] "=r" (regflags.nzcv), [rv] "=r" (v) \ - : [rs] "ri" (s), [rd] "1" (d) \ - : "cc"); \ - COPY_CARRY; \ - } while(0) - -#define optflag_subb(v, s, d) do { \ - __asm__ __volatile__ ("lsl %[rd],%[rd],#24\n\t" \ - "subs %[rd],%[rd],%[rs],lsl #24\n\t" \ - "mrs %[nzcv],cpsr\n\t" \ - "eor %[nzcv],#0x20000000\n\t" \ - "lsr %[rv],%[rd],#24\n\t" \ - : [nzcv] "=r" (regflags.nzcv), [rv] "=r" (v) \ - : [rs] "ri" (s), [rd] "1" (d) \ - : "cc"); \ - COPY_CARRY; \ - } while(0) - -#define optflag_cmpw(s, d) do { \ - __asm__ __volatile__ ("lsl %[rd],%[rd],#16\n\t" \ - "cmp %[rd],%[rs],lsl #16\n\t" \ - "mrs %[nzcv],cpsr\n\t" \ - "eor %[nzcv],#0x20000000\n\t" \ - : [nzcv] "=r" (regflags.nzcv) \ - : [rs] "ri" (s), [rd] "0" (d) \ - : "cc"); \ - } while(0) - -#define optflag_cmpb(s, d) do { \ - __asm__ __volatile__ ("lsl %[rd],%[rd],#24\n\t" \ - "cmp %[rd],%[rs],lsl #24\n\t" \ - "mrs %[nzcv],cpsr\n\t" \ - "eor %[nzcv],#0x20000000\n\t" \ - : [nzcv] "=r" (regflags.nzcv) \ - : [rs] "ri" (s), [rd] "0" (d) \ - : "cc"); \ - } while(0) - -#endif - -#else - -struct flag_struct { - unsigned int c; - unsigned int z; - unsigned int n; - unsigned int v; - unsigned int x; -}; - -extern struct flag_struct regflags; - -#define ZFLG (regflags.z) -#define NFLG (regflags.n) -#define CFLG (regflags.c) -#define VFLG (regflags.v) -#define XFLG (regflags.x) - -#define SET_CFLG(flags, x) (CFLG(flags) = (x)) -#define SET_NFLG(flags, x) (NFLG(flags) = (x)) -#define SET_VFLG(flags, x) (VFLG(flags) = (x)) -#define SET_ZFLG(flags, x) (ZFLG(flags) = (x)) -#define SET_XFLG(flags, x) (XFLG(flags) = (x)) - -#define GET_CFLG(flags) CFLG(flags) -#define GET_NFLG(flags) NFLG(flags) -#define GET_VFLG(flags) VFLG(flags) -#define GET_ZFLG(flags) ZFLG)flags) -#define GET_XFLG(flags) XFLG(flags) - -#define CLEAR_CZNV(flags) do { \ - SET_CFLG (flags, 0); \ - SET_ZFLG (flags, 0); \ - SET_NFLG (flags, 0); \ - SET_VFLG (flags, 0); \ -} while (0) - -#define COPY_CARRY(flags) ((flags)->x = (flags)->cznv) - -static inline int cctrue(struct flag_struct *flags, const int cc) -{ - switch(flags->cc){ - case 0: return 1; /* T */ - case 1: return 0; /* F */ - case 2: return !CFLG && !ZFLG; /* HI */ - case 3: return CFLG || ZFLG; /* LS */ - case 4: return !CFLG; /* CC */ - case 5: return CFLG; /* CS */ - case 6: return !ZFLG; /* NE */ - case 7: return ZFLG; /* EQ */ - case 8: return !VFLG; /* VC */ - case 9: return VFLG; /* VS */ - case 10:return !NFLG; /* PL */ - case 11:return NFLG; /* MI */ - case 12:return NFLG == VFLG; /* GE */ - case 13:return NFLG != VFLG; /* LT */ - case 14:return !ZFLG && (NFLG == VFLG); /* GT */ - case 15:return ZFLG || (NFLG != VFLG); /* LE */ - } - return 0; -} - -#endif /* OPTIMIZED_FLAGS */ diff --git a/src/machdep/maccess.h b/src/machdep/maccess.h deleted file mode 100644 index 6611e348..00000000 --- a/src/machdep/maccess.h +++ /dev/null @@ -1,109 +0,0 @@ - /* - * UAE - The Un*x Amiga Emulator - * - * Memory access functions - * - * Copyright 1996 Bernd Schmidt - */ - -#ifndef MACCESS_UAE_H -#define MACCESS_UAE_H - -#define likely(x) __builtin_expect((x),1) -#define unlikely(x) __builtin_expect((x),0) - - -#ifdef ARMV6_ASSEMBLY -static __inline__ uae_u16 do_get_mem_word(uae_u16 *_GCCRES_ a) -{ - uae_u16 v; - __asm__ __volatile__ ( - "ldrh %[v], [%[a]] \n\t" - "rev16 %[v], %[v] \n\t" - : [v] "=r" (v) : [a] "r" (a) ); - return v; -} -#else -static __inline__ uae_u16 do_get_mem_word(uae_u16 *_GCCRES_ a) -{ - uae_u8 *b = (uae_u8 *)a; - - return (*b << 8) | (*(b+1)); -} -#endif - - -#ifdef ARMV6_ASSEMBLY -static inline uae_u32 do_get_mem_long(uae_u32 *a) -{ - uae_u32 v; - __asm__ __volatile__ ( - "ldr %[v], [%[a]] \n\t" - "rev %[v], %[v] \n\t" - : [v] "=r" (v) : [a] "r" (a) ); - return v; -} -#else -static __inline__ uae_u32 do_get_mem_long(uae_u32 *_GCCRES_ a) -{ - uae_u8 *b = (uae_u8 *)a; - - return (*b << 24) | (*(b+1) << 16) | (*(b+2) << 8) | (*(b+3)); -} -#endif - - -static __inline__ uae_u8 do_get_mem_byte(uae_u8 *_GCCRES_ a) -{ - return *a; -} - -#ifdef ARMV6_ASSEMBLY -static __inline__ void do_put_mem_word(uae_u16 *_GCCRES_ a, uae_u16 v) -{ - __asm__ __volatile__ ( - "rev16 r2, %[v] \n\t" - "strh r2, [%[a]] \n\t" - : : [v] "r" (v), [a] "r" (a) : "r2", "memory" ); -} -#else -static __inline__ void do_put_mem_word(uae_u16 *_GCCRES_ a, uae_u16 v) -{ - uae_u8 *b = (uae_u8 *)a; - - *b = v >> 8; - *(b+1) = v; -} -#endif - -#ifdef ARMV6_ASSEMBLY -static __inline__ void do_put_mem_long(uae_u32 *_GCCRES_ a, uae_u32 v) -{ - __asm__ __volatile__ ( - "rev r2, %[v] \n\t" - "str r2, [%[a]] \n\t" - : : [v] "r" (v), [a] "r" (a) : "r2", "memory" ); -} -#else -static __inline__ void do_put_mem_long(uae_u32 *_GCCRES_ a, uae_u32 v) -{ - uae_u8 *b = (uae_u8 *)a; - - *b = v >> 24; - *(b+1) = v >> 16; - *(b+2) = v >> 8; - *(b+3) = v; -} -#endif - -static __inline__ void do_put_mem_byte(uae_u8 *_GCCRES_ a, uae_u8 v) -{ - *a = v; -} - -#define call_mem_get_func(func, addr) ((*func)(addr)) -#define call_mem_put_func(func, addr, v) ((*func)(addr, v)) - -#undef MD_HAVE_MEM_1_FUNCS - -#endif diff --git a/src/machdep/md-fpp.h b/src/machdep/md-fpp.h deleted file mode 100644 index aebb1903..00000000 --- a/src/machdep/md-fpp.h +++ /dev/null @@ -1,75 +0,0 @@ - /* - * UAE - The Un*x Amiga Emulator - * - * MC68881 emulation - * Support functions for IEEE 754-compatible host CPUs. - * These functions use a GCC extension (type punning through unions) and - * should only be compiled with compilers that support this. - * - * Copyright 1999 Sam Jordan - * Copyright 2007 Richard Drummond - */ - -STATIC_INLINE double to_single (uae_u32 value) -{ - union { - float f; - uae_u32 u; - } val; - - val.u = value; - return val.f; -} - -STATIC_INLINE uae_u32 from_single (double src) -{ - union { - float f; - uae_u32 u; - } val; - - val.f = src; - return val.u; -} - -STATIC_INLINE double to_double (uae_u32 wrd1, uae_u32 wrd2) -{ - union { - double d; - uae_u32 u[2]; - } val; - -#ifdef WORDS_BIGENDIAN - val.u[0] = wrd1; - val.u[1] = wrd2; -#else - val.u[1] = wrd1; - val.u[0] = wrd2; -#endif - return val.d; -} - -STATIC_INLINE void from_double (double src, uae_u32 * wrd1, uae_u32 * wrd2) -{ - union { - double d; - uae_u32 u[2]; - } val; - - val.d = src; -#ifdef WORDS_BIGENDIAN - *wrd1 = val.u[0]; - *wrd2 = val.u[1]; -#else - *wrd1 = val.u[1]; - *wrd2 = val.u[0]; -#endif -} - -#define HAVE_from_double -#define HAVE_to_double -#define HAVE_from_single -#define HAVE_to_single - -/* Get the rest of the conversion functions defined. */ -#include "fpp-unknown.h" diff --git a/src/machdep/rpt.h b/src/machdep/rpt.h deleted file mode 100644 index 7bb051fb..00000000 --- a/src/machdep/rpt.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * UAE - The Un*x Amiga Emulator - * - * Definitions for accessing cycle counters on a given machine, if possible. - * - * Copyright 1998 Bernd Schmidt - */ - -#ifndef _RPT_H_ -#define _RPT_H_ - -typedef unsigned long frame_time_t; - -extern int64_t g_uae_epoch; - -static __inline__ frame_time_t read_processor_time (void) -{ - int64_t time; - struct timespec ts; - - clock_gettime (CLOCK_MONOTONIC, &ts); - - time = (((int64_t) ts.tv_sec) * 1000000) + (ts.tv_nsec / 1000); - return time - g_uae_epoch; -} - -#endif /* _RPT_H_ */ - diff --git a/src/machdep/support.cpp b/src/machdep/support.cpp deleted file mode 100644 index 962947e4..00000000 --- a/src/machdep/support.cpp +++ /dev/null @@ -1,31 +0,0 @@ -#include "config.h" -#include "sysconfig.h" - -#include -#include -#include - -#include "sysdeps.h" -#include "options.h" -#include "events.h" -#include "custom.h" - - -int64_t g_uae_epoch = 0; - - -void machdep_init (void) -{ - picasso_requested_on = 0; - picasso_on = 0; - screen_is_picasso = 0; - - // Initialize timebase - g_uae_epoch = read_processor_time(); - syncbase = 1000000; // Microseconds -} - - -void machdep_free (void) -{ -} diff --git a/src/main.cpp b/src/main.cpp index 791a05d1..faa25638 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -10,11 +10,11 @@ #include "sysdeps.h" #include #include "options.h" -#include "threaddep/thread.h" +#include "td-sdl/thread.h" #include "uae.h" #include "gensound.h" #include "audio.h" -#include "sounddep/sound.h" +#include "sd-pandora/sound.h" #include "events.h" #include "memory.h" #include "custom.h" diff --git a/src/native2amiga.cpp b/src/native2amiga.cpp index 73e20a0d..9c0e494a 100644 --- a/src/native2amiga.cpp +++ b/src/native2amiga.cpp @@ -12,7 +12,7 @@ #include "sysconfig.h" #include "sysdeps.h" -#include "threaddep/thread.h" +#include "td-sdl/thread.h" #include "options.h" #include "memory.h" #include "custom.h" diff --git a/src/od-pandora/gui/PanelSound.cpp b/src/od-pandora/gui/PanelSound.cpp index a819cd83..fa388778 100644 --- a/src/od-pandora/gui/PanelSound.cpp +++ b/src/od-pandora/gui/PanelSound.cpp @@ -16,7 +16,7 @@ #include "custom.h" #include "target.h" #include "gui_handling.h" -#include "sounddep/sound.h" +#include "sd-pandora/sound.h" static gcn::Window *grpSound; diff --git a/src/od-pandora/gui/SelectorEntry.cpp b/src/od-pandora/gui/SelectorEntry.cpp index 967f8e61..47d01d6d 100644 --- a/src/od-pandora/gui/SelectorEntry.cpp +++ b/src/od-pandora/gui/SelectorEntry.cpp @@ -1,4 +1,4 @@ -#include "osdep/gui/SelectorEntry.hpp" +#include "od-pandora/gui/SelectorEntry.hpp" #include "guichan/widgets/container.hpp" #include "guichan/widgets/icon.hpp" diff --git a/src/od-pandora/keyboard.cpp b/src/od-pandora/keyboard.cpp index 8c198ad2..4c4d434e 100644 --- a/src/od-pandora/keyboard.cpp +++ b/src/od-pandora/keyboard.cpp @@ -262,7 +262,7 @@ int keycode2amiga(SDL_keysym *prKeySym) { int iAmigaKeycode = kc_decode(prKeySym); if (iAmigaKeycode == -1) - return decode_fr(prKeySym); + return decode_us(prKeySym); return iAmigaKeycode; } diff --git a/src/od-pandora/menu/menu_config.cpp b/src/od-pandora/menu/menu_config.cpp index 1dce3eef..1d2df226 100644 --- a/src/od-pandora/menu/menu_config.cpp +++ b/src/od-pandora/menu/menu_config.cpp @@ -6,9 +6,9 @@ #include "autoconf.h" #include "options.h" #include "gui.h" -#include "sounddep/sound.h" +#include "sd-pandora/sound.h" #include "custom.h" -#include "osdep/gp2x.h" +#include "od-pandora/gp2x.h" #include "cfgfile.h" #include "uae.h" #include "disk.h" diff --git a/src/od-pandora/pandora_gui.cpp b/src/od-pandora/pandora_gui.cpp index ba0790b8..4a33768d 100644 --- a/src/od-pandora/pandora_gui.cpp +++ b/src/od-pandora/pandora_gui.cpp @@ -14,13 +14,13 @@ #include "memory.h" #include "zfile.h" #include "gui.h" -#include "osdep/gui/SelectorEntry.hpp" +#include "od-pandora/gui/SelectorEntry.hpp" #include "gui/gui_handling.h" #include "custom.h" #include "memory.h" #include "xwin.h" #include "drawing.h" -#include "sounddep/sound.h" +#include "sd-pandora/sound.h" #include "audio.h" #include "keybuf.h" #include "keyboard.h" diff --git a/src/od-rasp/rasp_gfx.cpp b/src/od-rasp/rasp_gfx.cpp index 9e343e50..a79efaae 100644 --- a/src/od-rasp/rasp_gfx.cpp +++ b/src/od-rasp/rasp_gfx.cpp @@ -8,7 +8,7 @@ #include "custom.h" #include "drawing.h" #include "events.h" -#include "osdep/inputmode.h" +#include "od-pandora/inputmode.h" #include "savestate.h" #include "picasso96.h" @@ -19,7 +19,7 @@ #ifdef ANDROIDSDL #include #endif -#include "thread.h" +#include "td-sdl/thread.h" #include "bcm_host.h" extern int stylusClickOverride; diff --git a/src/osdep/config.h b/src/osdep/config.h deleted file mode 100644 index 7d8a74e2..00000000 --- a/src/osdep/config.h +++ /dev/null @@ -1,82 +0,0 @@ - /* - * UAE - The Un*x Amiga Emulator - * - * User configuration options - * - * Copyright 1995 - 1998 Bernd Schmidt - */ - -/* - * Please note: Many things are configurable with command line parameters, - * and you can put anything you can pass on the command line into a - * configuration file ~/.uaerc. Please read the documentation for more - * information. - * - * NOTE NOTE NOTE - * Whenever you change something in this file, you have to "make clean" - * afterwards. - * Don't remove the '#' signs. If you want to enable something, move it out - * of the C comment block, if you want to disable something, move it inside - * the block. - */ - -/* - * When USE_COMPILER is defined, a m68k->i386 instruction compiler will be - * used. This is experimental. It has only been tested on a Linux/i386 ELF - * machine, although it might work on other i386 Unices. - * This is supposed to speed up application programs. It will not work very - * well for hardware bangers like games and demos, in fact it will be much - * slower. It can also be slower for some applications and/or benchmarks. - * It needs a lot of tuning. Please let me know your results with this. - * The second define, RELY_ON_LOADSEG_DETECTION, decides how the compiler - * tries to detect self-modifying code. If it is not set, the first bytes - * of every compiled routine are used as checksum before executing the - * routine. If it is set, the UAE filesystem will perform some checks to - * detect whether an executable is being loaded. This is less reliable - * (it won't work if you don't use the harddisk emulation, so don't try to - * use floppies or even the RAM disk), but much faster. - * - * @@@ NOTE: This option is unfortunately broken in this version. Don't - * try to use it. @@@ - * -#define USE_COMPILER -#define RELY_ON_LOADSEG_DETECTION - */ - -#undef USE_COMPILER -#undef RELY_ON_LOADSEG_DETECTION - -/* - * Set USER_PROGRAMS_BEHAVE to 1 or 2 to indicate that you are only running - * non-hardware banging programs which leave all the dirty work to the - * Kickstart. This affects the compiler. Any program that is _not_ in the ROM - * (i.e. everything but the Kickstart) will use faster memory access - * functions. - * There is of course the problem that the Amiga doesn't really distinguish - * between user programs and the kernel. Not all of the OS is in the ROM, - * e.g. the parallel.device is on the disk and gets loaded into RAM at least - * with Kickstart 1.3 (don't know about newer Kickstarts). So you probably - * can't print, and some other stuff may also fail to work. - * A useless option, really, given the way lots of Amiga software is written. -#define USER_PROGRAMS_BEHAVE 0 - */ - -/*************************************************************************** - * Operating system/machine specific options - * Configure these for your CPU. The default settings should work on any - * machine, but may not give optimal performance everywhere. - * (These don't do very much yet, except HAVE_RDTSC - */ - -/* - * Define this on PPro's, K6's and maybe other non-x86 CPUs. -#undef MULTIPLICATION_PROFITABLE - */ - -/* - * PPros don't like branches. With this option, UAE tries to avoid them in some - * places. -#undef BRANCHES_ARE_EXPENSIVE - */ - -#define MUSIC_VOLUME 80 diff --git a/src/osdep/exectasks.h b/src/osdep/exectasks.h deleted file mode 100644 index f6a93ca0..00000000 --- a/src/osdep/exectasks.h +++ /dev/null @@ -1,17 +0,0 @@ - /* - * UAE - The Un*x Amiga Emulator - * - * exec.library multitasking emulation - * - * Copyright 1996 Bernd Schmidt - */ - -struct switch_struct { - int dummy; -}; -/* Looks weird. I think I had a report once that some compiler chokes if - * the statement is empty. */ -#define EXEC_SWITCH_TASKS(run, ready) do { int i = 0; i++; } while(0) - -#define EXEC_SETUP_SWS(t) do { int i = 0; i++; } while(0) - diff --git a/src/osdep/fsdb_host.cpp b/src/osdep/fsdb_host.cpp deleted file mode 100644 index 13707882..00000000 --- a/src/osdep/fsdb_host.cpp +++ /dev/null @@ -1,36 +0,0 @@ -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "fsdb.h" - - -int dos_errno(void) -{ - int e = errno; - - switch (e) { - case ENOMEM: return ERROR_NO_FREE_STORE; - case EEXIST: return ERROR_OBJECT_EXISTS; - case EACCES: return ERROR_WRITE_PROTECTED; - case ENOENT: return ERROR_OBJECT_NOT_AROUND; - case ENOTDIR: return ERROR_OBJECT_WRONG_TYPE; - case ENOSPC: return ERROR_DISK_IS_FULL; - case EBUSY: return ERROR_OBJECT_IN_USE; - case EISDIR: return ERROR_OBJECT_WRONG_TYPE; -#if defined(ETXTBSY) - case ETXTBSY: return ERROR_OBJECT_IN_USE; -#endif -#if defined(EROFS) - case EROFS: return ERROR_DISK_WRITE_PROTECTED; -#endif -#if defined(ENOTEMPTY) -#if ENOTEMPTY != EEXIST - case ENOTEMPTY: return ERROR_DIRECTORY_NOT_EMPTY; -#endif -#endif - - default: - write_log(("Unimplemented error %s\n", strerror(e))); - return ERROR_NOT_IMPLEMENTED; - } -} diff --git a/src/osdep/gp2x.h b/src/osdep/gp2x.h deleted file mode 100644 index fdddb057..00000000 --- a/src/osdep/gp2x.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef _GP2X_H -#define _GP2X_H - -#define GP2X_BUTTON_Y 0 -#define GP2X_BUTTON_A 1 -#define GP2X_BUTTON_X 2 -#define GP2X_BUTTON_B 3 -#define GP2X_BUTTON_R 8 -#define GP2X_BUTTON_L 7 -#define GP2X_BUTTON_START 5 -#define GP2X_BUTTON_SELECT 4 - -#define GP2X_UP (1<<0) -#define GP2X_UP_LEFT (1<<1) -#define GP2X_LEFT (1<<2) -#define GP2X_DOWN_LEFT (1<<3) -#define GP2X_DOWN (1<<4) -#define GP2X_DOWN_RIGHT (1<<5) -#define GP2X_RIGHT (1<<6) -#define GP2X_UP_RIGHT (1<<7) -#define GP2X_A (1<<12) -#define GP2X_B (1<<13) -#define GP2X_X (1<<15) -#define GP2X_Y (1<<14) -#define GP2X_L (1<<10) -#define GP2X_R (1<<11) -#define GP2X_SELECT (1<<9) -#define GP2X_START (1<<8) -#define GP2X_VOL_UP (1<<16) -#define GP2X_VOL_DOWN (1<<17) -#define GP2X_PUSH (1<<27) - -#endif diff --git a/src/osdep/gui/EditFilesysHardfile.cpp b/src/osdep/gui/EditFilesysHardfile.cpp deleted file mode 100644 index 3b00d284..00000000 --- a/src/osdep/gui/EditFilesysHardfile.cpp +++ /dev/null @@ -1,352 +0,0 @@ -#include -#include -#include -#include "sdltruetypefont.hpp" -#include "SelectorEntry.hpp" -#include "UaeRadioButton.hpp" -#include "UaeDropDown.hpp" -#include "UaeCheckBox.hpp" - -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "options.h" -#include "memory.h" -#include "uae.h" -#include "autoconf.h" -#include "filesys.h" -#include "gui.h" -#include "target.h" -#include "gui_handling.h" - - -#define DIALOG_WIDTH 520 -#define DIALOG_HEIGHT 242 - -static const char *harddisk_filter[] = { ".hdf", "\0" }; - -static bool dialogResult = false; -static bool dialogFinished = false; - -static gcn::Window *wndEditFilesysHardfile; -static gcn::Button* cmdOK; -static gcn::Button* cmdCancel; -static gcn::Label *lblDevice; -static gcn::TextField *txtDevice; -static gcn::UaeCheckBox* chkReadWrite; -static gcn::Label *lblBootPri; -static gcn::TextField *txtBootPri; -static gcn::Label *lblPath; -static gcn::TextField *txtPath; -static gcn::Button* cmdPath; -static gcn::Label *lblSurfaces; -static gcn::TextField *txtSurfaces; -static gcn::Label *lblReserved; -static gcn::TextField *txtReserved; -static gcn::Label *lblSectors; -static gcn::TextField *txtSectors; -static gcn::Label *lblBlocksize; -static gcn::TextField *txtBlocksize; - - -class FilesysHardfileActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - if(actionEvent.getSource() == cmdPath) - { - char tmp[MAX_PATH]; - strncpy(tmp, txtPath->getText().c_str(), MAX_PATH); - wndEditFilesysHardfile->releaseModalFocus(); - if(SelectFile("Select harddisk file", tmp, harddisk_filter)) - txtPath->setText(tmp); - wndEditFilesysHardfile->requestModalFocus(); - cmdPath->requestFocus(); - } - else - { - if (actionEvent.getSource() == cmdOK) - { - if(txtDevice->getText().length() <= 0) - { - // ToDo: Message to user - return; - } - dialogResult = true; - } - dialogFinished = true; - } - } -}; -static FilesysHardfileActionListener* filesysHardfileActionListener; - - -static void InitEditFilesysHardfile(void) -{ - wndEditFilesysHardfile = new gcn::Window("Edit"); - wndEditFilesysHardfile->setSize(DIALOG_WIDTH, DIALOG_HEIGHT); - wndEditFilesysHardfile->setPosition((GUI_WIDTH - DIALOG_WIDTH) / 2, (GUI_HEIGHT - DIALOG_HEIGHT) / 2); - wndEditFilesysHardfile->setBaseColor(gui_baseCol + 0x202020); - wndEditFilesysHardfile->setCaption("Volume settings"); - wndEditFilesysHardfile->setTitleBarHeight(TITLEBAR_HEIGHT); - - filesysHardfileActionListener = new FilesysHardfileActionListener(); - - cmdOK = new gcn::Button("Ok"); - cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - 2 * BUTTON_WIDTH - DISTANCE_NEXT_X, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10); - cmdOK->setBaseColor(gui_baseCol + 0x202020); - cmdOK->setId("hdfOK"); - cmdOK->addActionListener(filesysHardfileActionListener); - - cmdCancel = new gcn::Button("Cancel"); - cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10); - cmdCancel->setBaseColor(gui_baseCol + 0x202020); - cmdCancel->setId("hdfCancel"); - cmdCancel->addActionListener(filesysHardfileActionListener); - - lblDevice = new gcn::Label("Device Name:"); - lblDevice->setSize(100, LABEL_HEIGHT); - lblDevice->setAlignment(gcn::Graphics::RIGHT); - txtDevice = new gcn::TextField(); - txtDevice->setSize(80, TEXTFIELD_HEIGHT); - txtDevice->setId("hdfDev"); - - chkReadWrite = new gcn::UaeCheckBox("Read/Write", true); - chkReadWrite->setId("hdfRW"); - - lblBootPri = new gcn::Label("Boot priority:"); - lblBootPri->setSize(84, LABEL_HEIGHT); - lblBootPri->setAlignment(gcn::Graphics::RIGHT); - txtBootPri = new gcn::TextField(); - txtBootPri->setSize(40, TEXTFIELD_HEIGHT); - txtBootPri->setId("hdfBootPri"); - - lblSurfaces = new gcn::Label("Surfaces:"); - lblSurfaces->setSize(84, LABEL_HEIGHT); - lblSurfaces->setAlignment(gcn::Graphics::RIGHT); - txtSurfaces = new gcn::TextField(); - txtSurfaces->setSize(40, TEXTFIELD_HEIGHT); - txtSurfaces->setId("hdfSurface"); - - lblReserved = new gcn::Label("Reserved:"); - lblReserved->setSize(84, LABEL_HEIGHT); - lblReserved->setAlignment(gcn::Graphics::RIGHT); - txtReserved = new gcn::TextField(); - txtReserved->setSize(40, TEXTFIELD_HEIGHT); - txtReserved->setId("hdfReserved"); - - lblSectors = new gcn::Label("Sectors:"); - lblSectors->setSize(84, LABEL_HEIGHT); - lblSectors->setAlignment(gcn::Graphics::RIGHT); - txtSectors = new gcn::TextField(); - txtSectors->setSize(40, TEXTFIELD_HEIGHT); - txtSectors->setId("hdfSectors"); - - lblBlocksize = new gcn::Label("Blocksize:"); - lblBlocksize->setSize(84, LABEL_HEIGHT); - lblBlocksize->setAlignment(gcn::Graphics::RIGHT); - txtBlocksize = new gcn::TextField(); - txtBlocksize->setSize(40, TEXTFIELD_HEIGHT); - txtBlocksize->setId("hdfBlocksize"); - - lblPath = new gcn::Label("Path:"); - lblPath->setSize(100, LABEL_HEIGHT); - lblPath->setAlignment(gcn::Graphics::RIGHT); - txtPath = new gcn::TextField(); - txtPath->setSize(338, TEXTFIELD_HEIGHT); - txtPath->setEnabled(false); - cmdPath = new gcn::Button("..."); - cmdPath->setSize(SMALL_BUTTON_WIDTH, SMALL_BUTTON_HEIGHT); - cmdPath->setBaseColor(gui_baseCol + 0x202020); - cmdPath->setId("hdfPath"); - cmdPath->addActionListener(filesysHardfileActionListener); - - int posY = DISTANCE_BORDER; - wndEditFilesysHardfile->add(lblDevice, DISTANCE_BORDER, posY); - wndEditFilesysHardfile->add(txtDevice, DISTANCE_BORDER + lblDevice->getWidth() + 8, posY); - wndEditFilesysHardfile->add(chkReadWrite, 240, posY); - wndEditFilesysHardfile->add(lblBootPri, 374, posY); - wndEditFilesysHardfile->add(txtBootPri, 374 + lblBootPri->getWidth() + 8, posY); - posY += txtDevice->getHeight() + DISTANCE_NEXT_Y; - wndEditFilesysHardfile->add(lblPath, DISTANCE_BORDER, posY); - wndEditFilesysHardfile->add(txtPath, DISTANCE_BORDER + lblPath->getWidth() + 8, posY); - wndEditFilesysHardfile->add(cmdPath, wndEditFilesysHardfile->getWidth() - DISTANCE_BORDER - SMALL_BUTTON_WIDTH, posY); - posY += txtPath->getHeight() + DISTANCE_NEXT_Y; - wndEditFilesysHardfile->add(lblSurfaces, DISTANCE_BORDER, posY); - wndEditFilesysHardfile->add(txtSurfaces, DISTANCE_BORDER + lblSurfaces->getWidth() + 8, posY); - wndEditFilesysHardfile->add(lblReserved, 240, posY); - wndEditFilesysHardfile->add(txtReserved, 240 + lblReserved->getWidth() + 8, posY); - posY += txtSurfaces->getHeight() + DISTANCE_NEXT_Y; - wndEditFilesysHardfile->add(lblSectors, DISTANCE_BORDER, posY); - wndEditFilesysHardfile->add(txtSectors, DISTANCE_BORDER + lblSectors->getWidth() + 8, posY); - wndEditFilesysHardfile->add(lblBlocksize, 240, posY); - wndEditFilesysHardfile->add(txtBlocksize, 240 + lblBlocksize->getWidth() + 8, posY); - posY += txtSectors->getHeight() + DISTANCE_NEXT_Y; - - wndEditFilesysHardfile->add(cmdOK); - wndEditFilesysHardfile->add(cmdCancel); - - gui_top->add(wndEditFilesysHardfile); - - txtDevice->requestFocus(); - wndEditFilesysHardfile->requestModalFocus(); -} - - -static void ExitEditFilesysHardfile(void) -{ - wndEditFilesysHardfile->releaseModalFocus(); - gui_top->remove(wndEditFilesysHardfile); - - delete lblDevice; - delete txtDevice; - delete chkReadWrite; - delete lblBootPri; - delete txtBootPri; - delete lblPath; - delete txtPath; - delete cmdPath; - delete lblSurfaces; - delete txtSurfaces; - delete lblReserved; - delete txtReserved; - delete lblSectors; - delete txtSectors; - delete lblBlocksize; - delete txtBlocksize; - - delete cmdOK; - delete cmdCancel; - delete filesysHardfileActionListener; - - delete wndEditFilesysHardfile; -} - - -static void EditFilesysHardfileLoop(void) -{ - while(!dialogFinished) - { - SDL_Event event; - while(SDL_PollEvent(&event)) - { - if (event.type == SDL_KEYDOWN) - { - switch(event.key.keysym.sym) - { - case SDLK_ESCAPE: - dialogFinished = true; - break; - - case SDLK_UP: - if(HandleNavigation(DIRECTION_UP)) - continue; // Don't change value when enter ComboBox -> don't send event to control - break; - - case SDLK_DOWN: - if(HandleNavigation(DIRECTION_DOWN)) - continue; // Don't change value when enter ComboBox -> don't send event to control - break; - - case SDLK_LEFT: - if(HandleNavigation(DIRECTION_LEFT)) - continue; // Don't change value when enter Slider -> don't send event to control - break; - - case SDLK_RIGHT: - if(HandleNavigation(DIRECTION_RIGHT)) - continue; // Don't change value when enter Slider -> don't send event to control - break; - - case SDLK_PAGEDOWN: - case SDLK_HOME: - event.key.keysym.sym = SDLK_RETURN; - gui_input->pushInput(event); // Fire key down - event.type = SDL_KEYUP; // and the key up - break; - } - } - - //------------------------------------------------- - // Send event to guichan-controls - //------------------------------------------------- - gui_input->pushInput(event); - } - - // Now we let the Gui object perform its logic. - uae_gui->logic(); - // Now we let the Gui object draw itself. - uae_gui->draw(); - // Finally we update the screen. - SDL_Flip(gui_screen); - } -} - - -bool EditFilesysHardfile(int unit_no) -{ - char *volname, *devname, *rootdir, *filesys; - int secspertrack, surfaces, cylinders, reserved, blocksize, readonly, bootpri; - uae_u64 size; - const char *failure; - - dialogResult = false; - dialogFinished = false; - - InitEditFilesysHardfile(); - - if(unit_no >= 0) - { - char tmp[32]; - - failure = get_filesys_unit(currprefs.mountinfo, unit_no, - &devname, &volname, &rootdir, &readonly, &secspertrack, &surfaces, &reserved, - &cylinders, &size, &blocksize, &bootpri, &filesys, 0); - - txtDevice->setText(devname); - txtPath->setText(rootdir); - chkReadWrite->setSelected(!readonly); - snprintf(tmp, 32, "%d", bootpri); - txtBootPri->setText(tmp); - snprintf(tmp, 32, "%d", surfaces); - txtSurfaces->setText(tmp); - snprintf(tmp, 32, "%d", reserved); - txtReserved->setText(tmp); - snprintf(tmp, 32, "%d", secspertrack); - txtSectors->setText(tmp); - snprintf(tmp, 32, "%d", blocksize); - txtBlocksize->setText(tmp); - } - else - { - txtDevice->setText(""); - txtPath->setText(currentDir); - chkReadWrite->setSelected(true); - txtBootPri->setText("0"); - txtSurfaces->setText("1"); - txtReserved->setText("2"); - txtSectors->setText("32"); - txtBlocksize->setText("512"); - } - - EditFilesysHardfileLoop(); - ExitEditFilesysHardfile(); - - if(dialogResult) - { - if(unit_no >= 0) - kill_filesys_unit(currprefs.mountinfo, unit_no); - else - extractPath((char *) txtPath->getText().c_str(), currentDir); - failure = add_filesys_unit(currprefs.mountinfo, (char *) txtDevice->getText().c_str(), - 0, (char *) txtPath->getText().c_str(), !chkReadWrite->isSelected(), - atoi(txtSectors->getText().c_str()), atoi(txtSurfaces->getText().c_str()), - atoi(txtReserved->getText().c_str()), atoi(txtBlocksize->getText().c_str()), - atoi(txtBootPri->getText().c_str()), 0, 0); - } - - return dialogResult; -} diff --git a/src/osdep/gui/EditFilesysVirtual.cpp b/src/osdep/gui/EditFilesysVirtual.cpp deleted file mode 100644 index 3fb5225c..00000000 --- a/src/osdep/gui/EditFilesysVirtual.cpp +++ /dev/null @@ -1,303 +0,0 @@ -#include -#include -#include -#include "sdltruetypefont.hpp" -#include "SelectorEntry.hpp" -#include "UaeRadioButton.hpp" -#include "UaeDropDown.hpp" -#include "UaeCheckBox.hpp" - -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "options.h" -#include "memory.h" -#include "uae.h" -#include "autoconf.h" -#include "filesys.h" -#include "gui.h" -#include "target.h" -#include "gui_handling.h" - - -#define DIALOG_WIDTH 520 -#define DIALOG_HEIGHT 202 - -static bool dialogResult = false; -static bool dialogFinished = false; - -static gcn::Window *wndEditFilesysVirtual; -static gcn::Button* cmdOK; -static gcn::Button* cmdCancel; -static gcn::Label *lblDevice; -static gcn::TextField *txtDevice; -static gcn::Label *lblVolume; -static gcn::TextField *txtVolume; -static gcn::Label *lblPath; -static gcn::TextField *txtPath; -static gcn::Button* cmdPath; -static gcn::UaeCheckBox* chkReadWrite; -static gcn::Label *lblBootPri; -static gcn::TextField *txtBootPri; - - -class FilesysVirtualActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - if(actionEvent.getSource() == cmdPath) - { - char tmp[MAX_PATH]; - strncpy(tmp, txtPath->getText().c_str(), MAX_PATH); - wndEditFilesysVirtual->releaseModalFocus(); - if(SelectFolder("Select folder", tmp)) - txtPath->setText(tmp); - wndEditFilesysVirtual->requestModalFocus(); - cmdPath->requestFocus(); - } - else - { - if (actionEvent.getSource() == cmdOK) - { - if(txtDevice->getText().length() <= 0) - { - // ToDo: Message to user - return; - } - if(txtVolume->getText().length() <= 0) - { - // ToDo: Message to user - return; - } - dialogResult = true; - } - dialogFinished = true; - } - } -}; -static FilesysVirtualActionListener* filesysVirtualActionListener; - - -static void InitEditFilesysVirtual(void) -{ - wndEditFilesysVirtual = new gcn::Window("Edit"); - wndEditFilesysVirtual->setSize(DIALOG_WIDTH, DIALOG_HEIGHT); - wndEditFilesysVirtual->setPosition((GUI_WIDTH - DIALOG_WIDTH) / 2, (GUI_HEIGHT - DIALOG_HEIGHT) / 2); - wndEditFilesysVirtual->setBaseColor(gui_baseCol + 0x202020); - wndEditFilesysVirtual->setCaption("Volume settings"); - wndEditFilesysVirtual->setTitleBarHeight(TITLEBAR_HEIGHT); - - filesysVirtualActionListener = new FilesysVirtualActionListener(); - - cmdOK = new gcn::Button("Ok"); - cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - 2 * BUTTON_WIDTH - DISTANCE_NEXT_X, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10); - cmdOK->setBaseColor(gui_baseCol + 0x202020); - cmdOK->setId("virtOK"); - cmdOK->addActionListener(filesysVirtualActionListener); - - cmdCancel = new gcn::Button("Cancel"); - cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10); - cmdCancel->setBaseColor(gui_baseCol + 0x202020); - cmdCancel->setId("virtCancel"); - cmdCancel->addActionListener(filesysVirtualActionListener); - - lblDevice = new gcn::Label("Device Name:"); - lblDevice->setSize(100, LABEL_HEIGHT); - lblDevice->setAlignment(gcn::Graphics::RIGHT); - txtDevice = new gcn::TextField(); - txtDevice->setSize(80, TEXTFIELD_HEIGHT); - txtDevice->setId("virtDev"); - - lblVolume = new gcn::Label("Volume Label:"); - lblVolume->setSize(100, LABEL_HEIGHT); - lblVolume->setAlignment(gcn::Graphics::RIGHT); - txtVolume = new gcn::TextField(); - txtVolume->setSize(80, TEXTFIELD_HEIGHT); - txtVolume->setId("virtVol"); - - lblPath = new gcn::Label("Path:"); - lblPath->setSize(100, LABEL_HEIGHT); - lblPath->setAlignment(gcn::Graphics::RIGHT); - txtPath = new gcn::TextField(); - txtPath->setSize(338, TEXTFIELD_HEIGHT); - txtPath->setEnabled(false); - cmdPath = new gcn::Button("..."); - cmdPath->setSize(SMALL_BUTTON_WIDTH, SMALL_BUTTON_HEIGHT); - cmdPath->setBaseColor(gui_baseCol + 0x202020); - cmdPath->setId("virtPath"); - cmdPath->addActionListener(filesysVirtualActionListener); - - chkReadWrite = new gcn::UaeCheckBox("Read/Write", true); - chkReadWrite->setId("virtRW"); - - lblBootPri = new gcn::Label("Boot priority:"); - lblBootPri->setSize(84, LABEL_HEIGHT); - lblBootPri->setAlignment(gcn::Graphics::RIGHT); - txtBootPri = new gcn::TextField(); - txtBootPri->setSize(40, TEXTFIELD_HEIGHT); - txtBootPri->setId("virtBootpri"); - - int posY = DISTANCE_BORDER; - wndEditFilesysVirtual->add(lblDevice, DISTANCE_BORDER, posY); - wndEditFilesysVirtual->add(txtDevice, DISTANCE_BORDER + lblDevice->getWidth() + 8, posY); - wndEditFilesysVirtual->add(chkReadWrite, 260, posY); - posY += txtDevice->getHeight() + DISTANCE_NEXT_Y; - wndEditFilesysVirtual->add(lblVolume, DISTANCE_BORDER, posY); - wndEditFilesysVirtual->add(txtVolume, DISTANCE_BORDER + lblDevice->getWidth() + 8, posY); - wndEditFilesysVirtual->add(lblBootPri, 260, posY); - wndEditFilesysVirtual->add(txtBootPri, 260 + lblBootPri->getWidth() + 8, posY); - posY += txtDevice->getHeight() + DISTANCE_NEXT_Y; - wndEditFilesysVirtual->add(lblPath, DISTANCE_BORDER, posY); - wndEditFilesysVirtual->add(txtPath, DISTANCE_BORDER + lblDevice->getWidth() + 8, posY); - wndEditFilesysVirtual->add(cmdPath, wndEditFilesysVirtual->getWidth() - DISTANCE_BORDER - SMALL_BUTTON_WIDTH, posY); - posY += txtDevice->getHeight() + DISTANCE_NEXT_Y; - - wndEditFilesysVirtual->add(cmdOK); - wndEditFilesysVirtual->add(cmdCancel); - - gui_top->add(wndEditFilesysVirtual); - - txtDevice->requestFocus(); - wndEditFilesysVirtual->requestModalFocus(); -} - - -static void ExitEditFilesysVirtual(void) -{ - wndEditFilesysVirtual->releaseModalFocus(); - gui_top->remove(wndEditFilesysVirtual); - - delete lblDevice; - delete txtDevice; - delete lblVolume; - delete txtVolume; - delete lblPath; - delete txtPath; - delete cmdPath; - delete chkReadWrite; - delete lblBootPri; - delete txtBootPri; - - delete cmdOK; - delete cmdCancel; - delete filesysVirtualActionListener; - - delete wndEditFilesysVirtual; -} - - -static void EditFilesysVirtualLoop(void) -{ - while(!dialogFinished) - { - SDL_Event event; - while(SDL_PollEvent(&event)) - { - if (event.type == SDL_KEYDOWN) - { - switch(event.key.keysym.sym) - { - case SDLK_ESCAPE: - dialogFinished = true; - break; - - case SDLK_UP: - if(HandleNavigation(DIRECTION_UP)) - continue; // Don't change value when enter ComboBox -> don't send event to control - break; - - case SDLK_DOWN: - if(HandleNavigation(DIRECTION_DOWN)) - continue; // Don't change value when enter ComboBox -> don't send event to control - break; - - case SDLK_LEFT: - if(HandleNavigation(DIRECTION_LEFT)) - continue; // Don't change value when enter Slider -> don't send event to control - break; - - case SDLK_RIGHT: - if(HandleNavigation(DIRECTION_RIGHT)) - continue; // Don't change value when enter Slider -> don't send event to control - break; - - case SDLK_PAGEDOWN: - case SDLK_HOME: - event.key.keysym.sym = SDLK_RETURN; - gui_input->pushInput(event); // Fire key down - event.type = SDL_KEYUP; // and the key up - break; - } - } - - //------------------------------------------------- - // Send event to guichan-controls - //------------------------------------------------- - gui_input->pushInput(event); - } - - // Now we let the Gui object perform its logic. - uae_gui->logic(); - // Now we let the Gui object draw itself. - uae_gui->draw(); - // Finally we update the screen. - SDL_Flip(gui_screen); - } -} - - -bool EditFilesysVirtual(int unit_no) -{ - char *volname, *devname, *rootdir, *filesys; - int secspertrack, surfaces, cylinders, reserved, blocksize, readonly, bootpri; - uae_u64 size; - const char *failure; - - dialogResult = false; - dialogFinished = false; - - InitEditFilesysVirtual(); - - if(unit_no >= 0) - { - char tmp[32]; - - failure = get_filesys_unit(currprefs.mountinfo, unit_no, - &devname, &volname, &rootdir, &readonly, &secspertrack, &surfaces, &reserved, - &cylinders, &size, &blocksize, &bootpri, &filesys, 0); - - txtDevice->setText(devname); - txtVolume->setText(volname); - txtPath->setText(rootdir); - chkReadWrite->setSelected(!readonly); - snprintf(tmp, 32, "%d", bootpri); - txtBootPri->setText(tmp); - } - else - { - txtDevice->setText(""); - txtVolume->setText(""); - txtPath->setText(currentDir); - chkReadWrite->setSelected(true); - txtBootPri->setText("0"); - } - - EditFilesysVirtualLoop(); - ExitEditFilesysVirtual(); - - if(dialogResult) - { - if(unit_no >= 0) - kill_filesys_unit(currprefs.mountinfo, unit_no); - else - extractPath((char *) txtPath->getText().c_str(), currentDir); - failure = add_filesys_unit(currprefs.mountinfo, (char *) txtDevice->getText().c_str(), - (char *) txtVolume->getText().c_str(), (char *) txtPath->getText().c_str(), - !chkReadWrite->isSelected(), 0, 0, 0, 0, atoi(txtBootPri->getText().c_str()), 0, 0); - } - - return dialogResult; -} diff --git a/src/osdep/gui/InGameMessage.cpp b/src/osdep/gui/InGameMessage.cpp deleted file mode 100644 index d466656c..00000000 --- a/src/osdep/gui/InGameMessage.cpp +++ /dev/null @@ -1,142 +0,0 @@ -#include -#include -#include -#include "sdltruetypefont.hpp" -#include "SelectorEntry.hpp" - -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "options.h" -#include "uae.h" -#include "gui.h" -#include "target.h" -#include "gui_handling.h" - - -extern SDL_Surface *prSDLScreen; - - -static int msg_done = 0; -class DoneActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - msg_done = 1; - } -}; -static DoneActionListener* doneActionListener; - - -void InGameMessage(const char *msg) -{ - gcn::Gui* msg_gui; - gcn::SDLGraphics* msg_graphics; - gcn::SDLInput* msg_input; - gcn::contrib::SDLTrueTypeFont* msg_font; - gcn::Color msg_baseCol; - - gcn::Container* msg_top; - gcn::Window *wndMsg; - gcn::Button* cmdDone; - gcn::TextBox* txtMsg; - - int msgWidth = 260; - int msgHeight = 100; - - msg_graphics = new gcn::SDLGraphics(); - msg_graphics->setTarget(prSDLScreen); - msg_input = new gcn::SDLInput(); - msg_gui = new gcn::Gui(); - msg_gui->setGraphics(msg_graphics); - msg_gui->setInput(msg_input); - - msg_baseCol.r = 192; - msg_baseCol.g = 192; - msg_baseCol.b = 208; - - msg_top = new gcn::Container(); - msg_top->setDimension(gcn::Rectangle((prSDLScreen->w - msgWidth) / 2, (prSDLScreen->h - msgHeight) / 2, msgWidth, msgHeight)); - msg_top->setBaseColor(msg_baseCol); - msg_gui->setTop(msg_top); - - TTF_Init(); - msg_font = new gcn::contrib::SDLTrueTypeFont("data/FreeSans.ttf", 10); - gcn::Widget::setGlobalFont(msg_font); - - doneActionListener = new DoneActionListener(); - - wndMsg = new gcn::Window("Load"); - wndMsg->setSize(msgWidth, msgHeight); - wndMsg->setPosition(0, 0); - wndMsg->setBaseColor(msg_baseCol + 0x202020); - wndMsg->setCaption("Information"); - wndMsg->setTitleBarHeight(12); - - cmdDone = new gcn::Button("Ok"); - cmdDone->setSize(40, 20); - cmdDone->setBaseColor(msg_baseCol + 0x202020); - cmdDone->addActionListener(doneActionListener); - - txtMsg = new gcn::TextBox(msg); - txtMsg->setEnabled(false); - txtMsg->setPosition(6, 6); - txtMsg->setSize(wndMsg->getWidth() - 16, 46); - txtMsg->setOpaque(false); - - wndMsg->add(txtMsg, 6, 6); - wndMsg->add(cmdDone, (wndMsg->getWidth() - cmdDone->getWidth()) / 2, wndMsg->getHeight() - 38); - - msg_top->add(wndMsg); - cmdDone->requestFocus(); - - msg_done = 0; - while(!msg_done) - { - //------------------------------------------------- - // Check user input - //------------------------------------------------- - SDL_Event event; - while(SDL_PollEvent(&event)) - { - if (event.type == SDL_KEYDOWN) - { - switch(event.key.keysym.sym) - { - case SDLK_PAGEDOWN: - case SDLK_HOME: - case SDLK_RETURN: - msg_done = 1; - break; - } - } - - //------------------------------------------------- - // Send event to guichan-controls - //------------------------------------------------- - msg_input->pushInput(event); - } - - // Now we let the Gui object perform its logic. - msg_gui->logic(); - // Now we let the Gui object draw itself. - msg_gui->draw(); - // Finally we update the screen. - SDL_Flip(prSDLScreen); - } - - msg_top->remove(wndMsg); - - delete txtMsg; - delete cmdDone; - delete doneActionListener; - delete wndMsg; - - delete msg_font; - delete msg_top; - - delete msg_gui; - delete msg_input; - delete msg_graphics; -} diff --git a/src/osdep/gui/Navigation.cpp b/src/osdep/gui/Navigation.cpp deleted file mode 100644 index c1af2aec..00000000 --- a/src/osdep/gui/Navigation.cpp +++ /dev/null @@ -1,289 +0,0 @@ -#include -#include -#include -#include "sdltruetypefont.hpp" -#include "SelectorEntry.hpp" -#include "UaeRadioButton.hpp" -#include "UaeDropDown.hpp" - -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "target.h" -#include "gui_handling.h" - -typedef struct -{ - std::string activeWidget; - std::string leftWidget; - std::string rightWidget; - std::string upWidget; - std::string downWidget; -} NavigationMap; - - -static NavigationMap navMap[] = -{ -// active move left move right move up move down -// main_window - { "Paths", "SystemROMs", "SystemROMs", "Reset", "Configurations" }, - { "Configurations", "ConfigList", "ConfigList", "Paths", "CPU" }, - { "CPU", "7 Mhz", "68000", "Configurations", "Chipset" }, - { "Chipset", "BlitNormal", "OCS", "CPU", "ROM" }, - { "ROM", "MainROM", "cboMainROM", "Chipset", "RAM" }, - { "RAM", "Chipmem", "Chipmem", "ROM", "Floppy drives" }, - { "Floppy drives", "cmdSel0", "DF0:", "RAM", "Hard drives" }, - { "Hard drives", "cmdDel0", "cmdProp0", "Floppy drives", "Display" }, - { "Display", "sldWidth", "sldWidth", "Hard drives", "Sound" }, - { "Sound", "sndDisable", "sndDisable", "Display", "Input" }, - { "Input", "cboCtrlConfig", "cboCtrlConfig", "Sound", "Miscellaneous" }, - { "Miscellaneous", "Status Line", "Status Line", "Input", "Savestates" }, - { "Savestates", "State0", "State0", "Miscellaneous", "Reset" }, - { "Reset", "Start", "Quit", "Savestates", "Paths" }, - { "Quit", "Reset", "Restart", "Savestates", "Paths" }, - { "Restart", "Quit", "Start", "Savestates", "Paths" }, - { "Start", "Restart", "Reset", "Savestates", "Paths" }, - -// PanelPaths - { "SystemROMs", "Paths", "Paths", "RescanROMs", "ConfigPath" }, - { "ConfigPath", "Paths", "Paths", "SystemROMs", "RescanROMs" }, - { "RescanROMs", "Paths", "Paths", "ConfigPath", "SystemROMs" }, - -// PanelConfig - { "ConfigList", "Configurations", "ConfigName", "", "" }, - { "ConfigName", "Configurations", "Configurations", "ConfigList", "ConfigDesc" }, - { "ConfigDesc", "Configurations", "Configurations", "ConfigName", "ConfigLoad" }, - { "ConfigLoad", "Configurations", "ConfigSave", "ConfigDesc", "ConfigList" }, - { "ConfigSave", "ConfigLoad", "CfgDelete", "ConfigDesc", "ConfigList" }, - { "CfgDelete", "ConfigSave", "Configurations", "ConfigDesc", "ConfigList" }, - -// active move left move right move up move down -// PanelCPU - { "68000", "CPU", "7 Mhz", "JIT", "68010" }, - { "68010", "CPU", "14 Mhz", "68000", "68EC020" }, - { "68EC020", "CPU", "28 Mhz", "68010", "68020" }, - { "68020", "CPU", "Fastest", "68EC020", "68040" }, - { "68040", "CPU", "Fastest", "68020", "CPUComp" }, - { "CPUComp", "CPU", "Fastest", "68040", "JIT" }, - { "JIT", "CPU", "Fastest", "CPUComp", "68000" }, - { "7 Mhz", "68000", "CPU", "Fastest", "14 Mhz" }, - { "14 Mhz", "68010", "CPU", "7 Mhz", "28 Mhz" }, - { "28 Mhz", "68EC020", "CPU", "14 Mhz", "Fastest" }, - { "Fastest", "68020", "CPU", "28 Mhz", "7 Mhz" }, - -// PanelChipset - { "OCS", "Chipset", "BlitNormal", "CollFull", "ECS" }, - { "ECS", "Chipset", "Immediate", "OCS", "AGA" }, - { "AGA", "Chipset", "Improved", "ECS", "NTSC" }, - { "NTSC", "Chipset", "Chipset", "AGA", "CollNone" }, - { "BlitNormal", "OCS", "Chipset", "CollFull", "Immediate" }, - { "Immediate", "ECS", "Chipset", "BlitNormal", "Improved" }, - { "Improved", "AGA", "Chipset", "Immediate", "CollNone" }, - { "CollNone", "Chipset", "Chipset", "NTSC", "Sprites only" }, - { "Sprites only", "Chipset", "Chipset", "CollNone", "CollPlay" }, - { "CollPlay", "Chipset", "Chipset", "Sprites only", "CollFull" }, - { "CollFull", "Chipset", "Chipset", "CollPlay", "OCS" }, - -// active move left move right move up move down -// PanelROM - { "cboMainROM", "ROM", "MainROM", "cboExtROM", "cboExtROM" }, - { "MainROM", "cboMainROM", "ROM", "ExtROM", "ExtROM" }, - { "cboExtROM", "ROM", "ExtROM", "cboMainROM", "cboMainROM" }, - { "ExtROM", "cboExtROM", "ROM", "MainROM", "MainROM" }, - -//PanelRAM - { "Chipmem", "", "", "RAM", "Slowmem" }, - { "Slowmem", "", "", "Chipmem", "Fastmem" }, - { "Fastmem", "", "", "Slowmem", "Z3mem" }, - { "Z3mem", "", "", "Fastmem", "Gfxmem" }, - { "Gfxmem", "", "", "Z3mem", "RAM" }, - -//PanelFloppy - { "DF0:", "Floppy drives", "cboType0", "SaveForDisk", "cboDisk0" }, - { "cboType0", "DF0:", "cmdEject0", "SaveForDisk", "cboDisk0" }, - { "cmdEject0", "cboType0", "cmdSel0", "SaveForDisk", "cboDisk0" }, - { "cmdSel0", "cmdEject0", "Floppy drives", "SaveForDisk", "cboDisk0" }, - { "cboDisk0", "Floppy drives", "Floppy drives", "DF0:", "DF1:" }, - { "DF1:", "Floppy drives", "cboType1", "cboDisk0", "cboDisk1" }, - { "cboType1", "DF1:", "cmdEject1", "cboDisk0", "cboDisk1" }, - { "cmdEject1", "cboType1", "cmdSel1", "cboDisk0", "cboDisk1" }, - { "cmdSel1", "cmdEject1", "Floppy drives", "cboDisk0", "cboDisk1" }, - { "cboDisk1", "Floppy drives", "Floppy drives", "DF1:", "DF2:" }, - { "DF2:", "Floppy drives", "cboType2", "cboDisk1", "cboDisk2" }, - { "cboType2", "DF2:", "cmdEject2", "cboDisk1", "cboDisk2" }, - { "cmdEject2", "cboType2", "cmdSel2", "cboDisk1", "cboDisk2" }, - { "cmdSel2", "cmdEject2", "Floppy drives", "cboDisk1", "cboDisk2" }, - { "cboDisk2", "Floppy drives", "Floppy drives", "DF2:", "DF3:" }, - { "DF3:", "Floppy drives", "cboType3", "cboDisk2", "cboDisk3" }, - { "cboType3", "DF3:", "cmdEject3", "cboDisk2", "cboDisk3" }, - { "cmdEject3", "cboType3", "cmdSel3", "cboDisk2", "cboDisk3" }, - { "cmdSel3", "cmdEject3", "Floppy drives", "cboDisk2", "cboDisk3" }, - { "cboDisk3", "Floppy drives", "Floppy drives", "DF3:", "DriveSpeed" }, - { "DriveSpeed", "", "", "cboDisk3", "SaveForDisk" }, - { "SaveForDisk", "Floppy drives", "Floppy drives", "DriveSpeed", "DF0:" }, - -// active move left move right move up move down -// PanelHD - { "cmdProp0", "Hard drives", "cmdDel0", "cmdAddDir", "cmdProp1" }, - { "cmdDel0", "cmdProp0", "Hard drives", "cmdAddHDF", "cmdDel1" }, - { "cmdProp1", "Hard drives", "cmdDel1", "cmdProp0", "cmdProp2" }, - { "cmdDel1", "cmdProp1", "Hard drives", "cmdDel0", "cmdDel2" }, - { "cmdProp2", "Hard drives", "cmdDel2", "cmdProp1", "cmdProp3" }, - { "cmdDel2", "cmdProp2", "Hard drives", "cmdDel1", "cmdDel3" }, - { "cmdProp3", "Hard drives", "cmdDel3", "cmdProp2", "cmdProp4" }, - { "cmdDel3", "cmdProp3", "Hard drives", "cmdDel2", "cmdDel4" }, - { "cmdProp4", "Hard drives", "cmdDel4", "cmdProp3", "cmdAddDir" }, - { "cmdDel4", "cmdProp4", "Hard drives", "cmdDel3", "cmdAddHDF" }, - { "cmdAddDir", "Hard drives", "cmdAddHDF", "cmdProp4", "cmdProp0" }, - { "cmdAddHDF", "cmdAddDir", "Hard drives", "cmdDel4", "cmdDel0" }, - -// PanelDisplay - { "sldWidth", "", "", "Frameskip", "sldHeight" }, - { "sldHeight", "", "", "sldWidth", "sldVertPos" }, - { "sldVertPos", "", "", "sldHeight", "Frameskip" }, - { "Frameskip", "Display", "Display", "sldVertPos", "sldWidth" }, - -//PanelSound - { "sndDisable", "Sound", "Mono", "sldStereoDelay", "sndDisEmu" }, - { "sndDisEmu", "Sound", "Stereo", "sndDisable", "sndEmulate" }, - { "sndEmulate", "Sound", "Stereo", "sndDisEmu", "sndEmuBest" }, - { "sndEmuBest", "Sound", "Stereo", "sndEmulate", "cboFrequency" }, - { "Mono", "sndDisable", "Sound", "sldStereoDelay", "Stereo" }, - { "Stereo", "sndDisEmu", "Sound", "Mono", "cboFrequency" }, - { "cboFrequency", "Sound", "Sound", "sndEmuBest", "cboInterpol" }, - { "cboInterpol", "Sound", "Sound", "cboFrequency", "cboFilter" }, - { "cboFilter", "Sound", "Sound", "cboInterpol", "sldSeparation" }, - { "sldSeparation", "", "", "cboFilter", "sldStereoDelay" }, - { "sldStereoDelay", "", "", "sldSeparation", "sndDisable" }, - -// PanelInput - { "cboCtrlConfig", "Input", "Input", "cboLeft", "cboJoystick" }, - { "cboJoystick", "Input", "cboAutofire", "cboCtrlConfig", "cboTapDelay" }, - { "cboAutofire", "cboJoystick", "Input", "cboCtrlConfig", "cboTapDelay" }, - { "cboTapDelay", "Input", "Input", "cboJoystick", "MouseSpeed" }, - { "MouseSpeed", "", "", "cboTapDelay", "StylusOffset" }, - { "StylusOffset", "", "", "MouseSpeed", "cboDPAD" }, - { "cboDPAD", "Input", "CustomCtrl", "StylusOffset", "cboA" }, - { "CustomCtrl", "cboDPAD", "Input", "StylusOffset", "cboB" }, - { "cboA", "Input", "cboB", "cboDPAD", "cboX" }, - { "cboB", "cboA", "Input", "CustomCtrl", "cboY" }, - { "cboX", "Input", "cboY", "cboA", "cboL" }, - { "cboY", "cboX", "Input", "cboB", "cboR" }, - { "cboL", "Input", "cboR", "cboX", "cboUp" }, - { "cboR", "cboL", "Input", "cboY", "cboDown" }, - { "cboUp", "Input", "cboDown", "cboL", "cboLeft" }, - { "cboDown", "cboUp", "Input", "cboR", "cboRight" }, - { "cboLeft", "Input", "cboRight", "cboUp", "cboCtrlConfig" }, - { "cboRight", "cboLeft", "Input", "cboDown", "cboCtrlConfig" }, - -// PanelMisc - { "Status Line", "Miscellaneous", "Miscellaneous", "PandSpeed", "ShowGUI" }, - { "ShowGUI", "Miscellaneous", "Miscellaneous", "Status Line", "PandSpeed" }, - { "PandSpeed", "", "", "ShowGUI", "Status Line" }, - -// PanelSavestate - { "State0", "Savestates", "Savestates", "LoadState", "State1" }, - { "State1", "Savestates", "Savestates", "State0", "State2" }, - { "State2", "Savestates", "Savestates", "State1", "State3" }, - { "State3", "Savestates", "Savestates", "State2", "LoadState" }, - { "LoadState", "Savestates", "SaveState", "State3", "State0" }, - { "SaveState", "LoadState", "Savestates", "State3", "State0" }, - - -// active move left move right move up move down -// EditFilesysVirtual - { "virtDev", "virtRW", "virtRW", "virtOK", "virtVol" }, - { "virtVol", "virtBootpri", "virtBootpri", "virtDev", "virtPath" }, - { "virtPath", "", "", "virtBootpri", "virtCancel" }, - { "virtRW", "virtDev", "virtDev", "virtOK", "virtBootpri" }, - { "virtBootpri", "virtVol", "virtVol", "virtRW", "virtPath" }, - { "virtOK", "virtCancel", "virtCancel", "virtPath", "virtRW" }, - { "virtCancel", "virtOK", "virtOK", "virtPath", "virtRW" }, - -// EditFilesysHardfile - { "hdfDev", "hdfBootPri", "hdfRW", "hdfOK", "hdfPath" }, - { "hdfRW", "hdfDev", "hdfBootPri", "hdfOK", "hdfPath" }, - { "hdfBootPri", "hdfRW", "hdfDev", "hdfCancel", "hdfPath" }, - { "hdfSurface", "hdfReserved", "hdfReserved", "hdfPath", "hdfSectors" }, - { "hdfReserved", "hdfSurface", "hdfSurface", "hdfPath", "hdfBlocksize" }, - { "hdfSectors", "hdfBlocksize", "hdfBlocksize", "hdfSurface", "hdfOK" }, - { "hdfBlocksize", "hdfSectors", "hdfSectors", "hdfReserved", "hdfOK" }, - { "hdfPath", "", "", "hdfBootPri", "hdfReserved" }, - { "hdfOK", "hdfCancel", "hdfCancel", "hdfBlocksize", "hdfBootPri" }, - { "hdfCancel", "hdfOK", "hdfOK", "hdfBlocksize", "hdfBootPri" }, - - { "END", "", "", "", "" } -}; - - -bool HandleNavigation(int direction) -{ - gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler(); - gcn::Widget* focusTarget = NULL; - - if(focusHdl != NULL) - { - gcn::Widget* activeWidget = focusHdl->getFocused(); - - if(activeWidget != NULL && activeWidget->getId().length() > 0) - { - std::string activeName = activeWidget->getId(); - bool bFoundEnabled = false; - - while(!bFoundEnabled) - { - std::string searchFor = ""; - - for(int i=0; navMap[i].activeWidget != "END"; ++i) - { - if(navMap[i].activeWidget == activeName) - { - switch(direction) - { - case DIRECTION_LEFT: - searchFor = navMap[i].leftWidget; - break; - case DIRECTION_RIGHT: - searchFor = navMap[i].rightWidget; - break; - case DIRECTION_UP: - searchFor = navMap[i].upWidget; - break; - case DIRECTION_DOWN: - searchFor = navMap[i].downWidget; - break; - } - if(searchFor.length() > 0) - { - focusTarget = gui_top->findWidgetById(searchFor); - if(focusTarget != NULL) - { - if(focusTarget->isEnabled()) - bFoundEnabled = true; - else - activeName = searchFor; - } - } - break; - } - } - if(searchFor == "") - bFoundEnabled = true; // No entry to navigate to -> exit loop - } - - if(focusTarget != NULL) - { - if(!activeWidget->getId().substr(0, 3).compare("cbo")) - { - gcn::UaeDropDown *dropdown = (gcn::UaeDropDown *) activeWidget; - if(dropdown->isDroppedDown() && (direction == DIRECTION_UP || direction == DIRECTION_DOWN)) - focusTarget = NULL; // Up/down navigates in list if dropped down - } - } - } - } - - if(focusTarget != NULL) - focusTarget->requestFocus(); - return (focusTarget != NULL); -} diff --git a/src/osdep/gui/PanelCPU.cpp b/src/osdep/gui/PanelCPU.cpp deleted file mode 100644 index 4331a179..00000000 --- a/src/osdep/gui/PanelCPU.cpp +++ /dev/null @@ -1,326 +0,0 @@ -#include -#include -#include -#include "sdltruetypefont.hpp" -#include "SelectorEntry.hpp" -#include "UaeRadioButton.hpp" -#include "UaeCheckBox.hpp" - -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "options.h" -#include "uae.h" -#include "gui.h" -#include "target.h" -#include "gui_handling.h" - - -static gcn::Window *grpCPU; -static gcn::UaeRadioButton* optCPU68000; -static gcn::UaeRadioButton* optCPU68010; -static gcn::UaeRadioButton* optCPU68EC020; -static gcn::UaeRadioButton* optCPU68020; -static gcn::UaeRadioButton* optCPU68040; -static gcn::UaeCheckBox* chkCPUCompatible; -static gcn::UaeCheckBox* chkJIT; -static gcn::Window *grpFPU; -static gcn::UaeRadioButton* optFPUnone; -static gcn::UaeRadioButton* optFPU68881; -static gcn::UaeRadioButton* optFPU68882; -static gcn::Window *grpCPUSpeed; -static gcn::UaeRadioButton* opt7Mhz; -static gcn::UaeRadioButton* opt14Mhz; -static gcn::UaeRadioButton* opt28Mhz; -static gcn::UaeRadioButton* optFastest; - - -class CPUButtonActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - if (actionEvent.getSource() == optCPU68000) - { - changed_prefs.cpu_level = 0; - changed_prefs.address_space_24 = true; - changed_prefs.z3fastmem_size = 0; - changed_prefs.gfxmem_size = 0; - } - else if (actionEvent.getSource() == optCPU68010) - { - changed_prefs.cpu_level = 1; - changed_prefs.address_space_24 = true; - changed_prefs.z3fastmem_size = 0; - changed_prefs.gfxmem_size = 0; - changed_prefs.cpu_compatible = 0; - } - else if (actionEvent.getSource() == optCPU68EC020) - { - changed_prefs.cpu_level = 2; - changed_prefs.address_space_24 = true; - changed_prefs.z3fastmem_size = 0; - changed_prefs.gfxmem_size = 0; - changed_prefs.cpu_compatible = 0; - } - else if (actionEvent.getSource() == optCPU68020) - { - if(optFPU68881->isSelected()) - changed_prefs.cpu_level = 3; // with 68881 - else - changed_prefs.cpu_level = 2; // no fpu - changed_prefs.address_space_24 = false; - changed_prefs.cpu_compatible = 0; - } - else if (actionEvent.getSource() == optCPU68040) - { - changed_prefs.cpu_level = 4; - changed_prefs.address_space_24 = false; - changed_prefs.cpu_compatible = 0; - } - RefreshPanelCPU(); - RefreshPanelRAM(); - } -}; -static CPUButtonActionListener* cpuButtonActionListener; - - -class FPUButtonActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - if (actionEvent.getSource() == optFPUnone) - { - if(changed_prefs.cpu_level == 3) - changed_prefs.cpu_level = 2; - } - else if(actionEvent.getSource() == optFPU68881) - { - if(changed_prefs.cpu_level == 2) - changed_prefs.cpu_level = 3; - } - else - ; - } -}; -static FPUButtonActionListener* fpuButtonActionListener; - - -class CPUSpeedButtonActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - if (actionEvent.getSource() == opt7Mhz) - changed_prefs.m68k_speed = M68K_SPEED_7MHZ_CYCLES; - else if (actionEvent.getSource() == opt14Mhz) - changed_prefs.m68k_speed = M68K_SPEED_14MHZ_CYCLES; - else if (actionEvent.getSource() == opt28Mhz) - changed_prefs.m68k_speed = M68K_SPEED_25MHZ_CYCLES; - else if (actionEvent.getSource() == optFastest) - changed_prefs.m68k_speed = -1; - } -}; -static CPUSpeedButtonActionListener* cpuSpeedButtonActionListener; - - -class CPUCompActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - if (chkCPUCompatible->isSelected()) - { - changed_prefs.cpu_compatible = 1; - changed_prefs.cachesize = 0; - } - else - { - changed_prefs.cpu_compatible = 0; - } - RefreshPanelCPU(); - } -}; -static CPUCompActionListener* cpuCompActionListener; - - -class JITActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - if (chkJIT->isSelected()) - { - changed_prefs.cpu_compatible = 0; - changed_prefs.cachesize = 8192; - } - else - { - changed_prefs.cachesize = 0; - } - RefreshPanelCPU(); - } -}; -static JITActionListener* jitActionListener; - - -void InitPanelCPU(const struct _ConfigCategory& category) -{ - cpuButtonActionListener = new CPUButtonActionListener(); - cpuCompActionListener = new CPUCompActionListener(); - jitActionListener = new JITActionListener(); - - optCPU68000 = new gcn::UaeRadioButton("68000", "radiocpugroup"); - optCPU68000->addActionListener(cpuButtonActionListener); - optCPU68010 = new gcn::UaeRadioButton("68010", "radiocpugroup"); - optCPU68010->addActionListener(cpuButtonActionListener); - optCPU68EC020 = new gcn::UaeRadioButton("68EC020", "radiocpugroup"); - optCPU68EC020->addActionListener(cpuButtonActionListener); - optCPU68020 = new gcn::UaeRadioButton("68020", "radiocpugroup"); - optCPU68020->addActionListener(cpuButtonActionListener); - optCPU68040 = new gcn::UaeRadioButton("68040", "radiocpugroup"); - optCPU68040->addActionListener(cpuButtonActionListener); - - chkCPUCompatible = new gcn::UaeCheckBox("More compatible", true); - chkCPUCompatible->setId("CPUComp"); - chkCPUCompatible->addActionListener(cpuCompActionListener); - - chkJIT = new gcn::UaeCheckBox("JIT", true); - chkJIT->setId("JIT"); - chkJIT->addActionListener(jitActionListener); - - grpCPU = new gcn::Window("CPU"); - grpCPU->setPosition(DISTANCE_BORDER, DISTANCE_BORDER); - grpCPU->add(optCPU68000, 5, 10); - grpCPU->add(optCPU68010, 5, 40); - grpCPU->add(optCPU68EC020, 5, 70); - grpCPU->add(optCPU68020, 5, 100); - grpCPU->add(optCPU68040, 5, 130); - grpCPU->add(chkCPUCompatible, 5, 170); - grpCPU->add(chkJIT, 5, 200); - grpCPU->setMovable(false); - grpCPU->setSize(160, 245); - grpCPU->setBaseColor(gui_baseCol); - - category.panel->add(grpCPU); - - fpuButtonActionListener = new FPUButtonActionListener(); - - optFPUnone = new gcn::UaeRadioButton("None", "radiofpugroup"); - optFPUnone->setId("FPUnone"); - optFPUnone->addActionListener(fpuButtonActionListener); - - optFPU68881 = new gcn::UaeRadioButton("68881", "radiofpugroup"); - optFPU68881->addActionListener(fpuButtonActionListener); - - optFPU68882 = new gcn::UaeRadioButton("68882", "radiofpugroup"); - optFPU68882->addActionListener(fpuButtonActionListener); - - grpFPU = new gcn::Window("FPU"); - grpFPU->setPosition(DISTANCE_BORDER, DISTANCE_BORDER + grpCPU->getHeight() + DISTANCE_NEXT_Y); - grpFPU->add(optFPUnone, 5, 10); - grpFPU->add(optFPU68881, 5, 40); -// grpFPU->add(optFPU68882, 5, 70); - grpFPU->setMovable(false); - grpFPU->setSize(grpCPU->getWidth(), 115); - grpFPU->setBaseColor(gui_baseCol); - - category.panel->add(grpFPU); - - cpuSpeedButtonActionListener = new CPUSpeedButtonActionListener(); - - opt7Mhz = new gcn::UaeRadioButton("7 Mhz", "radiocpuspeedgroup"); - opt7Mhz->addActionListener(cpuSpeedButtonActionListener); - - opt14Mhz = new gcn::UaeRadioButton("14 Mhz", "radiocpuspeedgroup"); - opt14Mhz->addActionListener(cpuSpeedButtonActionListener); - - opt28Mhz = new gcn::UaeRadioButton("28 Mhz", "radiocpuspeedgroup"); - opt28Mhz->addActionListener(cpuSpeedButtonActionListener); - - optFastest = new gcn::UaeRadioButton("Fastest", "radiocpuspeedgroup"); - optFastest->addActionListener(cpuSpeedButtonActionListener); - - grpCPUSpeed = new gcn::Window("CPU Speed"); - grpCPUSpeed->setPosition(DISTANCE_BORDER + grpCPU->getWidth() + DISTANCE_NEXT_X, DISTANCE_BORDER); - grpCPUSpeed->add(opt7Mhz, 5, 10); - grpCPUSpeed->add(opt14Mhz, 5, 40); - grpCPUSpeed->add(opt28Mhz, 5, 70); - grpCPUSpeed->add(optFastest, 5, 100); - grpCPUSpeed->setMovable(false); - grpCPUSpeed->setSize(95, 145); - grpCPUSpeed->setBaseColor(gui_baseCol); - - category.panel->add(grpCPUSpeed); - - RefreshPanelCPU(); -} - - -void ExitPanelCPU(void) -{ - delete optCPU68000; - delete optCPU68010; - delete optCPU68EC020; - delete optCPU68020; - delete optCPU68040; - delete chkCPUCompatible; - delete chkJIT; - delete grpCPU; - delete cpuButtonActionListener; - delete cpuCompActionListener; - delete jitActionListener; - - delete optFPUnone; - delete optFPU68881; - delete optFPU68882; - delete grpFPU; - delete fpuButtonActionListener; - - delete opt7Mhz; - delete opt14Mhz; - delete opt28Mhz; - delete optFastest; - delete grpCPUSpeed; - delete cpuSpeedButtonActionListener; -} - - -void RefreshPanelCPU(void) -{ - if(changed_prefs.address_space_24) - { - if(changed_prefs.cpu_level == 0) - optCPU68000->setSelected(true); - else if(changed_prefs.cpu_level == 1) - optCPU68010->setSelected(true); - else if(changed_prefs.cpu_level == 2) - optCPU68EC020->setSelected(true); - } - else - { - if(changed_prefs.cpu_level == 2 || changed_prefs.cpu_level == 3) - optCPU68020->setSelected(true); - else if(changed_prefs.cpu_level == 4) - optCPU68040->setSelected(true); - } - - chkCPUCompatible->setSelected(changed_prefs.cpu_compatible > 0); - chkCPUCompatible->setEnabled(changed_prefs.cpu_level == 0); - chkJIT->setSelected(changed_prefs.cachesize > 0); - - if(changed_prefs.cpu_level <= 2) - optFPUnone->setSelected(true); - else - optFPU68881->setSelected(true); - - if (changed_prefs.m68k_speed == M68K_SPEED_7MHZ_CYCLES) - opt7Mhz->setSelected(true); - else if (changed_prefs.m68k_speed == M68K_SPEED_14MHZ_CYCLES) - opt14Mhz->setSelected(true); - else if (changed_prefs.m68k_speed == M68K_SPEED_25MHZ_CYCLES) - opt28Mhz->setSelected(true); - else if (changed_prefs.m68k_speed == -1) - optFastest->setSelected(true); -} diff --git a/src/osdep/gui/PanelChipset.cpp b/src/osdep/gui/PanelChipset.cpp deleted file mode 100644 index b05a94b1..00000000 --- a/src/osdep/gui/PanelChipset.cpp +++ /dev/null @@ -1,238 +0,0 @@ -#include -#include -#include -#include "sdltruetypefont.hpp" -#include "SelectorEntry.hpp" -#include "UaeRadioButton.hpp" -#include "UaeCheckBox.hpp" - -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "options.h" -#include "uae.h" -#include "gui.h" -#include "custom.h" -#include "target.h" -#include "gui_handling.h" - - -static gcn::Window *grpChipset; -static gcn::UaeRadioButton* optOCS; -static gcn::UaeRadioButton* optECS; -static gcn::UaeRadioButton* optAGA; -static gcn::UaeCheckBox* chkNTSC; -static gcn::Window *grpBlitter; -static gcn::UaeRadioButton* optBlitNormal; -static gcn::UaeRadioButton* optBlitImmed; -static gcn::UaeRadioButton* optBlitImproved; -static gcn::Window *grpCollisionLevel; -static gcn::UaeRadioButton* optCollNone; -static gcn::UaeRadioButton* optCollSprites; -static gcn::UaeRadioButton* optCollPlayfield; -static gcn::UaeRadioButton* optCollFull; - - -class ChipsetButtonActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - if (actionEvent.getSource() == optOCS) - changed_prefs.chipset_mask = CSMASK_ECS_AGNUS; - else if (actionEvent.getSource() == optECS) - changed_prefs.chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE; - else - changed_prefs.chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE | CSMASK_AGA; - } -}; -static ChipsetButtonActionListener* chipsetButtonActionListener; - - -class NTSCButtonActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - if (chkNTSC->isSelected()) - { - changed_prefs.ntscmode = true; - changed_prefs.chipset_refreshrate = 60; - } - else - { - changed_prefs.ntscmode = false; - changed_prefs.chipset_refreshrate = 50; - } - } -}; -static NTSCButtonActionListener* ntscButtonActionListener; - - -class BlitterButtonActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - changed_prefs.immediate_blits = optBlitImmed->isSelected(); - changed_prefs.pandora_partial_blits = optBlitImproved->isSelected(); - } -}; -static BlitterButtonActionListener* blitterButtonActionListener; - - -class CollisionButtonActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - if (actionEvent.getSource() == optCollNone) - changed_prefs.collision_level = 0; - else if (actionEvent.getSource() == optCollSprites) - changed_prefs.collision_level = 1; - else if (actionEvent.getSource() == optCollPlayfield) - changed_prefs.collision_level = 2; - else - changed_prefs.collision_level = 3; - } -}; -static CollisionButtonActionListener* collisionButtonActionListener; - - -void InitPanelChipset(const struct _ConfigCategory& category) -{ - chipsetButtonActionListener = new ChipsetButtonActionListener(); - ntscButtonActionListener = new NTSCButtonActionListener(); - - optOCS = new gcn::UaeRadioButton("OCS", "radiochipsetgroup"); - optOCS->addActionListener(chipsetButtonActionListener); - - optECS = new gcn::UaeRadioButton("ECS", "radiochipsetgroup"); - optECS->addActionListener(chipsetButtonActionListener); - - optAGA = new gcn::UaeRadioButton("AGA", "radiochipsetgroup"); - optAGA->addActionListener(chipsetButtonActionListener); - - chkNTSC = new gcn::UaeCheckBox("NTSC"); - chkNTSC->addActionListener(ntscButtonActionListener); - - grpChipset = new gcn::Window("Chipset"); - grpChipset->setPosition(DISTANCE_BORDER, DISTANCE_BORDER); - grpChipset->add(optOCS, 5, 10); - grpChipset->add(optECS, 5, 40); - grpChipset->add(optAGA, 5, 70); - grpChipset->add(chkNTSC, 5, 110); - grpChipset->setMovable(false); - grpChipset->setSize(100, 155); - grpChipset->setBaseColor(gui_baseCol); - - category.panel->add(grpChipset); - - blitterButtonActionListener = new BlitterButtonActionListener(); - - optBlitNormal = new gcn::UaeRadioButton("Normal", "radiocblittergroup"); - optBlitNormal->setId("BlitNormal"); - optBlitNormal->addActionListener(blitterButtonActionListener); - - optBlitImmed = new gcn::UaeRadioButton("Immediate", "radiocblittergroup"); - optBlitImmed->addActionListener(blitterButtonActionListener); - - optBlitImproved = new gcn::UaeRadioButton("Improved", "radiocblittergroup"); - optBlitImproved->addActionListener(blitterButtonActionListener); - - grpBlitter = new gcn::Window("Blitter"); - grpBlitter->setPosition(DISTANCE_BORDER + grpChipset->getWidth() + DISTANCE_NEXT_X, DISTANCE_BORDER); - grpBlitter->add(optBlitNormal, 5, 10); - grpBlitter->add(optBlitImmed, 5, 40); - grpBlitter->add(optBlitImproved, 5, 70); - grpBlitter->setMovable(false); - grpBlitter->setSize(120, 115); - grpBlitter->setBaseColor(gui_baseCol); - - category.panel->add(grpBlitter); - - collisionButtonActionListener = new CollisionButtonActionListener(); - - optCollNone = new gcn::UaeRadioButton("None", "radioccollisiongroup"); - optCollNone->setId("CollNone"); - optCollNone->addActionListener(collisionButtonActionListener); - - optCollSprites = new gcn::UaeRadioButton("Sprites only", "radioccollisiongroup"); - optCollSprites->addActionListener(collisionButtonActionListener); - - optCollPlayfield = new gcn::UaeRadioButton("Sprites and Sprites vs. Playfield", "radioccollisiongroup"); - optCollPlayfield->setId("CollPlay"); - optCollPlayfield->addActionListener(collisionButtonActionListener); - - optCollFull = new gcn::UaeRadioButton("Full (rarely needed)", "radioccollisiongroup"); - optCollFull->setId("CollFull"); - optCollFull->addActionListener(collisionButtonActionListener); - - grpCollisionLevel = new gcn::Window("Collision Level"); - grpCollisionLevel->setPosition(DISTANCE_BORDER, DISTANCE_BORDER + grpChipset->getHeight() + DISTANCE_NEXT_Y); - grpCollisionLevel->add(optCollNone, 5, 10); - grpCollisionLevel->add(optCollSprites, 5, 40); - grpCollisionLevel->add(optCollPlayfield, 5, 70); - grpCollisionLevel->add(optCollFull, 5, 100); - grpCollisionLevel->setMovable(false); - grpCollisionLevel->setSize(250, 145); - grpCollisionLevel->setBaseColor(gui_baseCol); - - category.panel->add(grpCollisionLevel); - - RefreshPanelChipset(); -} - - -void ExitPanelChipset(void) -{ - delete optOCS; - delete optECS; - delete optAGA; - delete chkNTSC; - delete grpChipset; - delete chipsetButtonActionListener; - delete ntscButtonActionListener; - - delete optBlitNormal; - delete optBlitImmed; - delete optBlitImproved; - delete grpBlitter; - delete blitterButtonActionListener; - - delete optCollNone; - delete optCollSprites; - delete optCollPlayfield; - delete optCollFull; - delete grpCollisionLevel; - delete collisionButtonActionListener; -} - - -void RefreshPanelChipset(void) -{ - if (changed_prefs.chipset_mask == CSMASK_ECS_AGNUS) - optOCS->setSelected(true); - else if (changed_prefs.chipset_mask == (CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE)) - optECS->setSelected(true); - else if (changed_prefs.chipset_mask == (CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE | CSMASK_AGA)) - optAGA->setSelected(true); - - chkNTSC->setSelected(changed_prefs.ntscmode); - - if(changed_prefs.immediate_blits) - optBlitImmed->setSelected(true); - else if (changed_prefs.pandora_partial_blits) - optBlitImproved->setSelected(true); - else - optBlitNormal->setSelected(true); - - if(changed_prefs.collision_level == 0) - optCollNone->setSelected(true); - else if(changed_prefs.collision_level == 1) - optCollSprites->setSelected(true); - else if(changed_prefs.collision_level == 2) - optCollPlayfield->setSelected(true); - else - optCollFull->setSelected(true); -} diff --git a/src/osdep/gui/PanelConfig.cpp b/src/osdep/gui/PanelConfig.cpp deleted file mode 100644 index 9b64e8eb..00000000 --- a/src/osdep/gui/PanelConfig.cpp +++ /dev/null @@ -1,328 +0,0 @@ -#include -#include -#include -#include "sdltruetypefont.hpp" -#include "SelectorEntry.hpp" -#include "UaeListBox.hpp" - -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "options.h" -#include "uae.h" -#include "gui.h" -#include "target.h" -#include "gui_handling.h" - - -static char last_active_config[MAX_PATH] = { '\0' }; - -static gcn::Button *cmdLoad; -static gcn::Button *cmdSave; -static gcn::Button *cmdLoadFrom; -static gcn::Button *cmdSaveAs; -static gcn::Button *cmdDelete; -static gcn::Label *lblName; -static gcn::TextField *txtName; -static gcn::Label *lblDesc; -static gcn::TextField *txtDesc; -static gcn::UaeListBox* lstConfigs; -static gcn::ScrollArea* scrAreaConfigs; - - -bool LoadConfigByName(const char *name) -{ - ConfigFileInfo* config = SearchConfigInList(name); - if(config != NULL) - { - txtName->setText(config->Name); - txtDesc->setText(config->Description); - target_cfgfile_load(&changed_prefs, config->FullPath, 0, 0); - strncpy(last_active_config, config->Name, MAX_PATH); - RefreshAllPanels(); - } - - return false; -} - -void SetLastActiveConfig(const char *filename) -{ - extractFileName(filename, last_active_config); - removeFileExtension(last_active_config); -} - - -class ConfigsListModel : public gcn::ListModel -{ - std::vector configs; - - public: - ConfigsListModel() - { - } - - int getNumberOfElements() - { - return configs.size(); - } - - std::string getElementAt(int i) - { - if(i >= configs.size() || i < 0) - return "---"; - return configs[i]; - } - - void InitConfigsList(void) - { - configs.clear(); - for(int i=0; iName, MAX_DPATH); - if(strlen(ConfigFilesList[i]->Description) > 0) - { - strncat(tmp, " (", MAX_DPATH); - strncat(tmp, ConfigFilesList[i]->Description, MAX_DPATH); - strncat(tmp, ")", MAX_DPATH); - } - configs.push_back(tmp); - } - } -}; -static ConfigsListModel *configsList; - - -class ConfigButtonActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - int i; - if (actionEvent.getSource() == cmdLoad) - { - //----------------------------------------------- - // Load selected configuration - //----------------------------------------------- - i = lstConfigs->getSelected(); - target_cfgfile_load(&changed_prefs, ConfigFilesList[i]->FullPath, 0, 0); - strncpy(last_active_config, ConfigFilesList[i]->Name, MAX_PATH); - RefreshAllPanels(); - } - else if(actionEvent.getSource() == cmdSave) - { - //----------------------------------------------- - // Save current configuration - //----------------------------------------------- - char filename[MAX_DPATH]; - if(!txtName->getText().empty()) - { - fetch_configurationpath(filename, MAX_DPATH); - strncat(filename, txtName->getText().c_str(), MAX_DPATH); - strncat(filename, ".uae", MAX_DPATH); - strncpy(changed_prefs.description, txtDesc->getText().c_str(), 256); - if(cfgfile_save(&changed_prefs, filename, 0)) - RefreshPanelConfig(); - } - } - else if(actionEvent.getSource() == cmdLoadFrom) - { - } - else if(actionEvent.getSource() == cmdSaveAs) - { - } - else if(actionEvent.getSource() == cmdDelete) - { - //----------------------------------------------- - // Delete selected config - //----------------------------------------------- - char msg[256]; - i = lstConfigs->getSelected(); - if(i >= 0 && strcmp(ConfigFilesList[i]->Name, OPTIONSFILENAME)) - { - snprintf(msg, 256, "Do you want to delete '%s' ?", ConfigFilesList[i]->Name); - if(ShowMessage("Delete Configuration", msg, "", "Yes", "No")) - { - remove(ConfigFilesList[i]->FullPath); - if(!strcmp(last_active_config, ConfigFilesList[i]->Name)) - { - txtName->setText(""); - txtDesc->setText(""); - last_active_config[0] = '\0'; - } - ConfigFilesList.erase(ConfigFilesList.begin() + i); - RefreshPanelConfig(); - } - cmdDelete->requestFocus(); - } - } - } -}; -static ConfigButtonActionListener* configButtonActionListener; - - -class ConfigsListActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - int selected_item; - selected_item = lstConfigs->getSelected(); - if(!txtName->getText().compare(ConfigFilesList[selected_item]->Name)) - { - //----------------------------------------------- - // Selected same config again -> load and start it - //----------------------------------------------- - target_cfgfile_load(&changed_prefs, ConfigFilesList[selected_item]->FullPath, 0, 0); - strncpy(last_active_config, ConfigFilesList[selected_item]->Name, MAX_PATH); - RefreshAllPanels(); - uae_reset(1); - gui_running = false; - } - else - { - txtName->setText(ConfigFilesList[selected_item]->Name); - txtDesc->setText(ConfigFilesList[selected_item]->Description); - } - } -}; -static ConfigsListActionListener* configsListActionListener; - - -void InitPanelConfig(const struct _ConfigCategory& category) -{ - configButtonActionListener = new ConfigButtonActionListener(); - - cmdLoad = new gcn::Button("Load"); - cmdLoad->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdLoad->setBaseColor(gui_baseCol); - cmdLoad->setId("ConfigLoad"); - cmdLoad->addActionListener(configButtonActionListener); - - cmdSave = new gcn::Button("Save"); - cmdSave->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdSave->setBaseColor(gui_baseCol); - cmdSave->setId("ConfigSave"); - cmdSave->addActionListener(configButtonActionListener); - - cmdLoadFrom = new gcn::Button("Load From..."); - cmdLoadFrom->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdLoadFrom->setBaseColor(gui_baseCol); - cmdLoadFrom->setId("CfgLoadFrom"); - cmdLoadFrom->addActionListener(configButtonActionListener); - cmdLoadFrom->setEnabled(false); - - cmdSaveAs = new gcn::Button("Save As..."); - cmdSaveAs->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdSaveAs->setBaseColor(gui_baseCol); - cmdSaveAs->setId("CfgSaveAs"); - cmdSaveAs->addActionListener(configButtonActionListener); - cmdSaveAs->setEnabled(false); - - cmdDelete = new gcn::Button("Delete"); - cmdDelete->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdDelete->setBaseColor(gui_baseCol); - cmdDelete->setId("CfgDelete"); - cmdDelete->addActionListener(configButtonActionListener); - - int buttonX = DISTANCE_BORDER; - int buttonY = category.panel->getHeight() - DISTANCE_BORDER - BUTTON_HEIGHT; - category.panel->add(cmdLoad, buttonX, buttonY); - buttonX += BUTTON_WIDTH + DISTANCE_NEXT_X; - category.panel->add(cmdSave, buttonX, buttonY); - buttonX += BUTTON_WIDTH + 3 * DISTANCE_NEXT_X; -// category.panel->add(cmdLoadFrom, buttonX, buttonY); - buttonX += BUTTON_WIDTH + DISTANCE_NEXT_X; -// category.panel->add(cmdSaveAs, buttonX, buttonY); - buttonX = category.panel->getWidth() - DISTANCE_BORDER - BUTTON_WIDTH; - category.panel->add(cmdDelete, buttonX, buttonY); - - lblName = new gcn::Label("Name:"); - lblName->setSize(90, LABEL_HEIGHT); - lblName->setAlignment(gcn::Graphics::RIGHT); - txtName = new gcn::TextField(); - txtName->setSize(300, TEXTFIELD_HEIGHT); - txtName->setId("ConfigName"); - - lblDesc = new gcn::Label("Description:"); - lblDesc->setSize(90, LABEL_HEIGHT); - lblDesc->setAlignment(gcn::Graphics::RIGHT); - txtDesc = new gcn::TextField(); - txtDesc->setSize(300, TEXTFIELD_HEIGHT); - txtDesc->setId("ConfigDesc"); - - category.panel->add(lblName, DISTANCE_BORDER, 2 + buttonY - DISTANCE_NEXT_Y - 2 * TEXTFIELD_HEIGHT - 10); - category.panel->add(txtName, DISTANCE_BORDER + lblName->getWidth() + 8, buttonY - DISTANCE_NEXT_Y - 2 * TEXTFIELD_HEIGHT - 10); - category.panel->add(lblDesc, DISTANCE_BORDER, 2 + buttonY - DISTANCE_NEXT_Y - TEXTFIELD_HEIGHT); - category.panel->add(txtDesc, DISTANCE_BORDER + lblName->getWidth() + 8, buttonY - DISTANCE_NEXT_Y - TEXTFIELD_HEIGHT); - - ReadConfigFileList(); - configsList = new ConfigsListModel(); - configsList->InitConfigsList(); - configsListActionListener = new ConfigsListActionListener(); - - lstConfigs = new gcn::UaeListBox(configsList); - lstConfigs->setSize(category.panel->getWidth() - 2 * DISTANCE_BORDER - 22, 232); - lstConfigs->setBaseColor(gui_baseCol); - lstConfigs->setWrappingEnabled(true); - lstConfigs->setId("ConfigList"); - lstConfigs->addActionListener(configsListActionListener); - - scrAreaConfigs = new gcn::ScrollArea(lstConfigs); - scrAreaConfigs->setFrameSize(1); - scrAreaConfigs->setPosition(DISTANCE_BORDER, DISTANCE_BORDER); - scrAreaConfigs->setSize(category.panel->getWidth() - 2 * DISTANCE_BORDER - 2, 252); - scrAreaConfigs->setScrollbarWidth(20); - scrAreaConfigs->setBaseColor(gui_baseCol); - - category.panel->add(scrAreaConfigs); - - if(strlen(last_active_config) == 0) - strncpy(last_active_config, OPTIONSFILENAME, MAX_PATH); - txtName->setText(last_active_config); - txtDesc->setText(changed_prefs.description); - RefreshPanelConfig(); -} - - -void ExitPanelConfig(void) -{ - delete lstConfigs; - delete scrAreaConfigs; - delete configsListActionListener; - delete configsList; - - delete cmdLoad; - delete cmdSave; - delete cmdLoadFrom; - delete cmdSaveAs; - delete cmdDelete; - - delete configButtonActionListener; - - delete lblName; - delete txtName; - delete lblDesc; - delete txtDesc; -} - - -void RefreshPanelConfig(void) -{ - ReadConfigFileList(); - configsList->InitConfigsList(); - - // Search current entry - if(!txtName->getText().empty()) - { - for(int i=0; iName, txtName->getText().c_str())) - { - // Select current entry - lstConfigs->setSelected(i); - break; - } - } - } -} diff --git a/src/osdep/gui/PanelDisplay.cpp b/src/osdep/gui/PanelDisplay.cpp deleted file mode 100644 index 3dce0ada..00000000 --- a/src/osdep/gui/PanelDisplay.cpp +++ /dev/null @@ -1,195 +0,0 @@ -#include -#include -#include -#include "sdltruetypefont.hpp" -#include "SelectorEntry.hpp" -#include "UaeRadioButton.hpp" -#include "UaeDropDown.hpp" -#include "UaeCheckBox.hpp" - -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "options.h" -#include "memory.h" -#include "uae.h" -#include "gui.h" -#include "target.h" -#include "gui_handling.h" - - -const int amigawidth_values[] = { 320, 352, 384, 640, 704, 768 }; -const int amigaheight_values[] = { 200, 216, 240, 256, 262, 270 }; - -static gcn::Window *grpAmigaScreen; -static gcn::Label* lblAmigaWidth; -static gcn::Label* lblAmigaWidthInfo; -static gcn::Slider* sldAmigaWidth; -static gcn::Label* lblAmigaHeight; -static gcn::Label* lblAmigaHeightInfo; -static gcn::Slider* sldAmigaHeight; -static gcn::Label* lblVertPos; -static gcn::Label* lblVertPosInfo; -static gcn::Slider* sldVertPos; -static gcn::UaeCheckBox* chkFrameskip; - - -class AmigaScreenActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - if (actionEvent.getSource() == sldAmigaWidth) - { - if(changed_prefs.gfx_size.width != amigawidth_values[(int)(sldAmigaWidth->getValue())]) - { - changed_prefs.gfx_size.width = amigawidth_values[(int)(sldAmigaWidth->getValue())]; - RefreshPanelDisplay(); - } - } - else if (actionEvent.getSource() == sldAmigaHeight) - { - if(changed_prefs.gfx_size.height != amigaheight_values[(int)(sldAmigaHeight->getValue())]) - { - changed_prefs.gfx_size.height = amigaheight_values[(int)(sldAmigaHeight->getValue())]; - RefreshPanelDisplay(); - } - } - else if (actionEvent.getSource() == sldVertPos) - { - if(changed_prefs.pandora_vertical_offset != (int)(sldVertPos->getValue())) - { - changed_prefs.pandora_vertical_offset = (int)(sldVertPos->getValue()); - RefreshPanelDisplay(); - } - } - else if (actionEvent.getSource() == chkFrameskip) - { - changed_prefs.gfx_framerate = chkFrameskip->isSelected() ? 1 : 0; - } - } -}; -AmigaScreenActionListener* amigaScreenActionListener; - - -void InitPanelDisplay(const struct _ConfigCategory& category) -{ - amigaScreenActionListener = new AmigaScreenActionListener(); - - lblAmigaWidth = new gcn::Label("Width:"); - lblAmigaWidth->setSize(80, LABEL_HEIGHT); - lblAmigaWidth->setAlignment(gcn::Graphics::RIGHT); - sldAmigaWidth = new gcn::Slider(0, 5); - sldAmigaWidth->setSize(160, SLIDER_HEIGHT); - sldAmigaWidth->setBaseColor(gui_baseCol); - sldAmigaWidth->setMarkerLength(20); - sldAmigaWidth->setStepLength(1); - sldAmigaWidth->setId("sldWidth"); - sldAmigaWidth->addActionListener(amigaScreenActionListener); - lblAmigaWidthInfo = new gcn::Label("320"); - - lblAmigaHeight = new gcn::Label("Height:"); - lblAmigaHeight->setSize(80, LABEL_HEIGHT); - lblAmigaHeight->setAlignment(gcn::Graphics::RIGHT); - sldAmigaHeight = new gcn::Slider(0, 5); - sldAmigaHeight->setSize(160, SLIDER_HEIGHT); - sldAmigaHeight->setBaseColor(gui_baseCol); - sldAmigaHeight->setMarkerLength(20); - sldAmigaHeight->setStepLength(1); - sldAmigaHeight->setId("sldHeight"); - sldAmigaHeight->addActionListener(amigaScreenActionListener); - lblAmigaHeightInfo = new gcn::Label("200"); - - lblVertPos = new gcn::Label("Vert. offset:"); - lblVertPos->setSize(80, LABEL_HEIGHT); - lblVertPos->setAlignment(gcn::Graphics::RIGHT); - sldVertPos = new gcn::Slider(-16, 16); - sldVertPos->setSize(160, SLIDER_HEIGHT); - sldVertPos->setBaseColor(gui_baseCol); - sldVertPos->setMarkerLength(20); - sldVertPos->setStepLength(1); - sldVertPos->setId("sldVertPos"); - sldVertPos->addActionListener(amigaScreenActionListener); - lblVertPosInfo = new gcn::Label("000"); - - chkFrameskip = new gcn::UaeCheckBox("Frameskip"); - chkFrameskip->addActionListener(amigaScreenActionListener); - - grpAmigaScreen = new gcn::Window("Amiga Screen"); - grpAmigaScreen->setPosition(DISTANCE_BORDER, DISTANCE_BORDER); - - int posY = 10; - grpAmigaScreen->add(lblAmigaWidth, 8, posY); - grpAmigaScreen->add(sldAmigaWidth, 100, posY); - grpAmigaScreen->add(lblAmigaWidthInfo, 100 + sldAmigaWidth->getWidth() + 12, posY); - posY += sldAmigaWidth->getHeight() + DISTANCE_NEXT_Y; - grpAmigaScreen->add(lblAmigaHeight, 8, posY); - grpAmigaScreen->add(sldAmigaHeight, 100, posY); - grpAmigaScreen->add(lblAmigaHeightInfo, 100 + sldAmigaHeight->getWidth() + 12, posY); - posY += sldAmigaHeight->getHeight() + DISTANCE_NEXT_Y; - grpAmigaScreen->add(lblVertPos, 8, posY); - grpAmigaScreen->add(sldVertPos, 100, posY); - grpAmigaScreen->add(lblVertPosInfo, 100 + sldVertPos->getWidth() + 12, posY); - posY += sldVertPos->getHeight() + DISTANCE_NEXT_Y; - - grpAmigaScreen->setMovable(false); - grpAmigaScreen->setSize(320, posY + DISTANCE_BORDER); - grpAmigaScreen->setBaseColor(gui_baseCol); - - category.panel->add(grpAmigaScreen); - category.panel->add(chkFrameskip, DISTANCE_BORDER, DISTANCE_BORDER + grpAmigaScreen->getHeight() + DISTANCE_NEXT_Y); - - RefreshPanelDisplay(); -} - - -void ExitPanelDisplay(void) -{ - delete lblAmigaWidth; - delete sldAmigaWidth; - delete lblAmigaWidthInfo; - delete lblAmigaHeight; - delete sldAmigaHeight; - delete lblAmigaHeightInfo; - delete lblVertPos; - delete sldVertPos; - delete lblVertPosInfo; - delete grpAmigaScreen; - delete chkFrameskip; - delete amigaScreenActionListener; -} - - -void RefreshPanelDisplay(void) -{ - int i; - char tmp[32]; - - for(i=0; i<6; ++i) - { - if(changed_prefs.gfx_size.width == amigawidth_values[i]) - { - sldAmigaWidth->setValue(i); - snprintf(tmp, 32, "%d", changed_prefs.gfx_size.width); - lblAmigaWidthInfo->setCaption(tmp); - break; - } - } - - for(i=0; i<6; ++i) - { - if(changed_prefs.gfx_size.height == amigaheight_values[i]) - { - sldAmigaHeight->setValue(i); - snprintf(tmp, 32, "%d", changed_prefs.gfx_size.height); - lblAmigaHeightInfo->setCaption(tmp); - break; - } - } - - sldVertPos->setValue(changed_prefs.pandora_vertical_offset); - snprintf(tmp, 32, "%d", changed_prefs.pandora_vertical_offset); - lblVertPosInfo->setCaption(tmp); - - chkFrameskip->setSelected(changed_prefs.gfx_framerate); -} diff --git a/src/osdep/gui/PanelFloppy.cpp b/src/osdep/gui/PanelFloppy.cpp deleted file mode 100644 index d4d2f57b..00000000 --- a/src/osdep/gui/PanelFloppy.cpp +++ /dev/null @@ -1,505 +0,0 @@ -#include -#include -#include -#include "sdltruetypefont.hpp" -#include "SelectorEntry.hpp" -#include "UaeRadioButton.hpp" -#include "UaeDropDown.hpp" -#include "UaeCheckBox.hpp" - -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "options.h" -#include "memory.h" -#include "disk.h" -#include "uae.h" -#include "gui.h" -#include "target.h" -#include "gui_handling.h" - - -static gcn::UaeCheckBox* chkDFx[4]; -static gcn::UaeDropDown* cboDFxType[4]; -static gcn::UaeCheckBox* chkDFxWriteProtect[4]; -static gcn::Button* cmdDFxInfo[4]; -static gcn::Button* cmdDFxEject[4]; -static gcn::Button* cmdDFxSelect[4]; -static gcn::UaeDropDown* cboDFxFile[4]; -static gcn::Label* lblDriveSpeed; -static gcn::Label* lblDriveSpeedInfo; -static gcn::Slider* sldDriveSpeed; -static gcn::UaeCheckBox* chkLoadConfig; -static gcn::Button *cmdSaveForDisk; - -static const char *diskfile_filter[] = { ".adf", ".adz", ".zip", ".gz", "\0" }; -static const char *drivespeedlist[] = { "100% (compatible)", "200%", "400%", "800%" }; -static const int drivespeedvalues[] = { 100, 200, 400, 800 }; - -static void AdjustDropDownControls(void); - - -class DriveTypeListModel : public gcn::ListModel -{ - private: - std::vector types; - - public: - DriveTypeListModel() - { - types.push_back("Disabled"); - types.push_back("3.5'' DD"); - types.push_back("3.5'' HD"); - types.push_back("5.25'' SD"); - types.push_back("3.5'' ESCOM"); - } - - int getNumberOfElements() - { - return types.size(); - } - - std::string getElementAt(int i) - { - if(i < 0 || i >= types.size()) - return "---"; - return types[i]; - } -}; -static DriveTypeListModel driveTypeList; - - -class DiskfileListModel : public gcn::ListModel -{ - public: - DiskfileListModel() - { - } - - int getNumberOfElements() - { - return lstMRUDiskList.size(); - } - - std::string getElementAt(int i) - { - if(i < 0 || i >= lstMRUDiskList.size()) - return "---"; - return lstMRUDiskList[i]; - } -}; -static DiskfileListModel diskfileList; - - -class DriveTypeActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - //--------------------------------------- - // New drive type selected - //--------------------------------------- - for(int i=0; i<4; ++i) - { - if (actionEvent.getSource() == cboDFxType[i]) - changed_prefs.dfxtype[i] = cboDFxType[i]->getSelected() - 1; - } - RefreshPanelFloppy(); - } -}; -static DriveTypeActionListener* driveTypeActionListener; - - -class DFxCheckActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - for(int i=0; i<4; ++i) - { - if (actionEvent.getSource() == chkDFx[i]) - { - //--------------------------------------- - // Drive enabled/disabled - //--------------------------------------- - if(chkDFx[i]->isSelected()) - changed_prefs.dfxtype[i] = DRV_35_DD; - else - changed_prefs.dfxtype[i] = DRV_NONE; - } - else if(actionEvent.getSource() == chkDFxWriteProtect[i]) - { - //--------------------------------------- - // Write-protect changed - //--------------------------------------- - // ToDo: set write protect for floppy - } - } - RefreshPanelFloppy(); - } -}; -static DFxCheckActionListener* dfxCheckActionListener; - - -class DFxButtonActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - for(int i=0; i<4; ++i) - { - if (actionEvent.getSource() == cmdDFxInfo[i]) - { - //--------------------------------------- - // Show info about current disk-image - //--------------------------------------- - if(changed_prefs.dfxtype[i] != DRV_NONE && strlen(changed_prefs.df[i]) > 0) - ; // ToDo: Show info dialog - } - else if (actionEvent.getSource() == cmdDFxEject[i]) - { - //--------------------------------------- - // Eject disk from drive - //--------------------------------------- - disk_eject(i); - strcpy(changed_prefs.df[i], ""); - AdjustDropDownControls(); - } - else if (actionEvent.getSource() == cmdDFxSelect[i]) - { - //--------------------------------------- - // Select disk for drive - //--------------------------------------- - char tmp[MAX_PATH]; - - if(strlen(changed_prefs.df[i]) > 0) - strncpy(tmp, changed_prefs.df[i], MAX_PATH); - else - strncpy(tmp, currentDir, MAX_PATH); - if(SelectFile("Select disk image file", tmp, diskfile_filter)) - { - if(strncmp(changed_prefs.df[i], tmp, MAX_PATH)) - { - strncpy(changed_prefs.df[i], tmp, sizeof(changed_prefs.df[i])); - disk_insert(i, tmp); - AddFileToDiskList(tmp, 1); - extractPath(tmp, currentDir); - - if(i == 0 && chkLoadConfig->isSelected()) - { - // Search for config of disk - extractFileName(changed_prefs.df[i], tmp); - removeFileExtension(tmp); - LoadConfigByName(tmp); - } - AdjustDropDownControls(); - } - } - cmdDFxSelect[i]->requestFocus(); - } - } - } -}; -static DFxButtonActionListener* dfxButtonActionListener; - - -static bool bIgnoreListChange = false; -class DiskFileActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - for(int i=0; i<4; ++i) - { - if (actionEvent.getSource() == cboDFxFile[i]) - { - //--------------------------------------- - // Diskimage from list selected - //--------------------------------------- - if(!bIgnoreListChange) - { - int idx = cboDFxFile[i]->getSelected(); - - if(idx < 0) - { - disk_eject(i); - strcpy(changed_prefs.df[i], ""); - AdjustDropDownControls(); - } - else - { - if(diskfileList.getElementAt(idx).compare(changed_prefs.df[i])) - { - strncpy(changed_prefs.df[i], diskfileList.getElementAt(idx).c_str(), sizeof(changed_prefs.df[i])); - disk_insert(i, changed_prefs.df[i]); - lstMRUDiskList.erase(lstMRUDiskList.begin() + idx); - lstMRUDiskList.insert(lstMRUDiskList.begin(), changed_prefs.df[i]); - bIgnoreListChange = true; - cboDFxFile[i]->setSelected(0); - bIgnoreListChange = false; - - if(i == 0 && chkLoadConfig->isSelected()) - { - // Search for config of disk - char tmp[MAX_PATH]; - - extractFileName(changed_prefs.df[i], tmp); - removeFileExtension(tmp); - LoadConfigByName(tmp); - } - } - } - } - } - } - } -}; -static DiskFileActionListener* diskFileActionListener; - - -class DriveSpeedSliderActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - changed_prefs.floppy_speed = drivespeedvalues[(int)sldDriveSpeed->getValue()]; - RefreshPanelFloppy(); - } -}; -static DriveSpeedSliderActionListener* driveSpeedSliderActionListener; - - -class SaveForDiskActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - //--------------------------------------- - // Save configuration for current disk - //--------------------------------------- - if(strlen(changed_prefs.df[0]) > 0) - { - char filename[MAX_DPATH]; - char diskname[MAX_PATH]; - - extractFileName(changed_prefs.df[0], diskname); - removeFileExtension(diskname); - - fetch_configurationpath(filename, MAX_DPATH); - strncat(filename, diskname, MAX_DPATH); - strncat(filename, ".uae", MAX_DPATH); - - snprintf(changed_prefs.description, 256, "Configuration for disk '%s'", diskname); - if(cfgfile_save(&changed_prefs, filename, 0)) - RefreshPanelConfig(); - } - } -}; -static SaveForDiskActionListener* saveForDiskActionListener; - - -void InitPanelFloppy(const struct _ConfigCategory& category) -{ - int posX; - int posY = DISTANCE_BORDER; - int i; - - dfxCheckActionListener = new DFxCheckActionListener(); - driveTypeActionListener = new DriveTypeActionListener(); - dfxButtonActionListener = new DFxButtonActionListener(); - diskFileActionListener = new DiskFileActionListener(); - driveSpeedSliderActionListener = new DriveSpeedSliderActionListener(); - saveForDiskActionListener = new SaveForDiskActionListener(); - - for(i=0; i<4; ++i) - { - char tmp[20]; - snprintf(tmp, 20, "DF%d:", i); - chkDFx[i] = new gcn::UaeCheckBox(tmp); - chkDFx[i]->addActionListener(dfxCheckActionListener); - - cboDFxType[i] = new gcn::UaeDropDown(&driveTypeList); - cboDFxType[i]->setSize(106, DROPDOWN_HEIGHT); - cboDFxType[i]->setBaseColor(gui_baseCol); - snprintf(tmp, 20, "cboType%d", i); - cboDFxType[i]->setId(tmp); - cboDFxType[i]->addActionListener(driveTypeActionListener); - - chkDFxWriteProtect[i] = new gcn::UaeCheckBox("Write-protected"); - chkDFxWriteProtect[i]->addActionListener(dfxCheckActionListener); - chkDFxWriteProtect[i]->setEnabled(false); - - cmdDFxInfo[i] = new gcn::Button("?"); - cmdDFxInfo[i]->setSize(SMALL_BUTTON_WIDTH, SMALL_BUTTON_HEIGHT); - cmdDFxInfo[i]->setBaseColor(gui_baseCol); - cmdDFxInfo[i]->addActionListener(dfxButtonActionListener); - - cmdDFxEject[i] = new gcn::Button("Eject"); - cmdDFxEject[i]->setSize(SMALL_BUTTON_WIDTH * 2, SMALL_BUTTON_HEIGHT); - cmdDFxEject[i]->setBaseColor(gui_baseCol); - snprintf(tmp, 20, "cmdEject%d", i); - cmdDFxEject[i]->setId(tmp); - cmdDFxEject[i]->addActionListener(dfxButtonActionListener); - - cmdDFxSelect[i] = new gcn::Button("..."); - cmdDFxSelect[i]->setSize(SMALL_BUTTON_WIDTH, SMALL_BUTTON_HEIGHT); - cmdDFxSelect[i]->setBaseColor(gui_baseCol); - snprintf(tmp, 20, "cmdSel%d", i); - cmdDFxSelect[i]->setId(tmp); - cmdDFxSelect[i]->addActionListener(dfxButtonActionListener); - - cboDFxFile[i] = new gcn::UaeDropDown(&diskfileList); - cboDFxFile[i]->setSize(category.panel->getWidth() - 2 * DISTANCE_BORDER, DROPDOWN_HEIGHT); - cboDFxFile[i]->setBaseColor(gui_baseCol); - snprintf(tmp, 20, "cboDisk%d", i); - cboDFxFile[i]->setId(tmp); - cboDFxFile[i]->addActionListener(diskFileActionListener); - - if(i == 0) - { - chkLoadConfig = new gcn::UaeCheckBox("Load config with same name as disk"); - chkLoadConfig->setId("LoadDiskCfg"); - } - } - - lblDriveSpeed = new gcn::Label("Floppy Drive Emulation Speed:"); - sldDriveSpeed = new gcn::Slider(0, 3); - sldDriveSpeed->setSize(110, SLIDER_HEIGHT); - sldDriveSpeed->setBaseColor(gui_baseCol); - sldDriveSpeed->setMarkerLength(20); - sldDriveSpeed->setStepLength(1); - sldDriveSpeed->setId("DriveSpeed"); - sldDriveSpeed->addActionListener(driveSpeedSliderActionListener); - lblDriveSpeedInfo = new gcn::Label(drivespeedlist[0]); - - cmdSaveForDisk = new gcn::Button("Save config for disk"); - cmdSaveForDisk->setSize(BUTTON_WIDTH * 2, BUTTON_HEIGHT); - cmdSaveForDisk->setBaseColor(gui_baseCol); - cmdSaveForDisk->setId("SaveForDisk"); - cmdSaveForDisk->addActionListener(saveForDiskActionListener); - - for(i=0; i<4; ++i) - { - posX = DISTANCE_BORDER; - category.panel->add(chkDFx[i], posX, posY); - posX += 100; - category.panel->add(cboDFxType[i], posX, posY); - posX += cboDFxType[i]->getWidth() + 2 * DISTANCE_NEXT_X; -// category.panel->add(chkDFxWriteProtect[i], posX, posY); - posX += chkDFxWriteProtect[i]->getWidth() + 4 * DISTANCE_NEXT_X; -// category.panel->add(cmdDFxInfo[i], posX, posY); - posX += cmdDFxInfo[i]->getWidth() + DISTANCE_NEXT_X; - category.panel->add(cmdDFxEject[i], posX, posY); - posX += cmdDFxEject[i]->getWidth() + DISTANCE_NEXT_X; - category.panel->add(cmdDFxSelect[i], posX, posY); - posY += chkDFx[i]->getHeight() + 8; - - category.panel->add(cboDFxFile[i], DISTANCE_BORDER, posY); - if(i == 0) - { - posY += cboDFxFile[i]->getHeight() + 8; - category.panel->add(chkLoadConfig, DISTANCE_BORDER, posY); - } - posY += cboDFxFile[i]->getHeight() + DISTANCE_NEXT_Y + 4; - } - - posX = DISTANCE_BORDER; - category.panel->add(lblDriveSpeed, posX, posY); - posX += lblDriveSpeed->getWidth() + 8; - category.panel->add(sldDriveSpeed, posX, posY); - posX += sldDriveSpeed->getWidth() + DISTANCE_NEXT_X; - category.panel->add(lblDriveSpeedInfo, posX, posY); - posY += sldDriveSpeed->getHeight() + DISTANCE_NEXT_Y; - - category.panel->add(cmdSaveForDisk, DISTANCE_BORDER, category.panel->getHeight() - DISTANCE_BORDER - BUTTON_HEIGHT); - - RefreshPanelFloppy(); -} - - -void ExitPanelFloppy(void) -{ - for(int i=0; i<4; ++i) - { - delete chkDFx[i]; - delete cboDFxType[i]; - delete chkDFxWriteProtect[i]; - delete cmdDFxInfo[i]; - delete cmdDFxEject[i]; - delete cmdDFxSelect[i]; - delete cboDFxFile[i]; - } - delete chkLoadConfig; - delete lblDriveSpeed; - delete sldDriveSpeed; - delete lblDriveSpeedInfo; - delete cmdSaveForDisk; - - delete dfxCheckActionListener; - delete driveTypeActionListener; - delete dfxButtonActionListener; - delete diskFileActionListener; - delete driveSpeedSliderActionListener; - delete saveForDiskActionListener; -} - - -static void AdjustDropDownControls(void) -{ - int i, j; - - bIgnoreListChange = true; - - for(i=0; i<4; ++i) - { - cboDFxFile[i]->clearSelected(); - - if((changed_prefs.dfxtype[i] != DRV_NONE) && strlen(changed_prefs.df[i]) > 0) - { - for(j=0; jsetSelected(j); - break; - } - } - } - } - - bIgnoreListChange = false; -} - - -void RefreshPanelFloppy(void) -{ - int i; - - AdjustDropDownControls(); - - for(i=0; i<4; ++i) - { - bool driveEnabled = changed_prefs.dfxtype[i] != DRV_NONE; - chkDFx[i]->setSelected(driveEnabled); - cboDFxType[i]->setSelected(changed_prefs.dfxtype[i] + 1); - chkDFxWriteProtect[i]->setSelected(false); - - cmdDFxInfo[i]->setEnabled(driveEnabled); - cmdDFxEject[i]->setEnabled(driveEnabled); - cmdDFxSelect[i]->setEnabled(driveEnabled); - cboDFxFile[i]->setEnabled(driveEnabled); - } - - chkLoadConfig->setSelected(true); - - for(i=0; i<4; ++i) - { - if(changed_prefs.floppy_speed == drivespeedvalues[i]) - { - sldDriveSpeed->setValue(i); - lblDriveSpeedInfo->setCaption(drivespeedlist[i]); - break; - } - } - -} diff --git a/src/osdep/gui/PanelHD.cpp b/src/osdep/gui/PanelHD.cpp deleted file mode 100644 index 24e7714d..00000000 --- a/src/osdep/gui/PanelHD.cpp +++ /dev/null @@ -1,292 +0,0 @@ -#include -#include -#include -#include "sdltruetypefont.hpp" -#include "SelectorEntry.hpp" -#include "UaeRadioButton.hpp" -#include "UaeDropDown.hpp" -#include "UaeCheckBox.hpp" - -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "options.h" -#include "memory.h" -#include "uae.h" -#include "autoconf.h" -#include "filesys.h" -#include "gui.h" -#include "target.h" -#include "gui_handling.h" - - -#define MAX_HD_DEVICES 5 -enum { COL_DEVICE, COL_VOLUME, COL_PATH, COL_READWRITE, COL_SIZE, COL_BOOTPRI, COL_COUNT }; - -static const char *column_caption[] = { - "Device", "Volume", "Path", "R/W", "Size", "Bootpri" }; -static const int COLUMN_SIZE[] = { - 50, // Device - 70, // Volume - 260, // Path - 40, // R/W - 50, // Size - 50 // Bootpri -}; - -static gcn::Label* lblList[COL_COUNT]; -static gcn::Container* listEntry[MAX_HD_DEVICES]; -static gcn::TextField* listCells[MAX_HD_DEVICES][COL_COUNT]; -static gcn::Button* listCmdProps[MAX_HD_DEVICES]; -static gcn::ImageButton* listCmdDelete[MAX_HD_DEVICES]; -static gcn::Button* cmdAddDirectory; -static gcn::Button* cmdAddHardfile; - - -class HDRemoveActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - for(int i=0; irequestFocus(); - RefreshPanelHD(); - } -}; -static HDRemoveActionListener* hdRemoveActionListener; - - -class HDEditActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - for(int i=0; irequestFocus(); - break; - } - } - RefreshPanelHD(); - } -}; -static HDEditActionListener* hdEditActionListener; - - -class AddVirtualHDActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - EditFilesysVirtual(-1); - cmdAddDirectory->requestFocus(); - RefreshPanelHD(); - } -}; -AddVirtualHDActionListener* addVirtualHDActionListener; - - -class AddHardfileActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - EditFilesysHardfile(-1); - cmdAddHardfile->requestFocus(); - RefreshPanelHD(); - } -}; -AddHardfileActionListener* addHardfileActionListener; - - -void InitPanelHD(const struct _ConfigCategory& category) -{ - int row, col; - int posX; - int posY = DISTANCE_BORDER; - char tmp[20]; - - hdRemoveActionListener = new HDRemoveActionListener(); - hdEditActionListener = new HDEditActionListener(); - addVirtualHDActionListener = new AddVirtualHDActionListener(); - addHardfileActionListener = new AddHardfileActionListener(); - - for(col=0; colsetSize(category.panel->getWidth() - 2 * DISTANCE_BORDER, TEXTFIELD_HEIGHT + 4); - listEntry[row]->setBaseColor(gui_baseCol); - listEntry[row]->setFrameSize(0); - - listCmdProps[row] = new gcn::Button("..."); - listCmdProps[row]->setBaseColor(gui_baseCol); - listCmdProps[row]->setSize(SMALL_BUTTON_WIDTH, SMALL_BUTTON_HEIGHT); - snprintf(tmp, 20, "cmdProp%d", row); - listCmdProps[row]->setId(tmp); - listCmdProps[row]->addActionListener(hdEditActionListener); - - listCmdDelete[row] = new gcn::ImageButton("data/delete.png"); - listCmdDelete[row]->setBaseColor(gui_baseCol); - listCmdDelete[row]->setSize(SMALL_BUTTON_HEIGHT, SMALL_BUTTON_HEIGHT); - snprintf(tmp, 20, "cmdDel%d", row); - listCmdDelete[row]->setId(tmp); - listCmdDelete[row]->addActionListener(hdRemoveActionListener); - - for(col=0; colsetSize(COLUMN_SIZE[col] - 8, TEXTFIELD_HEIGHT); - listCells[row][col]->setEnabled(false); - listCells[row][col]->setBackgroundColor(gui_baseCol); - } - } - - cmdAddDirectory = new gcn::Button("Add Directory"); - cmdAddDirectory->setBaseColor(gui_baseCol); - cmdAddDirectory->setSize(BUTTON_WIDTH + 20, BUTTON_HEIGHT); - cmdAddDirectory->setId("cmdAddDir"); - cmdAddDirectory->addActionListener(addVirtualHDActionListener); - - cmdAddHardfile = new gcn::Button("Add Hardfile"); - cmdAddHardfile->setBaseColor(gui_baseCol); - cmdAddHardfile->setSize(BUTTON_WIDTH + 20, BUTTON_HEIGHT); - cmdAddHardfile->setId("cmdAddHDF"); - cmdAddHardfile->addActionListener(addHardfileActionListener); - - posX = DISTANCE_BORDER + 2 + SMALL_BUTTON_WIDTH + 34; - for(col=0; coladd(lblList[col], posX, posY); - posX += COLUMN_SIZE[col]; - } - posY += lblList[0]->getHeight() + 2; - - for(row=0; rowadd(listCmdProps[row], posX, 2); - posX += listCmdProps[row]->getWidth() + 4; - listEntry[row]->add(listCmdDelete[row], posX, 2); - posX += listCmdDelete[row]->getWidth() + 8; - for(col=0; coladd(listCells[row][col], posX, 2); - posX += COLUMN_SIZE[col]; - } - category.panel->add(listEntry[row], DISTANCE_BORDER, posY); - posY += listEntry[row]->getHeight() + 4; - } - - posY = category.panel->getHeight() - DISTANCE_BORDER - BUTTON_HEIGHT; - category.panel->add(cmdAddDirectory, DISTANCE_BORDER, posY); - category.panel->add(cmdAddHardfile, DISTANCE_BORDER + cmdAddDirectory->getWidth() + DISTANCE_NEXT_X, posY); - - RefreshPanelHD(); -} - - -void ExitPanelHD(void) -{ - int row, col; - - for(col=0; colsetText(devname); - listCells[row][COL_VOLUME]->setText(volname); - listCells[row][COL_PATH]->setText(rootdir); - if(readonly) - listCells[row][COL_READWRITE]->setText("no"); - else - listCells[row][COL_READWRITE]->setText("yes"); - listCells[row][COL_SIZE]->setText("n/a"); - snprintf(tmp, 32, "%d", bootpri); - listCells[row][COL_BOOTPRI]->setText(tmp); - } - else - { - listCells[row][COL_DEVICE]->setText(devname); - listCells[row][COL_VOLUME]->setText("n/a"); - listCells[row][COL_PATH]->setText(rootdir); - if(readonly) - listCells[row][COL_READWRITE]->setText("no"); - else - listCells[row][COL_READWRITE]->setText("yes"); - if (size >= 1024 * 1024 * 1024) - snprintf (tmp, 32, "%.1fG", ((double)(uae_u32)(size / (1024 * 1024))) / 1024.0); - else - snprintf (tmp, 32, "%.1fM", ((double)(uae_u32)(size / (1024))) / 1024.0); - listCells[row][COL_SIZE]->setText(tmp); - snprintf(tmp, 32, "%d", bootpri); - listCells[row][COL_BOOTPRI]->setText(tmp); - } - listCmdProps[row]->setEnabled(true); - listCmdDelete[row]->setEnabled(true); - } - else - { - // Empty slot - for(col=0; colsetText(""); - listCmdProps[row]->setEnabled(false); - listCmdDelete[row]->setEnabled(false); - } - } -} diff --git a/src/osdep/gui/PanelInput.cpp b/src/osdep/gui/PanelInput.cpp deleted file mode 100644 index 72012b78..00000000 --- a/src/osdep/gui/PanelInput.cpp +++ /dev/null @@ -1,536 +0,0 @@ -#include -#include -#include -#include "sdltruetypefont.hpp" -#include "SelectorEntry.hpp" -#include "UaeRadioButton.hpp" -#include "UaeDropDown.hpp" -#include "UaeCheckBox.hpp" - -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "options.h" -#include "memory.h" -#include "uae.h" -#include "autoconf.h" -#include "filesys.h" -#include "gui.h" -#include "target.h" -#include "gui_handling.h" - - -static const char *mousespeed_list[] = { ".25", ".5", "1x", "2x", "4x" }; -static const int mousespeed_values[] = { 2, 5, 10, 20, 40 }; -static const char *stylusoffset_list[] = { "None", "1 px", "2 px", "3 px", "4 px", "5 px", "6 px", "7 px", "8 px", "9 px", "10 px" }; -static const int stylusoffset_values[] = { 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20 }; - -static gcn::Label *lblCtrlConfig; -static gcn::UaeDropDown* cboCtrlConfig; -static gcn::Label *lblJoystick; -static gcn::UaeDropDown* cboJoystick; -static gcn::Label *lblAutofire; -static gcn::UaeDropDown* cboAutofire; -static gcn::Label* lblMouseSpeed; -static gcn::Label* lblMouseSpeedInfo; -static gcn::Slider* sldMouseSpeed; -static gcn::Label *lblTapDelay; -static gcn::UaeDropDown* cboTapDelay; -static gcn::Label* lblStylusOffset; -static gcn::Label* lblStylusOffsetInfo; -static gcn::Slider* sldStylusOffset; - -static gcn::UaeCheckBox* chkCustomCtrl; -static gcn::Label *lblDPAD; -static gcn::UaeDropDown* cboDPAD; -static gcn::Label *lblA; -static gcn::UaeDropDown* cboA; -static gcn::Label *lblB; -static gcn::UaeDropDown* cboB; -static gcn::Label *lblX; -static gcn::UaeDropDown* cboX; -static gcn::Label *lblY; -static gcn::UaeDropDown* cboY; -static gcn::Label *lblL; -static gcn::UaeDropDown* cboL; -static gcn::Label *lblR; -static gcn::UaeDropDown* cboR; -static gcn::Label *lblUp; -static gcn::UaeDropDown* cboUp; -static gcn::Label *lblDown; -static gcn::UaeDropDown* cboDown; -static gcn::Label *lblLeft; -static gcn::UaeDropDown* cboLeft; -static gcn::Label *lblRight; -static gcn::UaeDropDown* cboRight; - - -class StringListModel : public gcn::ListModel -{ - private: - std::vector values; - public: - StringListModel(const char *entries[], int count) - { - for(int i=0; i= values.size()) - return "---"; - return values[i]; - } -}; - -const char *ctrlConfigValues[] = { - "A=Autofire, X=Fire, Y=Space, B=2nd", - "A=Fire, X=Autofire, Y=Space, B=2nd", - "A=Autofire, X=Jump, Y=Fire, B=2nd", - "A=Fire, X=Jump, Y=Autofire, B=2nd" -}; -StringListModel ctrlConfigList(ctrlConfigValues, 4); - -const char *joystickValues[] = { "Port0", "Port1", "Both" }; -StringListModel joystickList(joystickValues, 3); - -const char *autofireValues[] = { "Light", "Medium", "Heavy" }; -StringListModel autofireList(autofireValues, 3); - -const char *tapDelayValues[] = { "Normal", "Short", "None" }; -StringListModel tapDelayList(tapDelayValues, 3); - -const char *dPADValues[] = { "Joystick", "Mouse", "Custom" }; -StringListModel dPADList(dPADValues, 3); - -const char *mappingValues[] = { - "Joystick Right", "Joystick Left", "Joystick Down", "Joystick Up", - "Joystick fire but.2", "Joystick fire but.1", "Mouse right button", "Mouse left button", - "------------------", - "Arrow Up", "Arrow Down", "Arrow Left", "Arrow Right", "Numpad 0", "Numpad 1", "Numpad 2", - "Numpad 3", "Numpad 4", "Numpad 5", "Numpad 6", "Numpad 7", "Numpad 8", "Numpad 9", - "Numpad Enter", "Numpad /", "Numpad *", "Numpad -", "Numpad +", - "Numpad Delete", "Numpad (", "Numpad )", - "Space", "Backspace", "Tab", "Return", "Escape", "Delete", - "Left Shift", "Right Shift", "CAPS LOCK", "CTRL", "Left ALT", "Right ALT", - "Left Amiga Key", "Right Amiga Key", "Help", "Left Bracket", "Right Bracket", - "Semicolon", "Comma", "Period", "Slash", "Backslash", "Quote", "#", - "", "Backquote", "-", "=", - "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", - "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", - "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", - "F1", "F2", "F3", "F4", "F5", "F6", "F7", "F8", "F9", "F10", "NULL" -}; -StringListModel mappingList(mappingValues, 105); - - -class InputActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - if (actionEvent.getSource() == cboCtrlConfig) - changed_prefs.pandora_joyConf = cboCtrlConfig->getSelected(); - - else if (actionEvent.getSource() == cboJoystick) - changed_prefs.pandora_joyPort = (cboJoystick->getSelected() + 1) % 3; - - else if (actionEvent.getSource() == cboAutofire) - { - if(cboAutofire->getSelected() == 0) - changed_prefs.input_autofire_framecnt = 12; - else if (cboAutofire->getSelected() == 1) - changed_prefs.input_autofire_framecnt = 8; - else - changed_prefs.input_autofire_framecnt = 4; - } - - else if (actionEvent.getSource() == sldMouseSpeed) - { - changed_prefs.input_joymouse_multiplier = mousespeed_values[(int)(sldMouseSpeed->getValue())]; - RefreshPanelInput(); - } - - else if (actionEvent.getSource() == cboTapDelay) - { - if(cboTapDelay->getSelected() == 0) - changed_prefs.pandora_tapDelay = 10; - else if (cboTapDelay->getSelected() == 1) - changed_prefs.pandora_tapDelay = 5; - else - changed_prefs.pandora_tapDelay = 2; - } - - else if (actionEvent.getSource() == sldStylusOffset) - { - changed_prefs.pandora_stylusOffset = stylusoffset_values[(int)(sldStylusOffset->getValue())]; - RefreshPanelInput(); - } - - else if (actionEvent.getSource() == chkCustomCtrl) - changed_prefs.pandora_customControls = chkCustomCtrl->isSelected() ? 1 : 0; - - else if (actionEvent.getSource() == cboDPAD) - changed_prefs.pandora_custom_dpad = cboDPAD->getSelected(); - - else if (actionEvent.getSource() == cboA) - changed_prefs.pandora_custom_A = cboA->getSelected() - 8; - - else if (actionEvent.getSource() == cboB) - changed_prefs.pandora_custom_B = cboB->getSelected() - 8; - - else if (actionEvent.getSource() == cboX) - changed_prefs.pandora_custom_X = cboX->getSelected() - 8; - - else if (actionEvent.getSource() == cboY) - changed_prefs.pandora_custom_Y = cboY->getSelected() - 8; - - else if (actionEvent.getSource() == cboL) - changed_prefs.pandora_custom_L = cboL->getSelected() - 8; - - else if (actionEvent.getSource() == cboR) - changed_prefs.pandora_custom_R = cboR->getSelected() - 8; - - else if (actionEvent.getSource() == cboUp) - changed_prefs.pandora_custom_up = cboUp->getSelected() - 8; - - else if (actionEvent.getSource() == cboDown) - changed_prefs.pandora_custom_down = cboDown->getSelected() - 8; - - else if (actionEvent.getSource() == cboLeft) - changed_prefs.pandora_custom_left = cboLeft->getSelected() - 8; - - else if (actionEvent.getSource() == cboRight) - changed_prefs.pandora_custom_right = cboRight->getSelected() - 8; - } -}; -static InputActionListener* inputActionListener; - - -void InitPanelInput(const struct _ConfigCategory& category) -{ - inputActionListener = new InputActionListener(); - - lblCtrlConfig = new gcn::Label("Control Config:"); - lblCtrlConfig->setSize(100, LABEL_HEIGHT); - lblCtrlConfig->setAlignment(gcn::Graphics::RIGHT); - cboCtrlConfig = new gcn::UaeDropDown(&ctrlConfigList); - cboCtrlConfig->setSize(280, DROPDOWN_HEIGHT); - cboCtrlConfig->setBaseColor(gui_baseCol); - cboCtrlConfig->setId("cboCtrlConfig"); - cboCtrlConfig->addActionListener(inputActionListener); - - lblJoystick = new gcn::Label("Joystick:"); - lblJoystick->setSize(100, LABEL_HEIGHT); - lblJoystick->setAlignment(gcn::Graphics::RIGHT); - cboJoystick = new gcn::UaeDropDown(&joystickList); - cboJoystick->setSize(80, DROPDOWN_HEIGHT); - cboJoystick->setBaseColor(gui_baseCol); - cboJoystick->setId("cboJoystick"); - cboJoystick->addActionListener(inputActionListener); - - lblAutofire = new gcn::Label("Autofire Rate:"); - lblAutofire->setSize(100, LABEL_HEIGHT); - lblAutofire->setAlignment(gcn::Graphics::RIGHT); - cboAutofire = new gcn::UaeDropDown(&autofireList); - cboAutofire->setSize(80, DROPDOWN_HEIGHT); - cboAutofire->setBaseColor(gui_baseCol); - cboAutofire->setId("cboAutofire"); - cboAutofire->addActionListener(inputActionListener); - - lblMouseSpeed = new gcn::Label("Mouse Speed:"); - lblMouseSpeed->setSize(100, LABEL_HEIGHT); - lblMouseSpeed->setAlignment(gcn::Graphics::RIGHT); - sldMouseSpeed = new gcn::Slider(0, 4); - sldMouseSpeed->setSize(110, SLIDER_HEIGHT); - sldMouseSpeed->setBaseColor(gui_baseCol); - sldMouseSpeed->setMarkerLength(20); - sldMouseSpeed->setStepLength(1); - sldMouseSpeed->setId("MouseSpeed"); - sldMouseSpeed->addActionListener(inputActionListener); - lblMouseSpeedInfo = new gcn::Label(".25"); - - lblTapDelay = new gcn::Label("Tap Delay:"); - lblTapDelay->setSize(100, LABEL_HEIGHT); - lblTapDelay->setAlignment(gcn::Graphics::RIGHT); - cboTapDelay = new gcn::UaeDropDown(&tapDelayList); - cboTapDelay->setSize(80, DROPDOWN_HEIGHT); - cboTapDelay->setBaseColor(gui_baseCol); - cboTapDelay->setId("cboTapDelay"); - cboTapDelay->addActionListener(inputActionListener); - - lblStylusOffset = new gcn::Label("Stylus Offset:"); - lblStylusOffset->setSize(100, LABEL_HEIGHT); - lblStylusOffset->setAlignment(gcn::Graphics::RIGHT); - sldStylusOffset = new gcn::Slider(0, 10); - sldStylusOffset->setSize(110, SLIDER_HEIGHT); - sldStylusOffset->setBaseColor(gui_baseCol); - sldStylusOffset->setMarkerLength(20); - sldStylusOffset->setStepLength(1); - sldStylusOffset->setId("StylusOffset"); - sldStylusOffset->addActionListener(inputActionListener); - lblStylusOffsetInfo = new gcn::Label("10 px"); - - chkCustomCtrl = new gcn::UaeCheckBox("Custom Control"); - chkCustomCtrl->setId("CustomCtrl"); - chkCustomCtrl->addActionListener(inputActionListener); - - lblDPAD = new gcn::Label("DPAD:"); - lblDPAD->setSize(100, LABEL_HEIGHT); - lblDPAD->setAlignment(gcn::Graphics::RIGHT); - cboDPAD = new gcn::UaeDropDown(&dPADList); - cboDPAD->setSize(80, DROPDOWN_HEIGHT); - cboDPAD->setBaseColor(gui_baseCol); - cboDPAD->setId("cboDPAD"); - cboDPAD->addActionListener(inputActionListener); - - lblA = new gcn::Label(":"); - lblA->setSize(100, LABEL_HEIGHT); - lblA->setAlignment(gcn::Graphics::RIGHT); - cboA = new gcn::UaeDropDown(&mappingList); - cboA->setSize(150, DROPDOWN_HEIGHT); - cboA->setBaseColor(gui_baseCol); - cboA->setId("cboA"); - cboA->addActionListener(inputActionListener); - - lblB = new gcn::Label(":"); - lblB->setSize(100, LABEL_HEIGHT); - lblB->setAlignment(gcn::Graphics::RIGHT); - cboB = new gcn::UaeDropDown(&mappingList); - cboB->setSize(150, DROPDOWN_HEIGHT); - cboB->setBaseColor(gui_baseCol); - cboB->setId("cboB"); - cboB->addActionListener(inputActionListener); - - lblX = new gcn::Label(":"); - lblX->setSize(100, LABEL_HEIGHT); - lblX->setAlignment(gcn::Graphics::RIGHT); - cboX = new gcn::UaeDropDown(&mappingList); - cboX->setSize(150, DROPDOWN_HEIGHT); - cboX->setBaseColor(gui_baseCol); - cboX->setId("cboX"); - cboX->addActionListener(inputActionListener); - - lblY = new gcn::Label(":"); - lblY->setSize(100, LABEL_HEIGHT); - lblY->setAlignment(gcn::Graphics::RIGHT); - cboY = new gcn::UaeDropDown(&mappingList); - cboY->setSize(150, DROPDOWN_HEIGHT); - cboY->setBaseColor(gui_baseCol); - cboY->setId("cboY"); - cboY->addActionListener(inputActionListener); - - lblL = new gcn::Label(":"); - lblL->setSize(100, LABEL_HEIGHT); - lblL->setAlignment(gcn::Graphics::RIGHT); - cboL = new gcn::UaeDropDown(&mappingList); - cboL->setSize(150, DROPDOWN_HEIGHT); - cboL->setBaseColor(gui_baseCol); - cboL->setId("cboL"); - cboL->addActionListener(inputActionListener); - - lblR = new gcn::Label(":"); - lblR->setSize(100, LABEL_HEIGHT); - lblR->setAlignment(gcn::Graphics::RIGHT); - cboR = new gcn::UaeDropDown(&mappingList); - cboR->setSize(150, DROPDOWN_HEIGHT); - cboR->setBaseColor(gui_baseCol); - cboR->setId("cboR"); - cboR->addActionListener(inputActionListener); - - lblUp = new gcn::Label("Up:"); - lblUp->setSize(100, LABEL_HEIGHT); - lblUp->setAlignment(gcn::Graphics::RIGHT); - cboUp = new gcn::UaeDropDown(&mappingList); - cboUp->setSize(150, DROPDOWN_HEIGHT); - cboUp->setBaseColor(gui_baseCol); - cboUp->setId("cboUp"); - cboUp->addActionListener(inputActionListener); - - lblDown = new gcn::Label("Down:"); - lblDown->setSize(100, LABEL_HEIGHT); - lblDown->setAlignment(gcn::Graphics::RIGHT); - cboDown = new gcn::UaeDropDown(&mappingList); - cboDown->setSize(150, DROPDOWN_HEIGHT); - cboDown->setBaseColor(gui_baseCol); - cboDown->setId("cboDown"); - cboDown->addActionListener(inputActionListener); - - lblLeft = new gcn::Label("Left:"); - lblLeft->setSize(100, LABEL_HEIGHT); - lblLeft->setAlignment(gcn::Graphics::RIGHT); - cboLeft = new gcn::UaeDropDown(&mappingList); - cboLeft->setSize(150, DROPDOWN_HEIGHT); - cboLeft->setBaseColor(gui_baseCol); - cboLeft->setId("cboLeft"); - cboLeft->addActionListener(inputActionListener); - - lblRight = new gcn::Label("Right:"); - lblRight->setSize(100, LABEL_HEIGHT); - lblRight->setAlignment(gcn::Graphics::RIGHT); - cboRight = new gcn::UaeDropDown(&mappingList); - cboRight->setSize(150, DROPDOWN_HEIGHT); - cboRight->setBaseColor(gui_baseCol); - cboRight->setId("cboRight"); - cboRight->addActionListener(inputActionListener); - - int posY = DISTANCE_BORDER; - category.panel->add(lblCtrlConfig, DISTANCE_BORDER, posY); - category.panel->add(cboCtrlConfig, DISTANCE_BORDER + lblCtrlConfig->getWidth() + 8, posY); - posY += cboCtrlConfig->getHeight() + DISTANCE_NEXT_Y; - category.panel->add(lblJoystick, DISTANCE_BORDER, posY); - category.panel->add(cboJoystick, DISTANCE_BORDER + lblJoystick->getWidth() + 8, posY); - category.panel->add(lblAutofire, 300, posY); - category.panel->add(cboAutofire, 300 + lblAutofire->getWidth() + 8, posY); - posY += cboAutofire->getHeight() + DISTANCE_NEXT_Y; - category.panel->add(lblTapDelay, DISTANCE_BORDER, posY); - category.panel->add(cboTapDelay, DISTANCE_BORDER + lblTapDelay->getWidth() + 8, posY); - posY += cboTapDelay->getHeight() + DISTANCE_NEXT_Y; - category.panel->add(lblMouseSpeed, DISTANCE_BORDER, posY); - category.panel->add(sldMouseSpeed, DISTANCE_BORDER + lblMouseSpeed->getWidth() + 8, posY); - category.panel->add(lblMouseSpeedInfo, sldMouseSpeed->getX() + sldMouseSpeed->getWidth() + 12, posY); - posY += sldMouseSpeed->getHeight() + DISTANCE_NEXT_Y; - category.panel->add(lblStylusOffset, DISTANCE_BORDER, posY); - category.panel->add(sldStylusOffset, DISTANCE_BORDER + lblStylusOffset->getWidth() + 8, posY); - category.panel->add(lblStylusOffsetInfo, sldStylusOffset->getX() + sldStylusOffset->getWidth() + 12, posY); - posY += sldStylusOffset->getHeight() + DISTANCE_NEXT_Y; - - category.panel->add(lblDPAD, DISTANCE_BORDER, posY); - category.panel->add(cboDPAD, DISTANCE_BORDER + lblDPAD->getWidth() + 8, posY); - category.panel->add(chkCustomCtrl, 320, posY); - posY += cboDPAD->getHeight() + DISTANCE_NEXT_Y; - category.panel->add(lblA, DISTANCE_BORDER, posY); - category.panel->add(cboA, DISTANCE_BORDER + lblA->getWidth() + 8, posY); - category.panel->add(lblB, 300, posY); - category.panel->add(cboB, 300 + lblB->getWidth() + 8, posY); - posY += cboA->getHeight() + 4; - category.panel->add(lblX, DISTANCE_BORDER, posY); - category.panel->add(cboX, DISTANCE_BORDER + lblX->getWidth() + 8, posY); - category.panel->add(lblY, 300, posY); - category.panel->add(cboY, 300 + lblY->getWidth() + 8, posY); - posY += cboX->getHeight() + 4; - category.panel->add(lblL, DISTANCE_BORDER, posY); - category.panel->add(cboL, DISTANCE_BORDER + lblL->getWidth() + 8, posY); - category.panel->add(lblR, 300, posY); - category.panel->add(cboR, 300 + lblR->getWidth() + 8, posY); - posY += cboL->getHeight() + 4; - category.panel->add(lblUp, DISTANCE_BORDER, posY); - category.panel->add(cboUp, DISTANCE_BORDER + lblUp->getWidth() + 8, posY); - category.panel->add(lblDown, 300, posY); - category.panel->add(cboDown, 300 + lblDown->getWidth() + 8, posY); - posY += cboUp->getHeight() + 4; - category.panel->add(lblLeft, DISTANCE_BORDER, posY); - category.panel->add(cboLeft, DISTANCE_BORDER + lblLeft->getWidth() + 8, posY); - category.panel->add(lblRight, 300, posY); - category.panel->add(cboRight, 300 + lblRight->getWidth() + 8, posY); - posY += cboLeft->getHeight() + 4; - - RefreshPanelInput(); -} - - -void ExitPanelInput(void) -{ - delete lblCtrlConfig; - delete cboCtrlConfig; - delete lblJoystick; - delete cboJoystick; - delete lblAutofire; - delete cboAutofire; - delete lblMouseSpeed; - delete sldMouseSpeed; - delete lblMouseSpeedInfo; - delete lblTapDelay; - delete cboTapDelay; - delete lblStylusOffset; - delete sldStylusOffset; - delete lblStylusOffsetInfo; - - delete chkCustomCtrl; - delete lblDPAD; - delete cboDPAD; - delete lblA; - delete cboA; - delete lblB; - delete cboB; - delete lblX; - delete cboX; - delete lblY; - delete cboY; - delete lblL; - delete cboL; - delete lblR; - delete cboR; - delete lblUp; - delete cboUp; - delete lblDown; - delete cboDown; - delete lblLeft; - delete cboLeft; - delete lblRight; - delete cboRight; - - delete inputActionListener; -} - - -void RefreshPanelInput(void) -{ - int i; - - cboCtrlConfig->setSelected(changed_prefs.pandora_joyConf); - cboJoystick->setSelected((changed_prefs.pandora_joyPort + 2) % 3); - - if (changed_prefs.input_autofire_framecnt == 12) - cboAutofire->setSelected(0); - else if (changed_prefs.input_autofire_framecnt == 8) - cboAutofire->setSelected(1); - else - cboAutofire->setSelected(2); - - for(i=0; i<5; ++i) - { - if(changed_prefs.input_joymouse_multiplier == mousespeed_values[i]) - { - sldMouseSpeed->setValue(i); - lblMouseSpeedInfo->setCaption(mousespeed_list[i]); - break; - } - } - - if (changed_prefs.pandora_tapDelay == 10) - cboTapDelay->setSelected(0); - else if (changed_prefs.pandora_tapDelay == 5) - cboTapDelay->setSelected(1); - else - cboTapDelay->setSelected(2); - - for(i=0; i<11; ++i) - { - if(changed_prefs.pandora_stylusOffset == stylusoffset_values[i]) - { - sldStylusOffset->setValue(i); - lblStylusOffsetInfo->setCaption(stylusoffset_list[i]); - break; - } - } - - chkCustomCtrl->setSelected(changed_prefs.pandora_customControls); - cboDPAD->setSelected(changed_prefs.pandora_custom_dpad); - cboA->setSelected(changed_prefs.pandora_custom_A + 8); - cboB->setSelected(changed_prefs.pandora_custom_B + 8); - cboX->setSelected(changed_prefs.pandora_custom_X + 8); - cboY->setSelected(changed_prefs.pandora_custom_Y + 8); - cboL->setSelected(changed_prefs.pandora_custom_L + 8); - cboR->setSelected(changed_prefs.pandora_custom_R + 8); - cboUp->setSelected(changed_prefs.pandora_custom_up + 8); - cboDown->setSelected(changed_prefs.pandora_custom_down + 8); - cboLeft->setSelected(changed_prefs.pandora_custom_left + 8); - cboRight->setSelected(changed_prefs.pandora_custom_right + 8); -} diff --git a/src/osdep/gui/PanelMisc.cpp b/src/osdep/gui/PanelMisc.cpp deleted file mode 100644 index ea03766a..00000000 --- a/src/osdep/gui/PanelMisc.cpp +++ /dev/null @@ -1,114 +0,0 @@ -#include -#include -#include -#include "sdltruetypefont.hpp" -#include "SelectorEntry.hpp" -#include "UaeRadioButton.hpp" -#include "UaeDropDown.hpp" -#include "UaeCheckBox.hpp" - -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "options.h" -#include "memory.h" -#include "uae.h" -#include "autoconf.h" -#include "filesys.h" -#include "gui.h" -#include "target.h" -#include "gui_handling.h" - - -static gcn::UaeCheckBox* chkStatusLine; -static gcn::UaeCheckBox* chkShowGUI; -static gcn::Label* lblPandoraSpeed; -static gcn::Label* lblPandoraSpeedInfo; -static gcn::Slider* sldPandoraSpeed; - - -class MiscActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - if (actionEvent.getSource() == chkStatusLine) - changed_prefs.leds_on_screen = chkStatusLine->isSelected(); - - else if (actionEvent.getSource() == chkShowGUI) - changed_prefs.start_gui = chkShowGUI->isSelected(); - - else if (actionEvent.getSource() == sldPandoraSpeed) - { - int newspeed = (int) sldPandoraSpeed->getValue(); - newspeed = newspeed - (newspeed % 20); - if(changed_prefs.pandora_cpu_speed != newspeed) - { - changed_prefs.pandora_cpu_speed = newspeed; - RefreshPanelMisc(); - } - } - } -}; -MiscActionListener* miscActionListener; - - -void InitPanelMisc(const struct _ConfigCategory& category) -{ - miscActionListener = new MiscActionListener(); - - chkStatusLine = new gcn::UaeCheckBox("Status Line"); - chkStatusLine->addActionListener(miscActionListener); - - chkShowGUI = new gcn::UaeCheckBox("Show GUI on startup"); - chkShowGUI->setId("ShowGUI"); - chkShowGUI->addActionListener(miscActionListener); - - lblPandoraSpeed = new gcn::Label("Pandora Speed:"); - lblPandoraSpeed->setSize(110, LABEL_HEIGHT); - lblPandoraSpeed->setAlignment(gcn::Graphics::RIGHT); - sldPandoraSpeed = new gcn::Slider(500, 1260); - sldPandoraSpeed->setSize(200, SLIDER_HEIGHT); - sldPandoraSpeed->setBaseColor(gui_baseCol); - sldPandoraSpeed->setMarkerLength(20); - sldPandoraSpeed->setStepLength(20); - sldPandoraSpeed->setId("PandSpeed"); - sldPandoraSpeed->addActionListener(miscActionListener); - lblPandoraSpeedInfo = new gcn::Label("1000 MHz"); - - int posY = DISTANCE_BORDER; - category.panel->add(chkStatusLine, DISTANCE_BORDER, posY); - posY += chkStatusLine->getHeight() + DISTANCE_NEXT_Y; - category.panel->add(chkShowGUI, DISTANCE_BORDER, posY); - posY += chkShowGUI->getHeight() + DISTANCE_NEXT_Y; - category.panel->add(lblPandoraSpeed, DISTANCE_BORDER, posY); - category.panel->add(sldPandoraSpeed, DISTANCE_BORDER + lblPandoraSpeed->getWidth() + 8, posY); - category.panel->add(lblPandoraSpeedInfo, sldPandoraSpeed->getX() + sldPandoraSpeed->getWidth() + 12, posY); - posY += sldPandoraSpeed->getHeight() + DISTANCE_NEXT_Y; - - RefreshPanelMisc(); -} - - -void ExitPanelMisc(void) -{ - delete chkStatusLine; - delete chkShowGUI; - delete lblPandoraSpeed; - delete sldPandoraSpeed; - delete lblPandoraSpeedInfo; - delete miscActionListener; -} - - -void RefreshPanelMisc(void) -{ - char tmp[20]; - - chkStatusLine->setSelected(changed_prefs.leds_on_screen); - chkShowGUI->setSelected(changed_prefs.start_gui); - - sldPandoraSpeed->setValue(changed_prefs.pandora_cpu_speed); - snprintf(tmp, 20, "%d MHz", changed_prefs.pandora_cpu_speed); - lblPandoraSpeedInfo->setCaption(tmp); -} diff --git a/src/osdep/gui/PanelPaths.cpp b/src/osdep/gui/PanelPaths.cpp deleted file mode 100644 index 8f386e41..00000000 --- a/src/osdep/gui/PanelPaths.cpp +++ /dev/null @@ -1,150 +0,0 @@ -#include -#include -#include -#include "sdltruetypefont.hpp" -#include "SelectorEntry.hpp" - -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "options.h" -#include "uae.h" -#include "gui.h" -#include "target.h" -#include "gui_handling.h" - -static gcn::Label *lblSystemROMs; -static gcn::TextField *txtSystemROMs; -static gcn::Button *cmdSystemROMs; -static gcn::Label *lblConfigPath; -static gcn::TextField *txtConfigPath; -static gcn::Button *cmdConfigPath; -static gcn::Button *cmdRescanROMs; - - -class FolderButtonActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - char tmp[MAX_PATH]; - - if (actionEvent.getSource() == cmdSystemROMs) - { - fetch_rompath(tmp, MAX_PATH); - if(SelectFolder("Folder for System ROMs", tmp)) - { - set_rompath(tmp); - RefreshPanelPaths(); - } - cmdSystemROMs->requestFocus(); - } - else if(actionEvent.getSource() == cmdConfigPath) - { - fetch_configurationpath(tmp, MAX_PATH); - if(SelectFolder("Folder for configuration files", tmp)) - { - set_configurationpath(tmp); - RefreshPanelPaths(); - RefreshPanelConfig(); - } - cmdConfigPath->requestFocus(); - } - } -}; -static FolderButtonActionListener* folderButtonActionListener; - - -class RescanROMsButtonActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - RescanROMs(); - RefreshPanelROM(); - } -}; -static RescanROMsButtonActionListener* rescanROMsButtonActionListener; - - -void InitPanelPaths(const struct _ConfigCategory& category) -{ - int textFieldWidth = category.panel->getWidth() - 2 * DISTANCE_BORDER - SMALL_BUTTON_WIDTH - DISTANCE_NEXT_X; - int yPos = DISTANCE_BORDER; - folderButtonActionListener = new FolderButtonActionListener(); - - lblSystemROMs = new gcn::Label("System ROMs:"); - lblSystemROMs->setSize(120, LABEL_HEIGHT); - txtSystemROMs = new gcn::TextField(); - txtSystemROMs->setSize(textFieldWidth, TEXTFIELD_HEIGHT); - txtSystemROMs->setEnabled(false); - cmdSystemROMs = new gcn::Button("..."); - cmdSystemROMs->setId("SystemROMs"); - cmdSystemROMs->setSize(SMALL_BUTTON_WIDTH, SMALL_BUTTON_HEIGHT); - cmdSystemROMs->setBaseColor(gui_baseCol); - cmdSystemROMs->addActionListener(folderButtonActionListener); - - lblConfigPath = new gcn::Label("Configuration files:"); - lblConfigPath->setSize(120, LABEL_HEIGHT); - txtConfigPath = new gcn::TextField(); - txtConfigPath->setSize(textFieldWidth, TEXTFIELD_HEIGHT); - txtConfigPath->setEnabled(false); - cmdConfigPath = new gcn::Button("..."); - cmdConfigPath->setId("ConfigPath"); - cmdConfigPath->setSize(SMALL_BUTTON_WIDTH, SMALL_BUTTON_HEIGHT); - cmdConfigPath->setBaseColor(gui_baseCol); - cmdConfigPath->addActionListener(folderButtonActionListener); - - category.panel->add(lblSystemROMs, DISTANCE_BORDER, yPos); - yPos += lblSystemROMs->getHeight(); - category.panel->add(txtSystemROMs, DISTANCE_BORDER, yPos); - category.panel->add(cmdSystemROMs, DISTANCE_BORDER + textFieldWidth + DISTANCE_NEXT_X, yPos); - yPos += txtSystemROMs->getHeight() + DISTANCE_NEXT_Y; - - category.panel->add(lblConfigPath, DISTANCE_BORDER, yPos); - yPos += lblConfigPath->getHeight(); - category.panel->add(txtConfigPath, DISTANCE_BORDER, yPos); - category.panel->add(cmdConfigPath, DISTANCE_BORDER + textFieldWidth + DISTANCE_NEXT_X, yPos); - yPos += txtConfigPath->getHeight() + DISTANCE_NEXT_Y; - - rescanROMsButtonActionListener = new RescanROMsButtonActionListener(); - - cmdRescanROMs = new gcn::Button("Rescan ROMs"); - cmdRescanROMs->setSize(120, BUTTON_HEIGHT); - cmdRescanROMs->setBaseColor(gui_baseCol); - cmdRescanROMs->setId("RescanROMs"); - cmdRescanROMs->addActionListener(rescanROMsButtonActionListener); - - category.panel->add(cmdRescanROMs, DISTANCE_BORDER, category.panel->getHeight() - BUTTON_HEIGHT - DISTANCE_BORDER); - - RefreshPanelPaths(); -} - - -void ExitPanelPaths(void) -{ - delete lblSystemROMs; - delete txtSystemROMs; - delete cmdSystemROMs; - - delete lblConfigPath; - delete txtConfigPath; - delete cmdConfigPath; - - delete folderButtonActionListener; - - delete cmdRescanROMs; - delete rescanROMsButtonActionListener; -} - - -void RefreshPanelPaths(void) -{ - char tmp[MAX_PATH]; - - fetch_rompath(tmp, MAX_PATH); - txtSystemROMs->setText(tmp); - - fetch_configurationpath(tmp, MAX_PATH); - txtConfigPath->setText(tmp); -} diff --git a/src/osdep/gui/PanelRAM.cpp b/src/osdep/gui/PanelRAM.cpp deleted file mode 100644 index 13d9b9c6..00000000 --- a/src/osdep/gui/PanelRAM.cpp +++ /dev/null @@ -1,253 +0,0 @@ -#include -#include -#include -#include "sdltruetypefont.hpp" -#include "SelectorEntry.hpp" -#include "UaeRadioButton.hpp" -#include "UaeDropDown.hpp" -#include "UaeCheckBox.hpp" - -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "options.h" -#include "memory.h" -#include "uae.h" -#include "gui.h" -#include "target.h" -#include "gui_handling.h" - - -static const char *ChipMem_list[] = { "512 K", "1 MB", "2 MB", "4 MB", "8 MB" }; -static const int ChipMem_values[] = { 0x080000, 0x100000, 0x200000, 0x400000, 0x800000 }; -static const char *SlowMem_list[] = { "None", "512 K", "1 MB", "1.5 MB", "1.8 MB" }; -static const int SlowMem_values[] = { 0x000000, 0x080000, 0x100000, 0x180000, 0x1c0000 }; -static const char *FastMem_list[] = { "None", "1 MB", "2 MB", "4 MB", "8 MB", "16 MB", "32 MB" }; -static const int FastMem_values[] = { 0x000000, 0x100000, 0x200000, 0x400000, 0x800000, 0x1000000, 0x2000000 }; - -static gcn::Window *grpRAM; -static gcn::Label* lblChipmem; -static gcn::Label* lblChipsize; -static gcn::Slider* sldChipmem; -static gcn::Label* lblSlowmem; -static gcn::Label* lblSlowsize; -static gcn::Slider* sldSlowmem; -static gcn::Label* lblFastmem; -static gcn::Label* lblFastsize; -static gcn::Slider* sldFastmem; -static gcn::Label* lblZ3mem; -static gcn::Label* lblZ3size; -static gcn::Slider* sldZ3mem; -static gcn::Label* lblGfxmem; -static gcn::Label* lblGfxsize; -static gcn::Slider* sldGfxmem; - - -class MemorySliderActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - if (actionEvent.getSource() == sldChipmem) { - changed_prefs.chipmem_size = ChipMem_values[(int)(sldChipmem->getValue())]; - if ((changed_prefs.chipmem_size > 0x200000) && (changed_prefs.fastmem_size > 0)) - changed_prefs.fastmem_size = 0; - } - - if (actionEvent.getSource() == sldSlowmem) { - changed_prefs.bogomem_size = SlowMem_values[(int)(sldSlowmem->getValue())]; - } - - if (actionEvent.getSource() == sldFastmem) { - changed_prefs.fastmem_size = FastMem_values[(int)(sldFastmem->getValue())]; - if (changed_prefs.fastmem_size > 0 && changed_prefs.chipmem_size > 0x200000) - changed_prefs.chipmem_size = 0x200000; - } - - if (actionEvent.getSource() == sldZ3mem) { - changed_prefs.z3fastmem_size = FastMem_values[(int)(sldZ3mem->getValue())]; - if (changed_prefs.z3fastmem_size > max_z3fastmem) - changed_prefs.z3fastmem_size = max_z3fastmem; - } - - if (actionEvent.getSource() == sldGfxmem) { - changed_prefs.gfxmem_size = FastMem_values[(int)(sldGfxmem->getValue())]; - } - - RefreshPanelRAM(); - } -}; -static MemorySliderActionListener* memorySliderActionListener; - - -void InitPanelRAM(const struct _ConfigCategory& category) -{ - memorySliderActionListener = new MemorySliderActionListener(); - - lblChipmem = new gcn::Label("Chip:"); - sldChipmem = new gcn::Slider(0, 4); - sldChipmem->setSize(110, SLIDER_HEIGHT); - sldChipmem->setBaseColor(gui_baseCol); - sldChipmem->setMarkerLength(20); - sldChipmem->setStepLength(1); - sldChipmem->setId("Chipmem"); - sldChipmem->addActionListener(memorySliderActionListener); - lblChipsize = new gcn::Label("None "); - - lblSlowmem = new gcn::Label("Slow:"); - sldSlowmem = new gcn::Slider(0, 4); - sldSlowmem->setSize(110, SLIDER_HEIGHT); - sldSlowmem->setBaseColor(gui_baseCol); - sldSlowmem->setMarkerLength(20); - sldSlowmem->setStepLength(1); - sldSlowmem->setId("Slowmem"); - sldSlowmem->addActionListener(memorySliderActionListener); - lblSlowsize = new gcn::Label("None "); - - lblFastmem = new gcn::Label("Fast:"); - sldFastmem = new gcn::Slider(0, 4); - sldFastmem->setSize(110, SLIDER_HEIGHT); - sldFastmem->setBaseColor(gui_baseCol); - sldFastmem->setMarkerLength(20); - sldFastmem->setStepLength(1); - sldFastmem->setId("Fastmem"); - sldFastmem->addActionListener(memorySliderActionListener); - lblFastsize = new gcn::Label("None "); - - lblZ3mem = new gcn::Label("Z3 fast:"); - sldZ3mem = new gcn::Slider(0, 6); - sldZ3mem->setSize(110, SLIDER_HEIGHT); - sldZ3mem->setBaseColor(gui_baseCol); - sldZ3mem->setMarkerLength(20); - sldZ3mem->setStepLength(1); - sldZ3mem->setId("Z3mem"); - sldZ3mem->addActionListener(memorySliderActionListener); - lblZ3size = new gcn::Label("None "); - - lblGfxmem = new gcn::Label("RTG:"); - sldGfxmem = new gcn::Slider(0, 5); - sldGfxmem->setSize(110, SLIDER_HEIGHT); - sldGfxmem->setBaseColor(gui_baseCol); - sldGfxmem->setMarkerLength(20); - sldGfxmem->setStepLength(1); - sldGfxmem->setId("Gfxmem"); - sldGfxmem->addActionListener(memorySliderActionListener); - lblGfxsize = new gcn::Label("None "); - - grpRAM = new gcn::Window("Memory Settings"); - grpRAM->setPosition(DISTANCE_BORDER, DISTANCE_BORDER); - - int posY = 10; - grpRAM->add(lblChipmem, 8, posY); - grpRAM->add(sldChipmem, 70, posY); - grpRAM->add(lblChipsize, 70 + sldChipmem->getWidth() + 12, posY); - posY += sldChipmem->getHeight() + DISTANCE_NEXT_Y; - - grpRAM->add(lblSlowmem, 8, posY); - grpRAM->add(sldSlowmem, 70, posY); - grpRAM->add(lblSlowsize, 70 + sldSlowmem->getWidth() + 12, posY); - posY += sldSlowmem->getHeight() + DISTANCE_NEXT_Y; - - grpRAM->add(lblFastmem, 8, posY); - grpRAM->add(sldFastmem, 70, posY); - grpRAM->add(lblFastsize, 70 + sldFastmem->getWidth() + 12, posY); - posY += sldFastmem->getHeight() + DISTANCE_NEXT_Y; - - grpRAM->add(lblZ3mem, 8, posY); - grpRAM->add(sldZ3mem, 70, posY); - grpRAM->add(lblZ3size, 70 + sldZ3mem->getWidth() + 12, posY); - posY += sldZ3mem->getHeight() + DISTANCE_NEXT_Y; - - grpRAM->add(lblGfxmem, 8, posY); - grpRAM->add(sldGfxmem, 70, posY); - grpRAM->add(lblGfxsize, 70 + sldGfxmem->getWidth() + 12, posY); - posY += sldGfxmem->getHeight() + DISTANCE_NEXT_Y; - - grpRAM->setMovable(false); - grpRAM->setSize(250, posY + DISTANCE_BORDER); - grpRAM->setBaseColor(gui_baseCol); - - category.panel->add(grpRAM); - - RefreshPanelRAM(); -} - - -void ExitPanelRAM(void) -{ - delete lblChipmem; - delete sldChipmem; - delete lblChipsize; - delete lblSlowmem; - delete sldSlowmem; - delete lblSlowsize; - delete lblFastmem; - delete sldFastmem; - delete lblFastsize; - delete lblZ3mem; - delete sldZ3mem; - delete lblZ3size; - delete lblGfxmem; - delete sldGfxmem; - delete lblGfxsize; - delete grpRAM; - delete memorySliderActionListener; -} - - -void RefreshPanelRAM(void) -{ - int i; - - for(i=0; i<5; ++i) - { - if(changed_prefs.chipmem_size == ChipMem_values[i]) - { - sldChipmem->setValue(i); - lblChipsize->setCaption(ChipMem_list[i]); - break; - } - } - - for(i=0; i<5; ++i) - { - if(changed_prefs.bogomem_size == SlowMem_values[i]) - { - sldSlowmem->setValue(i); - lblSlowsize->setCaption(SlowMem_list[i]); - break; - } - } - - for(i=0; i<5; ++i) - { - if(changed_prefs.fastmem_size == FastMem_values[i]) - { - sldFastmem->setValue(i); - lblFastsize->setCaption(FastMem_list[i]); - break; - } - } - - for(i=0; i<7; ++i) - { - if(changed_prefs.z3fastmem_size == FastMem_values[i]) - { - sldZ3mem->setValue(i); - lblZ3size->setCaption(FastMem_list[i]); - break; - } - } - sldZ3mem->setEnabled(!changed_prefs.address_space_24); - - for(i=0; i<6; ++i) - { - if(changed_prefs.gfxmem_size == FastMem_values[i]) - { - sldGfxmem->setValue(i); - lblGfxsize->setCaption(FastMem_list[i]); - break; - } - } - sldGfxmem->setEnabled(!changed_prefs.address_space_24); -} diff --git a/src/osdep/gui/PanelROM.cpp b/src/osdep/gui/PanelROM.cpp deleted file mode 100644 index 2d0fc2d8..00000000 --- a/src/osdep/gui/PanelROM.cpp +++ /dev/null @@ -1,249 +0,0 @@ -#include -#include -#include -#include "sdltruetypefont.hpp" -#include "SelectorEntry.hpp" -#include "UaeRadioButton.hpp" -#include "UaeDropDown.hpp" -#include "UaeCheckBox.hpp" - -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "options.h" -#include "memory.h" -#include "uae.h" -#include "gui.h" -#include "target.h" -#include "gui_handling.h" - -static gcn::Label *lblMainROM; -static gcn::UaeDropDown* cboMainROM; -static gcn::Button *cmdMainROM; -static gcn::Label *lblExtROM; -static gcn::UaeDropDown* cboExtROM; -static gcn::Button *cmdExtROM; -static gcn::UaeCheckBox* chkMapROM; - - -class ROMListModel : public gcn::ListModel -{ - private: - std::vector roms; - std::vector idxToAvailableROMs; - int ROMType; - - public: - ROMListModel(int romtype) - { - ROMType = romtype; - } - - int getNumberOfElements() - { - return roms.size(); - } - - std::string getElementAt(int i) - { - if(i < 0 || i >= roms.size()) - return "---"; - return roms[i]; - } - - AvailableROM* getROMat(int i) - { - if(i >= 0 && i < idxToAvailableROMs.size()) - return idxToAvailableROMs[i] < 0 ? NULL : lstAvailableROMs[idxToAvailableROMs[i]]; - return NULL; - } - - int InitROMList(char *current) - { - roms.clear(); - idxToAvailableROMs.clear(); - - if(ROMType & (ROMTYPE_EXTCDTV | ROMTYPE_EXTCD32)) - { - roms.push_back(""); - idxToAvailableROMs.push_back(-1); - } - int currIdx = -1; - for(int i=0; iROMType & ROMType) - { - if(!strcasecmp(lstAvailableROMs[i]->Path, current)) - currIdx = roms.size(); - roms.push_back(lstAvailableROMs[i]->Name); - idxToAvailableROMs.push_back(i); - } - } - return currIdx; - } -}; -static ROMListModel *mainROMList; -static ROMListModel *extROMList; - - -class MainROMActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - AvailableROM* rom = mainROMList->getROMat(cboMainROM->getSelected()); - if(rom != NULL) - strncpy(changed_prefs.romfile, rom->Path, sizeof(changed_prefs.romfile)); - } -}; -static MainROMActionListener* mainROMActionListener; - - -class ExtROMActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - AvailableROM* rom = extROMList->getROMat(cboExtROM->getSelected()); - if(rom != NULL) - strncpy(changed_prefs.romextfile, rom->Path, sizeof(changed_prefs.romextfile)); - else - strncpy(changed_prefs.romextfile, "", sizeof(changed_prefs.romextfile)); - } -}; -static ExtROMActionListener* extROMActionListener; - - -class ROMButtonActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - char tmp[MAX_PATH]; - const char *filter[] = { ".rom", "\0" }; - - if (actionEvent.getSource() == cmdMainROM) - { - strncpy(tmp, currentDir, MAX_PATH); - if(SelectFile("Select System ROM", tmp, filter)) - { - AvailableROM *newrom; - newrom = new AvailableROM(); - extractFileName(tmp, newrom->Name); - removeFileExtension(newrom->Name); - strncpy(newrom->Path, tmp, MAX_PATH); - newrom->ROMType = ROMTYPE_KICK; - lstAvailableROMs.push_back(newrom); - strncpy(changed_prefs.romfile, tmp, sizeof(changed_prefs.romfile)); - RefreshPanelROM(); - } - cmdMainROM->requestFocus(); - } - else if (actionEvent.getSource() == cmdExtROM) - { - strncpy(tmp, currentDir, MAX_PATH); - if(SelectFile("Select Extended ROM", tmp, filter)) - { - AvailableROM *newrom; - newrom = new AvailableROM(); - extractFileName(tmp, newrom->Name); - removeFileExtension(newrom->Name); - strncpy(newrom->Path, tmp, MAX_PATH); - newrom->ROMType = ROMTYPE_EXTCDTV; - lstAvailableROMs.push_back(newrom); - strncpy(changed_prefs.romextfile, tmp, sizeof(changed_prefs.romextfile)); - RefreshPanelROM(); - } - cmdExtROM->requestFocus(); - } - } -}; -static ROMButtonActionListener* romButtonActionListener; - - -void InitPanelROM(const struct _ConfigCategory& category) -{ - mainROMActionListener = new MainROMActionListener(); - extROMActionListener = new ExtROMActionListener(); - romButtonActionListener = new ROMButtonActionListener(); - mainROMList = new ROMListModel(ROMTYPE_KICK | ROMTYPE_KICKCD32); - extROMList = new ROMListModel(ROMTYPE_EXTCDTV | ROMTYPE_EXTCD32); - - lblMainROM = new gcn::Label("Main ROM File:"); - lblMainROM->setSize(200, LABEL_HEIGHT); - cboMainROM = new gcn::UaeDropDown(mainROMList); - cboMainROM->setSize(400, DROPDOWN_HEIGHT); - cboMainROM->setBaseColor(gui_baseCol); - cboMainROM->setId("cboMainROM"); - cboMainROM->addActionListener(mainROMActionListener); - cmdMainROM = new gcn::Button("..."); - cmdMainROM->setId("MainROM"); - cmdMainROM->setSize(SMALL_BUTTON_WIDTH, SMALL_BUTTON_HEIGHT); - cmdMainROM->setBaseColor(gui_baseCol); - cmdMainROM->addActionListener(romButtonActionListener); - - lblExtROM = new gcn::Label("Extended ROM File:"); - lblExtROM->setSize(200, LABEL_HEIGHT); - cboExtROM = new gcn::UaeDropDown(extROMList); - cboExtROM->setSize(400, DROPDOWN_HEIGHT); - cboExtROM->setBaseColor(gui_baseCol); - cboExtROM->setId("cboExtROM"); - cboExtROM->addActionListener(extROMActionListener); - cmdExtROM = new gcn::Button("..."); - cmdExtROM->setId("ExtROM"); - cmdExtROM->setSize(SMALL_BUTTON_WIDTH, SMALL_BUTTON_HEIGHT); - cmdExtROM->setBaseColor(gui_baseCol); - cmdExtROM->addActionListener(romButtonActionListener); - - chkMapROM = new gcn::UaeCheckBox("MapROM emulation", true); - chkMapROM->setEnabled(false); - - int posY = DISTANCE_BORDER; - category.panel->add(lblMainROM, DISTANCE_BORDER, posY); - posY += lblMainROM->getHeight() + 4; - category.panel->add(cboMainROM, DISTANCE_BORDER, posY); - category.panel->add(cmdMainROM, DISTANCE_BORDER + cboMainROM->getWidth() + DISTANCE_NEXT_X, posY); - posY += cboMainROM->getHeight() + DISTANCE_NEXT_Y; - - category.panel->add(lblExtROM, DISTANCE_BORDER, posY); - posY += lblExtROM->getHeight() + 4; - category.panel->add(cboExtROM, DISTANCE_BORDER, posY); - category.panel->add(cmdExtROM, DISTANCE_BORDER + cboExtROM->getWidth() + DISTANCE_NEXT_X, posY); - posY += cboExtROM->getHeight() + DISTANCE_NEXT_Y; - -// category.panel->add(chkMapROM, DISTANCE_BORDER, posY); - posY += chkMapROM->getHeight() + DISTANCE_NEXT_Y; - - RefreshPanelROM(); -} - - -void ExitPanelROM(void) -{ - delete lblMainROM; - delete cboMainROM; - delete cmdMainROM; - delete mainROMList; - delete mainROMActionListener; - - delete lblExtROM; - delete cboExtROM; - delete cmdExtROM; - delete extROMList; - delete extROMActionListener; - - delete romButtonActionListener; - delete chkMapROM; -} - - -void RefreshPanelROM(void) -{ - int idx = mainROMList->InitROMList(changed_prefs.romfile); - cboMainROM->setSelected(idx); - - idx = extROMList->InitROMList(changed_prefs.romextfile); - cboExtROM->setSelected(idx); - - chkMapROM->setSelected(false); -} diff --git a/src/osdep/gui/PanelSavestate.cpp b/src/osdep/gui/PanelSavestate.cpp deleted file mode 100644 index 2dd3357b..00000000 --- a/src/osdep/gui/PanelSavestate.cpp +++ /dev/null @@ -1,250 +0,0 @@ -#include -#include -#include -#include -#include "sdltruetypefont.hpp" -#include "SelectorEntry.hpp" -#include "UaeRadioButton.hpp" -#include "UaeCheckBox.hpp" - -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "options.h" -#include "autoconf.h" -#include "xwin.h" -#include "custom.h" -#include "drawing.h" -#include "uae.h" -#include "gui.h" -#include "savestate.h" -#include "target.h" -#include "gui_handling.h" - - -int currentStateNum = 0; - -static gcn::Window *grpNumber; -static gcn::UaeRadioButton* optState0; -static gcn::UaeRadioButton* optState1; -static gcn::UaeRadioButton* optState2; -static gcn::UaeRadioButton* optState3; -static gcn::Window *wndScreenshot; -static gcn::Icon* icoSavestate = 0; -static gcn::Image *imgSavestate = 0; -static gcn::Button* cmdLoadState; -static gcn::Button* cmdSaveState; -static gcn::Label *lblWarningHDDon; - - -class SavestateActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - if (actionEvent.getSource() == optState0) - currentStateNum = 0; - else if (actionEvent.getSource() == optState1) - currentStateNum = 1; - else if (actionEvent.getSource() == optState2) - currentStateNum = 2; - else if (actionEvent.getSource() == optState3) - currentStateNum = 3; - else if (actionEvent.getSource() == cmdLoadState) - { - //------------------------------------------ - // Load state - //------------------------------------------ - if(emulating) - { - if(strlen(savestate_fname) > 0) - { - FILE *f = fopen(savestate_fname,"rb"); - if (f) - { - fclose(f); - savestate_initsave(savestate_fname, 2); - savestate_state = STATE_DORESTORE; - gui_running = false; - } - } - if(savestate_state != STATE_DORESTORE) - ShowMessage("Loading savestate", "Statefile doesn't exist.", "", "Ok", ""); - } - else - ShowMessage("Loading savestate", "Emulation hasn't started yet.", "", "Ok", ""); - } - else if (actionEvent.getSource() == cmdSaveState) - { - //------------------------------------------ - // Save current state - //------------------------------------------ - if(emulating) - { - savestate_initsave(savestate_fname, 2); - save_state (savestate_fname, "..."); - savestate_state = STATE_DOSAVE; // Just to create the screenshot - delay_savestate_frame = 1; - gui_running = false; - } - else - ShowMessage("Saving state", "Emulation hasn't started yet.", "", "Ok", ""); - } - - RefreshPanelSavestate(); - } -}; -static SavestateActionListener* savestateActionListener; - - -void InitPanelSavestate(const struct _ConfigCategory& category) -{ - savestateActionListener = new SavestateActionListener(); - - optState0 = new gcn::UaeRadioButton("0", "radiostategroup"); - optState0->setId("State0"); - optState0->addActionListener(savestateActionListener); - - optState1 = new gcn::UaeRadioButton("1", "radiostategroup"); - optState1->setId("State1"); - optState1->addActionListener(savestateActionListener); - - optState2 = new gcn::UaeRadioButton("2", "radiostategroup"); - optState2->setId("State2"); - optState2->addActionListener(savestateActionListener); - - optState3 = new gcn::UaeRadioButton("3", "radiostategroup"); - optState3->setId("State3"); - optState3->addActionListener(savestateActionListener); - - grpNumber = new gcn::Window("Number"); - grpNumber->add(optState0, 5, 10); - grpNumber->add(optState1, 5, 40); - grpNumber->add(optState2, 5, 70); - grpNumber->add(optState3, 5, 100); - grpNumber->setMovable(false); - grpNumber->setSize(60, 145); - grpNumber->setBaseColor(gui_baseCol); - - wndScreenshot = new gcn::Window("State screen"); - wndScreenshot->setMovable(false); - wndScreenshot->setSize(400, 300); - wndScreenshot->setBaseColor(gui_baseCol); - - cmdLoadState = new gcn::Button("Load State"); - cmdLoadState->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdLoadState->setBaseColor(gui_baseCol); - cmdLoadState->setId("LoadState"); - cmdLoadState->addActionListener(savestateActionListener); - - cmdSaveState = new gcn::Button("Save State"); - cmdSaveState->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdSaveState->setBaseColor(gui_baseCol); - cmdSaveState->setId("SaveState"); - cmdSaveState->addActionListener(savestateActionListener); - - lblWarningHDDon = new gcn::Label("State saves do not support harddrive emulation."); - lblWarningHDDon->setSize(360, LABEL_HEIGHT); - - category.panel->add(grpNumber, DISTANCE_BORDER, DISTANCE_BORDER); - category.panel->add(wndScreenshot, DISTANCE_BORDER + 100, DISTANCE_BORDER); - int buttonY = category.panel->getHeight() - DISTANCE_BORDER - BUTTON_HEIGHT; - category.panel->add(cmdLoadState, DISTANCE_BORDER, buttonY); - category.panel->add(cmdSaveState, DISTANCE_BORDER + BUTTON_WIDTH + DISTANCE_NEXT_X, buttonY); - category.panel->add(lblWarningHDDon, DISTANCE_BORDER + 100, DISTANCE_BORDER + 50); - - RefreshPanelSavestate(); -} - - -void ExitPanelSavestate(void) -{ - delete optState0; - delete optState1; - delete optState2; - delete optState3; - delete grpNumber; - - if(imgSavestate != 0) - delete imgSavestate; - imgSavestate = 0; - if(icoSavestate != 0) - delete icoSavestate; - icoSavestate = 0; - delete wndScreenshot; - - delete cmdLoadState; - delete cmdSaveState; - delete lblWarningHDDon; - - delete savestateActionListener; -} - - -void RefreshPanelSavestate(void) -{ - if(icoSavestate != 0) - { - wndScreenshot->remove(icoSavestate); - delete icoSavestate; - icoSavestate = 0; - } - if(imgSavestate != 0) - { - delete imgSavestate; - imgSavestate = 0; - } - - switch(currentStateNum) - { - case 0: - optState0->setSelected(true); - break; - case 1: - optState1->setSelected(true); - break; - case 2: - optState2->setSelected(true); - break; - case 3: - optState3->setSelected(true); - break; - } - - gui_update(); - if(strlen(screenshot_filename) > 0) - { - FILE *f=fopen(screenshot_filename,"rb"); - if (f) - { - fclose(f); - gcn::Rectangle rect = wndScreenshot->getChildrenArea(); - SDL_Surface *loadedImage = IMG_Load(screenshot_filename); - if(loadedImage != NULL) - { - SDL_Rect source = {0, 0, 0, 0 }; - SDL_Rect target = {0, 0, 0, 0 }; - SDL_Surface *scaled = SDL_CreateRGBSurface(loadedImage->flags, rect.width, rect.height, loadedImage->format->BitsPerPixel, loadedImage->format->Rmask, loadedImage->format->Gmask, loadedImage->format->Bmask, loadedImage->format->Amask); - source.w = loadedImage->w; - source.h = loadedImage->h; - target.w = rect.width; - target.h = rect.height; - SDL_SoftStretch(loadedImage, &source, scaled, &target); - SDL_FreeSurface(loadedImage); - imgSavestate = new gcn::SDLImage(scaled, true); - icoSavestate = new gcn::Icon(imgSavestate); - wndScreenshot->add(icoSavestate); - } - } - } - - bool enabled = nr_units (currprefs.mountinfo) == 0; - optState0->setEnabled(enabled); - optState1->setEnabled(enabled); - optState2->setEnabled(enabled); - optState3->setEnabled(enabled); - wndScreenshot->setVisible(enabled); - cmdLoadState->setEnabled(enabled); - cmdSaveState->setEnabled(enabled); - lblWarningHDDon->setVisible(!enabled); -} diff --git a/src/osdep/gui/PanelSound.cpp b/src/osdep/gui/PanelSound.cpp deleted file mode 100644 index a819cd83..00000000 --- a/src/osdep/gui/PanelSound.cpp +++ /dev/null @@ -1,461 +0,0 @@ -#include -#include -#include -#include "sdltruetypefont.hpp" -#include "SelectorEntry.hpp" -#include "UaeRadioButton.hpp" -#include "UaeCheckBox.hpp" -#include "UaeDropDown.hpp" - -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "options.h" -#include "uae.h" -#include "gui.h" -#include "custom.h" -#include "target.h" -#include "gui_handling.h" -#include "sounddep/sound.h" - - -static gcn::Window *grpSound; -static gcn::UaeRadioButton* optSoundDisabled; -static gcn::UaeRadioButton* optSoundDisabledEmu; -static gcn::UaeRadioButton* optSoundEmulated; -static gcn::UaeRadioButton* optSoundEmulatedBest; -static gcn::Window *grpMode; -static gcn::UaeRadioButton* optMono; -static gcn::UaeRadioButton* optStereo; -static gcn::Label* lblFrequency; -static gcn::UaeDropDown* cboFrequency; -static gcn::Label* lblInterpolation; -static gcn::UaeDropDown* cboInterpolation; -static gcn::Label* lblFilter; -static gcn::UaeDropDown* cboFilter; -static gcn::Label* lblSeparation; -static gcn::Label* lblSeparationInfo; -static gcn::Slider* sldSeparation; -static gcn::Label* lblStereoDelay; -static gcn::Label* lblStereoDelayInfo; -static gcn::Slider* sldStereoDelay; - -static int curr_separation_idx; -static int curr_stereodelay_idx; - - -class FrequencyListModel : public gcn::ListModel -{ - private: - std::vector freq; - - public: - FrequencyListModel() - { - freq.push_back("11025"); - freq.push_back("22050"); - freq.push_back("32000"); - freq.push_back("44100"); - } - - int getNumberOfElements() - { - return freq.size(); - } - - std::string getElementAt(int i) - { - if(i < 0 || i >= freq.size()) - return "---"; - return freq[i]; - } -}; -static FrequencyListModel frequencyTypeList; - - -class InterpolationListModel : public gcn::ListModel -{ - private: - std::vector entry; - - public: - InterpolationListModel() - { - entry.push_back("Disabled"); - entry.push_back("Anti"); - entry.push_back("Sinc"); - entry.push_back("RH"); - entry.push_back("Crux"); - } - - int getNumberOfElements() - { - return entry.size(); - } - - std::string getElementAt(int i) - { - if(i < 0 || i >= entry.size()) - return "---"; - return entry[i]; - } -}; -static InterpolationListModel interpolationTypeList; - - -class FilterListModel : public gcn::ListModel -{ - private: - std::vector entry; - - public: - FilterListModel() - { - entry.push_back("Always off"); - entry.push_back("Emulated (A500)"); - entry.push_back("Emulated (A1200)"); - entry.push_back("Always on (A500)"); - entry.push_back("Always on (A1200)"); - } - - int getNumberOfElements() - { - return entry.size(); - } - - std::string getElementAt(int i) - { - if(i < 0 || i >= entry.size()) - return "---"; - return entry[i]; - } -}; -static FilterListModel filterTypeList; - - -class SoundActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - if (actionEvent.getSource() == optSoundDisabled) - changed_prefs.produce_sound = 0; - else if (actionEvent.getSource() == optSoundDisabledEmu) - changed_prefs.produce_sound = 1; - else if (actionEvent.getSource() == optSoundEmulated) - changed_prefs.produce_sound = 2; - else if (actionEvent.getSource() == optSoundEmulatedBest) - changed_prefs.produce_sound = 3; - - else if (actionEvent.getSource() == optMono) - changed_prefs.sound_stereo = 0; - else if (actionEvent.getSource() == optStereo) - changed_prefs.sound_stereo = 1; - - else if (actionEvent.getSource() == cboFrequency) - { - switch(cboFrequency->getSelected()) - { - case 0: - changed_prefs.sound_freq = 11025; - break; - case 1: - changed_prefs.sound_freq = 22050; - break; - case 2: - changed_prefs.sound_freq = 32000; - break; - case 3: - changed_prefs.sound_freq = 44100; - break; - } - } - - else if (actionEvent.getSource() == cboInterpolation) - changed_prefs.sound_interpol = cboInterpolation->getSelected(); - - else if (actionEvent.getSource() == cboFilter) - { - switch (cboFilter->getSelected()) - { - case 0: - changed_prefs.sound_filter = FILTER_SOUND_OFF; - break; - case 1: - changed_prefs.sound_filter = FILTER_SOUND_EMUL; - changed_prefs.sound_filter_type = 0; - break; - case 2: - changed_prefs.sound_filter = FILTER_SOUND_EMUL; - changed_prefs.sound_filter_type = 1; - break; - case 3: - changed_prefs.sound_filter = FILTER_SOUND_ON; - changed_prefs.sound_filter_type = 0; - break; - case 4: - changed_prefs.sound_filter = FILTER_SOUND_ON; - changed_prefs.sound_filter_type = 1; - break; - } - } - - else if (actionEvent.getSource() == sldSeparation) - { - if(curr_separation_idx != (int)(sldSeparation->getValue()) - && changed_prefs.sound_stereo > 0) - { - curr_separation_idx = (int)(sldSeparation->getValue()); - changed_prefs.sound_stereo_separation = 10 - curr_separation_idx; - } - } - - else if (actionEvent.getSource() == sldStereoDelay) - { - if(curr_stereodelay_idx != (int)(sldStereoDelay->getValue()) - && changed_prefs.sound_stereo > 0) - { - curr_stereodelay_idx = (int)(sldStereoDelay->getValue()); - if(curr_stereodelay_idx > 0) - changed_prefs.sound_mixed_stereo = curr_stereodelay_idx; - else - changed_prefs.sound_mixed_stereo = -1; - } - } - - RefreshPanelSound(); - } -}; -static SoundActionListener* soundActionListener; - - -void InitPanelSound(const struct _ConfigCategory& category) -{ - soundActionListener = new SoundActionListener(); - - optSoundDisabled = new gcn::UaeRadioButton("Disabled", "radiosoundgroup"); - optSoundDisabled->setId("sndDisable"); - optSoundDisabled->addActionListener(soundActionListener); - - optSoundDisabledEmu = new gcn::UaeRadioButton("Disabled, but emulated", "radiosoundgroup"); - optSoundDisabledEmu->setId("sndDisEmu"); - optSoundDisabledEmu->addActionListener(soundActionListener); - - optSoundEmulated = new gcn::UaeRadioButton("Enabled", "radiosoundgroup"); - optSoundEmulated->setId("sndEmulate"); - optSoundEmulated->addActionListener(soundActionListener); - - optSoundEmulatedBest = new gcn::UaeRadioButton("Enabled, most accurate", "radiosoundgroup"); - optSoundEmulatedBest->setId("sndEmuBest"); - optSoundEmulatedBest->addActionListener(soundActionListener); - - grpSound = new gcn::Window("Sound Emulation"); - grpSound->add(optSoundDisabled, 5, 10); - grpSound->add(optSoundDisabledEmu, 5, 40); - grpSound->add(optSoundEmulated, 5, 70); - grpSound->add(optSoundEmulatedBest, 5, 100); - grpSound->setMovable(false); - grpSound->setSize(200, 150); - grpSound->setBaseColor(gui_baseCol); - - lblFrequency = new gcn::Label("Frequency:"); - lblFrequency->setSize(130, LABEL_HEIGHT); - lblFrequency->setAlignment(gcn::Graphics::RIGHT); - cboFrequency = new gcn::UaeDropDown(&frequencyTypeList); - cboFrequency->setSize(160, DROPDOWN_HEIGHT); - cboFrequency->setBaseColor(gui_baseCol); - cboFrequency->setId("cboFrequency"); - cboFrequency->addActionListener(soundActionListener); - - optMono = new gcn::UaeRadioButton("Mono", "radiosoundmodegroup"); - optMono->addActionListener(soundActionListener); - - optStereo = new gcn::UaeRadioButton("Stereo", "radiosoundmodegroup"); - optStereo->addActionListener(soundActionListener); - - grpMode = new gcn::Window("Mode"); - grpMode->add(optMono, 5, 10); - grpMode->add(optStereo, 5, 40); - grpMode->setMovable(false); - grpMode->setSize(90, 90); - grpMode->setBaseColor(gui_baseCol); - - lblInterpolation = new gcn::Label("Interpolation:"); - lblInterpolation->setSize(130, LABEL_HEIGHT); - lblInterpolation->setAlignment(gcn::Graphics::RIGHT); - cboInterpolation = new gcn::UaeDropDown(&interpolationTypeList); - cboInterpolation->setSize(160, DROPDOWN_HEIGHT); - cboInterpolation->setBaseColor(gui_baseCol); - cboInterpolation->setId("cboInterpol"); - cboInterpolation->addActionListener(soundActionListener); - - lblFilter = new gcn::Label("Filter:"); - lblFilter->setSize(130, LABEL_HEIGHT); - lblFilter->setAlignment(gcn::Graphics::RIGHT); - cboFilter = new gcn::UaeDropDown(&filterTypeList); - cboFilter->setSize(160, DROPDOWN_HEIGHT); - cboFilter->setBaseColor(gui_baseCol); - cboFilter->setId("cboFilter"); - cboFilter->addActionListener(soundActionListener); - - lblSeparation = new gcn::Label("Stereo separation:"); - lblSeparation->setSize(130, LABEL_HEIGHT); - lblSeparation->setAlignment(gcn::Graphics::RIGHT); - sldSeparation = new gcn::Slider(0, 10); - sldSeparation->setSize(160, SLIDER_HEIGHT); - sldSeparation->setBaseColor(gui_baseCol); - sldSeparation->setMarkerLength(20); - sldSeparation->setStepLength(1); - sldSeparation->setId("sldSeparation"); - sldSeparation->addActionListener(soundActionListener); - lblSeparationInfo = new gcn::Label("100%"); - - lblStereoDelay = new gcn::Label("Stereo delay:"); - lblStereoDelay->setSize(130, LABEL_HEIGHT); - lblStereoDelay->setAlignment(gcn::Graphics::RIGHT); - sldStereoDelay = new gcn::Slider(0, 10); - sldStereoDelay->setSize(160, SLIDER_HEIGHT); - sldStereoDelay->setBaseColor(gui_baseCol); - sldStereoDelay->setMarkerLength(20); - sldStereoDelay->setStepLength(1); - sldStereoDelay->setId("sldStereoDelay"); - sldStereoDelay->addActionListener(soundActionListener); - lblStereoDelayInfo = new gcn::Label("10"); - - int posY = DISTANCE_BORDER; - category.panel->add(grpSound, DISTANCE_BORDER, posY); - category.panel->add(grpMode, grpSound->getX() + grpSound->getWidth() + DISTANCE_NEXT_X, posY); - posY += grpSound->getHeight() + DISTANCE_NEXT_Y; - category.panel->add(lblFrequency, DISTANCE_BORDER, posY); - category.panel->add(cboFrequency, lblFrequency->getX() + lblFrequency->getWidth() + 12, posY); - posY += cboFrequency->getHeight() + DISTANCE_NEXT_Y; - category.panel->add(lblInterpolation, DISTANCE_BORDER, posY); - category.panel->add(cboInterpolation, lblInterpolation->getX() + lblInterpolation->getWidth() + 12, posY); - posY += cboInterpolation->getHeight() + DISTANCE_NEXT_Y; - category.panel->add(lblFilter, DISTANCE_BORDER, posY); - category.panel->add(cboFilter, lblFilter->getX() + lblFilter->getWidth() + 12, posY); - posY += cboFilter->getHeight() + DISTANCE_NEXT_Y; - category.panel->add(lblSeparation, DISTANCE_BORDER, posY); - category.panel->add(sldSeparation, lblSeparation->getX() + lblSeparation->getWidth() + 12, posY); - category.panel->add(lblSeparationInfo, sldSeparation->getX() + sldSeparation->getWidth() + 12, posY); - posY += SLIDER_HEIGHT + DISTANCE_NEXT_Y; - category.panel->add(lblStereoDelay, DISTANCE_BORDER, posY); - category.panel->add(sldStereoDelay, lblStereoDelay->getX() + lblStereoDelay->getWidth() + 12, posY); - category.panel->add(lblStereoDelayInfo, sldStereoDelay->getX() + sldStereoDelay->getWidth() + 12, posY); - posY += SLIDER_HEIGHT + DISTANCE_NEXT_Y; - - RefreshPanelSound(); -} - - -void ExitPanelSound(void) -{ - delete optSoundDisabled; - delete optSoundDisabledEmu; - delete optSoundEmulated; - delete optSoundEmulatedBest; - delete grpSound; - delete optMono; - delete optStereo; - delete grpMode; - delete lblFrequency; - delete cboFrequency; - delete lblInterpolation; - delete cboInterpolation; - delete lblFilter; - delete cboFilter; - delete lblSeparation; - delete sldSeparation; - delete lblSeparationInfo; - delete lblStereoDelay; - delete sldStereoDelay; - delete lblStereoDelayInfo; - delete soundActionListener; -} - - -void RefreshPanelSound(void) -{ - char tmp[10]; - int i; - - switch(changed_prefs.produce_sound) - { - case 0: - optSoundDisabled->setSelected(true); - break; - case 1: - optSoundDisabledEmu->setSelected(true); - break; - case 2: - optSoundEmulated->setSelected(true); - break; - case 3: - optSoundEmulatedBest->setSelected(true); - break; - } - - if (changed_prefs.sound_stereo == 0) - optMono->setSelected(true); - else if (changed_prefs.sound_stereo == 1) - optStereo->setSelected(true); - - switch(changed_prefs.sound_freq) - { - case 11025: - cboFrequency->setSelected(0); - break; - case 22050: - cboFrequency->setSelected(1); - break; - case 32000: - cboFrequency->setSelected(2); - break; - default: - cboFrequency->setSelected(3); - break; - } - - cboInterpolation->setSelected(changed_prefs.sound_interpol); - - i = 0; - switch (changed_prefs.sound_filter) - { - case 0: - i = 0; - break; - case 1: - i = changed_prefs.sound_filter_type ? 2 : 1; - break; - case 2: - i = changed_prefs.sound_filter_type ? 4 : 3; - break; - } - cboFilter->setSelected(i); - - if(changed_prefs.sound_stereo == 0) - { - curr_separation_idx = 0; - curr_stereodelay_idx = 0; - } - else - { - curr_separation_idx = 10 - changed_prefs.sound_stereo_separation; - curr_stereodelay_idx = changed_prefs.sound_mixed_stereo > 0 ? changed_prefs.sound_mixed_stereo : 0; - } - - sldSeparation->setValue(curr_separation_idx); - sldSeparation->setEnabled(changed_prefs.sound_stereo >= 1); - snprintf(tmp, 10, "%d%%", 100 - 10 * curr_separation_idx); - lblSeparationInfo->setCaption(tmp); - - sldStereoDelay->setValue(curr_stereodelay_idx); - sldStereoDelay->setEnabled(changed_prefs.sound_stereo >= 1); - if(curr_stereodelay_idx <= 0) - lblStereoDelayInfo->setCaption("-"); - else - { - snprintf(tmp, 10, "%d", curr_stereodelay_idx); - lblStereoDelayInfo->setCaption(tmp); - } -} diff --git a/src/osdep/gui/SelectFile.cpp b/src/osdep/gui/SelectFile.cpp deleted file mode 100644 index f1308a92..00000000 --- a/src/osdep/gui/SelectFile.cpp +++ /dev/null @@ -1,315 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "sdltruetypefont.hpp" -#include "SelectorEntry.hpp" - -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "uae.h" -#include "gui.h" -#include "gui_handling.h" - - -#define DIALOG_WIDTH 520 -#define DIALOG_HEIGHT 400 - -static bool dialogResult = false; -static bool dialogFinished = false; -static char workingDir[MAX_PATH]; -static const char **filefilter; - -static gcn::Window *wndSelectFile; -static gcn::Button* cmdOK; -static gcn::Button* cmdCancel; -static gcn::ListBox* lstFiles; -static gcn::ScrollArea* scrAreaFiles; -static gcn::TextField *txtCurrent; - - -class SelectFileListModel : public gcn::ListModel -{ - std::vector dirs; - std::vector files; - - public: - SelectFileListModel(const char * path) - { - changeDir(path); - } - - int getNumberOfElements() - { - return dirs.size() + files.size(); - } - - std::string getElementAt(int i) - { - if(i >= dirs.size() + files.size() || i < 0) - return "---"; - if(i < dirs.size()) - return dirs[i]; - return files[i - dirs.size()]; - } - - void changeDir(const char *path) - { - ReadDirectory(path, &dirs, &files); - if(dirs.size() == 0) - dirs.push_back(".."); - FilterFiles(&files, filefilter); - } - - bool isDir(int i) - { - return (i < dirs.size()); - } -}; -static SelectFileListModel *fileList; - - -class FileButtonActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - if (actionEvent.getSource() == cmdOK) - { - int selected_item; - selected_item = lstFiles->getSelected(); - if(fileList->isDir(selected_item)) - return; // Directory selected -> Ok not possible - strcat(workingDir, "/"); - strcat(workingDir, fileList->getElementAt(selected_item).c_str()); - dialogResult = true; - } - dialogFinished = true; - } -}; -static FileButtonActionListener* fileButtonActionListener; - - -static void checkfoldername (char *current) -{ - char *ptr; - char actualpath [MAX_PATH]; - DIR *dir; - - if (dir = opendir(current)) - { - fileList->changeDir(current); - ptr = realpath(current, actualpath); - strcpy(workingDir, ptr); - closedir(dir); - } - else - strcpy(workingDir, start_path_data); - txtCurrent->setText(workingDir); -} - -static void checkfilename(char *current) -{ - char actfile[MAX_PATH]; - extractFileName(current, actfile); - for(int i=0; igetNumberOfElements(); ++i) - { - if(!fileList->isDir(i) && !strcasecmp(fileList->getElementAt(i).c_str(), actfile)) - { - lstFiles->setSelected(i); - break; - } - } -} - - -class SelectFileActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - int selected_item; - char foldername[256] = ""; - - selected_item = lstFiles->getSelected(); - strcpy(foldername, workingDir); - strcat(foldername, "/"); - strcat(foldername, fileList->getElementAt(selected_item).c_str()); - if(fileList->isDir(selected_item)) - checkfoldername(foldername); - else - { - strncpy(workingDir, foldername, sizeof(workingDir)); - dialogResult = true; - dialogFinished = true; - } - } -}; -static SelectFileActionListener* selectFileActionListener; - - -static void InitSelectFile(const char *title) -{ - wndSelectFile = new gcn::Window("Load"); - wndSelectFile->setSize(DIALOG_WIDTH, DIALOG_HEIGHT); - wndSelectFile->setPosition((GUI_WIDTH - DIALOG_WIDTH) / 2, (GUI_HEIGHT - DIALOG_HEIGHT) / 2); - wndSelectFile->setBaseColor(gui_baseCol + 0x202020); - wndSelectFile->setCaption(title); - wndSelectFile->setTitleBarHeight(TITLEBAR_HEIGHT); - - fileButtonActionListener = new FileButtonActionListener(); - - cmdOK = new gcn::Button("Ok"); - cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - 2 * BUTTON_WIDTH - DISTANCE_NEXT_X, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10); - cmdOK->setBaseColor(gui_baseCol + 0x202020); - cmdOK->addActionListener(fileButtonActionListener); - - cmdCancel = new gcn::Button("Cancel"); - cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10); - cmdCancel->setBaseColor(gui_baseCol + 0x202020); - cmdCancel->addActionListener(fileButtonActionListener); - - txtCurrent = new gcn::TextField(); - txtCurrent->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, TEXTFIELD_HEIGHT); - txtCurrent->setPosition(DISTANCE_BORDER, 10); - txtCurrent->setEnabled(false); - - selectFileActionListener = new SelectFileActionListener(); - fileList = new SelectFileListModel("."); - - lstFiles = new gcn::ListBox(fileList); - lstFiles->setSize(800, 252); - lstFiles->setBaseColor(gui_baseCol); - lstFiles->setWrappingEnabled(true); - lstFiles->addActionListener(selectFileActionListener); - - scrAreaFiles = new gcn::ScrollArea(lstFiles); - scrAreaFiles->setFrameSize(1); - scrAreaFiles->setPosition(DISTANCE_BORDER, 10 + TEXTFIELD_HEIGHT + 10); - scrAreaFiles->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, 272); - scrAreaFiles->setScrollbarWidth(20); - scrAreaFiles->setBaseColor(gui_baseCol + 0x202020); - - wndSelectFile->add(cmdOK); - wndSelectFile->add(cmdCancel); - wndSelectFile->add(txtCurrent); - wndSelectFile->add(scrAreaFiles); - - gui_top->add(wndSelectFile); - - lstFiles->requestFocus(); - lstFiles->setSelected(0); - wndSelectFile->requestModalFocus(); -} - - -static void ExitSelectFile(void) -{ - wndSelectFile->releaseModalFocus(); - gui_top->remove(wndSelectFile); - - delete cmdOK; - delete cmdCancel; - delete fileButtonActionListener; - - delete txtCurrent; - delete lstFiles; - delete scrAreaFiles; - delete selectFileActionListener; - delete fileList; - - delete wndSelectFile; -} - - -static void SelectFileLoop(void) -{ - while(!dialogFinished) - { - SDL_Event event; - while(SDL_PollEvent(&event)) - { - if (event.type == SDL_KEYDOWN) - { - switch(event.key.keysym.sym) - { - case SDLK_ESCAPE: - dialogFinished = true; - break; - - case SDLK_LEFT: - { - gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler(); - gcn::Widget* activeWidget = focusHdl->getFocused(); - if(activeWidget == lstFiles) - cmdCancel->requestFocus(); - else if(activeWidget == cmdCancel) - cmdOK->requestFocus(); - else if(activeWidget == cmdOK) - lstFiles->requestFocus(); - continue; - } - break; - - case SDLK_RIGHT: - { - gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler(); - gcn::Widget* activeWidget = focusHdl->getFocused(); - if(activeWidget == lstFiles) - cmdOK->requestFocus(); - else if(activeWidget == cmdCancel) - lstFiles->requestFocus(); - else if(activeWidget == cmdOK) - cmdCancel->requestFocus(); - continue; - } - break; - - case SDLK_PAGEDOWN: - case SDLK_HOME: - event.key.keysym.sym = SDLK_RETURN; - gui_input->pushInput(event); // Fire key down - event.type = SDL_KEYUP; // and the key up - break; - } - } - - //------------------------------------------------- - // Send event to guichan-controls - //------------------------------------------------- - gui_input->pushInput(event); - } - - // Now we let the Gui object perform its logic. - uae_gui->logic(); - // Now we let the Gui object draw itself. - uae_gui->draw(); - // Finally we update the screen. - SDL_Flip(gui_screen); - } -} - - -bool SelectFile(const char *title, char *value, const char *filter[]) -{ - dialogResult = false; - dialogFinished = false; - filefilter = filter; - - InitSelectFile(title); - extractPath(value, workingDir); - checkfoldername(workingDir); - checkfilename(value); - - SelectFileLoop(); - ExitSelectFile(); - - if(dialogResult) - strncpy(value, workingDir, MAX_PATH); - return dialogResult; -} diff --git a/src/osdep/gui/SelectFolder.cpp b/src/osdep/gui/SelectFolder.cpp deleted file mode 100644 index 6fbe3212..00000000 --- a/src/osdep/gui/SelectFolder.cpp +++ /dev/null @@ -1,273 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "sdltruetypefont.hpp" -#include "SelectorEntry.hpp" - -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "uae.h" -#include "gui_handling.h" - - -#define DIALOG_WIDTH 520 -#define DIALOG_HEIGHT 400 - -static bool dialogResult = false; -static bool dialogFinished = false; -static char workingDir[MAX_PATH]; - -static gcn::Window *wndSelectFolder; -static gcn::Button* cmdOK; -static gcn::Button* cmdCancel; -static gcn::ListBox* lstFolders; -static gcn::ScrollArea* scrAreaFolders; -static gcn::TextField *txtCurrent; - - -class ButtonActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - if (actionEvent.getSource() == cmdOK) - { - dialogResult = true; - } - dialogFinished = true; - } -}; -static ButtonActionListener* buttonActionListener; - - -class DirListModel : public gcn::ListModel -{ - std::vector dirs; - - public: - DirListModel(const char * path) - { - changeDir(path); - } - - int getNumberOfElements() - { - return dirs.size(); - } - - std::string getElementAt(int i) - { - if(i >= dirs.size() || i < 0) - return "---"; - return dirs[i]; - } - - void changeDir(const char *path) - { - ReadDirectory(path, &dirs, NULL); - if(dirs.size() == 0) - dirs.push_back(".."); - } -}; -static DirListModel dirList("."); - - -static void checkfoldername (char *current) -{ - char *ptr; - char actualpath [PATH_MAX]; - DIR *dir; - - if (dir = opendir(current)) - { - dirList = current; - ptr = realpath(current, actualpath); - strcpy(workingDir, ptr); - closedir(dir); - } - else - strcpy(workingDir, start_path_data); - txtCurrent->setText(workingDir); -} - - -class ListBoxActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - int selected_item; - char foldername[256] = ""; - - selected_item = lstFolders->getSelected(); - strcpy(foldername, workingDir); - strcat(foldername, "/"); - strcat(foldername, dirList.getElementAt(selected_item).c_str()); - checkfoldername(foldername); - } -}; -static ListBoxActionListener* listBoxActionListener; - - -static void InitSelectFolder(const char *title) -{ - wndSelectFolder = new gcn::Window("Load"); - wndSelectFolder->setSize(DIALOG_WIDTH, DIALOG_HEIGHT); - wndSelectFolder->setPosition((GUI_WIDTH - DIALOG_WIDTH) / 2, (GUI_HEIGHT - DIALOG_HEIGHT) / 2); - wndSelectFolder->setBaseColor(gui_baseCol + 0x202020); - wndSelectFolder->setCaption(title); - wndSelectFolder->setTitleBarHeight(TITLEBAR_HEIGHT); - - buttonActionListener = new ButtonActionListener(); - - cmdOK = new gcn::Button("Ok"); - cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - 2 * BUTTON_WIDTH - DISTANCE_NEXT_X, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10); - cmdOK->setBaseColor(gui_baseCol + 0x202020); - cmdOK->addActionListener(buttonActionListener); - - cmdCancel = new gcn::Button("Cancel"); - cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10); - cmdCancel->setBaseColor(gui_baseCol + 0x202020); - cmdCancel->addActionListener(buttonActionListener); - - txtCurrent = new gcn::TextField(); - txtCurrent->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, TEXTFIELD_HEIGHT); - txtCurrent->setPosition(DISTANCE_BORDER, 10); - txtCurrent->setEnabled(false); - - listBoxActionListener = new ListBoxActionListener(); - - lstFolders = new gcn::ListBox(&dirList); - lstFolders->setSize(800, 252); - lstFolders->setBaseColor(gui_baseCol); - lstFolders->setWrappingEnabled(true); - lstFolders->addActionListener(listBoxActionListener); - - scrAreaFolders = new gcn::ScrollArea(lstFolders); - scrAreaFolders->setFrameSize(1); - scrAreaFolders->setPosition(DISTANCE_BORDER, 10 + TEXTFIELD_HEIGHT + 10); - scrAreaFolders->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER - 4, 272); - scrAreaFolders->setScrollbarWidth(20); - scrAreaFolders->setBaseColor(gui_baseCol + 0x202020); - - wndSelectFolder->add(cmdOK); - wndSelectFolder->add(cmdCancel); - wndSelectFolder->add(txtCurrent); - wndSelectFolder->add(scrAreaFolders); - - gui_top->add(wndSelectFolder); - - lstFolders->requestFocus(); - lstFolders->setSelected(0); - wndSelectFolder->requestModalFocus(); -} - - -static void ExitSelectFolder(void) -{ - wndSelectFolder->releaseModalFocus(); - gui_top->remove(wndSelectFolder); - - delete cmdOK; - delete cmdCancel; - delete buttonActionListener; - - delete txtCurrent; - delete lstFolders; - delete scrAreaFolders; - delete listBoxActionListener; - - delete wndSelectFolder; -} - - -static void SelectFolderLoop(void) -{ - while(!dialogFinished) - { - SDL_Event event; - while(SDL_PollEvent(&event)) - { - if (event.type == SDL_KEYDOWN) - { - switch(event.key.keysym.sym) - { - case SDLK_ESCAPE: - dialogFinished = true; - break; - - case SDLK_LEFT: - { - gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler(); - gcn::Widget* activeWidget = focusHdl->getFocused(); - if(activeWidget == lstFolders) - cmdCancel->requestFocus(); - else if(activeWidget == cmdCancel) - cmdOK->requestFocus(); - else if(activeWidget == cmdOK) - lstFolders->requestFocus(); - continue; - } - break; - - case SDLK_RIGHT: - { - gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler(); - gcn::Widget* activeWidget = focusHdl->getFocused(); - if(activeWidget == lstFolders) - cmdOK->requestFocus(); - else if(activeWidget == cmdCancel) - lstFolders->requestFocus(); - else if(activeWidget == cmdOK) - cmdCancel->requestFocus(); - continue; - } - break; - - case SDLK_PAGEDOWN: - case SDLK_HOME: - event.key.keysym.sym = SDLK_RETURN; - gui_input->pushInput(event); // Fire key down - event.type = SDL_KEYUP; // and the key up - break; - } - } - - //------------------------------------------------- - // Send event to guichan-controls - //------------------------------------------------- - gui_input->pushInput(event); - } - - // Now we let the Gui object perform its logic. - uae_gui->logic(); - // Now we let the Gui object draw itself. - uae_gui->draw(); - // Finally we update the screen. - SDL_Flip(gui_screen); - } -} - - -bool SelectFolder(const char *title, char *value) -{ - dialogResult = false; - dialogFinished = false; - InitSelectFolder(title); - checkfoldername(value); - SelectFolderLoop(); - ExitSelectFolder(); - if(dialogResult) - { - strncpy(value, workingDir, MAX_PATH); - if(value[strlen(value) - 1] != '/') - strcat(value, "/"); - } - return dialogResult; -} diff --git a/src/osdep/gui/SelectorEntry.cpp b/src/osdep/gui/SelectorEntry.cpp deleted file mode 100644 index 967f8e61..00000000 --- a/src/osdep/gui/SelectorEntry.cpp +++ /dev/null @@ -1,94 +0,0 @@ -#include "osdep/gui/SelectorEntry.hpp" - -#include "guichan/widgets/container.hpp" -#include "guichan/widgets/icon.hpp" -#include "guichan/widgets/label.hpp" - - -namespace gcn -{ - SelectorEntry::SelectorEntry(const std::string& caption, const std::string& imagepath) - { - addWidgetListener(this); - - active = false; - - container = new gcn::Container(); - container->setOpaque(true); - - label = new gcn::Label(caption); - label->setHeight(16); - - gcn::Image *img = gcn::Image::load(imagepath); - icon = new gcn::Icon(img); - icon->setSize(16, 16); - - container->add(icon, 4, 4); - container->add(label, 24, 4); - - setFocusable(true); - - setId(caption); - } - - - SelectorEntry::~SelectorEntry() - { - removeWidgetListener(this); - delete container; - delete label; - delete icon; - } - - - void SelectorEntry::draw(Graphics* graphics) - { - container->draw(graphics); - if(isFocused()) - graphics->drawRectangle(Rectangle(2, 2, getWidth() - 4, getHeight() - 4)); - } - - - void SelectorEntry::setInactiveColor(const Color& color) - { - inactiveColor = color; - if(!active) - container->setBaseColor(color); - } - - - void SelectorEntry::setActiveColor(const Color& color) - { - activeColor = color; - if(active) - container->setBaseColor(color); - } - - - void SelectorEntry::setActive(bool active) - { - this->active = active; - if(active) - container->setBaseColor(activeColor); - else - container->setBaseColor(inactiveColor); - } - - - bool SelectorEntry::getActive(void) - { - return active; - } - - - void SelectorEntry::widgetResized(const Event& event) - { - if(container->getWidth() != getWidth()) - container->setWidth(getWidth()); - if(container->getHeight() != getHeight()) - container->setHeight(getHeight()); - - if(label->getWidth() != getWidth() - label->getX() - 4) - label->setWidth(getWidth() - label->getX() - 4); - } -} diff --git a/src/osdep/gui/SelectorEntry.hpp b/src/osdep/gui/SelectorEntry.hpp deleted file mode 100644 index 6fe743e2..00000000 --- a/src/osdep/gui/SelectorEntry.hpp +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef GCN_SELECTORENTRY_HPP -#define GCN_SELECTORENTRY_HPP - -#include - -#include "guichan/basiccontainer.hpp" -#include "guichan/graphics.hpp" -#include "guichan/platform.hpp" -#include "guichan/widgetlistener.hpp" - - -namespace gcn -{ - class Container; - class Icon; - class Label; - class Color; - class WidgetListener; - - - class GCN_CORE_DECLSPEC SelectorEntry : - public Widget, - public WidgetListener - { - public: - SelectorEntry(const std::string& caption, const std::string& imagepath); - - virtual ~SelectorEntry(); - - virtual void draw(Graphics* graphics); - - void setInactiveColor(const Color& color); - void setActiveColor(const Color& color); - void setActive(bool active); - bool getActive(void); - - virtual void widgetResized(const Event& event); - - protected: - Container *container; - Icon *icon; - Label *label; - - Color inactiveColor; - Color activeColor; - - bool active; - }; -} - -#endif // end GCN_SELECTORENTRY_HPP diff --git a/src/osdep/gui/ShowMessage.cpp b/src/osdep/gui/ShowMessage.cpp deleted file mode 100644 index e7e7e678..00000000 --- a/src/osdep/gui/ShowMessage.cpp +++ /dev/null @@ -1,172 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "sdltruetypefont.hpp" -#include "SelectorEntry.hpp" - -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "gui.h" -#include "gui_handling.h" - - -#define DIALOG_WIDTH 340 -#define DIALOG_HEIGHT 140 - -static bool dialogResult = false; -static bool dialogFinished = false; - -static gcn::Window *wndShowMessage; -static gcn::Button* cmdOK; -static gcn::Button* cmdCancel; -static gcn::Label* lblText1; -static gcn::Label* lblText2; - - -class ShowMessageActionListener : public gcn::ActionListener -{ - public: - void action(const gcn::ActionEvent& actionEvent) - { - if (actionEvent.getSource() == cmdOK) - dialogResult = true; - dialogFinished = true; - } -}; -static ShowMessageActionListener* showMessageActionListener; - - -static void InitShowMessage(void) -{ - wndShowMessage = new gcn::Window("Message"); - wndShowMessage->setSize(DIALOG_WIDTH, DIALOG_HEIGHT); - wndShowMessage->setPosition((GUI_WIDTH - DIALOG_WIDTH) / 2, (GUI_HEIGHT - DIALOG_HEIGHT) / 2); - wndShowMessage->setBaseColor(gui_baseCol + 0x202020); - wndShowMessage->setTitleBarHeight(TITLEBAR_HEIGHT); - - showMessageActionListener = new ShowMessageActionListener(); - - lblText1 = new gcn::Label(""); - lblText1->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER, LABEL_HEIGHT); - lblText2 = new gcn::Label(""); - lblText2->setSize(DIALOG_WIDTH - 2 * DISTANCE_BORDER, LABEL_HEIGHT); - - cmdOK = new gcn::Button("Ok"); - cmdOK->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdOK->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - 2 * BUTTON_WIDTH - DISTANCE_NEXT_X, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10); - cmdOK->setBaseColor(gui_baseCol + 0x202020); - cmdOK->addActionListener(showMessageActionListener); - - cmdCancel = new gcn::Button("Cancel"); - cmdCancel->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdCancel->setPosition(DIALOG_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, DIALOG_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - 10); - cmdCancel->setBaseColor(gui_baseCol + 0x202020); - cmdCancel->addActionListener(showMessageActionListener); - - wndShowMessage->add(lblText1, DISTANCE_BORDER, DISTANCE_BORDER); - wndShowMessage->add(lblText2, DISTANCE_BORDER, DISTANCE_BORDER + lblText1->getHeight() + 4); - wndShowMessage->add(cmdOK); - wndShowMessage->add(cmdCancel); - - gui_top->add(wndShowMessage); - - cmdOK->requestFocus(); - wndShowMessage->requestModalFocus(); -} - - -static void ExitShowMessage(void) -{ - wndShowMessage->releaseModalFocus(); - gui_top->remove(wndShowMessage); - - delete lblText1; - delete lblText2; - delete cmdOK; - delete cmdCancel; - - delete showMessageActionListener; - - delete wndShowMessage; -} - - -static void ShowMessageLoop(void) -{ - while(!dialogFinished) - { - SDL_Event event; - while(SDL_PollEvent(&event)) - { - if (event.type == SDL_KEYDOWN) - { - switch(event.key.keysym.sym) - { - case SDLK_ESCAPE: - dialogFinished = true; - break; - - case SDLK_LEFT: - case SDLK_RIGHT: - { - gcn::FocusHandler* focusHdl = gui_top->_getFocusHandler(); - gcn::Widget* activeWidget = focusHdl->getFocused(); - if(activeWidget == cmdCancel) - cmdOK->requestFocus(); - else if(activeWidget == cmdOK) - cmdCancel->requestFocus(); - continue; - } - break; - - case SDLK_PAGEDOWN: - case SDLK_HOME: - event.key.keysym.sym = SDLK_RETURN; - gui_input->pushInput(event); // Fire key down - event.type = SDL_KEYUP; // and the key up - break; - } - } - - //------------------------------------------------- - // Send event to guichan-controls - //------------------------------------------------- - gui_input->pushInput(event); - } - - // Now we let the Gui object perform its logic. - uae_gui->logic(); - // Now we let the Gui object draw itself. - uae_gui->draw(); - // Finally we update the screen. - SDL_Flip(gui_screen); - } -} - - -bool ShowMessage(const char *title, const char *line1, const char *line2, const char *button1, const char *button2) -{ - dialogResult = false; - dialogFinished = false; - - InitShowMessage(); - - wndShowMessage->setCaption(title); - lblText1->setCaption(line1); - lblText2->setCaption(line2); - cmdOK->setCaption(button1); - cmdCancel->setCaption(button2); - if(strlen(button2) == 0) - { - cmdCancel->setVisible(false); - cmdOK->setPosition(cmdCancel->getX(), cmdCancel->getY()); - } - ShowMessageLoop(); - ExitShowMessage(); - - return dialogResult; -} diff --git a/src/osdep/gui/UaeCheckBox.cpp b/src/osdep/gui/UaeCheckBox.cpp deleted file mode 100644 index 9d9e7712..00000000 --- a/src/osdep/gui/UaeCheckBox.cpp +++ /dev/null @@ -1,87 +0,0 @@ -#include "UaeCheckBox.hpp" -#include "guichan/widgets/checkbox.hpp" - -#include "guichan/font.hpp" -#include "guichan/graphics.hpp" -#include "guichan/key.hpp" -#include "guichan/mouseinput.hpp" - - -namespace gcn -{ - - UaeCheckBox::UaeCheckBox() - : CheckBox() - { - } - - UaeCheckBox::UaeCheckBox(const std::string &caption, - bool selected) - : CheckBox(caption, selected) - { - setId(caption); - } - - UaeCheckBox::~UaeCheckBox() - { - } - - void UaeCheckBox::draw(Graphics* graphics) - { - drawBox(graphics); - - graphics->setFont(getFont()); - graphics->setColor(getForegroundColor()); - - const int h = getHeight() + getHeight() / 2; - - graphics->drawText(getCaption(), h - 2, 0); - - if (isFocused()) - { - graphics->setColor(Color(0x000000)); - graphics->drawRectangle(Rectangle(0, - 0, - getWidth(), - getHeight())); - } - } - - void UaeCheckBox::drawBox(Graphics *graphics) - { - const int h = getHeight() - 2; - const int alpha = getBaseColor().a; - Color faceColor = getBaseColor(); - faceColor.a = alpha; - Color highlightColor = faceColor + 0x303030; - highlightColor.a = alpha; - Color shadowColor = faceColor - 0x303030; - shadowColor.a = alpha; - - graphics->setColor(shadowColor); - graphics->drawLine(1, 1, h, 1); - graphics->drawLine(1, 1, 1, h); - - graphics->setColor(highlightColor); - graphics->drawLine(h, 1, h, h); - graphics->drawLine(1, h, h - 1, h); - - Color backCol = getBackgroundColor(); - if(!isEnabled()) - backCol = backCol - 0x303030; - graphics->setColor(backCol); - graphics->fillRectangle(Rectangle(2, 2, h - 2, h - 2)); - - graphics->setColor(getForegroundColor()); - - if (mSelected) - { - graphics->drawLine(3, 9, 6, h - 2); - graphics->drawLine(4, 9, 7, h - 2); - - graphics->drawLine(6, h - 2, h - 3, 4); - graphics->drawLine(7, h - 2, h - 2, 4); - } - } - -} diff --git a/src/osdep/gui/UaeCheckBox.hpp b/src/osdep/gui/UaeCheckBox.hpp deleted file mode 100644 index 9c6ef0fe..00000000 --- a/src/osdep/gui/UaeCheckBox.hpp +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef GCN_UAECHECKBOX_HPP -#define GCN_UAECHECKBOX_HPP - -#include -#include - -#include "guichan/keylistener.hpp" -#include "guichan/mouselistener.hpp" -#include "guichan/platform.hpp" -#include "guichan/widget.hpp" -#include "guichan/widgets/checkbox.hpp" - - -namespace gcn -{ - class GCN_CORE_DECLSPEC UaeCheckBox : public CheckBox - { - public: - UaeCheckBox(); - - UaeCheckBox(const std::string &caption, - bool selected = false); - - virtual ~UaeCheckBox(); - - virtual void draw(Graphics* graphics); - - protected: - virtual void drawBox(Graphics *graphics); - - }; -} - - -#endif // end GCN_UAECHECKBOX_HPP diff --git a/src/osdep/gui/UaeDropDown.cpp b/src/osdep/gui/UaeDropDown.cpp deleted file mode 100644 index 612883f7..00000000 --- a/src/osdep/gui/UaeDropDown.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include "UaeDropDown.hpp" -#include "guichan/widgets/dropdown.hpp" - -#include "guichan/font.hpp" -#include "guichan/graphics.hpp" -#include "guichan/key.hpp" -#include "guichan/mouseinput.hpp" - - -namespace gcn -{ - UaeDropDown::UaeDropDown(ListModel *listModel, - ScrollArea *scrollArea, - ListBox *listBox) - : DropDown(listModel, scrollArea, listBox) - { - mScrollArea->setScrollbarWidth(20); - } - - - UaeDropDown::~UaeDropDown() - { - } - - - void UaeDropDown::keyPressed(KeyEvent& keyEvent) - { - if (keyEvent.isConsumed()) - return; - - Key key = keyEvent.getKey(); - - if ((key.getValue() == Key::ENTER || key.getValue() == Key::SPACE) - && !mDroppedDown) - { - dropDown(); - keyEvent.consume(); - } - else if (key.getValue() == Key::UP) - { - setSelected(getSelected() - 1); - keyEvent.consume(); - distributeActionEvent(); - } - else if (key.getValue() == Key::DOWN) - { - setSelected(getSelected() + 1); - keyEvent.consume(); - distributeActionEvent(); - } - } - - void UaeDropDown::clearSelected(void) - { - mListBox->setSelected(-1); - } - - bool UaeDropDown::isDroppedDown(void) - { - return mDroppedDown; - } -} diff --git a/src/osdep/gui/UaeDropDown.hpp b/src/osdep/gui/UaeDropDown.hpp deleted file mode 100644 index f4914611..00000000 --- a/src/osdep/gui/UaeDropDown.hpp +++ /dev/null @@ -1,34 +0,0 @@ -#ifndef GCN_UAEDROPDOWN_HPP -#define GCN_UAEDROPDOWN_HPP - -#include -#include - -#include "guichan/keylistener.hpp" -#include "guichan/mouselistener.hpp" -#include "guichan/platform.hpp" -#include "guichan/widget.hpp" -#include "guichan/widgets/dropdown.hpp" - - -namespace gcn -{ - class GCN_CORE_DECLSPEC UaeDropDown : public DropDown - { - public: - UaeDropDown(ListModel *listModel = NULL, - ScrollArea *scrollArea = NULL, - ListBox *listBox = NULL); - - virtual ~UaeDropDown(); - - virtual void keyPressed(KeyEvent& keyEvent); - - void clearSelected(void); - - bool isDroppedDown(void); - }; -} - - -#endif // end GCN_UAEDROPDOWN_HPP diff --git a/src/osdep/gui/UaeListBox.cpp b/src/osdep/gui/UaeListBox.cpp deleted file mode 100644 index b4f6000f..00000000 --- a/src/osdep/gui/UaeListBox.cpp +++ /dev/null @@ -1,105 +0,0 @@ -#include "UaeListBox.hpp" -#include "guichan/widgets/listbox.hpp" - -#include "guichan/basiccontainer.hpp" -#include "guichan/font.hpp" -#include "guichan/graphics.hpp" -#include "guichan/key.hpp" -#include "guichan/listmodel.hpp" -#include "guichan/mouseinput.hpp" -#include "guichan/selectionlistener.hpp" - - -namespace gcn -{ - - UaeListBox::UaeListBox() - : ListBox() - { - } - - UaeListBox::UaeListBox(ListModel *listModel) - : ListBox(listModel) - { - } - - UaeListBox::~UaeListBox() - { - } - - void UaeListBox::draw(Graphics* graphics) - { - graphics->setColor(getBackgroundColor()); - graphics->fillRectangle(Rectangle(0, 0, getWidth(), getHeight())); - - if (mListModel == NULL) - { - return; - } - - graphics->setColor(getForegroundColor()); - graphics->setFont(getFont()); - - // Check the current clip area so we don't draw unnecessary items - // that are not visible. - const ClipRectangle currentClipArea = graphics->getCurrentClipArea(); - int rowHeight = getRowHeight(); - - // Calculate the number of rows to draw by checking the clip area. - // The addition of two makes covers a partial visible row at the top - // and a partial visible row at the bottom. - int numberOfRows = currentClipArea.height / rowHeight + 2; - - if (numberOfRows > mListModel->getNumberOfElements()) - { - numberOfRows = mListModel->getNumberOfElements(); - } - - // Calculate which row to start drawing. If the list box - // has a negative y coordinate value we should check if - // we should drop rows in the begining of the list as - // they might not be visible. A negative y value is very - // common if the list box for instance resides in a scroll - // area and the user has scrolled the list box downwards. - int startRow; - if (getY() < 0) - { - startRow = -1 * (getY() / rowHeight); - } - else - { - startRow = 0; - } - - int i; - // The y coordinate where we start to draw the text is - // simply the y coordinate multiplied with the font height. - int y = rowHeight * startRow; - for (i = startRow; i < startRow + numberOfRows; ++i) - { - if (i == mSelected) - { - if(isFocused()) - graphics->setColor(getSelectionColor()); - else - graphics->setColor(0xd0d0d0); - graphics->fillRectangle(Rectangle(0, y, getWidth(), rowHeight)); - graphics->setColor(getForegroundColor()); - } - - // If the row height is greater than the font height we - // draw the text with a center vertical alignment. - if (rowHeight > getFont()->getHeight()) - { - graphics->drawText(mListModel->getElementAt(i), 1, y + rowHeight / 2 - getFont()->getHeight() / 2); - } - else - { - graphics->drawText(mListModel->getElementAt(i), 1, y); - } - - y += rowHeight; - } - } - -} diff --git a/src/osdep/gui/UaeListBox.hpp b/src/osdep/gui/UaeListBox.hpp deleted file mode 100644 index 202ea0db..00000000 --- a/src/osdep/gui/UaeListBox.hpp +++ /dev/null @@ -1,30 +0,0 @@ -#ifndef GCN_UAELISTBOX_HPP -#define GCN_UAELISTBOX_HPP - -#include - -#include "guichan/keylistener.hpp" -#include "guichan/listmodel.hpp" -#include "guichan/mouselistener.hpp" -#include "guichan/platform.hpp" -#include "guichan/widget.hpp" -#include "guichan/widgets/listbox.hpp" - - -namespace gcn -{ - class GCN_CORE_DECLSPEC UaeListBox : public ListBox - { - public: - UaeListBox(); - - UaeListBox(ListModel *listModel); - - virtual ~UaeListBox(); - - virtual void draw(Graphics* graphics); - }; -} - - -#endif // end GCN_UAELISTBOX_HPP diff --git a/src/osdep/gui/UaeRadioButton.cpp b/src/osdep/gui/UaeRadioButton.cpp deleted file mode 100644 index 0ff52542..00000000 --- a/src/osdep/gui/UaeRadioButton.cpp +++ /dev/null @@ -1,59 +0,0 @@ -#include "UaeRadioButton.hpp" -#include "guichan/widgets/radiobutton.hpp" - -#include "guichan/font.hpp" -#include "guichan/graphics.hpp" -#include "guichan/key.hpp" -#include "guichan/mouseinput.hpp" - - -namespace gcn -{ - - UaeRadioButton::UaeRadioButton() - : RadioButton() - { - } - - UaeRadioButton::UaeRadioButton(const std::string &caption, - const std::string &group, - bool selected) - : RadioButton(caption, group, selected) - { - setId(caption); - } - - UaeRadioButton::~UaeRadioButton() - { - // Remove us from the group list - setGroup(""); - } - - void UaeRadioButton::draw(Graphics* graphics) - { - graphics->pushClipArea(Rectangle(1, - 1, - getWidth() - 1, - getHeight() - 1)); - drawBox(graphics); - graphics->popClipArea(); - - - graphics->setFont(getFont()); - graphics->setColor(getForegroundColor()); - - if (isFocused()) - { - graphics->setColor(Color(0x000000)); - graphics->drawRectangle(Rectangle(0, - 0, - getWidth(), - getHeight())); - } - - int h = getHeight() + getHeight() / 2; - - graphics->drawText(getCaption(), h - 2, 0); - } - -} diff --git a/src/osdep/gui/UaeRadioButton.hpp b/src/osdep/gui/UaeRadioButton.hpp deleted file mode 100644 index 52882be6..00000000 --- a/src/osdep/gui/UaeRadioButton.hpp +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef GCN_UAERADIOBUTTON_HPP -#define GCN_UAERADIOBUTTON_HPP - -#include -#include - -#include "guichan/keylistener.hpp" -#include "guichan/mouselistener.hpp" -#include "guichan/platform.hpp" -#include "guichan/widget.hpp" -#include "guichan/widgets/radiobutton.hpp" - - -namespace gcn -{ - class GCN_CORE_DECLSPEC UaeRadioButton : public RadioButton - { - public: - UaeRadioButton(); - - UaeRadioButton(const std::string &caption, - const std::string &group, - bool selected = false); - - virtual ~UaeRadioButton(); - - virtual void draw(Graphics* graphics); - - }; -} - - -#endif // end GCN_UAERADIOBUTTON_HPP diff --git a/src/osdep/gui/gui_handling.h b/src/osdep/gui/gui_handling.h deleted file mode 100644 index c318a88d..00000000 --- a/src/osdep/gui/gui_handling.h +++ /dev/null @@ -1,109 +0,0 @@ -#ifndef _GUI_HANDLING_H -#define _GUI_HANDLING_H - -#define GUI_WIDTH 800 -#define GUI_HEIGHT 480 -#define DISTANCE_BORDER 15 -#define DISTANCE_NEXT_X 15 -#define DISTANCE_NEXT_Y 15 -#define BUTTON_WIDTH 90 -#define BUTTON_HEIGHT 30 -#define SMALL_BUTTON_WIDTH 30 -#define SMALL_BUTTON_HEIGHT 22 -#define LABEL_HEIGHT 20 -#define TEXTFIELD_HEIGHT 24 -#define DROPDOWN_HEIGHT 22 -#define SLIDER_HEIGHT 18 -#define TITLEBAR_HEIGHT 24 - -typedef struct _ConfigCategory { - const char *category; - const char *imagepath; - gcn::SelectorEntry *selector; - gcn::Container *panel; - void (*InitFunc) (const struct _ConfigCategory& category); - void (*ExitFunc) (void); - void (*RefreshFunc) (void); -} ConfigCategory; - -extern bool gui_running; -extern ConfigCategory categories[]; -extern gcn::Gui* uae_gui; -extern gcn::Container* gui_top; -extern gcn::Color gui_baseCol; -extern gcn::SDLInput* gui_input; -extern SDL_Surface* gui_screen; - -extern char currentDir[MAX_DPATH]; -extern char last_loaded_config[MAX_DPATH]; - -typedef struct { - char Name[MAX_DPATH]; - char FullPath[MAX_DPATH]; - char Description[MAX_DPATH]; -} ConfigFileInfo; -extern std::vector ConfigFilesList; - -void InitPanelPaths(const struct _ConfigCategory& category); -void ExitPanelPaths(void); -void RefreshPanelPaths(void); -void InitPanelConfig(const struct _ConfigCategory& category); -void ExitPanelConfig(void); -void RefreshPanelConfig(void); -void InitPanelCPU(const struct _ConfigCategory& category); -void ExitPanelCPU(void); -void RefreshPanelCPU(void); -void InitPanelChipset(const struct _ConfigCategory& category); -void ExitPanelChipset(void); -void RefreshPanelChipset(void); -void InitPanelROM(const struct _ConfigCategory& category); -void ExitPanelROM(void); -void RefreshPanelROM(void); -void InitPanelRAM(const struct _ConfigCategory& category); -void ExitPanelRAM(void); -void RefreshPanelRAM(void); -void InitPanelFloppy(const struct _ConfigCategory& category); -void ExitPanelFloppy(void); -void RefreshPanelFloppy(void); -void InitPanelHD(const struct _ConfigCategory& category); -void ExitPanelHD(void); -void RefreshPanelHD(void); -void InitPanelDisplay(const struct _ConfigCategory& category); -void ExitPanelDisplay(void); -void RefreshPanelDisplay(void); -void InitPanelSound(const struct _ConfigCategory& category); -void ExitPanelSound(void); -void RefreshPanelSound(void); -void InitPanelInput(const struct _ConfigCategory& category); -void ExitPanelInput(void); -void RefreshPanelInput(void); -void InitPanelMisc(const struct _ConfigCategory& category); -void ExitPanelMisc(void); -void RefreshPanelMisc(void); -void InitPanelSavestate(const struct _ConfigCategory& category); -void ExitPanelSavestate(void); -void RefreshPanelSavestate(void); - -void RefreshAllPanels(void); - -void InGameMessage(const char *msg); -bool ShowMessage(const char *title, const char *line1, const char *line2, const char *button1, const char *button2); -bool SelectFolder(const char *title, char *value); -bool SelectFile(const char *title, char *value, const char *filter[]); -bool EditFilesysVirtual(int unit_no); -bool EditFilesysHardfile(int unit_no); - -bool LoadConfigByName(const char *name); -ConfigFileInfo* SearchConfigInList(const char *name); - -extern void ReadDirectory(const char *path, std::vector *dirs, std::vector *files); -extern void FilterFiles(std::vector *files, const char *filter[]); - -enum { DIRECTION_NONE, DIRECTION_UP, DIRECTION_DOWN, DIRECTION_LEFT, DIRECTION_RIGHT }; -bool HandleNavigation(int direction); - -extern char *screenshot_filename; -extern int currentStateNum; -extern int delay_savestate_frame; - -#endif // _GUI_HANDLING_H diff --git a/src/osdep/gui/main_window.cpp b/src/osdep/gui/main_window.cpp deleted file mode 100644 index d2ecacb5..00000000 --- a/src/osdep/gui/main_window.cpp +++ /dev/null @@ -1,507 +0,0 @@ -#include -#include -#include -#include "sdltruetypefont.hpp" -#include "SelectorEntry.hpp" - -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "options.h" -#include "uae.h" -#include "gui.h" -#include "target.h" -#include "gui_handling.h" - -bool gui_running = false; -static int last_active_panel = 1; - - -ConfigCategory categories[] = { - { "Paths", "data/paths.ico", NULL, NULL, InitPanelPaths, ExitPanelPaths, RefreshPanelPaths }, - { "Configurations", "data/file.ico", NULL, NULL, InitPanelConfig, ExitPanelConfig, RefreshPanelConfig }, - { "CPU", "data/cpu.ico", NULL, NULL, InitPanelCPU, ExitPanelCPU, RefreshPanelCPU }, - { "Chipset", "data/cpu.ico", NULL, NULL, InitPanelChipset, ExitPanelChipset, RefreshPanelChipset }, - { "ROM", "data/chip.ico", NULL, NULL, InitPanelROM, ExitPanelROM, RefreshPanelROM }, - { "RAM", "data/chip.ico", NULL, NULL, InitPanelRAM, ExitPanelRAM, RefreshPanelRAM }, - { "Floppy drives", "data/35floppy.ico", NULL, NULL, InitPanelFloppy, ExitPanelFloppy, RefreshPanelFloppy }, - { "Hard drives", "data/drive.ico", NULL, NULL, InitPanelHD, ExitPanelHD, RefreshPanelHD }, - { "Display", "data/screen.ico", NULL, NULL, InitPanelDisplay, ExitPanelDisplay, RefreshPanelDisplay }, - { "Sound", "data/sound.ico", NULL, NULL, InitPanelSound, ExitPanelSound, RefreshPanelSound }, - { "Input", "data/joystick.ico", NULL, NULL, InitPanelInput, ExitPanelInput, RefreshPanelInput }, - { "Miscellaneous", "data/misc.ico", NULL, NULL, InitPanelMisc, ExitPanelMisc, RefreshPanelMisc }, - { "Savestates", "data/savestate.png", NULL, NULL, InitPanelSavestate, ExitPanelSavestate, RefreshPanelSavestate }, - { NULL, NULL, NULL, NULL, NULL, NULL, NULL } -}; -enum { PANEL_PATHS, PANEL_CONFIGURATIONS, PANEL_CPU, PANEL_CHIPSET, PANEL_ROM, PANEL_RAM, - PANEL_FLOPPY, PANEL_HD, PANEL_DISPLAY, PANEL_SOUND, PANEL_INPUT, PANEL_MISC, PANEL_SAVESTATES, - NUM_PANELS }; - - -gcn::Gui* uae_gui; -gcn::Color gui_baseCol; -gcn::Color gui_baseColLabel; -gcn::Color colSelectorInactive; -gcn::Color colSelectorActive; -gcn::Container* gui_top; -gcn::Container* selectors; -gcn::contrib::SDLTrueTypeFont* gui_font; -SDL_Surface* gui_screen; -gcn::SDLGraphics* gui_graphics; -gcn::SDLInput* gui_input; -gcn::SDLImageLoader* gui_imageLoader; - -namespace sdl -{ - void gui_init() - { - //------------------------------------------------- - // Set layer for GUI screen - //------------------------------------------------- - char tmp[20]; - snprintf(tmp, 20, "%dx%d", GUI_WIDTH, GUI_HEIGHT); - setenv("SDL_OMAP_LAYER_SIZE", tmp, 1); - snprintf(tmp, 20, "0,0,0,0"); - setenv("SDL_OMAP_BORDER_CUT", tmp, 1); - - //------------------------------------------------- - // Create new screen for GUI - //------------------------------------------------- - gui_screen = SDL_SetVideoMode(GUI_WIDTH, GUI_HEIGHT, 16, SDL_SWSURFACE); - SDL_EnableUNICODE(1); - SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); - SDL_ShowCursor(SDL_ENABLE); - - //------------------------------------------------- - // Create helpers for guichan - //------------------------------------------------- - gui_imageLoader = new gcn::SDLImageLoader(); - gcn::Image::setImageLoader(gui_imageLoader); - gui_graphics = new gcn::SDLGraphics(); - gui_graphics->setTarget(gui_screen); - gui_input = new gcn::SDLInput(); - uae_gui = new gcn::Gui(); - uae_gui->setGraphics(gui_graphics); - uae_gui->setInput(gui_input); - } - - void gui_halt() - { - delete uae_gui; - delete gui_imageLoader; - delete gui_input; - delete gui_graphics; - - SDL_FreeSurface(gui_screen); - gui_screen = NULL; - } - - void gui_run() - { - //------------------------------------------------- - // The main loop - //------------------------------------------------- - while(gui_running) - { - //------------------------------------------------- - // Check user input - //------------------------------------------------- - SDL_Event event; - while(SDL_PollEvent(&event)) - { - if (event.type == SDL_QUIT) - { - //------------------------------------------------- - // Quit entire program via SQL-Quit - //------------------------------------------------- - uae_quit(); - gui_running = false; - break; - } - - else if (event.type == SDL_KEYDOWN) - { - switch(event.key.keysym.sym) - { - case SDLK_q: - //------------------------------------------------- - // Quit entire program via Q on keyboard - //------------------------------------------------- - uae_quit(); - gui_running = false; - break; - - case SDLK_ESCAPE: - case SDLK_RCTRL: - //------------------------------------------------- - // Reset Amiga - //------------------------------------------------- - uae_reset(0); - gui_running = false; - break; - - case SDLK_LCTRL: - if(emulating) - { - //------------------------------------------------ - // Continue emulation - //------------------------------------------------ - gui_running = false; - } - else - { - //------------------------------------------------ - // First start of emulator -> reset Amiga - //------------------------------------------------ - uae_reset(0); - gui_running = false; - } - break; - - case SDLK_PAGEDOWN: - case SDLK_HOME: - //------------------------------------------------ - // Simulate press of enter when 'X' pressed - //------------------------------------------------ - event.key.keysym.sym = SDLK_RETURN; - gui_input->pushInput(event); // Fire key down - event.type = SDL_KEYUP; // and the key up - break; - - case SDLK_UP: - if(HandleNavigation(DIRECTION_UP)) - continue; // Don't change value when enter ComboBox -> don't send event to control - break; - - case SDLK_DOWN: - if(HandleNavigation(DIRECTION_DOWN)) - continue; // Don't change value when enter ComboBox -> don't send event to control - break; - - case SDLK_LEFT: - if(HandleNavigation(DIRECTION_LEFT)) - continue; // Don't change value when enter Slider -> don't send event to control - break; - - case SDLK_RIGHT: - if(HandleNavigation(DIRECTION_RIGHT)) - continue; // Don't change value when enter Slider -> don't send event to control - break; - } - } - - //------------------------------------------------- - // Send event to guichan-controls - //------------------------------------------------- - gui_input->pushInput(event); - } - - // Now we let the Gui object perform its logic. - uae_gui->logic(); - // Now we let the Gui object draw itself. - uae_gui->draw(); - // Finally we update the screen. - SDL_Flip(gui_screen); - } - } - -} - -namespace widgets -{ - // Main buttons - gcn::Button* cmdQuit; - gcn::Button* cmdReset; - gcn::Button* cmdRestart; - gcn::Button* cmdStart; - - - class MainButtonActionListener : public gcn::ActionListener - { - public: - void action(const gcn::ActionEvent& actionEvent) - { - if (actionEvent.getSource() == cmdQuit) - { - //------------------------------------------------- - // Quit entire program via click on Quit-button - //------------------------------------------------- - uae_quit(); - gui_running = false; - } - else if(actionEvent.getSource() == cmdReset) - { - //------------------------------------------------- - // Reset Amiga via click on Reset-button - //------------------------------------------------- - uae_reset(1); - gui_running = false; - } - else if(actionEvent.getSource() == cmdRestart) - { - //------------------------------------------------- - // Restart emulator - //------------------------------------------------- - char tmp[MAX_PATH]; - fetch_configurationpath (tmp, sizeof (tmp)); - if(strlen(last_loaded_config) > 0) - strcat (tmp, last_loaded_config); - else - { - strcat (tmp, OPTIONSFILENAME); - strcat (tmp, ".uae"); - } - uae_restart(0, tmp); - gui_running = false; - } - else if(actionEvent.getSource() == cmdStart) - { - if(emulating) - { - //------------------------------------------------ - // Continue emulation - //------------------------------------------------ - gui_running = false; - } - else - { - //------------------------------------------------ - // First start of emulator -> reset Amiga - //------------------------------------------------ - uae_reset(0); - gui_running = false; - } - } - } - }; - MainButtonActionListener* mainButtonActionListener; - - - class PanelFocusListener : public gcn::FocusListener - { - public: - void focusGained(const gcn::Event& event) - { - int i; - for(i=0; categories[i].category != NULL; ++i) - { - if(event.getSource() == categories[i].selector) - { - categories[i].selector->setActive(true); - categories[i].panel->setVisible(true); - last_active_panel = i; - } - else - { - categories[i].selector->setActive(false); - categories[i].panel->setVisible(false); - } - } - } - }; - PanelFocusListener* panelFocusListener; - - - void gui_init() - { - int i; - int yPos; - - //------------------------------------------------- - // Define base colors - //------------------------------------------------- - gui_baseCol.r = 192; - gui_baseCol.g = 192; - gui_baseCol.b = 208; - gui_baseColLabel.r = gui_baseCol.r; - gui_baseColLabel.g = gui_baseCol.g; - gui_baseColLabel.b = gui_baseCol.b; - gui_baseColLabel.a = 192; - colSelectorInactive.r = 255; - colSelectorInactive.g = 255; - colSelectorInactive.b = 255; - colSelectorActive.r = 192; - colSelectorActive.g = 192; - colSelectorActive.b = 255; - - //------------------------------------------------- - // Create container for main page - //------------------------------------------------- - gui_top = new gcn::Container(); - gui_top->setDimension(gcn::Rectangle(0, 0, GUI_WIDTH, GUI_HEIGHT)); - gui_top->setBaseColor(gui_baseCol); - uae_gui->setTop(gui_top); - - //------------------------------------------------- - // Initialize fonts - //------------------------------------------------- - TTF_Init(); - gui_font = new gcn::contrib::SDLTrueTypeFont("data/FreeSans.ttf", 14); - gcn::Widget::setGlobalFont(gui_font); - - //-------------------------------------------------- - // Create main buttons - //-------------------------------------------------- - mainButtonActionListener = new MainButtonActionListener(); - - cmdQuit = new gcn::Button("Quit"); - cmdQuit->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdQuit->setBaseColor(gui_baseCol); - cmdQuit->setId("Quit"); - cmdQuit->addActionListener(mainButtonActionListener); - - cmdReset = new gcn::Button("Reset"); - cmdReset->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdReset->setBaseColor(gui_baseCol); - cmdReset->setId("Reset"); - cmdReset->addActionListener(mainButtonActionListener); - - cmdRestart = new gcn::Button("Restart"); - cmdRestart->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdRestart->setBaseColor(gui_baseCol); - cmdRestart->setId("Restart"); - cmdRestart->addActionListener(mainButtonActionListener); - - cmdStart = new gcn::Button("Start"); - if(emulating) - cmdStart->setCaption("Resume"); - cmdStart->setSize(BUTTON_WIDTH, BUTTON_HEIGHT); - cmdStart->setBaseColor(gui_baseCol); - cmdStart->setId("Start"); - cmdStart->addActionListener(mainButtonActionListener); - - //-------------------------------------------------- - // Create selector entries - //-------------------------------------------------- - int workAreaHeight = GUI_HEIGHT - 2 * DISTANCE_BORDER - BUTTON_HEIGHT - DISTANCE_NEXT_Y; - selectors = new gcn::Container(); - selectors->setSize(150, workAreaHeight - 2); - selectors->setBaseColor(colSelectorInactive); - selectors->setFrameSize(1); - int panelStartX = DISTANCE_BORDER + selectors->getWidth() + 2 + 11; - - panelFocusListener = new PanelFocusListener(); - for(i=0; categories[i].category != NULL; ++i) - { - categories[i].selector = new gcn::SelectorEntry(categories[i].category, categories[i].imagepath); - categories[i].selector->setActiveColor(colSelectorActive); - categories[i].selector->setInactiveColor(colSelectorInactive); - categories[i].selector->setSize(150, 24); - categories[i].selector->addFocusListener(panelFocusListener); - - categories[i].panel = new gcn::Container(); - categories[i].panel->setId(categories[i].category); - categories[i].panel->setSize(GUI_WIDTH - panelStartX - DISTANCE_BORDER - 1, workAreaHeight - 2); - categories[i].panel->setBaseColor(gui_baseCol); - categories[i].panel->setFrameSize(1); - categories[i].panel->setVisible(false); - } - - //-------------------------------------------------- - // Initialize panels - //-------------------------------------------------- - for(i=0; categories[i].category != NULL; ++i) - { - if(categories[i].InitFunc != NULL) - (*categories[i].InitFunc) (categories[i]); - } - - //-------------------------------------------------- - // Place everything on main form - //-------------------------------------------------- - gui_top->add(cmdReset, DISTANCE_BORDER, GUI_HEIGHT - DISTANCE_BORDER - BUTTON_HEIGHT); - gui_top->add(cmdQuit, DISTANCE_BORDER + BUTTON_WIDTH + DISTANCE_NEXT_X, GUI_HEIGHT - DISTANCE_BORDER - BUTTON_HEIGHT); -// gui_top->add(cmdRestart, DISTANCE_BORDER + 2 * BUTTON_WIDTH + 2 * DISTANCE_NEXT_X, GUI_HEIGHT - DISTANCE_BORDER - BUTTON_HEIGHT); - gui_top->add(cmdStart, GUI_WIDTH - DISTANCE_BORDER - BUTTON_WIDTH, GUI_HEIGHT - DISTANCE_BORDER - BUTTON_HEIGHT); - - gui_top->add(selectors, DISTANCE_BORDER + 1, DISTANCE_BORDER + 1); - for(i=0, yPos=0; categories[i].category != NULL; ++i, yPos += 24) - { - selectors->add(categories[i].selector, 0, yPos); - gui_top->add(categories[i].panel, panelStartX, DISTANCE_BORDER + 1); - } - - //-------------------------------------------------- - // Activate last active panel - //-------------------------------------------------- - categories[last_active_panel].selector->requestFocus(); - } - - - void gui_halt() - { - int i; - - for(i=0; categories[i].category != NULL; ++i) - { - if(categories[i].ExitFunc != NULL) - (*categories[i].ExitFunc) (); - } - - for(i=0; categories[i].category != NULL; ++i) - delete categories[i].selector; - delete panelFocusListener; - delete selectors; - - delete cmdQuit; - delete cmdReset; - delete cmdRestart; - delete cmdStart; - - delete mainButtonActionListener; - - delete gui_font; - delete gui_top; - } -} - - -void RefreshAllPanels(void) -{ - int i; - - for(i=0; categories[i].category != NULL; ++i) - { - if(categories[i].RefreshFunc != NULL) - (*categories[i].RefreshFunc) (); - } -} - - -void run_gui(void) -{ - gui_running = true; - try - { - sdl::gui_init(); - widgets::gui_init(); - sdl::gui_run(); - widgets::gui_halt(); - sdl::gui_halt(); - } - // Catch all Guichan exceptions. - catch (gcn::Exception e) - { - std::cout << e.getMessage() << std::endl; - uae_quit(); - } - // Catch all Std exceptions. - catch (std::exception e) - { - std::cout << "Std exception: " << e.what() << std::endl; - uae_quit(); - } - // Catch all unknown exceptions. - catch (...) - { - std::cout << "Unknown exception" << std::endl; - uae_quit(); - } - if(quit_program > 1 || quit_program < -1) - { - //-------------------------------------------------- - // Prepare everything for Reset of Amiga - //-------------------------------------------------- - currprefs.nr_floppies = changed_prefs.nr_floppies; - } -} diff --git a/src/osdep/gui/sdltruetypefont.cpp b/src/osdep/gui/sdltruetypefont.cpp deleted file mode 100644 index b7481bf3..00000000 --- a/src/osdep/gui/sdltruetypefont.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -/* - * For comments regarding functions please see the header file. - */ - -#include "sdltruetypefont.hpp" - -#include "guichan/exception.hpp" -#include "guichan/image.hpp" -#include "guichan/graphics.hpp" -#include "guichan/sdl/sdlgraphics.hpp" - -namespace gcn -{ - namespace contrib - { - SDLTrueTypeFont::SDLTrueTypeFont (const std::string& filename, int size) - { - mRowSpacing = 0; - mGlyphSpacing = 0; - mAntiAlias = true; - mFilename = filename; - mFont = NULL; - - mFont = TTF_OpenFont(filename.c_str(), size); - - if (mFont == NULL) - { - throw GCN_EXCEPTION("SDLTrueTypeFont::SDLTrueTypeFont. "+std::string(TTF_GetError())); - } - } - - SDLTrueTypeFont::~SDLTrueTypeFont() - { - TTF_CloseFont(mFont); - } - - int SDLTrueTypeFont::getWidth(const std::string& text) const - { - int w, h; - TTF_SizeText(mFont, text.c_str(), &w, &h); - - return w; - } - - int SDLTrueTypeFont::getHeight() const - { - return TTF_FontHeight(mFont) + mRowSpacing; - } - - void SDLTrueTypeFont::drawString(gcn::Graphics* graphics, const std::string& text, const int x, const int y) - { - if (text == "") - { - return; - } - - gcn::SDLGraphics *sdlGraphics = dynamic_cast(graphics); - - if (sdlGraphics == NULL) - { - throw GCN_EXCEPTION("SDLTrueTypeFont::drawString. Graphics object not an SDL graphics object!"); - return; - } - - // This is needed for drawing the Glyph in the middle if we have spacing - int yoffset = getRowSpacing() / 2; - - Color col = sdlGraphics->getColor(); - - SDL_Color sdlCol; - sdlCol.b = col.b; - sdlCol.r = col.r; - sdlCol.g = col.g; - - SDL_Surface *textSurface; - if (mAntiAlias) - { - textSurface = TTF_RenderText_Blended(mFont, text.c_str(), sdlCol); - } - else - { - textSurface = TTF_RenderText_Solid(mFont, text.c_str(), sdlCol); - } - - SDL_Rect dst, src; - dst.x = x; - dst.y = y + yoffset; - src.w = textSurface->w; - src.h = textSurface->h; - src.x = 0; - src.y = 0; - - sdlGraphics->drawSDLSurface(textSurface, src, dst); - SDL_FreeSurface(textSurface); - } - - void SDLTrueTypeFont::setRowSpacing(int spacing) - { - mRowSpacing = spacing; - } - - int SDLTrueTypeFont::getRowSpacing() - { - return mRowSpacing; - } - - void SDLTrueTypeFont::setGlyphSpacing(int spacing) - { - mGlyphSpacing = spacing; - } - - int SDLTrueTypeFont::getGlyphSpacing() - { - return mGlyphSpacing; - } - - void SDLTrueTypeFont::setAntiAlias(bool antiAlias) - { - mAntiAlias = antiAlias; - } - - bool SDLTrueTypeFont::isAntiAlias() - { - return mAntiAlias; - } - } -} - diff --git a/src/osdep/gui/sdltruetypefont.hpp b/src/osdep/gui/sdltruetypefont.hpp deleted file mode 100644 index 34bf8a59..00000000 --- a/src/osdep/gui/sdltruetypefont.hpp +++ /dev/null @@ -1,156 +0,0 @@ -/* _______ __ __ __ ______ __ __ _______ __ __ - * / _____/\ / /\ / /\ / /\ / ____/\ / /\ / /\ / ___ /\ / |\/ /\ - * / /\____\// / // / // / // /\___\// /_// / // /\_/ / // , |/ / / - * / / /__ / / // / // / // / / / ___ / // ___ / // /| ' / / - * / /_// /\ / /_// / // / // /_/_ / / // / // /\_/ / // / | / / - * /______/ //______/ //_/ //_____/\ /_/ //_/ //_/ //_/ //_/ /|_/ / - * \______\/ \______\/ \_\/ \_____\/ \_\/ \_\/ \_\/ \_\/ \_\/ \_\/ - * - * Copyright (c) 2004 - 2008 Olof Naessén and Per Larsson - * - * - * Per Larsson a.k.a finalman - * Olof Naessén a.k.a jansem/yakslem - * - * Visit: http://guichan.sourceforge.net - * - * License: (BSD) - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of Guichan nor the names of its contributors may - * be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED - * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF - * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef GCN_CONTRIB_SDLTRUETYPEFONT_HPP -#define GCN_CONTRIB_SDLTRUETYPEFONT_HPP - -#include -#include - -#include - -#include "guichan/font.hpp" -#include "guichan/platform.hpp" - -namespace gcn -{ - class Graphics; - namespace contrib - { - - /** - * SDL True Type Font implementation of Font. It uses the SDL_ttf library - * to display True Type Fonts with SDL. - * - * NOTE: You must initialize the SDL_ttf library before using this - * class. Also, remember to call the SDL_ttf libraries quit - * function. - * - * @author Walluce Pinkham - * @author Olof Naessén - */ - class GCN_EXTENSION_DECLSPEC SDLTrueTypeFont: public Font - { - public: - - /** - * Constructor. - * - * @param filename the filename of the True Type Font. - * @param size the size the font should be in. - */ - SDLTrueTypeFont (const std::string& filename, int size); - - /** - * Destructor. - */ - virtual ~SDLTrueTypeFont(); - - /** - * Sets the spacing between rows in pixels. Default is 0 pixels. - * The spacing can be negative. - * - * @param spacing the spacing in pixels. - */ - virtual void setRowSpacing (int spacing); - - /** - * Gets the spacing between rows in pixels. - * - * @return the spacing. - */ - virtual int getRowSpacing(); - - /** - * Sets the spacing between letters in pixels. Default is 0 pixels. - * The spacing can be negative. - * - * @param spacing the spacing in pixels. - */ - virtual void setGlyphSpacing(int spacing); - - /** - * Gets the spacing between letters in pixels. - * - * @return the spacing. - */ - virtual int getGlyphSpacing(); - - /** - * Sets the use of anti aliasing.. - * - * @param antaAlias true for use of antia aliasing. - */ - virtual void setAntiAlias(bool antiAlias); - - /** - * Checks if anti aliasing is used. - * - * @return true if anti aliasing is used. - */ - virtual bool isAntiAlias(); - - - // Inherited from Font - - virtual int getWidth(const std::string& text) const; - - virtual int getHeight() const; - - virtual void drawString(Graphics* graphics, const std::string& text, int x, int y); - - protected: - TTF_Font *mFont; - - int mHeight; - int mGlyphSpacing; - int mRowSpacing; - - std::string mFilename; - bool mAntiAlias; - }; - } -} - -#endif - diff --git a/src/osdep/inputmode.cpp b/src/osdep/inputmode.cpp deleted file mode 100644 index e51a9c1b..00000000 --- a/src/osdep/inputmode.cpp +++ /dev/null @@ -1,113 +0,0 @@ -#include -#include -#include -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "options.h" -#include "gp2x.h" -#include "inputmode.h" -#include "uae.h" -#include "target.h" - -extern SDL_Surface *prSDLScreen; - -static SDL_Surface *inputMode[3]; - - -void inputmode_init(void) -{ - int i; - char tmpchar[256]; - SDL_Surface* tmp; - - if(inputMode[0] == NULL) - { - snprintf(tmpchar, 256, "%s/data/joystick.bmp", start_path_data); - tmp = SDL_LoadBMP(tmpchar); - - if (tmp) - { - inputMode[0] = SDL_DisplayFormat(tmp); - SDL_FreeSurface(tmp); - } - } - - if(inputMode[1] == NULL) - { - snprintf(tmpchar, 256, "%s/data/mouse.bmp", start_path_data); - tmp = SDL_LoadBMP(tmpchar); - - if (tmp) - { - inputMode[1] = SDL_DisplayFormat(tmp); - SDL_FreeSurface(tmp); - } - } - - if(inputMode[2] == NULL) - { - snprintf(tmpchar, 256, "%s/data/remapping.bmp", start_path_data); - tmp = SDL_LoadBMP(tmpchar); - - if (tmp) - { - inputMode[2] = SDL_DisplayFormat(tmp); - SDL_FreeSurface(tmp); - } - } - - show_inputmode = 0; -} - - -void inputmode_redraw(void) -{ - SDL_Rect r; - SDL_Surface* surface; - - r.x=80; - r.y=prSDLScreen->h-200; - r.w=160; - r.h=160; - - if (inputMode[0] && inputMode[1] && inputMode[2]) - { - surface = inputMode[currprefs.pandora_custom_dpad]; - - SDL_BlitSurface(surface,NULL,prSDLScreen,&r); - } -} - - -void set_joyConf(void) -{ - if(changed_prefs.pandora_joyConf == 0) - { - changed_prefs.pandora_button1 = GP2X_BUTTON_X; - changed_prefs.pandora_button2 = GP2X_BUTTON_A; - changed_prefs.pandora_jump = -1; - changed_prefs.pandora_autofireButton1 = GP2X_BUTTON_B; - } - else if(changed_prefs.pandora_joyConf == 1) - { - changed_prefs.pandora_button1 = GP2X_BUTTON_B; - changed_prefs.pandora_button2 = GP2X_BUTTON_A; - changed_prefs.pandora_jump = -1; - changed_prefs.pandora_autofireButton1 = GP2X_BUTTON_X; - } - else if(changed_prefs.pandora_joyConf == 2) - { - changed_prefs.pandora_button1 = GP2X_BUTTON_Y; - changed_prefs.pandora_button2 = GP2X_BUTTON_A; - changed_prefs.pandora_jump = GP2X_BUTTON_X; - changed_prefs.pandora_autofireButton1 = GP2X_BUTTON_B; - } - else if(changed_prefs.pandora_joyConf == 3) - { - changed_prefs.pandora_button1 = GP2X_BUTTON_B; - changed_prefs.pandora_button2 = GP2X_BUTTON_A; - changed_prefs.pandora_jump = GP2X_BUTTON_X; - changed_prefs.pandora_autofireButton1 = GP2X_BUTTON_Y; - } -} diff --git a/src/osdep/inputmode.h b/src/osdep/inputmode.h deleted file mode 100644 index ad4d9ef0..00000000 --- a/src/osdep/inputmode.h +++ /dev/null @@ -1,10 +0,0 @@ - -#define SIMULATE_SHIFT 0x200 -#define SIMULATE_RELEASED_SHIFT 0x400 - -void inputmode_init(void); -void inputmode_redraw(void); - -void set_joyConf(void); - -extern int show_inputmode; diff --git a/src/osdep/joystick.cpp b/src/osdep/joystick.cpp deleted file mode 100644 index 4df34332..00000000 --- a/src/osdep/joystick.cpp +++ /dev/null @@ -1,221 +0,0 @@ - /* - * UAE - The Un*x Amiga Emulator - * - * Joystick emulation for Linux and BSD. They share too much code to - * split this file. - * - * Copyright 1997 Bernd Schmidt - * Copyright 1998 Krister Walfridsson - */ - -#include "sysconfig.h" -#include "sysdeps.h" - -#include "config.h" -#include "uae.h" -#include "options.h" -#include "memory.h" -#include "custom.h" -#include "joystick.h" -#include "SDL.h" - -#ifdef GP2X -#include "gp2x.h" -#include "xwin.h" -#if defined(PANDORA) || defined (ANDROIDSDL) -extern int dpadUp; -extern int dpadDown; -extern int dpadLeft; -extern int dpadRight; -extern int buttonA; -extern int buttonB; -extern int buttonX; -extern int buttonY; -extern int triggerL; -extern int triggerR; -#endif - -static int delay=0; -#endif - - -static int nr_joysticks; - -static SDL_Joystick *uae4all_joy0, *uae4all_joy1; - -void read_joystick(int nr, unsigned int *dir, int *button) -{ - int left = 0, right = 0, top = 0, bot = 0, upRight=0, downRight=0, upLeft=0, downLeft=0, x=0, y=0, a=0, b=0; - SDL_Joystick *joy = nr == 0 ? uae4all_joy0 : uae4all_joy1; - - *dir = 0; - *button = 0; - - nr = (~nr)&0x1; - - SDL_JoystickUpdate (); - - if (!triggerR /*R+dpad = arrow keys*/ && currprefs.pandora_custom_dpad==0) - { - // get joystick direction via dPad or joystick - if (dpadRight || SDL_JoystickGetAxis(joy, 0) > 0) right=1; - if (dpadLeft || SDL_JoystickGetAxis(joy, 0) < 0) left=1; - if (dpadUp || SDL_JoystickGetAxis(joy, 1) < 0) top=1; - if (dpadDown || SDL_JoystickGetAxis(joy, 1) > 0) bot=1; - if (currprefs.pandora_joyConf) - { - if ((buttonX && currprefs.pandora_jump > -1) || SDL_JoystickGetButton(joy, currprefs.pandora_jump)) - top = 1; - } - } - - if(currprefs.pandora_customControls) - { - // get joystick direction via custom keys - if((currprefs.pandora_custom_A==-5 && buttonA) || (currprefs.pandora_custom_B==-5 && buttonB) || (currprefs.pandora_custom_X==-5 && buttonX) || (currprefs.pandora_custom_Y==-5 && buttonY) || (currprefs.pandora_custom_L==-5 && triggerL) || (currprefs.pandora_custom_R==-5 && triggerR)) - top = 1; - else if(currprefs.pandora_custom_dpad == 2) - { - if((currprefs.pandora_custom_up==-5 && dpadUp) || (currprefs.pandora_custom_down==-5 && dpadDown) || (currprefs.pandora_custom_left==-5 && dpadLeft) || (currprefs.pandora_custom_right==-5 && dpadRight)) - top = 1; - } - - if((currprefs.pandora_custom_A==-6 && buttonA) || (currprefs.pandora_custom_B==-6 && buttonB) || (currprefs.pandora_custom_X==-6 && buttonX) || (currprefs.pandora_custom_Y==-6 && buttonY) || (currprefs.pandora_custom_L==-6 && triggerL) || (currprefs.pandora_custom_R==-6 && triggerR)) - bot = 1; - else if(currprefs.pandora_custom_dpad == 2) - { - if((currprefs.pandora_custom_up==-6 && dpadUp) || (currprefs.pandora_custom_down==-6 && dpadDown) || (currprefs.pandora_custom_left==-6 && dpadLeft) || (currprefs.pandora_custom_right==-6 && dpadRight)) - bot = 1; - } - - if((currprefs.pandora_custom_A==-7 && buttonA) || (currprefs.pandora_custom_B==-7 && buttonB) || (currprefs.pandora_custom_X==-7 && buttonX) || (currprefs.pandora_custom_Y==-7 && buttonY) || (currprefs.pandora_custom_L==-7 && triggerL) || (currprefs.pandora_custom_R==-7 && triggerR)) - left = 1; - else if(currprefs.pandora_custom_dpad == 2) - { - if((currprefs.pandora_custom_up==-7 && dpadUp) || (currprefs.pandora_custom_down==-7 && dpadDown) || (currprefs.pandora_custom_left==-7 && dpadLeft) || (currprefs.pandora_custom_right==-7 && dpadRight)) - left = 1; - } - - if((currprefs.pandora_custom_A==-8 && buttonA) || (currprefs.pandora_custom_B==-8 && buttonB) || (currprefs.pandora_custom_X==-8 && buttonX) || (currprefs.pandora_custom_Y==-8 && buttonY) || (currprefs.pandora_custom_L==-8 && triggerL) || (currprefs.pandora_custom_R==-8 && triggerR)) - right = 1; - else if(currprefs.pandora_custom_dpad == 2) - { - if((currprefs.pandora_custom_up==-8 && dpadUp) || (currprefs.pandora_custom_down==-8 && dpadDown) || (currprefs.pandora_custom_left==-8 && dpadLeft) || (currprefs.pandora_custom_right==-8 && dpadRight)) - right = 1; - } - } - - if(currprefs.pandora_custom_dpad == 0) // dPad as joystick - { - // Handle autofire (only available if no custom controls active) - if(!currprefs.pandora_customControls && - (((currprefs.pandora_autofireButton1==GP2X_BUTTON_B && buttonA) - || (currprefs.pandora_autofireButton1==GP2X_BUTTON_X && buttonX) - || (currprefs.pandora_autofireButton1==GP2X_BUTTON_Y && buttonY)) - && delay > currprefs.input_autofire_framecnt)) - { - if(!buttonB) - *button=1; - delay=0; - *button |= (buttonB & 1) << 1; - } - } - - if(currprefs.pandora_customControls) - { - // get joystick button via custom controls - if((currprefs.pandora_custom_A==-3 && buttonA) || (currprefs.pandora_custom_B==-3 && buttonB) || (currprefs.pandora_custom_X==-3 && buttonX) || (currprefs.pandora_custom_Y==-3 && buttonY) || (currprefs.pandora_custom_L==-3 && triggerL) || (currprefs.pandora_custom_R==-3 && triggerR)) - *button = 1; - else if(currprefs.pandora_custom_dpad == 2) - { - if((currprefs.pandora_custom_up==-3 && dpadUp) || (currprefs.pandora_custom_down==-3 && dpadDown) || (currprefs.pandora_custom_left==-3 && dpadLeft) || (currprefs.pandora_custom_right==-3 && dpadRight)) - *button = 1; - } - - if((currprefs.pandora_custom_A==-4 && buttonA) || (currprefs.pandora_custom_B==-4 && buttonB) || (currprefs.pandora_custom_X==-4 && buttonX) || (currprefs.pandora_custom_Y==-4 && buttonY) || (currprefs.pandora_custom_L==-4 && triggerL) || (currprefs.pandora_custom_R==-4 && triggerR)) - *button |= 1 << 1; - else if(currprefs.pandora_custom_dpad == 2) - { - if((currprefs.pandora_custom_up==-4 && dpadUp) || (currprefs.pandora_custom_down==-4 && dpadDown) || (currprefs.pandora_custom_left==-4 && dpadLeft) || (currprefs.pandora_custom_right==-4 && dpadRight)) - *button |= 1 << 1; - } - delay++; - } - else - { - // get joystick button via ABXY or joystick - *button = ((currprefs.pandora_button1==GP2X_BUTTON_B && buttonA) || (currprefs.pandora_button1==GP2X_BUTTON_X && buttonX) || (currprefs.pandora_button1==GP2X_BUTTON_Y && buttonY) || SDL_JoystickGetButton(joy, currprefs.pandora_button1)) & 1; - delay++; - - *button |= ((buttonB || SDL_JoystickGetButton(joy, currprefs.pandora_button2)) & 1) << 1; - } - - // normal joystick movement - if (left) - top = !top; - if (right) - bot = !bot; - *dir = bot | (right << 1) | (top << 8) | (left << 9); - - if(currprefs.pandora_joyPort != 0) - { - // Only one joystick active - if((nr == 0 && currprefs.pandora_joyPort == 2) || (nr == 1 && currprefs.pandora_joyPort == 1)) - { - *dir = 0; - *button = 0; - } - } -} - -void handle_joymouse(void) -{ - if (currprefs.pandora_custom_dpad == 1) - { - int mouseScale = currprefs.input_joymouse_multiplier / 2; - - if (buttonY) // slow mouse active - mouseScale = currprefs.input_joymouse_multiplier / 10; - - if (dpadLeft) - { - lastmx -= mouseScale; - newmousecounters=1; - } - if (dpadRight) - { - lastmx += mouseScale; - newmousecounters=1; - } - if (dpadUp) - { - lastmy -= mouseScale; - newmousecounters=1; - } - if (dpadDown) - { - lastmy += mouseScale; - newmousecounters=1; - } - } -} - -void init_joystick(void) -{ - int i; - nr_joysticks = SDL_NumJoysticks (); - if (nr_joysticks > 0) - uae4all_joy0 = SDL_JoystickOpen (0); - if (nr_joysticks > 1) - uae4all_joy1 = SDL_JoystickOpen (1); - else - uae4all_joy1 = NULL; -} - -void close_joystick(void) -{ - if (nr_joysticks > 0) - SDL_JoystickClose (uae4all_joy0); - if (nr_joysticks > 1) - SDL_JoystickClose (uae4all_joy1); -} diff --git a/src/osdep/keyboard.cpp b/src/osdep/keyboard.cpp deleted file mode 100644 index bc873ff7..00000000 --- a/src/osdep/keyboard.cpp +++ /dev/null @@ -1,207 +0,0 @@ -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "options.h" -#include "uae.h" -#include "memory.h" -#include "xwin.h" -#include "custom.h" -#include "drawing.h" -#include "keyboard.h" -#include "keybuf.h" -#include "gui.h" -#include - - -/* Decode KeySyms. This function knows about all keys that are common - * between different keyboard languages. */ -static int kc_decode (SDL_keysym *prKeySym) -{ -#ifdef PANDORA - // Special handling of Pandora keyboard: - // Some keys requires shift on Amiga, so we simulate shift... - switch (prKeySym->sym) - { - case SDLK_COLON: - return SIMULATE_SHIFT | AK_SEMICOLON; - case SDLK_QUESTION: - return SIMULATE_SHIFT | AK_SLASH; - case SDLK_HASH: - return SIMULATE_SHIFT | AK_3; - case SDLK_DOLLAR: - return SIMULATE_SHIFT | AK_4; - case SDLK_QUOTEDBL: - return SIMULATE_SHIFT | AK_QUOTE; - case SDLK_PLUS: - return SIMULATE_SHIFT | AK_EQUAL; - case SDLK_AT: - return SIMULATE_SHIFT | AK_2; - case SDLK_LEFTPAREN: - return SIMULATE_SHIFT | AK_9; - case SDLK_RIGHTPAREN: - return SIMULATE_SHIFT | AK_0; - case SDLK_EXCLAIM: - return SIMULATE_SHIFT | AK_1; - case SDLK_UNDERSCORE: - return SIMULATE_SHIFT | AK_MINUS; - case SDLK_2: - if(prKeySym->mod == KMOD_LSHIFT) - return SIMULATE_SHIFT | AK_LBRACKET; - break; - case SDLK_3: - if(prKeySym->mod == KMOD_LSHIFT) - return SIMULATE_SHIFT | AK_RBRACKET; - break; - case SDLK_4: - if(prKeySym->mod == KMOD_LSHIFT) - return SIMULATE_SHIFT | AK_BACKQUOTE; - break; - case SDLK_9: - if(prKeySym->mod == KMOD_LSHIFT) - return SIMULATE_RELEASED_SHIFT | AK_LBRACKET; - break; - case SDLK_0: - if(prKeySym->mod == KMOD_LSHIFT) - return SIMULATE_RELEASED_SHIFT | AK_RBRACKET; - break; - case 124: // code for '|' - return SIMULATE_SHIFT | AK_BACKSLASH; - } -#endif - switch (prKeySym->sym) - { - case SDLK_b: return AK_B; - case SDLK_c: return AK_C; - case SDLK_d: return AK_D; - case SDLK_e: return AK_E; - case SDLK_f: return AK_F; - case SDLK_g: return AK_G; - case SDLK_h: return AK_H; - case SDLK_i: return AK_I; - case SDLK_j: return AK_J; - case SDLK_k: return AK_K; - case SDLK_l: return AK_L; - case SDLK_n: return AK_N; - case SDLK_o: return AK_O; - case SDLK_p: return AK_P; - case SDLK_r: return AK_R; - case SDLK_s: return AK_S; - case SDLK_t: return AK_T; - case SDLK_u: return AK_U; - case SDLK_v: return AK_V; - case SDLK_x: return AK_X; - - case SDLK_0: return AK_0; - case SDLK_1: return AK_1; - case SDLK_2: return AK_2; - case SDLK_3: return AK_3; - case SDLK_4: return AK_4; - case SDLK_5: return AK_5; - case SDLK_6: return AK_6; - case SDLK_7: return AK_7; - case SDLK_8: return AK_8; - case SDLK_9: return AK_9; - - case SDLK_KP0: return AK_NP0; - case SDLK_KP1: return AK_NP1; - case SDLK_KP2: return AK_NP2; - case SDLK_KP3: return AK_NP3; - case SDLK_KP4: return AK_NP4; - case SDLK_KP5: return AK_NP5; - case SDLK_KP6: return AK_NP6; - case SDLK_KP7: return AK_NP7; - case SDLK_KP8: return AK_NP8; - case SDLK_KP9: return AK_NP9; - case SDLK_KP_DIVIDE: return AK_NPDIV; - case SDLK_KP_MULTIPLY: return AK_NPMUL; - case SDLK_KP_MINUS: return AK_NPSUB; - case SDLK_KP_PLUS: return AK_NPADD; - case SDLK_KP_PERIOD: return AK_NPDEL; - case SDLK_KP_ENTER: return AK_ENT; - - case SDLK_F1: return AK_F1; - case SDLK_F2: return AK_F2; - case SDLK_F3: return AK_F3; - case SDLK_F4: return AK_F4; - case SDLK_F5: return AK_F5; - case SDLK_F6: return AK_F6; - case SDLK_F7: return AK_F7; - case SDLK_F8: return AK_F8; - case SDLK_F9: return AK_F9; - case SDLK_F10: return AK_F10; - - case SDLK_BACKSPACE: return AK_BS; - case SDLK_DELETE: return AK_DEL; - case SDLK_LCTRL: return AK_CTRL; - case SDLK_RCTRL: return AK_RCTRL; - case SDLK_TAB: return AK_TAB; - case SDLK_LALT: return AK_LALT; - case SDLK_RALT: return AK_RALT; - case SDLK_RMETA: return AK_RAMI; - case SDLK_LMETA: return AK_LAMI; - case SDLK_RETURN: return AK_RET; - case SDLK_SPACE: return AK_SPC; - case SDLK_LSHIFT: return AK_LSH; - case SDLK_RSHIFT: return AK_RSH; - case SDLK_ESCAPE: return AK_ESC; - - case SDLK_INSERT: return AK_HELP; - case SDLK_HOME: return AK_NPLPAREN; - case SDLK_END: return AK_NPRPAREN; - case SDLK_CAPSLOCK: return AK_CAPSLOCK; - - case SDLK_UP: return AK_UP; - case SDLK_DOWN: return AK_DN; - case SDLK_LEFT: return AK_LF; - case SDLK_RIGHT: return AK_RT; - - case SDLK_PAGEUP: return AK_RAMI; /* PgUp mapped to right amiga */ - case SDLK_PAGEDOWN: return AK_LAMI; /* PgDn mapped to left amiga */ - - default: return -1; - } -} - -static int decode_us (SDL_keysym *prKeySym) -{ - switch(prKeySym->sym) - { - /* US specific */ - case SDLK_a: return AK_A; - case SDLK_m: return AK_M; - case SDLK_q: return AK_Q; - case SDLK_y: return AK_Y; - case SDLK_w: return AK_W; - case SDLK_z: return AK_Z; - case SDLK_LEFTBRACKET: return AK_LBRACKET; - case SDLK_RIGHTBRACKET: return AK_RBRACKET; - case SDLK_COMMA: return AK_COMMA; - case SDLK_PERIOD: return AK_PERIOD; - case SDLK_SLASH: return AK_SLASH; - case SDLK_SEMICOLON: return AK_SEMICOLON; - case SDLK_MINUS: return AK_MINUS; - case SDLK_EQUALS: return AK_EQUAL; - /* this doesn't work: */ - case SDLK_BACKQUOTE: return AK_QUOTE; - case SDLK_QUOTE: return AK_BACKQUOTE; - case SDLK_BACKSLASH: return AK_BACKSLASH; - default: return -1; - } -} - -int keycode2amiga(SDL_keysym *prKeySym) -{ - int iAmigaKeycode = kc_decode(prKeySym); - if (iAmigaKeycode == -1) - return decode_us(prKeySym); - return iAmigaKeycode; -} - -int getcapslockstate (void) -{ - return 0; -} - -void setcapslockstate (int state) -{ -} diff --git a/src/osdep/menu/menu_config.cpp b/src/osdep/menu/menu_config.cpp deleted file mode 100644 index 1dce3eef..00000000 --- a/src/osdep/menu/menu_config.cpp +++ /dev/null @@ -1,634 +0,0 @@ -#define _MENU_CONFIG_CPP - -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "autoconf.h" -#include "options.h" -#include "gui.h" -#include "sounddep/sound.h" -#include "custom.h" -#include "osdep/gp2x.h" -#include "cfgfile.h" -#include "uae.h" -#include "disk.h" -#include "../inputmode.h" - -static int kickstart; - -static int presetModeId = 2; - -int saveMenu_n_savestate = 0; - - -static void SetPresetMode(int mode, struct uae_prefs *p) -{ - presetModeId = mode; - - switch(mode) - { - case 0: - p->gfx_size.height = 200; - p->gfx_size_fs.width = 768; - break; - - case 1: - p->gfx_size.height = 216; - p->gfx_size_fs.width = 716; - break; - - case 2: - p->gfx_size.height = 240; - p->gfx_size_fs.width = 640; - break; - - case 3: - p->gfx_size.height = 256; - p->gfx_size_fs.width = 600; - break; - - case 4: - p->gfx_size.height = 262; - p->gfx_size_fs.width = 588; - break; - - case 5: - p->gfx_size.height = 270; - p->gfx_size_fs.width = 570; - break; - - case 6: - p->gfx_size.height = 200; - p->gfx_size_fs.width = 640; - break; - - case 7: - p->gfx_size.height = 200; - p->gfx_size_fs.width = 800; - break; - - case 10: - p->gfx_size.height = 200; - p->gfx_size_fs.width = 768; - break; - - case 11: - p->gfx_size.height = 216; - p->gfx_size_fs.width = 716; - break; - - case 12: - p->gfx_size.height = 240; - p->gfx_size_fs.width = 640; - break; - - case 13: - p->gfx_size.height = 256; - p->gfx_size_fs.width = 600; - break; - - case 14: - p->gfx_size.height = 262; - p->gfx_size_fs.width = 588; - break; - - case 15: - p->gfx_size.height = 270; - p->gfx_size_fs.width = 570; - break; - - case 16: - p->gfx_size.height = 200; - p->gfx_size_fs.width = 640; - break; - - case 17: - p->gfx_size.height = 200; - p->gfx_size_fs.width = 800; - break; - - case 20: - p->gfx_size.height = 200; - p->gfx_size_fs.width = 800; - break; - - case 21: - p->gfx_size.height = 216; - p->gfx_size_fs.width = 784; - break; - - case 22: - p->gfx_size.height = 240; - p->gfx_size_fs.width = 704; - break; - - case 23: - p->gfx_size.height = 256; - p->gfx_size_fs.width = 660; - break; - - case 24: - p->gfx_size.height = 262; - p->gfx_size_fs.width = 640; - break; - - case 25: - p->gfx_size.height = 270; - p->gfx_size_fs.width = 624; - break; - - case 26: - p->gfx_size.height = 200; - p->gfx_size_fs.width = 704; - break; - - case 27: - p->gfx_size.height = 200; - p->gfx_size_fs.width = 800; - break; - - case 30: - p->gfx_size.height = 200; - p->gfx_size_fs.width = 800; - break; - - case 31: - p->gfx_size.height = 216; - p->gfx_size_fs.width = 784; - break; - - case 32: - p->gfx_size.height = 240; - p->gfx_size_fs.width = 704; - break; - - case 33: - p->gfx_size.height = 256; - p->gfx_size_fs.width = 660; - break; - - case 34: - p->gfx_size.height = 262; - p->gfx_size_fs.width = 640; - break; - - case 35: - p->gfx_size.height = 270; - p->gfx_size_fs.width = 624; - break; - - case 36: - p->gfx_size.height = 200; - p->gfx_size_fs.width = 704; - break; - - case 37: - p->gfx_size.height = 200; - p->gfx_size_fs.width = 800; - break; - - case 40: - p->gfx_size.height = 200; - p->gfx_size_fs.width = 800; - break; - - case 41: - p->gfx_size.height = 216; - p->gfx_size_fs.width = 800; - break; - - case 42: - p->gfx_size.height = 240; - p->gfx_size_fs.width = 768; - break; - - case 43: - p->gfx_size.height = 256; - p->gfx_size_fs.width = 720; - break; - - case 44: - p->gfx_size.height = 262; - p->gfx_size_fs.width = 704; - break; - - case 45: - p->gfx_size.height = 270; - p->gfx_size_fs.width = 684; - break; - - case 46: - p->gfx_size.height = 200; - p->gfx_size_fs.width = 800; - break; - - case 47: - p->gfx_size.height = 200; - p->gfx_size_fs.width = 800; - break; - - case 50: - p->gfx_size.height = 200; - p->gfx_size_fs.width = 800; - break; - - case 51: - p->gfx_size.height = 216; - p->gfx_size_fs.width = 800; - break; - - case 52: - p->gfx_size.height = 240; - p->gfx_size_fs.width = 768; - break; - - case 53: - p->gfx_size.height = 256; - p->gfx_size_fs.width = 720; - break; - - case 54: - p->gfx_size.height = 262; - p->gfx_size_fs.width = 704; - break; - - case 55: - p->gfx_size.height = 270; - p->gfx_size_fs.width = 684; - break; - - case 56: - p->gfx_size.height = 200; - p->gfx_size_fs.width = 800; - break; - - case 57: - p->gfx_size.height = 200; - p->gfx_size_fs.width = 800; - break; - - default: - p->gfx_size.height = 240; - p->gfx_size_fs.width = 640; - presetModeId = 2; - break; - } - - switch(presetModeId / 10) - { - case 0: - p->gfx_size.width = 320; - break; - - case 1: - p->gfx_size.width = 640; - break; - - case 2: - p->gfx_size.width = 352; - break; - - case 3: - p->gfx_size.width = 704; - break; - - case 4: - p->gfx_size.width = 384; - break; - - case 5: - p->gfx_size.width = 768; - break; - } -} - - -static void SetDefaultMenuSettings(struct uae_prefs *p) -{ - while(nr_units(p->mountinfo) > 0) - kill_filesys_unit(p->mountinfo, 0); - - kickstart = 1; - - SetPresetMode(2, p); -} - - -static void replace(char * str,char replace, char toreplace) -{ - while(*str) - { - if (*str==toreplace) *str=replace; - str++; - } -} - - -int create_configfilename(char *dest, char *basename, int fromDir) -{ - char *p; - p = basename + strlen(basename) - 1; - while (*p != '/') - p--; - p++; - if(fromDir == 0) - { - int len = strlen(p) + 1; - char filename[len]; - strcpy(filename, p); - char *pch = &filename[len]; - while (pch != filename && *pch != '.') - pch--; - if (pch) - { - *pch='\0'; - snprintf(dest, 300, "%s/conf/%s.uae", start_path_data, filename); - return 1; - } - } - else - { - snprintf(dest, 300, "%s/conf/%s.uae", start_path_data, p); - return 1; - } - - return 0; -} - - -const char *kickstarts_rom_names[] = { "kick12.rom\0", "kick13.rom\0", "kick20.rom\0", "kick31.rom\0", "aros-amiga-m68k-rom.bin\0" }; -const char *extended_rom_names[] = { "\0", "\0", "\0", "\0", "aros-amiga-m68k-ext.bin\0" }; -const char *kickstarts_names[] = { "KS ROM v1.2\0", "KS ROM v1.3\0", "KS ROM v2.05\0", "KS ROM v3.1\0", "\0" }; -#ifdef ANDROIDSDL -const char *af_kickstarts_rom_names[] = { "amiga-os-120.rom\0", "amiga-os-130.rom\0", "amiga-os-204.rom\0", "amiga-os-310-a1200.rom\0" }; -#endif - -static bool CheckKickstart(struct uae_prefs *p) -{ - char kickpath[MAX_DPATH]; - int i; - - // Search via filename - fetch_rompath(kickpath, MAX_DPATH); - strncat(kickpath, kickstarts_rom_names[kickstart], MAX_DPATH); - for(i=0; iPath, kickpath)) - { - // Found it - strncpy(p->romfile, kickpath, sizeof(p->romfile)); - return true; - } - } - - // Search via name - if(strlen(kickstarts_names[kickstart]) > 0) - { - for(i=0; iName, kickstarts_names[kickstart], strlen(kickstarts_names[kickstart]))) - { - // Found it - strncpy(p->romfile, lstAvailableROMs[i]->Path, sizeof(p->romfile)); - return true; - } - } - } - - return false; -} - - -// In this procedure, we use changed_prefs -int loadconfig_old(struct uae_prefs *p, const char *orgpath) -{ - char path[MAX_PATH]; - - strcpy(path, orgpath); - char *ptr = strstr(path, ".uae"); - if(ptr > 0) - { - *(ptr + 1) = '\0'; - strcat(path, "conf"); - } - - FILE *f=fopen(path,"rt"); - if (!f){ - write_log ("No config file %s!\n",path); - return 0; - } - else - { - // Set everthing to default and clear HD settings - default_prefs(p, 0); - SetDefaultMenuSettings(p); - - char filebuffer[256]; - int dummy; - - fscanf(f,"kickstart=%d\n",&kickstart); -#if defined(PANDORA) || defined(ANDROIDSDL) - fscanf(f,"scaling=%d\n",&dummy); -#else - fscanf(f,"scaling=%d\n",&mainMenu_enableHWscaling); -#endif - fscanf(f,"showstatus=%d\n", &p->leds_on_screen); - fscanf(f,"mousemultiplier=%d\n", &p->input_joymouse_multiplier); - p->input_joymouse_multiplier *= 10; -#if defined(PANDORA) || defined(ANDROIDSDL) - fscanf(f,"systemclock=%d\n",&dummy); // mainMenu_throttle never changes -> removed - fscanf(f,"syncthreshold=%d\n", &dummy); // timeslice_mode never changes -> removed -#else - fscanf(f,"systemclock=%d\n",&mainMenu_throttle); - fscanf(f,"syncthreshold=%d\n", ×lice_mode); -#endif - fscanf(f,"frameskip=%d\n", &p->gfx_framerate); - fscanf(f,"sound=%d\n",&p->produce_sound ); - if(p->produce_sound >= 10) - { - p->sound_stereo = 1; - p->produce_sound -= 10; - if(p->produce_sound > 0) - p->produce_sound += 1; - } - else - p->sound_stereo = 0; - fscanf(f,"soundrate=%d\n",&p->sound_freq); - fscanf(f,"autosave=%d\n", &dummy); - fscanf(f,"gp2xclock=%d\n", &dummy); - int joybuffer = 0; - fscanf(f,"joyconf=%d\n",&joybuffer); - p->pandora_joyConf = (joybuffer & 0x0f); - p->pandora_joyPort = ((joybuffer >> 4) & 0x0f); - fscanf(f,"autofireRate=%d\n",&p->input_autofire_framecnt); - fscanf(f,"autofire=%d\n", &dummy); - fscanf(f,"stylusOffset=%d\n",&p->pandora_stylusOffset); - fscanf(f,"tapDelay=%d\n",&p->pandora_tapDelay); - fscanf(f,"scanlines=%d\n", &dummy); -#if defined(PANDORA) || defined(ANDROIDSDL) - fscanf(f,"ham=%d\n",&dummy); -#else - fscanf(f,"ham=%d\n",&mainMenu_ham); -#endif - fscanf(f,"enableScreenshots=%d\n", &dummy); - fscanf(f,"floppyspeed=%d\n",&p->floppy_speed); - fscanf(f,"drives=%d\n", &p->nr_floppies); - fscanf(f,"videomode=%d\n", &p->ntscmode); - if(p->ntscmode) - p->chipset_refreshrate = 60; - else - p->chipset_refreshrate = 50; - fscanf(f,"mainMenu_cpuSpeed=%d\n",&p->pandora_cpu_speed); - fscanf(f,"presetModeId=%d\n",&presetModeId); - fscanf(f,"moveX=%d\n", &p->pandora_horizontal_offset); - fscanf(f,"moveY=%d\n", &p->pandora_vertical_offset); - fscanf(f,"displayedLines=%d\n",&p->gfx_size.height); - fscanf(f,"screenWidth=%d\n", &p->gfx_size_fs.width); - fscanf(f,"cutLeft=%d\n", &dummy); - fscanf(f,"cutRight=%d\n", &dummy); - fscanf(f,"customControls=%d\n",&p->pandora_customControls); - fscanf(f,"custom_dpad=%d\n",&p->pandora_custom_dpad); - fscanf(f,"custom_up=%d\n",&p->pandora_custom_up); - fscanf(f,"custom_down=%d\n",&p->pandora_custom_down); - fscanf(f,"custom_left=%d\n",&p->pandora_custom_left); - fscanf(f,"custom_right=%d\n",&p->pandora_custom_right); - fscanf(f,"custom_A=%d\n",&p->pandora_custom_A); - fscanf(f,"custom_B=%d\n",&p->pandora_custom_B); - fscanf(f,"custom_X=%d\n",&p->pandora_custom_X); - fscanf(f,"custom_Y=%d\n",&p->pandora_custom_Y); - fscanf(f,"custom_L=%d\n",&p->pandora_custom_L); - fscanf(f,"custom_R=%d\n",&p->pandora_custom_R); - fscanf(f,"cpu=%d\n", &p->cpu_level); - if(p->cpu_level > M68000) - // Was old format - p->cpu_level = M68020; - fscanf(f,"chipset=%d\n", &p->chipset_mask); - p->immediate_blits = (p->chipset_mask & 0x100) == 0x100; - p->pandora_partial_blits = (p->chipset_mask & 0x200) == 0x200; - switch (p->chipset_mask & 0xff) - { - case 1: p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE; break; - case 2: p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE | CSMASK_AGA; break; - default: p->chipset_mask = CSMASK_ECS_AGNUS; break; - } - fscanf(f,"cpu=%d\n", &p->m68k_speed); - if(p->m68k_speed < 0) - { - // New version of this option - p->m68k_speed = -p->m68k_speed; - } - else - { - // Old version (500 5T 1200 12T 12T2) - if(p->m68k_speed >= 2) - { - // 1200: set to 68020 with 14 MHz - p->cpu_level = M68020; - p->m68k_speed--; - if(p->m68k_speed > 2) - p->m68k_speed = 2; - } - } - if(p->m68k_speed == 1) - p->m68k_speed = M68K_SPEED_14MHZ_CYCLES; - if(p->m68k_speed == 2) - p->m68k_speed = M68K_SPEED_25MHZ_CYCLES; - p->cachesize = 0; - p->cpu_compatible = 0; - - disk_eject(0); - disk_eject(1); - disk_eject(2); - disk_eject(3); - fscanf(f,"df0=%s\n",&filebuffer); - replace(filebuffer,' ','|'); - strcpy(p->df[0], filebuffer); - disk_insert(0, filebuffer); - if(p->nr_floppies > 1) - { - memset(filebuffer, 0, 256); - fscanf(f,"df1=%s\n",&filebuffer); - replace(filebuffer,' ','|'); - strcpy(p->df[1], filebuffer); - disk_insert(1, filebuffer); - } - if(p->nr_floppies > 2) - { - memset(filebuffer, 0, 256); - fscanf(f,"df2=%s\n",&filebuffer); - replace(filebuffer,' ','|'); - strcpy(p->df[2], filebuffer); - disk_insert(2, filebuffer); - } - if(p->nr_floppies > 3) - { - memset(filebuffer, 0, 256); - fscanf(f,"df3=%s\n",&filebuffer); - replace(filebuffer,' ','|'); - strcpy(p->df[3], filebuffer); - disk_insert(3, filebuffer); - } - - for(int i=0; i<4; ++i) - { - if(i < p->nr_floppies) - p->dfxtype[i] = DRV_35_DD; - else - p->dfxtype[i] = DRV_NONE; - } - - fscanf(f,"chipmemory=%d\n",&p->chipmem_size); - if(p->chipmem_size < 10) - // Was saved in old format - p->chipmem_size = 0x80000 << p->chipmem_size; - fscanf(f,"slowmemory=%d\n",&p->bogomem_size); - if(p->bogomem_size > 0 && p->bogomem_size < 10) - // Was saved in old format - p->bogomem_size = - (p->bogomem_size <= 2) ? 0x080000 << p->bogomem_size : - (p->bogomem_size == 3) ? 0x180000 : 0x1c0000; - fscanf(f,"fastmemory=%d\n",&p->fastmem_size); - if(p->fastmem_size > 0 && p->fastmem_size < 10) - // Was saved in old format - p->fastmem_size = 0x080000 << p->fastmem_size; -#ifdef ANDROIDSDL - fscanf(f,"onscreen=%d\n",&mainMenu_onScreen); - fscanf(f,"onScreen_textinput=%d\n",&mainMenu_onScreen_textinput); - fscanf(f,"onScreen_dpad=%d\n",&mainMenu_onScreen_dpad); - fscanf(f,"onScreen_button1=%d\n",&mainMenu_onScreen_button1); - fscanf(f,"onScreen_button2=%d\n",&mainMenu_onScreen_button2); - fscanf(f,"onScreen_button3=%d\n",&mainMenu_onScreen_button3); - fscanf(f,"onScreen_button4=%d\n",&mainMenu_onScreen_button4); - fscanf(f,"onScreen_button5=%d\n",&mainMenu_onScreen_button5); - fscanf(f,"onScreen_button6=%d\n",&mainMenu_onScreen_button6); - fscanf(f,"custom_position=%d\n",&mainMenu_custom_position); - fscanf(f,"pos_x_textinput=%d\n",&mainMenu_pos_x_textinput); - fscanf(f,"pos_y_textinput=%d\n",&mainMenu_pos_y_textinput); - fscanf(f,"pos_x_dpad=%d\n",&mainMenu_pos_x_dpad); - fscanf(f,"pos_y_dpad=%d\n",&mainMenu_pos_y_dpad); - fscanf(f,"pos_x_button1=%d\n",&mainMenu_pos_x_button1); - fscanf(f,"pos_y_button1=%d\n",&mainMenu_pos_y_button1); - fscanf(f,"pos_x_button2=%d\n",&mainMenu_pos_x_button2); - fscanf(f,"pos_y_button2=%d\n",&mainMenu_pos_y_button2); - fscanf(f,"pos_x_button3=%d\n",&mainMenu_pos_x_button3); - fscanf(f,"pos_y_button3=%d\n",&mainMenu_pos_y_button3); - fscanf(f,"pos_x_button4=%d\n",&mainMenu_pos_x_button4); - fscanf(f,"pos_y_button4=%d\n",&mainMenu_pos_y_button4); - fscanf(f,"pos_x_button5=%d\n",&mainMenu_pos_x_button5); - fscanf(f,"pos_y_button5=%d\n",&mainMenu_pos_y_button5); - fscanf(f,"pos_x_button6=%d\n",&mainMenu_pos_x_button6); - fscanf(f,"pos_y_button6=%d\n",&mainMenu_pos_y_button6); - fscanf(f,"quick_switch=%d\n",&mainMenu_quickSwitch); - fscanf(f,"FloatingJoystick=%d\n",&mainMenu_FloatingJoystick); -#endif - - fclose(f); - } - - SetPresetMode(presetModeId, p); - - CheckKickstart(p); - set_joyConf(); - - return 1; -} diff --git a/src/osdep/neon_helper.s b/src/osdep/neon_helper.s deleted file mode 100644 index cee63f0d..00000000 --- a/src/osdep/neon_helper.s +++ /dev/null @@ -1,795 +0,0 @@ -@ Some functions and tests to increase performance in drawing.cpp and custom.cpp - -.arm - -.global TRACE_Start -.global TRACE_mem -.global pixcpy_swap16 -.global pixcpy_swap32 -.global ARM_doline_n1 -.global NEON_doline_n2 -.global NEON_doline_n3 -.global NEON_doline_n4 -.global NEON_doline_n6 -.global NEON_doline_n8 - - -.text - -.align 8 - -TRACE_Start: - stmdb sp!, {r0, r1} - stmdb sp!, {r1} - ldr r1, =TRACE_mem - str r0, [r1] - add r1, r1, #4 - ldmia sp!, {r0} - str r0, [r1] - add r1, r1, #4 - str r2, [r1] - add r1, r1, #4 - str r3, [r1] - - add r1, r1, #4 - str r4, [r1] - add r1, r1, #4 - str r5, [r1] - add r1, r1, #4 - str r6, [r1] - add r1, r1, #4 - str r7, [r1] - - add r1, r1, #4 - str r8, [r1] - add r1, r1, #4 - str r9, [r1] - add r1, r1, #4 - str r10, [r1] - add r1, r1, #4 - str r11, [r1] - - add r1, r1, #4 - str r12, [r1] - add r1, r1, #4 - str r13, [r1] - add r1, r1, #4 - str r14, [r1] - add r1, r1, #4 - str r15, [r1] - - ldmia sp!, {r0, r1} - bx lr - - -@---------------------------------------------------------------- -@ pixcpy_swap16 -@ -@ r0: uae_u16 *dstp -@ r1: uae_u16 *srcp -@ r2: int cols -@ -@ void pixcpy_swap16(uae_u16 *dstp, uae_u16 *srcp, int cols); -@ -@---------------------------------------------------------------- -pixcpy_swap16: - subs r2, r2, #1 - bxmi lr -pixcpy_swap16_1: - ldrh r3, [r1], #2 - rev16 r3, r3 - strh r3, [r0], #2 - subs r2, r2, #1 - bge pixcpy_swap16_1 - bx lr - - -@---------------------------------------------------------------- -@ pixcpy_swap32 -@ -@ r0: uae_u32 *dstp -@ r1: uae_u32 *srcp -@ r2: int cols -@ -@ void pixcpy_swap32(uae_u32 *dstp, uae_u32 *srcp, int cols); -@ -@---------------------------------------------------------------- -pixcpy_swap32: - subs r2, r2, #1 - bxmi lr -pixcpy_swap32_1: - ldr r3, [r1], #4 - rev r3, r3 - str r3, [r0], #4 - subs r2, r2, #1 - bge pixcpy_swap32_1 - bx lr - - -@---------------------------------------------------------------- -@ ARM_doline_n1 -@ -@ r0: uae_u32 *pixels -@ r1: int wordcount -@ r2: int lineno -@ -@ void ARM_doline_n1(uae_u32 *pixels, int wordcount, int lineno); -@ -@---------------------------------------------------------------- -ARM_doline_n1: - stmdb sp!, {r4-r9, lr} - - mov r3, #1600 - mul r2, r2, r3 - ldr r3, =line_data - add r3, r3, r2 @ real_bplpt[0] - - ldr r4, =Lookup_doline_n1 - - sub r3, r3, #4 - -ARM_doline_n1_loop: - ldr r2, [r3, #4]! -@ add r3, r3, #4 - - ubfx r5, r2, #28, #4 - add r5, r4, r5, lsl #2 - ldr r6, [r5] - - ubfx r5, r2, #24, #4 - add r5, r4, r5, lsl #2 - ldr r7, [r5] - - ubfx r5, r2, #20, #4 - add r5, r4, r5, lsl #2 - ldr r8, [r5] - - ubfx r5, r2, #16, #4 - add r5, r4, r5, lsl #2 - ldr r9, [r5] - stmia r0!, {r6-r9} - - ubfx r5, r2, #12, #4 - add r5, r4, r5, lsl #2 - ldr r6, [r5] - - ubfx r5, r2, #8, #4 - add r5, r4, r5, lsl #2 - ldr r7, [r5] - - ubfx r5, r2, #4, #4 - add r5, r4, r5, lsl #2 - ldr r8, [r5] - - ubfx r5, r2, #0, #4 - add r5, r4, r5, lsl #2 - ldr r9, [r5] - stmia r0!, {r6-r9} - - subs r1, r1, #1 - bgt ARM_doline_n1_loop - - ldmia sp!, {r4-r9, pc} - - -.align 8 - -@---------------------------------------------------------------- -@ NEON_doline_n2 -@ -@ r0: uae_u32 *pixels -@ r1: int wordcount -@ r2: int lineno -@ -@ void NEON_doline_n2(uae_u32 *pixels, int wordcount, int lineno); -@ -@---------------------------------------------------------------- -NEON_doline_n2: - - mov r3, #1600 - mul r2, r2, r3 - ldr r3, =line_data - add r2, r3, r2 @ real_bplpt[0] - add r3, r2, #200 - -@ Load masks to registers - vmov.u8 d18, #0x55 - vmov.u8 d19, #0x33 - vmov.u8 d20, #0x0f - -NEON_doline_n2_loop: - @ Load data as early as possible - vldmia r2!, {d4} - vldmia r3!, {d6} - -@ MERGE (b6, b7, 0x55555555, 1); - vshr.u8 d16, d4, #1 @ tmpb = b >> shift - vshl.u8 d17, d6, #1 @ tmpa = a << shift - vbit.u8 d6, d16, d18 @ a = a and bit set from tmpb if mask is true - vbif.u8 d4, d17, d18 @ b = b and bit set from tmpa if mask is false - -@ MERGE_0(b4, b6, 0x33333333, 2); - vshr.u8 d16, d6, #2 @ tmp = b >> shift - vand.8 d2, d16, d19 @ a = tmp & mask - vand.8 d6, d6, d19 @ b = b & mask -@ MERGE_0(b5, b7, 0x33333333, 2); - vshr.u8 d16, d4, #2 @ tmp = b >> shift - vand.8 d0, d16, d19 @ a = tmp & mask - vand.8 d4, d4, d19 @ b = b & mask - -@ MERGE_0(b0, b4, 0x0f0f0f0f, 4); - vshr.u8 d16, d2, #4 @ tmp = b >> shift - vand.8 d3, d16, d20 @ a = tmp & mask - vand.8 d2, d2, d20 @ b = b & mask -@ MERGE_0(b1, b5, 0x0f0f0f0f, 4); - vshr.u8 d16, d0, #4 @ tmp = b >> shift - vand.8 d1, d16, d20 @ a = tmp & mask - vand.8 d0, d0, d20 @ b = b & mask -@ MERGE_0(b2, b6, 0x0f0f0f0f, 4); - vshr.u8 d16, d6, #4 @ tmp = b >> shift - vand.8 d7, d16, d20 @ a = tmp & mask - vand.8 d6, d6, d20 @ b = b & mask -@ MERGE_0(b3, b7, 0x0f0f0f0f, 4); - vshr.u8 d16, d4, #4 @ tmp = b >> shift - vand.8 d5, d16, d20 @ a = tmp & mask - vand.8 d4, d4, d20 @ b = b & mask - - vzip.8 d3, d7 - vzip.8 d1, d5 - vzip.8 d2, d6 - vzip.8 d0, d4 - - vzip.8 d3, d1 - vzip.8 d2, d0 - vzip.32 d3, d2 - vzip.32 d1, d0 - - vst1.8 {d0, d1, d2, d3}, [r0]! - - cmp r1, #1 @ Exit from here if odd number of words - bxeq lr - - subs r1, r1, #2 @ We handle 2 words (64 bit) per loop: wordcount -= 2 - - vzip.8 d7, d5 - vzip.8 d6, d4 - vzip.32 d7, d6 - vzip.32 d5, d4 - - vst1.8 {d4, d5, d6, d7}, [r0]! - - bgt NEON_doline_n2_loop - -NEON_doline_n2_exit: - bx lr - - -.align 8 - -@---------------------------------------------------------------- -@ NEON_doline_n3 -@ -@ r0: uae_u32 *pixels -@ r1: int wordcount -@ r2: int lineno -@ -@ void NEON_doline_n3(uae_u32 *pixels, int wordcount, int lineno); -@ -@---------------------------------------------------------------- -NEON_doline_n3: - stmdb sp!, {r4, lr} - - mov r3, #1600 - mul r2, r2, r3 - ldr r3, =line_data - add r2, r3, r2 @ real_bplpt[0] - add r3, r2, #200 - add r4, r3, #200 - - @ Load data as early as possible - vldmia r4!, {d0} - -@ Load masks to registers - vmov.u8 d18, #0x55 - vmov.u8 d19, #0x33 - vmov.u8 d20, #0x0f - -NEON_doline_n3_loop: -@ Load from real_bplpt (now loaded earlier) -@ vld1.8 d0, [r4]! -@ vld1.8 d4, [r2]! -@ vld1.8 d6, [r3]! - - @ Load data as early as possible - vldmia r2!, {d4} - vldmia r3!, {d6} - -@ MERGE_0(b4, b5, 0x55555555, 1); - vshr.u8 d16, d0, #1 @ tmp = b >> shift - vand.8 d2, d16, d18 @ a = tmp & mask - vand.8 d0, d0, d18 @ b = b & mask - -@ MERGE (b6, b7, 0x55555555, 1); - vshr.u8 d16, d4, #1 @ tmpb = b >> shift - vshl.u8 d17, d6, #1 @ tmpa = a << shift - vbit.u8 d6, d16, d18 @ a = a and bit set from tmpb if mask is true - vbif.u8 d4, d17, d18 @ b = b and bit set from tmpa if mask is false - -@ MERGE (b4, b6, 0x33333333, 2); - vshr.u8 d16, d6, #2 @ tmpb = b >> shift - vshl.u8 d17, d2, #2 @ tmpa = a << shift - vbit.u8 d2, d16, d19 @ a = a and bit set from tmpb if mask is true - vbif.u8 d6, d17, d19 @ b = b and bit set from tmpa if mask is false -@ MERGE (b5, b7, 0x33333333, 2); - vshr.u8 d16, d4, #2 @ tmpb = b >> shift - vshl.u8 d17, d0, #2 @ tmpa = a << shift - vbit.u8 d0, d16, d19 @ a = a and bit set from tmpb if mask is true - vbif.u8 d4, d17, d19 @ b = b and bit set from tmpa if mask is false - -@ MERGE_0(b0, b4, 0x0f0f0f0f, 4); - vshr.u8 d16, d2, #4 @ tmp = b >> shift - vand.8 d3, d16, d20 @ a = tmp & mask - vand.8 d2, d2, d20 @ b = b & mask -@ MERGE_0(b1, b5, 0x0f0f0f0f, 4); - vshr.u8 d16, d0, #4 @ tmp = b >> shift - vand.8 d1, d16, d20 @ a = tmp & mask - vand.8 d0, d0, d20 @ b = b & mask -@ MERGE_0(b2, b6, 0x0f0f0f0f, 4); - vshr.u8 d16, d6, #4 @ tmp = b >> shift - vand.8 d7, d16, d20 @ a = tmp & mask - vand.8 d6, d6, d20 @ b = b & mask -@ MERGE_0(b3, b7, 0x0f0f0f0f, 4); - vshr.u8 d16, d4, #4 @ tmp = b >> shift - vand.8 d5, d16, d20 @ a = tmp & mask - vand.8 d4, d4, d20 @ b = b & mask - - vzip.8 d3, d7 - vzip.8 d1, d5 - vzip.8 d2, d6 - vzip.8 d0, d4 - - vzip.8 d3, d1 - vzip.8 d2, d0 - vzip.32 d3, d2 - vzip.32 d1, d0 - - vst1.8 {d0, d1, d2, d3}, [r0]! - - cmp r1, #1 @ Exit from here if odd number of words - ldmeqia sp!, {r4, pc} - - subs r1, r1, #2 @ We handle 2 words (64 bit) per loop: wordcount -= 2 - - @ Load next data (if needed) as early as possible - vldmiagt r4!, {d0} - - vzip.8 d7, d5 - vzip.8 d6, d4 - vzip.32 d7, d6 - vzip.32 d5, d4 - - vst1.8 {d4, d5, d6, d7}, [r0]! - - bgt NEON_doline_n3_loop - -NEON_doline_n3_exit: - ldmia sp!, {r4, pc} - - -.align 8 - -@---------------------------------------------------------------- -@ NEON_doline_n4 -@ -@ r0: uae_u32 *pixels -@ r1: int wordcount -@ r2: int lineno -@ -@ void NEON_doline_n4(uae_u32 *pixels, int wordcount, int lineno); -@ -@---------------------------------------------------------------- -NEON_doline_n4: - stmdb sp!, {r4-r5, lr} - - mov r3, #1600 - mul r2, r2, r3 - ldr r3, =line_data - add r2, r3, r2 @ real_bplpt[0] - add r3, r2, #200 - add r4, r3, #200 - add r5, r4, #200 - - @ Load data as early as possible - vldmia r4!, {d0} - vldmia r5!, {d2} - -@ Load masks to registers - vmov.u8 d18, #0x55 - vmov.u8 d19, #0x33 - vmov.u8 d20, #0x0f - -NEON_doline_n4_loop: -@ Load from real_bplpt (now loaded earlier) -@ vld1.8 d0, [r4]! -@ vld1.8 d2, [r5]! -@ vld1.8 d4, [r2]! -@ vld1.8 d6, [r3]! - - @ Load data as early as possible - vldmia r2!, {d4} - -@ MERGE (b4, b5, 0x55555555, 1); - vshr.u8 d16, d0, #1 @ tmpb = b >> shift - vshl.u8 d17, d2, #1 @ tmpa = a << shift - - vldmia r3!, {d6} - - vbit.u8 d2, d16, d18 @ a = a and bit set from tmpb if mask is true - vbif.u8 d0, d17, d18 @ b = b and bit set from tmpa if mask is false -@ MERGE (b6, b7, 0x55555555, 1); - vshr.u8 d16, d4, #1 @ tmpb = b >> shift - vshl.u8 d17, d6, #1 @ tmpa = a << shift - vbit.u8 d6, d16, d18 @ a = a and bit set from tmpb if mask is true - vbif.u8 d4, d17, d18 @ b = b and bit set from tmpa if mask is false - -@ MERGE (b4, b6, 0x33333333, 2); - vshr.u8 d16, d6, #2 @ tmpb = b >> shift - vshl.u8 d17, d2, #2 @ tmpa = a << shift - vbit.u8 d2, d16, d19 @ a = a and bit set from tmpb if mask is true - vbif.u8 d6, d17, d19 @ b = b and bit set from tmpa if mask is false -@ MERGE (b5, b7, 0x33333333, 2); - vshr.u8 d16, d4, #2 @ tmpb = b >> shift - vshl.u8 d17, d0, #2 @ tmpa = a << shift - vbit.u8 d0, d16, d19 @ a = a and bit set from tmpb if mask is true - vbif.u8 d4, d17, d19 @ b = b and bit set from tmpa if mask is false - -@ MERGE_0(b0, b4, 0x0f0f0f0f, 4); - vshr.u8 d16, d2, #4 @ tmp = b >> shift - vand.8 d3, d16, d20 @ a = tmp & mask - vand.8 d2, d2, d20 @ b = b & mask -@ MERGE_0(b1, b5, 0x0f0f0f0f, 4); - vshr.u8 d16, d0, #4 @ tmp = b >> shift - vand.8 d1, d16, d20 @ a = tmp & mask - vand.8 d0, d0, d20 @ b = b & mask -@ MERGE_0(b2, b6, 0x0f0f0f0f, 4); - vshr.u8 d16, d6, #4 @ tmp = b >> shift - vand.8 d7, d16, d20 @ a = tmp & mask - vand.8 d6, d6, d20 @ b = b & mask -@ MERGE_0(b3, b7, 0x0f0f0f0f, 4); - vshr.u8 d16, d4, #4 @ tmp = b >> shift - vand.8 d5, d16, d20 @ a = tmp & mask - vand.8 d4, d4, d20 @ b = b & mask - - vzip.8 d3, d7 - vzip.8 d1, d5 - vzip.8 d2, d6 - vzip.8 d0, d4 - - vzip.8 d3, d1 - vzip.8 d2, d0 - vzip.32 d3, d2 - vzip.32 d1, d0 - - vst1.8 {d0, d1, d2, d3}, [r0]! - - cmp r1, #1 @ Exit from here if odd number of words - ldmeqia sp!, {r4-r5, pc} - - subs r1, r1, #2 @ We handle 2 words (64 bit) per loop: wordcount -= 2 - - @ Load next data (if needed) as early as possible - vldmiagt r4!, {d0} - - vzip.8 d7, d5 - vzip.8 d6, d4 - - vldmiagt r5!, {d2} - - vzip.32 d7, d6 - vzip.32 d5, d4 - - vst1.8 {d4, d5, d6, d7}, [r0]! - - bgt NEON_doline_n4_loop - -NEON_doline_n4_exit: - ldmia sp!, {r4-r5, pc} - - -.align 8 - -@---------------------------------------------------------------- -@ NEON_doline_n6 -@ -@ r0: uae_u32 *pixels -@ r1: int wordcount -@ r2: int lineno -@ -@ void NEON_doline_n6(uae_u32 *pixels, int wordcount, int lineno); -@ -@---------------------------------------------------------------- -NEON_doline_n6: - stmdb sp!, {r4-r7, lr} - - mov r3, #1600 - mul r2, r2, r3 - ldr r3, =line_data - add r2, r3, r2 @ real_bplpt[0] - add r3, r2, #200 - add r4, r3, #200 - add r5, r4, #200 - add r6, r5, #200 - add r7, r6, #200 - -@ Load masks to registers - vmov.u8 d18, #0x55 - vmov.u8 d19, #0x33 - vmov.u8 d20, #0x0f - -NEON_doline_n6_loop: - @ Load data as early as possible - vldmia r6!, {d5} - vldmia r7!, {d7} - - @ Load data as early as possible - vldmia r4!, {d0} -@ MERGE (b2, b3, 0x55555555, 1); - vshr.u8 d16, d5, #1 @ tmpb = b >> shift - vshl.u8 d17, d7, #1 @ tmpa = a << shift - @ Load data as early as possible - vldmia r5!, {d2} - vbit.u8 d7, d16, d18 @ a = a and bit set from tmpb if mask is true - vbif.u8 d5, d17, d18 @ b = b and bit set from tmpa if mask is false - @ Load data as early as possible - vldmia r2!, {d4} -@ MERGE (b4, b5, 0x55555555, 1); - vshr.u8 d16, d0, #1 @ tmpb = b >> shift - vshl.u8 d17, d2, #1 @ tmpa = a << shift - @ Load data as early as possible - vldmia r3!, {d6} - vbit.u8 d2, d16, d18 @ a = a and bit set from tmpb if mask is true - vbif.u8 d0, d17, d18 @ b = b and bit set from tmpa if mask is false -@ MERGE (b6, b7, 0x55555555, 1); - vshr.u8 d16, d4, #1 @ tmpb = b >> shift - vshl.u8 d17, d6, #1 @ tmpa = a << shift - vbit.u8 d6, d16, d18 @ a = a and bit set from tmpb if mask is true - vbif.u8 d4, d17, d18 @ b = b and bit set from tmpa if mask is false - -@ MERGE_0(b0, b2, 0x33333333, 2); - vshr.u8 d16, d7, #2 @ tmp = b >> shift - vand.8 d3, d16, d19 @ a = tmp & mask - vand.8 d7, d7, d19 @ b = b & mask -@ MERGE_0(b1, b3, 0x33333333, 2); - vshr.u8 d16, d5, #2 @ tmp = b >> shift - vand.8 d1, d16, d19 @ a = tmp & mask - vand.8 d5, d5, d19 @ b = b & mask -@ MERGE (b4, b6, 0x33333333, 2); - vshr.u8 d16, d6, #2 @ tmpb = b >> shift - vshl.u8 d17, d2, #2 @ tmpa = a << shift - vbit.u8 d2, d16, d19 @ a = a and bit set from tmpb if mask is true - vbif.u8 d6, d17, d19 @ b = b and bit set from tmpa if mask is false -@ MERGE (b5, b7, 0x33333333, 2); - vshr.u8 d16, d4, #2 @ tmpb = b >> shift - vshl.u8 d17, d0, #2 @ tmpa = a << shift - vbit.u8 d0, d16, d19 @ a = a and bit set from tmpb if mask is true - vbif.u8 d4, d17, d19 @ b = b and bit set from tmpa if mask is false - -@ MERGE (b0, b4, 0x0f0f0f0f, 4); - vshr.u8 d16, d2, #4 @ tmpb = b >> shift - vshl.u8 d17, d3, #4 @ tmpa = a << shift - vbit.u8 d3, d16, d20 @ a = a and bit set from tmpb if mask is true - vbif.u8 d2, d17, d20 @ b = b and bit set from tmpa if mask is false -@ MERGE (b1, b5, 0x0f0f0f0f, 4); - vshr.u8 d16, d0, #4 @ tmpb = b >> shift - vshl.u8 d17, d1, #4 @ tmpa = a << shift - vbit.u8 d1, d16, d20 @ a = a and bit set from tmpb if mask is true - vbif.u8 d0, d17, d20 @ b = b and bit set from tmpa if mask is false -@ MERGE (b2, b6, 0x0f0f0f0f, 4); - vshr.u8 d16, d6, #4 @ tmpb = b >> shift - vshl.u8 d17, d7, #4 @ tmpa = a << shift - vbit.u8 d7, d16, d20 @ a = a and bit set from tmpb if mask is true - vbif.u8 d6, d17, d20 @ b = b and bit set from tmpa if mask is false -@ MERGE (b3, b7, 0x0f0f0f0f, 4); - vshr.u8 d16, d4, #4 @ tmpb = b >> shift - vshl.u8 d17, d5, #4 @ tmpa = a << shift - vbit.u8 d5, d16, d20 @ a = a and bit set from tmpb if mask is true - vbif.u8 d4, d17, d20 @ b = b and bit set from tmpa if mask is false - - vzip.8 d3, d7 - vzip.8 d1, d5 - vzip.8 d2, d6 - vzip.8 d0, d4 - - vzip.8 d3, d1 - vzip.8 d2, d0 - vzip.32 d3, d2 - vzip.32 d1, d0 - - vst1.8 {d0, d1, d2, d3}, [r0]! - - cmp r1, #1 @ Exit from here if odd number of words - ldmeqia sp!, {r4-r7, pc} - - subs r1, r1, #2 @ We handle 2 words (64 bit) per loop: wordcount -= 2 - - vzip.8 d7, d5 - vzip.8 d6, d4 - vzip.32 d7, d6 - vzip.32 d5, d4 - - vst1.8 {d4, d5, d6, d7}, [r0]! - - bgt NEON_doline_n6_loop - -NEON_doline_n6_exit: - ldmia sp!, {r4-r7, pc} - - -.align 8 - -@---------------------------------------------------------------- -@ NEON_doline_n8 -@ -@ r0: uae_u32 *pixels -@ r1: int wordcount -@ r2: int lineno -@ -@ void NEON_doline_n8(uae_u32 *pixels, int wordcount, int lineno); -@ -@---------------------------------------------------------------- -NEON_doline_n8: - stmdb sp!, {r4-r9, lr} - - mov r3, #1600 - mul r2, r2, r3 - ldr r3, =line_data - add r2, r3, r2 @ real_bplpt[0] - add r3, r2, #200 - add r4, r3, #200 - add r5, r4, #200 - add r6, r5, #200 - add r7, r6, #200 - add r8, r7, #200 - add r9, r8, #200 - - @ Load data as early as possible - vldmia r8!, {d1} - vldmia r9!, {d3} - -@ Load masks to registers - vmov.u8 d18, #0x55 - vmov.u8 d19, #0x33 - vmov.u8 d20, #0x0f - -NEON_doline_n8_loop: - @ Load data as early as possible - vldmia r6!, {d5} -@ MERGE (b0, b1, 0x55555555, 1); - vshr.u8 d16, d1, #1 @ tmpb = b >> shift - vshl.u8 d17, d3, #1 @ tmpa = a << shift - @ Load data as early as possible - vldmia r7!, {d7} - vbit.u8 d3, d16, d18 @ a = a and bit set from tmpb if mask is true - vbif.u8 d1, d17, d18 @ b = b and bit set from tmpa if mask is false - @ Load data as early as possible - vldmia r4!, {d0} -@ MERGE (b2, b3, 0x55555555, 1); - vshr.u8 d16, d5, #1 @ tmpb = b >> shift - vshl.u8 d17, d7, #1 @ tmpa = a << shift - @ Load data as early as possible - vldmia r5!, {d2} - vbit.u8 d7, d16, d18 @ a = a and bit set from tmpb if mask is true - vbif.u8 d5, d17, d18 @ b = b and bit set from tmpa if mask is false - @ Load data as early as possible - vldmia r2!, {d4} -@ MERGE (b4, b5, 0x55555555, 1); - vshr.u8 d16, d0, #1 @ tmpb = b >> shift - vshl.u8 d17, d2, #1 @ tmpa = a << shift - @ Load data as early as possible - vldmia r3!, {d6} - vbit.u8 d2, d16, d18 @ a = a and bit set from tmpb if mask is true - vbif.u8 d0, d17, d18 @ b = b and bit set from tmpa if mask is false -@ MERGE (b6, b7, 0x55555555, 1); - vshr.u8 d16, d4, #1 @ tmpb = b >> shift - vshl.u8 d17, d6, #1 @ tmpa = a << shift - vbit.u8 d6, d16, d18 @ a = a and bit set from tmpb if mask is true - vbif.u8 d4, d17, d18 @ b = b and bit set from tmpa if mask is false - -@ MERGE (b0, b2, 0x33333333, 2); - vshr.u8 d16, d7, #2 @ tmpb = b >> shift - vshl.u8 d17, d3, #2 @ tmpa = a << shift - vbit.u8 d3, d16, d19 @ a = a and bit set from tmpb if mask is true - vbif.u8 d7, d17, d19 @ b = b and bit set from tmpa if mask is false -@ MERGE (b1, b3, 0x33333333, 2); - vshr.u8 d16, d5, #2 @ tmpb = b >> shift - vshl.u8 d17, d1, #2 @ tmpa = a << shift - vbit.u8 d1, d16, d19 @ a = a and bit set from tmpb if mask is true - vbif.u8 d5, d17, d19 @ b = b and bit set from tmpa if mask is false -@ MERGE (b4, b6, 0x33333333, 2); - vshr.u8 d16, d6, #2 @ tmpb = b >> shift - vshl.u8 d17, d2, #2 @ tmpa = a << shift - vbit.u8 d2, d16, d19 @ a = a and bit set from tmpb if mask is true - vbif.u8 d6, d17, d19 @ b = b and bit set from tmpa if mask is false -@ MERGE (b5, b7, 0x33333333, 2); - vshr.u8 d16, d4, #2 @ tmpb = b >> shift - vshl.u8 d17, d0, #2 @ tmpa = a << shift - vbit.u8 d0, d16, d19 @ a = a and bit set from tmpb if mask is true - vbif.u8 d4, d17, d19 @ b = b and bit set from tmpa if mask is false - -@ MERGE (b0, b4, 0x0f0f0f0f, 4); - vshr.u8 d16, d2, #4 @ tmpb = b >> shift - vshl.u8 d17, d3, #4 @ tmpa = a << shift - vbit.u8 d3, d16, d20 @ a = a and bit set from tmpb if mask is true - vbif.u8 d2, d17, d20 @ b = b and bit set from tmpa if mask is false -@ MERGE (b1, b5, 0x0f0f0f0f, 4); - vshr.u8 d16, d0, #4 @ tmpb = b >> shift - vshl.u8 d17, d1, #4 @ tmpa = a << shift - vbit.u8 d1, d16, d20 @ a = a and bit set from tmpb if mask is true - vbif.u8 d0, d17, d20 @ b = b and bit set from tmpa if mask is false -@ MERGE (b2, b6, 0x0f0f0f0f, 4); - vshr.u8 d16, d6, #4 @ tmpb = b >> shift - vshl.u8 d17, d7, #4 @ tmpa = a << shift - vbit.u8 d7, d16, d20 @ a = a and bit set from tmpb if mask is true - vbif.u8 d6, d17, d20 @ b = b and bit set from tmpa if mask is false -@ MERGE (b3, b7, 0x0f0f0f0f, 4); - vshr.u8 d16, d4, #4 @ tmpb = b >> shift - vshl.u8 d17, d5, #4 @ tmpa = a << shift - vbit.u8 d5, d16, d20 @ a = a and bit set from tmpb if mask is true - vbif.u8 d4, d17, d20 @ b = b and bit set from tmpa if mask is false - - vzip.8 d3, d7 - vzip.8 d1, d5 - vzip.8 d2, d6 - vzip.8 d0, d4 - - vzip.8 d3, d1 - vzip.8 d2, d0 - vzip.32 d3, d2 - vzip.32 d1, d0 - - vst1.8 {d0, d1, d2, d3}, [r0]! - - cmp r1, #1 @ Exit from here if odd number of words - ldmeqia sp!, {r4-r9, pc} - - subs r1, r1, #2 @ We handle 2 words (64 bit) per loop: wordcount -= 2 - - @ Load data as early as possible - vldmiagt r8!, {d1} - - vzip.8 d7, d5 - vzip.8 d6, d4 - - @ Load data as early as possible - vldmiagt r9!, {d3} - - vzip.32 d7, d6 - vzip.32 d5, d4 - - vst1.8 {d4, d5, d6, d7}, [r0]! - - bgt NEON_doline_n8_loop - -NEON_doline_n8_exit: - ldmia sp!, {r4-r9, pc} - - -.data - -.align 8 - -Lookup_doline_n1: - .long 0x00000000, 0x01000000, 0x00010000, 0x01010000 - .long 0x00000100, 0x01000100, 0x00010100, 0x01010100 - .long 0x00000001, 0x01000001, 0x00010001, 0x01010001 - .long 0x00000101, 0x01000101, 0x00010101, 0x01010101 - -TRACE_mem: - .long 0x00000000, 0x00000000, 0x00000000, 0x00000000 - .long 0x00000000, 0x00000000, 0x00000000, 0x00000000 - .long 0x00000000, 0x00000000, 0x00000000, 0x00000000 - .long 0x00000000, 0x00000000, 0x00000000, 0x00000000 - .long 0x00000000, 0x00000000, 0x00000000, 0x00000000 - .long 0x00000000, 0x00000000, 0x00000000, 0x00000000 - .long 0x00000000, 0x00000000, 0x00000000, 0x00000000 - .long 0x00000000, 0x00000000, 0x00000000, 0x00000000 diff --git a/src/osdep/pandora.cpp b/src/osdep/pandora.cpp deleted file mode 100644 index 580106c2..00000000 --- a/src/osdep/pandora.cpp +++ /dev/null @@ -1,836 +0,0 @@ -/* - * UAE - The Un*x Amiga Emulator - * - * Pandora interface - * - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "autoconf.h" -#include "uae.h" -#include "options.h" -#include "gui.h" -#include "events.h" -#include "memory.h" -#include "custom.h" -#include "xwin.h" -#include "drawing.h" -#include "inputdevice.h" -#include "keybuf.h" -#include "keyboard.h" -#include "joystick.h" -#include "disk.h" -#include "savestate.h" -#include -#include "gp2x.h" - -extern void signal_segv(int signum, siginfo_t* info, void*ptr); - -extern int doStylusRightClick; -extern int mouseMoving; -extern int justClicked; -extern int fcounter; - -extern int keycode2amiga(SDL_keysym *prKeySym); -extern int loadconfig_old(struct uae_prefs *p, const char *orgpath); -extern void SetLastActiveConfig(const char *filename); - -/* Keyboard and mouse */ -/* Keyboard */ -int uae4all_keystate[256]; -#ifdef PANDORA -static int shiftWasPressed = 0; -#endif - -char start_path_data[MAX_DPATH]; -char currentDir[MAX_DPATH]; -int show_inputmode = 0; - -int sleep_resolution = 1000 / 1; - -static char config_path[MAX_DPATH]; -static char rom_path[MAX_DPATH]; -char last_loaded_config[MAX_DPATH] = { '\0' }; - -static bool slow_mouse = false; - -static bool cpuSpeedChanged = false; -static int lastCpuSpeed = 600; - - -extern "C" int main( int argc, char *argv[] ); - - -void sleep_millis (int ms) -{ - usleep(ms * 1000); -} - -void sleep_millis_busy (int ms) -{ - usleep(ms * 1000); -} - - -void logging_init( void ) -{ -#ifdef WITH_LOGGING - static int started; - static int first; - char debugfilename[MAX_DPATH]; - - if (first > 1) { - write_log ("***** RESTART *****\n"); - return; - } - if (first == 1) { - if (debugfile) - fclose (debugfile); - debugfile = 0; - } - - sprintf(debugfilename, "%s/uae4all_log.txt", start_path_data); - if(!debugfile) - debugfile = fopen(debugfilename, "wt"); - - first++; - write_log ( "UAE4ALL Logfile\n\n"); -#endif -} - -void logging_cleanup( void ) -{ -#ifdef WITH_LOGGING - if(debugfile) - fclose(debugfile); - debugfile = 0; -#endif -} - - -void target_default_options (struct uae_prefs *p, int type) -{ - p->pandora_horizontal_offset = 0; - p->pandora_vertical_offset = 0; - p->pandora_cpu_speed = 600; - p->pandora_partial_blits = 0; - - p->pandora_joyConf = 0; - p->pandora_joyPort = 0; - p->pandora_tapDelay = 10; - p->pandora_stylusOffset = 0; - - p->pandora_customControls = 0; - p->pandora_custom_dpad = 0; - p->pandora_custom_up = 0; - p->pandora_custom_down = 0; - p->pandora_custom_left = 0; - p->pandora_custom_right = 0; - p->pandora_custom_A = 0; - p->pandora_custom_B = 0; - p->pandora_custom_X = 0; - p->pandora_custom_Y = 0; - p->pandora_custom_L = 0; - p->pandora_custom_R = 0; - - p->pandora_button1 = GP2X_BUTTON_X; - p->pandora_button2 = GP2X_BUTTON_A; - p->pandora_autofireButton1 = GP2X_BUTTON_B; - p->pandora_jump = -1; -} - - -void target_save_options (struct zfile *f, struct uae_prefs *p) -{ - cfgfile_write (f, "pandora.blitter_in_partial_mode=%d\n", p->pandora_partial_blits); - cfgfile_write (f, "pandora.cpu_speed=%d\n", p->pandora_cpu_speed); - cfgfile_write (f, "pandora.joy_conf=%d\n", p->pandora_joyConf); - cfgfile_write (f, "pandora.joy_port=%d\n", p->pandora_joyPort); - cfgfile_write (f, "pandora.stylus_offset=%d\n", p->pandora_stylusOffset); - cfgfile_write (f, "pandora.tap_delay=%d\n", p->pandora_tapDelay); - cfgfile_write (f, "pandora.custom_controls=%d\n", p->pandora_customControls); - cfgfile_write (f, "pandora.custom_dpad=%d\n", p->pandora_custom_dpad); - cfgfile_write (f, "pandora.custom_up=%d\n", p->pandora_custom_up); - cfgfile_write (f, "pandora.custom_down=%d\n", p->pandora_custom_down); - cfgfile_write (f, "pandora.custom_left=%d\n", p->pandora_custom_left); - cfgfile_write (f, "pandora.custom_right=%d\n", p->pandora_custom_right); - cfgfile_write (f, "pandora.custom_a=%d\n", p->pandora_custom_A); - cfgfile_write (f, "pandora.custom_b=%d\n", p->pandora_custom_B); - cfgfile_write (f, "pandora.custom_x=%d\n", p->pandora_custom_X); - cfgfile_write (f, "pandora.custom_y=%d\n", p->pandora_custom_Y); - cfgfile_write (f, "pandora.custom_l=%d\n", p->pandora_custom_L); - cfgfile_write (f, "pandora.custom_r=%d\n", p->pandora_custom_R); - cfgfile_write (f, "pandora.move_x=%d\n", p->pandora_horizontal_offset); - cfgfile_write (f, "pandora.move_y=%d\n", p->pandora_vertical_offset); - cfgfile_write (f, "pandora.button1=%d\n", p->pandora_button1); - cfgfile_write (f, "pandora.button2=%d\n", p->pandora_button2); - cfgfile_write (f, "pandora.autofire_button=%d\n", p->pandora_autofireButton1); - cfgfile_write (f, "pandora.jump=%d\n", p->pandora_jump); -} - - -int target_parse_option (struct uae_prefs *p, char *option, char *value) -{ - int result = (cfgfile_intval (option, value, "blitter_in_partial_mode", &p->pandora_partial_blits, 1) - || cfgfile_intval (option, value, "cpu_speed", &p->pandora_cpu_speed, 1) - || cfgfile_intval (option, value, "joy_conf", &p->pandora_joyConf, 1) - || cfgfile_intval (option, value, "joy_port", &p->pandora_joyPort, 1) - || cfgfile_intval (option, value, "stylus_offset", &p->pandora_stylusOffset, 1) - || cfgfile_intval (option, value, "tap_delay", &p->pandora_tapDelay, 1) - || cfgfile_intval (option, value, "custom_controls", &p->pandora_customControls, 1) - || cfgfile_intval (option, value, "custom_dpad", &p->pandora_custom_dpad, 1) - || cfgfile_intval (option, value, "custom_up", &p->pandora_custom_up, 1) - || cfgfile_intval (option, value, "custom_down", &p->pandora_custom_down, 1) - || cfgfile_intval (option, value, "custom_left", &p->pandora_custom_left, 1) - || cfgfile_intval (option, value, "custom_right", &p->pandora_custom_right, 1) - || cfgfile_intval (option, value, "custom_a", &p->pandora_custom_A, 1) - || cfgfile_intval (option, value, "custom_b", &p->pandora_custom_B, 1) - || cfgfile_intval (option, value, "custom_x", &p->pandora_custom_X, 1) - || cfgfile_intval (option, value, "custom_y", &p->pandora_custom_Y, 1) - || cfgfile_intval (option, value, "custom_l", &p->pandora_custom_L, 1) - || cfgfile_intval (option, value, "custom_r", &p->pandora_custom_R, 1) - || cfgfile_intval (option, value, "move_x", &p->pandora_horizontal_offset, 1) - || cfgfile_intval (option, value, "move_y", &p->pandora_vertical_offset, 1) - || cfgfile_intval (option, value, "button1", &p->pandora_button1, 1) - || cfgfile_intval (option, value, "button2", &p->pandora_button2, 1) - || cfgfile_intval (option, value, "autofire_button", &p->pandora_autofireButton1, 1) - || cfgfile_intval (option, value, "jump", &p->pandora_jump, 1) - ); -} - - -void fetch_configurationpath (char *out, int size) -{ - strncpy(out, config_path, size); -} - - -void set_configurationpath(char *newpath) -{ - strncpy(config_path, newpath, MAX_DPATH); -} - - -void fetch_rompath (char *out, int size) -{ - strncpy(out, rom_path, size); -} - - -void set_rompath(char *newpath) -{ - strncpy(rom_path, newpath, MAX_DPATH); -} - - -void fetch_savestatepath(char *out, int size) -{ - strncpy(out, start_path_data, size); - strncat(out, "/savestates/", size); -} - - -void fetch_screenshotpath(char *out, int size) -{ - strncpy(out, start_path_data, size); - strncat(out, "/screenshots/", size); -} - - -int target_cfgfile_load (struct uae_prefs *p, char *filename, int type, int isdefault) -{ - int result = 0; - - while(nr_units(p->mountinfo) > 0) - kill_filesys_unit(p->mountinfo, 0); - - char *ptr = strstr(filename, ".uae"); - if(ptr > 0) - { - int type = CONFIG_TYPE_HARDWARE | CONFIG_TYPE_HOST; - result = cfgfile_load(p, filename, &type, 0); - } - if(result) - { - set_joyConf(); - extractFileName(filename, last_loaded_config); - } - else - result = loadconfig_old(p, filename); - - if(result) - { - for(int i=0; i < p->nr_floppies; ++i) - { - if(strlen(p->df[i]) > 0) - AddFileToDiskList(p->df[i], 1); - } - - inputdevice_updateconfig (p); - - SetLastActiveConfig(filename); - } - - return result; -} - - -int check_configfile(char *file) -{ - char tmp[MAX_PATH]; - - FILE *f = fopen(file, "rt"); - if(f) - { - fclose(f); - return 1; - } - - strcpy(tmp, file); - char *ptr = strstr(tmp, ".uae"); - if(ptr > 0) - { - *(ptr + 1) = '\0'; - strcat(tmp, "conf"); - f = fopen(tmp, "rt"); - if(f) - { - fclose(f); - return 2; - } - } - - return 0; -} - - -void extractFileName(const char * str,char *buffer) -{ - const char *p=str+strlen(str)-1; - while(*p != '/' && p > str) - p--; - p++; - strcpy(buffer,p); -} - - -void extractPath(char *str, char *buffer) -{ - strcpy(buffer, str); - char *p = buffer + strlen(buffer) - 1; - while(*p != '/' && p > buffer) - p--; - p[1] = '\0'; -} - - -void removeFileExtension(char *filename) -{ - char *p = filename + strlen(filename) - 1; - while(p > filename && *p != '.') - { - *p = '\0'; - --p; - } - *p = '\0'; -} - - -void ReadDirectory(const char *path, std::vector *dirs, std::vector *files) -{ - DIR *dir; - struct dirent *dent; - - if(dirs != NULL) - dirs->clear(); - if(files != NULL) - files->clear(); - - dir = opendir(path); - if(dir != NULL) - { - while((dent = readdir(dir)) != NULL) - { - if(dent->d_type == DT_DIR) - { - if(dirs != NULL) - dirs->push_back(dent->d_name); - } - else if (files != NULL) - files->push_back(dent->d_name); - } - if(dirs != NULL && dirs->size() > 0 && (*dirs)[0] == ".") - dirs->erase(dirs->begin()); - closedir(dir); - } - - if(dirs != NULL) - std::sort(dirs->begin(), dirs->end()); - if(files != NULL) - std::sort(files->begin(), files->end()); -} - - -void saveAdfDir(void) -{ - char path[MAX_DPATH]; - int i; - - snprintf(path, MAX_DPATH, "%s/conf/adfdir.conf", start_path_data); - FILE *f=fopen(path,"w"); - if (!f) - return; - - char buffer[MAX_DPATH]; - snprintf(buffer, MAX_DPATH, "path=%s\n", currentDir); - fputs(buffer,f); - - snprintf(buffer, MAX_DPATH, "config_path=%s\n", config_path); - fputs(buffer, f); - - snprintf(buffer, MAX_DPATH, "rom_path=%s\n", rom_path); - fputs(buffer, f); - - snprintf(buffer, MAX_DPATH, "ROMs=%d\n", lstAvailableROMs.size()); - fputs(buffer, f); - for(i=0; iName); - fputs(buffer, f); - snprintf(buffer, MAX_DPATH, "ROMPath=%s\n", lstAvailableROMs[i]->Path); - fputs(buffer, f); - snprintf(buffer, MAX_DPATH, "ROMType=%d\n", lstAvailableROMs[i]->ROMType); - fputs(buffer, f); - } - - snprintf(buffer, MAX_DPATH, "MRUDiskList=%d\n", lstMRUDiskList.size()); - fputs(buffer, f); - for(i=0; i 0 && (buffer[i - 1] == '\t' || buffer[i - 1] == ' ' - || buffer[i - 1] == '\r' || buffer[i - 1] == '\n')) - buffer[--i] = '\0'; - strncpy(dst, buffer, size); -} - - -void loadAdfDir(void) -{ - char path[MAX_DPATH]; - int i; - - strcpy(currentDir, start_path_data); - snprintf(config_path, MAX_DPATH, "%s/conf/", start_path_data); - snprintf(rom_path, MAX_DPATH, "%s/kickstarts/", start_path_data); - - snprintf(path, MAX_DPATH, "%s/conf/adfdir.conf", start_path_data); - FILE *f1=fopen(path,"rt"); - if(f1) - { - fscanf(f1, "path="); - get_string(f1, currentDir, sizeof(currentDir)); - if(!feof(f1)) - { - fscanf(f1, "config_path="); - get_string(f1, config_path, sizeof(config_path)); - fscanf(f1, "rom_path="); - get_string(f1, rom_path, sizeof(rom_path)); - - int numROMs; - fscanf(f1, "ROMs=%d\n", &numROMs); - for(i=0; iROMType)); - lstAvailableROMs.push_back(tmp); - } - - lstMRUDiskList.clear(); - int numDisks = 0; - char disk[MAX_PATH]; - fscanf(f1, "MRUDiskList=%d\n", &numDisks); - for(i=0; i 500 && value < 1200) - { - lastCpuSpeed = value - 10; - currprefs.pandora_cpu_speed = changed_prefs.pandora_cpu_speed = value; - setCpuSpeed(); - printf("CPU speed reset to %d\n", value); - } - } - } - fclose(f); - } - } -} - - -int main (int argc, char *argv[]) -{ - struct sigaction action; - - // Get startup path - getcwd(start_path_data, MAX_DPATH); - - loadAdfDir(); - - snprintf(savestate_fname, MAX_PATH, "%s/saves/default.ads", start_path_data); - logging_init (); - - memset(&action, 0, sizeof(action)); - action.sa_sigaction = signal_segv; - action.sa_flags = SA_SIGINFO; - if(sigaction(SIGSEGV, &action, NULL) < 0) - { - printf("Failed to set signal handler (SIGSEGV).\n"); - abort(); - } - if(sigaction(SIGILL, &action, NULL) < 0) - { - printf("Failed to set signal handler (SIGILL).\n"); - abort(); - } - - alloc_AmigaMem(); - real_main (argc, argv); - free_AmigaMem(); - - logging_cleanup(); - - return 0; -} - - -int needmousehack (void) -{ - return 1; -} - - -int mousehack_allowed (void) -{ - return 1; -} - - -void keyboard_init(void) -{ - int i; - - for (i = 256; i--;) - uae4all_keystate[i] = 0; - shiftWasPressed = 0; -} - - -void handle_events (void) -{ - SDL_Event rEvent; - int iAmigaKeyCode; - int i, j; - int iIsHotKey = 0; - - /* Handle GUI events */ - gui_handle_events (); - handle_joymouse(); - - while (SDL_PollEvent(&rEvent)) - { - switch (rEvent.type) - { - case SDL_QUIT: - uae_quit(); - break; - - case SDL_KEYDOWN: - if(rEvent.key.keysym.sym==SDLK_PAGEUP) - slow_mouse=true; - if(currprefs.pandora_custom_dpad == 1) // dPad as mouse, why these emulation of key presses? - { - if(rEvent.key.keysym.sym==SDLK_RSHIFT) - { - uae4all_keystate[AK_LALT] = 1; - record_key(AK_LALT << 1); - } - if(rEvent.key.keysym.sym==SDLK_RCTRL || rEvent.key.keysym.sym==SDLK_END || rEvent.key.keysym.sym==SDLK_HOME) - { - uae4all_keystate[AK_RALT] = 1; - record_key(AK_RALT << 1); - } - if(rEvent.key.keysym.sym==SDLK_PAGEDOWN) - { - uae4all_keystate[AK_DN] = 1; - record_key(AK_DN << 1); - } - } - - if (rEvent.key.keysym.sym==SDLK_LALT) - { - // state moves thus: - // joystick mode (with virt keyboard on L and R) - // mouse mode (with mouse buttons on L and R) - // remapping mode (with whatever's been supplied) - // back to start of state - - currprefs.pandora_custom_dpad++; - if(currprefs.pandora_custom_dpad > 2) - currprefs.pandora_custom_dpad = 0; - changed_prefs.pandora_custom_dpad = currprefs.pandora_custom_dpad; - if(currprefs.pandora_custom_dpad == 2) - mousehack_set(mousehack_follow); - else - mousehack_set (mousehack_dontcare); - - show_inputmode = 1; - } - - if (rEvent.key.keysym.sym==SDLK_RSHIFT || rEvent.key.keysym.sym==SDLK_RCTRL) - doStylusRightClick = 1; - - if (rEvent.key.keysym.sym!=SDLK_UP && rEvent.key.keysym.sym!=SDLK_DOWN && rEvent.key.keysym.sym!=SDLK_LEFT && - rEvent.key.keysym.sym!=SDLK_RIGHT && rEvent.key.keysym.sym!=SDLK_PAGEUP && rEvent.key.keysym.sym!=SDLK_PAGEDOWN && - rEvent.key.keysym.sym!=SDLK_HOME && rEvent.key.keysym.sym!=SDLK_END && rEvent.key.keysym.sym!=SDLK_LALT && - rEvent.key.keysym.sym!=SDLK_LCTRL && rEvent.key.keysym.sym!=SDLK_RSHIFT && rEvent.key.keysym.sym!=SDLK_RCTRL) - { - iAmigaKeyCode = keycode2amiga(&(rEvent.key.keysym)); - if (iAmigaKeyCode >= 0) - { -#ifdef PANDORA - if(iAmigaKeyCode & SIMULATE_SHIFT) - { - // We need to simulate shift - iAmigaKeyCode = iAmigaKeyCode & 0x1ff; - shiftWasPressed = uae4all_keystate[AK_LSH]; - if(!shiftWasPressed) - { - uae4all_keystate[AK_LSH] = 1; - record_key(AK_LSH << 1); - } - } - if(iAmigaKeyCode & SIMULATE_RELEASED_SHIFT) - { - // We need to simulate released shift - iAmigaKeyCode = iAmigaKeyCode & 0x1ff; - shiftWasPressed = uae4all_keystate[AK_LSH]; - if(shiftWasPressed) - { - uae4all_keystate[AK_LSH] = 0; - record_key((AK_LSH << 1) | 1); - } - } -#endif - if (!uae4all_keystate[iAmigaKeyCode]) - { - uae4all_keystate[iAmigaKeyCode] = 1; - record_key(iAmigaKeyCode << 1); - } - } - } - break; - - case SDL_KEYUP: - if(rEvent.key.keysym.sym==SDLK_PAGEUP) - slow_mouse = false; - if(currprefs.pandora_custom_dpad == 1) // dPad as mouse, why these emulation of key presses? - { - if(rEvent.key.keysym.sym==SDLK_RSHIFT) - { - uae4all_keystate[AK_LALT] = 0; - record_key((AK_LALT << 1) | 1); - } - if(rEvent.key.keysym.sym==SDLK_RCTRL || rEvent.key.keysym.sym==SDLK_END || rEvent.key.keysym.sym==SDLK_HOME) - { - uae4all_keystate[AK_RALT] = 0; - record_key((AK_RALT << 1) | 1); - } - if(rEvent.key.keysym.sym==SDLK_PAGEDOWN) - { - uae4all_keystate[AK_DN] = 0; - record_key((AK_DN << 1) | 1); - } - } - - if (rEvent.key.keysym.sym==SDLK_RSHIFT || rEvent.key.keysym.sym==SDLK_RCTRL) - { - doStylusRightClick = 0; - mouseMoving = 0; - justClicked = 0; - fcounter = 0; - buttonstate[2] = 0; - } - - if (rEvent.key.keysym.sym==SDLK_LALT) - { - show_inputmode = 0; - } - if (rEvent.key.keysym.sym!=SDLK_UP && rEvent.key.keysym.sym!=SDLK_DOWN && rEvent.key.keysym.sym!=SDLK_LEFT && - rEvent.key.keysym.sym!=SDLK_RIGHT && rEvent.key.keysym.sym!=SDLK_PAGEUP && rEvent.key.keysym.sym!=SDLK_PAGEDOWN && - rEvent.key.keysym.sym!=SDLK_HOME && rEvent.key.keysym.sym!=SDLK_END && rEvent.key.keysym.sym!=SDLK_LALT && - rEvent.key.keysym.sym!=SDLK_LCTRL && rEvent.key.keysym.sym!=SDLK_RSHIFT && rEvent.key.keysym.sym!=SDLK_RCTRL) - { - iAmigaKeyCode = keycode2amiga(&(rEvent.key.keysym)); - if (iAmigaKeyCode >= 0) - { -#ifdef PANDORA - if(iAmigaKeyCode & SIMULATE_SHIFT) - { - // We needed to simulate shift - iAmigaKeyCode = iAmigaKeyCode & 0x1ff; - if(!shiftWasPressed) - { - uae4all_keystate[AK_LSH] = 0; - record_key((AK_LSH << 1) | 1); - shiftWasPressed = 0; - } - } - if(iAmigaKeyCode & SIMULATE_RELEASED_SHIFT) - { - // We needed to simulate released shift - iAmigaKeyCode = iAmigaKeyCode & 0x1ff; - if(shiftWasPressed) - { - uae4all_keystate[AK_LSH] = 1; - record_key(AK_LSH << 1); - shiftWasPressed = 0; - } - } -#endif - uae4all_keystate[iAmigaKeyCode] = 0; - record_key((iAmigaKeyCode << 1) | 1); - } - } - break; - - case SDL_MOUSEBUTTONDOWN: - if (currprefs.pandora_custom_dpad < 2) - buttonstate[(rEvent.button.button-1)%3] = 1; - break; - - case SDL_MOUSEBUTTONUP: - if (currprefs.pandora_custom_dpad < 2) - buttonstate[(rEvent.button.button-1)%3] = 0; - break; - - case SDL_MOUSEMOTION: - if(currprefs.pandora_custom_dpad == 2) - { - lastmx = rEvent.motion.x*2 - currprefs.pandora_stylusOffset + stylusAdjustX >> 1; - lastmy = rEvent.motion.y*2 - currprefs.pandora_stylusOffset + stylusAdjustY >> 1; - //mouseMoving = 1; - } - else if(slow_mouse) - { - lastmx += rEvent.motion.xrel; - lastmy += rEvent.motion.yrel; - if(rEvent.motion.x == 0) - lastmx -= 2; - if(rEvent.motion.y == 0) - lastmy -= 2; - if(rEvent.motion.x == currprefs.gfx_size.width - 1) - lastmx += 2; - if(rEvent.motion.y == currprefs.gfx_size.height - 1) - lastmy += 2; - } - else - { - int mouseScale = currprefs.input_joymouse_multiplier / 2; - - lastmx += rEvent.motion.xrel * mouseScale; - lastmy += rEvent.motion.yrel * mouseScale; - if(rEvent.motion.x == 0) - lastmx -= mouseScale * 4; - if(rEvent.motion.y == 0) - lastmy -= mouseScale * 4; - if(rEvent.motion.x == currprefs.gfx_size.width - 1) - lastmx += mouseScale * 4; - if(rEvent.motion.y == currprefs.gfx_size.height - 1) - lastmy += mouseScale * 4; - } - newmousecounters = 1; - break; - } - } -} - -void uae_set_thread_priority (int pri) -{ -} diff --git a/src/osdep/pandora_filesys.cpp b/src/osdep/pandora_filesys.cpp deleted file mode 100644 index bcea631d..00000000 --- a/src/osdep/pandora_filesys.cpp +++ /dev/null @@ -1,126 +0,0 @@ -#include -#include -#include -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "zfile.h" - - -void filesys_init( void ) -{ -} - - -int my_existsfile (const char *name) -{ - struct stat st; - if (lstat (name, &st) == -1) { - return 0; - } else { - if (!S_ISDIR(st.st_mode)) - return 1; - } - return 0; -} - - -int my_existsdir(const char *name) -{ - struct stat st; - - if(lstat(name, &st) == -1) { - return 0; - } else { - if (S_ISDIR(st.st_mode)) - return 1; - } - return 0; -} - - -void *my_opendir (const char* name) -{ - return opendir(name); -} - - -void my_closedir (void* dir) -{ - closedir((DIR *) dir); -} - - -int my_readdir (void* dir, char* name) -{ - struct dirent *de; - - if (!dir) - return 0; - - de = readdir((DIR *) dir); - if(de == 0) - return 0; - strncpy(name, de->d_name, MAX_PATH); - return 1; -} - - -int my_rmdir (const char*name) -{ - return rmdir(name); -} - - -int my_mkdir (const char*name) -{ - return mkdir(name, 0777); -} - - -int my_unlink (const char* name) -{ - return unlink(name); -} - - -int my_rename (const char* oldname, const char* newname) -{ - return rename(oldname, newname); -} - - -void *my_open (const char* name, int flags) -{ - return (void *) open(name, flags); -} - - -void my_close (void* f) -{ - close((int) f); -} - - -unsigned int my_lseek (void* f, unsigned int offset, int pos) -{ - return lseek((int) f, offset, pos); -} - - -unsigned int my_read (void* f, void* b, unsigned int len) -{ - return read((int) f, b, len); -} - - -unsigned int my_write (void* f, void* b, unsigned int len) -{ - return write((int) f, b, len); -} - - -int my_truncate (const char *name, long int len) -{ - return truncate(name, len); -} diff --git a/src/osdep/pandora_gfx.cpp b/src/osdep/pandora_gfx.cpp deleted file mode 100644 index e240ec68..00000000 --- a/src/osdep/pandora_gfx.cpp +++ /dev/null @@ -1,465 +0,0 @@ -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "uae.h" -#include "options.h" -#include "gui.h" -#include "xwin.h" -#include "custom.h" -#include "drawing.h" -#include "events.h" -#include "osdep/inputmode.h" -#include "savestate.h" - -#include -#include -#include -#include -#ifdef ANDROIDSDL -#include -#endif - -extern int stylusClickOverride; - - -/* SDL variable for output of emulation and menu */ -SDL_Surface *prSDLScreen = NULL; -uae_u16 *prSDLScreenPixels; -static SDL_Surface *current_screenshot = NULL; -static int curr_layer_width = 0; - -static char screenshot_filename_default[255]={ - '/', 't', 'm', 'p', '/', 'n', 'u', 'l', 'l', '.', 'p', 'n', 'g', '\0' -}; -char *screenshot_filename=(char *)&screenshot_filename_default[0]; -FILE *screenshot_file=NULL; -static void CreateScreenshot(void); -static int save_thumb(char *path); -int delay_savestate_frame = 0; - -#define VIDEO_FLAGS_INIT SDL_SWSURFACE|SDL_FULLSCREEN -#ifdef ANDROIDSDL -#define VIDEO_FLAGS VIDEO_FLAGS_INIT -#else -#define VIDEO_FLAGS VIDEO_FLAGS_INIT | SDL_DOUBLEBUF -#endif - -int justClicked = 0; -int mouseMoving = 0; -int fcounter = 0; -int doStylusRightClick = 0; - -static unsigned long previous_synctime = 0; -static unsigned long next_synctime = 0; - - -int graphics_setup (void) -{ - return 1; -} - - -void InitAmigaVidMode(struct uae_prefs *p) -{ - /* Initialize structure for Amiga video modes */ - gfxvidinfo.pixbytes = 2; - gfxvidinfo.bufmem = (uae_u8 *)prSDLScreen->pixels; - gfxvidinfo.linemem = 0; - gfxvidinfo.emergmem = 0; - gfxvidinfo.width = p->gfx_size.width; - gfxvidinfo.height = p->gfx_size.height; - gfxvidinfo.maxblocklines = 0; - gfxvidinfo.rowbytes = prSDLScreen->pitch; -} - - -void graphics_subshutdown (void) -{ - SDL_FreeSurface(prSDLScreen); - prSDLScreen = NULL; -} - - -static void CalcPandoraWidth(struct uae_prefs *p) -{ - int amigaWidth = p->gfx_size.width; - int amigaHeight = p->gfx_size.height; - int pandHeight = 480; - - if(amigaWidth > 600) - amigaWidth = amigaWidth / 2; // Hires selected, but we calc in lores - int pandWidth = (amigaWidth * pandHeight) / amigaHeight; - pandWidth = pandWidth & (~1); - if((pandWidth * amigaHeight) / pandHeight < amigaWidth) - pandWidth += 2; - if(pandWidth > 800) - pandWidth = 800; - p->gfx_size_fs.width = pandWidth; -} - - -void update_display(struct uae_prefs *p) -{ - if(prSDLScreen != NULL) - graphics_subshutdown(); - - CalcPandoraWidth(p); - if(curr_layer_width != p->gfx_size_fs.width) - { - char layersize[20]; - snprintf(layersize, 20, "%dx480", p->gfx_size_fs.width); - -#ifndef WIN32 - setenv("SDL_OMAP_LAYER_SIZE", layersize, 1); -#endif - } - -#ifdef ANDROIDSDL - update_onscreen(); -#endif - - if(prSDLScreen == NULL || prSDLScreen->w != p->gfx_size.width || prSDLScreen->h != p->gfx_size.height) - { -#if defined(PANDORA) && !defined(WIN32) - prSDLScreen = SDL_SetVideoMode(p->gfx_size.width, p->gfx_size.height, 16, SDL_SWSURFACE|SDL_FULLSCREEN|SDL_DOUBLEBUF); -#elif defined(PANDORA) && defined(WIN32) - prSDLScreen = SDL_SetVideoMode(p->gfx_size.width, p->gfx_size.height, 16, SDL_SWSURFACE|SDL_DOUBLEBUF); -#else - prSDLScreen = SDL_SetVideoMode(p->gfx_size.width, p->gfx_size.height, 16, SDL_SWSURFACE|SDL_FULLSCREEN); -#endif - } - SDL_ShowCursor(SDL_DISABLE); - - InitAmigaVidMode(p); - init_row_map(); - framecnt = 1; // Don't draw frame before reset done -} - - -int check_prefs_changed_gfx (void) -{ - int changed = 0; - - if(currprefs.gfx_size.height != changed_prefs.gfx_size.height || - currprefs.gfx_size.width != changed_prefs.gfx_size.width || - currprefs.gfx_size_fs.width != changed_prefs.gfx_size_fs.width) - { - cfgfile_configuration_change(1); - currprefs.gfx_size.height = changed_prefs.gfx_size.height; - currprefs.gfx_size.width = changed_prefs.gfx_size.width; - currprefs.gfx_size_fs.width = changed_prefs.gfx_size_fs.width; - update_display(&currprefs); - changed = 1; - } - if (currprefs.leds_on_screen != changed_prefs.leds_on_screen || - currprefs.pandora_vertical_offset != changed_prefs.pandora_vertical_offset) - { - currprefs.leds_on_screen = changed_prefs.leds_on_screen; - currprefs.pandora_vertical_offset = changed_prefs.pandora_vertical_offset; - changed = 1; - } - if (currprefs.chipset_refreshrate != changed_prefs.chipset_refreshrate) - { - currprefs.chipset_refreshrate = changed_prefs.chipset_refreshrate; - init_hz (); - changed = 1; - } - - return changed; -} - - -int lockscr (void) -{ - SDL_LockSurface(prSDLScreen); - return 1; -} - - -void unlockscr (void) -{ - SDL_UnlockSurface(prSDLScreen); -} - - -void flush_block () -{ - SDL_UnlockSurface (prSDLScreen); - - if (show_inputmode) - inputmode_redraw(); - - if (savestate_state == STATE_DOSAVE) - { - if(delay_savestate_frame > 0) - --delay_savestate_frame; - else - { - CreateScreenshot(); - save_thumb(screenshot_filename); - savestate_state = 0; - } - } - - unsigned long start = read_processor_time(); - if(start < next_synctime && next_synctime - start > time_per_frame - 1000) - usleep((next_synctime - start) - 1000); - SDL_Flip(prSDLScreen); - last_synctime = read_processor_time(); - - if(last_synctime - next_synctime > time_per_frame - 1000) - adjust_idletime(0); - else - adjust_idletime(next_synctime - start); - - if(last_synctime - next_synctime > time_per_frame - 5000) - next_synctime = last_synctime + time_per_frame * (1 + currprefs.gfx_framerate); - else - next_synctime = next_synctime + time_per_frame * (1 + currprefs.gfx_framerate); - - SDL_LockSurface (prSDLScreen); - - if(stylusClickOverride) - { - justClicked = 0; - mouseMoving = 0; - } - else - { - if(justClicked) - { - buttonstate[0] = 0; - buttonstate[2] = 0; - justClicked = 0; - } - - if(mouseMoving) - { - if(fcounter >= currprefs.pandora_tapDelay) - { - if(doStylusRightClick) - { - buttonstate[2] = 1; - } - else - { - buttonstate[0] = 1; - mouseMoving = 0; - justClicked = 1; - fcounter = 0; - } - } - fcounter++; - } - } - init_row_map(); -} - - -void black_screen_now(void) -{ - SDL_FillRect(prSDLScreen,NULL,0); - SDL_Flip(prSDLScreen); -} - - -static void graphics_subinit (void) -{ - if (prSDLScreen == NULL) - { - fprintf(stderr, "Unable to set video mode: %s\n", SDL_GetError()); - return; - } - else - { - prSDLScreenPixels=(uae_u16 *)prSDLScreen->pixels; - SDL_LockSurface(prSDLScreen); - SDL_UnlockSurface(prSDLScreen); - SDL_Flip(prSDLScreen); - SDL_ShowCursor(SDL_DISABLE); - - InitAmigaVidMode(&currprefs); - } - lastmx = lastmy = 0; - newmousecounters = 0; -} - -STATIC_INLINE int bitsInMask (unsigned long mask) -{ - /* count bits in mask */ - int n = 0; - while (mask) - { - n += mask & 1; - mask >>= 1; - } - return n; -} - - -STATIC_INLINE int maskShift (unsigned long mask) -{ - /* determine how far mask is shifted */ - int n = 0; - while (!(mask & 1)) - { - n++; - mask >>= 1; - } - return n; -} - - -static int init_colors (void) -{ - int i; - int red_bits, green_bits, blue_bits; - int red_shift, green_shift, blue_shift; - - /* Truecolor: */ - red_bits = bitsInMask(prSDLScreen->format->Rmask); - green_bits = bitsInMask(prSDLScreen->format->Gmask); - blue_bits = bitsInMask(prSDLScreen->format->Bmask); - red_shift = maskShift(prSDLScreen->format->Rmask); - green_shift = maskShift(prSDLScreen->format->Gmask); - blue_shift = maskShift(prSDLScreen->format->Bmask); - alloc_colors64k (red_bits, green_bits, blue_bits, red_shift, green_shift, blue_shift, 0); - for (i = 0; i < 4096; i++) - xcolors[i] = xcolors[i] * 0x00010001; - - return 1; -} - - -int graphics_init (void) -{ - int i,j; - - graphics_subinit (); - - init_row_map (); - - if (!init_colors ()) - return 0; - - buttonstate[0] = buttonstate[1] = buttonstate[2] = 0; - keyboard_init(); - - return 1; -} - -void graphics_leave (void) -{ - graphics_subshutdown (); - SDL_VideoQuit(); - //dumpcustom (); -} - - -#define systemRedShift (prSDLScreen->format->Rshift) -#define systemGreenShift (prSDLScreen->format->Gshift) -#define systemBlueShift (prSDLScreen->format->Bshift) -#define systemRedMask (prSDLScreen->format->Rmask) -#define systemGreenMask (prSDLScreen->format->Gmask) -#define systemBlueMask (prSDLScreen->format->Bmask) - -static int save_png(SDL_Surface* surface, char *path) -{ - int w = surface->w; - int h = surface->h; - unsigned char * pix = (unsigned char *)surface->pixels; - unsigned char writeBuffer[1024 * 3]; - FILE *f = fopen(path,"wb"); - if(!f) return 0; - png_structp png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, - NULL, - NULL, - NULL); - if(!png_ptr) { - fclose(f); - return 0; - } - - png_infop info_ptr = png_create_info_struct(png_ptr); - - if(!info_ptr) { - png_destroy_write_struct(&png_ptr,NULL); - fclose(f); - return 0; - } - - png_init_io(png_ptr,f); - - png_set_IHDR(png_ptr, - info_ptr, - w, - h, - 8, - PNG_COLOR_TYPE_RGB, - PNG_INTERLACE_NONE, - PNG_COMPRESSION_TYPE_DEFAULT, - PNG_FILTER_TYPE_DEFAULT); - - png_write_info(png_ptr,info_ptr); - - unsigned char *b = writeBuffer; - - int sizeX = w; - int sizeY = h; - int y; - int x; - - unsigned short *p = (unsigned short *)pix; - for(y = 0; y < sizeY; y++) - { - for(x = 0; x < sizeX; x++) - { - unsigned short v = p[x]; - - *b++ = ((v & systemRedMask ) >> systemRedShift ) << 3; // R - *b++ = ((v & systemGreenMask) >> systemGreenShift) << 2; // G - *b++ = ((v & systemBlueMask ) >> systemBlueShift ) << 3; // B - } - p += surface->pitch / 2; - png_write_row(png_ptr,writeBuffer); - b = writeBuffer; - } - - png_write_end(png_ptr, info_ptr); - - png_destroy_write_struct(&png_ptr, &info_ptr); - - fclose(f); - return 1; -} - - -static void CreateScreenshot(void) -{ - int w, h; - - if(current_screenshot != NULL) - { - SDL_FreeSurface(current_screenshot); - current_screenshot = NULL; - } - - w=prSDLScreen->w; - h=prSDLScreen->h; - - current_screenshot = SDL_CreateRGBSurface(prSDLScreen->flags,w,h,prSDLScreen->format->BitsPerPixel,prSDLScreen->format->Rmask,prSDLScreen->format->Gmask,prSDLScreen->format->Bmask,prSDLScreen->format->Amask); - SDL_BlitSurface(prSDLScreen, NULL, current_screenshot, NULL); -} - - -static int save_thumb(char *path) -{ - int ret = 0; - if(current_screenshot != NULL) - { - ret = save_png(current_screenshot, path); - SDL_FreeSurface(current_screenshot); - current_screenshot = NULL; - } - return ret; -} diff --git a/src/osdep/pandora_gui.cpp b/src/osdep/pandora_gui.cpp deleted file mode 100644 index 26c45065..00000000 --- a/src/osdep/pandora_gui.cpp +++ /dev/null @@ -1,1316 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "uae.h" -#include "options.h" -#include "keybuf.h" -#include "inputdevice.h" -#include "memory.h" -#include "zfile.h" -#include "gui.h" -#include "osdep/gui/SelectorEntry.hpp" -#include "gui/gui_handling.h" -#include "custom.h" -#include "memory.h" -#include "xwin.h" -#include "drawing.h" -#include "sounddep/sound.h" -#include "audio.h" -#include "keybuf.h" -#include "keyboard.h" -#include "disk.h" -#include "savestate.h" -#include - - -int emulating = 0; -extern bool switch_autofire; -static int justMovedUp=0, justMovedDown=0, justMovedLeft=0, justMovedRight=0; -static int justPressedA=0, justPressedB=0, justPressedX=0, justPressedY=0; -static int justPressedL=0, justPressedR=0; -int stylusClickOverride=0; -int stylusAdjustX=0, stylusAdjustY=0; - - -extern SDL_Surface *prSDLScreen; - -int dpadUp=0; -int dpadDown=0; -int dpadLeft=0; -int dpadRight=0; -int buttonA=0; -int buttonB=0; -int buttonX=0; -int buttonY=0; -int triggerL=0; -int triggerR=0; - -struct gui_msg { - int num; - const char *msg; -}; -struct gui_msg gui_msglist[] = { - { NUMSG_KS68EC020, "Your Kickstart requires a 68EC020 or later CPU." }, - { NUMSG_KS68020, "Your Kickstart requires a 68020 CPU or later CPU." }, - { -1, "" } -}; - -std::vector ConfigFilesList; -std::vector lstAvailableROMs; -std::vector lstMRUDiskList; - - -void AddFileToDiskList(const char *file, int moveToTop) -{ - int i; - - for(i=0; i= lstMRUDiskList.size()) - lstMRUDiskList.insert(lstMRUDiskList.begin(), file); - - while(lstMRUDiskList.size() > MAX_MRU_DISKLIST) - lstMRUDiskList.pop_back(); -} - - -static void ClearAvailableROMList(void) -{ - while(lstAvailableROMs.size() > 0) - { - AvailableROM *tmp = lstAvailableROMs[0]; - lstAvailableROMs.erase(lstAvailableROMs.begin()); - delete tmp; - } -} - -static void addrom(struct romdata *rd, char *path) -{ - AvailableROM *tmp; - tmp = new AvailableROM(); - strncpy(tmp->Name, rd->name, MAX_PATH); - strncpy(tmp->Path, path, MAX_PATH); - tmp->ROMType = rd->type; - lstAvailableROMs.push_back(tmp); -} - -struct romscandata { - uae_u8 *keybuf; - int keysize; -}; - -static struct romdata *scan_single_rom_2 (struct zfile *f, uae_u8 *keybuf, int keysize) -{ - uae_u8 buffer[20] = { 0 }; - uae_u8 *rombuf; - int cl = 0, size; - struct romdata *rd = 0; - - zfile_fseek (f, 0, SEEK_END); - size = zfile_ftell (f); - zfile_fseek (f, 0, SEEK_SET); - if (size > 1760 * 512) /* don't skip KICK disks */ - return 0; - zfile_fread (buffer, 1, 11, f); - if (!memcmp (buffer, "KICK", 4)) { - zfile_fseek (f, 512, SEEK_SET); - if (size > 262144) - size = 262144; - } else if (!memcmp (buffer, "AMIROMTYPE1", 11)) { - cl = 1; - if (keybuf == 0) - cl = -1; - size -= 11; - } else { - zfile_fseek (f, 0, SEEK_SET); - } - rombuf = (uae_u8 *) xcalloc (size, 1); - if (!rombuf) - return 0; - zfile_fread (rombuf, 1, size, f); - if (cl > 0) { - decode_cloanto_rom_do (rombuf, size, size, keybuf, keysize); - cl = 0; - } - if (!cl) - rd = getromdatabydata (rombuf, size); - free (rombuf); - return rd; -} - -static int scan_rom_2 (struct zfile *f, void *rsd) -{ - struct romdata *rd = scan_single_rom_2(f, ((struct romscandata *)rsd)->keybuf, ((struct romscandata *)rsd)->keysize); - if (rd) - addrom (rd, zfile_getname(f)); - return 1; -} - -static void scan_rom(char *path, uae_u8 *keybuf, int keysize) -{ - struct romdata *rd; - struct romscandata rsd = { keybuf, keysize }; - - rd = getarcadiarombyname(path); - if (rd) - addrom(rd, path); - else - zfile_zopen (path, scan_rom_2, &rsd); -} - - -void RescanROMs(void) -{ - int keysize; - uae_u8 *keybuf; - std::vector files; - char path[MAX_DPATH]; - - ClearAvailableROMList(); - fetch_rompath(path, MAX_DPATH); - - keybuf = load_keyfile (&changed_prefs, path, &keysize); - ReadDirectory(path, NULL, &files); - for(int i=0; i 0) - { - ConfigFileInfo *tmp = ConfigFilesList[0]; - ConfigFilesList.erase(ConfigFilesList.begin()); - delete tmp; - } -} - - -void ReadConfigFileList(void) -{ - char path[MAX_PATH]; - std::vector files; - const char *filter_uae[] = { ".uae", "\0" }; - const char *filter_conf[] = { ".conf", "\0" }; - - ClearConfigFileList(); - - fetch_configurationpath(path, MAX_PATH); - ReadDirectory(path, NULL, &files); - FilterFiles(&files, filter_uae); - for (int i=0; iFullPath, path, MAX_DPATH); - strcat(tmp->FullPath, files[i].c_str()); - strncpy(tmp->Name, files[i].c_str(), MAX_DPATH); - removeFileExtension(tmp->Name); - cfgfile_get_description(tmp->FullPath, tmp->Description); - ConfigFilesList.push_back(tmp); - } - - // Read also old style configs - ReadDirectory(path, NULL, &files); - FilterFiles(&files, filter_conf); - for (int i=0; iFullPath, path, MAX_DPATH); - strcat(tmp->FullPath, files[i].c_str()); - strncpy(tmp->Name, files[i].c_str(), MAX_DPATH); - removeFileExtension(tmp->Name); - strcpy(tmp->Description, "Old style configuration file"); - for(int j=0; jName, tmp->Name)) - { - // Config in new style already in list - delete tmp; - tmp = NULL; - break; - } - } - if(tmp != NULL) - ConfigFilesList.push_back(tmp); - } - } -} - -ConfigFileInfo* SearchConfigInList(const char *name) -{ - for(int i=0; iName, name, MAX_DPATH)) - return ConfigFilesList[i]; - } - return NULL; -} - - -int gui_init (void) -{ - int ret = 0; - -#ifndef ANDROIDSDL - SDL_JoystickEventState(SDL_ENABLE); - SDL_JoystickOpen(0); -#endif - - emulating=0; - - if(lstAvailableROMs.size() == 0) - RescanROMs(); - - graphics_subshutdown(); - run_gui(); - if(quit_program < 0) - quit_program = -quit_program; - if(quit_program == 1) - ret = -2; // Quit without start of emulator - - setCpuSpeed(); - update_display(&changed_prefs); - - inputmode_init(); - inputdevice_copyconfig (&changed_prefs, &currprefs); - inputdevice_config_change_test(); - emulating=1; - return ret; -} - -void gui_exit(void) -{ - resetCpuSpeed(); - sync(); - pandora_stop_sound(); - saveAdfDir(); - ClearConfigFileList(); - ClearAvailableROMList(); -} - - -void gui_purge_events(void) -{ - SDL_Event event; - SDL_Delay(150); - while(SDL_PollEvent(&event)) - SDL_Delay(10); - keybuf_init(); -} - - -int gui_update (void) -{ - char tmp[MAX_PATH]; - - fetch_savestatepath(savestate_fname, MAX_DPATH); - fetch_screenshotpath(screenshot_filename, MAX_DPATH); - - if(strlen(currprefs.df[0]) > 0) - extractFileName(currprefs.df[0], tmp); - else - strncpy(tmp, last_loaded_config, MAX_PATH); - - strncat(savestate_fname, tmp, MAX_DPATH); - strncat(screenshot_filename, tmp, MAX_DPATH); - removeFileExtension(savestate_fname); - removeFileExtension(screenshot_filename); - - switch(currentStateNum) - { - case 1: - strcat(savestate_fname,"-1.uss"); - strcat(screenshot_filename,"-1.png"); - break; - case 2: - strcat(savestate_fname,"-2.uss"); - strcat(screenshot_filename,"-2.png"); - break; - case 3: - strcat(savestate_fname,"-3.uss"); - strcat(screenshot_filename,"-3.png"); - break; - default: - strcat(savestate_fname,".uss"); - strcat(screenshot_filename,".png"); - } - return 0; -} - - -static void goMenu(void) -{ - if (quit_program != 0) - return; - emulating=1; - pause_sound(); - - if(lstAvailableROMs.size() == 0) - RescanROMs(); - graphics_subshutdown(); - run_gui(); - setCpuSpeed(); - update_display(&changed_prefs); - - /* Clear menu garbage at the bottom of the screen */ - black_screen_now(); - notice_screen_contents_lost(); - resume_sound(); - - inputdevice_copyconfig (&changed_prefs, &currprefs); - inputdevice_config_change_test (); - - gui_update (); - - gui_purge_events(); - fpscounter_reset(); - notice_screen_contents_lost(); -} - - -static int customKey[256] = - { 0, AK_UP, AK_DN, AK_LF, AK_RT, AK_NP0, AK_NP1, AK_NP2, /* 0 - 7 */ - AK_NP3, AK_NP4, AK_NP5, AK_NP6, AK_NP7, AK_NP8, AK_NP9, AK_ENT, /* 8 - 15 */ - AK_NPDIV, AK_NPMUL, AK_NPSUB, AK_NPADD, AK_NPDEL, AK_NPLPAREN, AK_NPRPAREN, AK_SPC, /* 16 - 23 */ - AK_BS, AK_TAB, AK_RET, AK_ESC, AK_DEL, AK_LSH, AK_RSH, AK_CAPSLOCK, /* 24 - 31 */ - AK_CTRL, AK_LALT, AK_RALT, AK_LAMI, AK_RAMI, AK_HELP, AK_LBRACKET, AK_RBRACKET, /* 32 - 39 */ - AK_SEMICOLON, AK_COMMA, AK_PERIOD, AK_SLASH, AK_BACKSLASH, AK_QUOTE, AK_NUMBERSIGN, AK_LTGT, /* 40 - 47 */ - AK_BACKQUOTE, AK_MINUS, AK_EQUAL, AK_A, AK_B, AK_C, AK_D, AK_E, /* 48 - 55 */ - AK_F, AK_G, AK_H, AK_I, AK_J, AK_K, AK_L, AK_M, /* 56 - 63 */ - AK_N, AK_O, AK_P, AK_Q, AK_R, AK_S, AK_T, AK_U, /* 64 - 71 */ - AK_V, AK_W, AK_X, AK_Y, AK_Z, AK_1, AK_2, AK_3, /* 72 - 79 */ - AK_4, AK_5, AK_6, AK_7, AK_8, AK_9, AK_0, AK_F1, /* 80 - 87 */ - AK_F2, AK_F3, AK_F4, AK_F5, AK_F6, AK_F7, AK_F8, AK_F9, /* 88 - 95 */ - AK_F10, 0 }; /* 96 - 97 */ - -static int getMapping(int customId) -{ - if(customId > 96) - return 0; - else - return customKey[customId]; -} - -void moveVertical(int value) -{ - changed_prefs.pandora_vertical_offset += value; - if(changed_prefs.pandora_vertical_offset < -16) - changed_prefs.pandora_vertical_offset = -16; - else if(changed_prefs.pandora_vertical_offset > 16) - changed_prefs.pandora_vertical_offset = 16; -} - -void gui_handle_events (void) -{ - int i; - int key = 0; - - Uint8 *keystate = SDL_GetKeyState(NULL); - dpadUp = keystate[SDLK_UP]; - dpadDown = keystate[SDLK_DOWN]; - dpadLeft = keystate[SDLK_LEFT]; - dpadRight = keystate[SDLK_RIGHT]; - buttonA = keystate[SDLK_HOME]; - buttonB = keystate[SDLK_END]; - buttonX = keystate[SDLK_PAGEDOWN]; - buttonY = keystate[SDLK_PAGEUP]; - triggerL = keystate[SDLK_RSHIFT]; - triggerR = keystate[SDLK_RCTRL]; - - if(keystate[SDLK_LCTRL]) - goMenu(); - - //L + R - if(triggerL && triggerR) - { - //up - if(dpadUp) - { - moveVertical(1); - stylusAdjustY += 2; - } - //down - else if(dpadDown) - { - moveVertical(-1); - stylusAdjustY -= 2; - } - //1 - else if(keystate[SDLK_1]) - { - changed_prefs.gfx_size.height = amigaheight_values[0]; - update_display(&changed_prefs); - } - //2 - else if(keystate[SDLK_2]) - { - changed_prefs.gfx_size.height = amigaheight_values[1]; - update_display(&changed_prefs); - } - //3 - else if(keystate[SDLK_3]) - { - changed_prefs.gfx_size.height = amigaheight_values[2]; - update_display(&changed_prefs); - } - //4 - else if(keystate[SDLK_4]) - { - changed_prefs.gfx_size.height = amigaheight_values[3]; - update_display(&changed_prefs); - } - //5 - else if(keystate[SDLK_5]) - { - changed_prefs.gfx_size.height = amigaheight_values[4]; - update_display(&changed_prefs); - } - //6 - else if(keystate[SDLK_6]) - { - changed_prefs.gfx_size.height = amigaheight_values[5]; - update_display(&changed_prefs); - } - //9 - else if(keystate[SDLK_9]) - { - for(i=0; i 0) - changed_prefs.gfx_size.height = amigaheight_values[i - 1]; - else - changed_prefs.gfx_size.height = amigaheight_values[AMIGAHEIGHT_COUNT - 1]; - break; - } - } - update_display(&changed_prefs); - } - //0 - else if(keystate[SDLK_0]) - { - for(i=0; i 0) - { - key = getMapping(currprefs.pandora_custom_up); - uae4all_keystate[key] = 1; - record_key(key << 1); - } - justMovedUp=1; - } - } - else if(justMovedUp) - { - if(currprefs.pandora_custom_up == -1) buttonstate[0]=0; - else if(currprefs.pandora_custom_up == -2) buttonstate[2]=0; - else if(currprefs.pandora_custom_up > 0) - { - key = getMapping(currprefs.pandora_custom_up); - uae4all_keystate[key] = 0; - record_key((key << 1) | 1); - } - justMovedUp=0; - } - - //DOWN - if(dpadDown) - { - if(!justMovedDown) - { - if(currprefs.pandora_custom_down == -1) buttonstate[0]=1; - else if(currprefs.pandora_custom_down == -2) buttonstate[2]=1; - else if(currprefs.pandora_custom_down > 0) - { - key = getMapping(currprefs.pandora_custom_down); - uae4all_keystate[key] = 1; - record_key(key << 1); - } - justMovedDown=1; - } - } - else if(justMovedDown) - { - if(currprefs.pandora_custom_down == -1) buttonstate[0]=0; - else if(currprefs.pandora_custom_down == -2) buttonstate[2]=0; - else if(currprefs.pandora_custom_down > 0) - { - key = getMapping(currprefs.pandora_custom_down); - uae4all_keystate[key] = 0; - record_key((key << 1) | 1); - } - justMovedDown=0; - } - - //LEFT - if(dpadLeft) - { - if(!justMovedLeft) - { - if(currprefs.pandora_custom_left == -1) buttonstate[0]=1; - else if(currprefs.pandora_custom_left == -2) buttonstate[2]=1; - else if(currprefs.pandora_custom_left > 0) - { - key = getMapping(currprefs.pandora_custom_left); - uae4all_keystate[key] = 1; - record_key(key << 1); - } - justMovedLeft=1; - } - } - else if(justMovedLeft) - { - if(currprefs.pandora_custom_left == -1) buttonstate[0]=0; - else if(currprefs.pandora_custom_left == -2) buttonstate[2]=0; - else if(currprefs.pandora_custom_left > 0) - { - key = getMapping(currprefs.pandora_custom_left); - uae4all_keystate[key] = 0; - record_key((key << 1) | 1); - } - justMovedLeft=0; - } - - //RIGHT - if(dpadRight) - { - if(!justMovedRight) - { - if(currprefs.pandora_custom_right == -1) buttonstate[0]=1; - else if(currprefs.pandora_custom_right == -2) buttonstate[2]=1; - else if(currprefs.pandora_custom_right > 0) - { - key = getMapping(currprefs.pandora_custom_right); - uae4all_keystate[key] = 1; - record_key(key << 1); - } - justMovedRight=1; - } - } - else if(justMovedRight) - { - if(currprefs.pandora_custom_right == -1) buttonstate[0]=0; - else if(currprefs.pandora_custom_right == -2) buttonstate[2]=0; - else if(currprefs.pandora_custom_right > 0) - { - key = getMapping(currprefs.pandora_custom_right); - uae4all_keystate[key] = 0; - record_key((key << 1) | 1); - } - justMovedRight=0; - } - } - - //(A) - if(buttonA) - { - if(!justPressedA) - { - if(currprefs.pandora_custom_A == -1) buttonstate[0]=1; - else if(currprefs.pandora_custom_A == -2) buttonstate[2]=1; - else if(currprefs.pandora_custom_A > 0) - { - key = getMapping(currprefs.pandora_custom_A); - uae4all_keystate[key] = 1; - record_key(key << 1); - } - justPressedA=1; - } - } - else if(justPressedA) - { - if(currprefs.pandora_custom_A == -1) buttonstate[0]=0; - else if(currprefs.pandora_custom_A == -2) buttonstate[2]=0; - else if(currprefs.pandora_custom_A > 0) - { - key = getMapping(currprefs.pandora_custom_A); - uae4all_keystate[key] = 0; - record_key((key << 1) | 1); - } - justPressedA=0; - } - - //(B) - if(buttonB) - { - if(!justPressedB) - { - if(currprefs.pandora_custom_B == -1) buttonstate[0]=1; - else if(currprefs.pandora_custom_B == -2) buttonstate[2]=1; - else if(currprefs.pandora_custom_B > 0) - { - key = getMapping(currprefs.pandora_custom_B); - uae4all_keystate[key] = 1; - record_key(key << 1); - } - justPressedB=1; - } - } - else if(justPressedB) - { - if(currprefs.pandora_custom_B == -1) buttonstate[0]=0; - else if(currprefs.pandora_custom_B == -2) buttonstate[2]=0; - else if(currprefs.pandora_custom_B > 0) - { - key = getMapping(currprefs.pandora_custom_B); - uae4all_keystate[key] = 0; - record_key((key << 1) | 1); - } - justPressedB=0; - } - - //(X) - if(buttonX) - { - if(!justPressedX) - { - if(currprefs.pandora_custom_X == -1) buttonstate[0]=1; - else if(currprefs.pandora_custom_X == -2) buttonstate[2]=1; - else if(currprefs.pandora_custom_X > 0) - { - key = getMapping(currprefs.pandora_custom_X); - uae4all_keystate[key] = 1; - record_key(key << 1); - } - justPressedX=1; - } - } - else if(justPressedX) - { - if(currprefs.pandora_custom_X == -1) buttonstate[0]=0; - else if(currprefs.pandora_custom_X == -2) buttonstate[2]=0; - else if(currprefs.pandora_custom_X > 0) - { - key = getMapping(currprefs.pandora_custom_X); - uae4all_keystate[key] = 0; - record_key((key << 1) | 1); - } - justPressedX=0; - } - - //(Y) - if(buttonY) - { - if(!justPressedY) - { - if(currprefs.pandora_custom_Y == -1) buttonstate[0]=1; - else if(currprefs.pandora_custom_Y == -2) buttonstate[2]=1; - else if(currprefs.pandora_custom_Y > 0) - { - key = getMapping(currprefs.pandora_custom_Y); - uae4all_keystate[key] = 1; - record_key(key << 1); - } - justPressedY=1; - } - } - else if(justPressedY) - { - if(currprefs.pandora_custom_Y == -1) buttonstate[0]=0; - else if(currprefs.pandora_custom_Y == -2) buttonstate[2]=0; - else if(currprefs.pandora_custom_Y > 0) - { - key = getMapping(currprefs.pandora_custom_Y); - uae4all_keystate[key] = 0; - record_key((key << 1) | 1); - } - justPressedY=0; - } - - //(L) - if(triggerL) - { - if(!justPressedL) - { - if(currprefs.pandora_custom_L == -1) buttonstate[0]=1; - else if(currprefs.pandora_custom_L == -2) buttonstate[2]=1; - else if(currprefs.pandora_custom_L > 0) - { - key = getMapping(currprefs.pandora_custom_L); - uae4all_keystate[key] = 1; - record_key(key << 1); - } - justPressedL=1; - } - } - else if(justPressedL) - { - if(currprefs.pandora_custom_L == -1) buttonstate[0]=0; - else if(currprefs.pandora_custom_L == -2) buttonstate[2]=0; - else if(currprefs.pandora_custom_L > 0) - { - key = getMapping(currprefs.pandora_custom_L); - uae4all_keystate[key] = 0; - record_key((key << 1) | 1); - } - justPressedL=0; - } - - //(R) - if(triggerR) - { - if(!justPressedR) - { - if(currprefs.pandora_custom_R == -1) buttonstate[0]=1; - else if(currprefs.pandora_custom_R == -2) buttonstate[2]=1; - else if(currprefs.pandora_custom_R > 0) - { - key = getMapping(currprefs.pandora_custom_R); - uae4all_keystate[key] = 1; - record_key(key << 1); - } - justPressedR=1; - } - } - else if(justPressedR) - { - if(currprefs.pandora_custom_R == -1) buttonstate[0]=0; - else if(currprefs.pandora_custom_R == -2) buttonstate[2]=0; - else if(currprefs.pandora_custom_R > 0) - { - key = getMapping(currprefs.pandora_custom_R); - uae4all_keystate[key] = 0; - record_key((key << 1) | 1); - } - justPressedR=0; - } - } - - else // Custom controls not active - { - if(currprefs.pandora_custom_dpad < 2 && triggerR) - { - //R+dpad = arrow keys in joystick and mouse mode - //dpad up - if(dpadUp) - { - if(!justMovedUp) - { - //arrow up - uae4all_keystate[AK_UP] = 1; - record_key(AK_UP << 1); - justMovedUp=1; - } - } - else if(justMovedUp) - { - //arrow up - uae4all_keystate[AK_UP] = 0; - record_key((AK_UP << 1) | 1); - justMovedUp=0; - } - //dpad down - if(dpadDown) - { - if(!justMovedDown) - { - //arrow down - uae4all_keystate[AK_DN] = 1; - record_key(AK_DN << 1); - justMovedDown=1; - } - } - else if(justMovedDown) - { - //arrow down - uae4all_keystate[AK_DN] = 0; - record_key((AK_DN << 1) | 1); - justMovedDown=0; - } - //dpad left - if(dpadLeft) - { - if(!justMovedLeft) - { - //arrow left - uae4all_keystate[AK_LF] = 1; - record_key(AK_LF << 1); - justMovedLeft=1; - } - } - else if(justMovedLeft) - { - //arrow left - uae4all_keystate[AK_LF] = 0; - record_key((AK_LF << 1) | 1); - justMovedLeft=0; - } - //dpad right - if (dpadRight) - { - if(!justMovedRight) - { - //arrow right - uae4all_keystate[AK_RT] = 1; - record_key(AK_RT << 1); - justMovedRight=1; - } - } - else if(justMovedRight) - { - //arrow right - uae4all_keystate[AK_RT] = 0; - record_key((AK_RT << 1) | 1); - justMovedRight=0; - } - } - - switch(currprefs.pandora_custom_dpad) - { - case 0: // dPad is joystick - // R-trigger emulates some Amiga-Keys - if(triggerR) - { - //(A) button - if(buttonA) - { - if(!justPressedA) - { - //CTRL - uae4all_keystate[AK_CTRL] = 1; - record_key(AK_CTRL << 1); - justPressedA=1; - } - } - else if(justPressedA) - { - uae4all_keystate[AK_CTRL] = 0; - record_key((AK_CTRL << 1) | 1); - justPressedA=0; - } - //(B) button - if(buttonB) - { - if(!justPressedB) - { - //left ALT - uae4all_keystate[AK_LALT] = 1; - record_key(AK_LALT << 1); - justPressedB=1; - } - } - else if(justPressedB) - { - uae4all_keystate[AK_LALT] = 0; - record_key((AK_LALT << 1) | 1); - justPressedB=0; - } - //(X) button - if(buttonX) - { - if(!justPressedX) - { - //HELP - uae4all_keystate[AK_HELP] = 1; - record_key(AK_HELP << 1); - justPressedX=1; - } - } - else if(justPressedX) - { - //HELP - uae4all_keystate[AK_HELP] = 0; - record_key((AK_HELP << 1) | 1); - justPressedX=0; - } - } - // L-trigger emulates left and right mouse button - else if(triggerL) - { - //(A) button - if(buttonA) - { - if(!justPressedA) - { - //left mouse-button down - buttonstate[0] = 1; - justPressedA=1; - } - } - else if(justPressedA) - { - //left mouse-button up - buttonstate[0] = 0; - justPressedA=0; - } - //(B) button - if(buttonB) - { - if(!justPressedB) - { - //right mouse-button down - buttonstate[2] = 1; - justPressedB=1; - } - } - else if(justPressedB) - { - //right mouse-button up - buttonstate[2] = 0; - justPressedB=0; - } - } - - else if(currprefs.pandora_joyConf < 2) - { - // Y-Button mapped to Space - if(buttonY) - { - if(!justPressedY) - { - //SPACE - uae4all_keystate[AK_SPC] = 1; - record_key(AK_SPC << 1); - justPressedY=1; - } - } - else if(justPressedY) - { - //SPACE - uae4all_keystate[AK_SPC] = 0; - record_key((AK_SPC << 1) | 1); - justPressedY=0; - } - } - - break; - - case 1: // dPad is mouse - // A and B emulates mouse buttons - if(buttonA) - { - if(!justPressedA) - { - //left mouse-button down - buttonstate[0] = 1; - justPressedA=1; - } - } - else if(justPressedA) - { - //left mouse-button up - buttonstate[0] = 0; - justPressedA=0; - } - //(B) button - if(buttonB) - { - if(!justPressedB) - { - //right mouse-button down - buttonstate[2] = 1; - justPressedB=1; - } - } - else if(justPressedB) - { - //right mouse-button up - buttonstate[2] = 0; - justPressedB=0; - } - - // Y emulates Space - if(buttonY) - { - if(!justPressedY) - { - //SPACE - uae4all_keystate[AK_SPC] = 1; - record_key(AK_SPC << 1); - justPressedY=1; - } - } - else if(justPressedY) - { - //SPACE - uae4all_keystate[AK_SPC] = 0; - record_key((AK_SPC << 1) | 1); - justPressedY=0; - } - - break; - - case 2: // dPad is custom (stylus) -> dPad decides which mouse button is clicked - //dpad up - if (dpadUp) - { - if(!justMovedUp) - { - //left and right mouse-buttons down - buttonstate[0] = 1; - buttonstate[2] = 1; - stylusClickOverride = 1; - justMovedUp=1; - } - } - else if(justMovedUp) - { - //left and right mouse-buttons up - buttonstate[0] = 0; - buttonstate[2] = 0; - stylusClickOverride = 0; - justMovedUp=0; - } - //dpad down - if (dpadDown) - { - if(!justMovedDown) - { - //no clicks with stylus now - stylusClickOverride=1; - justMovedDown=1; - } - } - else if(justMovedDown) - { - //clicks active again - stylusClickOverride=0; - justMovedDown=0; - } - //dpad left - if (dpadLeft) - { - if(!justMovedLeft) - { - //left mouse-button down - buttonstate[0] = 1; - stylusClickOverride = 1; - justMovedLeft=1; - } - } - else if(justMovedLeft) - { - //left mouse-button up - buttonstate[0] = 0; - stylusClickOverride = 0; - justMovedLeft=0; - } - //dpad right - if (dpadRight) - { - if(!justMovedRight) - { - //right mouse-button down - buttonstate[2] = 1; - stylusClickOverride = 1; - justMovedRight=1; - } - } - else if(justMovedRight) - { - //right mouse-button up - buttonstate[2] = 0; - stylusClickOverride = 0; - justMovedRight=0; - } - - //L + up - if(triggerL && dpadUp) - stylusAdjustY-=2; - //L + down - if(triggerL && dpadDown) - stylusAdjustY+=2; - //L + left - if(triggerL && dpadLeft) - stylusAdjustX-=2; - //L + right - if(triggerL && dpadRight) - stylusAdjustX+=2; - - break; - } - } -} - -void gui_hd_led (int led) -{ - static int resetcounter; - - if (led == 0) { - resetcounter--; - if (resetcounter > 0) - return; - } - gui_data.hd = led; - resetcounter = 2; -} - -void gui_cd_led (int led) -{ -} - -void gui_led (int led, int on) -{ -} - -void gui_filename (int num, const char *name) -{ -} - -void gui_message (const char *format,...) -{ - char msg[2048]; - va_list parms; - - va_start (parms, format); - vsprintf( msg, format, parms ); - va_end (parms); - - InGameMessage(msg); -} - -void notify_user (int msg) -{ - int i=0; - while(gui_msglist[i].num >= 0) - { - if(gui_msglist[i].num == msg) - { - gui_message(gui_msglist[i].msg); - break; - } - ++i; - } -} - - -void gui_lock (void) -{ -} - -void gui_unlock (void) -{ -} - - -void FilterFiles(std::vector *files, const char *filter[]) -{ - for (int q=0; qsize(); q++) - { - std::string tmp = (*files)[q]; - - bool bRemove = true; - for(int f=0; filter[f] != NULL && strlen(filter[f]) > 0; ++f) - { - if(tmp.size() >= strlen(filter[f])) - { - if(!strcasecmp(tmp.substr(tmp.size() - strlen(filter[f])).c_str(), filter[f])) - { - bRemove = false; - break; - } - } - } - - if(bRemove) - { - files->erase(files->begin() + q); - --q; - } - } -} diff --git a/src/osdep/pandora_mem.cpp b/src/osdep/pandora_mem.cpp deleted file mode 100644 index d12f8b3a..00000000 --- a/src/osdep/pandora_mem.cpp +++ /dev/null @@ -1,138 +0,0 @@ -#include "sysconfig.h" -#include "sysdeps.h" -#include "config.h" -#include "autoconf.h" -#include "uae.h" -#include "options.h" -#include "gui.h" -#include "custom.h" -#include "memory.h" -#include -#include - - -uae_u8* natmem_offset = 0; -uae_u32 natmem_size; -static uae_u64 totalAmigaMemSize; -#define MAXAMIGAMEM 0x4000000 // 64 MB (16 MB for standard Amiga stuff, 16 MG RTG, 32 MB Z3 fast) - - -/* -void TestMemMap(void) -{ - void *starting = (void *)0x60000000; - void *base; - void *z3fast; - void *gfx; - - base = mmap(starting, 0x1000000, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - printf("TEST: adr for first 16MB: 0x%08x\n", base); - if(base != MAP_FAILED) - { - z3fast = mmap((void *)((int)base + 0x10000000), 0x2000000, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - printf("TEST: adr for z3fast 32MB: 0x%08x\n", z3fast); - if(z3fast != MAP_FAILED) - { - gfx = mmap((void *)((int)base + 0x12000000), 0x800000, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - printf("TEST: adr for gfx 8MB: 0x%08x\n", gfx); - if(gfx != MAP_FAILED) - { - munmap(gfx, 0x800000); - } - munmap(z3fast, 0x2000000); - } - munmap(base, 0x1000000); - } -} -*/ - - -void free_AmigaMem(void) -{ - if(natmem_offset != 0) - { - free(natmem_offset); - natmem_offset = 0; - } -} - - -void alloc_AmigaMem(void) -{ - int i; - uae_u64 total; - uae_u32 max_allowed_mman; - - free_AmigaMem(); - - // Get max. available size - total = (uae_u64)sysconf (_SC_PHYS_PAGES) * (uae_u64)getpagesize(); - - // Limit to max. 64 MB - natmem_size = total; - if (natmem_size > MAXAMIGAMEM) - natmem_size = MAXAMIGAMEM; - - // We need at least 16 MB - if (natmem_size < 16 * 1024 * 1024) - natmem_size = 16 * 1024 * 1024; - - write_log("Total physical RAM %lluM. Attempting to reserve: %uM.\n", total >> 20, natmem_size >> 20); - natmem_offset = (uae_u8*)valloc (natmem_size); - - if (!natmem_offset) { - for (;;) { - natmem_offset = (uae_u8*)valloc (natmem_size); - if (natmem_offset) - break; - natmem_size -= 16 * 1024 * 1024; - if (!natmem_size) { - write_log("Can't allocate 16M of virtual address space!?\n"); - abort(); - } - } - } - max_z3fastmem = natmem_size - 32 * 1024 * 1024; - if(max_z3fastmem < 0) - max_z3fastmem = 0; - write_log("Reserved: %p-%p (0x%08x %dM)\n", natmem_offset, (uae_u8*)natmem_offset + natmem_size, - natmem_size, natmem_size >> 20); -} - - -uae_u8 *mapped_malloc (size_t s, const char *file) -{ - if(!strcmp(file, "chip")) - return natmem_offset; - - if(!strcmp(file, "fast")) - return natmem_offset + 0x200000; - - if(!strcmp(file, "bogo")) - return natmem_offset + bogomem_start; - - if(!strcmp(file, "rom_f0")) - return natmem_offset + 0xf00000; - - if(!strcmp(file, "rom_e0")) - return natmem_offset + 0xe00000; - - if(!strcmp(file, "kick")) - return natmem_offset + kickmem_start; - - if(!strcmp(file, "z3")) - return natmem_offset + 0x1000000; //z3fastmem_start; - - if(!strcmp(file, "gfx")) - return natmem_offset + 0x3000000; //gfxmem_start; - - if(!strcmp(file, "rtarea")) - return natmem_offset + RTAREA_BASE; - - return NULL; -} - - -void mapped_free (uae_u8 *p) -{ -} diff --git a/src/osdep/picasso96.cpp b/src/osdep/picasso96.cpp deleted file mode 100644 index 2ce0fd63..00000000 --- a/src/osdep/picasso96.cpp +++ /dev/null @@ -1,2680 +0,0 @@ -/* - * UAE - The U*nix Amiga Emulator - * - * Picasso96 Support Module - * - * Copyright 1997-2001 Brian King - * Copyright 2000-2001 Bernd Roesch - * Copyright 2003-2005 Richard Drummond - * - * Theory of operation: - * On the Amiga side, a Picasso card consists mainly of a memory area that - * contains the frame buffer. On the UAE side, we allocate a block of memory - * that will hold the frame buffer. This block is in normal memory, it is - * never directly on the graphics card. All graphics operations, which are - * mainly reads and writes into this block and a few basic operations like - * filling a rectangle, operate on this block of memory. - * Since the memory is not on the graphics card, some work must be done to - * synchronize the display with the data in the Picasso frame buffer. There - * are various ways to do this. One possibility is to allocate a second - * buffer of the same size, and perform all write operations twice. Since - * we never read from the second buffer, it can actually be placed in video - * memory. The X11 driver could be made to use the Picasso frame buffer as - * the data buffer of an XImage, which could then be XPutImage()d from time - * to time. Another possibility is to translate all Picasso accesses into - * Xlib (or GDI, or whatever your graphics system is) calls. This possibility - * is a bit tricky, since there is a risk of generating very many single pixel - * accesses which may be rather slow. - * - * TODO: - * - we want to add a manual switch to override SetSwitch for hardware banging - * programs started from a Picasso workbench. - */ - -#include "sysconfig.h" -#include "sysdeps.h" - - -#include "config.h" -#include "options.h" -#include "uae.h" -#include "memory.h" -#include "custom.h" -#include "newcpu.h" -#include "xwin.h" -#include "savestate.h" -#include "autoconf.h" -#include "traps.h" - -#ifdef PICASSO96 - -#include "picasso96.h" -#include - -int have_done_picasso; /* For the JIT compiler */ -static int p96syncrate; - -int palette_changed; - -static uae_u32 REGPARAM2 gfxmem_lget (uaecptr) REGPARAM; -static uae_u32 REGPARAM2 gfxmem_wget (uaecptr) REGPARAM; -static uae_u32 REGPARAM2 gfxmem_bget (uaecptr) REGPARAM; -static void REGPARAM2 gfxmem_lput (uaecptr, uae_u32) REGPARAM; -static void REGPARAM2 gfxmem_wput (uaecptr, uae_u32) REGPARAM; -static void REGPARAM2 gfxmem_bput (uaecptr, uae_u32) REGPARAM; -static int REGPARAM2 gfxmem_check (uaecptr addr, uae_u32 size) REGPARAM; -static uae_u8 *REGPARAM2 gfxmem_xlate (uaecptr addr) REGPARAM; - -static void write_gfx_long (uaecptr addr, uae_u32 value); -static void write_gfx_word (uaecptr addr, uae_u16 value); -static void write_gfx_byte (uaecptr addr, uae_u8 value); - -static uae_u8 all_ones_bitmap, all_zeros_bitmap; - -struct picasso96_state_struct picasso96_state; -struct picasso_vidbuf_description picasso_vidinfo; - -/* These are the maximum resolutions... They are filled in by GetSupportedResolutions() */ -/* have to fill this in, otherwise problems occur on the Amiga side P96 s/w which expects -/* data here. */ -struct ScreenResolution planar = { 320, 240 }; -struct ScreenResolution chunky = { 640, 480 }; -struct ScreenResolution hicolour = { 640, 480 }; -struct ScreenResolution truecolour = { 640, 480 }; -struct ScreenResolution alphacolour = { 640, 480 }; - -#define UAE_RTG_LIBRARY_VERSION 40 -#define UAE_RTG_LIBRARY_REVISION 3993 -static void checkrtglibrary(void) -{ - uae_u32 v; - static int checked = 0; - - if (checked) - return; - v = get_long (4); // execbase - v += 378; // liblist - while ((v = get_long(v))) { - uae_u32 v2 = get_long(v + 10); // name - uae_u8 *p; - addrbank *b = &get_mem_bank(v2); - if (!b || !b->check (v2, 12)) - continue; - p = b->xlateaddr(v2); - if (!memcmp(p, "rtg.library\0", 12)) { - uae_u16 ver = get_word(v + 20); - uae_u16 rev = get_word(v + 22); - if (ver * 10000 + rev < UAE_RTG_LIBRARY_VERSION * 10000 + UAE_RTG_LIBRARY_REVISION) { - char msg[2000]; - write_log("installed rtg.library: %d.%d, required: %d.%d\n", ver, rev, UAE_RTG_LIBRARY_VERSION, UAE_RTG_LIBRARY_REVISION); - } else { - write_log("P96: rtg.library %d.%d detected\n", ver, rev); - } - checked = 1; - } - } -} - -struct PicassoResolution DisplayModes[MAX_PICASSO_MODES]; - -static int mode_count = 0; - -static uae_u32 p2ctab[256][2]; -static int set_gc_called = 0; - - -static uae_u8 GetBytesPerPixel (uae_u32 RGBfmt) -{ - static int bFailure = 0; - - switch (RGBfmt) { - case RGBFB_CLUT: - return 1; - - case RGBFB_A8R8G8B8: - case RGBFB_A8B8G8R8: - case RGBFB_R8G8B8A8: - case RGBFB_B8G8R8A8: - return 4; - - case RGBFB_B8G8R8: - case RGBFB_R8G8B8: - return 3; - - case RGBFB_R5G5B5: - case RGBFB_R5G6B5: - case RGBFB_R5G6B5PC: - case RGBFB_R5G5B5PC: - case RGBFB_B5G6R5PC: - case RGBFB_B5G5R5PC: - return 2; - default: - write_log ("ERROR - GetBytesPerPixel() was unsuccessful with 0x%x?!\n", RGBfmt); - if( !bFailure ) - { - bFailure = 1; - return GetBytesPerPixel(picasso_vidinfo.rgbformat); - } - else - { - abort(); - } - } - return 0; -} - -/* - * Amiga <-> native structure conversion functions - */ - -static int CopyRenderInfoStructureA2U (uaecptr amigamemptr, struct RenderInfo *ri) -{ - uaecptr memp = get_long (amigamemptr + PSSO_RenderInfo_Memory); - - if (valid_address (memp, PSSO_RenderInfo_sizeof)) { - ri->Memory = get_real_address (memp); - ri->BytesPerRow = get_word (amigamemptr + PSSO_RenderInfo_BytesPerRow); - ri->RGBFormat = (RGBFTYPE)get_long (amigamemptr + PSSO_RenderInfo_RGBFormat); - return 1; - } - write_log ("ERROR - Invalid RenderInfo memory area...\n"); - return 0; -} - -static int CopyPatternStructureA2U (uaecptr amigamemptr, struct Pattern *pattern) -{ - uaecptr memp = get_long (amigamemptr + PSSO_Pattern_Memory); - if (valid_address (memp, PSSO_Pattern_sizeof)) { - pattern->Memory = (char *)get_real_address (memp); - pattern->XOffset = get_word (amigamemptr + PSSO_Pattern_XOffset); - pattern->YOffset = get_word (amigamemptr + PSSO_Pattern_YOffset); - pattern->FgPen = get_long (amigamemptr + PSSO_Pattern_FgPen); - pattern->BgPen = get_long (amigamemptr + PSSO_Pattern_BgPen); - pattern->Size = get_byte (amigamemptr + PSSO_Pattern_Size); - pattern->DrawMode = get_byte (amigamemptr + PSSO_Pattern_DrawMode); - return 1; - } - write_log ("ERROR - Invalid Pattern memory area...\n"); - return 0; -} - -static void CopyColorIndexMappingA2U (uaecptr amigamemptr, struct ColorIndexMapping *cim) -{ - int i; - cim->ColorMask = get_long (amigamemptr); - for (i = 0; i < 256; i++, amigamemptr += 4) - cim->Colors[i] = get_long (amigamemptr + 4); -} - -static int CopyBitMapStructureA2U (uaecptr amigamemptr, struct BitMap *bm) -{ - int i; - - bm->BytesPerRow = get_word (amigamemptr + PSSO_BitMap_BytesPerRow); - bm->Rows = get_word (amigamemptr + PSSO_BitMap_Rows); - bm->Flags = get_byte (amigamemptr + PSSO_BitMap_Flags); - bm->Depth = get_byte (amigamemptr + PSSO_BitMap_Depth); - - /* ARGH - why is THIS happening? */ - if( bm->Depth > 8 ) - bm->Depth = 8; - - for (i = 0; i < bm->Depth; i++) { - uaecptr plane = get_long (amigamemptr + PSSO_BitMap_Planes + i * 4); - switch (plane) { - case 0: - bm->Planes[i] = &all_zeros_bitmap; - break; - case 0xFFFFFFFF: - bm->Planes[i] = &all_ones_bitmap; - break; - default: - if (valid_address (plane, bm->BytesPerRow * bm->Rows)) - bm->Planes[i] = get_real_address (plane); - else - return 0; - break; - } - } - return 1; -} - -static int CopyTemplateStructureA2U (uaecptr amigamemptr, struct Template *tmpl) -{ - uaecptr memp = get_long (amigamemptr + PSSO_Template_Memory); - - if (valid_address (memp, sizeof(struct Template) )) { - tmpl->Memory = (char *)get_real_address (memp); - tmpl->BytesPerRow = get_word (amigamemptr + PSSO_Template_BytesPerRow); - tmpl->XOffset = get_byte (amigamemptr + PSSO_Template_XOffset); - tmpl->DrawMode = get_byte (amigamemptr + PSSO_Template_DrawMode); - tmpl->FgPen = get_long (amigamemptr + PSSO_Template_FgPen); - tmpl->BgPen = get_long (amigamemptr + PSSO_Template_BgPen); - return 1; - } - write_log ("ERROR - Invalid Template memory area...\n"); - return 0; -} - -static void CopyLibResolutionStructureU2A (struct LibResolution *libres, uaecptr amigamemptr) -{ - char *uaememptr = 0; - int i; - - uaememptr = (char *)gfxmem_xlate (amigamemptr); /* I know that amigamemptr is inside my gfxmem chunk, so I can just do the xlate() */ - memset (uaememptr, 0, PSSO_LibResolution_sizeof); /* zero out our LibResolution structure */ - memcpy (uaememptr + PSSO_LibResolution_P96ID, libres->P96ID, 6); - strncpy(uaememptr + PSSO_LibResolution_Name, libres->Name, MAXRESOLUTIONNAMELENGTH); - put_long (amigamemptr + PSSO_LibResolution_DisplayID, libres->DisplayID); - put_word (amigamemptr + PSSO_LibResolution_Width, libres->Width); - put_word (amigamemptr + PSSO_LibResolution_Height, libres->Height); - put_word (amigamemptr + PSSO_LibResolution_Flags, libres->Flags); - for (i = 0; i < MAXMODES; i++) - put_long (amigamemptr + PSSO_LibResolution_Modes + i * 4, libres->Modes[i]); - put_long (amigamemptr + 10, amigamemptr + PSSO_LibResolution_P96ID); - put_long (amigamemptr + PSSO_LibResolution_BoardInfo, libres->BoardInfo); -} - -/* list is Amiga address of list, in correct endian format for UAE - * node is Amiga address of node, in correct endian format for UAE */ -static void AmigaListAddTail (uaecptr l, uaecptr n) -{ - put_long (n + 0, l + 4); // n->ln_Succ = (struct Node *)&l->lh_Tail; - put_long (n + 4, get_long (l + 8)); // n->ln_Pred = l->lh_TailPred; - put_long (get_long (l + 8) + 0, n); // l->lh_TailPred->ln_Succ = n; - put_long (l + 8, n); // l->lh_TailPred = n; -} - -/* - * Functions to perform an action on the real screen - */ - -/* - * Fill a rectangle on the screen. src points to the start of a line of the - * filled rectangle in the frame buffer; it can be used as a memcpy source if - * there is no OS specific function to fill the rectangle. - */ - -static void do_fillrect (uae_u8 *src, unsigned int x, unsigned int y, unsigned int width, unsigned int height, - uae_u32 pen, int Bpp, RGBFTYPE rgbtype) -{ - uae_u8 *dst; - - /* Try OS specific fillrect function here; and return if successful. Make sure we adjust for - * the pen values if we're doing 8-bit display-emulation on a 16-bit or higher screen. */ - if( picasso_vidinfo.rgbformat == picasso96_state.RGBFormat ) - { - if( DX_Fill( x, y, width, height, pen, rgbtype ) ) - return; - } - else - { - if( DX_Fill( x, y, width, height, picasso_vidinfo.clut[pen], rgbtype ) ) - return; - } - - if (y + height > picasso_vidinfo.height) - height = picasso_vidinfo.height - y; - if (x + width > picasso_vidinfo.width) - width = picasso_vidinfo.width - x; - - DX_Invalidate (y, y + height - 1); - if (!picasso_vidinfo.extra_mem) - return; - - width *= Bpp; - dst = gfx_lock_picasso (); - - if (!dst) - goto out; - - dst += y * picasso_vidinfo.rowbytes + x * picasso_vidinfo.pixbytes; - if (picasso_vidinfo.rgbformat == picasso96_state.RGBFormat) { - if (Bpp == 1) { - while (height-- > 0) { - memset (dst, pen, width); - dst += picasso_vidinfo.rowbytes; - } - } else { - // Set first line - if (Bpp == 2) { - for(int i=0; i 0) { - memcpy (dst, src, width); - dst += picasso_vidinfo.rowbytes; - } - } - } else { - int psiz = GetBytesPerPixel (picasso_vidinfo.rgbformat); - if (picasso96_state.RGBFormat != RGBFB_CHUNKY) - { - abort (); - } - - while (height-- > 0) - { - unsigned int i; - switch (psiz) - { - case 2: - for (i = 0; i < width; i++) - *((uae_u16 *) dst + i) = picasso_vidinfo.clut[src[i]]; - break; - case 4: - for (i = 0; i < width; i++) - *((uae_u32 *) dst + i) = picasso_vidinfo.clut[src[i]]; - break; - default: - abort (); - break; - } - dst += picasso_vidinfo.rowbytes; - } - } -out: - gfx_unlock_picasso (); -} - -/* - * This routine modifies the real screen buffer after a blit has been - * performed in the save area. If can_do_blit is nonzero, the blit can - * be performed within the real screen buffer; otherwise, this routine - * must do it by hand using the data in the frame-buffer, calculated using - * the RenderInfo data and our coordinates. - */ - -static void do_blit (struct RenderInfo *ri, int Bpp, - unsigned int srcx, unsigned int srcy, unsigned int dstx, unsigned int dsty, - unsigned int width, unsigned int height, BLIT_OPCODE opcode, int can_do_blit) -{ - uae_u8 *dstp, *srcp; - - dstx = dstx - picasso96_state.XOffset; - dsty = dsty - picasso96_state.YOffset; - if ((int)dstx <= 0) { - srcx=srcx-dstx; - dstx = 0; - } - if ((int)dsty <= 0) { - srcy=srcy-dsty; - dsty = 0; - } - - /* Is our x/y origin on-screen? */ - if( dsty >= picasso_vidinfo.height ) - return; - if( dstx >= picasso_vidinfo.width ) - return; - - /* Is our area in-range? */ - if (dsty + height >= picasso_vidinfo.height) - height = picasso_vidinfo.height - dsty; - if (dstx + width >= picasso_vidinfo.width) - width = picasso_vidinfo.width - dstx; - - srcp = ri->Memory + srcx*Bpp + srcy*ri->BytesPerRow; - - DX_Invalidate (dsty, dsty + height - 1); - if (!picasso_vidinfo.extra_mem) - { - return; - } - - dstp = gfx_lock_picasso (); - if (dstp == 0) - { - goto out; - } - - /* The areas can't overlap: the source is always in the Picasso frame buffer, - * and the destination is a different buffer owned by the graphics code. */ - dstp += dsty * picasso_vidinfo.rowbytes + dstx * picasso_vidinfo.pixbytes; - - if (picasso_vidinfo.rgbformat == picasso96_state.RGBFormat) { - while (height-- > 0) { - switch (Bpp) - { - case 2: - pixcpy_swap16((uae_u16*)dstp, (uae_u16*)srcp, width); - break; - case 4: - pixcpy_swap32((uae_u32*)dstp, (uae_u32*)srcp, width); - break; - default: - memcpy (dstp, srcp, width); - } - srcp += ri->BytesPerRow; - dstp += picasso_vidinfo.rowbytes; - } - } else { - int psiz = GetBytesPerPixel (picasso_vidinfo.rgbformat); - if (picasso96_state.RGBFormat != RGBFB_CHUNKY) - { - abort (); - } - while (height-- > 0) { - unsigned int i; - switch (psiz) { - case 2: - for (i = 0; i < width; i++) - *((uae_u16 *) dstp + i) = picasso_vidinfo.clut[srcp[i]]; - break; - case 4: - for (i = 0; i < width; i++) - *((uae_u32 *) dstp + i) = picasso_vidinfo.clut[srcp[i]]; - break; - default: - abort (); - break; - } - srcp += ri->BytesPerRow; - dstp += picasso_vidinfo.rowbytes; - } - } -out: - gfx_unlock_picasso (); -} - -/* -* Invert a rectangle on the screen. a render-info is given, -* so that do_blit can be used if -* there is no OS specific function to invert the rectangle. - */ - -static void do_invertrect (struct RenderInfo *ri, int Bpp, int x, int y, int width, int height) -{ - do_blit (ri, Bpp, x, y, x, y, width, height, BLIT_SRC, 0); -} - -static uaecptr wgfx_linestart; -static uaecptr wgfx_lineend; -static uaecptr wgfx_min, wgfx_max; -static unsigned long wgfx_y; - -static void wgfx_do_flushline (void) -{ - uae_u8 *src, *dstp; - - /* Mark these lines as "dirty" */ - DX_Invalidate (wgfx_y, wgfx_y); - - if (!picasso_vidinfo.extra_mem) /* The "out" will flush the dirty lines directly */ - goto out; - - dstp = gfx_lock_picasso (); - if (dstp == 0) - goto out; - - src = gfxmemory + wgfx_min; - - if (picasso_vidinfo.rgbformat == picasso96_state.RGBFormat) { - dstp += wgfx_y * picasso_vidinfo.rowbytes + wgfx_min - wgfx_linestart; -// memcpy (dstp, src, wgfx_max - wgfx_min); - switch (GetBytesPerPixel(picasso_vidinfo.rgbformat)) - { - case 2: - pixcpy_swap16((uae_u16*)dstp, (uae_u16*)src, wgfx_max - wgfx_min); - break; - case 4: - pixcpy_swap32((uae_u32*)dstp, (uae_u32*)src, wgfx_max - wgfx_min); - break; - default: - memcpy (dstp, src, wgfx_max - wgfx_min); - } - } else { - int width = wgfx_max - wgfx_min; - int i; - int psiz = GetBytesPerPixel (picasso_vidinfo.rgbformat); - - if (picasso96_state.RGBFormat != RGBFB_CHUNKY) - { - abort (); - } - - dstp += wgfx_y * picasso_vidinfo.rowbytes + (wgfx_min - wgfx_linestart) * psiz; - switch (psiz) { - case 2: - for (i = 0; i < width; i++) - *((uae_u16 *) dstp + i) = picasso_vidinfo.clut[src[i]]; - break; - case 4: - for (i = 0; i < width; i++) - *((uae_u32 *) dstp + i) = picasso_vidinfo.clut[src[i]]; - break; - default: - abort (); - break; - } - } - -out: - gfx_unlock_picasso (); - wgfx_linestart = 0xFFFFFFFF; -} - -STATIC_INLINE void wgfx_flushline (void) -{ - if (wgfx_linestart == 0xFFFFFFFF || !picasso_on) - return; - wgfx_do_flushline (); -} - -static int renderinfo_is_current_screen (struct RenderInfo *ri) -{ - if (!picasso_on) - return 0; - if (ri->Memory != gfxmemory + (picasso96_state.Address - gfxmem_start)) - return 0; - - return 1; -} - -/* -* Fill a rectangle in the screen. -*/ -STATIC_INLINE void do_fillrect_frame_buffer (struct RenderInfo *ri, int X, int Y, int Width, int Height, uae_u32 Pen, int Bpp, RGBFTYPE RGBFormat) -{ - int cols; - uae_u8 *start, *oldstart; - uae_u8 *src, *dst; - int lines; - - /* Do our virtual frame-buffer memory. First, we do a single line fill by hand */ - oldstart = start = src = ri->Memory + X * Bpp + Y * ri->BytesPerRow; - - switch (Bpp) { - case 1: - memset (start, Pen, Width); - break; - case 2: - for (cols = 0; cols < Width; cols++) { - do_put_mem_word ((uae_u16 *)start, (uae_u16)Pen); - start += 2; - } - break; - case 3: - for (cols = 0; cols < Width; cols++) { - do_put_mem_byte (start, (uae_u8)Pen); - start++; - *(uae_u16 *)(start) = (Pen & 0x00FFFF00) >> 8; - start+=2; - } - break; - case 4: - for (cols = 0; cols < Width; cols++) { - do_put_mem_long ((uae_u32 *)start, Pen); - start += 4; - } - break; - } /* switch (Bpp) */ - - src = oldstart; - dst = src + ri->BytesPerRow; - - /* next, we do the remaining line fills via memcpy() for > 1 BPP, otherwise some more memset() calls */ - if (Bpp > 1) { - for (lines = 0; lines < (Height - 1); lines++, dst += ri->BytesPerRow) - memcpy (dst, src, Width * Bpp); - } else { - for (lines = 0; lines < (Height - 1); lines++, dst += ri->BytesPerRow) - memset( dst, Pen, Width ); - } -} - -void picasso_handle_vsync (void) -{ - rtarea[get_long (RTAREA_BASE + 36) + 12 - 1]++; - - if (palette_changed) { - DX_SetPalette (0, 256); - palette_changed = 0; - } - - flush_block (); -} - -static int set_panning_called = 0; - -/* Clear our screen, since we've got a new Picasso screen-mode, and refresh with the proper contents - * This is called on several occasions: - * 1. Amiga-->Picasso transition, via SetSwitch() - * 2. Picasso-->Picasso transition, via SetPanning(). - * 3. whenever the graphics code notifies us that the screen contents have been lost. - */ -extern unsigned int new_beamcon0; - -void picasso_refresh ( int call_setpalette ) -{ - struct RenderInfo ri; - static int beamcon0_before, p96refresh_was; - - if (!picasso_on) - return; - - have_done_picasso=1; - - /* Make sure that the first time we show a Picasso video mode, we don't blit any crap. - * We can do this by checking if we have an Address yet. */ - if (picasso96_state.Address) { - unsigned int width, height; - /* blit the stuff from our static frame-buffer to the gfx-card */ - ri.Memory = gfxmemory + (picasso96_state.Address - gfxmem_start); - ri.BytesPerRow = picasso96_state.BytesPerRow; - ri.RGBFormat = (RGBFTYPE)picasso96_state.RGBFormat; - - if (set_panning_called) { - width = ( picasso96_state.VirtualWidth < picasso96_state.Width ) ? - picasso96_state.VirtualWidth : picasso96_state.Width; - height = ( picasso96_state.VirtualHeight < picasso96_state.Height ) ? - picasso96_state.VirtualHeight : picasso96_state.Height; - } else { - width = picasso96_state.Width; - height = picasso96_state.Height; - } - - do_blit (&ri, picasso96_state.BytesPerPixel, 0, 0, 0, 0, width, height, BLIT_SRC, 0); - } else - write_log ("ERROR - picasso_refresh() can't refresh!\n"); -} - -/* -* Functions to perform an action on the frame-buffer -*/ -STATIC_INLINE void do_blitrect_frame_buffer (struct RenderInfo *ri, - struct RenderInfo *dstri, - unsigned long srcx, unsigned long srcy, - unsigned long dstx, unsigned long dsty, - unsigned long width, unsigned long height, - uae_u8 mask, BLIT_OPCODE opcode) -{ - uae_u8 *src, *dst, *tmp, *tmp2, *tmp3; - uae_u8 Bpp = GetBytesPerPixel (ri->RGBFormat); - unsigned long total_width = width * Bpp; - unsigned long linewidth = (total_width + 15) & ~15; - unsigned long lines; - int can_do_visible_blit = 0; - - src = ri->Memory + srcx*Bpp + srcy*ri->BytesPerRow; - dst = dstri->Memory + dstx*Bpp + dsty*dstri->BytesPerRow; - - if (mask != 0xFF && Bpp > 1) { - write_log ("WARNING - BlitRect() has mask 0x%x with Bpp %d.\n", mask, Bpp); - } - - if (mask == 0xFF || Bpp > 1) { - if( opcode == BLIT_SRC ) { - /* handle normal case efficiently */ - if (ri->Memory == dstri->Memory && dsty == srcy) { - unsigned long i; - for (i = 0; i < height; i++, src += ri->BytesPerRow, dst += dstri->BytesPerRow) - memmove (dst, src, total_width); - } else if (dsty < srcy) { - unsigned long i; - for (i = 0; i < height; i++, src += ri->BytesPerRow, dst += dstri->BytesPerRow) - memcpy (dst, src, total_width); - } else { - unsigned long i; - src += (height-1) * ri->BytesPerRow; - dst += (height-1) * dstri->BytesPerRow; - for (i = 0; i < height; i++, src -= ri->BytesPerRow, dst -= dstri->BytesPerRow) - memcpy (dst, src, total_width); - } - return; - } else { - uae_u8 *src2 = src; - uae_u8 *dst2 = dst; - uae_u32 *src2_32 = (uae_u32*)src; - uae_u32 *dst2_32 = (uae_u32*)dst; - unsigned int y; - - for (y = 0; y < height; y++) /* Vertical lines */ - { - uae_u8* bound = src + total_width - 4; - //copy now the longs - for( src2_32 = (uae_u32 *)src, dst2_32 = (uae_u32 *)dst; src2_32 < (uae_u32 *)bound; src2_32++, dst2_32++ ) /* Horizontal bytes */ - { - switch( opcode ) { - case BLIT_FALSE: - *dst2_32 = 0; - break; - case BLIT_NOR: - *dst2_32 = ~(*src2_32 | *dst2_32); - break; - case BLIT_ONLYDST: - *dst2_32 = *dst2_32 & ~(*src2_32); - break; - case BLIT_NOTSRC: - *dst2_32 = ~(*src2_32); - break; - case BLIT_ONLYSRC: - *dst2_32 = *src2_32 & ~(*dst2_32); - break; - case BLIT_NOTDST: - *dst2_32 = ~(*dst2_32); - break; - case BLIT_EOR: - *dst2_32 = *src2_32 ^ *dst2_32; - break; - case BLIT_NAND: - *dst2_32 = ~(*src2_32 & *dst2_32); - break; - case BLIT_AND: - *dst2_32 = *src2_32 & *dst2_32; - break; - case BLIT_NEOR: - *dst2_32 = ~(*src2_32 ^ *dst2_32); - break; - case BLIT_DST: - write_log( "do_blitrect_frame_buffer shouldn't get BLIT_DST!\n"); - break; - case BLIT_NOTONLYSRC: - *dst2_32 = ~(*src2_32) | *dst2_32; - break; - case BLIT_SRC: - write_log( "do_blitrect_frame_buffer shouldn't get BLIT_SRC!\n"); - break; - case BLIT_NOTONLYDST: - *dst2_32 = ~(*dst2_32) | *src2_32; - break; - case BLIT_OR: - *dst2_32 = *src2_32 | *dst2_32; - break; - case BLIT_TRUE: - *dst2_32 = 0xFFFFFFFF; - break; - case 30: //code for swap source with dest in byte - { - uae_u32 temp; - temp = *src2_32; - *src2_32 = *dst2_32; - *dst2_32 = temp; - } - break; - case BLIT_LAST: - write_log( "do_blitrect_frame_buffer shouldn't get BLIT_LAST!\n"); - break; - } /* switch opcode */ - } // for end - //now copy the rest few bytes - for (src2 = (uae_u8 *)src2_32, dst2 = (uae_u8 *)dst2_32; src2 < src + total_width; src2++, dst2++ ) /* Horizontal bytes */ - { - switch( opcode ) { - case BLIT_FALSE: - *dst2 = 0; - break; - case BLIT_NOR: - *dst2 = ~(*src2 | *dst2); - break; - case BLIT_ONLYDST: - *dst2 = *dst2 & ~(*src2); - break; - case BLIT_NOTSRC: - *dst2 = ~(*src2); - break; - case BLIT_ONLYSRC: - *dst2 = *src2 & ~(*dst2); - break; - case BLIT_NOTDST: - *dst2 = ~(*dst2); - break; - case BLIT_EOR: - *dst2 = *src2 ^ *dst2; - break; - case BLIT_NAND: - *dst2 = ~(*src2 & *dst2); - break; - case BLIT_AND: - *dst2 = *src2 & *dst2; - break; - case BLIT_NEOR: - *dst2 = ~(*src2 ^ *dst2); - break; - case BLIT_DST: - write_log( "do_blitrect_frame_buffer shouldn't get BLIT_DST!\n"); - break; - case BLIT_NOTONLYSRC: - *dst2 = ~(*src2) | *dst2; - break; - case BLIT_SRC: - write_log( "do_blitrect_frame_buffer shouldn't get BLIT_SRC!\n"); - break; - case BLIT_NOTONLYDST: - *dst2 = ~(*dst2) | *src2; - break; - case BLIT_OR: - *dst2 = *src2 | *dst2; - break; - case BLIT_TRUE: - *dst2 = 0xFF; - break; - case BLIT_LAST: - write_log( "do_blitrect_frame_buffer shouldn't get BLIT_LAST!\n"); - break; - case 30: //code for swap source with dest in long - { - uae_u8 temp; - temp = *src2; - *src2 = *dst2; - *dst2 = temp; - } - break; - } /* switch opcode */ - } /* for width */ - src += ri->BytesPerRow; - dst += dstri->BytesPerRow; - } /* for height */ - } - return; - } - - tmp3 = tmp2 = tmp = (uae_u8 *)xmalloc (linewidth * height); /* allocate enough memory for the src-rect */ - if (!tmp) - return; - - /* copy the src-rect into our temporary buffer space */ - for (lines = 0; lines < height; lines++, src += ri->BytesPerRow, tmp2 += linewidth) - memcpy (tmp2, src, total_width); - - /* copy the temporary buffer to the destination */ - for (lines = 0; lines < height; lines++, dst += dstri->BytesPerRow, tmp += linewidth) { - unsigned long cols; - for (cols = 0; cols < width; cols++) { - dst[cols] &= ~mask; - dst[cols] |= tmp[cols] & mask; - } - } - /* free the temp-buf */ - free (tmp3); -} - -/* -DrawLine: -Synopsis: DrawLine(bi, ri, line, Mask, RGBFormat); -Inputs: a0: struct BoardInfo *bi -a1: struct RenderInfo *ri -a2: struct Line *line -d0.b: Mask -d7.l: RGBFormat - -This function is used to paint a line on the board memory possibly using the blitter. It is called by Draw -and obeyes the destination RGBFormat as well as ForeGround and BackGround pens and draw modes. -*/ -uae_u32 REGPARAM2 picasso_DrawLine (struct regstruct *regs) -{ - return 0; -} - -/* - * BOOL FindCard(struct BoardInfo *bi); and - * - * FindCard is called in the first stage of the board initialisation and - * configuration and is used to look if there is a free and unconfigured - * board of the type the driver is capable of managing. If it finds one, - * it immediately reserves it for use by Picasso96, usually by clearing - * the CDB_CONFIGME bit in the flags field of the ConfigDev struct of - * this expansion card. But this is only a common example, a driver can - * do whatever it wants to mark this card as used by the driver. This - * mechanism is intended to ensure that a board is only configured and - * used by one driver. FindBoard also usually fills some fields of the - * BoardInfo struct supplied by the caller, the rtg.library, for example - * the MemoryBase, MemorySize and RegisterBase fields. - */ -uae_u32 REGPARAM2 picasso_FindCard (struct regstruct *regs) -{ - uaecptr AmigaBoardInfo = m68k_areg (regs, 0); - /* NOTES: See BoardInfo struct definition in Picasso96 dev info */ - - if (allocated_gfxmem && !picasso96_state.CardFound) { - /* Fill in MemoryBase, MemorySize */ - put_long (AmigaBoardInfo + PSSO_BoardInfo_MemoryBase, gfxmem_start); - /* size of memory, minus a 32K chunk: 16K for pattern bitmaps, 16K for resolution list */ - put_long (AmigaBoardInfo + PSSO_BoardInfo_MemorySize, allocated_gfxmem - 32768); - - picasso96_state.CardFound = 1; /* mark our "card" as being found */ - - return -1; - } else - return 0; -} - -static void FillBoardInfo (uaecptr amigamemptr, struct LibResolution *res, struct PicassoResolution *dm) -{ - char *uaememptr; - switch (dm->depth) { - case 1: - res->Modes[CHUNKY] = amigamemptr; - break; - case 2: - res->Modes[HICOLOR] = amigamemptr; - break; - case 3: - res->Modes[TRUECOLOR] = amigamemptr; - break; - default: - res->Modes[TRUEALPHA] = amigamemptr; - break; - } - uaememptr = (char *)gfxmem_xlate (amigamemptr); /* I know that amigamemptr is inside my gfxmem chunk, so I can just do the xlate() */ - memset (uaememptr, 0, PSSO_ModeInfo_sizeof); /* zero out our ModeInfo struct */ - - put_word (amigamemptr + PSSO_ModeInfo_Width, dm->res.width); - put_word (amigamemptr + PSSO_ModeInfo_Height, dm->res.height); - put_byte (amigamemptr + PSSO_ModeInfo_Depth, dm->depth * 8); - put_byte (amigamemptr + PSSO_ModeInfo_Flags, 0); - put_word (amigamemptr + PSSO_ModeInfo_HorTotal, dm->res.width); - put_word (amigamemptr + PSSO_ModeInfo_HorBlankSize, 0); - put_word (amigamemptr + PSSO_ModeInfo_HorSyncStart, 0); - put_word (amigamemptr + PSSO_ModeInfo_HorSyncSize, 0); - put_byte (amigamemptr + PSSO_ModeInfo_HorSyncSkew, 0); - put_byte (amigamemptr + PSSO_ModeInfo_HorEnableSkew, 0); - - put_word (amigamemptr + PSSO_ModeInfo_VerTotal, dm->res.height); - put_word (amigamemptr + PSSO_ModeInfo_VerBlankSize, 0); - put_word (amigamemptr + PSSO_ModeInfo_VerSyncStart, 0); - put_word (amigamemptr + PSSO_ModeInfo_VerSyncSize, 0); - - put_byte (amigamemptr + PSSO_ModeInfo_first_union, 98); - put_byte (amigamemptr + PSSO_ModeInfo_second_union, 14); - - put_long (amigamemptr + PSSO_ModeInfo_PixelClock, dm->res.width * dm->res.height * (currprefs.gfx_refreshrate ? abs (currprefs.gfx_refreshrate) : 60)); -} - -static int AssignModeID(int i, int count) -{ - int result; - if (DisplayModes[i].res.width == 320 && DisplayModes[i].res.height == 200) - result = 0x50001000; - else if (DisplayModes[i].res.width == 320 && DisplayModes[i].res.height == 240) - result = 0x50011000; - else if (DisplayModes[i].res.width == 640 && DisplayModes[i].res.height == 400) - result = 0x50021000; - else if (DisplayModes[i].res.width == 640 && DisplayModes[i].res.height == 480) - result = 0x50031000; - else if (DisplayModes[i].res.width == 800 && DisplayModes[i].res.height == 600) - result = 0x50041000; - else if (DisplayModes[i].res.width == 1024 && DisplayModes[i].res.height == 768) - result = 0x50051000; - else if (DisplayModes[i].res.width == 1152 && DisplayModes[i].res.height == 864) - result = 0x50061000; - else if (DisplayModes[i].res.width == 1280 && DisplayModes[i].res.height == 1024) - result = 0x50071000; - else if (DisplayModes[i].res.width == 1600 && DisplayModes[i].res.height == 1280) - result = 0x50081000; - else - result = 0x50091000 + count * 0x10000; - return result; -} - -/**************************************** -* InitCard() -* -* a2: BoardInfo structure ptr - Amiga-based address in Intel endian-format -* -* Job - fill in the following structure members: -* gbi_RGBFormats: the pixel formats that the host-OS of UAE supports -* If UAE is running in a window, it should ONLY report the pixel format of the host-OS desktop -* If UAE is running full-screen, it should report ALL pixel formats that the host-OS can handle in full-screen -* NOTE: If full-screen, and the user toggles to windowed-mode, all hell will break loose visually. Must inform -* user that they're doing something stupid (unless their desktop and full-screen colour modes match). -* gbi_SoftSpriteFlags: should be the same as above for now, until actual cursor support is added -* gbi_BitsPerCannon: could be 6 or 8 or ???, depending on the host-OS gfx-card -* gbi_MaxHorResolution: fill this in for all modes (even if you don't support them) -* gbi_MaxVerResolution: fill this in for all modes (even if you don't support them) -*/ -uae_u32 REGPARAM2 picasso_InitCard (struct regstruct *regs) -{ - struct LibResolution res; - int i; - int ModeInfoStructureCount = 1, LibResolutionStructureCount = 0; - uaecptr amigamemptr = 0; - uaecptr AmigaBoardInfo = m68k_areg (regs, 2); - put_word (AmigaBoardInfo + PSSO_BoardInfo_BitsPerCannon, DX_BitsPerCannon ()); - put_word (AmigaBoardInfo + PSSO_BoardInfo_RGBFormats, picasso96_pixel_format); - put_long (AmigaBoardInfo + PSSO_BoardInfo_BoardType, BT_uaegfx); - put_word (AmigaBoardInfo + PSSO_BoardInfo_SoftSpriteFlags, picasso96_pixel_format); - put_word (AmigaBoardInfo + PSSO_BoardInfo_MaxHorResolution + 0, planar.width); - put_word (AmigaBoardInfo + PSSO_BoardInfo_MaxHorResolution + 2, chunky.width); - put_word (AmigaBoardInfo + PSSO_BoardInfo_MaxHorResolution + 4, hicolour.width); - put_word (AmigaBoardInfo + PSSO_BoardInfo_MaxHorResolution + 6, truecolour.width); - put_word (AmigaBoardInfo + PSSO_BoardInfo_MaxHorResolution + 8, alphacolour.width); - put_word (AmigaBoardInfo + PSSO_BoardInfo_MaxVerResolution + 0, planar.height); - put_word (AmigaBoardInfo + PSSO_BoardInfo_MaxVerResolution + 2, chunky.height); - put_word (AmigaBoardInfo + PSSO_BoardInfo_MaxVerResolution + 4, hicolour.height); - put_word (AmigaBoardInfo + PSSO_BoardInfo_MaxVerResolution + 6, truecolour.height); - put_word (AmigaBoardInfo + PSSO_BoardInfo_MaxVerResolution + 8, alphacolour.height); - - for (i = 0; i < mode_count;) { - int j = i; - /* Add a LibResolution structure to the ResolutionsList MinList in our BoardInfo */ - res.DisplayID = AssignModeID (i, LibResolutionStructureCount); - res.BoardInfo = AmigaBoardInfo; - res.Width = DisplayModes[i].res.width; - res.Height = DisplayModes[i].res.height; - res.Flags = P96F_PUBLIC; - memcpy (res.P96ID, "P96-0:", 6); - strcpy (res.Name, "uaegfx:"); - strncat (res.Name, DisplayModes[i].name, strchr (DisplayModes[i].name, ',') - DisplayModes[i].name); - res.Modes[PLANAR] = 0; - res.Modes[CHUNKY] = 0; - res.Modes[HICOLOR] = 0; - res.Modes[TRUECOLOR] = 0; - res.Modes[TRUEALPHA] = 0; - - do { - /* Handle this display mode's depth */ - /* New: Only add the modes when there is enough P96 RTG memory to hold the bitmap */ - if ((allocated_gfxmem - 32768) > - (DisplayModes[i].res.width * DisplayModes[i].res.height * DisplayModes[i].depth)) - { - amigamemptr = gfxmem_start + allocated_gfxmem - (PSSO_ModeInfo_sizeof * ModeInfoStructureCount++); - FillBoardInfo (amigamemptr, &res, &DisplayModes[i]); - } - i++; - } while (i < mode_count - && DisplayModes[i].res.width == DisplayModes[j].res.width - && DisplayModes[i].res.height == DisplayModes[j].res.height); - - amigamemptr = gfxmem_start + allocated_gfxmem - 16384 + (PSSO_LibResolution_sizeof * LibResolutionStructureCount++); - CopyLibResolutionStructureU2A (&res, amigamemptr); - AmigaListAddTail (AmigaBoardInfo + PSSO_BoardInfo_ResolutionsList, amigamemptr); - } - - return -1; -} - -extern int x_size, y_size; - -/* - * SetSwitch: - * a0: struct BoardInfo - * d0.w: BOOL state - * this function should set a board switch to let the Amiga signal pass - * through when supplied with a 0 in d0 and to show the board signal if - * a 1 is passed in d0. You should remember the current state of the - * switch to avoid unneeded switching. If your board has no switch, then - * simply supply a function that does nothing except a RTS. - * - * NOTE: Return the opposite of the switch-state. BDK -*/ -uae_u32 REGPARAM2 picasso_SetSwitch (struct regstruct *regs) -{ - uae_u16 flag = m68k_dreg (regs, 0) & 0xFFFF; - - /* Do not switch immediately. Tell the custom chip emulation about the - * desired state, and wait for custom.c to call picasso_enablescreen - * whenever it is ready to change the screen state. */ - picasso_requested_on = flag; - write_log ("SetSwitch() - trying to show %s screen\n", flag ? "picasso96":"amiga"); - - /* Put old switch-state in D0 */ - return !flag; -} - -void picasso_enablescreen (int on) -{ - wgfx_linestart = 0xFFFFFFFF; - picasso_refresh (1); - write_log ("picasso_enablescreen() showing %s screen\n", on ? "picasso96": "amiga"); - checkrtglibrary(); -} - - -/* - * SetColorArray: - * a0: struct BoardInfo - * d0.w: startindex - * d1.w: count - * when this function is called, your driver has to fetch "count" color - * values starting at "startindex" from the CLUT field of the BoardInfo - * structure and write them to the hardware. The color values are always - * between 0 and 255 for each component regardless of the number of bits - * per cannon your board has. So you might have to shift the colors - * before writing them to the hardware. - */ -uae_u32 REGPARAM2 picasso_SetColorArray (struct regstruct *regs) -{ - /* Fill in some static UAE related structure about this new CLUT setting - * We need this for CLUT-based displays, and for mapping CLUT to hi/true colour */ - uae_u16 start = m68k_dreg (regs, 0); - uae_u16 count = m68k_dreg (regs, 1); - int i; - uaecptr boardinfo = m68k_areg (regs, 0); - uaecptr clut = boardinfo + PSSO_BoardInfo_CLUT + start * 3; - - for (i = start; i < start + count; i++) { - int r = get_byte (clut); - int g = get_byte (clut + 1); - int b = get_byte (clut + 2); - - palette_changed |= (picasso96_state.CLUT[i].Red != r - || picasso96_state.CLUT[i].Green != g - || picasso96_state.CLUT[i].Blue != b); - - picasso96_state.CLUT[i].Red = r; - picasso96_state.CLUT[i].Green = g; - picasso96_state.CLUT[i].Blue = b; - clut += 3; - } - return 1; -} - -/* - * SetDAC: - * a0: struct BoardInfo - * d7: RGBFTYPE RGBFormat - * This function is called whenever the RGB format of the display changes, - * e.g. from chunky to TrueColor. Usually, all you have to do is to set - * the RAMDAC of your board accordingly. - */ -uae_u32 REGPARAM2 picasso_SetDAC (struct regstruct *regs) -{ - /* Fill in some static UAE related structure about this new DAC setting - * Lets us keep track of what pixel format the Amiga is thinking about in our frame-buffer */ - - return 1; -} - -static void init_picasso_screen (void) -{ - if (set_panning_called) { - picasso96_state.Extent = picasso96_state.Address + (picasso96_state.BytesPerRow * picasso96_state.VirtualHeight); - } - - if (set_gc_called) { - gfx_set_picasso_modeinfo (picasso96_state.Width, picasso96_state.Height, - picasso96_state.GC_Depth, (RGBFTYPE) picasso96_state.RGBFormat); - } - if( ( picasso_vidinfo.width == picasso96_state.Width ) && - ( picasso_vidinfo.height == picasso96_state.Height ) && - ( picasso_vidinfo.depth == (picasso96_state.GC_Depth >> 3) ) && - ( picasso_vidinfo.selected_rgbformat == picasso96_state.RGBFormat) ) - { - DX_SetPalette (0, 256); - picasso_refresh (1); - } -} - -/* - * SetGC: - * a0: struct BoardInfo - * a1: struct ModeInfo - * d0: BOOL Border - * This function is called whenever another ModeInfo has to be set. This - * function simply sets up the CRTC and TS registers to generate the - * timing used for that screen mode. You should not set the DAC, clocks - * or linear start adress. They will be set when appropriate by their - * own functions. - */ -uae_u32 REGPARAM2 picasso_SetGC (struct regstruct *regs) -{ - /* Fill in some static UAE related structure about this new ModeInfo setting */ - uae_u32 border = m68k_dreg (regs, 0); - uaecptr modeinfo = m68k_areg (regs, 1); - - picasso96_state.Width = get_word (modeinfo + PSSO_ModeInfo_Width); - picasso96_state.VirtualWidth = picasso96_state.Width; /* in case SetPanning doesn't get called */ - - picasso96_state.Height = get_word (modeinfo + PSSO_ModeInfo_Height); - picasso96_state.VirtualHeight = picasso96_state.Height; /* in case SetPanning doesn't get called */ - - picasso96_state.GC_Depth = get_byte (modeinfo + PSSO_ModeInfo_Depth); - picasso96_state.GC_Flags = get_byte (modeinfo + PSSO_ModeInfo_Flags); - - set_gc_called = 1; - picasso96_state.HostAddress = NULL; - - init_picasso_screen (); - init_hz_p96 (); - return 1; -} - -/* - * SetPanning: - * a0: struct BoardInfo - * a1: UBYTE *Memory - * d0: uae_u16 Width - * d1: WORD XOffset - * d2: WORD YOffset - * d7: RGBFTYPE RGBFormat - * This function sets the view origin of a display which might also be - * overscanned. In register a1 you get the start address of the screen - * bitmap on the Amiga side. You will have to subtract the starting - * address of the board memory from that value to get the memory start - * offset within the board. Then you get the offset in pixels of the - * left upper edge of the visible part of an overscanned display. From - * these values you will have to calculate the LinearStartingAddress - * fields of the CRTC registers. - - * NOTE: SetPanning() can be used to know when a Picasso96 screen is - * being opened. Better to do the appropriate clearing of the - * background here than in SetSwitch() derived functions, - * because SetSwitch() is not called for subsequent Picasso screens. - */ -uae_u32 REGPARAM2 picasso_SetPanning (struct regstruct *regs) -{ - uae_u16 Width = m68k_dreg (regs, 0); - uaecptr start_of_screen = m68k_areg (regs, 1); - uaecptr bi = m68k_areg (regs, 0); - uaecptr bmeptr = get_long (bi + PSSO_BoardInfo_BitMapExtra); /* Get our BoardInfo ptr's BitMapExtra ptr */ - uae_u16 bme_width, bme_height; - - bme_width = get_word (bmeptr + PSSO_BitMapExtra_Width); - bme_height = get_word (bmeptr + PSSO_BitMapExtra_Height); - - picasso96_state.Address = start_of_screen; /* Amiga-side address */ - picasso96_state.XOffset = (uae_s16) (m68k_dreg (regs, 1) & 0xFFFF); - picasso96_state.YOffset = (uae_s16) (m68k_dreg (regs, 2) & 0xFFFF); - picasso96_state.VirtualWidth = bme_width; - picasso96_state.VirtualHeight = bme_height; - picasso96_state.RGBFormat = m68k_dreg (regs, 7); - picasso96_state.BytesPerPixel = GetBytesPerPixel (picasso96_state.RGBFormat); - picasso96_state.BytesPerRow = bme_width * picasso96_state.BytesPerPixel; - - set_panning_called = 1; - init_picasso_screen (); - set_panning_called = 0; - - return 1; -} - -static void do_xor8 (uae_u8 * ptr, long len, uae_u32 val) -{ - int i; - for (i = 0; i < len; i++, ptr++) { - do_put_mem_byte (ptr, (uae_u8)(do_get_mem_byte (ptr) ^ val)); - } -} - -/* - * InvertRect: - * - * Inputs: - * a0:struct BoardInfo *bi - * a1:struct RenderInfo *ri - * d0.w:X - * d1.w:Y - * d2.w:Width - * d3.w:Height - * d4.l:Mask - * d7.l:RGBFormat - * - * This function is used to invert a rectangular area on the board. It is called by BltBitMap, - * BltPattern and BltTemplate. - */ -uae_u32 REGPARAM2 picasso_InvertRect (struct regstruct *regs) -{ - uaecptr renderinfo = m68k_areg (regs, 1); - unsigned long X = (uae_u16)m68k_dreg (regs, 0); - unsigned long Y = (uae_u16)m68k_dreg (regs, 1); - unsigned long Width = (uae_u16)m68k_dreg (regs, 2); - unsigned long Height = (uae_u16)m68k_dreg (regs, 3); - uae_u8 mask = (uae_u8)m68k_dreg (regs, 4); - int Bpp = GetBytesPerPixel (m68k_dreg (regs, 7)); - uae_u32 xorval; - unsigned int lines; - struct RenderInfo ri; - uae_u8 *uae_mem, *rectstart; - unsigned long width_in_bytes; - uae_u32 result = 0; - - wgfx_flushline (); - - if (CopyRenderInfoStructureA2U (renderinfo, &ri)) { - if (mask != 0xFF && Bpp > 1) - mask = 0xFF; - - xorval = 0x01010101 * (mask & 0xFF); - width_in_bytes = Bpp * Width; - rectstart = uae_mem = ri.Memory + Y*ri.BytesPerRow + X*Bpp; - - for (lines = 0; lines < Height; lines++, uae_mem += ri.BytesPerRow) - do_xor8 (uae_mem, width_in_bytes, xorval); - - if (renderinfo_is_current_screen (&ri)) { - if (mask == 0xFF) - do_invertrect (&ri, Bpp, X, Y, Width, Height); - else - do_blit( &ri, Bpp, X, Y, X, Y, Width, Height, BLIT_SRC, 0); - } - result = 1; - } - return result; /* 1 if supported, 0 otherwise */ -} - -/*********************************************************** -FillRect: -*********************************************************** -* a0: struct BoardInfo * -* a1: struct RenderInfo * -* d0: WORD X -* d1: WORD Y -* d2: WORD Width -* d3: WORD Height -* d4: uae_u32 Pen -* d5: UBYTE Mask -* d7: uae_u32 RGBFormat -***********************************************************/ -uae_u32 REGPARAM2 picasso_FillRect (struct regstruct *regs) -{ - uaecptr renderinfo = m68k_areg (regs, 1); - uae_u32 X = (uae_u16)m68k_dreg (regs, 0); - uae_u32 Y = (uae_u16)m68k_dreg (regs, 1); - uae_u32 Width = (uae_u16)m68k_dreg (regs, 2); - uae_u32 Height = (uae_u16)m68k_dreg (regs, 3); - uae_u32 Pen = m68k_dreg (regs, 4); - uae_u8 Mask = (uae_u8)m68k_dreg (regs, 5); - RGBFTYPE RGBFormat = (RGBFTYPE) m68k_dreg (regs, 7); - - uae_u8 *src; - uae_u8 *oldstart; - int Bpp; - struct RenderInfo ri; - uae_u32 result = 0; - - if (Width * Height <= 2500) - return 0; - -#ifdef JIT - special_mem|=S_WRITE|S_READ; -#endif - - wgfx_flushline (); - - if (CopyRenderInfoStructureA2U (renderinfo, &ri) && Y != 0xFFFF) { - if (ri.RGBFormat != RGBFormat) - write_log ("Weird Stuff!\n"); - - Bpp = GetBytesPerPixel (RGBFormat); - - if (Bpp > 1) - Mask = 0xFF; - - if (Mask == 0xFF) { - if ((Width == 1) || (Height == 1)) { - int i; - uaecptr addr; - if (renderinfo_is_current_screen (&ri)) { - uae_u32 diff = gfxmem_start - (uae_u32)gfxmemory; - addr = (uaecptr)ri.Memory + X * Bpp + Y * ri.BytesPerRow + diff; - - if (Width == 1) { - for (i = 0; i < Height; i++) { - if( Bpp == 4 ) - gfxmem_lput (addr + (i * picasso96_state.BytesPerRow), Pen); - else if (Bpp == 2) - gfxmem_wput (addr + (i * picasso96_state.BytesPerRow), Pen); - else - gfxmem_bput (addr + (i * picasso96_state.BytesPerRow), Pen); - } - } else if (Height == 1) { - for (i = 0; i < Width; i++) { - if (Bpp == 4) - gfxmem_lput (addr + (i*Bpp), Pen); - else if (Bpp == 2) - gfxmem_wput (addr + (i*Bpp), Pen); - else - gfxmem_bput( addr + (i*Bpp), Pen ); - } - } - return 1; - } - } - - /* Do the fill-rect in the frame-buffer */ - do_fillrect_frame_buffer (&ri, X, Y, Width, Height, Pen, Bpp, RGBFormat); - - /* Now we do the on-screen display, if renderinfo points to it */ - if (renderinfo_is_current_screen (&ri)) { - src = ri.Memory + X * Bpp + Y * ri.BytesPerRow; - X = X - picasso96_state.XOffset; - Y = Y - picasso96_state.YOffset; - if ((int)X < 0) - {Width = Width + X; X=0;} - if ((int)Width < 1) - return 1; - if ((int)Y < 0) - {Height = Height + Y; Y=0;} - if ((int)Height < 1) - return 1; - - /* Argh - why does P96Speed do this to me, with FillRect only?! */ - if ((X < picasso96_state.Width) && (Y < picasso96_state.Height)) { - if (X + Width > picasso96_state.Width) - Width = picasso96_state.Width - X; - if (Y+Height > picasso96_state.Height) - Height = picasso96_state.Height - Y; - - do_fillrect (src, X, Y, Width, Height, Pen, Bpp, RGBFormat); - } - } - result = 1; - } else { - /* We get here only if Mask != 0xFF */ - if (Bpp != 1) { - write_log( "WARNING - FillRect() has unhandled mask 0x%x with Bpp %d. Using fall-back routine.\n", Mask, Bpp); - } else { - Pen &= Mask; - Mask = ~Mask; - oldstart = ri.Memory + Y * ri.BytesPerRow + X * Bpp; - { - uae_u8 *start = oldstart; - uae_u8 *end = start + Height * ri.BytesPerRow; - for (; start != end; start += ri.BytesPerRow) { - uae_u8 *p = start; - unsigned long cols; - for (cols = 0; cols < Width; cols++) { - uae_u32 tmpval = do_get_mem_byte (p + cols) & Mask; - do_put_mem_byte (p + cols, (uae_u8)(Pen | tmpval)); - } - } - } - if (renderinfo_is_current_screen (&ri)) - do_blit( &ri, Bpp, X, Y, X, Y, Width, Height, BLIT_SRC, 0); - result = 1; - } - } - } - - return result; -} - -/* -* BlitRect() is a generic (any chunky pixel format) rectangle copier -* NOTE: If dstri is NULL, then we're only dealing with one RenderInfo area, and called from picasso_BlitRect() -* -* OpCodes: -* 0 = FALSE: dst = 0 -* 1 = NOR: dst = ~(src | dst) -* 2 = ONLYDST: dst = dst & ~src -* 3 = NOTSRC: dst = ~src -* 4 = ONLYSRC: dst = src & ~dst -* 5 = NOTDST: dst = ~dst -* 6 = EOR: dst = src^dst -* 7 = NAND: dst = ~(src & dst) -* 8 = AND: dst = (src & dst) -* 9 = NEOR: dst = ~(src ^ dst) -*10 = DST: dst = dst -*11 = NOTONLYSRC: dst = ~src | dst -*12 = SRC: dst = src -*13 = NOTONLYDST: dst = ~dst | src -*14 = OR: dst = src | dst -*15 = TRUE: dst = 0xFF -*/ -struct blitdata -{ - struct RenderInfo ri_struct; - struct RenderInfo dstri_struct; - struct RenderInfo *ri; /* Self-referencing pointers */ - struct RenderInfo *dstri; - unsigned long srcx; - unsigned long srcy; - unsigned long dstx; - unsigned long dsty; - unsigned long width; - unsigned long height; - uae_u8 mask; - BLIT_OPCODE opcode; -} blitrectdata; - -STATIC_INLINE int BlitRectHelper( void ) -{ - struct RenderInfo *ri = blitrectdata.ri; - struct RenderInfo *dstri = blitrectdata.dstri; - unsigned long srcx = blitrectdata.srcx; - unsigned long srcy = blitrectdata.srcy; - unsigned long dstx = blitrectdata.dstx; - unsigned long dsty = blitrectdata.dsty; - unsigned long width = blitrectdata.width; - unsigned long height = blitrectdata.height; - uae_u8 mask = blitrectdata.mask; - BLIT_OPCODE opcode = blitrectdata.opcode; - - uae_u8 Bpp = GetBytesPerPixel (ri->RGBFormat); - unsigned long total_width = width * Bpp; - unsigned long linewidth = (total_width + 15) & ~15; - int can_do_visible_blit = 0; - - if (opcode == BLIT_DST) { - write_log( "WARNING: BlitRect() being called with opcode of BLIT_DST\n" ); - return 1; - } - - /* - * If we have no destination RenderInfo, then we're dealing with a single-buffer action, called - * from picasso_BlitRect(). The code in do_blitrect_frame_buffer() deals with the frame-buffer, - * while the do_blit() code deals with the visible screen. - * - * If we have a destination RenderInfo, then we've been called from picasso_BlitRectNoMaskComplete() - * and we need to put the results on the screen from the frame-buffer. - */ - if (dstri == NULL || dstri->Memory == ri->Memory) { - if (mask != 0xFF && Bpp > 1) { - mask = 0xFF; - } - dstri = ri; - can_do_visible_blit = 1; - } - - /* Do our virtual frame-buffer memory first */ - do_blitrect_frame_buffer (ri, dstri, srcx, srcy, dstx, dsty, width, height, mask, opcode); - /* Now we do the on-screen display, if renderinfo points to it */ - - if (renderinfo_is_current_screen (dstri)) { - if (mask == 0xFF || Bpp > 1) { - if (can_do_visible_blit) - do_blit (dstri, Bpp, srcx, srcy, dstx, dsty, width, height, opcode, 1); - else - do_blit (dstri, Bpp, dstx, dsty, dstx, dsty, width, height, opcode, 0); - } else { - do_blit (dstri, Bpp, dstx, dsty, dstx, dsty, width, height, opcode, 0); - } - } - - return 1; -} - -STATIC_INLINE int BlitRect (uaecptr ri, uaecptr dstri, - unsigned long srcx, unsigned long srcy, unsigned long dstx, unsigned long dsty, - unsigned long width, unsigned long height, uae_u8 mask, BLIT_OPCODE opcode ) -{ - /* Set up the params */ - CopyRenderInfoStructureA2U( ri, &blitrectdata.ri_struct ); - blitrectdata.ri = &blitrectdata.ri_struct; - - if (dstri) { - CopyRenderInfoStructureA2U( dstri, &blitrectdata.dstri_struct ); - blitrectdata.dstri = &blitrectdata.dstri_struct; - } else - { - blitrectdata.dstri = NULL; - } - blitrectdata.srcx = srcx; - blitrectdata.srcy = srcy; - blitrectdata.dstx = dstx; - blitrectdata.dsty = dsty; - blitrectdata.width = width; - blitrectdata.height = height; - blitrectdata.mask = mask; - blitrectdata.opcode = opcode; - - return BlitRectHelper(); -} - -/*********************************************************** -BlitRect: -*********************************************************** -* a0: struct BoardInfo -* a1: struct RenderInfo -* d0: WORD SrcX -* d1: WORD SrcY -* d2: WORD DstX -* d3: WORD DstY -* d4: WORD Width -* d5: WORD Height -* d6: UBYTE Mask -* d7: uae_u32 RGBFormat -***********************************************************/ -uae_u32 REGPARAM2 picasso_BlitRect (struct regstruct *regs) -{ - uaecptr renderinfo = m68k_areg (regs, 1); - unsigned long srcx = (uae_u16)m68k_dreg (regs, 0); - unsigned long srcy = (uae_u16)m68k_dreg (regs, 1); - unsigned long dstx = (uae_u16)m68k_dreg (regs, 2); - unsigned long dsty = (uae_u16)m68k_dreg (regs, 3); - unsigned long width = (uae_u16)m68k_dreg (regs, 4); - unsigned long height = (uae_u16)m68k_dreg (regs, 5); - uae_u8 Mask = (uae_u8) m68k_dreg (regs, 6); - uae_u32 result = 0; - -#ifdef JIT - special_mem|=S_WRITE|S_READ; -#endif - - wgfx_flushline (); - - result = BlitRect (renderinfo, (uaecptr)NULL, srcx, srcy, dstx, dsty, width, height, Mask, BLIT_SRC); - - return result; -} - -/*********************************************************** -BlitRectNoMaskComplete: -*********************************************************** -* a0: struct BoardInfo -* a1: struct RenderInfo (src) -* a2: struct RenderInfo (dst) -* d0: WORD SrcX -* d1: WORD SrcY -* d2: WORD DstX -* d3: WORD DstY -* d4: WORD Width -* d5: WORD Height -* d6: UBYTE OpCode -* d7: uae_u32 RGBFormat -* NOTE: MUST return 0 in D0 if we're not handling this operation -* because the RGBFormat or opcode aren't supported. -* OTHERWISE return 1 -***********************************************************/ -uae_u32 REGPARAM2 picasso_BlitRectNoMaskComplete (struct regstruct *regs) -{ - uaecptr srcri = m68k_areg (regs, 1); - uaecptr dstri = m68k_areg (regs, 2); - unsigned long srcx = (uae_u16)m68k_dreg (regs, 0); - unsigned long srcy = (uae_u16)m68k_dreg (regs, 1); - unsigned long dstx = (uae_u16)m68k_dreg (regs, 2); - unsigned long dsty = (uae_u16)m68k_dreg (regs, 3); - unsigned long width = (uae_u16)m68k_dreg (regs, 4); - unsigned long height = (uae_u16)m68k_dreg (regs, 5); - uae_u8 OpCode = m68k_dreg (regs, 6); - uae_u32 RGBFmt = m68k_dreg (regs, 7); - uae_u32 result = 0; - -#ifdef JIT - special_mem|=S_WRITE|S_READ; -#endif - - wgfx_flushline (); - - result = BlitRect (srcri, dstri, srcx, srcy, dstx, dsty, width, height, 0xFF, (BLIT_OPCODE)OpCode); - - return result; -} - -/* This utility function is used both by BlitTemplate() and BlitPattern() */ -STATIC_INLINE void PixelWrite1 (uae_u8 * mem, int bits, uae_u32 fgpen, uae_u32 mask) -{ - if (mask != 0xFF) - fgpen = (fgpen & mask) | (do_get_mem_byte (mem + bits) & ~mask); - do_put_mem_byte (mem + bits, fgpen); -} - -STATIC_INLINE void PixelWrite2 (uae_u8 * mem, int bits, uae_u32 fgpen) -{ - do_put_mem_word (((uae_u16 *) mem) + bits, fgpen); -} - -STATIC_INLINE void PixelWrite3 (uae_u8 * mem, int bits, uae_u32 fgpen) -{ - do_put_mem_byte (mem + bits * 3, fgpen & 0x000000FF); - *(uae_u16 *) (mem + bits * 3 + 1) = (fgpen & 0x00FFFF00) >> 8; -} - -STATIC_INLINE void PixelWrite4 (uae_u8 * mem, int bits, uae_u32 fgpen) -{ - do_put_mem_long (((uae_u32 *) mem) + bits, fgpen); -} - -STATIC_INLINE void PixelWrite (uae_u8 * mem, int bits, uae_u32 fgpen, uae_u8 Bpp, uae_u32 mask) -{ - switch (Bpp) { - case 1: - if (mask != 0xFF) - fgpen = (fgpen & mask) | (do_get_mem_byte (mem + bits) & ~mask); - do_put_mem_byte (mem + bits, (uae_u8)fgpen); - break; - case 2: - do_put_mem_word (((uae_u16 *) mem) + bits, (uae_u16)fgpen); - break; - case 3: - do_put_mem_byte (mem + bits * 3, (uae_u8)fgpen); - *(uae_u16 *) (mem + bits * 3 + 1) = (fgpen & 0x00FFFF00) >> 8; - break; - case 4: - do_put_mem_long (((uae_u32 *) mem) + bits, fgpen); - break; - } -} - -/* - * BlitPattern: - * - * Synopsis:BlitPattern(bi, ri, pattern, X, Y, Width, Height, Mask, RGBFormat); - * Inputs: - * a0:struct BoardInfo *bi - * a1:struct RenderInfo *ri - * a2:struct Pattern *pattern - * d0.w:X - * d1.w:Y - * d2.w:Width - * d3.w:Height - * d4.w:Mask - * d7.l:RGBFormat - * - * This function is used to paint a pattern on the board memory using the blitter. It is called by - * BltPattern, if a AreaPtrn is used with positive AreaPtSz. The pattern consists of a b/w image - * using a single plane of image data which will be expanded repeatedly to the destination RGBFormat - * using ForeGround and BackGround pens as well as draw modes. The width of the pattern data is - * always 16 pixels (one word) and the height is calculated as 2^Size. The data must be shifted up - * and to the left by XOffset and YOffset pixels at the beginning. - */ -uae_u32 REGPARAM2 picasso_BlitPattern (struct regstruct *regs) -{ - uaecptr rinf = m68k_areg (regs, 1); - uaecptr pinf = m68k_areg (regs, 2); - unsigned long X = (uae_u16)m68k_dreg (regs, 0); - unsigned long Y = (uae_u16)m68k_dreg (regs, 1); - unsigned long W = (uae_u16)m68k_dreg (regs, 2); - unsigned long H = (uae_u16)m68k_dreg (regs, 3); - uae_u8 Mask = (uae_u8) m68k_dreg (regs, 4); - uae_u32 RGBFmt = m68k_dreg (regs, 7); - uae_u8 Bpp = GetBytesPerPixel (RGBFmt); - int inversion = 0; - struct RenderInfo ri; - struct Pattern pattern; - unsigned long rows; - uae_u32 fgpen; - uae_u8 *uae_mem; - int xshift; - unsigned long ysize_mask; - uae_u32 result = 0; - -#ifdef JIT - special_mem|=S_WRITE|S_READ; -#endif - - wgfx_flushline (); - - if (CopyRenderInfoStructureA2U (rinf, &ri) && CopyPatternStructureA2U (pinf, &pattern)) { - Bpp = GetBytesPerPixel (ri.RGBFormat); - uae_mem = ri.Memory + Y*ri.BytesPerRow + X*Bpp; /* offset with address */ - - if (pattern.DrawMode & INVERS) - inversion = 1; - - pattern.DrawMode &= 0x03; - - if (Mask != 0xFF) { - if( Bpp > 1 ) - Mask = 0xFF; - - if( pattern.DrawMode == COMP) - { - write_log ("WARNING - BlitPattern() has unhandled mask 0x%x with COMP DrawMode. Using fall-back routine.\n", Mask); - } - else - { - result = 1; - } - } else - { - result = 1; - } - - if (result) { - ysize_mask = (1 << pattern.Size) - 1; - xshift = pattern.XOffset & 15; - - for (rows = 0; rows < H; rows++, uae_mem += ri.BytesPerRow) { - unsigned long prow = (rows + pattern.YOffset) & ysize_mask; - unsigned int d = do_get_mem_word (((uae_u16 *)pattern.Memory) + prow); - uae_u8 *uae_mem2 = uae_mem; - unsigned long cols; - - if (xshift != 0) - d = (d << xshift) | (d >> (16 - xshift)); - - for (cols = 0; cols < W; cols += 16, uae_mem2 += Bpp << 4) { - long bits; - long max = W - cols; - unsigned int data = d; - - if (max > 16) - max = 16; - - for (bits = 0; bits < max; bits++) { - int bit_set = data & 0x8000; - data <<= 1; - switch (pattern.DrawMode) { - case JAM1: - if (inversion) - bit_set = !bit_set; - if (bit_set) - PixelWrite (uae_mem2, bits, pattern.FgPen, Bpp, Mask); - break; - case JAM2: - if (inversion) - bit_set = !bit_set; - if (bit_set) - PixelWrite (uae_mem2, bits, pattern.FgPen, Bpp, Mask); - else - PixelWrite (uae_mem2, bits, pattern.BgPen, Bpp, Mask); - break; - case COMP: - if (bit_set) { - fgpen = pattern.FgPen; - - switch (Bpp) { - case 1: - { - uae_u8 *addr = uae_mem2 + bits; - do_put_mem_byte (addr, (uae_u8)(do_get_mem_byte (addr) ^ fgpen)); - } - break; - case 2: - { - uae_u16 *addr = ((uae_u16 *)uae_mem2) + bits; - do_put_mem_word (addr, (uae_u16)(do_get_mem_word (addr) ^ fgpen)); - } - break; - case 3: - { - uae_u32 *addr = (uae_u32 *)(uae_mem2 + bits * 3); - do_put_mem_long (addr, do_get_mem_long (addr) ^ (fgpen & 0x00FFFFFF)); - } - break; - case 4: - { - uae_u32 *addr = ((uae_u32 *)uae_mem2) + bits; - do_put_mem_long (addr, do_get_mem_long (addr) ^ fgpen); - } - break; - } /* switch (Bpp) */ - } - break; - } /* switch (pattern.DrawMode) */ - } /* for (bits) */ - } /* for (cols) */ - } /* for (rows) */ - - /* If we need to update a second-buffer (extra_mem is set), then do it only if visible! */ - if (picasso_vidinfo.extra_mem && renderinfo_is_current_screen (&ri)) - do_blit( &ri, Bpp, X, Y, X, Y, W, H, BLIT_SRC, 0); - - result = 1; - } - } - return result; -} - -/************************************************* -BlitTemplate: -************************************************** -* Synopsis: BlitTemplate(bi, ri, template, X, Y, Width, Height, Mask, RGBFormat); -* a0: struct BoardInfo *bi -* a1: struct RenderInfo *ri -* a2: struct Template *template -* d0.w: X -* d1.w: Y -* d2.w: Width -* d3.w: Height -* d4.w: Mask -* d7.l: RGBFormat -* -* This function is used to paint a template on the board memory using the blitter. -* It is called by BltPattern and BltTemplate. The template consists of a b/w image -* using a single plane of image data which will be expanded to the destination RGBFormat -* using ForeGround and BackGround pens as well as draw modes. -***********************************************************************************/ -uae_u32 REGPARAM2 picasso_BlitTemplate (struct regstruct *regs) -{ - uae_u8 inversion = 0; - uaecptr rinf = m68k_areg (regs, 1); - uaecptr tmpl = m68k_areg (regs, 2); - unsigned long X = (uae_u16)m68k_dreg (regs, 0); - unsigned long Y = (uae_u16)m68k_dreg (regs, 1); - unsigned long W = (uae_u16)m68k_dreg (regs, 2); - unsigned long H = (uae_u16)m68k_dreg (regs, 3); - uae_u16 Mask = (uae_u16)m68k_dreg (regs, 4); - struct Template tmp; - struct RenderInfo ri; - unsigned long rows; - int bitoffset; - uae_u32 fgpen; - uae_u8 *uae_mem, Bpp; - uae_u8 *tmpl_base; - uae_u32 result = 0; - -#ifdef JIT - special_mem|=S_WRITE|S_READ; -#endif - - wgfx_flushline (); - - if (CopyRenderInfoStructureA2U (rinf, &ri) && CopyTemplateStructureA2U (tmpl, &tmp)) { - Bpp = GetBytesPerPixel (ri.RGBFormat); - uae_mem = ri.Memory + Y*ri.BytesPerRow + X*Bpp; /* offset into address */ - - if (tmp.DrawMode & INVERS) - inversion = 1; - - tmp.DrawMode &= 0x03; - - if (Mask != 0xFF) { - if (Bpp > 1) - Mask = 0xFF; - - if (tmp.DrawMode == COMP) { - write_log ("WARNING - BlitTemplate() has unhandled mask 0x%x with COMP DrawMode. Using fall-back routine.\n", Mask); - return 0; - } else - result = 1; - } else - result = 1; - -#if 1 - if (tmp.DrawMode == COMP) { - /* workaround, let native blitter handle COMP mode */ - return 0; - } -#endif - - if (result) { - bitoffset = tmp.XOffset % 8; - - tmpl_base = (uae_u8 *)tmp.Memory + tmp.XOffset / 8; - - for (rows = 0; rows < H; rows++, uae_mem += ri.BytesPerRow, tmpl_base += tmp.BytesPerRow) { - unsigned long cols; - uae_u8 *tmpl_mem = tmpl_base; - uae_u8 *uae_mem2 = uae_mem; - unsigned int data = *tmpl_mem; - - for (cols = 0; cols < W; cols += 8, uae_mem2 += Bpp << 3) { - unsigned int byte; - long bits; - long max = W - cols; - - if (max > 8) - max = 8; - - data <<= 8; - data |= *++tmpl_mem; - - byte = data >> (8 - bitoffset); - - for (bits = 0; bits < max; bits++) { - int bit_set = (byte & 0x80); - byte <<= 1; - switch (tmp.DrawMode) { - case JAM1: - if (inversion) - bit_set = !bit_set; - if (bit_set) { - fgpen = tmp.FgPen; - PixelWrite (uae_mem2, bits, fgpen, Bpp, Mask); - } - break; - case JAM2: - if (inversion) - bit_set = !bit_set; - fgpen = tmp.BgPen; - if (bit_set) - fgpen = tmp.FgPen; - PixelWrite (uae_mem2, bits, fgpen, Bpp, Mask); - break; - case COMP: - if (bit_set) { - fgpen = tmp.FgPen; - - switch (Bpp) { - case 1: - { - uae_u8 *addr = uae_mem2 + bits; - do_put_mem_byte (addr, (uae_u8) (do_get_mem_byte (addr) ^ fgpen)); - } - break; - case 2: - { - uae_u16 *addr = ((uae_u16 *)uae_mem2) + bits; - do_put_mem_word (addr, (uae_u16) (do_get_mem_word (addr) ^ fgpen)); - } - break; - case 3: - { - uae_u32 *addr = (uae_u32 *)(uae_mem2 + bits * 3); - do_put_mem_long (addr, do_get_mem_long (addr) ^ (fgpen & 0x00FFFFFF)); - } - break; - case 4: - { - uae_u32 *addr = ((uae_u32 *)uae_mem2) + bits; - do_put_mem_long (addr, do_get_mem_long (addr) ^ fgpen); - } - break; - } /* switch (Bpp) */ - } /* if (bit_set) */ - break; - } /* switch (tmp.DrawMode) */ - } /* for (bits) */ - } /* for (cols) */ - } /* for (rows) */ - - /* If we need to update a second-buffer (extra_mem is set), then do it only if visible! */ - if (picasso_vidinfo.extra_mem && renderinfo_is_current_screen (&ri)) - do_blit (&ri, Bpp, X, Y, X, Y, W, H, BLIT_SRC, 0); - - result = 1; - } - } - - return 1; -} - -/* - * CalculateBytesPerRow: - * a0: struct BoardInfo - * d0: uae_u16 Width - * d7: RGBFTYPE RGBFormat - * This function calculates the amount of bytes needed for a line of - * "Width" pixels in the given RGBFormat. - */ -uae_u32 REGPARAM2 picasso_CalculateBytesPerRow (struct regstruct *regs) -{ - uae_u16 width = m68k_dreg (regs, 0); - uae_u32 type = m68k_dreg (regs, 7); - - width = GetBytesPerPixel (type) * width; - return width; -} - -/* - * SetDisplay: - * a0: struct BoardInfo - * d0: BOOL state - * This function enables and disables the video display. - * - * NOTE: return the opposite of the state - */ -uae_u32 REGPARAM2 picasso_SetDisplay (struct regstruct *regs) -{ - uae_u32 state = m68k_dreg (regs, 0); - return !state; -} - -void init_hz_p96 (void) -{ -} - -/* NOTE: Watch for those planeptrs of 0x00000000 and 0xFFFFFFFF for all zero / all one bitmaps !!!! */ -static void PlanarToChunky (struct RenderInfo *ri, struct BitMap *bm, - unsigned long srcx, unsigned long srcy, - unsigned long dstx, unsigned long dsty, - unsigned long width, unsigned long height, - uae_u8 mask) -{ - int j; - - uae_u8 *PLANAR[8], *image = ri->Memory + dstx * GetBytesPerPixel (ri->RGBFormat) + dsty * ri->BytesPerRow; - int Depth = bm->Depth; - unsigned long rows, bitoffset = srcx & 7; - long eol_offset; - - /* if (mask != 0xFF) - write_log ("P2C - pixel-width = %d, bit-offset = %d\n", width, bitoffset); */ - - /* Set up our bm->Planes[] pointers to the right horizontal offset */ - for (j = 0; j < Depth; j++) { - uae_u8 *p = bm->Planes[j]; - if (p != &all_zeros_bitmap && p != &all_ones_bitmap) - p += srcx / 8 + srcy * bm->BytesPerRow; - PLANAR[j] = p; - if ((mask & (1 << j)) == 0) - PLANAR[j] = &all_zeros_bitmap; - } - eol_offset = (long) bm->BytesPerRow - (long) ((width + 7) >> 3); - for (rows = 0; rows < height; rows++, image += ri->BytesPerRow) { - unsigned long cols; - - for (cols = 0; cols < width; cols += 8) { - int k; - uae_u32 a = 0, b = 0; - unsigned int msk = 0xFF; - long tmp = cols + 8 - width; - if (tmp > 0) { - msk <<= tmp; - b = do_get_mem_long ((uae_u32 *) (image + cols + 4)); - if (tmp < 4) - b &= 0xFFFFFFFF >> (32 - tmp * 8); - else if (tmp > 4) { - a = do_get_mem_long ((uae_u32 *) (image + cols)); - a &= 0xFFFFFFFF >> (64 - tmp * 8); - } - } - for (k = 0; k < Depth; k++) { - unsigned int data; - if (PLANAR[k] == &all_zeros_bitmap) - data = 0; - else if (PLANAR[k] == &all_ones_bitmap) - data = 0xFF; - else { - data = (uae_u8) (do_get_mem_word ((uae_u16 *) PLANAR[k]) >> (8 - bitoffset)); - PLANAR[k]++; - } - data &= msk; - a |= p2ctab[data][0] << k; - b |= p2ctab[data][1] << k; - } - do_put_mem_long ((uae_u32 *) (image + cols), a); - do_put_mem_long ((uae_u32 *) (image + cols + 4), b); - } - for (j = 0; j < Depth; j++) { - if (PLANAR[j] != &all_zeros_bitmap && PLANAR[j] != &all_ones_bitmap) { - PLANAR[j] += eol_offset; - } - } - } -} - -/* - * BlitPlanar2Chunky: - * a0: struct BoardInfo *bi - * a1: struct BitMap *bm - source containing planar information and assorted details - * a2: struct RenderInfo *ri - dest area and its details - * d0.w: SrcX - * d1.w: SrcY - * d2.w: DstX - * d3.w: DstY - * d4.w: SizeX - * d5.w: SizeY - * d6.b: MinTerm - uh oh! - * d7.b: Mask - uh oh! - * - * This function is currently used to blit from planar bitmaps within system memory to chunky bitmaps - * on the board. Watch out for plane pointers that are 0x00000000 (represents a plane with all bits "0") - * or 0xffffffff (represents a plane with all bits "1"). - */ -uae_u32 REGPARAM2 picasso_BlitPlanar2Chunky (struct regstruct *regs) -{ - uaecptr bm = m68k_areg (regs, 1); - uaecptr ri = m68k_areg (regs, 2); - unsigned long srcx = (uae_u16) m68k_dreg (regs, 0); - unsigned long srcy = (uae_u16) m68k_dreg (regs, 1); - unsigned long dstx = (uae_u16) m68k_dreg (regs, 2); - unsigned long dsty = (uae_u16) m68k_dreg (regs, 3); - unsigned long width = (uae_u16) m68k_dreg (regs, 4); - unsigned long height = (uae_u16) m68k_dreg (regs, 5); - uae_u8 minterm = m68k_dreg (regs, 6) & 0xFF; - uae_u8 mask = m68k_dreg (regs, 7) & 0xFF; - struct RenderInfo local_ri; - struct BitMap local_bm; - uae_u32 result = 0; - -#ifdef JIT - special_mem|=S_WRITE|S_READ; -#endif - - wgfx_flushline (); - - if (minterm != 0x0C) { - write_log ("ERROR - BlitPlanar2Chunky() has minterm 0x%x, which I don't handle. Using fall-back routine.\n", minterm); - } - else if (CopyRenderInfoStructureA2U (ri, &local_ri) && CopyBitMapStructureA2U (bm, &local_bm)) - { - PlanarToChunky (&local_ri, &local_bm, srcx, srcy, dstx, dsty, width, height, mask); - if (renderinfo_is_current_screen (&local_ri)) - { - do_blit (&local_ri, GetBytesPerPixel (local_ri.RGBFormat), dstx, dsty, dstx, dsty, width, height, BLIT_SRC, 0); - } - result = 1; - } - - return result; -} - -/* NOTE: Watch for those planeptrs of 0x00000000 and 0xFFFFFFFF for all zero / all one bitmaps !!!! */ -static void PlanarToDirect (struct RenderInfo *ri, struct BitMap *bm, - unsigned long srcx, unsigned long srcy, - unsigned long dstx, unsigned long dsty, - unsigned long width, unsigned long height, uae_u8 mask, - struct ColorIndexMapping *cim) -{ - int j; - int bpp = GetBytesPerPixel (ri->RGBFormat); - uae_u8 *PLANAR[8]; - uae_u8 *image = ri->Memory + dstx * bpp + dsty * ri->BytesPerRow; - int Depth = bm->Depth; - unsigned long rows; - long eol_offset; - - if( !bpp ) - return; - - /* Set up our bm->Planes[] pointers to the right horizontal offset */ - for (j = 0; j < Depth; j++) { - uae_u8 *p = bm->Planes[j]; - if (p != &all_zeros_bitmap && p != &all_ones_bitmap) - p += srcx / 8 + srcy * bm->BytesPerRow; - PLANAR[j] = p; - if ((mask & (1 << j)) == 0) - PLANAR[j] = &all_zeros_bitmap; - } - - eol_offset = (long) bm->BytesPerRow - (long) ((width + (srcx & 7)) >> 3); - for (rows = 0; rows < height; rows++, image += ri->BytesPerRow) { - unsigned long cols; - uae_u8 *image2 = image; - unsigned int bitoffs = 7 - (srcx & 7); - int i; - - for (cols = 0; cols < width; cols++) { - int v = 0, k; - for (k = 0; k < Depth; k++) { - if (PLANAR[k] == &all_ones_bitmap) - v |= 1 << k; - else if (PLANAR[k] != &all_zeros_bitmap) { - v |= ((*PLANAR[k] >> bitoffs) & 1) << k; - } - } - - switch (bpp) { - case 2: - do_put_mem_word ((uae_u16 *) image2, (uae_u16)(cim->Colors[v])); - image2 += 2; - break; - case 3: - do_put_mem_byte (image2++, (uae_u8)cim->Colors[v]); - do_put_mem_word ((uae_u16 *) image2, (uae_u16)((cim->Colors[v] & 0x00FFFF00) >> 8)); - image2 += 2; - break; - case 4: - do_put_mem_long ((uae_u32 *) image2, cim->Colors[v]); - image2 += 4; - break; - } - bitoffs--; - bitoffs &= 7; - if (bitoffs == 7) { - int k; - for (k = 0; k < Depth; k++) { - if (PLANAR[k] != &all_zeros_bitmap && PLANAR[k] != &all_ones_bitmap) { - PLANAR[k]++; - } - } - } - } - - for (i = 0; i < Depth; i++) { - if (PLANAR[i] != &all_zeros_bitmap && PLANAR[i] != &all_ones_bitmap) { - PLANAR[i] += eol_offset; - } - } - } -} - -/* - * BlitPlanar2Direct: - * - * Synopsis: - * BlitPlanar2Direct(bi, bm, ri, cim, SrcX, SrcY, DstX, DstY, SizeX, SizeY, MinTerm, Mask); - * Inputs: - * a0:struct BoardInfo *bi - * a1:struct BitMap *bm - * a2:struct RenderInfo *ri - * a3:struct ColorIndexMapping *cmi - * d0.w:SrcX - * d1.w:SrcY - * d2.w:DstX - * d3.w:DstY - * d4.w:SizeX - * d5.w:SizeY - * d6.b:MinTerm - * d7.b:Mask - * - * This function is currently used to blit from planar bitmaps within system memory to direct color - * bitmaps (15, 16, 24 or 32 bit) on the board. Watch out for plane pointers that are 0x00000000 (represents - * a plane with all bits "0") or 0xffffffff (represents a plane with all bits "1"). The ColorIndexMapping is - * used to map the color index of each pixel formed by the bits in the bitmap's planes to a direct color value - * which is written to the destination RenderInfo. The color mask and all colors within the mapping are words, - * triple bytes or longwords respectively similar to the color values used in FillRect(), BlitPattern() or - * BlitTemplate(). - */ - -uae_u32 REGPARAM2 picasso_BlitPlanar2Direct (struct regstruct *regs) -{ - uaecptr bm = m68k_areg (regs, 1); - uaecptr ri = m68k_areg (regs, 2); - uaecptr cim = m68k_areg (regs, 3); - unsigned long srcx = (uae_u16)m68k_dreg (regs, 0); - unsigned long srcy = (uae_u16)m68k_dreg (regs, 1); - unsigned long dstx = (uae_u16)m68k_dreg (regs, 2); - unsigned long dsty = (uae_u16)m68k_dreg (regs, 3); - unsigned long width = (uae_u16)m68k_dreg (regs, 4); - unsigned long height = (uae_u16)m68k_dreg (regs, 5); - uae_u8 minterm = m68k_dreg (regs, 6); - uae_u8 Mask = m68k_dreg (regs, 7); - struct RenderInfo local_ri; - struct BitMap local_bm; - struct ColorIndexMapping local_cim; - uae_u32 result = 0; - -#ifdef JIT - special_mem|=S_WRITE|S_READ; -#endif - - wgfx_flushline (); - - if (minterm != 0x0C) { - write_log ("WARNING - BlitPlanar2Direct() has unhandled op-code 0x%x. Using fall-back routine.\n", minterm); - } else if (CopyRenderInfoStructureA2U (ri, &local_ri) && CopyBitMapStructureA2U (bm, &local_bm)) { - Mask = 0xFF; - CopyColorIndexMappingA2U (cim, &local_cim); - - PlanarToDirect (&local_ri, &local_bm, srcx, srcy, dstx, dsty, width, height, Mask, &local_cim); - if (renderinfo_is_current_screen (&local_ri)) - do_blit( &local_ri, GetBytesPerPixel( local_ri.RGBFormat ), dstx, dsty, dstx, dsty, width, height, BLIT_SRC, 0); - result = 1; - } - - return result; -} - -static void write_gfx_long (uaecptr addr, uae_u32 value) -{ - uaecptr oldaddr = addr; - int y; - - if (!picasso_on) - return; - - /* - * Several writes to successive memory locations are a common access pattern. - * Try to optimize it. - */ - if (addr >= wgfx_linestart && addr + 4 <= wgfx_lineend) { - if (addr < wgfx_min) - wgfx_min = addr; - if (addr + 4 > wgfx_max) - wgfx_max = addr + 4; - return; - } else - wgfx_flushline (); - - addr += gfxmem_start; - /* Check to see if this needs to be written through to the display, or was it an "offscreen" area? */ - if (addr < picasso96_state.Address || addr + 4 > picasso96_state.Extent) - return; - - addr -= picasso96_state.Address+(picasso96_state.XOffset*picasso96_state.BytesPerPixel) - +(picasso96_state.YOffset*picasso96_state.BytesPerRow); - y = addr / picasso96_state.BytesPerRow; - - if (y >= picasso96_state.Height) - return; - wgfx_linestart = picasso96_state.Address - gfxmem_start + y * picasso96_state.BytesPerRow; - wgfx_lineend = wgfx_linestart + picasso96_state.BytesPerRow; - wgfx_y = y; - wgfx_min = oldaddr; - wgfx_max = oldaddr + 4; -} - -static void write_gfx_word (uaecptr addr, uae_u16 value) -{ - uaecptr oldaddr = addr; - int y; - - if (!picasso_on) - return; - - /* - * Several writes to successive memory locations are a common access pattern. - * Try to optimize it. - */ - if (addr >= wgfx_linestart && addr + 2 <= wgfx_lineend) { - if (addr < wgfx_min) - wgfx_min = addr; - if (addr + 2 > wgfx_max) - wgfx_max = addr + 2; - return; - } else - wgfx_flushline (); - - addr += gfxmem_start; - /* Check to see if this needs to be written through to the display, or was it an "offscreen" area? */ - if (addr < picasso96_state.Address || addr + 2 > picasso96_state.Extent) - return; - - addr -= picasso96_state.Address+(picasso96_state.XOffset*picasso96_state.BytesPerPixel) - +(picasso96_state.YOffset*picasso96_state.BytesPerRow); - - y = addr / picasso96_state.BytesPerRow; - - if (y >= picasso96_state.Height) - return; - wgfx_linestart = picasso96_state.Address - gfxmem_start + y * picasso96_state.BytesPerRow; - wgfx_lineend = wgfx_linestart + picasso96_state.BytesPerRow; - wgfx_y = y; - wgfx_min = oldaddr; - wgfx_max = oldaddr + 2; -} - -static void write_gfx_byte (uaecptr addr, uae_u8 value) -{ - uaecptr oldaddr = addr; - int y; - - if (!picasso_on) - return; - - /* - * Several writes to successive memory locations are a common access pattern. - * Try to optimize it. - */ - if (addr >= wgfx_linestart && addr + 4 <= wgfx_lineend) { - if (addr < wgfx_min) - wgfx_min = addr; - if (addr + 1 > wgfx_max) - wgfx_max = addr + 1; - return; - } else - wgfx_flushline (); - - addr += gfxmem_start; - /* Check to see if this needs to be written through to the display, or was it an "offscreen" area? */ - if (addr < picasso96_state.Address || addr + 1 > picasso96_state.Extent) - return; - addr -= picasso96_state.Address+(picasso96_state.XOffset*picasso96_state.BytesPerPixel) - +(picasso96_state.YOffset*picasso96_state.BytesPerRow); - - y = addr / picasso96_state.BytesPerRow; - - if (y >= picasso96_state.Height) - return; - wgfx_linestart = picasso96_state.Address - gfxmem_start + y * picasso96_state.BytesPerRow; - wgfx_lineend = wgfx_linestart + picasso96_state.BytesPerRow; - wgfx_y = y; - wgfx_min = oldaddr; - wgfx_max = oldaddr + 1; -} - -static uae_u32 REGPARAM2 gfxmem_lget (uaecptr addr) -{ - uae_u32 *m; - -#ifdef JIT - special_mem |= S_READ; -#endif - addr -= gfxmem_start /*& gfxmem_mask*/; - addr &= gfxmem_mask; - m = (uae_u32 *)(gfxmemory + addr); - return do_get_mem_long(m); -} - -static uae_u32 REGPARAM2 gfxmem_wget (uaecptr addr) -{ - uae_u16 *m; -#ifdef JIT - special_mem |= S_READ; -#endif - addr -= gfxmem_start /*& gfxmem_mask*/; - addr &= gfxmem_mask; - m = (uae_u16 *)(gfxmemory + addr); - return do_get_mem_word(m); -} - -static uae_u32 REGPARAM2 gfxmem_bget (uaecptr addr) -{ - uae_u8 *m; -#ifdef JIT - special_mem |= S_READ; -#endif - addr -= gfxmem_start /*& gfxmem_mask*/; - addr &= gfxmem_mask; - m = (uae_u8 *)(gfxmemory + addr); - return do_get_mem_byte(m); -} - -static void REGPARAM2 gfxmem_lput (uaecptr addr, uae_u32 l) -{ - uae_u32 *m; -#ifdef JIT - special_mem |= S_WRITE; -#endif - addr -= gfxmem_start /*& gfxmem_mask*/; - addr &= gfxmem_mask; - m = (uae_u32 *)(gfxmemory + addr); - do_put_mem_long(m, l); - - /* write the long-word to our displayable memory */ - write_gfx_long (addr, l); -} - -static void REGPARAM2 gfxmem_wput (uaecptr addr, uae_u32 w) -{ - uae_u16 *m; -#ifdef JIT - special_mem |= S_WRITE; -#endif - addr -= gfxmem_start /*& gfxmem_mask*/; - addr &= gfxmem_mask; - m = (uae_u16 *)(gfxmemory + addr); - do_put_mem_word(m, (uae_u16)w); - - /* write the word to our displayable memory */ - write_gfx_word (addr, (uae_u16) w); -} - -static void REGPARAM2 gfxmem_bput (uaecptr addr, uae_u32 b) -{ - uae_u8 *m; -#ifdef JIT - special_mem |= S_WRITE; -#endif - addr -= gfxmem_start /*& gfxmem_mask*/; - addr &= gfxmem_mask; - m = (uae_u8 *)(gfxmemory + addr); - do_put_mem_byte(m, b); - - /* write the byte to our displayable memory */ - write_gfx_byte (addr, (uae_u8) b); -} - -static int REGPARAM2 gfxmem_check (uaecptr addr, uae_u32 size) -{ - addr -= gfxmem_start /*& gfxmem_mask*/; - addr &= gfxmem_mask; - return (addr + size) < allocated_gfxmem; -} - -static uae_u8 *REGPARAM2 gfxmem_xlate (uaecptr addr) -{ - addr -= gfxmem_start /*& gfxmem_mask*/; - addr &= gfxmem_mask; - return gfxmemory + addr; -} - -addrbank gfxmem_bank = { - gfxmem_lget, gfxmem_wget, gfxmem_bget, - gfxmem_lput, gfxmem_wput, gfxmem_bput, - gfxmem_xlate, gfxmem_check, NULL, "RTG RAM" -}; - -static int resolution_compare (const void *a, const void *b) -{ - struct PicassoResolution *ma = (struct PicassoResolution *) a; - struct PicassoResolution *mb = (struct PicassoResolution *) b; - if (ma->res.width > mb->res.width) - return -1; - if (ma->res.width < mb->res.width) - return 1; - if (ma->res.height > mb->res.height) - return -1; - if (ma->res.height < mb->res.height) - return 1; - return ma->depth - mb->depth; -} - -/* Call this function first, near the beginning of code flow -* Place in InitGraphics() which seems reasonable... -* Also put it in reset_drawing() for safe-keeping. */ -void InitPicasso96 (void) -{ - static int first_time = 1; - - have_done_picasso = 0; - palette_changed = 0; - memset (&picasso96_state, 0, sizeof (struct picasso96_state_struct)); - - if (first_time) { - int i; - - for (i = 0; i < 256; i++) { - p2ctab[i][0] = (((i & 128) ? 0x01000000 : 0) - | ((i & 64) ? 0x010000 : 0) - | ((i & 32) ? 0x0100 : 0) - | ((i & 16) ? 0x01 : 0)); - p2ctab[i][1] = (((i & 8) ? 0x01000000 : 0) - | ((i & 4) ? 0x010000 : 0) - | ((i & 2) ? 0x0100 : 0) - | ((i & 1) ? 0x01 : 0)); - } - mode_count = DX_FillResolutions (&picasso96_pixel_format); - qsort (DisplayModes, mode_count, sizeof (struct PicassoResolution), resolution_compare); - - for (i = 0; i < mode_count; i++) { - sprintf (DisplayModes[i].name, "%dx%d, %d-bit, %d Hz", - DisplayModes[i].res.width, DisplayModes[i].res.height, DisplayModes[i].depth * 8, DisplayModes[i].refresh); - switch (DisplayModes[i].depth) { - case 1: - if (DisplayModes[i].res.width > chunky.width) - chunky.width = DisplayModes[i].res.width; - if (DisplayModes[i].res.height > chunky.height) - chunky.height = DisplayModes[i].res.height; - break; - case 2: - if (DisplayModes[i].res.width > hicolour.width) - hicolour.width = DisplayModes[i].res.width; - if (DisplayModes[i].res.height > hicolour.height) - hicolour.height = DisplayModes[i].res.height; - break; - case 3: - if (DisplayModes[i].res.width > truecolour.width) - truecolour.width = DisplayModes[i].res.width; - if (DisplayModes[i].res.height > truecolour.height) - truecolour.height = DisplayModes[i].res.height; - break; - case 4: - if (DisplayModes[i].res.width > alphacolour.width) - alphacolour.width = DisplayModes[i].res.width; - if (DisplayModes[i].res.height > alphacolour.height) - alphacolour.height = DisplayModes[i].res.height; - break; - } - } - - first_time = 0; - } -} - - -uae_u8 *restore_p96 (uae_u8 *src) -{ - return src; -} - -uae_u8 *save_p96 (int *len, uae_u8 *dstptr) -{ - uae_u8 *dstbak,*dst; - - //dstbak = dst = malloc (16 + 12 + 1 + 1); - return 0; -} - -#endif //picasso96 diff --git a/src/osdep/sigsegv_handler.cpp b/src/osdep/sigsegv_handler.cpp deleted file mode 100644 index 3f0540c4..00000000 --- a/src/osdep/sigsegv_handler.cpp +++ /dev/null @@ -1,296 +0,0 @@ -/* - * sigsegv_linux_arm.cpp - x86_64 Linux SIGSEGV handler - * - * Copyright (c) 2014 Jens Heitmann ARAnyM dev team (see AUTHORS) - * - * Inspired by Bernie Meyer's UAE-JIT and Gwenole Beauchesne's Basilisk II-JIT - * - * This file is part of the ARAnyM project which builds a new and powerful - * TOS/FreeMiNT compatible virtual machine running on almost any hardware. - * - * ARAnyM is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * ARAnyM is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with ARAnyM; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - * - */ - -#include "sysconfig.h" -#include "sysdeps.h" -#include "options.h" -#include "events.h" -#include "include/memory.h" -#include "custom.h" -#include "newcpu.h" -#include "comptbl.h" -#include "compemu.h" - -#include -#include -#include -#include -#include - -#define DEBUG 0 -#include "debug.h" - - -enum transfer_type_t { - TYPE_UNKNOWN, - TYPE_LOAD, - TYPE_STORE -}; - -enum type_size_t { - SIZE_UNKNOWN, - SIZE_BYTE, - SIZE_WORD, - SIZE_INT -}; - -static int in_handler=0; - -enum { - ARM_REG_PC = 15, - ARM_REG_CPSR = 16 -}; - -static inline void unknown_instruction(uae_u32 instr) -{ - panicbug("Unknown instruction %08x!", instr); - SDL_Quit(); - abort(); -} - - -static bool handle_arm_instruction(unsigned long *pregs, uintptr addr) -{ - unsigned int *pc = (unsigned int *)pregs[ARM_REG_PC]; - - panicbug("IP: %p [%08x] %p\n", pc, pc[0], addr); - if (pc == 0) return false; - - if (in_handler > 0) - { - panicbug("Segmentation fault in handler :-("); - return false; - } - - in_handler += 1; - - transfer_type_t transfer_type = TYPE_UNKNOWN; - int transfer_size = SIZE_UNKNOWN; - enum { SIGNED, UNSIGNED }; - int style = UNSIGNED; - - // Handle load/store instructions only - const unsigned int opcode = pc[0]; - switch ((opcode >> 25) & 7) { - case 0: // Halfword and Signed Data Transfer (LDRH, STRH, LDRSB, LDRSH) - // Determine transfer size (S/H bits) - switch ((opcode >> 5) & 3) { - case 0: // SWP instruction - panicbug("FIXME: SWP Instruction\n"); - break; - case 1: // Unsigned halfwords - transfer_size = SIZE_WORD; - break; - case 3: // Signed halfwords - style = SIGNED; - transfer_size = SIZE_WORD; - break; - case 2: // Signed byte - style = SIGNED; - transfer_size = SIZE_BYTE; - break; - } - break; - case 2: - case 3: // Single Data Transfer (LDR, STR) - style = UNSIGNED; - // Determine transfer size (B bit) - if (((opcode >> 22) & 1) == 1) - transfer_size = SIZE_BYTE; - else - transfer_size = SIZE_INT; - break; - default: - panicbug("FIXME: support load/store mutliple?\n"); - return false; - } - - // Check for invalid transfer size (SWP instruction?) - if (transfer_size == SIZE_UNKNOWN) { - panicbug("Invalid transfer size\n"); - return false; - } - - // Determine transfer type (L bit) - if (((opcode >> 20) & 1) == 1) - transfer_type = TYPE_LOAD; - else - transfer_type = TYPE_STORE; - - int rd = (opcode >> 12) & 0xf; -#if DEBUG - static const char * reg_names[] = { - "r0", "r1", "r2", "r3", "r4", "r5", "r6", "r7", - "r8", "r9", "sl", "fp", "ip", "sp", "lr", "pc" - }; - panicbug("%s %s register %s\n", - transfer_size == SIZE_BYTE ? "byte" : - transfer_size == SIZE_WORD ? "word" : - transfer_size == SIZE_INT ? "long" : "unknown", - transfer_type == TYPE_LOAD ? "load to" : "store from", - reg_names[rd]); - panicbug("\n"); -// for (int i = 0; i < 16; i++) { -// panicbug("%s : %p", reg_names[i], pregs[i]); -// } -#endif - -// if ((addr < 0x00f00000) || (addr > 0x00ffffff)) -// goto buserr; - - if (transfer_type == TYPE_LOAD) { - switch(transfer_size) { - case SIZE_BYTE: { - pregs[rd] = style == SIGNED ? (uae_s8)get_byte(addr) : (uae_u8)get_byte(addr); - break; - } - case SIZE_WORD: { - pregs[rd] = do_byteswap_16(style == SIGNED ? (uae_s16)get_word(addr) : (uae_u16)get_word(addr)); - break; - } - case SIZE_INT: { - pregs[rd] = do_byteswap_32(get_long(addr)); - break; - } - } - } else { - switch(transfer_size) { - case SIZE_BYTE: { - put_byte(addr, pregs[rd]); - break; - } - case SIZE_WORD: { - put_word(addr, do_byteswap_16(pregs[rd])); - break; - } - case SIZE_INT: { - put_long(addr, do_byteswap_32(pregs[rd])); - break; - } - } - } - - pregs[ARM_REG_PC] += 4; - panicbug("processed: %p \n", pregs[ARM_REG_PC]); - - in_handler--; - - return true; - -buserr: - panicbug("Amiga bus error\n"); - -// BUS_ERROR(addr); - return false; -} - - -#define SIG_READ 1 -#define SIG_WRITE 2 - -extern void dump_compiler(uae_u32 *sp); - - -void signal_segv(int signum, siginfo_t* info, void*ptr) -{ - int i, f = 0; - ucontext_t *ucontext = (ucontext_t*)ptr; - Dl_info dlinfo; - - void **bp = 0; - void *ip = 0; - - mcontext_t *context = &(ucontext->uc_mcontext); - unsigned long *regs = &context->arm_r0; - uintptr addr = (uintptr)info->si_addr; - addr = (uae_u32) addr - (uae_u32) natmem_offset; - if (handle_arm_instruction(regs, addr)) - return; - - if(signum == 4) - printf("Illegal Instruction!\n"); - else - printf("Segmentation Fault!\n"); - printf("info.si_signo = %d\n", signum); - printf("info.si_errno = %d\n", info->si_errno); -// printf("info.si_code = %d (%s)\n", info->si_code, si_codes[info->si_code]); - printf("info.si_code = %d\n", info->si_code); - printf("info.si_addr = %p\n", info->si_addr); - if(signum == 4) - printf(" value = 0x%08x\n", *((uae_u32*)(info->si_addr))); - printf("reg[%02d] = 0x%08x\n",0 , ucontext->uc_mcontext.arm_r0); - printf("reg[%02d] = 0x%08x\n",1 , ucontext->uc_mcontext.arm_r1); - printf("reg[%02d] = 0x%08x\n",2 , ucontext->uc_mcontext.arm_r2); - printf("reg[%02d] = 0x%08x\n",3 , ucontext->uc_mcontext.arm_r3); - printf("reg[%02d] = 0x%08x\n",4 , ucontext->uc_mcontext.arm_r4); - printf("reg[%02d] = 0x%08x\n",5 , ucontext->uc_mcontext.arm_r5); - printf("reg[%02d] = 0x%08x\n",6 , ucontext->uc_mcontext.arm_r6); - printf("reg[%02d] = 0x%08x\n",7 , ucontext->uc_mcontext.arm_r7); - printf("reg[%02d] = 0x%08x\n",8 , ucontext->uc_mcontext.arm_r8); - printf("reg[%02d] = 0x%08x\n",9 , ucontext->uc_mcontext.arm_r9); - printf("reg[%02d] = 0x%08x\n",10 , ucontext->uc_mcontext.arm_r10); - printf("FP = 0x%08x\n", ucontext->uc_mcontext.arm_fp); - printf("IP = 0x%08x\n", ucontext->uc_mcontext.arm_ip); - printf("SP = 0x%08x\n", ucontext->uc_mcontext.arm_sp); - printf("LR = 0x%08x\n", ucontext->uc_mcontext.arm_lr); - printf("PC = 0x%08x\n", ucontext->uc_mcontext.arm_pc); - printf("CPSR = 0x%08x\n", ucontext->uc_mcontext.arm_cpsr); - printf("Fault Address = 0x%08x\n", ucontext->uc_mcontext.fault_address); - printf("Trap no = 0x%08x\n", ucontext->uc_mcontext.trap_no); - printf("Err Code = 0x%08x\n", ucontext->uc_mcontext.error_code); - printf("Old Mask = 0x%08x\n", ucontext->uc_mcontext.oldmask); - - dump_compiler((uae_u32*)ucontext->uc_mcontext.arm_pc); - -// printf("Stack trace:\n"); -// ip = (void*)ucontext->uc_mcontext.arm_r10; -// bp = (void**)ucontext->uc_mcontext.arm_r10; -// while(bp && ip) { -// if (!dladdr(ip, &dlinfo)) { -// printf("IP out of range\n"); -// break; -// } -// const char *symname = dlinfo.dli_sname; -// printf("% 2d: %p <%s + 0x%08x> (%s)\n", ++f, ip, symname, -// (unsigned long)ip - (unsigned long)dlinfo.dli_saddr, dlinfo.dli_fname); -// if(dlinfo.dli_sname && !strcmp(dlinfo.dli_sname, "main")) -// break; -// ip = bp[1]; -// bp = (void**)bp[0]; -// } -// -// printf("Stack trace (non-dedicated):\n"); -// char **strings; -// void *bt[20]; -// int sz = backtrace(bt, 20); -// strings = backtrace_symbols(bt, sz); -// for(i = 0; i < sz; ++i) -// printf("%s\n", strings[i]); -// printf("End of stack trace.\n"); - - SDL_Quit(); - abort(); -} diff --git a/src/osdep/sysconfig.h b/src/osdep/sysconfig.h deleted file mode 100644 index 2875fd17..00000000 --- a/src/osdep/sysconfig.h +++ /dev/null @@ -1,397 +0,0 @@ -/* src/sysconfig.h. Generated automatically by configure. */ -/* src/sysconfig.h.in. Generated automatically from configure.in by autoheader. */ - -/* Define 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 - -/* Define to empty if the keyword does not work. */ -/* #undef const */ - -/* Define if you have the getmntent function. */ -#define HAVE_GETMNTENT 1 - -/* Define if your struct stat has st_blocks. */ -/* #undef HAVE_ST_BLOCKS */ - -/* Define if utime(file, NULL) sets file's timestamp to the present. */ -#define HAVE_UTIME_NULL 1 - -/* Define as __inline if that's what the C compiler calls it. */ -/* #undef inline */ - -/* Define to `int' if doesn't define. */ -/* #undef mode_t */ - -/* Define to `long' if doesn't define. */ -/* #undef off_t */ - -/* Define to `int' if doesn't define. */ -/* #undef pid_t */ - -/* Define if you need to in order for stat and other things to work. */ -/* #undef _POSIX_SOURCE */ - -/* Define as the return type of signal handlers (int or void). */ -#define RETSIGTYPE void - -/* Define if you have the ANSI C header files. */ -#define STDC_HEADERS 1 - -/* Define if you can safely include both and . */ -#define TIME_WITH_SYS_TIME 1 - -/* Define if your declares struct tm. */ -/* #undef TM_IN_SYS_TIME */ - -/* Define if the X Window System is missing or not being used. */ -/* #undef X_DISPLAY_MISSING */ - -/* Define if you have the Andrew File System. */ -/* #undef AFS */ - -/* Define if there is no specific function for reading the list of - mounted filesystems. fread will be used to read /etc/mnttab. [SVR2] */ -/* #undef MOUNTED_FREAD */ - -/* Define if (like SVR2) there is no specific function for reading the - list of mounted filesystems, and your system has these header files: - and . [SVR3] */ -/* #undef MOUNTED_FREAD_FSTYP */ - -/* Define if there is a function named getfsstat for reading the list - of mounted filesystems. [DEC Alpha running OSF/1] */ -/* #undef MOUNTED_GETFSSTAT */ - -/* Define if there is a function named getmnt for reading the list of - mounted filesystems. [Ultrix] */ -/* #undef MOUNTED_GETMNT */ - -/* Define if there is a function named getmntent for reading the list - of mounted filesystems, and that function takes a single argument. - [4.3BSD, SunOS, HP-UX, Dynix, Irix] */ -#define MOUNTED_GETMNTENT1 1 - -/* Define if there is a function named getmntent for reading the list of - mounted filesystems, and that function takes two arguments. [SVR4] */ -/* #undef MOUNTED_GETMNTENT2 */ - -/* Define if there is a function named getmntinfo for reading the list - of mounted filesystems. [4.4BSD] */ -/* #undef MOUNTED_GETMNTINFO */ - -/* Define if there is a function named listmntent that can be used to - list all mounted filesystems. [UNICOS] */ -/* #undef MOUNTED_LISTMNTENT */ - -/* Define if there is a function named mntctl that can be used to read - the list of mounted filesystems, and there is a system header file - that declares `struct vmount.' [AIX] */ -/* #undef MOUNTED_VMOUNT */ - -/* Define if statfs takes 3 args. [DEC Alpha running OSF/1] */ -/* #undef STAT_STATFS3_OSF1 */ - -/* Define if there is no specific function for reading filesystems usage - information and you have the header file. [SVR2] */ -/* #undef STAT_READ_FILSYS */ - -/* Define if statfs takes 2 args and struct statfs has a field named f_bsize. - [4.3BSD, SunOS 4, HP-UX, AIX PS/2] */ -#define STAT_STATFS2_BSIZE 1 - -/* Define if statfs takes 2 args and struct statfs has a field named f_fsize. - [4.4BSD, NetBSD] */ -/* #undef STAT_STATFS2_FSIZE */ - -/* Define if statfs takes 2 args and the second argument has - type struct fs_data. [Ultrix] */ -/* #undef STAT_STATFS2_FS_DATA */ - -/* Define if statfs takes 4 args. [SVR3, Dynix, Irix, Dolphin] */ -/* #undef STAT_STATFS4 */ - -/* Define if there is a function named statvfs. [SVR4] */ -/* #undef STAT_STATVFS */ - -/* Define if the block counts reported by statfs may be truncated to 2GB - and the correct values may be stored in the f_spare array. - [SunOS 4.1.2, 4.1.3, and 4.1.3_U1 are reported to have this problem. - SunOS 4.1.1 seems not to be affected.] */ -/* #undef STATFS_TRUNCATES_BLOCK_COUNTS */ - -/* The number of bytes in a __int64. */ -#define SIZEOF___INT64 8 - -/* The number of bytes in a char. */ -#define SIZEOF_CHAR 1 - -/* The number of bytes in a int. */ -#define SIZEOF_INT 4 - -/* The number of bytes in a long. */ -#define SIZEOF_LONG 4 - -/* The number of bytes in a long long. */ -#define SIZEOF_LONG_LONG 8 - -/* The number of bytes in a short. */ -#define SIZEOF_SHORT 2 - -#define SIZEOF_FLOAT 4 -#define SIZEOF_DOUBLE 8 - -#define SIZEOF_VOID_P 4 - -#define HAVE_ISNAN -#undef HAVE_ISINF - -/* Define if you have the bcopy function. */ -#define HAVE_BCOPY 1 - -/* Define if you have the cfmakeraw function. */ -/* #undef HAVE_CFMAKERAW */ - -/* Define if you have the endgrent function. */ -#define HAVE_ENDGRENT 1 - -/* Define if you have the endpwent function. */ -#define HAVE_ENDPWENT 1 - -/* Define if you have the fchdir function. */ -#define HAVE_FCHDIR 1 - -/* Define if you have the ftime function. */ -#define HAVE_FTIME 1 - -/* Define if you have the ftruncate function. */ -#define HAVE_FTRUNCATE 1 - -/* Define if you have the getcwd function. */ -#define HAVE_GETCWD 1 - -/* Define if you have the getmntinfo function. */ -/* #undef HAVE_GETMNTINFO */ - -/* Define if you have the getopt function. */ -#define HAVE_GETOPT 1 - -/* Define if you have the gettimeofday function. */ -#define HAVE_GETTIMEOFDAY 1 - -/* Define if you have the isascii function. */ -#define HAVE_ISASCII 1 - -/* Define if you have the lchown function. */ -#define HAVE_LCHOWN 1 - -/* Define if you have the listmntent function. */ -/* #undef HAVE_LISTMNTENT */ - -/* Define if you have the memcpy function. */ -#define HAVE_MEMCPY 1 - -/* Define if you have the mkdir function. */ -#define HAVE_MKDIR 1 - -/* Define if you have the mkfifo function. */ -#define HAVE_MKFIFO 1 - -/* Define if you have the readdir_r function. */ -#define HAVE_READDIR_R 1 - -/* Define if you have the rmdir function. */ -#define HAVE_RMDIR 1 - -/* Define if you have the select function. */ -#define HAVE_SELECT 1 - -/* Define if you have the setitimer function. */ -#define HAVE_SETITIMER 1 - -/* Define if you have the sigaction function. */ -#define HAVE_SIGACTION 1 - -/* Define if you have the strchr function. */ -#define HAVE_STRCHR 1 - -/* Define if you have the strdup function. */ -#define HAVE_STRDUP 1 - -/* Define if you have the strerror function. */ -#define HAVE_STRERROR 1 - -/* Define if you have the strrchr function. */ -#define HAVE_STRRCHR 1 - -/* Define if you have the strstr function. */ -#define HAVE_STRSTR 1 - -/* Define if you have the tcgetattr function. */ -#define HAVE_TCGETATTR 1 - -/* Define if you have the vfprintf function. */ -#define HAVE_VFPRINTF 1 - -/* Define if you have the vprintf function. */ -#define HAVE_VPRINTF 1 - -/* Define if you have the vsprintf function. */ -#define HAVE_VSPRINTF 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SDL_SDL_H */ - -/* Define if you have the header file. */ -#define HAVE_CURSES_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_CYBERGRAPHX_CYBERGRAPHICS_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_DDRAW_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_DEVICES_AHI_H */ - -/* Define if you have the header file. */ -#define HAVE_DIRENT_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_DMEDIA_AUDIO_H */ - -/* Define if you have the header file. */ -#define HAVE_FCNTL_H 1 - -/* Define if you have the header file. */ -#define HAVE_FEATURES_H 1 - -/* Define if you have the header file. */ -#define HAVE_GETOPT_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_LIBRARIES_CYBERGRAPHICS_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_MACHINE_JOYSTICK_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_MACHINE_SOUNDCARD_H */ - -/* Define if you have the header file. */ -#define HAVE_MNTENT_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_MNTTAB_H */ - -/* Define if you have the header file. */ -#define HAVE_NCURSES_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_NDIR_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_POSIX_OPT_H */ - -/* Define if you have the header file. */ -#define HAVE_STRING_H 1 - -/* Define if you have the header file. */ -#define HAVE_STRINGS_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SUN_AUDIOIO_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_AUDIOIO_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_DIR_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_FILSYS_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_FS_S5PARAM_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_FS_TYPES_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_FSTYP_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_IOCTL_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_IPC_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_MOUNT_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_NDIR_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_PARAM_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_SHM_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_SOUNDCARD_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_STAT_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_STATFS_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_STATVFS_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_TERMIOS_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_TIME_H 1 - -/* Define if you have the header file. */ -#define HAVE_SYS_TYPES_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_SYS_UTIME_H */ - -/* Define if you have the header file. */ -#define HAVE_SYS_VFS_H 1 - -/* Define if you have the header file. */ -#define HAVE_UNISTD_H 1 - -/* Define if you have the header file. */ -#define HAVE_UTIME_H 1 - -/* Define if you have the header file. */ -/* #undef HAVE_VALUES_H */ - -/* Define if you have the header file. */ -/* #undef HAVE_WINDOWS_H */ - -#define FSDB_DIR_SEPARATOR '/' - -#define strcmpi(x,y) strcasecmp(x,y) -#define stricmp(x,y) strcasecmp(x,y) - -#ifndef MAX_PATH -#define MAX_PATH 256 -#endif -#define MAX_DPATH 256 - -#define WORDS_BIGENDIAN 1 - -#define M68K_SPEED_7MHZ_CYCLES 0 -#define M68K_SPEED_14MHZ_CYCLES 1024 -#define M68K_SPEED_25MHZ_CYCLES 128 diff --git a/src/osdep/target.h b/src/osdep/target.h deleted file mode 100644 index c3ac77b0..00000000 --- a/src/osdep/target.h +++ /dev/null @@ -1,35 +0,0 @@ - /* - * UAE - The Un*x Amiga Emulator - * - * Target specific stuff - * - * Copyright 1997 Bernd Schmidt - */ - -#define TARGET_NAME "pandora" - -#define OPTIONSFILENAME "uaeconfig" - -/* Just 0x0 and not 680x0, so that constants can fit in ARM instructions */ -#define M68000 0 -#define M68020 2 - -#define SIMULATE_SHIFT 0x200 -#define SIMULATE_RELEASED_SHIFT 0x400 - -extern int emulating; -extern int uae4all_keystate[256]; -extern int stylusAdjustX; -extern int stylusAdjustY; - -void run_gui(void); - -void saveAdfDir(void); -void setCpuSpeed(void); -void resetCpuSpeed(void); -void update_display(struct uae_prefs *); -void graphics_subshutdown (void); - -void pandora_stop_sound(void); - -void keyboard_init(void); diff --git a/src/osdep/writelog.cpp b/src/osdep/writelog.cpp deleted file mode 100644 index bcc44402..00000000 --- a/src/osdep/writelog.cpp +++ /dev/null @@ -1,33 +0,0 @@ - /* - * UAE - The Un*x Amiga Emulator - * - * Standard write_log that writes to the console - * - * Copyright 2001 Bernd Schmidt - */ -#include "sysconfig.h" -#include "sysdeps.h" - -#define WRITE_LOG_BUF_SIZE 4096 -FILE *debugfile = NULL; - -#ifdef WITH_LOGGING - -void write_log (const char *format,...) -{ - int count; - int numwritten; - char buffer[WRITE_LOG_BUF_SIZE]; - - va_list parms; - va_start (parms, format); - count = vsnprintf( buffer, WRITE_LOG_BUF_SIZE-1, format, parms ); - if( debugfile ) { - fprintf( debugfile, buffer ); - fflush (debugfile); - } - va_end (parms); -} - -#endif - diff --git a/src/savestate.cpp b/src/savestate.cpp index 47593845..d6f522e5 100644 --- a/src/savestate.cpp +++ b/src/savestate.cpp @@ -52,7 +52,7 @@ #include "zfile.h" #include "autoconf.h" #include "custom.h" -#include "sounddep/sound.h" +#include "sd-pandora/sound.h" #include "newcpu.h" #include "savestate.h" #include "audio.h" diff --git a/src/sd-sdl/sound_sdl_new.cpp b/src/sd-sdl/sound_sdl_new.cpp index 7f0ee667..8889cddf 100644 --- a/src/sd-sdl/sound_sdl_new.cpp +++ b/src/sd-sdl/sound_sdl_new.cpp @@ -20,7 +20,7 @@ #include "debug.h" #include "audio.h" #include "gensound.h" -#include "sounddep/sound.h" +#include "sd-pandora/sound.h" #include "custom.h" #include diff --git a/src/sounddep/sound.cpp b/src/sounddep/sound.cpp deleted file mode 100644 index dfb18326..00000000 --- a/src/sounddep/sound.cpp +++ /dev/null @@ -1,280 +0,0 @@ - /* - * Minimalistic sound.c implementation for gp2x - * (c) notaz, 2007 - */ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "sysconfig.h" -#include "sysdeps.h" -#include "uae.h" -#include "options.h" -#include "memory.h" -#include "audio.h" -#include "gensound.h" -#include "sounddep/sound.h" -#include "custom.h" -#include "savestate.h" - - -extern unsigned long next_sample_evtime; - -uae_u16 sndbuffer[4][(SNDBUFFER_LEN+32)*DEFAULT_SOUND_CHANNELS]; -uae_u16 *sndbufpt = sndbuffer[0]; -uae_u16 *render_sndbuff = sndbuffer[0]; -uae_u16 *finish_sndbuff = sndbuffer[0] + SNDBUFFER_LEN*2; - -static int have_sound = 0; - -static __inline__ void sound_default_evtime(void) -{ - int pal = beamcon0 & 0x20; -#ifndef PANDORA - switch(m68k_speed) - { - case 6: - scaled_sample_evtime=(unsigned)(MAXHPOS_PAL*MAXVPOS_PAL*VBLANK_HZ_PAL*CYCLE_UNIT/1.86)/currprefs.sound_freq; - break; - - case 5: - case 4: // ~4/3 234 - if (pal) - scaled_sample_evtime=(MAXHPOS_PAL*244*VBLANK_HZ_PAL*CYCLE_UNIT)/currprefs.sound_freq; // ??? - else - scaled_sample_evtime=(MAXHPOS_NTSC*255*VBLANK_HZ_NTSC*CYCLE_UNIT)/currprefs.sound_freq; - break; - - case 3: - case 2: // ~8/7 273 - if (pal) - scaled_sample_evtime=(MAXHPOS_PAL*270*VBLANK_HZ_PAL*CYCLE_UNIT)/currprefs.sound_freq; - else - scaled_sample_evtime=(MAXHPOS_NTSC*255*VBLANK_HZ_NTSC*CYCLE_UNIT)/currprefs.sound_freq; - break; - - case 1: - default: // MAXVPOS_PAL? -#endif - if (pal) - scaled_sample_evtime = (MAXHPOS_PAL*313*VBLANK_HZ_PAL*CYCLE_UNIT)/currprefs.sound_freq; - else - scaled_sample_evtime = (MAXHPOS_NTSC*MAXVPOS_NTSC*VBLANK_HZ_NTSC*CYCLE_UNIT)/currprefs.sound_freq + 1; -#ifndef PANDORA - break; - } -#endif -} - - -static int sounddev = -1, s_oldrate = 0, s_oldbits = 0, s_oldstereo = 0; -static int sound_thread_active = 0, sound_thread_exit = 0; -static sem_t sound_sem; - -static void *sound_thread(void *unused) -{ - int cnt = 0, sem_val = 0; - sound_thread_active = 1; - - for (;;) - { - sem_getvalue(&sound_sem, &sem_val); - while (sem_val > 1) - { - sem_wait(&sound_sem); - cnt++; - sem_getvalue(&sound_sem, &sem_val); - } - - sem_wait(&sound_sem); - if (sound_thread_exit) break; - - if(currprefs.sound_stereo) - write(sounddev, sndbuffer[cnt&3], SNDBUFFER_LEN*2); - else - write(sounddev, sndbuffer[cnt&3], SNDBUFFER_LEN); - cnt++; - } - - sound_thread_active = 0; - return NULL; -} - -static int pandora_start_sound(int rate, int bits, int stereo) -{ - int frag = 0, buffers, ret; - unsigned int bsize; - - if (!sound_thread_active) - { - // init sem, start sound thread - pthread_t thr; - - sndbufpt = sndbuffer[0]; - render_sndbuff = sndbuffer[0]; - finish_sndbuff = sndbuffer[0] + SNDBUFFER_LEN*2; - s_oldrate = 0; - s_oldbits = 0; - s_oldstereo = 0; - - sound_thread_exit = 0; - ret = sem_init(&sound_sem, 0, 0); - if (ret != 0) - write_log("sem_init() failed: %i, errno=%i\n", ret, errno); - ret = pthread_create(&thr, NULL, sound_thread, NULL); - if (ret != 0) - write_log("pthread_create() failed: %i\n", ret); - pthread_detach(thr); - } - - if (sounddev <= 0) - { - sounddev = open("/dev/dsp", O_WRONLY); - if (sounddev == -1) - { - write_log("open(\"/dev/dsp\") failed with %i\n", errno); - return -1; - } - } - - // if no settings change, we don't need to do anything - if (rate == s_oldrate && s_oldbits == bits && s_oldstereo == stereo) - return 0; - - ioctl(sounddev, SNDCTL_DSP_SPEED, &rate); - ioctl(sounddev, SNDCTL_DSP_SETFMT, &bits); - ioctl(sounddev, SNDCTL_DSP_STEREO, &stereo); - // calculate buffer size - buffers = 16; - bsize = rate / 32; - if (rate > 22050) { bsize*=4; buffers*=2; } // 44k mode seems to be very demanding - while ((bsize>>=1)) frag++; - frag |= buffers<<16; // 16 buffers - ioctl(sounddev, SNDCTL_DSP_SETFRAGMENT, &frag); - - s_oldrate = rate; - s_oldbits = bits; - s_oldstereo = stereo; - usleep(100000); - return 0; -} - - -// this is meant to be called only once on exit -void pandora_stop_sound(void) -{ - if (sound_thread_exit) - printf("don't call gp2x_stop_sound more than once!\n"); - if (sound_thread_active) - { - sound_thread_exit = 1; - sem_post(&sound_sem); - usleep(100*1000); - } - - if (sounddev > 0) - close(sounddev); - sounddev = -1; -} - - -static int wrcnt = 0; - -void finish_sound_buffer (void) -{ - sem_post(&sound_sem); - wrcnt++; - sndbufpt = render_sndbuff = sndbuffer[wrcnt&3]; - if(currprefs.sound_stereo) - finish_sndbuff = sndbufpt + SNDBUFFER_LEN; - else - finish_sndbuff = sndbufpt + SNDBUFFER_LEN/2; -} - -void restart_sound_buffer(void) -{ - sndbufpt = render_sndbuff = sndbuffer[wrcnt&3]; - if(currprefs.sound_stereo) - finish_sndbuff = sndbufpt + SNDBUFFER_LEN; - else - finish_sndbuff = sndbufpt + SNDBUFFER_LEN/2; -} - - -/* Try to determine whether sound is available. This is only for GUI purposes. */ -int setup_sound (void) -{ - if (pandora_start_sound(currprefs.sound_freq, 16, currprefs.sound_stereo) != 0) - return 0; - - sound_available = 1; - return 1; -} - -void update_sound (int freq) -{ - sound_default_evtime(); -} - -static int open_sound (void) -{ - if (pandora_start_sound(currprefs.sound_freq, 16, currprefs.sound_stereo) != 0) - return 0; - - init_sound_table16 (); - - sample_handler = currprefs.sound_stereo ? sample16s_handler : sample16_handler; - - have_sound = 1; - sound_available = 1; - - if(currprefs.sound_stereo) - sample_handler = sample16s_handler; - else - sample_handler = sample16_handler; - - return 1; -} - -void close_sound (void) -{ - if (!have_sound) - return; - - // testing shows that reopenning sound device is not a good idea on gp2x (causes random sound driver crashes) - // we will close it on real exit instead - //pandora_stop_sound(); - have_sound = 0; -} - -int init_sound (void) -{ - have_sound=open_sound(); - return have_sound; -} - -void pause_sound (void) -{ - /* nothing to do */ -} - -void resume_sound (void) -{ - /* nothing to do */ -} - -void reset_sound (void) -{ - if (!have_sound) - return; - - memset(sndbuffer, 0, 2 * 4 * (SNDBUFFER_LEN+32)*DEFAULT_SOUND_CHANNELS); -} diff --git a/src/sounddep/sound.h b/src/sounddep/sound.h deleted file mode 100644 index fd58adaa..00000000 --- a/src/sounddep/sound.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * UAE - The Un*x Amiga Emulator - * - * Support for Linux/USS sound - * - * Copyright 1997 Bernd Schmidt - */ - -#if defined(PANDORA) || defined(ANDROIDSDL) -#define DEFAULT_SOUND_CHANNELS 2 -#else -#define DEFAULT_SOUND_CHANNELS 1 -#endif - -#define SNDBUFFER_LEN 2048 - -extern uae_u16 sndbuffer[4][(SNDBUFFER_LEN+32)*DEFAULT_SOUND_CHANNELS]; -extern uae_u16 *sndbufpt; -extern uae_u16 *render_sndbuff; -extern uae_u16 *finish_sndbuff; -extern int sndbufsize; -extern void finish_sound_buffer (void); -extern void restart_sound_buffer (void); -extern int init_sound(void); -extern void close_sound (void); -extern int setup_sound (void); -extern void resume_sound (void); -extern void pause_sound (void); -extern void reset_sound (void); - -#define check_sound_buffers() { if (sndbufpt >= finish_sndbuff) finish_sound_buffer (); } - -STATIC_INLINE void clear_sound_buffers (void) -{ - memset (sndbuffer, 0, 4 * (SNDBUFFER_LEN + 32) * DEFAULT_SOUND_CHANNELS); -} - -#define PUT_SOUND_WORD(b) do { *(uae_u16 *)sndbufpt = b; sndbufpt = (uae_u16 *)(((uae_u8 *)sndbufpt) + 2); } while (0) -#define PUT_SOUND_WORD_LEFT(b) do { if (currprefs.sound_filter) b = filter (b, &sound_filter_state[0]); PUT_SOUND_WORD(b); } while (0) -#define PUT_SOUND_WORD_RIGHT(b) do { if (currprefs.sound_filter) b = filter (b, &sound_filter_state[1]); PUT_SOUND_WORD(b); } while (0) -#define PUT_SOUND_WORD_MONO(b) PUT_SOUND_WORD_LEFT(b) -#define SOUND16_BASE_VAL 0 - -#define DEFAULT_SOUND_BITS 16 -#define DEFAULT_SOUND_FREQ 44100 - -#define FILTER_SOUND_OFF 0 -#define FILTER_SOUND_EMUL 1 -#define FILTER_SOUND_ON 2 - -#define FILTER_SOUND_TYPE_A500 0 -#define FILTER_SOUND_TYPE_A1200 1 diff --git a/src/threaddep/thread.h b/src/threaddep/thread.h deleted file mode 100644 index fa5fc749..00000000 --- a/src/threaddep/thread.h +++ /dev/null @@ -1,44 +0,0 @@ - /* - * UAE - The Un*x Amiga Emulator - * - * Threading support, using SDL - * - * Copyright 1997, 2001 Bernd Schmidt - */ - -#include "SDL.h" -#include "SDL_thread.h" - -/* Sempahores. We use POSIX semaphores; if you are porting this to a machine - * with different ones, make them look like POSIX semaphores. */ -typedef SDL_sem *uae_sem_t; - -#define uae_sem_init(PSEM, DUMMY, INIT) do { \ - *PSEM = SDL_CreateSemaphore (INIT); \ -} while (0) -#define uae_sem_destroy(PSEM) SDL_DestroySemaphore (*PSEM) -#define uae_sem_post(PSEM) SDL_SemPost (*PSEM) -#define uae_sem_wait(PSEM) SDL_SemWait (*PSEM) -#define uae_sem_trywait(PSEM) SDL_SemTryWait (*PSEM) -#define uae_sem_getvalue(PSEM) SDL_SemValue (*PSEM) - -#include "commpipe.h" -extern void uae_set_thread_priority (int); - -typedef SDL_Thread *uae_thread_id; -#define BAD_THREAD NULL - -STATIC_INLINE int uae_start_thread (void *(*f) (void *), void *arg, uae_thread_id *foo) -{ - *foo = SDL_CreateThread ((int (*)(void *))f, arg); - return *foo == 0; -} - -STATIC_INLINE int uae_wait_thread (uae_thread_id thread) -{ - SDL_WaitThread (thread, (int*)0); - return 0; -} - -/* Do nothing; thread exits if thread function returns. */ -#define UAE_THREAD_EXIT do {} while (0) diff --git a/src/traps.cpp b/src/traps.cpp index bd0156c2..13fd54ff 100644 --- a/src/traps.cpp +++ b/src/traps.cpp @@ -17,7 +17,7 @@ #include "memory.h" #include "custom.h" #include "newcpu.h" -#include "threaddep/thread.h" +#include "td-sdl/thread.h" #include "autoconf.h" #include "traps.h"