Commit 7fb1ff3e authored by GnoStiC's avatar GnoStiC

puae 2.3.1

parent 93f80690
This diff is collapsed.
......@@ -169,7 +169,7 @@ static void trim (TCHAR *s)
s[_tcslen(s) - 1] = 0;
}
int isharddrive (const TCHAR *name)
static int isharddrive (const TCHAR *name)
{
int i;
......@@ -271,7 +271,8 @@ int hdf_open_target (struct hardfiledata *hfd, const char *pname)
i--;
}
if (h != INVALID_HANDLE_VALUE) {
size_t ret, low;
size_t ret;
int low;
ret = fseek (h, 0, SEEK_END);
if (ret)
goto end;
......@@ -478,7 +479,7 @@ int hdf_read_target (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int
if (hfd->drive_empty)
return 0;
if (offset < hfd->virtual_size) {
uae_u64 len2 = offset + len <= hfd->virtual_size ? len : hfd->virtual_size - offset;
uae_u64 len2 = offset + (unsigned)len <= hfd->virtual_size ? (unsigned)len : hfd->virtual_size - offset;
if (!hfd->virtual_rdb)
return 0;
memcpy (buffer, hfd->virtual_rdb + offset, len2);
......@@ -486,7 +487,7 @@ int hdf_read_target (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int
}
offset -= hfd->virtual_size;
while (len > 0) {
int maxlen;
unsigned int maxlen;
size_t ret;
if (hfd->physsize < CACHE_SIZE) {
hfd->cache_valid = 0;
......
......@@ -22,5 +22,8 @@ extern void write_log (const char *, ...) PRINTF_FORMAT;
extern void flush_log (void);
extern void set_logfile (const char *logfile_name);
extern void uae_reset (int);
extern void jit_abort (const char *fmt, ...);
extern void write_dlog (const char *format, ...);
extern char *setconsolemode (char *buffer, int maxlen);
#endif /* WRITELOG_H */
......@@ -66,7 +66,7 @@ extern struct zfile *zfile_gunzip (struct zfile *z);
extern int zfile_is_diskimage (const TCHAR *name);
extern int iszip (struct zfile *z);
extern int zfile_convertimage (const TCHAR *src, const TCHAR *dst);
//extern struct zfile *zuncompress (struct znode*, struct zfile *z, int dodefault, int mask, int *retcode, int index);
//extern struct zfile *zuncompress (struct znode *parent, struct zfile *z, int dodefault, int mask, int *retcode, int index);
extern void zfile_seterror (const TCHAR *format, ...);
extern TCHAR *zfile_geterror (void);
extern int zfile_truncate (struct zfile *z, uae_s64 size);
......@@ -106,6 +106,7 @@ extern const TCHAR *uae_diskimageextensions[];
extern struct zvolume *zfile_fopen_archive (const TCHAR *filename);
extern struct zvolume *zfile_fopen_archive2 (const TCHAR *filename, int flags);
extern struct zvolume *zfile_fopen_archive_root (const TCHAR *filename, int flags);
extern struct zvolume *zvolume_alloc_nofile (const TCHAR *name, unsigned int id, void *handle, const TCHAR *volumename);
extern void zfile_fclose_archive (struct zvolume *zv);
extern int zfile_fs_usage_archive (const TCHAR *path, const TCHAR *disk, struct fs_usage *fsp);
extern int zfile_stat_archive (const TCHAR *path, struct _stat64 *statbuf);
......@@ -121,4 +122,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*);
\ No newline at end of file
extern bool zfile_needwrite (struct zfile*);
This diff is collapsed.
/*
* UAE - The Un*x Amiga Emulator
*
* OS-specific memory support functions
*
* Copyright 2004 Richard Drummond
*/
/*
* PUAE - The Un*x Amiga Emulator
*
* OS-specific memory support functions
*
* Copyright 2004 Richard Drummond
* Copyright 2010 Mustafa Tufan
*/
#include "sysconfig.h"
#include "sysdeps.h"
......@@ -110,6 +111,13 @@ void preinit_shm (void)
uae_u64 totalphys64;
uae_u32 max_allowed_mman;
if (natmem_offset)
free (natmem_offset);
natmem_offset = NULL;
if (p96mem_offset)
free (p96mem_offset);
p96mem_offset = NULL;
#ifdef CPU_64_BIT
max_allowed_mman = 2048;
#else
......@@ -202,7 +210,7 @@ restart:
write_log ("NATMEM: retrying %d..\n", rounds);
rounds++;
if (natmem_offset)
free(natmem_offset);
free (natmem_offset);
natmem_offset = NULL;
natmem_offset_end = NULL;
canbang = 0;
......@@ -214,15 +222,17 @@ restart:
rtgbarrier = getpagesize();
if (currprefs.cpu_model >= 68020)
size = 0x10000000;
if (currprefs.z3fastmem_size || currprefs.z3fastmem2_size || currprefs.z3chipmem_size) {
z3size = currprefs.z3fastmem_size + currprefs.z3fastmem2_size + currprefs.z3chipmem_size + (currprefs.z3fastmem_start - 0x10000000);
if (currprefs.gfxmem_size)
rtgbarrier = 16 * 1024 * 1024;
if (currprefs.z3chipmem_size && (currprefs.z3fastmem_size || currprefs.z3fastmem2_size))
z3chipbarrier = 16 * 1024 * 1024;
} else {
rtgbarrier = 0;
}
if (currprefs.z3fastmem_size || currprefs.z3fastmem2_size || currprefs.z3chipmem_size) {
z3size = currprefs.z3fastmem_size + currprefs.z3fastmem2_size + currprefs.z3chipmem_size + (currprefs.z3fastmem_start - 0x10000000);
if (currprefs.gfxmem_size) {
rtgbarrier = 16 * 1024 * 1024 - ((currprefs.z3fastmem_size + currprefs.z3fastmem2_size) & 0x00ffffff);
}
if (currprefs.z3chipmem_size && (currprefs.z3fastmem_size || currprefs.z3fastmem2_size))
z3chipbarrier = 16 * 1024 * 1024;
} else {
rtgbarrier = 0;
}
totalsize = size + z3size + currprefs.gfxmem_size;
while (totalsize > size64) {
int change = lowmem ();
......@@ -265,8 +275,8 @@ restart:
write_log ("VirtualAlloc() part 2 error %d. RTG disabled.\n", errno);
currprefs.gfxmem_size = changed_prefs.gfxmem_size = 0;
rtgbarrier = getpagesize();
rtgextra = 0;
goto restart;
rtgextra = 0;
goto restart;
}
mprotect (natmem_offset, size, PROT_READ|PROT_WRITE|PROT_EXEC);
size = p96mem_size + rtgextra;
......@@ -281,11 +291,11 @@ restart:
if (!natmem_offset) {
write_log ("NATMEM: No special area could be allocated! (1) err=%d\n", errno);
} else {
write_log ("NATMEM: Our special area: 0x%p-0x%p (%08x %dM)\n",
write_log ("NATMEM: Our special area: %p-%p (%08x %dM)\n",
natmem_offset, (uae_u8*)natmem_offset + natmemsize,
natmemsize, natmemsize >> 20);
if (currprefs.gfxmem_size)
write_log ("NATMEM: P96 special area: 0x%p-0x%p (%08x %dM)\n",
write_log ("NATMEM: P96 special area: %p-%p (%08x %dM)\n",
p96mem_offset, (uae_u8*)p96mem_offset + currprefs.gfxmem_size,
currprefs.gfxmem_size, currprefs.gfxmem_size >> 20);
canbang = 1;
......@@ -489,7 +499,7 @@ void *my_shmat (int shmid, void *shmaddr, int shmflg)
if (shmids[shmid].key == shmid && shmids[shmid].size) {
shmids[shmid].mode = 0;
shmids[shmid].natmembase = natmem_offset;
write_log ("SHMAddr %s %p = 0x%p - 0x%p\n", shmids[shmid].name, (uae_u8*)shmaddr-natmem_offset, shmaddr, natmem_offset);
write_log ("SHMAddr %s %p = %p - %p\n", shmids[shmid].name, (uae_u8*)shmaddr-natmem_offset, shmaddr, natmem_offset);
// if (shmaddr)
// free (shmaddr);
result = valloc (/*shmaddr,*/ size);
......
......@@ -82,7 +82,7 @@ static void trap_HandleExtendedTrap (TrapHandler, int has_retval);
uaecptr find_trap (const TCHAR *name)
{
int i;
unsigned int i;
for (i = 0; i < trap_count; i++) {
struct Trap *trap = &traps[i];
......@@ -109,7 +109,7 @@ unsigned int define_trap (TrapHandler handler_func, int flags, const TCHAR *name
abort ();
return -1;
} else {
int i;
unsigned int i;
unsigned int trap_num;
struct Trap *trap;
uaecptr addr = here ();
......
......@@ -124,10 +124,10 @@ static uae_u32 REGPARAM2 uaeexe_server (TrapContext *context)
dst = (char*)get_real_address (ARG (0));
len = ARG (1);
s = ua (cmd);
strncpy (dst, s, len);
// s = ua (cmd);
strncpy (dst, cmd, len);
write_log ("Sending '%s' to remote cli\n", cmd);
xfree (s);
// xfree (s);
xfree (cmd);
return ARG (0);
}
......@@ -27,6 +27,8 @@
#include "audio.h"
#include "picasso96.h"
#include "version.h"
#include "filesys.h"
#include "misc.h"
/*
* Returns UAE Version
......@@ -246,10 +248,10 @@ static uae_u32 emulib_GetUaeConfig (uaecptr place)
put_byte (place + 35, 1);
for (j = 0; j < 4; j++) {
char *s = ua (currprefs.floppyslots[j].df);
// char *s = ua (currprefs.floppyslots[j].df);
for (i = 0; i < 256; i++)
put_byte (place + 36 + i + j * 256, s[i]);
xfree (s);
put_byte (place + 36 + i + j * 256, currprefs.floppyslots[j].df[i]);
// xfree (s);
}
return 1;
}
......@@ -341,7 +343,8 @@ static int native_dos_op (uae_u32 mode, uae_u32 p1, uae_u32 p2, uae_u32 p3)
{
TCHAR tmp[MAX_DPATH];
char *s;
int v, i;
int v;
unsigned int i;
if (mode)
return -1;
......@@ -351,12 +354,12 @@ static int native_dos_op (uae_u32 mode, uae_u32 p1, uae_u32 p2, uae_u32 p3)
v = get_native_path (p1, tmp);
if (v)
return v;
s = ua (tmp);
for (i = 0; i <= strlen (s) && i < p3 - 1; i++) {
put_byte (p2 + i, s[i]);
//s = ua (tmp);
for (i = 0; i <= strlen (tmp) && i < p3 - 1; i++) {
put_byte (p2 + i, tmp[i]);
put_byte (p2 + i + 1, 0);
}
xfree (s);
//xfree (s);
return 0;
}
#ifndef UAEGFX_INTERNAL
......
......@@ -96,6 +96,7 @@ void flush_log (void)
fflush (logfile ? logfile : stderr);
}
// Write Debug Log
void write_dlog (const char *format, ...)
{
......
......@@ -32,6 +32,7 @@
#include "archivers/wrp/warp.h"
#include <zlib.h>
#include <stdarg.h>
#include "misc.h"
static struct zfile *zlist = 0;
......@@ -1465,7 +1466,7 @@ static struct zfile *openzip (const TCHAR *pname)
_tcscpy (name, pname);
i = _tcslen (name) - 2;
while (i > 0) {
if (name[i] == '/' || name[i] == '\\' && i > 4) {
if ((name[i] == '/' || name[i] == '\\') && i > 4) {
v = name[i];
name[i] = 0;
for (j = 0; plugins_7z[j]; j++) {
......@@ -1989,8 +1990,8 @@ size_t zfile_fread (void *b, size_t l1, size_t l2, struct zfile *z)
l2 = (z->size - z->seek) / l1;
else
l2 = 0;
if (l2 < 0)
l2 = 0;
// if (l2 < 0)
// l2 = 0;
}
memcpy (b, z->data + z->offset + z->seek, l1 * l2);
z->seek += l1 * l2;
......@@ -2006,8 +2007,8 @@ size_t zfile_fread (void *b, size_t l1, size_t l2, struct zfile *z)
l2 = (size - v) / l1;
else
l2 = 0;
if (l2 < 0)
l2 = 0;
// if (l2 < 0)
// l2 = 0;
}
zfile_fseek (z->parent, z->seek + z->offset, SEEK_SET);
v = z->seek;
......@@ -2102,7 +2103,7 @@ TCHAR *zfile_fgets (TCHAR *s, int size, struct zfile *z)
p++;
}
*p = 0;
if (size > strlen (s2) + 1)
if ((unsigned)size > strlen (s2) + 1)
size = strlen (s2) + 1;
au_copy (s, size, s2);
return s + size;
......@@ -2112,7 +2113,7 @@ TCHAR *zfile_fgets (TCHAR *s, int size, struct zfile *z)
s1 = fgets (s2, size, z->f);
if (!s1)
return NULL;
if (size > strlen (s2) + 1)
if ((unsigned)size > strlen (s2) + 1)
size = strlen (s2) + 1;
au_copy (s, size, s2);
return s + size;
......@@ -2178,7 +2179,7 @@ int zfile_zuncompress (void *dst, int dstsize, struct zfile *src, int srcsize)
int left = srcsize - incnt;
if (left == 0)
break;
if (left > sizeof (inbuf))
if ((unsigned)left > sizeof (inbuf))
left = sizeof (inbuf);
zs.next_in = inbuf;
zs.avail_in = zfile_fread (inbuf, 1, left, src);
......@@ -2659,7 +2660,7 @@ static struct znode *get_znode (struct zvolume *zv, const TCHAR *ppath, int recu
return zn;
} else {
int len = _tcslen (zpath);
if (_tcslen (path) >= len && (path[len] == 0 || path[len] == FSDB_DIR_SEPARATOR) && !_tcsnicmp (zpath, path, len)) {
if (_tcslen (path) >= (unsigned)len && (path[len] == 0 || path[len] == FSDB_DIR_SEPARATOR) && !_tcsnicmp (zpath, path, len)) {
if (path[len] == 0)
return zn;
if (zn->vchild) {
......
......@@ -844,10 +844,10 @@ static void recurseadf (struct znode *zn, int root, TCHAR *name)
return;
if (gl (adf, 0) != 2)
break;
if (gl (adf, 1 * 4) != block)
if (gl (adf, 1 * 4) != (unsigned)block)
break;
secondary = gl (adf, bs - 1 * 4);
if (secondary != -3 && secondary != 2)
if (/*secondary != -3 &&*/ secondary != 2)
break;
memset (&zai, 0, sizeof zai);
fname = getBSTR (adf->block + bs - 20 * 4);
......@@ -860,7 +860,7 @@ static void recurseadf (struct znode *zn, int root, TCHAR *name)
}
_tcscat (name2, fname);
zai.name = name2;
if (size < 0 || size > 0x7fffffff)
if (/*size < 0 ||*/ size > 0x7fffffff)
size = 0;
zai.size = size;
zai.flags = gl (adf, bs - 48 * 4);
......@@ -1134,7 +1134,7 @@ static int sfsfindblock (struct adfhandle *adf, int btree, int theblock, struct
blocks = glx (p + 12);
else
blocks = gwx (p + 12);
if (key == theblock) {
if (key == (unsigned)theblock) {
struct sfsblock *sb;
if (*sfsblockcnt >= *sfsmaxblockcnt) {
*sfsmaxblockcnt += 100;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment