USHORT dms_CreateCRC(UCHAR* mem, ULONG size ){
- static USHORT CRCTab[256]={
+ static const USHORT CRCTab[256]={
0x0000,0xC0C1,0xC181,0x0140,0xC301,0x03C0,0x0280,0xC241,
0xC601,0x06C0,0x0780,0xC741,0x0500,0xC5C1,0xC481,0x0440,
0xCC01,0x0CC0,0x0D80,0xCD41,0x0F00,0xCFC1,0xCE81,0x0E40,
if (cmd == CMD_SHOWBANNER) /* Banner is in the first track */
ret = Process_Track(fi,NULL,b1,b2,cmd,opt,geninfo,extra);
else {
+ Init_Decrunchers();
for (;;) {
int ok = 0;
ret = Process_Track(fi,fo,b1,b2,cmd,opt,geninfo,extra);
USHORT hcrc, dcrc, usum, number, pklen1, pklen2, unpklen, l;
UCHAR cmode, flags;
int crcerr = 0;
+ bool normaltrack;
l = (USHORT)zfile_fread(b1,1,THLEN,fi);
//if (pwd && (number!=80)) dms_decrypt(b1,pklen1);
+ normaltrack = false;
if ((cmd == CMD_UNPACK) && (number<80) && (unpklen>2048)) {
memset(b2, 0, unpklen);
- if (!crcerr)
+ if (!crcerr) {
Unpack_Track(b1, b2, pklen2, unpklen, cmode, flags, number, pklen1, usum, dmsflags & DMSFLAG_ENCRYPTED);
+ }
if (number == 0 && zfile_ftell (fo) == 512 * 22) {
// did we have another cylinder 0 already?
uae_u8 *p;
zfile_fseek (fo, number * 512 * 22 * ((dmsflags & DMSFLAG_HD) ? 2 : 1), SEEK_SET);
if (zfile_fwrite(b2,1,(size_t)unpklen,fo) != unpklen)
return ERR_CANTWRITE;
+ normaltrack = true;
} else if (number == 0 && unpklen == 1024) {
memset(b2, 0, unpklen);
if (!crcerr)
if (crcerr)
return NO_PROBLEM;
- if (number == 0xffff && extra){
- Unpack_Track(b1, b2, pklen2, unpklen, cmode, flags, number, pklen1, usum, dmsflags & DMSFLAG_ENCRYPTED);
- addextra(L"Banner", extra, b2, unpklen);
+ if (number == 0xffff) {
+ if (extra){
+ Unpack_Track(b1, b2, pklen2, unpklen, cmode, flags, number, pklen1, usum, dmsflags & DMSFLAG_ENCRYPTED);
+ addextra(L"Banner", extra, b2, unpklen);
+ }
//printbandiz(b2,unpklen);
}
- if (number == 80 && extra) {
- Unpack_Track(b1, b2, pklen2, unpklen, cmode, flags, number, pklen1, usum, dmsflags & DMSFLAG_ENCRYPTED);
- addextra(L"FILEID.DIZ", extra, b2, unpklen);
+ if (number == 80) {
+ if (extra) {
+ Unpack_Track(b1, b2, pklen2, unpklen, cmode, flags, number, pklen1, usum, dmsflags & DMSFLAG_ENCRYPTED);
+ addextra(L"FILEID.DIZ", extra, b2, unpklen);
+ }
//printbandiz(b2,unpklen);
}
+ if (!normaltrack)
+ Init_Decrunchers();
+
return NO_PROBLEM;
}
if (Unpack_HEAVY(b1,b2,flags | 8,pklen2)) return ERR_BADDECR;
}
if (flags & 4) {
+ memset(b1,0,unpklen);
/* Unpack with RLE only if this flag is set */
if (Unpack_RLE(b2,b1,unpklen)) return ERR_BADDECR;
memcpy(b2,b1,(size_t)unpklen);
fsd->fstype = (u->volflags & MYVOLUMEINFO_ARCHIVE) ? FS_ARCHIVE : ((u->volflags & MYVOLUMEINFO_CDFS) ? FS_CDFS : FS_DIRECTORY);
if (fsd->fstype == FS_ARCHIVE) {
fsd->zd = zfile_opendir_archive (aino->nname);
+ if (fsd->zd)
+ return fsd;
} else if (fsd->fstype == FS_DIRECTORY) {
fsd->od = my_opendir (aino->nname);
+ if (fsd->od)
+ return fsd;
} else if (fsd->fstype == FS_CDFS) {
fsd->isod = isofs_opendir (u->ui.cdfs_superblock, aino->uniq_external);
+ if (fsd->isod)
+ return fsd;
}
- if (fsd)
- return fsd;
xfree (fsd);
return NULL;
}
fsf->fstype = (u->volflags & MYVOLUMEINFO_ARCHIVE) ? FS_ARCHIVE : ((u->volflags & MYVOLUMEINFO_CDFS) ? FS_CDFS : FS_DIRECTORY);
if (fsf->fstype == FS_ARCHIVE) {
fsf->zf = zfile_open_archive (aino->nname, flags);
+ if (fsf->zf)
+ return fsf;
} else if (fsf->fstype == FS_DIRECTORY) {
fsf->of = my_open (aino->nname, flags);
- } else {
+ if (fsf->of)
+ return fsf;
+ } else if (fsf->fstype == FS_CDFS) {
fsf->isof = isofs_openfile (u->ui.cdfs_superblock, aino->uniq_external, flags);
+ if (fsf->isof)
+ return fsf;
}
- if (fsf)
- return fsf;
xfree (fsf);
return NULL;
}
-static void fs_closefile (struct fs_filehandle *fd)
+static void fs_closefile (struct fs_filehandle *fsf)
{
- if (!fd)
+ if (!fsf)
return;
- if (fd->fstype == FS_ARCHIVE)
- zfile_close_archive (fd->zf);
- else if (fd->fstype == FS_DIRECTORY)
- my_close (fd->of);
- else if (fd->fstype == FS_CDFS)
- isofs_closefile (fd->isof);
+ if (fsf->fstype == FS_ARCHIVE) {
+ zfile_close_archive (fsf->zf);
+ } else if (fsf->fstype == FS_DIRECTORY) {
+ my_close (fsf->of);
+ } else if (fsf->fstype == FS_CDFS) {
+ isofs_closefile (fsf->isof);
+ }
+ xfree (fsf);
}
static unsigned int fs_read (struct fs_filehandle *fsf, void *b, unsigned int size)
{
}
static unsigned int fs_write (struct fs_filehandle *fsf, void *b, unsigned int size)
{
- if (fsf->fstype == FS_ARCHIVE)
- return 0;
- else if (fsf->fstype == FS_DIRECTORY)
+ if (fsf->fstype == FS_DIRECTORY)
return my_write (fsf->of, b, size);
return 0;
}
int i = 0;
int cnt = 100;
- write_log (L"FILESYS: flushing cache unit %d (max %d items)\n", unit->unit, num);
+ //write_log (L"FILESYS: flushing cache unit %d (max %d items)\n", unit->unit, num);
if (num == 0)
num = -1;
while (i < num || num < 0) {
if (base == 0)
base = &unit->rootnode;
for (;;) {
+ uae_u64 uniq = 0;
d = eak->dirhandle;
if (!eak->fn) {
do {
ok = zfile_readdir_archive (d->zd, fn);
else if (d->fstype == FS_DIRECTORY)
ok = my_readdir (d->od, fn);
+ else if (d->fstype == FS_CDFS)
+ ok = isofs_readdir (d->isod, fn, &uniq);
else
ok = 0;
} while (ok && d->fstype == FS_DIRECTORY && fsdb_name_invalid (fn));
xfree (eak->fn);
eak->fn = NULL;
}
- aino = lookup_child_aino_for_exnext (unit, base, fn, &err, 0);
+ aino = lookup_child_aino_for_exnext (unit, base, fn, &err, uniq);
if (!aino)
return 0;
eak->id = unit->exallid++;
{
struct fs_dirhandle *d;
a_inode *aino;
- uae_u64 uniq = 0;
d = fs_opendir (unit, base);
if (!d)
TRACE((L"Populating directory, child %p, locked_children %d\n",
base->child, base->locked_children));
for (;;) {
+ uae_u64 uniq = 0;
TCHAR fn[MAX_DPATH];
int ok;
uae_u32 err;
*cyl, *cylsec, *head, *tracksec);
}
-void getchsgeometry (uae_u64 size, int *pcyl, int *phead, int *psectorspertrack)
+static void getchsgeometry2 (uae_u64 size, int *pcyl, int *phead, int *psectorspertrack, int mode)
{
- int sptt[] = { 63, 127, 255, -1 };
+ int sptt[4];
int i, spt, head, cyl;
uae_u64 total = (unsigned int)(size / 512);
- for (i = 0; sptt[i] >= 0; i++) {
- spt = sptt[i];
- for (head = 4; head <= 16;head++) {
- cyl = total / (head * spt);
- if (size <= 512 * 1024 * 1024) {
- if (cyl <= 1023)
- break;
- } else {
- if (cyl < 16383)
- break;
- if (cyl < 32767 && head >= 5)
- break;
- if (cyl <= 65535)
- break;
+ if (mode == 1) {
+ // old-style head=1, spt=32 always mode
+ head = 1;
+ spt = 32;
+ cyl = total / (head * spt);
+
+ } else {
+
+ sptt[0] = 63;
+ sptt[1] = 127;
+ sptt[2] = 255;
+ sptt[3] = -1;
+
+ for (i = 0; sptt[i] >= 0; i++) {
+ spt = sptt[i];
+ for (head = 4; head <= 16;head++) {
+ cyl = total / (head * spt);
+ if (size <= 512 * 1024 * 1024) {
+ if (cyl <= 1023)
+ break;
+ } else {
+ if (cyl < 16383)
+ break;
+ if (cyl < 32767 && head >= 5)
+ break;
+ if (cyl <= 65535)
+ break;
+ }
}
+ if (head <= 16)
+ break;
}
- if (head <= 16)
- break;
+
}
+
*pcyl = cyl;
*phead = head;
*psectorspertrack = spt;
}
+void getchsgeometry (uae_u64 size, int *pcyl, int *phead, int *psectorspertrack)
+{
+ getchsgeometry2 (size, pcyl, phead, psectorspertrack, 0);
+}
+
+void getchsgeometry_hdf (struct hardfiledata *hfd, uae_u64 size, int *pcyl, int *phead, int *psectorspertrack)
+{
+ uae_u8 block[512];
+ int i;
+
+ if (size <= 512 * 1024 * 1024) {
+ *phead = 1;
+ *psectorspertrack = 32;
+ }
+ memset (block, 0, sizeof block);
+ if (hfd) {
+ hdf_read (hfd, block, 0, 512);
+ if (block[0] == 'D' && block[1] == 'O' && block[2] == 'S') {
+ int mode;
+ for (mode = 0; mode < 2; mode++) {
+ uae_u32 rootblock;
+ uae_u32 chk = 0;
+ getchsgeometry2 (size, pcyl, phead, psectorspertrack, mode);
+ rootblock = (2 + ((*pcyl) * (*phead) * (*psectorspertrack) - 1)) / 2;
+ memset (block, 0, sizeof block);
+ hdf_read (hfd, block, (uae_u64)rootblock * 512, 512);
+ for (i = 0; i < 512; i += 4)
+ chk += (block[i] << 24) | (block[i + 1] << 16) | (block[i + 2] << 8) | (block[i + 3] << 0);
+ if (!chk && block[0] == 0 && block[1] == 0 && block[2] == 0 && block[3] == 2 &&
+ block[4] == 0 && block[5] == 0 && block[6] == 0 && block[7] == 0 &&
+ block[8] == 0 && block[9] == 0 && block[10] == 0 && block[11] == 0 &&
+ block[508] == 0 && block[509] == 0 && block[510] == 0 && block[511] == 1) {
+ return;
+ }
+ }
+ }
+ }
+ getchsgeometry2 (size, pcyl, phead, psectorspertrack, 2);
+}
+
static void getchshd (struct hardfiledata *hfd, int *pcyl, int *phead, int *psectorspertrack)
{
uae_u64 total = hfd->virtsize / 512;
extern int hdf_write_target (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int len);
extern int hdf_resize_target (struct hardfiledata *hfd, uae_u64 newsize);
extern void getchsgeometry (uae_u64 size, int *pcyl, int *phead, int *psectorspertrack);
+extern void getchsgeometry_hdf (struct hardfiledata *hfd, uae_u64 size, int *pcyl, int *phead, int *psectorspertrack);
#include "isofs.h"
#define MAX_CACHED_BH_COUNT 100
-#define MAX_CACHE_INODE_COUNT 10
+//#define MAX_CACHE_INODE_COUNT 10
+#define HASH_SIZE 65536
#define CD_BLOCK_SIZE 2048
#define ISOFS_INVALID_MODE -1
TCHAR *i_comment;
};
+
struct super_block
{
int s_high_sierra;
struct buffer_head *buffer_heads;
int bh_count;
bool unknown_media;
+ struct inode *hash[HASH_SIZE];
+ int hash_miss, hash_hit;
};
+static int gethashindex(struct inode *inode)
+{
+ return inode->i_ino & (HASH_SIZE - 1);
+}
+
static void free_inode(struct inode *inode)
{
if (!inode)
return;
+ inode->i_sb->hash[gethashindex(inode)] = NULL;
inode->i_sb->inode_cnt--;
xfree(inode->name);
xfree(inode->i_comment);
inode->lockcnt--;
}
+
static void iput(struct inode *inode)
{
struct super_block *sb = inode->i_sb;
sb->inodes = inode;
inode->linked = true;
sb->inode_cnt++;
+ sb->hash[gethashindex(inode)] = inode;
}
static struct inode *find_inode(struct super_block *sb, uae_u64 uniq)
{
- struct inode *inode = sb->inodes;
- /* Need hash tables... Later... */
+ struct inode *inode;
+
+ inode = sb->hash[uniq & (HASH_SIZE - 1)];
+ if (inode && inode->i_ino == uniq) {
+ sb->hash_hit++;
+ return inode;
+ }
+ sb->hash_miss++;
+
+ inode = sb->inodes;
while (inode) {
if (inode->i_ino == uniq) {
inode->usecnt++;
if (!sb)
return;
+ write_log (L"miss: %d hit: %d\n", sb->hash_miss, sb->hash_hit);
inode = sb->inodes;
while (inode) {
struct inode *next = inode->next;
static D3DXMATRIXA16 m_matPreWorld;
static D3DXMATRIXA16 postproj;
static D3DXVECTOR4 maskmult, maskshift, texelsize;
+static D3DXVECTOR4 fakesize;
static int ledwidth, ledheight;
static int max_texture_w, max_texture_h;
fDims.x = (FLOAT) Desc.Width;
fDims.y = (FLOAT) Desc.Height;
}
+
fTexelSize.x = 1.0f / fDims.x;
fTexelSize.y = 1.0f / fDims.y;
+
if (m_SourceDimsEffectHandle) {
hr = pEffect->SetVector (m_SourceDimsEffectHandle, &fDims);
if (FAILED (hr)) {
w = sr.right - sr.left;
h = sr.bottom - sr.top;
+ fakesize.x = w;
+ fakesize.y = h;
+ fakesize.w = 1;
+ fakesize.z = 1;
+
MatrixOrthoOffCenterLH (&m_matProj, 0, w, 0, h, 0.0f, 1.0f);
float tx, ty;
sw = dw * tin_w / window_w;
sh = dh * tin_h / window_h;
+ sw -= 0.5f;
+ sh += 0.5f;
+
tx += xshift;
ty += yshift;
// Projection is (0,0,0) -> (1,1,1)
MatrixOrthoOffCenterLH (&m_matPreProj, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f);
// Align texels with pixels
- MatrixTranslation (&m_matPreView, -0.5f / tin_w, 0.5f / tin_h, 0.0f);
+ MatrixTranslation (&m_matPreView, -0.5f / tout_w, 0.5f / tout_h, 0.0f);
// Identity for world
D3DXMatrixIdentity (&m_matPreWorld);
psEffect_SetMatrices (&m_matProj, &m_matView, &m_matWorld);
MatrixOrthoOffCenterLH (&m_matProj2, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f);
- MatrixTranslation (&m_matView2, 0.5f - 0.5f / window_w, 0.5f + 0.5f / window_h, 0.0f);
+ MatrixTranslation (&m_matView2, 0.5f - 0.5f / tout_w, 0.5f + 0.5f / tout_h, 0.0f);
D3DXMatrixIdentity (&m_matWorld2);
}
write_log(L"-> %dx%d\n", prefs->gfx_size_win.width, prefs->gfx_size_win.height);
}
-static int getmult(int mult)
+static int getmult (int mult)
{
if (mult >= 4 * 256)
return 2;
write_log (L"rp_fixup_options(escapekey=%d,escapeholdtime=%d,screenmode=%d,inputmode=%d)\n",
rp_rpescapekey, rp_rpescapeholdtime, rp_screenmode, rp_inputmode);
- write_log (L"w=%dx%d fs=%dx%d pos=%dx%d %dx%d\n",
- p->gfx_size_win.width, p->gfx_size_win.height,
- p->gfx_size_fs.width, p->gfx_size_fs.height,
- p->gfx_xcenter_pos, p->gfx_ycenter_pos,
- p->gfx_xcenter_size, p->gfx_ycenter_size);
max_horiz_dbl = currprefs.gfx_max_horizontal;
max_vert_dbl = currprefs.gfx_max_vertical;
maxjports = (rp_version * 256 + rp_revision) >= 2 * 256 + 3 ? MAX_JPORTS : 2;
+ write_log (L"w=%dx%d fs=%dx%d pos=%dx%d %dx%d HV=%d,%d J=%d\n",
+ p->gfx_size_win.width, p->gfx_size_win.height,
+ p->gfx_size_fs.width, p->gfx_size_fs.height,
+ p->gfx_xcenter_pos, p->gfx_ycenter_pos,
+ p->gfx_xcenter_size, p->gfx_ycenter_size,
+ max_horiz_dbl, max_vert_dbl, maxjports);
+
sendfeatures ();
sendenum ();
#define LANG_DLL 1
//#define WINUAEBETA L""
-#define WINUAEBETA L"Beta 24 (RC2)"
-#define WINUAEDATE MAKEBD(2012, 3, 22)
+#define WINUAEBETA L"Beta 25 (RC3)"
+#define WINUAEDATE MAKEBD(2012, 3, 24)
#define WINUAEEXTRA L"RC1"
//#define WINUAEEXTRA L"AmiKit Preview"
#define WINUAEREV L""
sethardfile (hDlg);
}
-static void updatehdfinfo (HWND hDlg, int force)
+static void updatehdfinfo (HWND hDlg, bool force)
{
static uae_u64 bsize;
static uae_u8 id[512];
TCHAR idtmp[9];
if (force) {
+ bool open = false;
struct hardfiledata hfd;
memset (id, 0, sizeof id);
memset (&hfd, 0, sizeof hfd);
hfd.readonly = 1;
hfd.blocksize = 512;
if (hdf_open (&hfd, current_hfdlg.filename)) {
+ open = true;
for (i = 0; i < 16; i++) {
hdf_read (&hfd, id, i * 512, 512);
bsize = hfd.virtsize;
}
if (i == 16)
hdf_read (&hfd, id, 0, 512);
- hdf_close (&hfd);
}
+ if (current_hfdlg.blocksize * current_hfdlg.sectors * current_hfdlg.surfaces) {
+ getchsgeometry_hdf (open ? &hfd : NULL, bsize, ¤t_hfdlg.cylinders, ¤t_hfdlg.surfaces, ¤t_hfdlg.sectors);
+ current_hfdlg.original = 0;
+ }
+ hdf_close (&hfd);
}
cyls = 0;
if (current_hfdlg.blocksize * current_hfdlg.sectors * current_hfdlg.surfaces) {
- if (bsize >= 512 * 1024 * 1024 && current_hfdlg.original) {
- getchsgeometry (bsize, ¤t_hfdlg.cylinders, ¤t_hfdlg.surfaces, ¤t_hfdlg.sectors);
- current_hfdlg.original = 0;
- }
cyls = bsize / (current_hfdlg.blocksize * current_hfdlg.sectors * current_hfdlg.surfaces);
}
blocks = cyls * (current_hfdlg.sectors * current_hfdlg.surfaces);
fullpath (current_hfdlg.filename, sizeof current_hfdlg.filename / sizeof (TCHAR));
inithardfile (hDlg);
hardfile_testrdb (hDlg, ¤t_hfdlg);
- updatehdfinfo (hDlg, 1);
+ updatehdfinfo (hDlg, true);
sethardfile (hDlg);
}
inithardfile (hDlg);
sethardfile (hDlg);
sethfdostype (hDlg, 0);
- updatehdfinfo (hDlg, 1);
+ updatehdfinfo (hDlg, true);
setac (hDlg, IDC_PATH_NAME);
recursive--;
customDlgType = IDD_HARDFILE;
GetDlgItemText (hDlg, IDC_PATH_NAME, tmp, sizeof tmp / sizeof (TCHAR));
if (_tcscmp (tmp, current_hfdlg.filename)) {
_tcscpy (current_hfdlg.filename, tmp);
- updatehdfinfo (hDlg, 1);
+ updatehdfinfo (hDlg, true);
}
GetDlgItemText (hDlg, IDC_PATH_FILESYS, current_hfdlg.fsfilename, sizeof current_hfdlg.fsfilename / sizeof (TCHAR));
GetDlgItemText (hDlg, IDC_HARDFILE_DEVICE, current_hfdlg.devicename, sizeof current_hfdlg.devicename / sizeof (TCHAR));
posn = SendDlgItemMessage (hDlg, IDC_HDF_CONTROLLER, CB_GETCURSEL, 0, 0);
if (posn != CB_ERR)
current_hfdlg.controller = posn;
- updatehdfinfo (hDlg, 0);
+ updatehdfinfo (hDlg, false);
recursive--;
break;
if (customDlgType == IDD_HARDFILE) {
_tcscpy (current_hfdlg.filename, file);
SetDlgItemText (hDlg, IDC_PATH_NAME, current_hfdlg.filename);
- updatehdfinfo (customDlg, 1);
+ updatehdfinfo (customDlg, true);
continue;
}
+Beta 25: (RC3)
+
+- CDFS ACTION_EXAMINE_ALL fixed.
+- CDFS file/directory search now uses simple hash table for better performance.
+- Fixed crash introduced in b23 if filesystem was asked to open directory that couldn't be opened.
+- Directory filesystem host memory leak fixed (leaked few bytes when filehandle was closed). Very old bug.
+- Autodetect old-style geometry if >512M OFS/FFS partition harddrive was created with older UAE version.
+- Some rare DMS files didn't unpack properly.
+- Possible fix for diagonal artifact in some D3D filter modes.
+
Beta 24: (RC2)
- CDFS Amiga Rock Ridge 'AS' extension support added. (comments and protection flags)