minor updates from WinUAE

This commit is contained in:
Dimitris Panokostas 2020-08-12 15:26:35 +02:00
parent 41bac27715
commit 9c5a80c427
11 changed files with 166 additions and 118 deletions

View file

@ -410,6 +410,7 @@ static uae_u8 cdrom_command;
static uae_u8 cdrom_last_rx; static uae_u8 cdrom_last_rx;
static int cdrom_toc_counter; static int cdrom_toc_counter;
static uae_u32 cdrom_toc_crc;
static uae_u8 cdrom_toc_buffer[MAX_TOC_ENTRIES * 13]; static uae_u8 cdrom_toc_buffer[MAX_TOC_ENTRIES * 13];
static struct cd_toc_head cdrom_toc_cd_buffer; static struct cd_toc_head cdrom_toc_cd_buffer;
static uae_u8 qcode_buf[SUBQ_SIZE]; static uae_u8 qcode_buf[SUBQ_SIZE];
@ -695,6 +696,7 @@ static int get_cdrom_toc (void)
if (s->point >= 2 && s->point < 100 && (s->control & 0x0c) != 0x04 && !secondtrack) if (s->point >= 2 && s->point < 100 && (s->control & 0x0c) != 0x04 && !secondtrack)
secondtrack = addr; secondtrack = addr;
} }
cdrom_toc_crc = get_crc32 (cdrom_toc_buffer, cdrom_toc_cd_buffer.points * 13);
return 0; return 0;
} }
static bool is_valid_data_sector(int sector) static bool is_valid_data_sector(int sector)
@ -813,6 +815,13 @@ static int cdrom_command_led (void)
return 0; return 0;
} }
static int cdrom_command_idle_status (void)
{
cdrom_result_buffer[0] = 0x0a;
cdrom_result_buffer[1] = 0x70;
return 2;
}
static int cdrom_command_media_status (void) static int cdrom_command_media_status (void)
{ {
cdrom_result_buffer[0] = 0x0a; cdrom_result_buffer[0] = 0x0a;
@ -1798,13 +1807,17 @@ addrbank akiko_bank = {
ABFLAG_IO | ABFLAG_SAFE, S_READ, S_WRITE ABFLAG_IO | ABFLAG_SAFE, S_READ, S_WRITE
}; };
static const uae_u8 patchdata[]={0x0c,0x82,0x00,0x00,0x03,0xe8,0x64,0x00,0x00,0x46}; static const uae_u8 patchdata[] = { 0x0c, 0x82, 0x00, 0x00, 0x03, 0xe8, 0x64, 0x00, 0x00, 0x46 };
static const uae_u8 patchdata2[] = { 0x0c, 0x82, 0x00, 0x00, 0x03, 0xe8, 0x4e, 0x71, 0x4e, 0x71 };
static void patchrom(void) static void patchrom(void)
{ {
int i;
if (currprefs.cpu_model > 68020 || currprefs.cachesize || currprefs.m68k_speed != 0) { if (currprefs.cpu_model > 68020 || currprefs.cachesize || currprefs.m68k_speed != 0) {
uae_u8* p = extendedkickmem_bank.baseaddr; uae_u8 *p = extendedkickmem_bank.baseaddr;
if (p) { if (p) {
for (unsigned int i = 0; i < 524288 - sizeof patchdata; i++) { for (i = 0; i < 524288 - 512; i++) {
if (!memcmp(p + i, patchdata2, sizeof(patchdata2)))
return;
if (!memcmp(p + i, patchdata, sizeof(patchdata))) { if (!memcmp(p + i, patchdata, sizeof(patchdata))) {
protect_roms(false); protect_roms(false);
p[i + 6] = 0x4e; p[i + 6] = 0x4e;
@ -1859,6 +1872,7 @@ static int akiko_thread_do(int start)
static void akiko_reset(int hardreset) static void akiko_reset(int hardreset)
{ {
patchrom();
cdaudiostop_do (); cdaudiostop_do ();
nvram_read (); nvram_read ();
eeprom_reset(cd32_eeprom); eeprom_reset(cd32_eeprom);
@ -1931,7 +1945,6 @@ int akiko_init (void)
cdrom_playing = cdrom_paused = 0; cdrom_playing = cdrom_paused = 0;
cdrom_data_offset = -1; cdrom_data_offset = -1;
} }
patchrom ();
akiko_thread_do(1); akiko_thread_do(1);
gui_flicker_led (LED_HD, 0, -1); gui_flicker_led (LED_HD, 0, -1);
akiko_inited = true; akiko_inited = true;
@ -1996,7 +2009,7 @@ uae_u8 *save_akiko (int *len, uae_u8 *dstptr)
save_u8 (cdrom_speed); save_u8 (cdrom_speed);
save_u8 (cdrom_current_sector); save_u8 (cdrom_current_sector);
save_u32 (0); save_u32 (cdrom_toc_crc);
save_u8 (cdrom_toc_cd_buffer.points); save_u8 (cdrom_toc_cd_buffer.points);
save_u32 (cdrom_toc_cd_buffer.lastaddress); save_u32 (cdrom_toc_cd_buffer.lastaddress);

View file

@ -1057,10 +1057,11 @@ void action_replay_cia_access(bool write)
return; return;
if (action_replay_flag == ACTION_REPLAY_INACTIVE) if (action_replay_flag == ACTION_REPLAY_INACTIVE)
return; return;
int delay = currprefs.cpu_cycle_exact ? 1 : 0;
if ((armode_write & ARMODE_ACTIVATE_BFE001) && !write) { if ((armode_write & ARMODE_ACTIVATE_BFE001) && !write) {
event2_newevent_xx(-1, 0, write, action_replay_cia_access_delay); event2_newevent_xx(-1, delay, write, action_replay_cia_access_delay);
} else if ((armode_write & ARMODE_ACTIVATE_BFD100) && write) { } else if ((armode_write & ARMODE_ACTIVATE_BFD100) && write) {
event2_newevent_xx(-1, 0, write, action_replay_cia_access_delay); event2_newevent_xx(-1, delay, write, action_replay_cia_access_delay);
} }
} }
@ -1255,6 +1256,18 @@ static uae_u8* get_checksum_location (void)
return (uae_u8*)checksum_end; return (uae_u8*)checksum_end;
} }
/* Replaces the existing cart checksum with a correct one. */
/* Useful if you want to patch the rom. */
static void action_replay_fixup_checksum (uae_u32 new_checksum)
{
uae_u32* checksum = (uae_u32*)get_checksum_location();
if (checksum)
do_put_mem_long (checksum, new_checksum);
else
write_log (_T("Unable to locate Checksum in ROM.\n"));
return;
}
/* Longword search on word boundary /* Longword search on word boundary
* the search_value is assumed to already be in the local endian format * the search_value is assumed to already be in the local endian format
* return 0 on failure * return 0 on failure
@ -1418,6 +1431,7 @@ int action_replay_unload (int in_memory_reset)
static int superiv_init (struct romdata *rd, struct zfile *f) static int superiv_init (struct romdata *rd, struct zfile *f)
{ {
uae_u32 chip = currprefs.chipmem_size - 0x10000; uae_u32 chip = currprefs.chipmem_size - 0x10000;
int subtype = rd->id;
int flags = rd->type & ROMTYPE_MASK; int flags = rd->type & ROMTYPE_MASK;
const TCHAR *memname1, *memname2, *memname3; const TCHAR *memname1, *memname2, *memname3;

View file

@ -1,11 +1,11 @@
/* /*
* xDMS v1.3 - Portable DMS archive unpacker - Public Domain * xDMS v1.3 - Portable DMS archive unpacker - Public Domain
* Written by Andre Rodrigues de la Rocha <adlroc@usa.net> * Written by Andre Rodrigues de la Rocha <adlroc@usa.net>
* *
* Handles the processing of a single DMS archive * Handles the processing of a single DMS archive
* *
*/ */
#define HEADLEN 56 #define HEADLEN 56
@ -259,7 +259,7 @@ USHORT DMS_Process_File(struct zfile *fi, struct zfile *fo, USHORT cmd, USHORT o
} }
} }
if ((cmd == CMD_VIEWFULL) || (cmd == CMD_SHOWDIZ) || (cmd == CMD_SHOWBANNER)) write_log(_T("\n")); if ((cmd == CMD_VIEWFULL) || (cmd == CMD_SHOWDIZ) || (cmd == CMD_SHOWBANNER)) write_log (_T("\n"));
if (ret == DMS_FILE_END) ret = NO_PROBLEM; if (ret == DMS_FILE_END) ret = NO_PROBLEM;

View file

@ -25,7 +25,7 @@
#include "kjmp2.h" #include "kjmp2.h"
#ifdef _MSC_VER_ #ifdef _MSC_VER
#define FASTCALL __fastcall #define FASTCALL __fastcall
#else #else
#define FASTCALL #define FASTCALL

View file

@ -95,6 +95,9 @@ static uae_s32 ARCunsqueeze(struct zfile *in, struct zfile *out, struct rledata
{ {
numnodes = xadIOGetBitsLow(&io, 16); numnodes = xadIOGetBitsLow(&io, 16);
if (io.err)
return XADERR_ILLEGALDATA;
if(numnodes < 0 || numnodes >= ARCSQNUMVALS) if(numnodes < 0 || numnodes >= ARCSQNUMVALS)
err = XADERR_DECRUNCH; err = XADERR_DECRUNCH;
else else
@ -115,6 +118,9 @@ static uae_s32 ARCunsqueeze(struct zfile *in, struct zfile *out, struct rledata
while(i >= 0 && !io.err) while(i >= 0 && !io.err)
i = node[2*i + xadIOGetBitsLow(&io, 1)]; i = node[2*i + xadIOGetBitsLow(&io, 1)];
if (io.err)
return XADERR_ILLEGALDATA;
i = -(i + 1); /* decode fake node index to original data value */ i = -(i + 1); /* decode fake node index to original data value */
if(i != ARCSQSPEOF) if(i != ARCSQSPEOF)
@ -441,8 +447,12 @@ struct zfile *unwarp(struct zfile *zf)
{ {
int i; int i;
for (i = 0; i < size; i++) { for (i = 0; i < size; i++) {
uae_u8 v = zfile_getc (zf); uae_s32 v = zfile_getc(zf);
putrle (v, tmpf, algo == 3 ? &rled : NULL); if (v == -1) {
err = XADERR_ILLEGALDATA;
break;
}
putrle((uae_u8)v, tmpf, algo == 3 ? &rled : NULL);
} }
} }
break; break;

View file

@ -1,16 +1,16 @@
/* /*
* UAE - The Un*x Amiga Emulator * UAE - The Un*x Amiga Emulator
* *
* Paula audio emulation * Paula audio emulation
* *
* Copyright 1995, 1996, 1997 Bernd Schmidt * Copyright 1995, 1996, 1997 Bernd Schmidt
* Copyright 1996 Marcus Sundberg * Copyright 1996 Marcus Sundberg
* Copyright 1996 Manfred Thole * Copyright 1996 Manfred Thole
* Copyright 2006 Toni Wilen * Copyright 2006 Toni Wilen
* *
* new filter algorithm and anti&sinc interpolators by Antti S. Lankila * new filter algorithm and anti&sinc interpolators by Antti S. Lankila
* *
*/ */
#include "sysconfig.h" #include "sysconfig.h"
#include "sysdeps.h" #include "sysdeps.h"

View file

@ -18,6 +18,7 @@
#include "autoconf.h" #include "autoconf.h"
#include "traps.h" #include "traps.h"
#include "threaddep/thread.h" #include "threaddep/thread.h"
#include "native2amiga.h"
#include "inputdevice.h" #include "inputdevice.h"
#include "devices.h" #include "devices.h"
@ -553,7 +554,12 @@ static uae_u32 REGPARAM2 uae_puts (TrapContext *ctx)
void rtarea_init_mem (void) void rtarea_init_mem (void)
{ {
need_uae_boot_rom(&currprefs); if (need_uae_boot_rom(&currprefs)) {
rtarea_bank.flags &= ~ABFLAG_ALLOCINDIRECT;
} else {
// not enabled and something else may use same address space
rtarea_bank.flags |= ABFLAG_ALLOCINDIRECT;
}
rtarea_bank.reserved_size = RTAREA_SIZE; rtarea_bank.reserved_size = RTAREA_SIZE;
rtarea_bank.start = rtarea_base; rtarea_bank.start = rtarea_base;
if (!mapped_malloc (&rtarea_bank)) { if (!mapped_malloc (&rtarea_bank)) {

View file

@ -1,6 +1,5 @@
#include "sysconfig.h" #include "sysconfig.h"
#include "sysdeps.h" #include "sysdeps.h"
#include "savestate.h"
#include "options.h" #include "options.h"
#include "custom.h" #include "custom.h"
#include "memory.h" #include "memory.h"

View file

@ -3,7 +3,6 @@
#include "options.h" #include "options.h"
#include "custom.h" #include "custom.h"
#include "memory.h" #include "memory.h"
#include "savestate.h"
#include "blitter.h" #include "blitter.h"
#include "blitfunc.h" #include "blitfunc.h"

View file

@ -14,9 +14,9 @@
#include "memory.h" #include "memory.h"
#include "custom.h" #include "custom.h"
#include "newcpu.h" #include "newcpu.h"
#include "savestate.h"
#include "blitter.h" #include "blitter.h"
#include "blit.h" #include "blit.h"
#include "savestate.h"
/* we must not change ce-mode while blitter is running.. */ /* we must not change ce-mode while blitter is running.. */
static int blitter_cycle_exact, immediate_blits; static int blitter_cycle_exact, immediate_blits;
@ -313,11 +313,11 @@ int blitter_channel_state (void)
return channel_state (blit_cyclecounter); return channel_state (blit_cyclecounter);
} }
STATIC_INLINE int canblit(int hpos) STATIC_INLINE int canblit (int hpos)
{ {
if (!dmaen(DMA_BLITTER)) if (!dmaen (DMA_BLITTER))
return -1; return -1;
if (is_bitplane_dma(hpos)) if (is_bitplane_dma (hpos))
return 0; return 0;
if (cycle_line[hpos] & CYCLE_MASK) { if (cycle_line[hpos] & CYCLE_MASK) {
return 0; return 0;
@ -1076,7 +1076,9 @@ void do_blitter (int hpos)
bltstate = BLT_done; bltstate = BLT_done;
blitter_cycle_exact = currprefs.blitter_cycle_exact;
immediate_blits = currprefs.immediate_blits; immediate_blits = currprefs.immediate_blits;
blt_info.got_cycle = 0;
last_blitter_hpos = hpos + 1; last_blitter_hpos = hpos + 1;
blit_firstline_cycles = blit_first_cycle = get_cycles (); blit_firstline_cycles = blit_first_cycle = get_cycles ();
blit_misscyclecounter = 0; blit_misscyclecounter = 0;
@ -1119,6 +1121,10 @@ void do_blitter (int hpos)
return; return;
} }
if (dmaen (DMA_BLITTER)) {
blt_info.got_cycle = 1;
}
if (immediate_blits) { if (immediate_blits) {
if (dmaen (DMA_BLITTER)) if (dmaen (DMA_BLITTER))
blitter_doit (); blitter_doit ();

View file

@ -9,6 +9,7 @@
#ifndef UAE_BLITTER_H #ifndef UAE_BLITTER_H
#define UAE_BLITTER_H #define UAE_BLITTER_H
#include "savestate.h"
#include "uae/types.h" #include "uae/types.h"
struct bltinfo { struct bltinfo {