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) ...@@ -169,7 +169,7 @@ static void trim (TCHAR *s)
s[_tcslen(s) - 1] = 0; s[_tcslen(s) - 1] = 0;
} }
int isharddrive (const TCHAR *name) static int isharddrive (const TCHAR *name)
{ {
int i; int i;
...@@ -271,7 +271,8 @@ int hdf_open_target (struct hardfiledata *hfd, const char *pname) ...@@ -271,7 +271,8 @@ int hdf_open_target (struct hardfiledata *hfd, const char *pname)
i--; i--;
} }
if (h != INVALID_HANDLE_VALUE) { if (h != INVALID_HANDLE_VALUE) {
size_t ret, low; size_t ret;
int low;
ret = fseek (h, 0, SEEK_END); ret = fseek (h, 0, SEEK_END);
if (ret) if (ret)
goto end; goto end;
...@@ -478,7 +479,7 @@ int hdf_read_target (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int ...@@ -478,7 +479,7 @@ int hdf_read_target (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int
if (hfd->drive_empty) if (hfd->drive_empty)
return 0; return 0;
if (offset < hfd->virtual_size) { 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) if (!hfd->virtual_rdb)
return 0; return 0;
memcpy (buffer, hfd->virtual_rdb + offset, len2); memcpy (buffer, hfd->virtual_rdb + offset, len2);
...@@ -486,7 +487,7 @@ int hdf_read_target (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int ...@@ -486,7 +487,7 @@ int hdf_read_target (struct hardfiledata *hfd, void *buffer, uae_u64 offset, int
} }
offset -= hfd->virtual_size; offset -= hfd->virtual_size;
while (len > 0) { while (len > 0) {
int maxlen; unsigned int maxlen;
size_t ret; size_t ret;
if (hfd->physsize < CACHE_SIZE) { if (hfd->physsize < CACHE_SIZE) {
hfd->cache_valid = 0; hfd->cache_valid = 0;
......
...@@ -22,5 +22,8 @@ extern void write_log (const char *, ...) PRINTF_FORMAT; ...@@ -22,5 +22,8 @@ extern void write_log (const char *, ...) PRINTF_FORMAT;
extern void flush_log (void); extern void flush_log (void);
extern void set_logfile (const char *logfile_name); extern void set_logfile (const char *logfile_name);
extern void uae_reset (int); 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 */ #endif /* WRITELOG_H */
...@@ -66,7 +66,7 @@ extern struct zfile *zfile_gunzip (struct zfile *z); ...@@ -66,7 +66,7 @@ extern struct zfile *zfile_gunzip (struct zfile *z);
extern int zfile_is_diskimage (const TCHAR *name); extern int zfile_is_diskimage (const TCHAR *name);
extern int iszip (struct zfile *z); extern int iszip (struct zfile *z);
extern int zfile_convertimage (const TCHAR *src, const TCHAR *dst); 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 void zfile_seterror (const TCHAR *format, ...);
extern TCHAR *zfile_geterror (void); extern TCHAR *zfile_geterror (void);
extern int zfile_truncate (struct zfile *z, uae_s64 size); extern int zfile_truncate (struct zfile *z, uae_s64 size);
...@@ -106,6 +106,7 @@ extern const TCHAR *uae_diskimageextensions[]; ...@@ -106,6 +106,7 @@ extern const TCHAR *uae_diskimageextensions[];
extern struct zvolume *zfile_fopen_archive (const TCHAR *filename); 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_archive2 (const TCHAR *filename, int flags);
extern struct zvolume *zfile_fopen_archive_root (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 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_fs_usage_archive (const TCHAR *path, const TCHAR *disk, struct fs_usage *fsp);
extern int zfile_stat_archive (const TCHAR *path, struct _stat64 *statbuf); extern int zfile_stat_archive (const TCHAR *path, struct _stat64 *statbuf);
......
/* /*
* PUAE - The Un*x Amiga Emulator
*
* A collection of ugly and random stuff brought in from Win32 * A collection of ugly and random stuff brought in from Win32
* which desparately needs to be tidied up * which desparately needs to be tidied up
* *
* * Copyright 2004 Richard Drummond
* Copyright 2010-2011 Mustafa TUFAN
*/ */
#include "sysconfig.h" #include "sysconfig.h"
#include "sysdeps.h" #include "sysdeps.h"
#include "misc.h"
#include "options.h" #include "options.h"
#include "memory.h" #include "memory.h"
#include "custom.h" #include "custom.h"
...@@ -23,6 +27,9 @@ ...@@ -23,6 +27,9 @@
#include "keymap/keymap.h" #include "keymap/keymap.h"
#include "keyboard.h" #include "keyboard.h"
#include <stdarg.h> #include <stdarg.h>
#include "clipboard.h"
#include "fsdb.h"
#include "debug.h"
#define TRUE 1 #define TRUE 1
#define FALSE 0 #define FALSE 0
...@@ -61,12 +68,17 @@ static struct winuae_currentmode *currentmode = &currentmodestruct; ...@@ -61,12 +68,17 @@ static struct winuae_currentmode *currentmode = &currentmodestruct;
static int serial_period_hsyncs, serial_period_hsync_counter; static int serial_period_hsyncs, serial_period_hsync_counter;
static int data_in_serdatr; /* new data received */ static int data_in_serdatr; /* new data received */
// --- dinput.cpp START --- // dinput
int rawkeyboard = -1; int rawkeyboard = -1;
static bool rawinput_enabled_mouse, rawinput_enabled_keyboard; static bool rawinput_enabled_mouse, rawinput_enabled_keyboard;
int no_rawinput; int no_rawinput;
int is_tablet (void)
{
return tablet ? 1 : 0;
}
//win32gfx
void getgfxoffset (int *dxp, int *dyp, int *mxp, int *myp) void getgfxoffset (int *dxp, int *dyp, int *mxp, int *myp)
{ {
*dxp = 0; *dxp = 0;
...@@ -75,11 +87,6 @@ void getgfxoffset (int *dxp, int *dyp, int *mxp, int *myp) ...@@ -75,11 +87,6 @@ void getgfxoffset (int *dxp, int *dyp, int *mxp, int *myp)
*myp = 0; *myp = 0;
} }
int is_tablet (void)
{
return tablet ? 1 : 0;
}
int vsync_switchmode (int hz, int oldhz) int vsync_switchmode (int hz, int oldhz)
{ {
static int tempvsync; static int tempvsync;
...@@ -99,6 +106,7 @@ int vsync_switchmode (int hz, int oldhz) ...@@ -99,6 +106,7 @@ int vsync_switchmode (int hz, int oldhz)
hz = hz * dbl; hz = hz * dbl;
found = NULL; found = NULL;
/* for (i = 0; md->DisplayModes[i].depth >= 0 && !found; i++) { /* for (i = 0; md->DisplayModes[i].depth >= 0 && !found; i++) {
struct PicassoResolution *r = &md->DisplayModes[i]; struct PicassoResolution *r = &md->DisplayModes[i];
if (r->res.width == w && r->res.height == h && r->depth == d) { if (r->res.width == w && r->res.height == h && r->depth == d) {
...@@ -147,6 +155,7 @@ int vsync_switchmode (int hz, int oldhz) ...@@ -147,6 +155,7 @@ int vsync_switchmode (int hz, int oldhz)
return 0; return 0;
} }
// serial_win32
void serial_check_irq (void) void serial_check_irq (void)
{ {
if (data_in_serdatr) if (data_in_serdatr)
...@@ -179,6 +188,7 @@ void serial_hsynchandler (void) ...@@ -179,6 +188,7 @@ void serial_hsynchandler (void)
*/ */
} }
//win32
/* /*
static int drvsampleres[] = { static int drvsampleres[] = {
IDR_DRIVE_CLICK_A500_1, DS_CLICK, IDR_DRIVE_CLICK_A500_1, DS_CLICK,
...@@ -189,6 +199,8 @@ static int drvsampleres[] = { ...@@ -189,6 +199,8 @@ static int drvsampleres[] = {
-1 -1
}; };
*/ */
// driveclick_win32
int driveclick_loadresource (struct drvsample *sp, int drivetype) int driveclick_loadresource (struct drvsample *sp, int drivetype)
{ {
/* /*
...@@ -307,8 +319,10 @@ static int driveclick_fdrawcmd_init(int drive) ...@@ -307,8 +319,10 @@ static int driveclick_fdrawcmd_init(int drive)
uae_start_thread ("DriveClick", driveclick_thread, NULL, NULL); uae_start_thread ("DriveClick", driveclick_thread, NULL, NULL);
return 1; return 1;
*/ */
return 1;
} }
// win32
uae_u32 emulib_target_getcpurate (uae_u32 v, uae_u32 *low) uae_u32 emulib_target_getcpurate (uae_u32 v, uae_u32 *low)
{ {
#ifdef _WIN32 #ifdef _WIN32
...@@ -344,8 +358,10 @@ uae_u32 emulib_target_getcpurate (uae_u32 v, uae_u32 *low) ...@@ -344,8 +358,10 @@ uae_u32 emulib_target_getcpurate (uae_u32 v, uae_u32 *low)
return t2-t1; return t2-t1;
*/ */
#endif #endif
return 0;
} }
void setmouseactivexy (int x, int y, int dir) void setmouseactivexy (int x, int y, int dir)
{ {
/* int diff = 8; /* int diff = 8;
...@@ -378,6 +394,7 @@ void setmouseactive (int active) ...@@ -378,6 +394,7 @@ void setmouseactive (int active)
{ {
} }
// unicode
char *au_fs_copy (char *dst, int maxlen, const char *src) char *au_fs_copy (char *dst, int maxlen, const char *src)
{ {
unsigned int i; unsigned int i;
...@@ -388,6 +405,7 @@ char *au_fs_copy (char *dst, int maxlen, const char *src) ...@@ -388,6 +405,7 @@ char *au_fs_copy (char *dst, int maxlen, const char *src)
return dst; return dst;
} }
// fsdb_mywin32
int my_existsfile (const char *name) int my_existsfile (const char *name)
{ {
struct stat sonuc; struct stat sonuc;
...@@ -425,7 +443,7 @@ int my_getvolumeinfo (const char *root) ...@@ -425,7 +443,7 @@ int my_getvolumeinfo (const char *root)
return ret; return ret;
} }
// clipboard.c // clipboard
static uaecptr clipboard_data; static uaecptr clipboard_data;
static int vdelay, signaling, initialized; static int vdelay, signaling, initialized;
...@@ -465,7 +483,7 @@ void amiga_clipboard_got_data (uaecptr data, uae_u32 size, uae_u32 actual) ...@@ -465,7 +483,7 @@ void amiga_clipboard_got_data (uaecptr data, uae_u32 size, uae_u32 actual)
} }
} }
// win32
int get_guid_target (uae_u8 *out) int get_guid_target (uae_u8 *out)
{ {
unsigned Data1, Data2, Data3, Data4; unsigned Data1, Data2, Data3, Data4;
...@@ -488,10 +506,7 @@ int get_guid_target (uae_u8 *out) ...@@ -488,10 +506,7 @@ int get_guid_target (uae_u8 *out)
return 1; return 1;
} }
static int testwritewatch (void) // win32gfx
{
}
void machdep_free (void) void machdep_free (void)
{ {
} }
...@@ -501,7 +516,7 @@ void target_run (void) ...@@ -501,7 +516,7 @@ void target_run (void)
//shellexecute (currprefs.win32_commandpathstart); //shellexecute (currprefs.win32_commandpathstart);
} }
// --- dinput.cpp --- // dinput
int input_get_default_keyboard (int i) int input_get_default_keyboard (int i)
{ {
if (rawinput_enabled_keyboard) { if (rawinput_enabled_keyboard) {
...@@ -513,7 +528,7 @@ int input_get_default_keyboard (int i) ...@@ -513,7 +528,7 @@ int input_get_default_keyboard (int i)
} }
} }
// --- unicode.cpp --- // unicode
static unsigned int fscodepage; static unsigned int fscodepage;
char *ua_fs (const char *s, int defchar) char *ua_fs (const char *s, int defchar)
...@@ -528,7 +543,7 @@ char *ua_copy (char *dst, int maxlen, const char *src) ...@@ -528,7 +543,7 @@ char *ua_copy (char *dst, int maxlen, const char *src)
return dst; return dst;
} }
// --- win32gui.cpp --- // win32gui
static int qs_override; static int qs_override;
int target_cfgfile_load (struct uae_prefs *p, char *filename, int type, int isdefault) int target_cfgfile_load (struct uae_prefs *p, char *filename, int type, int isdefault)
...@@ -586,7 +601,7 @@ int target_cfgfile_load (struct uae_prefs *p, char *filename, int type, int isde ...@@ -586,7 +601,7 @@ int target_cfgfile_load (struct uae_prefs *p, char *filename, int type, int isde
return v; return v;
} }
// --- win32gfx.c // win32gfx
int screen_is_picasso = 0; int screen_is_picasso = 0;
struct uae_filter *usedfilter; struct uae_filter *usedfilter;
uae_u32 redc[3 * 256], grec[3 * 256], bluc[3 * 256]; uae_u32 redc[3 * 256], grec[3 * 256], bluc[3 * 256];
...@@ -603,7 +618,7 @@ int isfullscreen (void) ...@@ -603,7 +618,7 @@ int isfullscreen (void)
return isfullscreen_2 (&currprefs); return isfullscreen_2 (&currprefs);
} }
// --- win32.c // win32
uae_u8 *save_log (int bootlog, int *len) uae_u8 *save_log (int bootlog, int *len)
{ {
FILE *f; FILE *f;
...@@ -672,7 +687,7 @@ void refreshtitle (void) ...@@ -672,7 +687,7 @@ void refreshtitle (void)
*/ */
} }
// win32gui.c // win32gui
#define MAX_ROM_PATHS 10 #define MAX_ROM_PATHS 10
int scan_roms (int show) int scan_roms (int show)
{ {
...@@ -696,7 +711,7 @@ end: ...@@ -696,7 +711,7 @@ end:
return ret; return ret;
} }
// dinput.c // dinput
int input_get_default_lightpen (struct uae_input_device *uid, int i, int port, int af) int input_get_default_lightpen (struct uae_input_device *uid, int i, int port, int af)
{ {
/* struct didata *did; /* struct didata *did;
...@@ -782,7 +797,7 @@ void setid_af (struct uae_input_device *uid, int i, int slot, int sub, int port, ...@@ -782,7 +797,7 @@ void setid_af (struct uae_input_device *uid, int i, int slot, int sub, int port,
uid[i].flags[slot][sub] |= ID_FLAG_TOGGLE; uid[i].flags[slot][sub] |= ID_FLAG_TOGGLE;
} }
// win32.c // win32
void target_quit (void) void target_quit (void)
{ {
//shellexecute (currprefs.win32_commandpathend); //shellexecute (currprefs.win32_commandpathend);
...@@ -876,7 +891,8 @@ TCHAR *au_copy (TCHAR *dst, int maxlen, const char *src) ...@@ -876,7 +891,8 @@ TCHAR *au_copy (TCHAR *dst, int maxlen, const char *src)
memcpy (dst, src, maxlen); memcpy (dst, src, maxlen);
return dst; return dst;
} }
//writelog.cpp
// writelog
int consoleopen = 0; int consoleopen = 0;
static int realconsole = 1; static int realconsole = 1;
...@@ -913,7 +929,7 @@ void debugger_change (int mode) ...@@ -913,7 +929,7 @@ void debugger_change (int mode)
// regsetint (NULL, "DebuggerType", debugger_type); // regsetint (NULL, "DebuggerType", debugger_type);
openconsole (); openconsole ();
} }
// unicode.c // unicode
char *ua (const TCHAR *s) char *ua (const TCHAR *s)
{ {
return s; return s;
...@@ -927,7 +943,7 @@ char *utf8u (const char *s) ...@@ -927,7 +943,7 @@ char *utf8u (const char *s)
return s; return s;
} }
// fsdb_mywin32.c // fsdb_mywin32
FILE *my_opentext (const TCHAR *name) FILE *my_opentext (const TCHAR *name)
{ {
FILE *f; FILE *f;
...@@ -964,7 +980,6 @@ int ispressed (int key) ...@@ -964,7 +980,6 @@ int ispressed (int key)
return 0; return 0;
} }
static int specialkeycode (void) static int specialkeycode (void)
{ {
return 0; //currprefs.win32_specialkey; return 0; //currprefs.win32_specialkey;
...@@ -997,9 +1012,9 @@ int getcapslock (void) ...@@ -997,9 +1012,9 @@ int getcapslock (void)
int capstable[7]; int capstable[7];
// this returns bogus state if caps change when in exclusive mode.. // this returns bogus state if caps change when in exclusive mode..
/* host_capslockstate = GetKeyState (VK_CAPITAL) & 1; host_capslockstate = 1; //GetKeyState (VK_CAPITAL) & 1;
host_numlockstate = GetKeyState (VK_NUMLOCK) & 1; host_numlockstate = 0; //GetKeyState (VK_NUMLOCK) & 1;
host_scrolllockstate = GetKeyState (VK_SCROLL) & 1;*/ host_scrolllockstate = 0; //GetKeyState (VK_SCROLL) & 1;
capstable[0] = DIK_CAPITAL; capstable[0] = DIK_CAPITAL;
capstable[1] = host_capslockstate; capstable[1] = host_capslockstate;
capstable[2] = DIK_NUMLOCK; capstable[2] = DIK_NUMLOCK;
...@@ -1030,17 +1045,22 @@ void my_kbd_handler (int keyboard, int scancode, int newstate) ...@@ -1030,17 +1045,22 @@ void my_kbd_handler (int keyboard, int scancode, int newstate)
if (scancode == specialkeycode ()) if (scancode == specialkeycode ())
return; return;
/* if (scancode == DIK_F11 && currprefs.win32_ctrl_F11_is_quit && ctrlpressed ()) #ifdef WIN32
code = AKS_QUIT;*/ if (scancode == DIK_F11 && currprefs.win32_ctrl_F11_is_quit && ctrlpressed ())
code = AKS_QUIT;
#endif
scancode_new = scancode; scancode_new = scancode;
if (!specialpressed () && inputdevice_iskeymapped (keyboard, scancode)) if (!specialpressed () && inputdevice_iskeymapped (keyboard, scancode))
scancode = 0; scancode = 0;
#ifdef WIN32
// GUI must be always available // GUI must be always available
/* if (scancode_new == DIK_F12 && currprefs.win32_guikey < 0) if (scancode_new == DIK_F12 && currprefs.win32_guikey < 0)
scancode = scancode_new; scancode = scancode_new;
if (scancode_new == currprefs.win32_guikey && scancode_new != DIK_F12) if (scancode_new == currprefs.win32_guikey && scancode_new != DIK_F12)
scancode = scancode_new;*/ scancode = scancode_new;
#endif
// write_log ("kbd1 = %d, scancode = %d (0x%02x), state = %d\n", keyboard, scancode, scancode, newstate); // write_log ("kbd1 = %d, scancode = %d (0x%02x), state = %d\n", keyboard, scancode, scancode, newstate);
...@@ -1053,7 +1073,6 @@ void my_kbd_handler (int keyboard, int scancode, int newstate) ...@@ -1053,7 +1073,6 @@ void my_kbd_handler (int keyboard, int scancode, int newstate)
} }
} }
if (newstate && code == 0) { if (newstate && code == 0) {
if (scancode == DIK_F12 /*|| scancode == currprefs.win32_guikey*/) { if (scancode == DIK_F12 /*|| scancode == currprefs.win32_guikey*/) {
if (ctrlpressed ()) { if (ctrlpressed ()) {
...@@ -1198,7 +1217,7 @@ void my_kbd_handler (int keyboard, int scancode, int newstate) ...@@ -1198,7 +1217,7 @@ void my_kbd_handler (int keyboard, int scancode, int newstate)
} }
scancode = scancode_new; scancode = scancode_new;
/* if (!specialpressed () && newstate) { if (!specialpressed () && newstate) {
if (scancode == DIK_CAPITAL) { if (scancode == DIK_CAPITAL) {
host_capslockstate = host_capslockstate ? 0 : 1; host_capslockstate = host_capslockstate ? 0 : 1;
capslockstate = host_capslockstate; capslockstate = host_capslockstate;
...@@ -1211,7 +1230,7 @@ void my_kbd_handler (int keyboard, int scancode, int newstate) ...@@ -1211,7 +1230,7 @@ void my_kbd_handler (int keyboard, int scancode, int newstate)
host_scrolllockstate = host_scrolllockstate ? 0 : 1; host_scrolllockstate = host_scrolllockstate ? 0 : 1;
capslockstate = host_scrolllockstate; capslockstate = host_scrolllockstate;
} }
}*/ }
if (specialpressed ()) if (specialpressed ())
return; return;
...@@ -1220,7 +1239,7 @@ void my_kbd_handler (int keyboard, int scancode, int newstate) ...@@ -1220,7 +1239,7 @@ void my_kbd_handler (int keyboard, int scancode, int newstate)
inputdevice_translatekeycode (keyboard, scancode, newstate); inputdevice_translatekeycode (keyboard, scancode, newstate);
} }
//win32gfx // win32gfx
#define MAX_DISPLAYS 10 #define MAX_DISPLAYS 10
struct MultiDisplay Displays[MAX_DISPLAYS]; struct MultiDisplay Displays[MAX_DISPLAYS];
...@@ -1309,7 +1328,7 @@ void addmode (struct MultiDisplay *md, int w, int h, int d, int rate, int nondx) ...@@ -1309,7 +1328,7 @@ void addmode (struct MultiDisplay *md, int w, int h, int d, int rate, int nondx)
md->DisplayModes[i].res.width, md->DisplayModes[i].res.height, md->DisplayModes[i].depth * 8); md->DisplayModes[i].res.width, md->DisplayModes[i].res.height, md->DisplayModes[i].depth * 8);
} }
//dxwrap // dxwrap
int DirectDraw_CurrentRefreshRate (void) int DirectDraw_CurrentRefreshRate (void)
{ {
//DirectDraw_GetDisplayMode (); //DirectDraw_GetDisplayMode ();
...@@ -1331,7 +1350,7 @@ int D3D_goodenough (void) ...@@ -1331,7 +1350,7 @@ int D3D_goodenough (void)
return 0; return 0;
} }
//debug_win32 // debug_win32
void update_debug_info(void) void update_debug_info(void)
{ {
} }
/* /*
* UAE - The Un*x Amiga Emulator * PUAE - The Un*x Amiga Emulator
* *
* OS-specific memory support functions * OS-specific memory support functions
* *
* Copyright 2004 Richard Drummond * Copyright 2004 Richard Drummond
* Copyright 2010 Mustafa Tufan
*/ */
#include "sysconfig.h" #include "sysconfig.h"
...@@ -110,6 +111,13 @@ void preinit_shm (void) ...@@ -110,6 +111,13 @@ void preinit_shm (void)
uae_u64 totalphys64; uae_u64 totalphys64;
uae_u32 max_allowed_mman; 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 #ifdef CPU_64_BIT
max_allowed_mman = 2048; max_allowed_mman = 2048;
#else #else
...@@ -202,7 +210,7 @@ restart: ...@@ -202,7 +210,7 @@ restart:
write_log ("NATMEM: retrying %d..\n", rounds); write_log ("NATMEM: retrying %d..\n", rounds);
rounds++; rounds++;
if (natmem_offset) if (natmem_offset)
free(natmem_offset); free (natmem_offset);
natmem_offset = NULL; natmem_offset = NULL;
natmem_offset_end = NULL; natmem_offset_end = NULL;
canbang = 0; canbang = 0;
...@@ -216,13 +224,15 @@ restart: ...@@ -216,13 +224,15 @@ restart:
size = 0x10000000; size = 0x10000000;
if (currprefs.z3fastmem_size || currprefs.z3fastmem2_size || currprefs.z3chipmem_size) { if (currprefs.z3fastmem_size || currprefs.z3fastmem2_size || currprefs.z3chipmem_size) {
z3size = currprefs.z3fastmem_size + currprefs.z3fastmem2_size + currprefs.z3chipmem_size + (currprefs.z3fastmem_start - 0x10000000); z3size = currprefs.z3fastmem_size + currprefs.z3fastmem2_size + currprefs.z3chipmem_size + (currprefs.z3fastmem_start - 0x10000000);
if (currprefs.gfxmem_size) if (currprefs.gfxmem_size) {
rtgbarrier = 16 * 1024 * 1024; rtgbarrier = 16 * 1024 * 1024 - ((currprefs.z3fastmem_size + currprefs.z3fastmem2_size) & 0x00ffffff);
}
if (currprefs.z3chipmem_size && (currprefs.z3fastmem_size || currprefs.z3fastmem2_size)) if (currprefs.z3chipmem_size && (currprefs.z3fastmem_size || currprefs.z3fastmem2_size))
z3chipbarrier = 16 * 1024 * 1024; z3chipbarrier = 16 * 1024 * 1024;
} else { } else {
rtgbarrier = 0; rtgbarrier = 0;
} }
totalsize = size + z3size + currprefs.gfxmem_size; totalsize = size + z3size + currprefs.gfxmem_size;
while (totalsize > size64) { while (totalsize > size64) {
int change = lowmem (); int change = lowmem ();
...@@ -281,11 +291,11 @@ restart: ...@@ -281,11 +291,11 @@ restart:
if (!natmem_offset) { if (!natmem_offset) {
write_log ("NATMEM: No special area could be allocated! (1) err=%d\n", errno); write_log ("NATMEM: No special area could be allocated! (1) err=%d\n", errno);
} else { } 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, natmem_offset, (uae_u8*)natmem_offset + natmemsize,
natmemsize, natmemsize >> 20); natmemsize, natmemsize >> 20);
if (currprefs.gfxmem_size) 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, p96mem_offset, (uae_u8*)p96mem_offset + currprefs.gfxmem_size,
currprefs.gfxmem_size, currprefs.gfxmem_size >> 20); currprefs.gfxmem_size, currprefs.gfxmem_size >> 20);
canbang = 1; canbang = 1;
...@@ -489,7 +499,7 @@ void *my_shmat (int shmid, void *shmaddr, int shmflg) ...@@ -489,7 +499,7 @@ void *my_shmat (int shmid, void *shmaddr, int shmflg)
if (shmids[shmid].key == shmid && shmids[shmid].size) { if (shmids[shmid].key == shmid && shmids[shmid].size) {
shmids[shmid].mode = 0; shmids[shmid].mode = 0;
shmids[shmid].natmembase = natmem_offset; 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) // if (shmaddr)
// free (shmaddr); // free (shmaddr);
result = valloc (/*shmaddr,*/ size); result = valloc (/*shmaddr,*/ size);
......
...@@ -82,7 +82,7 @@ static void trap_HandleExtendedTrap (TrapHandler, int has_retval); ...@@ -82,7 +82,7 @@ static void trap_HandleExtendedTrap (TrapHandler, int has_retval);
uaecptr find_trap (const TCHAR *name) uaecptr find_trap (const TCHAR *name)
{ {
int i; unsigned int i;
for (i = 0; i < trap_count; i++) { for (i = 0; i < trap_count; i++) {
struct Trap *trap = &traps[i]; struct Trap *trap = &traps[i];
...@@ -109,7 +109,7 @@ unsigned int define_trap (TrapHandler handler_func, int flags, const TCHAR *name ...@@ -109,7 +109,7 @@ unsigned int define_trap (TrapHandler handler_func, int flags, const TCHAR *name
abort (); abort ();
return -1; return -1;
} else { } else {
int i; unsigned int i;
unsigned int trap_num; unsigned int trap_num;
struct Trap *trap; struct Trap *trap;
uaecptr addr = here (); uaecptr addr = here ();
......
...@@ -124,10 +124,10 @@ static uae_u32 REGPARAM2 uaeexe_server (TrapContext *context) ...@@ -124,10 +124,10 @@ static uae_u32 REGPARAM2 uaeexe_server (TrapContext *context)
dst = (char*)get_real_address (ARG (0)); dst = (char*)get_real_address (ARG (0));
len = ARG (1); len = ARG (1);
s = ua (cmd); // s = ua (cmd);
strncpy (dst, s, len); strncpy (dst, cmd, len);
write_log ("Sending '%s' to remote cli\n", cmd); write_log ("Sending '%s' to remote cli\n", cmd);
xfree (s); // xfree (s);
xfree (cmd); xfree (cmd);
return ARG (0); return ARG (0);
} }
...@@ -27,6 +27,8 @@ ...@@ -27,6 +27,8 @@
#include "audio.h" #include "audio.h"
#include "picasso96.h" #include "picasso96.h"
#include "version.h" #include "version.h"
#include "filesys.h"
#include "misc.h"
/* /*
* Returns UAE Version * Returns UAE Version
...@@ -246,10 +248,10 @@ static uae_u32 emulib_GetUaeConfig (uaecptr place) ...@@ -246,10 +248,10 @@ static uae_u32 emulib_GetUaeConfig (uaecptr place)
put_byte (place + 35, 1); put_byte (place + 35, 1);
for (j = 0; j < 4; j++) { 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++) for (i = 0; i < 256; i++)
put_byte (place + 36 + i + j * 256, s[i]); put_byte (place + 36 + i + j * 256, currprefs.floppyslots[j].df[i]);
xfree (s); // xfree (s);
} }
return 1; return 1;
} }
...@@ -341,7 +343,8 @@ static int native_dos_op (uae_u32 mode, uae_u32 p1, uae_u32 p2, uae_u32 p3) ...@@ -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]; TCHAR tmp[MAX_DPATH];
char *s; char *s;
int v, i; int v;
unsigned int i;
if (mode) if (mode)
return -1; return -1;
...@@ -351,12 +354,12 @@ static int native_dos_op (uae_u32 mode, uae_u32 p1, uae_u32 p2, uae_u32 p3) ...@@ -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); v = get_native_path (p1, tmp);
if (v) if (v)
return v; return v;
s = ua (tmp); //s = ua (tmp);
for (i = 0; i <= strlen (s) && i < p3 - 1; i++) { for (i = 0; i <= strlen (tmp) && i < p3 - 1; i++) {
put_byte (p2 + i, s[i]); put_byte (p2 + i, tmp[i]);
put_byte (p2 + i + 1, 0); put_byte (p2 + i + 1, 0);
} }
xfree (s); //xfree (s);
return 0; return 0;
} }
#ifndef UAEGFX_INTERNAL #ifndef UAEGFX_INTERNAL
......
...@@ -96,6 +96,7 @@ void flush_log (void) ...@@ -96,6 +96,7 @@ void flush_log (void)
fflush (logfile ? logfile : stderr); fflush (logfile ? logfile : stderr);
} }
// Write Debug Log
void write_dlog (const char *format, ...) void write_dlog (const char *format, ...)
{ {
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include "archivers/wrp/warp.h" #include "archivers/wrp/warp.h"
#include <zlib.h> #include <zlib.h>
#include <stdarg.h> #include <stdarg.h>
#include "misc.h"
static struct zfile *zlist = 0; static struct zfile *zlist = 0;
...@@ -1465,7 +1466,7 @@ static struct zfile *openzip (const TCHAR *pname) ...@@ -1465,7 +1466,7 @@ static struct zfile *openzip (const TCHAR *pname)
_tcscpy (name, pname); _tcscpy (name, pname);
i = _tcslen (name) - 2; i = _tcslen (name) - 2;
while (i > 0) { while (i > 0) {
if (name[i] == '/' || name[i] == '\\' && i > 4) { if ((name[i] == '/' || name[i] == '\\') && i > 4) {
v = name[i]; v = name[i];
name[i] = 0; name[i] = 0;
for (j = 0; plugins_7z[j]; j++) { 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) ...@@ -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; l2 = (z->size - z->seek) / l1;
else else
l2 = 0; l2 = 0;
if (l2 < 0) // if (l2 < 0)
l2 = 0; // l2 = 0;
} }
memcpy (b, z->data + z->offset + z->seek, l1 * l2); memcpy (b, z->data + z->offset + z->seek, l1 * l2);
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) ...@@ -2006,8 +2007,8 @@ size_t zfile_fread (void *b, size_t l1, size_t l2, struct zfile *z)
l2 = (size - v) / l1; l2 = (size - v) / l1;
else else
l2 = 0; l2 = 0;
if (l2 < 0) // if (l2 < 0)
l2 = 0; // l2 = 0;
} }
zfile_fseek (z->parent, z->seek + z->offset, SEEK_SET); zfile_fseek (z->parent, z->seek + z->offset, SEEK_SET);
v = z->seek; v = z->seek;
...@@ -2102,7 +2103,7 @@ TCHAR *zfile_fgets (TCHAR *s, int size, struct zfile *z) ...@@ -2102,7 +2103,7 @@ TCHAR *zfile_fgets (TCHAR *s, int size, struct zfile *z)
p++; p++;
} }
*p = 0; *p = 0;
if (size > strlen (s2) + 1) if ((unsigned)size > strlen (s2) + 1)
size = strlen (s2) + 1; size = strlen (s2) + 1;
au_copy (s, size, s2); au_copy (s, size, s2);
return s + size; return s + size;
...@@ -2112,7 +2113,7 @@ TCHAR *zfile_fgets (TCHAR *s, int size, struct zfile *z) ...@@ -2112,7 +2113,7 @@ TCHAR *zfile_fgets (TCHAR *s, int size, struct zfile *z)
s1 = fgets (s2, size, z->f); s1 = fgets (s2, size, z->f);
if (!s1) if (!s1)
return NULL; return NULL;
if (size > strlen (s2) + 1) if ((unsigned)size > strlen (s2) + 1)
size = strlen (s2) + 1; size = strlen (s2) + 1;
au_copy (s, size, s2); au_copy (s, size, s2);
return s + size; return s + size;
...@@ -2178,7 +2179,7 @@ int zfile_zuncompress (void *dst, int dstsize, struct zfile *src, int srcsize) ...@@ -2178,7 +2179,7 @@ int zfile_zuncompress (void *dst, int dstsize, struct zfile *src, int srcsize)
int left = srcsize - incnt; int left = srcsize - incnt;
if (left == 0) if (left == 0)
break; break;
if (left > sizeof (inbuf)) if ((unsigned)left > sizeof (inbuf))
left = sizeof (inbuf); left = sizeof (inbuf);
zs.next_in = inbuf; zs.next_in = inbuf;
zs.avail_in = zfile_fread (inbuf, 1, left, src); 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 ...@@ -2659,7 +2660,7 @@ static struct znode *get_znode (struct zvolume *zv, const TCHAR *ppath, int recu
return zn; return zn;
} else { } else {
int len = _tcslen (zpath); 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) if (path[len] == 0)
return zn; return zn;
if (zn->vchild) { if (zn->vchild) {
......
...@@ -844,10 +844,10 @@ static void recurseadf (struct znode *zn, int root, TCHAR *name) ...@@ -844,10 +844,10 @@ static void recurseadf (struct znode *zn, int root, TCHAR *name)
return; return;
if (gl (adf, 0) != 2) if (gl (adf, 0) != 2)
break; break;
if (gl (adf, 1 * 4) != block) if (gl (adf, 1 * 4) != (unsigned)block)
break; break;
secondary = gl (adf, bs - 1 * 4); secondary = gl (adf, bs - 1 * 4);
if (secondary != -3 && secondary != 2) if (/*secondary != -3 &&*/ secondary != 2)
break; break;
memset (&zai, 0, sizeof zai); memset (&zai, 0, sizeof zai);
fname = getBSTR (adf->block + bs - 20 * 4); fname = getBSTR (adf->block + bs - 20 * 4);
...@@ -860,7 +860,7 @@ static void recurseadf (struct znode *zn, int root, TCHAR *name) ...@@ -860,7 +860,7 @@ static void recurseadf (struct znode *zn, int root, TCHAR *name)
} }
_tcscat (name2, fname); _tcscat (name2, fname);
zai.name = name2; zai.name = name2;
if (size < 0 || size > 0x7fffffff) if (/*size < 0 ||*/ size > 0x7fffffff)
size = 0; size = 0;
zai.size = size; zai.size = size;
zai.flags = gl (adf, bs - 48 * 4); zai.flags = gl (adf, bs - 48 * 4);
...@@ -1134,7 +1134,7 @@ static int sfsfindblock (struct adfhandle *adf, int btree, int theblock, struct ...@@ -1134,7 +1134,7 @@ static int sfsfindblock (struct adfhandle *adf, int btree, int theblock, struct
blocks = glx (p + 12); blocks = glx (p + 12);
else else
blocks = gwx (p + 12); blocks = gwx (p + 12);
if (key == theblock) { if (key == (unsigned)theblock) {
struct sfsblock *sb; struct sfsblock *sb;
if (*sfsblockcnt >= *sfsmaxblockcnt) { if (*sfsblockcnt >= *sfsmaxblockcnt) {
*sfsmaxblockcnt += 100; *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