Commit f73bdd59 authored by GnoStiC's avatar GnoStiC

puae 2.3.1

parent f1a95459
......@@ -2306,8 +2306,6 @@ static void free_key (Unit *unit, Key *k)
{
Key *k1;
Key *prev = 0;
struct lockrecord *lr;
for (k1 = unit->keys; k1; k1 = k1->next) {
if (k == k1) {
if (prev)
......@@ -2319,6 +2317,8 @@ static void free_key (Unit *unit, Key *k)
prev = k1;
}
struct lockrecord *lr;
for (lr = k->record; lr;) {
struct lockrecord *next = lr->next;
xfree (lr);
......@@ -5346,8 +5346,6 @@ void filesys_cleanup (void)
void filesys_free_handles (void)
{
Unit *u, *u1;
struct lockrecord *lr;
for (u = units; u; u = u1) {
Key *k1, *knext;
u1 = u->next;
......@@ -5359,6 +5357,8 @@ void filesys_free_handles (void)
}
u->keys = NULL;
struct lockrecord *lrnext;
struct lockrecord *lr;
for (lr = u->waitingrecords; lr; lr = lrnext) {
lrnext = lr->next;
xfree (lr);
......
This diff is collapsed.
......@@ -1717,38 +1717,6 @@ int DX_Blit (int srcx, int srcy, int dstx, int dsty, int width, int height, BLIT
*/
static void add_p96_mode (int width, int height, int emulate_chunky, int *count)
{
unsigned int i;
struct MultiDisplay *md1;
md1 = Displays;
struct MultiDisplay *md = (struct MultiDisplay*)md1;
md1->DisplayModes = xmalloc (struct PicassoResolution, MAX_PICASSO_MODES);
md1->DisplayModes[0].depth = -1;
md1->disabled = 1;
for (i = 0; i <= (emulate_chunky ? 1 : 0); i++) {
if (*count < MAX_PICASSO_MODES) {
DisplayModes[*count].res.width = width;
DisplayModes[*count].res.height = height;
DisplayModes[*count].depth = (i == 1) ? 1 : bit_unit >> 3;
DisplayModes[*count].refresh[0] = 75;
(*count)++;
write_log ("SDLGFX: Added P96 mode: %dx%dx%d\n", width, height, (i == 1) ? 8 : bitdepth);
addmode (md, width, height, bitdepth, 75, 0);
}
}
md1 = Displays;
if (md1->DisplayModes[0].depth >= 0)
md1->disabled = 0;
i = 0;
while (md1->DisplayModes[i].depth > 0)
i++;
//write_log ("'%s', %d display modes (%s)\n", md1->name, i, md1->disabled ? "disabled" : "enabled");
md1++;
return;
}
......@@ -1795,10 +1763,19 @@ int DX_FillResolutions (uae_u16 *ppixel_format)
emulate_chunky = 1;
}
struct MultiDisplay *md = getdisplay (&currprefs);
struct PicassoResolution *DisplayModes = md->DisplayModes;
md->DisplayModes = xmalloc (struct PicassoResolution, MAX_PICASSO_MODES);
md->DisplayModes[0].depth = -1;
md->disabled = 1;
/* Check list of standard P96 screenmodes */
for (i = 0; i < MAX_SCREEN_MODES; i++) {
if (SDL_VideoModeOK (x_size_table[i], y_size_table[i], bitdepth, SDL_HWSURFACE | SDL_FULLSCREEN)) {
add_p96_mode (x_size_table[i], y_size_table[i], emulate_chunky, &count);
//add_p96_mode (x_size_table[i], y_size_table[i], emulate_chunky, &count);
addmode (md, x_size_table[i], y_size_table[i], bitdepth, 75, 0);
write_log ("SDLGFX: Added P96 mode: %dx%dx%d\n", x_size_table[i], y_size_table[i], bitdepth);
}
}
......@@ -1816,7 +1793,7 @@ int DX_FillResolutions (uae_u16 *ppixel_format)
/* If SDL mode is not a standard P96 mode (and thus already added to the
* list, above) then add it */
if (!found)
add_p96_mode (screenmode[i].w, screenmode[i].h, emulate_chunky, &count);
addmode (screenmode[i].w, screenmode[i].h, bitdepth, 75, 0);
}
return count;
......
......@@ -388,6 +388,38 @@ struct Template {
uae_u32 BgPen;
};
#define PSSO_Line_X 0
#define PSSO_Line_Y 2
#define PSSO_Line_Length 4
#define PSSO_Line_dX 6
#define PSSO_Line_dY 8
#define PSSO_Line_sDelta 10
#define PSSO_Line_lDelta 12
#define PSSO_Line_twoSDminusLD 14
#define PSSO_Line_LinePtrn 16
#define PSSO_Line_PatternShift 18
#define PSSO_Line_FgPen 20
#define PSSO_Line_BgPen 24
#define PSSO_Line_Horizontal 28
#define PSSO_Line_DrawMode 30
#define PSSO_Line_pad 31
#define PSSO_Line_Xorigin 32
#define PSSO_Line_Yorigin 34
struct Line {
uae_u16 X, Y;
uae_u16 Length;
uae_s16 dX, dY;
uae_s16 sDelta, lDelta, twoSDminusLD;
uae_u16 LinePtrn;
uae_u16 PatternShift;
uae_u32 FgPen, BgPen;
uae_u16 Horizontal;
uae_u8 DrawMode;
uae_s8 pad;
uae_u16 Xorigin, Yorigin;
};
#define PSSO_BitMapExtra_BoardNode 0
#define PSSO_BitMapExtra_HashChain 8 /* BoardNode is 8-bytes */
#define PSSO_BitMapExtra_Match 12
......
/*
* UAE - The Un*x Amiga Emulator
*
* MC68000 emulation - machine dependent bits
*
* Copyright 1996 Bernd Schmidt
* Copyright 2004-2007 Richard Drummond
*/
/*
* UAE - The Un*x Amiga Emulator
*
* MC68000 emulation - machine dependent bits
*
* Copyright 1996 Bernd Schmidt
* Copyright 2004-2007 Richard Drummond
*/
/*
* Machine dependent structure for holding the 68k CCR flags
......@@ -24,7 +24,7 @@ extern struct flag_struct regflags;
* 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:
* The 68k CZNV flags are thus assigned in cznv as:
*
* <--AL--> <--AH-->
* 76543210 FEDCBA98 --------- ---------
......@@ -60,13 +60,13 @@ extern struct flag_struct regflags;
#define IOR_CZNV(X) (regflags.cznv |= (X))
#define SET_CZNV(X) (regflags.cznv = (X))
#define COPY_CARRY (regflags.x = regflags.cznv)
#define COPY_CARRY() (regflags.x = regflags.cznv)
/*
* Test CCR condition
*/
STATIC_INLINE int cctrue(int cc)
STATIC_INLINE int cctrue (int cc)
{
uae_u32 cznv = regflags.cznv;
......
......@@ -1259,6 +1259,7 @@ void addmode (struct MultiDisplay *md, int w, int h, int d, int rate, int nondx)
ct = RGBMASK_32BIT;
if (ct == 0)
return;
d /= 8;
i = 0;
while (md->DisplayModes[i].depth >= 0) {
......@@ -1276,9 +1277,11 @@ void addmode (struct MultiDisplay *md, int w, int h, int d, int rate, int nondx)
}
i++;
}
i = 0;
while (md->DisplayModes[i].depth >= 0)
i++;
if (i >= MAX_PICASSO_MODES - 1)
return;
md->DisplayModes[i].nondx = nondx;
......
......@@ -58,7 +58,8 @@ int p96hack_vpos, p96hack_vpos2, p96refresh_active;
#define NOBLITTER 0
#define NOBLITTER_BLIT 0
#define P96TRACING_ENABLED 0
#define USE_HARDWARESPRITE 1
#define P96TRACING_ENABLED 1
#define P96SPRTRACING_ENABLED 0
static int hwsprite = 0;
......@@ -124,6 +125,8 @@ static uaecptr boardinfo, ABI_interrupt;
static int interrupt_enabled;
int p96vblank;
static int uaegfx_old, uaegfx_active;
static uae_u32 reserved_gfxmem;
static uaecptr uaegfx_resname,
uaegfx_resid,
uaegfx_init,
......@@ -307,12 +310,12 @@ static void ShowSupportedResolutions (void)
{
int i = 0;
write_log ("-----------------\n");
write_log ("-- P96: Show Supported Resolutions --\n");
while (newmodes[i].depth >= 0) {
write_log ("%s\n", newmodes[i].name);
i++;
}
write_log ("-----------------\n");
write_log ("-------------------------------------\n");
}
#endif
......@@ -1425,18 +1428,23 @@ static uae_u32 REGPARAM2 picasso_SetSprite (TrapContext *ctx)
* BoardInfo struct supplied by the caller, the rtg.library, for example
* the MemoryBase, MemorySize and RegisterBase fields.
*/
static void picasso96_alloc2 (TrapContext *ctx);
static uae_u32 REGPARAM2 picasso_FindCard (TrapContext *ctx)
{
uaecptr AmigaBoardInfo = m68k_areg (regs, 0);
/* NOTES: See BoardInfo struct definition in Picasso96 dev info */
if (!uaegfx_base)
if (!uaegfx_active)
return 0;
put_long (uaegfx_base + CARD_BOARDINFO, AmigaBoardInfo);
if (uaegfx_base) {
put_long (uaegfx_base + CARD_BOARDINFO, AmigaBoardInfo);
} else if (uaegfx_old) {
picasso96_alloc2 (ctx);
}
boardinfo = AmigaBoardInfo;
if (allocated_gfxmem && !picasso96_state.CardFound) {
/* Fill in MemoryBase, MemorySize */
put_long (AmigaBoardInfo + PSSO_BoardInfo_MemoryBase, gfxmem_start);
put_long (AmigaBoardInfo + PSSO_BoardInfo_MemorySize, allocated_gfxmem);
put_long (AmigaBoardInfo + PSSO_BoardInfo_MemorySize, allocated_gfxmem - reserved_gfxmem);
picasso96_state.CardFound = 1; /* mark our "card" as being found */
return -1;
} else
......@@ -1595,16 +1603,18 @@ static void CopyLibResolutionStructureU2A (struct LibResolution *libres, uaecptr
put_long (amigamemptr + PSSO_LibResolution_BoardInfo, libres->BoardInfo);
}
static void init_alloc (void)
static void init_alloc (TrapContext *ctx, int size)
{
picasso96_amem = picasso96_amemend = 0;
if (uaegfx_base) {
int size = get_long (uaegfx_base + CARD_RESLISTSIZE);
picasso96_amem = get_long (uaegfx_base + CARD_RESLIST);
picasso96_amemend = picasso96_amem + size;
write_log ("P96 RESINFO: %08X-%08X (%d,%d)\n", picasso96_amem, picasso96_amemend, size / PSSO_ModeInfo_sizeof, size);
} else if (uaegfx_active) {
reserved_gfxmem = size;
picasso96_amem = gfxmem_start + allocated_gfxmem - size;
}
picasso96_amemend = picasso96_amem + size;
write_log ("P96 RESINFO: %08X-%08X (%d,%d)\n", picasso96_amem, picasso96_amemend, size / PSSO_ModeInfo_sizeof, size);
xfree (gwwbuf);
gwwpagesize = getpagesize();
gwwbufsize = allocated_gfxmem / gwwpagesize + 1;
......@@ -1634,14 +1644,13 @@ static int missmodes[] = { 320, 200, 320, 240, 320, 256, 640, 400, 640, 480, 640
static uaecptr uaegfx_card_install (TrapContext *ctx, uae_u32 size);
void picasso96_alloc (TrapContext *ctx)
static void picasso96_alloc2 (TrapContext *ctx)
{
int i, j, size, cnt;
int misscnt, depths;
struct MultiDisplay *md = getdisplay (&currprefs);
struct PicassoResolution *DisplayModes = md->DisplayModes;
uaegfx_resname = ds ("uaegfx.card");
xfree (newmodes);
newmodes = NULL;
picasso96_amem = picasso96_amemend = 0;
......@@ -1752,11 +1761,19 @@ void picasso96_alloc (TrapContext *ctx)
}
}
}
#if 0
#if P96TRACING_ENABLED
ShowSupportedResolutions ();
#endif
uaegfx_card_install (ctx, size);
init_alloc ();
init_alloc (ctx, size);
}
void picasso96_alloc (TrapContext *ctx)
{
if (uaegfx_old)
return;
uaegfx_resname = ds ("uaegfx.card");
picasso96_alloc2 (ctx);
}
static uaecptr inituaegfxfuncs (uaecptr start, uaecptr ABI);
......@@ -1799,7 +1816,7 @@ static void inituaegfx (uaecptr ABI)
flags &= 0xffff0000;
flags |= BIF_BLITTER | BIF_NOMEMORYMODEMIX;
flags &= ~BIF_HARDWARESPRITE;
if (currprefs.gfx_api && D3D_goodenough ()) {
if (currprefs.gfx_api && D3D_goodenough () && USE_HARDWARESPRITE) {
hwsprite = 1;
flags |= BIF_HARDWARESPRITE;
write_log ("P96: Hardware sprite support enabled\n");
......@@ -1809,7 +1826,7 @@ static void inituaegfx (uaecptr ABI)
}
if (flags & BIF_NOBLITTER)
write_log ("P96: Blitter disabled in devs:monitors/uaegfx!\n");
if (currprefs.win32_rtgvblankrate >= -1)
if (currprefs.win32_rtgvblankrate >= -1 && !uaegfx_old)
flags |= BIF_VBLANKINTERRUPT;
if (!(flags & BIF_INDISPLAYCHAIN)) {
write_log ("P96: BIF_INDISPLAYCHAIN force-enabled!\n");
......@@ -1871,7 +1888,7 @@ static void addmode (uaecptr AmigaBoardInfo, uaecptr *amem, struct LibResolution
static uae_u32 REGPARAM2 picasso_InitCard (TrapContext *ctx)
{
int LibResolutionStructureCount = 0;
int i, j, unkcnt;
int i, j, unkcnt, cnt;
uaecptr amem;
uaecptr AmigaBoardInfo = m68k_areg (regs, 0);
......@@ -1884,13 +1901,13 @@ static uae_u32 REGPARAM2 picasso_InitCard (TrapContext *ctx)
inituaegfx (AmigaBoardInfo);
i = 0;
unkcnt = 0;
unkcnt = cnt = 0;
while (newmodes[i].depth >= 0) {
struct LibResolution res = { 0 };
TCHAR *s;
j = i;
addmode (AmigaBoardInfo, &amem, &res, newmodes[i].res.width, newmodes[i].res.height, NULL, 0, &unkcnt);
write_log ("%08X %4dx%4d %s\n", res.DisplayID, res.Width, res.Height, res.Name);
write_log ("%2d: %08X %4dx%4d %s\n", ++cnt, res.DisplayID, res.Width, res.Height, res.Name);
while (newmodes[i].depth >= 0
&& newmodes[i].res.width == newmodes[j].res.width
&& newmodes[i].res.height == newmodes[j].res.height)
......@@ -2896,8 +2913,7 @@ static uae_u32 REGPARAM2 picasso_CalculateBytesPerRow (TrapContext *ctx)
uae_u16 width = m68k_dreg (regs, 0);
uae_u32 type = m68k_dreg (regs, 7);
width = GetBytesPerPixel (type) * width;
P96TRACE (("CalculateBytesPerRow() = %d\n", width));
P96TRACE (("CalculateBytesPerRow() = %d\n", width));
return width;
}
......@@ -3840,6 +3856,8 @@ static uaecptr inituaegfxfuncs (uaecptr start, uaecptr ABI)
uaecptr old = here ();
uaecptr ptr;
if (uaegfx_old)
return 0;
org (start);
dw (RTS);
......@@ -4001,7 +4019,10 @@ static uaecptr inituaegfxfuncs (uaecptr start, uaecptr ABI)
void picasso_reset (void)
{
uaegfx_base = 0;
uaegfx_old = 0;
uaegfx_active = 0;
interrupt_enabled = 0;
reserved_gfxmem = 0;
}
void uaegfx_install_code (void)
......@@ -4036,6 +4057,9 @@ static uaecptr uaegfx_card_install (TrapContext *ctx, uae_u32 extrasize)
uaecptr findcardfunc, initcardfunc;
uaecptr exec = get_long (4);
if (uaegfx_old)
return NULL;
uaegfx_resid = ds ("UAE Graphics Card 3.3");
uaegfx_vblankname = ds ("UAE Graphics Card VBLANK");
uaegfx_portsname = ds ("UAE Graphics Card PORTS");
......@@ -4095,13 +4119,59 @@ static uaecptr uaegfx_card_install (TrapContext *ctx, uae_u32 extrasize)
initvblankirq (ctx, uaegfx_base);
write_log ("uaegfx.card %d.%d init @%08X\n", UAEGFX_VERSION, UAEGFX_REVISION, uaegfx_base);
uaegfx_active = 1;
return uaegfx_base;
}
uae_u32 picasso_demux (uae_u32 arg, TrapContext *ctx)
{
uae_u32 num = get_long (m68k_areg (regs, 7) + 4);
if (uaegfx_base) {
if (num >= 16 && num <= 39) {
write_log ("uaelib: obsolete Picasso96 uaelib hook called, call ignored\n");
return 0;
}
}
if (!uaegfx_old) {
write_log ("uaelib: uaelib hook in use\n");
uaegfx_old = 1;
uaegfx_active = 1;
}
switch (num)
{
case 16: return picasso_FindCard (ctx);
case 17: return picasso_FillRect (ctx);
case 18: return picasso_SetSwitch (ctx);
case 19: return picasso_SetColorArray (ctx);
case 20: return picasso_SetDAC (ctx);
case 21: return picasso_SetGC (ctx);
case 22: return picasso_SetPanning (ctx);
case 23: return picasso_CalculateBytesPerRow (ctx);
case 24: return picasso_BlitPlanar2Chunky (ctx);
case 25: return picasso_BlitRect (ctx);
case 26: return picasso_SetDisplay (ctx);
case 27: return picasso_BlitTemplate (ctx);
case 28: return picasso_BlitRectNoMaskComplete (ctx);
case 29: return picasso_InitCard (ctx);
case 30: return picasso_BlitPattern (ctx);
case 31: return picasso_InvertRect (ctx);
case 32: return picasso_BlitPlanar2Direct (ctx);
//case 34: return picasso_WaitVerticalSync (ctx);
case 35: return allocated_gfxmem ? 1 : 0;
case 36: return picasso_SetSprite (ctx);
case 37: return picasso_SetSpritePosition (ctx);
case 38: return picasso_SetSpriteImage (ctx);
case 39: return picasso_SetSpriteColor (ctx);
}
return 0;
}
#ifdef SAVESTATE
void restore_p96_finish (void)
{
init_alloc ();
init_alloc (NULL, 0);
if (uaegfx_rom && boardinfo)
inituaegfxfuncs (uaegfx_rom, boardinfo);
if (set_gc_called) {
......
......@@ -368,8 +368,8 @@ static uae_u32 REGPARAM2 uaelib_demux2 (TrapContext *context)
#define ARG5 (get_long (m68k_areg (regs, 7) + 24))
#ifndef UAEGFX_INTERNAL
// if (ARG0 >= 16 && ARG0 <= 39)
// return picasso_demux (ARG0, context);
if (ARG0 >= 16 && ARG0 <= 39)
return picasso_demux (ARG0, context);
#endif
switch (ARG0)
......@@ -423,7 +423,7 @@ static uae_u32 REGPARAM2 uaelib_demux2 (TrapContext *context)
return 0;
}
int uaelib_debug;
extern int uaelib_debug;
static uae_u32 REGPARAM2 uaelib_demux (TrapContext *context)
{
uae_u32 v;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment