mirror of
https://github.com/LIV2/WinUAE.git
synced 2025-12-06 00:12:52 +00:00
fs-uae portability patch
This commit is contained in:
parent
ee60f5ccde
commit
9bd3fb205a
@ -193,8 +193,6 @@ void rethink_a2091 (void)
|
||||
|
||||
static void INT2 (void)
|
||||
{
|
||||
int irq = 0;
|
||||
|
||||
if (currprefs.cs_cdtvscsi)
|
||||
return;
|
||||
if (!(auxstatus & 0x80))
|
||||
@ -618,7 +616,10 @@ uae_u8 wdscsi_getauxstatus (void)
|
||||
|
||||
uae_u8 wdscsi_get (void)
|
||||
{
|
||||
uae_u8 v, osasr = sasr;
|
||||
uae_u8 v;
|
||||
#if WD33C93_DEBUG > 1
|
||||
uae_u8 osasr = sasr;
|
||||
#endif
|
||||
|
||||
v = wdregs[sasr];
|
||||
if (sasr == WD_DATA) {
|
||||
@ -1053,7 +1054,9 @@ static void mbdmac_write (uae_u32 addr, uae_u32 val, int mode)
|
||||
|
||||
static uae_u32 mbdmac_read (uae_u32 addr, int mode)
|
||||
{
|
||||
#if A3000_DEBUG > 1
|
||||
uae_u32 vaddr = addr;
|
||||
#endif
|
||||
uae_u32 v = 0xffffffff;
|
||||
|
||||
if (currprefs.cs_mbdmac > 1)
|
||||
|
||||
19
akiko.cpp
19
akiko.cpp
@ -457,7 +457,7 @@ static uae_u8 qcode_buf[SUBQ_SIZE];
|
||||
static int qcode_valid;
|
||||
|
||||
static int cdrom_disk, cdrom_paused, cdrom_playing, cdrom_audiostatus;
|
||||
static int cdrom_command_active, cdrom_command_idle;
|
||||
static int cdrom_command_active;
|
||||
static int cdrom_command_length;
|
||||
static int cdrom_checksum_error, cdrom_unknown_command;
|
||||
static int cdrom_data_offset, cdrom_speed, cdrom_sector_counter;
|
||||
@ -984,7 +984,9 @@ static int cdrom_command_multi (void)
|
||||
}
|
||||
|
||||
if (cdrom_command_buffer[7] == 0x80) { /* data read */
|
||||
#if AKIKO_DEBUG_IO_CMD
|
||||
int cdrom_data_offset_end = endpos;
|
||||
#endif
|
||||
cdrom_data_offset = seekpos;
|
||||
cdrom_seek_delay = abs (cdrom_current_sector - cdrom_data_offset);
|
||||
if (cdrom_seek_delay < 100) {
|
||||
@ -1001,12 +1003,12 @@ static int cdrom_command_multi (void)
|
||||
#endif
|
||||
cdrom_result_buffer[1] |= 0x02;
|
||||
} else if (cdrom_command_buffer[10] & 4) { /* play audio */
|
||||
#if AKIKO_DEBUG_IO_CMD
|
||||
int scan = 0;
|
||||
if (cdrom_command_buffer[7] & 0x04)
|
||||
scan = 1;
|
||||
else if (cdrom_command_buffer[7] & 0x08)
|
||||
scan = -1;
|
||||
#if AKIKO_DEBUG_IO_CMD
|
||||
write_log (_T("PLAY FROM %06X (%d) to %06X (%d) SCAN=%d\n"),
|
||||
seekpos, msf2lsn (seekpos), endpos, msf2lsn (endpos), scan);
|
||||
#endif
|
||||
@ -1061,7 +1063,9 @@ static void cdrom_run_command (void)
|
||||
{
|
||||
int i, cmd_len;
|
||||
uae_u8 checksum;
|
||||
#if 0
|
||||
uae_u8 *pp = get_real_address (cdtx_address);
|
||||
#endif
|
||||
|
||||
if (!(cdrom_flags & CDFLAG_TXD))
|
||||
return;
|
||||
@ -1186,7 +1190,6 @@ static void cdrom_run_command_run (void)
|
||||
static void cdrom_run_read (void)
|
||||
{
|
||||
int i, sector, inc;
|
||||
int read = 0;
|
||||
int sec;
|
||||
int seccnt;
|
||||
|
||||
@ -1305,15 +1308,6 @@ static void akiko_internal (void)
|
||||
if (!cdrom_command_active)
|
||||
cdrom_run_command_run ();
|
||||
}
|
||||
#if 0
|
||||
if (!cdrom_playing && !cdrom_command_active) {
|
||||
cdrom_command_idle++;
|
||||
if (cdrom_command_idle > 1000) {
|
||||
cdrom_command_idle = 0;
|
||||
cdrom_start_return_data (cdrom_command_idle_status ());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void AKIKO_hsync_handler (void)
|
||||
@ -1411,7 +1405,6 @@ static void *akiko_thread (void *null)
|
||||
if (frame2counter <= 0) {
|
||||
frame2counter = 312 * 50 / 2;
|
||||
if (unitnum >= 0 && sys_command_cd_qcode (unitnum, qcode_buf)) {
|
||||
uae_u8 as = qcode_buf[1];
|
||||
qcode_valid = 1;
|
||||
}
|
||||
}
|
||||
|
||||
17
ar.cpp
17
ar.cpp
@ -882,6 +882,15 @@ static addrbank arram_bank = {
|
||||
arram_lget, arram_wget, ABFLAG_RAM
|
||||
};
|
||||
|
||||
|
||||
static void action_replay_map_banks (void)
|
||||
{
|
||||
if(!armemory_rom)
|
||||
return;
|
||||
map_banks (&arrom_bank, arrom_start >> 16, arrom_size >> 16, 0);
|
||||
map_banks (&arram_bank, arram_start >> 16, arram_size >> 16, 0);
|
||||
}
|
||||
|
||||
static void action_replay_unmap_banks (void)
|
||||
{
|
||||
if(!armemory_rom)
|
||||
@ -894,14 +903,6 @@ static void action_replay_unmap_banks (void)
|
||||
map_banks (&dummy_bank, arram_start >> 16 , arram_size >> 16, 0);
|
||||
}
|
||||
|
||||
static void action_replay_map_banks (void)
|
||||
{
|
||||
if(!armemory_rom)
|
||||
return;
|
||||
map_banks (&arrom_bank, arrom_start >> 16, arrom_size >> 16, 0);
|
||||
map_banks (&arram_bank, arram_start >> 16, arram_size >> 16, 0);
|
||||
}
|
||||
|
||||
static void hide_cart (int hide)
|
||||
{
|
||||
#ifdef ACTION_REPLAY_HIDE_CARTRIDGE
|
||||
|
||||
@ -92,7 +92,7 @@ static int load_rom8 (TCHAR *xpath, uae_u8 *mem, int extra)
|
||||
TCHAR path[MAX_DPATH];
|
||||
int i;
|
||||
uae_u8 *tmp = xmalloc (uae_u8, 131072);
|
||||
TCHAR *bin = extra == 1 ? _T(".bin") : _T("");
|
||||
const TCHAR *bin = extra == 1 ? _T(".bin") : _T("");
|
||||
|
||||
memset (tmp, 0, 131072);
|
||||
_stprintf (path, _T("%s%s%s"), xpath, extra == 3 ? _T("-hi") : (extra == 2 ? _T("hi") : _T("h")), bin);
|
||||
|
||||
10
audio.cpp
10
audio.cpp
@ -43,7 +43,7 @@
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#define MAX_EV ~0ul
|
||||
#define MAX_EV ~0u
|
||||
#define DEBUG_AUDIO 0
|
||||
#define DEBUG_CHANNEL_MASK 15
|
||||
#define TEST_AUDIO 0
|
||||
@ -58,10 +58,12 @@ STATIC_INLINE bool isaudio (void)
|
||||
return currprefs.produce_sound != 0;
|
||||
}
|
||||
|
||||
#if DEBUG_AUDIO > 0
|
||||
static bool debugchannel (int ch)
|
||||
{
|
||||
return ((1 << ch) & DEBUG_CHANNEL_MASK) != 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
STATIC_INLINE bool usehacks1 (void)
|
||||
{
|
||||
@ -216,7 +218,7 @@ void audio_sampleripper (int mode)
|
||||
while (rs) {
|
||||
if (rs->changed) {
|
||||
rs->changed = 0;
|
||||
fetch_ripperpath (path, sizeof (path) / sizeof TCHAR);
|
||||
fetch_ripperpath (path, sizeof (path) / sizeof (TCHAR));
|
||||
name[0] = 0;
|
||||
if (currprefs.floppyslots[0].dfxtype >= 0)
|
||||
_tcscpy (name, currprefs.floppyslots[0].df);
|
||||
@ -305,7 +307,7 @@ int sound_available = 0;
|
||||
void (*sample_handler) (void);
|
||||
static void (*sample_prehandler) (unsigned long best_evtime);
|
||||
|
||||
static float sample_evtime;
|
||||
float sample_evtime;
|
||||
float scaled_sample_evtime;
|
||||
|
||||
static unsigned long last_cycles;
|
||||
@ -1685,7 +1687,9 @@ void set_audio (void)
|
||||
void update_audio (void)
|
||||
{
|
||||
unsigned long int n_cycles = 0;
|
||||
#if SOUNDSTUFF > 1
|
||||
static int samplecounter;
|
||||
#endif
|
||||
|
||||
if (!isaudio ())
|
||||
goto end;
|
||||
|
||||
@ -118,12 +118,16 @@ extern struct device_functions devicefunc_win32_spti;
|
||||
extern struct device_functions devicefunc_win32_ioctl;
|
||||
extern struct device_functions devicefunc_cdimage;
|
||||
|
||||
#endif
|
||||
|
||||
static struct device_functions *devicetable[] = {
|
||||
NULL,
|
||||
&devicefunc_cdimage,
|
||||
#ifdef _WIN32
|
||||
&devicefunc_win32_ioctl,
|
||||
&devicefunc_win32_spti,
|
||||
&devicefunc_win32_aspi,
|
||||
#endif
|
||||
NULL
|
||||
};
|
||||
static int driver_installed[6];
|
||||
@ -180,7 +184,6 @@ static void install_driver (int flags)
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
void blkdev_default_prefs (struct uae_prefs *p)
|
||||
{
|
||||
|
||||
@ -1021,7 +1021,7 @@ static int parsemds (struct cdunit *cdu, struct zfile *zmds, const TCHAR *img)
|
||||
MDS_SessionBlock *sb = (MDS_SessionBlock*)(mds + head->sessions_blocks_offset);
|
||||
cdu->tracks = sb->last_track - sb->first_track + 1;
|
||||
for (int i = 0; i < sb->num_all_blocks; i++) {
|
||||
MDS_TrackBlock *tb = (MDS_TrackBlock*)(mds + sb->tracks_blocks_offset + i * sizeof MDS_TrackBlock);
|
||||
MDS_TrackBlock *tb = (MDS_TrackBlock*)(mds + sb->tracks_blocks_offset + i * sizeof (MDS_TrackBlock));
|
||||
int point = tb->point;
|
||||
int tracknum = -1;
|
||||
if (point == 0xa2)
|
||||
@ -1341,7 +1341,7 @@ static int parsecue (struct cdunit *cdu, struct zfile *zcue, const TCHAR *img)
|
||||
s2 = _tcsrchr (tmp, '/');
|
||||
if (s2) {
|
||||
s2[0] = 0;
|
||||
_tcscat (tmp, _T("\\"));
|
||||
_tcscat (tmp, FSDB_DIR_SEPARATOR_S);
|
||||
_tcscat (tmp, fname);
|
||||
ztrack = zfile_fopen (tmp, _T("rb"), ZFD_ARCHIVE | ZFD_DELAYEDOPEN);
|
||||
}
|
||||
|
||||
@ -251,7 +251,7 @@ int main(int argc, char **argv)
|
||||
for(i = 0; i < 5; i++) {
|
||||
printf("{%d,%d}%s", flaguse[i], flagset[i], i == 4 ? "" : ",");
|
||||
}
|
||||
printf("},%2d,L\"%s\"}", sduse, opstrp);
|
||||
printf("},%2d,_T(\"%s\")}", sduse, opstrp);
|
||||
}
|
||||
}
|
||||
printf("};\nint n_defs68k = %d;\n", no_insns);
|
||||
|
||||
@ -303,8 +303,6 @@ static void REGPARAM2 fmv_lput (uaecptr addr, uae_u32 w)
|
||||
fmv_wput (addr + 2, w >> 0);
|
||||
}
|
||||
|
||||
extern addrbank fmv_bank;
|
||||
|
||||
static void REGPARAM2 fmv_bput (uaecptr addr, uae_u32 w)
|
||||
{
|
||||
addr -= fmv_start & fmv_mask;
|
||||
|
||||
42
cfgfile.cpp
42
cfgfile.cpp
@ -330,7 +330,7 @@ static bool isdefault (const TCHAR *s)
|
||||
return false;
|
||||
}
|
||||
|
||||
static size_t cfg_write (void *b, struct zfile *z)
|
||||
static size_t cfg_write (const void *b, struct zfile *z)
|
||||
{
|
||||
size_t v;
|
||||
if (unicode_config) {
|
||||
@ -4601,17 +4601,6 @@ static int bip_cdtv (struct uae_prefs *p, int config, int compa, int romcheck)
|
||||
{
|
||||
int roms[4];
|
||||
|
||||
roms[0] = 6;
|
||||
roms[1] = 32;
|
||||
roms[2] = -1;
|
||||
if (!configure_rom (p, roms, romcheck))
|
||||
return 0;
|
||||
roms[0] = 20;
|
||||
roms[1] = 21;
|
||||
roms[2] = 22;
|
||||
roms[3] = -1;
|
||||
if (!configure_rom (p, roms, romcheck))
|
||||
return 0;
|
||||
p->bogomem_size = 0;
|
||||
p->chipmem_size = 0x100000;
|
||||
p->chipset_mask = CSMASK_ECS_AGNUS;
|
||||
@ -4629,6 +4618,17 @@ static int bip_cdtv (struct uae_prefs *p, int config, int compa, int romcheck)
|
||||
built_in_chipset_prefs (p);
|
||||
fetch_datapath (p->flashfile, sizeof (p->flashfile) / sizeof (TCHAR));
|
||||
_tcscat (p->flashfile, _T("cdtv.nvr"));
|
||||
roms[0] = 6;
|
||||
roms[1] = 32;
|
||||
roms[2] = -1;
|
||||
if (!configure_rom (p, roms, romcheck))
|
||||
return 0;
|
||||
roms[0] = 20;
|
||||
roms[1] = 21;
|
||||
roms[2] = 22;
|
||||
roms[3] = -1;
|
||||
if (!configure_rom (p, roms, romcheck))
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
@ -4637,6 +4637,15 @@ static int bip_cd32 (struct uae_prefs *p, int config, int compa, int romcheck)
|
||||
int roms[2];
|
||||
|
||||
buildin_default_prefs_68020 (p);
|
||||
p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = 1;
|
||||
p->nr_floppies = 0;
|
||||
p->floppyslots[0].dfxtype = DRV_NONE;
|
||||
p->floppyslots[1].dfxtype = DRV_NONE;
|
||||
set_68020_compa (p, compa, 1);
|
||||
p->cs_compatible = CP_CD32;
|
||||
built_in_chipset_prefs (p);
|
||||
fetch_datapath (p->flashfile, sizeof (p->flashfile) / sizeof (TCHAR));
|
||||
_tcscat (p->flashfile, _T("cd32.nvr"));
|
||||
roms[0] = 64;
|
||||
roms[1] = -1;
|
||||
if (!configure_rom (p, roms, 0)) {
|
||||
@ -4653,15 +4662,6 @@ static int bip_cd32 (struct uae_prefs *p, int config, int compa, int romcheck)
|
||||
if (!configure_rom (p, roms, romcheck))
|
||||
return 0;
|
||||
}
|
||||
p->cs_cd32c2p = p->cs_cd32cd = p->cs_cd32nvram = 1;
|
||||
p->nr_floppies = 0;
|
||||
p->floppyslots[0].dfxtype = DRV_NONE;
|
||||
p->floppyslots[1].dfxtype = DRV_NONE;
|
||||
set_68020_compa (p, compa, 1);
|
||||
p->cs_compatible = CP_CD32;
|
||||
built_in_chipset_prefs (p);
|
||||
fetch_datapath (p->flashfile, sizeof (p->flashfile) / sizeof (TCHAR));
|
||||
_tcscat (p->flashfile, _T("cd32.nvr"));
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@ -66,6 +66,7 @@ static void *console_thread (void *v)
|
||||
record_key_direct ((0x10 << 1) | 0);
|
||||
record_key_direct ((0x10 << 1) | 1);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int consolehook_activate (void)
|
||||
|
||||
@ -35,6 +35,9 @@
|
||||
#include "debug.h"
|
||||
#include "cpummu.h"
|
||||
|
||||
static void REGPARAM3 mmu_flush_atc(uaecptr addr, bool super, bool global) REGPARAM;
|
||||
static void REGPARAM3 mmu_flush_atc_all(bool global) REGPARAM;
|
||||
|
||||
#define DBG_MMU_VERBOSE 1
|
||||
#define DBG_MMU_SANITY 1
|
||||
|
||||
|
||||
26
custom.cpp
26
custom.cpp
@ -13,6 +13,7 @@
|
||||
|
||||
#include <ctype.h>
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "options.h"
|
||||
#include "uae.h"
|
||||
@ -2221,7 +2222,7 @@ STATIC_INLINE void record_sprite_1 (int sprxp, uae_u16 *buf, uae_u32 datab, int
|
||||
col = (datab & 3) << (2 * num);
|
||||
#if 0
|
||||
if (sprxp == sprite_minx || sprxp == sprite_maxx - 1)
|
||||
col ^= (rand () << 16) | rand ();
|
||||
col ^= (uaerand () << 16) | uaerand ();
|
||||
#endif
|
||||
if ((j & mask) == 0) {
|
||||
unsigned int tmp = (*buf) | col;
|
||||
@ -2727,7 +2728,7 @@ void compute_vsynctime (void)
|
||||
fake_vblank_hz = 0;
|
||||
vblank_hz_mult = 0;
|
||||
vblank_hz_state = 1;
|
||||
if (abs (currprefs.chipset_refreshrate) > 0.1) {
|
||||
if (fabs (currprefs.chipset_refreshrate) > 0.1) {
|
||||
vblank_hz = currprefs.chipset_refreshrate;
|
||||
if (isvsync_chipset ()) {
|
||||
int mult = 0;
|
||||
@ -2840,7 +2841,7 @@ void compute_framesync (void)
|
||||
if (!picasso_on) {
|
||||
if (isvsync_chipset ()) {
|
||||
if (cr->index == CHIPSET_REFRESH_PAL || cr->index == CHIPSET_REFRESH_NTSC) {
|
||||
if ((abs (vblank_hz - 50) < 1 || abs (vblank_hz - 60) < 1 || abs (vblank_hz - 100) < 1 || abs (vblank_hz - 120) < 1) && currprefs.gfx_apmode[0].gfx_vsync == 2 && currprefs.gfx_apmode[0].gfx_fullscreen > 0) {
|
||||
if ((fabs (vblank_hz - 50) < 1 || fabs (vblank_hz - 60) < 1 || fabs (vblank_hz - 100) < 1 || fabs (vblank_hz - 120) < 1) && currprefs.gfx_apmode[0].gfx_vsync == 2 && currprefs.gfx_apmode[0].gfx_fullscreen > 0) {
|
||||
vsync_switchmode (vblank_hz);
|
||||
}
|
||||
}
|
||||
@ -3080,11 +3081,13 @@ void init_hz (bool fullinit)
|
||||
maxvpos_total = (currprefs.chipset_mask & CSMASK_ECS_AGNUS) ? 2047 : 511;
|
||||
if (maxvpos_total > MAXVPOS)
|
||||
maxvpos_total = MAXVPOS;
|
||||
#ifdef PICASSO96
|
||||
if (!p96refresh_active) {
|
||||
maxvpos_stored = maxvpos;
|
||||
maxhpos_stored = maxhpos;
|
||||
vblank_hz_stored = vblank_hz;
|
||||
}
|
||||
#endif
|
||||
|
||||
compute_framesync ();
|
||||
|
||||
@ -5193,18 +5196,22 @@ static int rpt_vsync (void)
|
||||
|
||||
static void rtg_vsync (void)
|
||||
{
|
||||
#ifdef PICASSO96
|
||||
frame_time_t start, end;
|
||||
start = read_processor_time ();
|
||||
picasso_handle_vsync ();
|
||||
end = read_processor_time ();
|
||||
frameskiptime += end - start;
|
||||
#endif
|
||||
}
|
||||
|
||||
static void rtg_vsynccheck (void)
|
||||
{
|
||||
if (vblank_found_rtg) {
|
||||
vblank_found_rtg = false;
|
||||
#ifdef PICASSO96
|
||||
rtg_vsync ();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -5647,10 +5654,13 @@ static void vsync_handler_post (void)
|
||||
if (debug_dma)
|
||||
record_dma_reset ();
|
||||
|
||||
#ifdef PICASSO96
|
||||
if (p96refresh_active) {
|
||||
vpos_count = p96refresh_active;
|
||||
vtotal = vpos_count;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((beamcon0 & (0x20 | 0x80)) != (new_beamcon0 & (0x20 | 0x80)) || abs (vpos_count - vpos_count_diff) > 1 || lof_changed) {
|
||||
init_hz ();
|
||||
} else if (interlace_changed || changed_chipset_refresh ()) {
|
||||
@ -5672,7 +5682,7 @@ static void copper_check (int n)
|
||||
int vp = vpos & (((cop_state.saved_i2 >> 8) & 0x7F) | 0x80);
|
||||
if (vp < cop_state.vcmp) {
|
||||
if (copper_enabled_thisline)
|
||||
write_log (_T("COPPER BUG %d: vp=%d vpos=%d vcmp=%d act=%d thisline=%d\n"), n, vp, vpos, cop_state.vcmp, copper_enabled_thisline);
|
||||
write_log (_T("COPPER BUG %d: vp=%d vpos=%d vcmp=%d thisline=%d\n"), n, vp, vpos, cop_state.vcmp, copper_enabled_thisline);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -6198,7 +6208,9 @@ static void hsync_handler_post (bool onvsync)
|
||||
#endif
|
||||
|
||||
gayle_hsync ();
|
||||
#ifdef A2091
|
||||
scsi_hsync ();
|
||||
#endif
|
||||
|
||||
//copper_check (2);
|
||||
|
||||
@ -6514,7 +6526,9 @@ void custom_reset (int hardreset)
|
||||
if (hardreset)
|
||||
rtc_hardreset();
|
||||
|
||||
#ifdef PICASSO96
|
||||
picasso_reset ();
|
||||
#endif
|
||||
}
|
||||
|
||||
void dumpcustom (void)
|
||||
@ -7622,7 +7636,7 @@ uae_u8 *save_cycles (int *len, uae_u8 *dstptr)
|
||||
save_u32 (CYCLE_UNIT);
|
||||
save_u64 (get_cycles ());
|
||||
save_u32 (extra_cycle);
|
||||
write_log (_T("SAVECYCLES %08X\n"), get_cycles ());
|
||||
write_log (_T("SAVECYCLES %08lX\n"), get_cycles ());
|
||||
*len = dst - dstbak;
|
||||
return dstbak;
|
||||
}
|
||||
@ -7634,7 +7648,7 @@ uae_u8 *restore_cycles (uae_u8 *src)
|
||||
restore_u32 ();
|
||||
start_cycles = restore_u64 ();
|
||||
extra_cycle = restore_u32 ();
|
||||
write_log (_T("RESTORECYCLES %08X\n"), start_cycles);
|
||||
write_log (_T("RESTORECYCLES %08lX\n"), start_cycles);
|
||||
return src;
|
||||
}
|
||||
|
||||
|
||||
@ -397,7 +397,7 @@ static int checkvaltype (TCHAR **cp, uae_u32 *val, int *size, TCHAR def)
|
||||
return 0;
|
||||
*val = v;
|
||||
// stupid but works!
|
||||
_stprintf(p, L"%u", v);
|
||||
_stprintf(p, _T("%u"), v);
|
||||
p += _tcslen (p);
|
||||
if (peekchar (cp) == '.') {
|
||||
readchar (cp);
|
||||
@ -2510,7 +2510,7 @@ STATIC_INLINE uaecptr BPTR2APTR (uaecptr addr)
|
||||
}
|
||||
static TCHAR *BSTR2CSTR (uae_u8 *bstr)
|
||||
{
|
||||
WCHAR *s;
|
||||
TCHAR *s;
|
||||
char *cstr = xmalloc (char, bstr[0] + 1);
|
||||
if (cstr) {
|
||||
memcpy (cstr, bstr + 1, bstr[0]);
|
||||
|
||||
3
disk.cpp
3
disk.cpp
@ -4017,8 +4017,7 @@ int disk_prevnext (int drive, int dir)
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
int getdebug(void)
|
||||
{
|
||||
return floppy[0].mfmpos;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1318,7 +1318,9 @@ static void allocate_expamem (void)
|
||||
z3fastmem2_bank.baseaddr = z3fastmem2;
|
||||
z3chipmem_bank.baseaddr = z3chipmem;
|
||||
fastmem_bank.baseaddr = fastmemory;
|
||||
#ifdef PICASSO96
|
||||
gfxmem_bank.baseaddr = gfxmemory;
|
||||
#endif
|
||||
|
||||
#ifdef SAVESTATE
|
||||
if (savestate_state == STATE_RESTORE) {
|
||||
@ -1409,19 +1411,27 @@ uaecptr need_uae_boot_rom (void)
|
||||
|
||||
static void expamem_init_a2065 (void)
|
||||
{
|
||||
#ifdef A2065
|
||||
a2065_init ();
|
||||
#endif
|
||||
}
|
||||
static void expamem_init_cdtv (void)
|
||||
{
|
||||
#ifdef CDTV
|
||||
cdtv_init ();
|
||||
#endif
|
||||
}
|
||||
static void expamem_init_a2091 (void)
|
||||
{
|
||||
#ifdef A2091
|
||||
a2091_init ();
|
||||
#endif
|
||||
}
|
||||
static void expamem_init_a4091 (void)
|
||||
{
|
||||
#ifdef NCR
|
||||
ncr_init ();
|
||||
#endif
|
||||
}
|
||||
#if 0
|
||||
void p96memstart (void)
|
||||
|
||||
52
fdi2raw.cpp
52
fdi2raw.cpp
@ -1473,7 +1473,7 @@ static void fdi2_decode (FDI *fdi, unsigned long totalavg, uae_u32 *avgp, uae_u3
|
||||
if (i >= pulses)
|
||||
i = 0;
|
||||
indx = idx[i];
|
||||
if (uaerand() <= (indx * RAND_MAX) / maxidx) {
|
||||
if (uaerand() <= (indx * UAE_RAND_MAX) / maxidx) {
|
||||
pulse += avgp[i] - ref_pulse;
|
||||
if (indx >= maxidx)
|
||||
ref_pulse = 0;
|
||||
@ -1624,23 +1624,23 @@ static void fdi2_decode (FDI *fdi, unsigned long totalavg, uae_u32 *avgp, uae_u3
|
||||
if (min_pulse < ref_pulse)
|
||||
min_pulse = ref_pulse;
|
||||
randval = uaerand();
|
||||
if (randval < (RAND_MAX / 2)) {
|
||||
if (randval > (RAND_MAX / 4)) {
|
||||
if (randval <= (3 * RAND_MAX / 8))
|
||||
randval = (2 * randval) - (RAND_MAX /4);
|
||||
if (randval < (UAE_RAND_MAX / 2)) {
|
||||
if (randval > (UAE_RAND_MAX / 4)) {
|
||||
if (randval <= (3 * UAE_RAND_MAX / 8))
|
||||
randval = (2 * randval) - (UAE_RAND_MAX /4);
|
||||
else
|
||||
randval = (4 * randval) - RAND_MAX;
|
||||
randval = (4 * randval) - UAE_RAND_MAX;
|
||||
}
|
||||
jitter = 0 - (randval * (avg_pulse - min_pulse)) / RAND_MAX;
|
||||
jitter = 0 - (randval * (avg_pulse - min_pulse)) / UAE_RAND_MAX;
|
||||
} else {
|
||||
randval -= RAND_MAX / 2;
|
||||
if (randval > (RAND_MAX / 4)) {
|
||||
if (randval <= (3 * RAND_MAX / 8))
|
||||
randval = (2 * randval) - (RAND_MAX /4);
|
||||
randval -= UAE_RAND_MAX / 2;
|
||||
if (randval > (UAE_RAND_MAX / 4)) {
|
||||
if (randval <= (3 * UAE_RAND_MAX / 8))
|
||||
randval = (2 * randval) - (UAE_RAND_MAX /4);
|
||||
else
|
||||
randval = (4 * randval) - RAND_MAX;
|
||||
randval = (4 * randval) - UAE_RAND_MAX;
|
||||
}
|
||||
jitter = (randval * (max_pulse - avg_pulse)) / RAND_MAX;
|
||||
jitter = (randval * (max_pulse - avg_pulse)) / UAE_RAND_MAX;
|
||||
}
|
||||
avg_pulse += jitter;
|
||||
if ((avg_pulse < min_pulse) || (avg_pulse > max_pulse)) {
|
||||
@ -1654,28 +1654,28 @@ static void fdi2_decode (FDI *fdi, unsigned long totalavg, uae_u32 *avgp, uae_u3
|
||||
ref_pulse = 0;
|
||||
if (i == eodat)
|
||||
outstep++;
|
||||
} else if (uaerand() <= ((idx[i] * RAND_MAX) / maxidx)) {
|
||||
} else if (uaerand() <= ((idx[i] * UAE_RAND_MAX) / maxidx)) {
|
||||
avg_pulse = avgp[i];
|
||||
min_pulse = minp[i];
|
||||
max_pulse = maxp[i];
|
||||
randval = uaerand();
|
||||
if (randval < (RAND_MAX / 2)) {
|
||||
if (randval > (RAND_MAX / 4)) {
|
||||
if (randval <= (3 * RAND_MAX / 8))
|
||||
randval = (2 * randval) - (RAND_MAX /4);
|
||||
if (randval < (UAE_RAND_MAX / 2)) {
|
||||
if (randval > (UAE_RAND_MAX / 4)) {
|
||||
if (randval <= (3 * UAE_RAND_MAX / 8))
|
||||
randval = (2 * randval) - (UAE_RAND_MAX /4);
|
||||
else
|
||||
randval = (4 * randval) - RAND_MAX;
|
||||
randval = (4 * randval) - UAE_RAND_MAX;
|
||||
}
|
||||
avg_pulse -= (randval * (avg_pulse - min_pulse)) / RAND_MAX;
|
||||
avg_pulse -= (randval * (avg_pulse - min_pulse)) / UAE_RAND_MAX;
|
||||
} else {
|
||||
randval -= RAND_MAX / 2;
|
||||
if (randval > (RAND_MAX / 4)) {
|
||||
if (randval <= (3 * RAND_MAX / 8))
|
||||
randval = (2 * randval) - (RAND_MAX /4);
|
||||
randval -= UAE_RAND_MAX / 2;
|
||||
if (randval > (UAE_RAND_MAX / 4)) {
|
||||
if (randval <= (3 * UAE_RAND_MAX / 8))
|
||||
randval = (2 * randval) - (UAE_RAND_MAX /4);
|
||||
else
|
||||
randval = (4 * randval) - RAND_MAX;
|
||||
randval = (4 * randval) - UAE_RAND_MAX;
|
||||
}
|
||||
avg_pulse += (randval * (max_pulse - avg_pulse)) / RAND_MAX;
|
||||
avg_pulse += (randval * (max_pulse - avg_pulse)) / UAE_RAND_MAX;
|
||||
}
|
||||
if ((avg_pulse > ref_pulse) && (avg_pulse < (avgp[nexti] - jitter))) {
|
||||
pulse += avg_pulse - ref_pulse;
|
||||
|
||||
132
filesys.cpp
132
filesys.cpp
@ -73,6 +73,8 @@
|
||||
#define TRACE2(x)
|
||||
#endif
|
||||
|
||||
static void get_time (time_t t, long* days, long* mins, long* ticks);
|
||||
|
||||
static uae_sem_t test_sem;
|
||||
|
||||
int bootrom_header, bootrom_items;
|
||||
@ -649,7 +651,7 @@ int move_filesys_unitconfig (struct uae_prefs *p, int nr, int to)
|
||||
}
|
||||
|
||||
|
||||
static void filesys_addexternals (void);
|
||||
void filesys_addexternals (void);
|
||||
|
||||
static void initialize_mountinfo (void)
|
||||
{
|
||||
@ -676,18 +678,24 @@ static void initialize_mountinfo (void)
|
||||
uci->devname, uci->sectors, uci->surfaces, uci->reserved,
|
||||
uci->bootpri, uci->filesys);
|
||||
} else if (uci->controller <= HD_CONTROLLER_SCSI6) {
|
||||
#ifdef A2091
|
||||
if (currprefs.cs_mbdmac) {
|
||||
a3000_add_scsi_unit (uci->controller - HD_CONTROLLER_SCSI0, uci->rootdir, uci->blocksize, uci->readonly,
|
||||
uci->devname, uci->sectors, uci->surfaces, uci->reserved,
|
||||
uci->bootpri, uci->filesys);
|
||||
#endif
|
||||
} else if (currprefs.cs_a2091) {
|
||||
#ifdef A2091
|
||||
a2091_add_scsi_unit (uci->controller - HD_CONTROLLER_SCSI0, uci->rootdir, uci->blocksize, uci->readonly,
|
||||
uci->devname, uci->sectors, uci->surfaces, uci->reserved,
|
||||
uci->bootpri, uci->filesys);
|
||||
#endif
|
||||
} else if (currprefs.cs_cdtvscsi) {
|
||||
#ifdef CDTV
|
||||
cdtv_add_scsi_unit (uci->controller - HD_CONTROLLER_SCSI0, uci->rootdir, uci->blocksize, uci->readonly,
|
||||
uci->devname, uci->sectors, uci->surfaces, uci->reserved,
|
||||
uci->bootpri, uci->filesys);
|
||||
#endif
|
||||
}
|
||||
} else if (uci->controller == HD_CONTROLLER_PCMCIA_SRAM) {
|
||||
gayle_add_pcmcia_sram_unit (uci->rootdir, uci->readonly);
|
||||
@ -732,7 +740,7 @@ int sprintf_filesys_unit (TCHAR *buffer, int num)
|
||||
uip[num].rootdir, uip[num].readonly ? "ro" : "");
|
||||
else
|
||||
_stprintf (buffer, _T("(DH%d:) Hardfile, \"%s\", size %d Mbytes"), num,
|
||||
uip[num].rootdir, uip[num].hf.virtsize / (1024 * 1024));
|
||||
uip[num].rootdir, (int)(uip[num].hf.virtsize / (1024 * 1024)));
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -777,7 +785,7 @@ struct hardfiledata *get_hardfile_data (int nr)
|
||||
#define dp64_Arg5 56
|
||||
|
||||
/* result codes */
|
||||
#define DOS_TRUE ((unsigned long)-1L)
|
||||
#define DOS_TRUE ((uae_u32)-1L)
|
||||
#define DOS_FALSE (0L)
|
||||
|
||||
#define MAXFILESIZE32 (0x7fffffff)
|
||||
@ -1647,7 +1655,7 @@ static void dispose_aino (Unit *unit, a_inode **aip, a_inode *aino)
|
||||
static void free_all_ainos (Unit *u, a_inode *parent)
|
||||
{
|
||||
a_inode *a;
|
||||
while (a = parent->child) {
|
||||
while ((a = parent->child)) {
|
||||
free_all_ainos (u, a);
|
||||
dispose_aino (u, &parent->child, a);
|
||||
}
|
||||
@ -2277,12 +2285,14 @@ static Notify *new_notify (Unit *unit, TCHAR *name)
|
||||
return n;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void free_notify_item (Notify *n)
|
||||
{
|
||||
xfree (n->fullname);
|
||||
xfree (n->partname);
|
||||
xfree (n);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void free_notify (Unit *unit, int hash, Notify *n)
|
||||
{
|
||||
@ -2304,7 +2314,7 @@ static void startup_update_unit (Unit *unit, UnitInfo *uinfo)
|
||||
if (!unit)
|
||||
return;
|
||||
xfree (unit->ui.volname);
|
||||
memcpy (&unit->ui, uinfo, sizeof UnitInfo);
|
||||
memcpy (&unit->ui, uinfo, sizeof (UnitInfo));
|
||||
unit->ui.devname = uinfo->devname;
|
||||
unit->ui.volname = my_strdup (uinfo->volname); /* might free later for rename */
|
||||
}
|
||||
@ -2677,6 +2687,7 @@ static Key *new_key (Unit *unit)
|
||||
return k;
|
||||
}
|
||||
|
||||
#if TRACING_ENABLED
|
||||
static void
|
||||
dumplock (Unit *unit, uaecptr lock)
|
||||
{
|
||||
@ -2698,6 +2709,7 @@ static void
|
||||
}
|
||||
TRACE((_T(" }\n")));
|
||||
}
|
||||
#endif
|
||||
|
||||
static a_inode *find_aino (Unit *unit, uaecptr lock, const TCHAR *name, int *err)
|
||||
{
|
||||
@ -3656,7 +3668,7 @@ static int action_examine_all (Unit *unit, dpacket packet)
|
||||
uaecptr control = GET_PCK_ARG5 (packet);
|
||||
|
||||
ExAllKey *eak = NULL;
|
||||
a_inode *base;
|
||||
a_inode *base = NULL;
|
||||
struct fs_dirhandle *d;
|
||||
int ok, i;
|
||||
uaecptr exp;
|
||||
@ -4076,6 +4088,7 @@ static void do_find (Unit *unit, dpacket packet, int mode, int create, int fallb
|
||||
aino->shlock++;
|
||||
}
|
||||
de_recycle_aino (unit, aino);
|
||||
|
||||
PUT_PCK_RES1 (packet, DOS_TRUE);
|
||||
}
|
||||
|
||||
@ -5139,7 +5152,7 @@ static void action_change_file_position64 (Unit *unit, dpacket packet)
|
||||
if (mode < 0)
|
||||
whence = SEEK_SET;
|
||||
|
||||
TRACE((_T("ACTION_CHANGE_FILE_POSITION64(%s,%I64d,%d)\n"), k->aino->nname, pos, mode));
|
||||
TRACE((_T("ACTION_CHANGE_FILE_POSITION64(%s,%lld,%d)\n"), k->aino->nname, pos, mode));
|
||||
gui_flicker_led (LED_HD, unit->unit, 1);
|
||||
|
||||
cur = fs_lseek64 (k->fd, 0, SEEK_CUR);
|
||||
@ -5203,7 +5216,7 @@ static void action_change_file_size64 (Unit *unit, dpacket packet)
|
||||
if (mode < 0)
|
||||
whence = SEEK_SET;
|
||||
|
||||
TRACE((_T("ACTION_CHANGE_FILE_SIZE64(0x%lx, %I64d, 0x%x)\n"), GET_PCK64_ARG1 (packet), offset, mode));
|
||||
TRACE((_T("ACTION_CHANGE_FILE_SIZE64(0x%lx, %lld, 0x%x)\n"), GET_PCK64_ARG1 (packet), offset, mode));
|
||||
|
||||
k = lookup_key (unit, GET_PCK64_ARG1 (packet));
|
||||
if (k == 0) {
|
||||
@ -5503,49 +5516,58 @@ static int handle_packet (Unit *unit, dpacket pck, uae_u32 msg)
|
||||
}
|
||||
|
||||
#ifdef UAE_FILESYS_THREADS
|
||||
|
||||
static int filesys_iteration(UnitInfo *ui)
|
||||
{
|
||||
dpacket pck;
|
||||
uaecptr msg;
|
||||
uae_u32 morelocks;
|
||||
|
||||
pck = read_comm_pipe_u32_blocking (ui->unit_pipe);
|
||||
msg = read_comm_pipe_u32_blocking (ui->unit_pipe);
|
||||
morelocks = (uae_u32)read_comm_pipe_int_blocking (ui->unit_pipe);
|
||||
|
||||
if (ui->reset_state == FS_GO_DOWN) {
|
||||
if (pck != 0)
|
||||
return 1;
|
||||
/* Death message received. */
|
||||
uae_sem_post (&ui->reset_sync_sem);
|
||||
/* Die. */
|
||||
return 0;
|
||||
}
|
||||
|
||||
put_long (get_long (morelocks), get_long (ui->self->locklist));
|
||||
put_long (ui->self->locklist, morelocks);
|
||||
int ret = handle_packet (ui->self, pck, msg);
|
||||
if (!ret) {
|
||||
PUT_PCK_RES1 (pck, DOS_FALSE);
|
||||
PUT_PCK_RES2 (pck, ERROR_ACTION_NOT_KNOWN);
|
||||
}
|
||||
if (ret >= 0) {
|
||||
/* Mark the packet as processed for the list scan in the assembly code. */
|
||||
put_long (msg + 4, 0xffffffff);
|
||||
}
|
||||
/* Acquire the message lock, so that we know we can safely send the message. */
|
||||
ui->self->cmds_sent++;
|
||||
/* The message is sent by our interrupt handler, so make sure an interrupt happens. */
|
||||
do_uae_int_requested ();
|
||||
/* Send back the locks. */
|
||||
if (get_long (ui->self->locklist) != 0)
|
||||
write_comm_pipe_int (ui->back_pipe, (int)(get_long (ui->self->locklist)), 0);
|
||||
put_long (ui->self->locklist, 0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static void *filesys_thread (void *unit_v)
|
||||
{
|
||||
UnitInfo *ui = (UnitInfo *)unit_v;
|
||||
|
||||
uae_set_thread_priority (NULL, 1);
|
||||
for (;;) {
|
||||
dpacket pck;
|
||||
uaecptr msg;
|
||||
uae_u32 morelocks;
|
||||
|
||||
pck = read_comm_pipe_u32_blocking (ui->unit_pipe);
|
||||
msg = read_comm_pipe_u32_blocking (ui->unit_pipe);
|
||||
morelocks = (uae_u32)read_comm_pipe_int_blocking (ui->unit_pipe);
|
||||
|
||||
if (ui->reset_state == FS_GO_DOWN) {
|
||||
if (pck != 0)
|
||||
continue;
|
||||
/* Death message received. */
|
||||
uae_sem_post (&ui->reset_sync_sem);
|
||||
/* Die. */
|
||||
if (!filesys_iteration (ui)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
put_long (get_long (morelocks), get_long (ui->self->locklist));
|
||||
put_long (ui->self->locklist, morelocks);
|
||||
int ret = handle_packet (ui->self, pck, msg);
|
||||
if (!ret) {
|
||||
PUT_PCK_RES1 (pck, DOS_FALSE);
|
||||
PUT_PCK_RES2 (pck, ERROR_ACTION_NOT_KNOWN);
|
||||
}
|
||||
if (ret >= 0) {
|
||||
/* Mark the packet as processed for the list scan in the assembly code. */
|
||||
put_long (msg + 4, 0xffffffff);
|
||||
}
|
||||
/* Acquire the message lock, so that we know we can safely send the message. */
|
||||
ui->self->cmds_sent++;
|
||||
/* The message is sent by our interrupt handler, so make sure an interrupt happens. */
|
||||
do_uae_int_requested ();
|
||||
/* Send back the locks. */
|
||||
if (get_long (ui->self->locklist) != 0)
|
||||
write_comm_pipe_int (ui->back_pipe, (int)(get_long (ui->self->locklist)), 0);
|
||||
put_long (ui->self->locklist, 0);
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@ -5863,7 +5885,9 @@ static uae_u32 REGPARAM2 filesys_init_storeinfo (TrapContext *context)
|
||||
{
|
||||
case 1:
|
||||
mountertask = m68k_areg (regs, 1);
|
||||
#ifdef PICASSO96
|
||||
picasso96_alloc (context);
|
||||
#endif
|
||||
break;
|
||||
case 2:
|
||||
ret = automountunit;
|
||||
@ -6040,7 +6064,7 @@ static void dump_partinfo (struct hardfiledata *hfd, uae_u8 *pp)
|
||||
xfree (s);
|
||||
|
||||
if ((uae_u64)highcyl * spt * surfaces * blocksize > hfd->virtsize) {
|
||||
write_log (_T("RDB: WARNING: end of partition > size of disk! (%I64u > %I64u)\n"),
|
||||
write_log (_T("RDB: WARNING: end of partition > size of disk! (%llu > %llu)\n"),
|
||||
(uae_u64)highcyl * spt * surfaces * blocksize, hfd->virtsize);
|
||||
}
|
||||
|
||||
@ -6100,7 +6124,7 @@ static void dump_rdb (UnitInfo *uip, struct hardfiledata *hfd, uae_u8 *bufrdb, u
|
||||
}
|
||||
}
|
||||
|
||||
#define rdbmnt write_log (_T("Mounting uaehf.device %d (%d) (size=%I64u):\n"), unit_no, partnum, hfd->virtsize);
|
||||
#define rdbmnt write_log (_T("Mounting uaehf.device %d (%d) (size=%llu):\n"), unit_no, partnum, hfd->virtsize);
|
||||
|
||||
static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacket)
|
||||
{
|
||||
@ -6131,7 +6155,7 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke
|
||||
}
|
||||
if (lastblock * hfd->blocksize > hfd->virtsize) {
|
||||
rdbmnt
|
||||
write_log (_T("failed, too small (%d*%d > %I64u)\n"), lastblock, hfd->blocksize, hfd->virtsize);
|
||||
write_log (_T("failed, too small (%d*%d > %llu)\n"), lastblock, hfd->blocksize, hfd->virtsize);
|
||||
return -2;
|
||||
}
|
||||
for (rdblock = 0; rdblock < lastblock; rdblock++) {
|
||||
@ -6179,7 +6203,7 @@ static int rdb_mount (UnitInfo *uip, int unit_no, int partnum, uaecptr parmpacke
|
||||
|
||||
if (showdebug) {
|
||||
if ((uae_u64)hfd->cylinders * hfd->sectors * hfd->heads * blocksize > hfd->virtsize)
|
||||
write_log (_T("RDB: WARNING: RDSK header disk size > disk size! (%I64u > %I64u)\n"),
|
||||
write_log (_T("RDB: WARNING: RDSK header disk size > disk size! (%llu > %llu)\n"),
|
||||
(uae_u64)hfd->cylinders * hfd->sectors * hfd->heads * blocksize, hfd->virtsize);
|
||||
write_log (_T("RDSK dump start\n"));
|
||||
write_log (_T("RDSK at %d, C=%d S=%d H=%d\n"),
|
||||
@ -6722,11 +6746,13 @@ void filesys_install_code (void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#if USE_CDFS
|
||||
#if USE_CDFS == 1
|
||||
#include "cdrom-handler.cpp"
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "od-win32/win32_filesys.cpp"
|
||||
#endif
|
||||
|
||||
static uae_u8 *restore_filesys_hardfile (UnitInfo *ui, uae_u8 *src)
|
||||
{
|
||||
@ -7008,7 +7034,7 @@ static uae_u8 *restore_key (UnitInfo *ui, Unit *u, uae_u8 *src)
|
||||
write_log (_T("*** FS: Open file '%s', couldn't create dummy file!\n"), p);
|
||||
}
|
||||
} else {
|
||||
write_log (L"*** FS: Too big, ignored\n");
|
||||
write_log (_T("*** FS: Too big, ignored\n"));
|
||||
}
|
||||
} else {
|
||||
k->fd = fs_openfile (u, a, openmode | O_BINARY);
|
||||
@ -7020,9 +7046,9 @@ static uae_u8 *restore_key (UnitInfo *ui, Unit *u, uae_u8 *src)
|
||||
uae_s64 s;
|
||||
s = fs_fsize64 (k->fd);
|
||||
if (s != savedsize)
|
||||
write_log (_T("FS: restored file '%s' size changed! orig=%I64d, now=%I64d!!\n"), p, savedsize, s);
|
||||
write_log (_T("FS: restored file '%s' size changed! orig=%lld, now=%lld!!\n"), p, savedsize, s);
|
||||
if (k->file_pos > s) {
|
||||
write_log (_T("FS: restored filepos larger than size of file '%s'!! %I64d > %d\n"), p, k->file_pos, s);
|
||||
write_log (_T("FS: restored filepos larger than size of file '%s'!! %lld > %d\n"), p, k->file_pos, s);
|
||||
k->file_pos = s;
|
||||
}
|
||||
fs_lseek64 (k->fd, k->file_pos, SEEK_SET);
|
||||
@ -7144,7 +7170,7 @@ static int recurse_aino (UnitInfo *ui, a_inode *a, int cnt, uae_u8 **dstp)
|
||||
if (a->elock || a->shlock || a->uniq == 0) {
|
||||
if (dst) {
|
||||
TCHAR *fn = NULL;
|
||||
write_log (_T("uniq=%d %I64d s=%d e=%d d=%d '%s' '%s'\n"), a->uniq, a->uniq_external, a->shlock, a->elock, a->dir, a->aname, a->nname);
|
||||
write_log (_T("uniq=%d %lld s=%d e=%d d=%d '%s' '%s'\n"), a->uniq, a->uniq_external, a->shlock, a->elock, a->dir, a->aname, a->nname);
|
||||
if (a->aname) {
|
||||
fn = getfullaname (a);
|
||||
write_log (_T("->'%s'\n"), fn);
|
||||
@ -7187,7 +7213,7 @@ static uae_u8 *save_key (uae_u8 *dst, Key *k)
|
||||
save_string (fn);
|
||||
save_u64 (k->file_pos);
|
||||
save_u64 (size);
|
||||
write_log (_T("'%s' uniq=%d size=%I64d seekpos=%I64d mode=%d dosmode=%d\n"),
|
||||
write_log (_T("'%s' uniq=%d size=%lld seekpos=%lld mode=%d dosmode=%d\n"),
|
||||
fn, k->uniq, size, k->file_pos, k->createmode, k->dosmode);
|
||||
xfree (fn);
|
||||
return dst;
|
||||
|
||||
2
fpp.cpp
2
fpp.cpp
@ -274,7 +274,9 @@ STATIC_INLINE tointtype toint (fptype src, fptype minval, fptype maxval)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef HAVE_ISINF
|
||||
extern int isinf (double x);
|
||||
#endif
|
||||
|
||||
uae_u32 get_fpsr (void)
|
||||
{
|
||||
|
||||
2
fsdb.cpp
2
fsdb.cpp
@ -54,7 +54,7 @@ TCHAR *fsdb_search_dir (const TCHAR *dirname, TCHAR *rel)
|
||||
{
|
||||
TCHAR *p = 0;
|
||||
int de;
|
||||
void *dir;
|
||||
my_opendir_s *dir;
|
||||
TCHAR fn[MAX_DPATH];
|
||||
|
||||
dir = my_opendir (dirname);
|
||||
|
||||
@ -99,7 +99,7 @@ char *fsdb_create_unique_nname (a_inode *base, const char *suggestion)
|
||||
/* tmpnam isn't reentrant and I don't really want to hack configure
|
||||
* right now to see whether tmpnam_r is available... */
|
||||
for (i = 0; i < 8; i++) {
|
||||
tmp[i] = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"[random () % 63];
|
||||
tmp[i] = "_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"[uaerand () % 63];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
16
fsusage.cpp
16
fsusage.cpp
@ -46,7 +46,7 @@ static long adjust_blocks (long blocks, int fromsize, int tosize)
|
||||
return (blocks + (blocks < 0 ? -1 : 1)) / (tosize / fromsize);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef WINDOWS
|
||||
#include "od-win32/posixemu.h"
|
||||
#include <windows.h>
|
||||
int get_fs_usage (const TCHAR *path, const TCHAR *disk, struct fs_usage *fsp)
|
||||
@ -136,11 +136,7 @@ int statvfs ();
|
||||
Return the actual number of bytes read, zero for EOF, or negative
|
||||
for an error. */
|
||||
|
||||
int
|
||||
safe_read (desc, ptr, len)
|
||||
int desc;
|
||||
TCHAR *ptr;
|
||||
int len;
|
||||
int safe_read (int desc, TCHAR *ptr, int len)
|
||||
{
|
||||
int n_chars;
|
||||
|
||||
@ -167,11 +163,8 @@ methods that need to know it.
|
||||
Return 0 if successful, -1 if not. When returning -1, ensure that
|
||||
ERRNO is either a system error value, or zero if DISK is NULL
|
||||
on a system that requires a non-NULL value. */
|
||||
int
|
||||
get_fs_usage (path, disk, fsp)
|
||||
const TCHAR *path;
|
||||
const TCHAR *disk;
|
||||
struct fs_usage *fsp;
|
||||
#ifndef WINDOWS
|
||||
int get_fs_usage (const TCHAR *path, const TCHAR *disk, struct fs_usage *fsp)
|
||||
{
|
||||
#ifdef STAT_STATFS3_OSF1
|
||||
# define CONVERT_BLOCKS(B) adjust_blocks ((B), fsd.f_fsize, 512)
|
||||
@ -317,6 +310,7 @@ struct fs_usage *fsp;
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_AIX) && defined(_I386)
|
||||
/* AIX PS/2 does not supply statfs. */
|
||||
|
||||
@ -39,7 +39,7 @@ double getvsyncrate (double hz, int *mult)
|
||||
unsigned int doMask (int p, int bits, int shift)
|
||||
{
|
||||
/* scale to 0..255, shift to align msb with mask, and apply mask */
|
||||
unsigned long val;
|
||||
uae_u32 val;
|
||||
|
||||
if (flashscreen)
|
||||
p ^= 0xff;
|
||||
@ -211,6 +211,7 @@ static uae_u32 lowbits (int v, int shift, int lsize)
|
||||
|
||||
void alloc_colors_picasso (int rw, int gw, int bw, int rs, int gs, int bs, int rgbfmt)
|
||||
{
|
||||
#ifdef PICASSO96
|
||||
int byte_swap = 0;
|
||||
int i;
|
||||
int red_bits = 0, green_bits, blue_bits;
|
||||
@ -294,6 +295,7 @@ void alloc_colors_picasso (int rw, int gw, int bw, int rs, int gs, int bs, int r
|
||||
p96_rgbx16[i] = c;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void alloc_colors_rgb (int rw, int gw, int bw, int rs, int gs, int bs, int aw, int as, int alpha, int byte_swap,
|
||||
@ -376,6 +378,7 @@ void alloc_colors64k (int rw, int gw, int bw, int rs, int gs, int bs, int aw, in
|
||||
grec[2 * 256 + i] = xgreencolors[255];
|
||||
bluc[2 * 256 + i] = xbluecolors[255];
|
||||
}
|
||||
#ifdef GFXFILTER
|
||||
if (usedfilter && usedfilter->yuv) {
|
||||
/* create internal 5:6:5 color tables */
|
||||
for (i = 0; i < 256; i++) {
|
||||
@ -427,6 +430,7 @@ void alloc_colors64k (int rw, int gw, int bw, int rs, int gs, int bs, int aw, in
|
||||
tcrrgb[i] = ((uae_s8)get_cr (r, g, b)) * 256;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
xredcolor_b = rw;
|
||||
|
||||
@ -42,7 +42,6 @@ extern int action_replay_load (void);
|
||||
extern void action_replay_memory_reset (void);
|
||||
extern void action_replay_init (int);
|
||||
extern void action_replay_cleanup (void);
|
||||
extern void action_replay_map_banks (void);
|
||||
extern void REGPARAM3 chipmem_lput_actionreplay23 (uaecptr addr, uae_u32 l) REGPARAM;
|
||||
extern void REGPARAM3 chipmem_wput_actionreplay23 (uaecptr addr, uae_u32 w) REGPARAM;
|
||||
extern void REGPARAM3 chipmem_bput_actionreplay1 (uaecptr addr, uae_u32 b) REGPARAM;
|
||||
|
||||
@ -152,8 +152,6 @@ struct device_functions {
|
||||
|
||||
};
|
||||
|
||||
extern struct device_functions *device_func[MAX_TOTAL_SCSI_DEVICES];
|
||||
|
||||
extern int device_func_init(int flags);
|
||||
extern void device_func_reset(void);
|
||||
extern int sys_command_open (int unitnum);
|
||||
|
||||
@ -66,6 +66,7 @@ struct socketbase {
|
||||
uae_u32 logfacility;
|
||||
uaecptr fdcallback;
|
||||
|
||||
unsigned int *mtable; /* window messages allocated for asynchronous event notification */
|
||||
/* host-specific fields below */
|
||||
#ifdef _WIN32
|
||||
SOCKET_TYPE sockAbort; /* for aborting WinSock2 select() (damn Microsoft) */
|
||||
@ -73,7 +74,6 @@ struct socketbase {
|
||||
int needAbort; /* abort flag */
|
||||
void *hAsyncTask; /* async task handle */
|
||||
void *hEvent; /* thread event handle */
|
||||
unsigned int *mtable; /* window messages allocated for asynchronous event notification */
|
||||
#else
|
||||
uae_sem_t sem; /* semaphore to notify the socket thread of work */
|
||||
uae_thread_id thread; /* socket thread */
|
||||
|
||||
@ -228,8 +228,6 @@ extern mmu_atc_l1_array *current_atc;
|
||||
|
||||
#define ATC_L2_INDEX(addr) ((((addr) >> 12) ^ ((addr) >> (32 - ATC_L2_SIZE_LOG))) % ATC_L2_SIZE)
|
||||
|
||||
extern struct mmu_atc_line atc_l2[2][ATC_L2_SIZE];
|
||||
|
||||
/*
|
||||
* lookup address in the level 1 atc cache,
|
||||
* the data and write arguments are constant in the common,
|
||||
@ -288,9 +286,6 @@ extern void REGPARAM3 dfc_put_long(uaecptr addr, uae_u32 val) REGPARAM;
|
||||
extern void REGPARAM3 dfc_put_word(uaecptr addr, uae_u16 val) REGPARAM;
|
||||
extern void REGPARAM3 dfc_put_byte(uaecptr addr, uae_u8 val) REGPARAM;
|
||||
|
||||
|
||||
extern void REGPARAM3 mmu_flush_atc(uaecptr addr, bool super, bool global) REGPARAM;
|
||||
extern void REGPARAM3 mmu_flush_atc_all(bool global) REGPARAM;
|
||||
extern void REGPARAM3 mmu_op_real(uae_u32 opcode, uae_u16 extra) REGPARAM;
|
||||
|
||||
extern void REGPARAM3 mmu_reset(void) REGPARAM;
|
||||
|
||||
@ -139,7 +139,6 @@ extern frame_time_t syncbase;
|
||||
#define CYCLE_CPUNASTY 0x80
|
||||
|
||||
extern unsigned long frametime, timeframes;
|
||||
extern int plfstrt, plfstop, plffirstline, plflastline;
|
||||
extern uae_u16 htotal, vtotal, beamcon0;
|
||||
|
||||
/* 100 words give you 1600 horizontal pixels. Should be more than enough for
|
||||
|
||||
@ -42,7 +42,7 @@ before it appears on-screen. (TW: display emulation now does this automatically)
|
||||
|
||||
#define max_diwlastword (PIXEL_XPOS(0x1d4 >> 1))
|
||||
|
||||
extern int lores_factor, lores_shift, sprite_width, interlace_seen;
|
||||
extern int lores_factor, lores_shift, interlace_seen;
|
||||
extern bool aga_mode, direct_rgb;
|
||||
|
||||
STATIC_INLINE int coord_hw_to_window_x (int x)
|
||||
@ -202,13 +202,6 @@ extern uae_u16 spixels[MAX_SPR_PIXELS * 2];
|
||||
/* Way too much... */
|
||||
#define MAX_REG_CHANGE ((MAXVPOS + 1) * 2 * MAXHPOS)
|
||||
|
||||
#ifdef OS_WITHOUT_MEMORY_MANAGEMENT
|
||||
extern struct color_change *color_changes[2];
|
||||
#else
|
||||
extern struct color_change color_changes[2][MAX_REG_CHANGE];
|
||||
#endif
|
||||
|
||||
extern struct color_entry color_tables[2][(MAXVPOS + 2) * 2];
|
||||
extern struct color_entry *curr_color_tables, *prev_color_tables;
|
||||
|
||||
extern struct sprite_entry *curr_sprite_entries, *prev_sprite_entries;
|
||||
@ -243,8 +236,6 @@ struct draw_info {
|
||||
int nr_color_changes, nr_sprites;
|
||||
};
|
||||
|
||||
extern int next_sprite_entry;
|
||||
|
||||
extern struct decision line_decisions[2 * (MAXVPOS + 2) + 1];
|
||||
|
||||
extern uae_u8 line_data[(MAXVPOS + 2) * 2][MAX_PLANES * MAX_WORDS_PER_LINE * 2];
|
||||
@ -288,7 +279,6 @@ extern void putpixel (uae_u8 *buf, int bpp, int x, xcolnr c8, int opaq);
|
||||
/* Finally, stuff that shouldn't really be shared. */
|
||||
|
||||
extern int thisframe_first_drawn_line, thisframe_last_drawn_line;
|
||||
extern int diwfirstword, diwlastword;
|
||||
|
||||
#define IHF_SCROLLLOCK 0
|
||||
#define IHF_QUIT_PROGRAM 1
|
||||
|
||||
@ -299,31 +299,18 @@ STATIC_INLINE int valid_address (uaecptr addr, uae_u32 size)
|
||||
extern int addr_valid (const TCHAR*, uaecptr,uae_u32);
|
||||
|
||||
/* For faster access in custom chip emulation. */
|
||||
extern uae_u32 REGPARAM3 chipmem_lget (uaecptr) REGPARAM;
|
||||
extern uae_u32 REGPARAM3 chipmem_wget (uaecptr) REGPARAM;
|
||||
extern uae_u32 REGPARAM3 chipmem_bget (uaecptr) REGPARAM;
|
||||
extern void REGPARAM3 chipmem_lput (uaecptr, uae_u32) REGPARAM;
|
||||
extern void REGPARAM3 chipmem_wput (uaecptr, uae_u32) REGPARAM;
|
||||
extern void REGPARAM3 chipmem_bput (uaecptr, uae_u32) REGPARAM;
|
||||
|
||||
extern uae_u32 REGPARAM3 chipmem_agnus_lget (uaecptr) REGPARAM;
|
||||
extern uae_u32 REGPARAM3 chipmem_agnus_wget (uaecptr) REGPARAM;
|
||||
extern uae_u32 REGPARAM3 chipmem_agnus_bget (uaecptr) REGPARAM;
|
||||
extern void REGPARAM3 chipmem_agnus_lput (uaecptr, uae_u32) REGPARAM;
|
||||
extern void REGPARAM3 chipmem_agnus_wput (uaecptr, uae_u32) REGPARAM;
|
||||
extern void REGPARAM3 chipmem_agnus_bput (uaecptr, uae_u32) REGPARAM;
|
||||
|
||||
extern uae_u32 chipmem_mask, kickmem_mask;
|
||||
extern uae_u8 *kickmemory;
|
||||
extern int kickmem_size;
|
||||
extern addrbank dummy_bank;
|
||||
|
||||
/* 68020+ Chip RAM DMA contention emulation */
|
||||
extern uae_u32 REGPARAM3 chipmem_lget_ce2 (uaecptr) REGPARAM;
|
||||
extern uae_u32 REGPARAM3 chipmem_wget_ce2 (uaecptr) REGPARAM;
|
||||
extern uae_u32 REGPARAM3 chipmem_bget_ce2 (uaecptr) REGPARAM;
|
||||
extern void REGPARAM3 chipmem_lput_ce2 (uaecptr, uae_u32) REGPARAM;
|
||||
extern void REGPARAM3 chipmem_wput_ce2 (uaecptr, uae_u32) REGPARAM;
|
||||
extern void REGPARAM3 chipmem_bput_c2 (uaecptr, uae_u32) REGPARAM;
|
||||
|
||||
extern uae_u32 (REGPARAM3 *chipmem_lget_indirect)(uaecptr) REGPARAM;
|
||||
@ -363,4 +350,4 @@ extern void memcpyah_safe (uae_u8 *dst, uaecptr src, int size);
|
||||
extern void memcpyah (uae_u8 *dst, uaecptr src, int size);
|
||||
|
||||
extern uae_s32 getz2size (struct uae_prefs *p);
|
||||
extern ULONG getz2endaddr (void);
|
||||
extern ULONG getz2endaddr (void);
|
||||
|
||||
@ -18,7 +18,7 @@ extern long int version;
|
||||
#define MAX_PATHS 8
|
||||
|
||||
struct multipath {
|
||||
TCHAR path[MAX_PATHS][256];
|
||||
TCHAR path[MAX_PATHS][PATH_MAX];
|
||||
};
|
||||
|
||||
struct strlist {
|
||||
|
||||
@ -153,7 +153,7 @@ extern void restore_cd_finish (void);
|
||||
extern uae_u8 *save_configuration (int *len);
|
||||
extern uae_u8 *restore_configuration (uae_u8 *src);
|
||||
extern uae_u8 *save_log (int, int *len);
|
||||
extern uae_u8 *restore_log (uae_u8 *src);
|
||||
//extern uae_u8 *restore_log (uae_u8 *src);
|
||||
|
||||
extern uae_u8 *restore_input (uae_u8 *src);
|
||||
extern uae_u8 *save_input (int *len, uae_u8 *dstptr);
|
||||
|
||||
@ -150,7 +150,7 @@ struct utimbuf
|
||||
#define memcpy q_memcpy
|
||||
#define memset q_memset
|
||||
#define strdup my_strdup
|
||||
#define random rand
|
||||
#define random uaerand
|
||||
#define creat(x,y) open("T:creat",O_CREAT|O_RDWR|O_TRUNC,777)
|
||||
extern void* q_memset(void*,int,size_t);
|
||||
extern void* q_memcpy(void*,const void*,size_t);
|
||||
@ -578,4 +578,4 @@ extern void xfree (const void*);
|
||||
|
||||
#endif
|
||||
|
||||
#define DBLEQU(f, i) (abs ((f) - (i)) < 0.000001)
|
||||
#define DBLEQU(f, i) (abs ((f) - (i)) < 0.000001)
|
||||
|
||||
@ -12,7 +12,6 @@ extern void start_program (void);
|
||||
extern void leave_program (void);
|
||||
extern void real_main (int, TCHAR **);
|
||||
extern void usage (void);
|
||||
extern void parse_cmdline (int argc, TCHAR **argv);
|
||||
extern void sleep_millis (int ms);
|
||||
extern void sleep_millis_main (int ms);
|
||||
extern void sleep_millis_busy (int ms);
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
|
||||
typedef uae_s64 (*ZFILEREAD)(void*, uae_u64, uae_u64, struct zfile*);
|
||||
typedef uae_s64 (*ZFILEWRITE)(void*, uae_u64, uae_u64, struct zfile*);
|
||||
typedef uae_s64 (*ZFILEWRITE)(const void*, uae_u64, uae_u64, struct zfile*);
|
||||
typedef uae_s64 (*ZFILESEEK)(struct zfile*, uae_s64, int);
|
||||
|
||||
struct zfile {
|
||||
@ -112,11 +112,9 @@ extern struct znode *zvolume_adddir_abs (struct zvolume *zv, struct zarchive_inf
|
||||
extern struct znode *znode_adddir (struct znode *parent, const TCHAR *name, struct zarchive_info*);
|
||||
|
||||
extern struct zvolume *archive_directory_plain (struct zfile *zf);
|
||||
extern struct zfile *archive_access_plain (struct znode *zn);
|
||||
extern struct zvolume *archive_directory_lha(struct zfile *zf);
|
||||
extern struct zfile *archive_access_lha (struct znode *zn);
|
||||
extern struct zvolume *archive_directory_zip(struct zfile *zf);
|
||||
extern struct zfile *archive_access_zip (struct znode *zn, int flags);
|
||||
extern struct zvolume *archive_directory_7z (struct zfile *z);
|
||||
extern struct zfile *archive_access_7z (struct znode *zn);
|
||||
extern struct zvolume *archive_directory_rar (struct zfile *z);
|
||||
@ -126,12 +124,8 @@ extern struct zfile *archive_access_lzx (struct znode *zn);
|
||||
extern struct zvolume *archive_directory_arcacc (struct zfile *z, unsigned int id);
|
||||
extern struct zfile *archive_access_arcacc (struct znode *zn);
|
||||
extern struct zvolume *archive_directory_adf (struct znode *zn, struct zfile *z);
|
||||
extern struct zfile *archive_access_adf (struct znode *zn);
|
||||
extern struct zvolume *archive_directory_rdb (struct zfile *z);
|
||||
extern struct zfile *archive_access_rdb (struct znode *zn);
|
||||
extern struct zvolume *archive_directory_fat (struct zfile *z);
|
||||
extern struct zfile *archive_access_fat (struct znode *zn);
|
||||
extern struct zfile *archive_access_dir (struct znode *zn);
|
||||
extern struct zvolume *archive_directory_tar (struct zfile *zf);
|
||||
extern struct zfile *archive_access_tar (struct znode *zn);
|
||||
|
||||
@ -146,4 +140,4 @@ extern void archive_access_close (void *handle, unsigned int id);
|
||||
extern struct zfile *archive_getzfile (struct znode *zn, unsigned int id, int flags);
|
||||
extern struct zfile *archive_unpackzfile (struct zfile *zf);
|
||||
|
||||
extern struct zfile *decompress_zfd (struct zfile*);
|
||||
extern struct zfile *decompress_zfd (struct zfile*);
|
||||
|
||||
@ -50,7 +50,7 @@ extern uae_s64 zfile_fseek (struct zfile *z, uae_s64 offset, int mode);
|
||||
extern uae_s64 zfile_ftell (struct zfile *z);
|
||||
extern uae_s64 zfile_size (struct zfile *z);
|
||||
extern size_t zfile_fread (void *b, size_t l1, size_t l2, struct zfile *z);
|
||||
extern size_t zfile_fwrite (void *b, size_t l1, size_t l2, struct zfile *z);
|
||||
extern size_t zfile_fwrite (const void *b, size_t l1, size_t l2, struct zfile *z);
|
||||
extern TCHAR *zfile_fgets (TCHAR *s, int size, struct zfile *z);
|
||||
extern char *zfile_fgetsa (char *s, int size, struct zfile *z);
|
||||
extern size_t zfile_fputs (struct zfile *z, TCHAR *s);
|
||||
@ -129,4 +129,4 @@ extern unsigned int zfile_read_archive (struct zfile *d, void *b, unsigned int s
|
||||
extern void zfile_close_archive (struct zfile *d);
|
||||
extern struct zfile *zfile_open_archive (const TCHAR *path, int flags);
|
||||
extern int zfile_exists_archive (const TCHAR *path, const TCHAR *rel);
|
||||
extern bool zfile_needwrite (struct zfile*);
|
||||
extern bool zfile_needwrite (struct zfile*);
|
||||
|
||||
@ -85,7 +85,7 @@ int inputdevice_logging = 0;
|
||||
|
||||
#define JOYMOUSE_CDTV 8
|
||||
|
||||
#define DEFEVENT(A, B, C, D, E, F) {L#A, B, C, D, E, F },
|
||||
#define DEFEVENT(A, B, C, D, E, F) {_T(#A), B, C, D, E, F },
|
||||
static struct inputevent events[] = {
|
||||
{0, 0, AM_K,0,0,0},
|
||||
#include "inputevents.def"
|
||||
@ -2416,6 +2416,7 @@ void inputdevice_add_inputcode (int code, int state)
|
||||
|
||||
void inputdevice_do_keyboard (int code, int state)
|
||||
{
|
||||
#ifdef CDTV
|
||||
if (code >= 0x72 && code <= 0x77) { // CDTV keys
|
||||
if (cdtv_front_panel (-1)) {
|
||||
// front panel active
|
||||
@ -2425,6 +2426,7 @@ void inputdevice_do_keyboard (int code, int state)
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (code < 0x80) {
|
||||
uae_u8 key = code | (state ? 0x00 : 0x80);
|
||||
keybuf[key & 0x7f] = (key & 0x80) ? 0 : 1;
|
||||
|
||||
@ -2137,7 +2137,7 @@ static struct inode *isofs_find_entry(struct inode *dir, char *tmpname, TCHAR *t
|
||||
dpnt = de->name;
|
||||
/* Basic sanity check, whether name doesn't exceed dir entry */
|
||||
if (de_len < dlen + sizeof(struct iso_directory_record)) {
|
||||
write_log (_T("iso9660: Corrupted directory entry in block %lu of inode %lu\n"), block, dir->i_ino);
|
||||
write_log (_T("iso9660: Corrupted directory entry in block %lu of inode %u\n"), block, dir->i_ino);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
10
main.cpp
10
main.cpp
@ -106,7 +106,7 @@ void my_trim (TCHAR *s)
|
||||
{
|
||||
int len;
|
||||
while (_tcscspn (s, _T("\t \r\n")) == 0)
|
||||
memmove (s, s + 1, (_tcslen (s + 1) + 1) * sizeof TCHAR);
|
||||
memmove (s, s + 1, (_tcslen (s + 1) + 1) * sizeof (TCHAR));
|
||||
len = _tcslen (s);
|
||||
while (len > 0 && _tcscspn (s + len - 1, _T("\t \r\n")) == 0)
|
||||
s[--len] = '\0';
|
||||
@ -123,7 +123,7 @@ TCHAR *my_strdup_trim (const TCHAR *s)
|
||||
while (len > 0 && _tcscspn (s + len - 1, _T("\t \r\n")) == 0)
|
||||
len--;
|
||||
out = xmalloc (TCHAR, len + 1);
|
||||
memcpy (out, s, len * sizeof TCHAR);
|
||||
memcpy (out, s, len * sizeof (TCHAR));
|
||||
out[len] = 0;
|
||||
return out;
|
||||
}
|
||||
@ -477,8 +477,10 @@ void fixup_prefs (struct uae_prefs *p)
|
||||
#endif
|
||||
#if !defined (SCSIEMU)
|
||||
p->scsi = 0;
|
||||
#ifdef _WIN32
|
||||
p->win32_aspi = 0;
|
||||
#endif
|
||||
#endif
|
||||
#if !defined (SANA2)
|
||||
p->sana2 = 0;
|
||||
#endif
|
||||
@ -701,7 +703,7 @@ static void parse_cmdline_and_init_file (int argc, TCHAR **argv)
|
||||
#ifdef OPTIONS_IN_HOME
|
||||
/* sam: if not found in $HOME then look in current directory */
|
||||
_tcscpy (optionsfile, restart_config);
|
||||
target_cfgfile_load (&currprefs, optionsfile, 0);
|
||||
target_cfgfile_load (&currprefs, optionsfile, 0, default_config);
|
||||
#endif
|
||||
}
|
||||
fixup_prefs (&currprefs);
|
||||
@ -762,12 +764,14 @@ void reset_all_systems (void)
|
||||
* Add #ifdefs around these as appropriate.
|
||||
*/
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifndef JIT
|
||||
extern int DummyException (LPEXCEPTION_POINTERS blah, int n_except)
|
||||
{
|
||||
return EXCEPTION_CONTINUE_SEARCH;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
void do_start_program (void)
|
||||
{
|
||||
|
||||
40
memory.cpp
40
memory.cpp
@ -170,13 +170,13 @@ static void dummylog (int rw, uaecptr addr, int size, uae_u32 val, int ins)
|
||||
if (MAX_ILG >= 0)
|
||||
illegal_count++;
|
||||
if (ins) {
|
||||
write_log (_T("WARNING: Illegal opcode %cget at %08lx PC=%x\n"),
|
||||
write_log (_T("WARNING: Illegal opcode %cget at %08x PC=%x\n"),
|
||||
size == 2 ? 'w' : 'l', addr, M68K_GETPC);
|
||||
} else if (rw) {
|
||||
write_log (_T("Illegal %cput at %08lx=%08lx PC=%x\n"),
|
||||
write_log (_T("Illegal %cput at %08x=%08x PC=%x\n"),
|
||||
size == 1 ? 'b' : size == 2 ? 'w' : 'l', addr, val, M68K_GETPC);
|
||||
} else {
|
||||
write_log (_T("Illegal %cget at %08lx PC=%x\n"),
|
||||
write_log (_T("Illegal %cget at %08x PC=%x\n"),
|
||||
size == 1 ? 'b' : size == 2 ? 'w' : 'l', addr, M68K_GETPC);
|
||||
}
|
||||
}
|
||||
@ -442,7 +442,7 @@ void REGPARAM2 chipmem_bput (uaecptr addr, uae_u32 b)
|
||||
static uae_u32 chipmem_dummy (void)
|
||||
{
|
||||
/* not really right but something random that has more ones than zeros.. */
|
||||
return 0xffff & ~((1 << (rand () & 31)) | (1 << (rand () & 31)));
|
||||
return 0xffff & ~((1 << (uaerand () & 31)) | (1 << (uaerand () & 31)));
|
||||
}
|
||||
void REGPARAM2 chipmem_dummy_bput (uaecptr addr, uae_u32 b)
|
||||
{
|
||||
@ -971,7 +971,7 @@ static void REGPARAM2 kickmem_lput (uaecptr addr, uae_u32 b)
|
||||
} else
|
||||
a1000_handle_kickstart (0);
|
||||
} else if (currprefs.illegal_mem)
|
||||
write_log (_T("Illegal kickmem lput at %08lx\n"), addr);
|
||||
write_log (_T("Illegal kickmem lput at %08x\n"), addr);
|
||||
}
|
||||
|
||||
static void REGPARAM2 kickmem_wput (uaecptr addr, uae_u32 b)
|
||||
@ -989,7 +989,7 @@ static void REGPARAM2 kickmem_wput (uaecptr addr, uae_u32 b)
|
||||
} else
|
||||
a1000_handle_kickstart (0);
|
||||
} else if (currprefs.illegal_mem)
|
||||
write_log (_T("Illegal kickmem wput at %08lx\n"), addr);
|
||||
write_log (_T("Illegal kickmem wput at %08x\n"), addr);
|
||||
}
|
||||
|
||||
static void REGPARAM2 kickmem_bput (uaecptr addr, uae_u32 b)
|
||||
@ -1005,7 +1005,7 @@ static void REGPARAM2 kickmem_bput (uaecptr addr, uae_u32 b)
|
||||
} else
|
||||
a1000_handle_kickstart (0);
|
||||
} else if (currprefs.illegal_mem)
|
||||
write_log (_T("Illegal kickmem bput at %08lx\n"), addr);
|
||||
write_log (_T("Illegal kickmem bput at %08x\n"), addr);
|
||||
}
|
||||
|
||||
static void REGPARAM2 kickmem2_lput (uaecptr addr, uae_u32 l)
|
||||
@ -1099,7 +1099,7 @@ static void REGPARAM2 extendedkickmem_lput (uaecptr addr, uae_u32 b)
|
||||
special_mem |= S_WRITE;
|
||||
#endif
|
||||
if (currprefs.illegal_mem)
|
||||
write_log (_T("Illegal extendedkickmem lput at %08lx\n"), addr);
|
||||
write_log (_T("Illegal extendedkickmem lput at %08x\n"), addr);
|
||||
}
|
||||
static void REGPARAM2 extendedkickmem_wput (uaecptr addr, uae_u32 b)
|
||||
{
|
||||
@ -1107,7 +1107,7 @@ static void REGPARAM2 extendedkickmem_wput (uaecptr addr, uae_u32 b)
|
||||
special_mem |= S_WRITE;
|
||||
#endif
|
||||
if (currprefs.illegal_mem)
|
||||
write_log (_T("Illegal extendedkickmem wput at %08lx\n"), addr);
|
||||
write_log (_T("Illegal extendedkickmem wput at %08x\n"), addr);
|
||||
}
|
||||
static void REGPARAM2 extendedkickmem_bput (uaecptr addr, uae_u32 b)
|
||||
{
|
||||
@ -1115,7 +1115,7 @@ static void REGPARAM2 extendedkickmem_bput (uaecptr addr, uae_u32 b)
|
||||
special_mem |= S_WRITE;
|
||||
#endif
|
||||
if (currprefs.illegal_mem)
|
||||
write_log (_T("Illegal extendedkickmem lput at %08lx\n"), addr);
|
||||
write_log (_T("Illegal extendedkickmem lput at %08x\n"), addr);
|
||||
}
|
||||
static int REGPARAM2 extendedkickmem_check (uaecptr addr, uae_u32 size)
|
||||
{
|
||||
@ -1166,7 +1166,7 @@ static void REGPARAM2 extendedkickmem2_lput (uaecptr addr, uae_u32 b)
|
||||
special_mem |= S_WRITE;
|
||||
#endif
|
||||
if (currprefs.illegal_mem)
|
||||
write_log (_T("Illegal extendedkickmem2 lput at %08lx\n"), addr);
|
||||
write_log (_T("Illegal extendedkickmem2 lput at %08x\n"), addr);
|
||||
}
|
||||
static void REGPARAM2 extendedkickmem2_wput (uaecptr addr, uae_u32 b)
|
||||
{
|
||||
@ -1174,7 +1174,7 @@ static void REGPARAM2 extendedkickmem2_wput (uaecptr addr, uae_u32 b)
|
||||
special_mem |= S_WRITE;
|
||||
#endif
|
||||
if (currprefs.illegal_mem)
|
||||
write_log (_T("Illegal extendedkickmem2 wput at %08lx\n"), addr);
|
||||
write_log (_T("Illegal extendedkickmem2 wput at %08x\n"), addr);
|
||||
}
|
||||
static void REGPARAM2 extendedkickmem2_bput (uaecptr addr, uae_u32 b)
|
||||
{
|
||||
@ -1182,7 +1182,7 @@ static void REGPARAM2 extendedkickmem2_bput (uaecptr addr, uae_u32 b)
|
||||
special_mem |= S_WRITE;
|
||||
#endif
|
||||
if (currprefs.illegal_mem)
|
||||
write_log (_T("Illegal extendedkickmem2 lput at %08lx\n"), addr);
|
||||
write_log (_T("Illegal extendedkickmem2 lput at %08x\n"), addr);
|
||||
}
|
||||
static int REGPARAM2 extendedkickmem2_check (uaecptr addr, uae_u32 size)
|
||||
{
|
||||
@ -1894,7 +1894,7 @@ err:
|
||||
|
||||
#ifndef NATMEM_OFFSET
|
||||
|
||||
uae_u8 *mapped_malloc (size_t s, TCHAR *file)
|
||||
uae_u8 *mapped_malloc (size_t s, const TCHAR *file)
|
||||
{
|
||||
return xmalloc (uae_u8, s);
|
||||
}
|
||||
@ -2189,6 +2189,7 @@ static void allocate_memory (void)
|
||||
}
|
||||
need_hardreset = 1;
|
||||
}
|
||||
#ifdef CDTV
|
||||
if (allocated_cardmem != currprefs.cs_cdtvcard * 1024) {
|
||||
if (cardmemory)
|
||||
mapped_free (cardmemory);
|
||||
@ -2205,6 +2206,7 @@ static void allocate_memory (void)
|
||||
}
|
||||
cdtv_loadcardmem(cardmemory, allocated_cardmem);
|
||||
}
|
||||
#endif
|
||||
if (allocated_custmem1 != currprefs.custom_memory_sizes[0]) {
|
||||
if (custmem1)
|
||||
mapped_free (custmem1);
|
||||
@ -2523,21 +2525,29 @@ void memory_reset (void)
|
||||
map_banks (&clock_bank, 0xDC, 1, 0); /* none clock */
|
||||
if (currprefs.cs_fatgaryrev >= 0 || currprefs.cs_ramseyrev >= 0)
|
||||
map_banks (&mbres_bank, 0xDE, 1, 0);
|
||||
#ifdef CD32
|
||||
if (currprefs.cs_cd32c2p || currprefs.cs_cd32cd || currprefs.cs_cd32nvram) {
|
||||
map_banks (&akiko_bank, AKIKO_BASE >> 16, 1, 0);
|
||||
map_banks (&gayle2_bank, 0xDD, 2, 0);
|
||||
}
|
||||
#endif
|
||||
#ifdef CDTV
|
||||
if (currprefs.cs_cdtvcd)
|
||||
cdtv_check_banks ();
|
||||
#endif
|
||||
#ifdef A2091
|
||||
if (currprefs.cs_mbdmac == 1)
|
||||
a3000scsi_reset ();
|
||||
#endif
|
||||
|
||||
if (a3000lmemory != 0)
|
||||
map_banks (&a3000lmem_bank, a3000lmem_start >> 16, allocated_a3000lmem >> 16, 0);
|
||||
if (a3000hmemory != 0)
|
||||
map_banks (&a3000hmem_bank, a3000hmem_start >> 16, allocated_a3000hmem >> 16, 0);
|
||||
#ifdef CDTV
|
||||
if (cardmemory != 0)
|
||||
map_banks (&cardmem_bank, cardmem_start >> 16, allocated_cardmem >> 16, 0);
|
||||
#endif
|
||||
|
||||
map_banks (&kickmem_bank, 0xF8, 8, 0);
|
||||
if (currprefs.maprom)
|
||||
@ -2689,10 +2699,12 @@ void memory_cleanup (void)
|
||||
xfree (a1000_bootrom);
|
||||
if (chipmemory)
|
||||
mapped_free (chipmemory);
|
||||
#ifdef CDTV
|
||||
if (cardmemory) {
|
||||
cdtv_savecardmem (cardmemory, allocated_cardmem);
|
||||
mapped_free (cardmemory);
|
||||
}
|
||||
#endif
|
||||
if (custmem1)
|
||||
mapped_free (custmem1);
|
||||
if (custmem2)
|
||||
|
||||
@ -420,7 +420,7 @@ static void REGPARAM2 ncr_bput (uaecptr addr, uae_u32 b)
|
||||
ncr_bput2 (addr, b);
|
||||
}
|
||||
|
||||
static addrbank ncr_bank = {
|
||||
addrbank ncr_bank = {
|
||||
ncr_lget, ncr_wget, ncr_bget,
|
||||
ncr_lput, ncr_wput, ncr_bput,
|
||||
default_xlate, default_check, NULL, _T("A4091"),
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
//#define X86_MSVC_ASSEMBLY_MEMACCESS
|
||||
#define OPTIMIZED_FLAGS
|
||||
#define __i386__
|
||||
#define WINDOWS
|
||||
|
||||
#ifndef UAE_MINI
|
||||
|
||||
@ -89,6 +90,20 @@
|
||||
|
||||
#endif
|
||||
|
||||
#define A_ZIP
|
||||
#define A_RAR
|
||||
#define A_7Z
|
||||
#define A_LHA
|
||||
#define A_LZX
|
||||
#define A_DMS
|
||||
#define A_WRP
|
||||
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 256
|
||||
#endif
|
||||
|
||||
#define UAE_RAND_MAX RAND_MAX
|
||||
|
||||
#ifndef GFXFILTER
|
||||
#undef OPENGL
|
||||
#undef D3D
|
||||
@ -270,7 +285,7 @@
|
||||
#define SIZEOF_DOUBLE 8
|
||||
|
||||
#define HAVE_ISNAN
|
||||
#define HAVE_ISINF
|
||||
#undef HAVE_ISINF
|
||||
#define isnan _isnan
|
||||
|
||||
/* Define if you have the bcopy function. */
|
||||
|
||||
@ -131,7 +131,7 @@ static int hfdcheck (TCHAR drive)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void filesys_addexternals (void)
|
||||
void filesys_addexternals (void)
|
||||
{
|
||||
int drive, drivetype;
|
||||
UINT errormode;
|
||||
|
||||
@ -728,9 +728,15 @@ void savestate_restore_finish (void)
|
||||
restore_disk_finish ();
|
||||
restore_blitter_finish ();
|
||||
restore_akiko_finish ();
|
||||
#ifdef CDTV
|
||||
restore_cdtv_finish ();
|
||||
#endif
|
||||
#ifdef PICASSO96
|
||||
restore_p96_finish ();
|
||||
#endif
|
||||
#ifdef A2065
|
||||
restore_a2065_finish ();
|
||||
#endif
|
||||
restore_cia_finish ();
|
||||
restore_debug_memwatch_finish ();
|
||||
savestate_state = 0;
|
||||
|
||||
@ -390,7 +390,7 @@ static int release_async_request (struct devstruct *dev, uaecptr request)
|
||||
int i = 0;
|
||||
|
||||
if (log_scsi)
|
||||
write_log (_T("async request %p removed\n"), request);
|
||||
write_log (_T("async request %08x removed\n"), request);
|
||||
while (i < MAX_ASYNC_REQUESTS) {
|
||||
if (dev->d_request[i] == request) {
|
||||
int type = dev->d_request_type[i];
|
||||
@ -859,7 +859,7 @@ static int dev_do_io (struct devstruct *dev, uaecptr request)
|
||||
uae_u32 sdd = get_long (request + 40);
|
||||
io_error = sys_command_scsi_direct (dev->unitnum, sdd);
|
||||
if (log_scsi)
|
||||
write_log (_T("scsidev: did io: sdd %p request %p error %d\n"), sdd, request, get_byte (request + 31));
|
||||
write_log (_T("scsidev: did io: sdd %08x request %08x error %d\n"), sdd, request, get_byte (request + 31));
|
||||
}
|
||||
break;
|
||||
case NSCMD_DEVICEQUERY:
|
||||
@ -1048,7 +1048,7 @@ static void dev_reset (void)
|
||||
if (dev->opencnt > 0) {
|
||||
for (j = 0; j < MAX_ASYNC_REQUESTS; j++) {
|
||||
uaecptr request;
|
||||
if (request = dev->d_request[i])
|
||||
if ((request = dev->d_request[i]))
|
||||
abort_async (dev, request, 0, 0);
|
||||
}
|
||||
dev->opencnt = 1;
|
||||
|
||||
415
serial.cpp
415
serial.cpp
@ -57,9 +57,6 @@ void serial_dtr_off (void);
|
||||
void serial_flush_buffer (void);
|
||||
static int serial_read (char *buffer);
|
||||
|
||||
int serial_readstatus (void);
|
||||
uae_u16 serial_writestatus (int, int);
|
||||
|
||||
uae_u16 SERDATR (void);
|
||||
|
||||
int SERDATS (void);
|
||||
@ -70,344 +67,344 @@ static char inbuf[1024], outbuf[1024];
|
||||
static int inptr, inlast, outlast;
|
||||
|
||||
int waitqueue=0,
|
||||
carrier=0,
|
||||
serdev=0,
|
||||
dsr=0,
|
||||
dtr=0,
|
||||
isbaeh=0,
|
||||
doreadser=0,
|
||||
serstat=-1;
|
||||
carrier=0,
|
||||
serdev=0,
|
||||
dsr=0,
|
||||
dtr=0,
|
||||
isbaeh=0,
|
||||
doreadser=0,
|
||||
serstat=-1;
|
||||
|
||||
int sd = -1;
|
||||
|
||||
#ifdef POSIX_SERIAL
|
||||
struct termios tios;
|
||||
struct termios tios;
|
||||
#endif
|
||||
|
||||
uae_u16 serper=0,serdat;
|
||||
|
||||
void SERPER (uae_u16 w)
|
||||
{
|
||||
int baud=0, pspeed;
|
||||
int baud=0, pspeed;
|
||||
|
||||
if (!currprefs.use_serial)
|
||||
return;
|
||||
if (!currprefs.use_serial)
|
||||
return;
|
||||
|
||||
#if defined POSIX_SERIAL
|
||||
if (serper == w) /* don't set baudrate if it's already ok */
|
||||
return;
|
||||
serper=w;
|
||||
if (serper == w) /* don't set baudrate if it's already ok */
|
||||
return;
|
||||
serper=w;
|
||||
|
||||
if (w&0x8000)
|
||||
if (w&0x8000)
|
||||
write_log ("SERPER: 9bit transmission not implemented.\n");
|
||||
|
||||
switch (w & 0x7fff) {
|
||||
/* These values should be calculated by the current
|
||||
* color clock value (NTSC/PAL). But this solution is
|
||||
* easy and it works.
|
||||
*/
|
||||
switch (w & 0x7fff) {
|
||||
/* These values should be calculated by the current
|
||||
* color clock value (NTSC/PAL). But this solution is
|
||||
* easy and it works.
|
||||
*/
|
||||
|
||||
case 0x2e9b:
|
||||
case 0x2e14: baud=300; pspeed=B300; break;
|
||||
case 0x170a:
|
||||
case 0x0b85: baud=1200; pspeed=B1200; break;
|
||||
case 0x05c2:
|
||||
case 0x05b9: baud=2400; pspeed=B2400; break;
|
||||
case 0x02e9:
|
||||
case 0x02e1: baud=4800; pspeed=B4800; break;
|
||||
case 0x0174:
|
||||
case 0x0170: baud=9600; pspeed=B9600; break;
|
||||
case 0x00b9:
|
||||
case 0x00b8: baud=19200; pspeed=B19200; break;
|
||||
case 0x005c:
|
||||
case 0x005d: baud=38400; pspeed=B38400; break;
|
||||
case 0x003d: baud=57600; pspeed=B57600; break;
|
||||
case 0x001e: baud=115200; pspeed=B115200; break;
|
||||
case 0x000f: baud=230400; pspeed=B230400; break;
|
||||
default:
|
||||
write_log ("SERPER: unsupported baudrate (0x%04x) %d\n",w&0x7fff,
|
||||
(unsigned int)(3579546.471/(double)((w&0x7fff)+1))); return;
|
||||
}
|
||||
|
||||
/* Only access hardware when we own it */
|
||||
if (serdev == 1) {
|
||||
if (tcgetattr (sd, &tios) < 0) {
|
||||
write_log ("SERPER: TCGETATTR failed\n");
|
||||
return;
|
||||
case 0x2e9b:
|
||||
case 0x2e14: baud=300; pspeed=B300; break;
|
||||
case 0x170a:
|
||||
case 0x0b85: baud=1200; pspeed=B1200; break;
|
||||
case 0x05c2:
|
||||
case 0x05b9: baud=2400; pspeed=B2400; break;
|
||||
case 0x02e9:
|
||||
case 0x02e1: baud=4800; pspeed=B4800; break;
|
||||
case 0x0174:
|
||||
case 0x0170: baud=9600; pspeed=B9600; break;
|
||||
case 0x00b9:
|
||||
case 0x00b8: baud=19200; pspeed=B19200; break;
|
||||
case 0x005c:
|
||||
case 0x005d: baud=38400; pspeed=B38400; break;
|
||||
case 0x003d: baud=57600; pspeed=B57600; break;
|
||||
case 0x001e: baud=115200; pspeed=B115200; break;
|
||||
case 0x000f: baud=230400; pspeed=B230400; break;
|
||||
default:
|
||||
write_log ("SERPER: unsupported baudrate (0x%04x) %d\n",w&0x7fff,
|
||||
(unsigned int)(3579546.471/(double)((w&0x7fff)+1))); return;
|
||||
}
|
||||
|
||||
if (cfsetispeed (&tios, pspeed) < 0) { /* set serial input speed */
|
||||
write_log ("SERPER: CFSETISPEED (%d bps) failed\n", baud);
|
||||
return;
|
||||
}
|
||||
if (cfsetospeed (&tios, pspeed) < 0) { /* set serial output speed */
|
||||
write_log ("SERPER: CFSETOSPEED (%d bps) failed\n", baud);
|
||||
return;
|
||||
}
|
||||
/* Only access hardware when we own it */
|
||||
if (serdev == 1) {
|
||||
if (tcgetattr (sd, &tios) < 0) {
|
||||
write_log ("SERPER: TCGETATTR failed\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (tcsetattr (sd, TCSADRAIN, &tios) < 0) {
|
||||
write_log ("SERPER: TCSETATTR failed\n");
|
||||
return;
|
||||
if (cfsetispeed (&tios, pspeed) < 0) { /* set serial input speed */
|
||||
write_log ("SERPER: CFSETISPEED (%d bps) failed\n", baud);
|
||||
return;
|
||||
}
|
||||
if (cfsetospeed (&tios, pspeed) < 0) { /* set serial output speed */
|
||||
write_log ("SERPER: CFSETOSPEED (%d bps) failed\n", baud);
|
||||
return;
|
||||
}
|
||||
|
||||
if (tcsetattr (sd, TCSADRAIN, &tios) < 0) {
|
||||
write_log ("SERPER: TCSETATTR failed\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#if SERIALDEBUG > 0
|
||||
if (serdev == 1)
|
||||
write_log ("SERPER: baudrate set to %d bit/sec\n", baud);
|
||||
if (serdev == 1)
|
||||
write_log ("SERPER: baudrate set to %d bit/sec\n", baud);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Not (fully) implemented yet:
|
||||
*
|
||||
* - Something's wrong with the Interrupts.
|
||||
* (NComm works, TERM does not. TERM switches to a
|
||||
* blind mode after a connect and wait's for the end
|
||||
* of an asynchronous read before switching blind
|
||||
* mode off again. It never gets there on UAE :-< )
|
||||
* (NComm works, TERM does not. TERM switches to a
|
||||
* blind mode after a connect and wait's for the end
|
||||
* of an asynchronous read before switching blind
|
||||
* mode off again. It never gets there on UAE :-< )
|
||||
*
|
||||
* - RTS/CTS handshake, this is not really neccessary,
|
||||
* because you can use RTS/CTS "outside" without
|
||||
* passing it through to the emulated Amiga
|
||||
* because you can use RTS/CTS "outside" without
|
||||
* passing it through to the emulated Amiga
|
||||
*
|
||||
* - ADCON-Register ($9e write, $10 read) Bit 11 (UARTBRK)
|
||||
* (see "Amiga Intern", pg 246)
|
||||
* (see "Amiga Intern", pg 246)
|
||||
*/
|
||||
|
||||
void SERDAT (uae_u16 w)
|
||||
{
|
||||
unsigned char z;
|
||||
unsigned char z;
|
||||
|
||||
if (!currprefs.use_serial)
|
||||
return;
|
||||
if (!currprefs.use_serial)
|
||||
return;
|
||||
|
||||
z = (unsigned char)(w&0xff);
|
||||
z = (unsigned char)(w&0xff);
|
||||
|
||||
if (currprefs.serial_demand && !dtr) {
|
||||
if (!isbaeh) {
|
||||
write_log ("SERDAT: Baeh.. Your software needs SERIAL_ALWAYS to work properly.\n");
|
||||
isbaeh=1;
|
||||
if (currprefs.serial_demand && !dtr) {
|
||||
if (!isbaeh) {
|
||||
write_log ("SERDAT: Baeh.. Your software needs SERIAL_ALWAYS to work properly.\n");
|
||||
isbaeh=1;
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
outbuf[outlast++] = z;
|
||||
if (outlast == sizeof outbuf)
|
||||
serial_flush_buffer();
|
||||
}
|
||||
return;
|
||||
} else {
|
||||
outbuf[outlast++] = z;
|
||||
if (outlast == sizeof outbuf)
|
||||
serial_flush_buffer();
|
||||
}
|
||||
|
||||
#if SERIALDEBUG > 2
|
||||
write_log ("SERDAT: wrote 0x%04x\n", w);
|
||||
write_log ("SERDAT: wrote 0x%04x\n", w);
|
||||
#endif
|
||||
|
||||
serdat|=0x2000; /* Set TBE in the SERDATR ... */
|
||||
intreq|=1; /* ... and in INTREQ register */
|
||||
return;
|
||||
serdat|=0x2000; /* Set TBE in the SERDATR ... */
|
||||
intreq|=1; /* ... and in INTREQ register */
|
||||
return;
|
||||
}
|
||||
|
||||
uae_u16 SERDATR (void)
|
||||
{
|
||||
if (!currprefs.use_serial)
|
||||
return 0;
|
||||
if (!currprefs.use_serial)
|
||||
return 0;
|
||||
#if SERIALDEBUG > 2
|
||||
write_log ("SERDATR: read 0x%04x\n", serdat);
|
||||
write_log ("SERDATR: read 0x%04x\n", serdat);
|
||||
#endif
|
||||
waitqueue = 0;
|
||||
return serdat;
|
||||
waitqueue = 0;
|
||||
return serdat;
|
||||
}
|
||||
|
||||
int SERDATS (void)
|
||||
{
|
||||
unsigned char z;
|
||||
unsigned char z;
|
||||
|
||||
if (!serdev) /* || (serdat&0x4000)) */
|
||||
return 0;
|
||||
if (!serdev) /* || (serdat&0x4000)) */
|
||||
return 0;
|
||||
|
||||
if (waitqueue == 1) {
|
||||
intreq |= 0x0800;
|
||||
return 1;
|
||||
}
|
||||
if (waitqueue == 1) {
|
||||
intreq |= 0x0800;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((serial_read ((char *)&z)) == 1) {
|
||||
waitqueue = 1;
|
||||
serdat = 0x4100; /* RBF and STP set! */
|
||||
serdat |= ((unsigned int)z) & 0xff;
|
||||
intreq |= 0x0800; /* Set RBF flag (Receive Buffer full) */
|
||||
if ((serial_read ((char *)&z)) == 1) {
|
||||
waitqueue = 1;
|
||||
serdat = 0x4100; /* RBF and STP set! */
|
||||
serdat |= ((unsigned int)z) & 0xff;
|
||||
intreq |= 0x0800; /* Set RBF flag (Receive Buffer full) */
|
||||
|
||||
#if SERIALDEBUG > 1
|
||||
write_log ("SERDATS: received 0x%02x --> serdat==0x%04x\n",
|
||||
(unsigned int)z, (unsigned int)serdat);
|
||||
write_log ("SERDATS: received 0x%02x --> serdat==0x%04x\n",
|
||||
(unsigned int)z, (unsigned int)serdat);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void serial_dtr_on(void)
|
||||
{
|
||||
#if SERIALDEBUG > 0
|
||||
write_log ("DTR on.\n");
|
||||
write_log ("DTR on.\n");
|
||||
#endif
|
||||
dtr=1;
|
||||
dtr=1;
|
||||
|
||||
if (currprefs.serial_demand)
|
||||
serial_open ();
|
||||
if (currprefs.serial_demand)
|
||||
serial_open ();
|
||||
}
|
||||
|
||||
void serial_dtr_off(void)
|
||||
{
|
||||
#if SERIALDEBUG > 0
|
||||
write_log ("DTR off.\n");
|
||||
write_log ("DTR off.\n");
|
||||
#endif
|
||||
dtr=0;
|
||||
if (currprefs.serial_demand)
|
||||
serial_close ();
|
||||
dtr=0;
|
||||
if (currprefs.serial_demand)
|
||||
serial_close ();
|
||||
}
|
||||
|
||||
static int serial_read (char *buffer)
|
||||
{
|
||||
if (inptr < inlast) {
|
||||
*buffer = inbuf[inptr++];
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (serdev == 1) {
|
||||
inlast = read (sd, inbuf, sizeof inbuf);
|
||||
inptr = 0;
|
||||
if (inptr < inlast) {
|
||||
*buffer = inbuf[inptr++];
|
||||
return 1;
|
||||
*buffer = inbuf[inptr++];
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
if (serdev == 1) {
|
||||
inlast = read (sd, inbuf, sizeof inbuf);
|
||||
inptr = 0;
|
||||
if (inptr < inlast) {
|
||||
*buffer = inbuf[inptr++];
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void serial_flush_buffer(void)
|
||||
{
|
||||
if (serdev == 1) {
|
||||
if (outlast) {
|
||||
if (sd != 0) {
|
||||
write (sd, outbuf, outlast);
|
||||
}
|
||||
if (serdev == 1) {
|
||||
if (outlast) {
|
||||
if (sd != 0) {
|
||||
write (sd, outbuf, outlast);
|
||||
}
|
||||
}
|
||||
outlast = 0;
|
||||
} else {
|
||||
outlast = 0;
|
||||
inptr = 0;
|
||||
inlast = 0;
|
||||
}
|
||||
outlast = 0;
|
||||
} else {
|
||||
outlast = 0;
|
||||
inptr = 0;
|
||||
inlast = 0;
|
||||
}
|
||||
}
|
||||
|
||||
int serial_readstatus(void)
|
||||
uae_u8 serial_readstatus(void)
|
||||
{
|
||||
int status = 0;
|
||||
int status = 0;
|
||||
|
||||
#ifdef POSIX_SERIAL
|
||||
ioctl (sd, TIOCMGET, &status);
|
||||
ioctl (sd, TIOCMGET, &status);
|
||||
|
||||
if (status & TIOCM_CAR) {
|
||||
if (!carrier) {
|
||||
ciabpra |= 0x20; /* Push up Carrier Detect line */
|
||||
carrier = 1;
|
||||
if (status & TIOCM_CAR) {
|
||||
if (!carrier) {
|
||||
ciabpra |= 0x20; /* Push up Carrier Detect line */
|
||||
carrier = 1;
|
||||
#if SERIALDEBUG > 0
|
||||
write_log ("Carrier detect.\n");
|
||||
write_log ("Carrier detect.\n");
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
if (carrier) {
|
||||
ciabpra &= ~0x20;
|
||||
carrier = 0;
|
||||
}
|
||||
} else {
|
||||
if (carrier) {
|
||||
ciabpra &= ~0x20;
|
||||
carrier = 0;
|
||||
#if SERIALDEBUG > 0
|
||||
write_log ("Carrier lost.\n");
|
||||
write_log ("Carrier lost.\n");
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (status & TIOCM_DSR) {
|
||||
if (!dsr) {
|
||||
ciabpra |= 0x08; /* DSR ON */
|
||||
dsr = 1;
|
||||
if (status & TIOCM_DSR) {
|
||||
if (!dsr) {
|
||||
ciabpra |= 0x08; /* DSR ON */
|
||||
dsr = 1;
|
||||
}
|
||||
} else {
|
||||
if (dsr) {
|
||||
ciabpra &= ~0x08;
|
||||
dsr = 0;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (dsr) {
|
||||
ciabpra &= ~0x08;
|
||||
dsr = 0;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return status;
|
||||
return status;
|
||||
}
|
||||
|
||||
uae_u16 serial_writestatus (int old, int nw)
|
||||
uae_u8 serial_writestatus (int old, int nw)
|
||||
{
|
||||
if ((old & 0x80) == 0x80 && (nw & 0x80) == 0x00)
|
||||
serial_dtr_on();
|
||||
if ((old & 0x80) == 0x00 && (nw & 0x80) == 0x80)
|
||||
serial_dtr_off();
|
||||
if ((old & 0x80) == 0x80 && (nw & 0x80) == 0x00)
|
||||
serial_dtr_on();
|
||||
if ((old & 0x80) == 0x00 && (nw & 0x80) == 0x80)
|
||||
serial_dtr_off();
|
||||
|
||||
if ((old & 0x40) != (nw & 0x40))
|
||||
write_log ("RTS %s.\n", ((nw & 0x40) == 0x40) ? "set" : "cleared");
|
||||
if ((old & 0x40) != (nw & 0x40))
|
||||
write_log ("RTS %s.\n", ((nw & 0x40) == 0x40) ? "set" : "cleared");
|
||||
|
||||
if ((old & 0x10) != (nw & 0x10))
|
||||
write_log ("CTS %s.\n", ((nw & 0x10) == 0x10) ? "set" : "cleared");
|
||||
if ((old & 0x10) != (nw & 0x10))
|
||||
write_log ("CTS %s.\n", ((nw & 0x10) == 0x10) ? "set" : "cleared");
|
||||
|
||||
return nw; /* This value could also be changed here */
|
||||
return nw; /* This value could also be changed here */
|
||||
}
|
||||
|
||||
void serial_open(void)
|
||||
{
|
||||
if (serdev == 1)
|
||||
return;
|
||||
if (serdev == 1)
|
||||
return;
|
||||
|
||||
if ((sd = open (currprefs.sername, O_RDWR|O_NONBLOCK|O_BINARY, 0)) < 0) {
|
||||
write_log ("Error: Could not open Device %s\n", currprefs.sername);
|
||||
return;
|
||||
}
|
||||
if ((sd = open (currprefs.sername, O_RDWR|O_NONBLOCK|O_BINARY, 0)) < 0) {
|
||||
write_log ("Error: Could not open Device %s\n", currprefs.sername);
|
||||
return;
|
||||
}
|
||||
|
||||
serdev = 1;
|
||||
serdev = 1;
|
||||
|
||||
#ifdef POSIX_SERIAL
|
||||
if (tcgetattr (sd, &tios) < 0) { /* Initialize Serial tty */
|
||||
write_log ("Serial: TCGETATTR failed\n");
|
||||
return;
|
||||
}
|
||||
cfmakeraw (&tios);
|
||||
if (tcgetattr (sd, &tios) < 0) { /* Initialize Serial tty */
|
||||
write_log ("Serial: TCGETATTR failed\n");
|
||||
return;
|
||||
}
|
||||
cfmakeraw (&tios);
|
||||
|
||||
#ifndef MODEMTEST
|
||||
tios.c_cflag &= ~CRTSCTS; /* Disable RTS/CTS */
|
||||
tios.c_cflag &= ~CRTSCTS; /* Disable RTS/CTS */
|
||||
#else
|
||||
tios.c_cflag |= CRTSCTS; /* Enabled for testing modems */
|
||||
tios.c_cflag |= CRTSCTS; /* Enabled for testing modems */
|
||||
#endif
|
||||
|
||||
if (tcsetattr (sd, TCSADRAIN, &tios) < 0) {
|
||||
write_log ("Serial: TCSETATTR failed\n");
|
||||
return;
|
||||
}
|
||||
if (tcsetattr (sd, TCSADRAIN, &tios) < 0) {
|
||||
write_log ("Serial: TCSETATTR failed\n");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void serial_close (void)
|
||||
{
|
||||
if (sd >= 0)
|
||||
close (sd);
|
||||
serdev = 0;
|
||||
if (sd >= 0)
|
||||
close (sd);
|
||||
serdev = 0;
|
||||
}
|
||||
|
||||
void serial_init (void)
|
||||
{
|
||||
if (!currprefs.use_serial)
|
||||
if (!currprefs.use_serial)
|
||||
return;
|
||||
|
||||
if (!currprefs.serial_demand)
|
||||
serial_open ();
|
||||
|
||||
serdat = 0x2000;
|
||||
return;
|
||||
|
||||
if (!currprefs.serial_demand)
|
||||
serial_open ();
|
||||
|
||||
serdat = 0x2000;
|
||||
return;
|
||||
}
|
||||
|
||||
void serial_exit (void)
|
||||
{
|
||||
serial_close (); /* serial_close can always be called because it */
|
||||
dtr = 0; /* just closes *opened* filehandles which is ok */
|
||||
return; /* when exiting. */
|
||||
serial_close (); /* serial_close can always be called because it */
|
||||
dtr = 0; /* just closes *opened* filehandles which is ok */
|
||||
return; /* when exiting. */
|
||||
}
|
||||
|
||||
@ -371,8 +371,10 @@ static uae_u32 REGPARAM2 uaelib_demux2 (TrapContext *context)
|
||||
#define ARG4 (get_long (m68k_areg (regs, 7) + 20))
|
||||
#define ARG5 (get_long (m68k_areg (regs, 7) + 24))
|
||||
|
||||
#ifdef PICASSO96
|
||||
if (ARG0 >= 16 && ARG0 <= 39)
|
||||
return picasso_demux (ARG0, context);
|
||||
#endif
|
||||
|
||||
switch (ARG0)
|
||||
{
|
||||
|
||||
56
zfile.cpp
56
zfile.cpp
@ -508,7 +508,7 @@ static struct zfile *vhd (struct zfile *z)
|
||||
z->dataseek = 1;
|
||||
z->userdata = zvhd;
|
||||
z->zfileread = vhd_fread;
|
||||
write_log (_T("%s is VHD %s image, virtual size=%dK\n"),
|
||||
write_log (_T("%s is VHD %s image, virtual size=%lldK\n"),
|
||||
zfile_getname (z),
|
||||
zvhd->vhd_type == 2 ? _T("fixed") : _T("dynamic"),
|
||||
zvhd->virtsize / 1024);
|
||||
@ -1002,6 +1002,7 @@ end:
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef A_LZX
|
||||
static struct zfile *dsq (struct zfile *z, int lzx, int *retcode)
|
||||
{
|
||||
struct zfile *zi = NULL;
|
||||
@ -1092,7 +1093,9 @@ static struct zfile *dsq (struct zfile *z, int lzx, int *retcode)
|
||||
zfile_fclose (zi);
|
||||
return z;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef A_WRP
|
||||
static struct zfile *wrp (struct zfile *z, int *retcode)
|
||||
{
|
||||
if (zfile_needwrite (z)) {
|
||||
@ -1102,10 +1105,12 @@ static struct zfile *wrp (struct zfile *z, int *retcode)
|
||||
}
|
||||
return unwarp (z);
|
||||
}
|
||||
#endif
|
||||
|
||||
#include "7z/xz.h"
|
||||
#include "7z/lzmadec.h"
|
||||
#include "7z/7zcrc.h"
|
||||
#ifdef A_7Z
|
||||
#include "7z/Xz.h"
|
||||
#include "7z/Lzmadec.h"
|
||||
#include "7z/7zCrc.h"
|
||||
|
||||
static void *SzAlloc (void *p, size_t size)
|
||||
{
|
||||
@ -1183,7 +1188,9 @@ static struct zfile *xz (struct zfile *z, int *retcode)
|
||||
XzUnpacker_Free (&cx);
|
||||
return zo;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef A_DMS
|
||||
static struct zfile *dms (struct zfile *z, int index, int *retcode)
|
||||
{
|
||||
int ret;
|
||||
@ -1254,6 +1261,7 @@ end:
|
||||
zfile_fclose (zextra[i]);
|
||||
return zo;
|
||||
}
|
||||
#endif
|
||||
|
||||
const TCHAR *uae_ignoreextensions[] =
|
||||
{ _T(".gif"), _T(".jpg"), _T(".png"), _T(".xml"), _T(".pdf"), _T(".txt"), 0 };
|
||||
@ -1436,13 +1444,19 @@ struct zfile *zuncompress (struct znode *parent, struct zfile *z, int dodefault,
|
||||
return zfile_gunzip (z, retcode);
|
||||
if (strcasecmp (ext, _T("hdz")) == 0)
|
||||
return zfile_gunzip (z, retcode);
|
||||
#ifdef A_WRP
|
||||
if (strcasecmp (ext, _T("wrp")) == 0)
|
||||
return wrp (z, retcode);
|
||||
#endif
|
||||
#ifdef A_7Z
|
||||
if (strcasecmp (ext, _T("xz")) == 0)
|
||||
return xz (z, retcode);
|
||||
#endif
|
||||
}
|
||||
#ifdef A_DMS
|
||||
if (strcasecmp (ext, _T("dms")) == 0)
|
||||
return dms (z, index, retcode);
|
||||
#endif
|
||||
}
|
||||
if (mask & ZFD_RAWDISK) {
|
||||
#ifdef CAPS
|
||||
@ -1476,13 +1490,19 @@ struct zfile *zuncompress (struct znode *parent, struct zfile *z, int dodefault,
|
||||
if (index == 0) {
|
||||
if (header[0] == 0x1f && header[1] == 0x8b)
|
||||
return zfile_gunzip (z, retcode);
|
||||
#ifdef A_LZX
|
||||
if (header[0] == 'P' && header[1] == 'K' && header[2] == 'D')
|
||||
return dsq (z, 0, retcode);
|
||||
#endif
|
||||
#ifdef A_7Z
|
||||
if (header[0] == 0xfd && header[1] == 0x37 && header[2] == 0x7a && header[3] == 0x58 && header[4] == 0x5a && header[5] == 0)
|
||||
return xz (z, retcode);
|
||||
#endif
|
||||
}
|
||||
#ifdef A_DMS
|
||||
if (header[0] == 'D' && header[1] == 'M' && header[2] == 'S' && header[3] == '!')
|
||||
return dms (z, index, retcode);
|
||||
#endif
|
||||
}
|
||||
if (mask & ZFD_RAWDISK) {
|
||||
#ifdef CAPS
|
||||
@ -1517,8 +1537,10 @@ struct zfile *zuncompress (struct znode *parent, struct zfile *z, int dodefault,
|
||||
|
||||
if (ext) {
|
||||
if (mask & ZFD_UNPACK) {
|
||||
#ifdef A_LZX
|
||||
if (strcasecmp (ext, _T("dsq")) == 0)
|
||||
return dsq (z, 1, retcode);
|
||||
#endif
|
||||
}
|
||||
if (mask & ZFD_ADF) {
|
||||
if (strcasecmp (ext, _T("adf")) == 0 && !memcmp (header, "DOS", 3))
|
||||
@ -2037,7 +2059,7 @@ struct zfile *zfile_fopen_data (const TCHAR *name, uae_u64 size, const uae_u8 *d
|
||||
struct zfile *l;
|
||||
|
||||
l = zfile_create (NULL);
|
||||
l->name = name ? my_strdup (name) : _T("");
|
||||
l->name = my_strdup (name ? name : _T(""));
|
||||
l->data = xmalloc (uae_u8, size);
|
||||
l->size = size;
|
||||
l->datasize = size;
|
||||
@ -2173,7 +2195,7 @@ size_t zfile_fread (void *b, size_t l1, size_t l2, struct zfile *z)
|
||||
return fread (b, l1, l2, z->f);
|
||||
}
|
||||
|
||||
size_t zfile_fwrite (void *b, size_t l1, size_t l2, struct zfile *z)
|
||||
size_t zfile_fwrite (const void *b, size_t l1, size_t l2, struct zfile *z)
|
||||
{
|
||||
if (z->archiveparent)
|
||||
return 0;
|
||||
@ -2625,16 +2647,26 @@ static struct zvolume *zfile_fopen_archive_ext (struct znode *parent, struct zfi
|
||||
if (ext != NULL) {
|
||||
ext++;
|
||||
if (flags & ZFD_ARCHIVE) {
|
||||
#ifdef A_LHA
|
||||
if (strcasecmp (ext, _T("lha")) == 0 || strcasecmp (ext, _T("lzh")) == 0)
|
||||
zv = archive_directory_lha (zf);
|
||||
#endif
|
||||
#ifdef A_ZIP
|
||||
if (strcasecmp (ext, _T("zip")) == 0)
|
||||
zv = archive_directory_zip (zf);
|
||||
#endif
|
||||
#ifdef A_7Z
|
||||
if (strcasecmp (ext, _T("7z")) == 0)
|
||||
zv = archive_directory_7z (zf);
|
||||
#endif
|
||||
#ifdef A_LZX
|
||||
if (strcasecmp (ext, _T("lzx")) == 0)
|
||||
zv = archive_directory_lzx (zf);
|
||||
#endif
|
||||
#ifdef A_RAR
|
||||
if (strcasecmp (ext, _T("rar")) == 0)
|
||||
zv = archive_directory_rar (zf);
|
||||
#endif
|
||||
if (strcasecmp (ext, _T("tar")) == 0)
|
||||
zv = archive_directory_tar (zf);
|
||||
}
|
||||
@ -2664,14 +2696,22 @@ static struct zvolume *zfile_fopen_archive_data (struct znode *parent, struct zf
|
||||
zfile_fread (header, sizeof (header), 1, zf);
|
||||
zfile_fseek (zf, 0, SEEK_SET);
|
||||
if (flags & ZFD_ARCHIVE) {
|
||||
#ifdef A_ZIP
|
||||
if (header[0] == 'P' && header[1] == 'K')
|
||||
zv = archive_directory_zip (zf);
|
||||
#endif
|
||||
#ifdef A_RAR
|
||||
if (header[0] == 'R' && header[1] == 'a' && header[2] == 'r' && header[3] == '!')
|
||||
zv = archive_directory_rar (zf);
|
||||
#endif
|
||||
#ifdef A_LZX
|
||||
if (header[0] == 'L' && header[1] == 'Z' && header[2] == 'X')
|
||||
zv = archive_directory_lzx (zf);
|
||||
#endif
|
||||
#ifdef A_LHA
|
||||
if (header[2] == '-' && header[3] == 'l' && header[4] == 'h' && header[6] == '-')
|
||||
zv = archive_directory_lha (zf);
|
||||
#endif
|
||||
}
|
||||
if (flags & ZFD_ADF) {
|
||||
if (header[0] == 'D' && header[1] == 'O' && header[2] == 'S' && (header[3] >= 0 && header[3] <= 7))
|
||||
@ -2970,7 +3010,7 @@ struct zvolume *zfile_fopen_directory (const TCHAR *dirname)
|
||||
if (!_tcscmp (fname, _T(".")) || !_tcscmp (fname, _T("..")))
|
||||
continue;
|
||||
_tcscpy (fullname, dirname);
|
||||
_tcscat (fullname, _T("\\"));
|
||||
_tcscat (fullname, FSDB_DIR_SEPARATOR_S);
|
||||
_tcscat (fullname, fname);
|
||||
if (stat (fullname, &statbuf) == -1)
|
||||
continue;
|
||||
@ -3218,7 +3258,7 @@ int zfile_readdir_archive (struct zdirectory *zd, TCHAR *out, bool fullpath)
|
||||
return zd->cnt;
|
||||
if (fullpath) {
|
||||
_tcscpy (out, zd->parentpath);
|
||||
_tcscat (out, _T("\\"));
|
||||
_tcscat (out, FSDB_DIR_SEPARATOR_S);
|
||||
}
|
||||
_tcscat (out, zd->filenames[zd->offset]);
|
||||
zd->offset++;
|
||||
|
||||
@ -53,21 +53,31 @@ static struct zvolume *getzvolume (struct znode *parent, struct zfile *zf, unsig
|
||||
|
||||
switch (id)
|
||||
{
|
||||
#ifdef A_ZIP
|
||||
case ArchiveFormatZIP:
|
||||
zv = archive_directory_zip (zf);
|
||||
break;
|
||||
#endif
|
||||
#ifdef A_7Z
|
||||
case ArchiveFormat7Zip:
|
||||
zv = archive_directory_7z (zf);
|
||||
break;
|
||||
#endif
|
||||
#ifdef A_RAR
|
||||
case ArchiveFormatRAR:
|
||||
zv = archive_directory_rar (zf);
|
||||
break;
|
||||
#endif
|
||||
#ifdef A_LHA
|
||||
case ArchiveFormatLHA:
|
||||
zv = archive_directory_lha (zf);
|
||||
break;
|
||||
#endif
|
||||
#ifdef A_LZX
|
||||
case ArchiveFormatLZX:
|
||||
zv = archive_directory_lzx (zf);
|
||||
break;
|
||||
#endif
|
||||
case ArchiveFormatPLAIN:
|
||||
zv = archive_directory_plain (zf);
|
||||
break;
|
||||
@ -84,8 +94,10 @@ static struct zvolume *getzvolume (struct znode *parent, struct zfile *zf, unsig
|
||||
zv = archive_directory_fat (zf);
|
||||
break;
|
||||
}
|
||||
#ifdef ARCHIVEACCESS
|
||||
if (!zv)
|
||||
zv = archive_directory_arcacc (zf, id);
|
||||
#endif
|
||||
return zv;
|
||||
}
|
||||
|
||||
@ -328,6 +340,7 @@ struct zfile *archive_access_tar (struct znode *zn)
|
||||
}
|
||||
|
||||
/* ZIP */
|
||||
#ifdef A_ZIP
|
||||
|
||||
static void archive_close_zip (void *handle)
|
||||
{
|
||||
@ -469,7 +482,9 @@ static struct zfile *archive_unpack_zip (struct zfile *zf)
|
||||
{
|
||||
return archive_do_zip (NULL, zf, 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef A_7Z
|
||||
/* 7Z */
|
||||
|
||||
#include "7z/7z.h"
|
||||
@ -625,10 +640,10 @@ static struct zfile *archive_access_7z (struct znode *zn)
|
||||
}
|
||||
return z;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* RAR */
|
||||
|
||||
|
||||
#ifdef A_RAR
|
||||
|
||||
/* copy and paste job? you are only imagining it! */
|
||||
static struct zfile *rarunpackzf; /* stupid unrar.dll */
|
||||
@ -783,6 +798,8 @@ end:
|
||||
pRARCloseArchive(rc->hArcData);
|
||||
return zf;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* ArchiveAccess */
|
||||
|
||||
@ -1629,7 +1646,7 @@ static TCHAR *tochar (uae_u8 *s, int len)
|
||||
for (i = 0; i < len; i++) {
|
||||
uae_char c = *s++;
|
||||
if (c >= 0 && c <= 9) {
|
||||
tmp[j++] = '\\';
|
||||
tmp[j++] = FSDB_DIR_SEPARATOR;
|
||||
tmp[j++] = '0' + c;
|
||||
} else if (c < ' ' || c > 'z') {
|
||||
tmp[j++] = '.';
|
||||
@ -2039,17 +2056,25 @@ void archive_access_close (void *handle, unsigned int id)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
#ifdef A_ZIP
|
||||
case ArchiveFormatZIP:
|
||||
archive_close_zip (handle);
|
||||
break;
|
||||
#endif
|
||||
#ifdef A_7Z
|
||||
case ArchiveFormat7Zip:
|
||||
archive_close_7z (handle);
|
||||
break;
|
||||
#endif
|
||||
#ifdef A_RAR
|
||||
case ArchiveFormatRAR:
|
||||
archive_close_rar (handle);
|
||||
break;
|
||||
#endif
|
||||
#ifdef A_LHA
|
||||
case ArchiveFormatLHA:
|
||||
break;
|
||||
#endif
|
||||
case ArchiveFormatADF:
|
||||
archive_close_adf (handle);
|
||||
break;
|
||||
@ -2074,9 +2099,11 @@ struct zfile *archive_unpackzfile (struct zfile *zf)
|
||||
zf->datasize = zf->size;
|
||||
switch (zf->archiveid)
|
||||
{
|
||||
#ifdef A_ZIP
|
||||
case ArchiveFormatZIP:
|
||||
zout = archive_unpack_zip (zf);
|
||||
break;
|
||||
#endif
|
||||
}
|
||||
zfile_fclose (zf->archiveparent);
|
||||
zf->archiveparent = NULL;
|
||||
@ -2090,21 +2117,31 @@ struct zfile *archive_getzfile (struct znode *zn, unsigned int id, int flags)
|
||||
|
||||
switch (id)
|
||||
{
|
||||
#ifdef A_ZIP
|
||||
case ArchiveFormatZIP:
|
||||
zf = archive_access_zip (zn, flags);
|
||||
break;
|
||||
#endif
|
||||
#ifdef A_7Z
|
||||
case ArchiveFormat7Zip:
|
||||
zf = archive_access_7z (zn);
|
||||
break;
|
||||
#endif
|
||||
#ifdef A_RAR
|
||||
case ArchiveFormatRAR:
|
||||
zf = archive_access_rar (zn);
|
||||
break;
|
||||
#endif
|
||||
#ifdef A_LHA
|
||||
case ArchiveFormatLHA:
|
||||
zf = archive_access_lha (zn);
|
||||
break;
|
||||
#endif
|
||||
#ifdef A_LZX
|
||||
case ArchiveFormatLZX:
|
||||
zf = archive_access_lzx (zn);
|
||||
break;
|
||||
#endif
|
||||
case ArchiveFormatPLAIN:
|
||||
zf = archive_access_plain (zn);
|
||||
break;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user