puae 2.3.0

This commit is contained in:
Mustafa 'GnoStiC' TUFAN 2010-08-31 16:04:17 +03:00
parent 0ca2fccc7e
commit 9e3242b4d3
27 changed files with 3259 additions and 2936 deletions

View File

@ -554,29 +554,36 @@ static bool isaudiotrack (int startlsn)
return true;
}
static struct cd_toc *get_track (int startlsn)
{
unsigned int i;
for (i = cdrom_toc_cd_buffer.first_track_offset + 1; i <= cdrom_toc_cd_buffer.last_track_offset; i++) {
struct cd_toc *s = &cdrom_toc_cd_buffer.toc[i];
uae_u32 addr = s->paddress;
if (startlsn < addr)
return s - 1;
}
return NULL;
}
static int last_play_end;
static int cd_play_audio (int startlsn, int endlsn, int scan)
{
struct cd_toc *s = NULL;
uae_u32 addr;
int i;
if (!cdrom_toc_cd_buffer.points)
return 0;
for (i = cdrom_toc_cd_buffer.first_track_offset; i <= cdrom_toc_cd_buffer.last_track_offset; i++) {
s = &cdrom_toc_cd_buffer.toc[i];
addr = s->paddress;
if (s->track > 0 && s->track < 100 && addr >= startlsn)
break;
}
s = get_track (startlsn);
if (s && (s->control & 0x0c) == 0x04) {
write_log ("tried to play data track %d!\n", s->track);
s++;
s = get_track (startlsn + 150);
if (s && (s->control & 0x0c) == 0x04) {
write_log ("tried to play data track %d!\n", s->track);
s++;
startlsn = s->paddress;
s++;
endlsn = s->paddress;
}
startlsn = s->paddress;
s++;
endlsn = s->paddress;
return 0;
}
qcode_valid = 0;
last_play_end = endlsn;
@ -1843,17 +1850,6 @@ void restore_akiko_finish (void)
#endif
void akiko_entergui (void)
{
if (cdrom_playing)
write_comm_pipe_u32 (&requests, 0x0102, 1);
}
void akiko_exitgui (void)
{
if (cdrom_playing)
write_comm_pipe_u32 (&requests, 0x0103, 1);
}
void akiko_mute (int muted)
{
cdrom_muted = muted;

View File

@ -156,3 +156,5 @@ void amax_init (void)
}
#endif //ifdef amax

View File

@ -633,7 +633,7 @@ end:
static void cdda_stop (struct cdunit *cdu)
{
if (cdu->cdda_play > 0) {
if (cdu->cdda_play != 0) {
cdu->cdda_play = -1;
while (cdu->cdda_play) {
Sleep (10);
@ -787,7 +787,11 @@ static int command_rawread (int unitnum, uae_u8 *data, int sector, int size, int
} else if (sectorsize == 2336 && t->size == 2352) {
// 2352 -> 2336
while (size-- > 0) {
zfile_fseek (t->handle, t->offset + sector * t->size + 16, SEEK_SET);
uae_u8 b = 0;
zfile_fseek (t->handle, t->offset + sector * t->size + 15, SEEK_SET);
zfile_fread (&b, 1, 1, t->handle);
if (b != 2 && b != 0) // MODE0 or MODE2 only allowed
return 0;
zfile_fread (data, sectorsize, 1, t->handle);
sector++;
data += sectorsize;
@ -801,8 +805,8 @@ static int command_rawread (int unitnum, uae_u8 *data, int sector, int size, int
cdu->cd_last_pos = sector;
ret = sectorsize * size;
} else {
uae_u8 sectortype = extra >> 16;
uae_u8 cmd9 = extra >> 8;
int sync = (cmd9 >> 7) & 1;
@ -1141,7 +1145,7 @@ static int parsemds (struct cdunit *cdu, struct zfile *zmds, const TCHAR *img)
}
if (tb->subchannel && t->handle) {
t->suboffset = t->offset + t->size;
t->suboffset = t->size;
t->subcode = 1; // interleaved
t->subhandle = zfile_dup (t->handle);
t->skipsize = SUB_CHANNEL_SIZE;
@ -1286,6 +1290,8 @@ static int parseccd (struct cdunit *cdu, struct zfile *zcue, const TCHAR *img)
}
}
zfile_fclose (zimg);
zfile_fclose (zsub);
return cdu->tracks;
}
@ -1326,7 +1332,7 @@ static int parsecue (struct cdunit *cdu, struct zfile *zcue, const TCHAR *img)
fnametypeid = AUDENC_NONE;
if (!fnametype)
break;
if (_tcsicmp (fnametype, "BINARY") && _tcsicmp (fnametype, "WAVE") && _tcsicmp (fnametype, "MP3")) {
if (_tcsicmp (fnametype, "BINARY") && _tcsicmp (fnametype, "WAVE") && _tcsicmp (fnametype, "MP3") && _tcsicmp (fnametype, "FLAC")) {
write_log ("CUE: unknown file type '%s' ('%s')\n", fnametype, fname);
}
fnametypeid = AUDENC_PCM;
@ -1657,7 +1663,7 @@ static void unload_image (struct cdunit *cdu)
{
int i;
for (i = 0; i < cdu->tracks; i++) {
for (i = 0; i < sizeof cdu->toc / sizeof (struct cdtoc); i++) {
struct cdtoc *t = &cdu->toc[i];
zfile_fclose (t->handle);
if (t->handle != t->subhandle)
@ -1701,8 +1707,6 @@ static void close_device (int unitnum)
struct cdunit *cdu = &cdunits[unitnum];
if (cdu->open) {
cdda_stop (cdu);
unload_image (cdu);
uae_sem_destroy (&cdu->sub_sem);
cdu->open = false;
if (cdimage_unpack_thread) {
cdimage_unpack_thread = 0;
@ -1713,6 +1717,8 @@ static void close_device (int unitnum)
cdimage_unpack_thread = 0;
destroy_comm_pipe (&unpack_pipe);
}
unload_image (cdu);
uae_sem_destroy (&cdu->sub_sem);
}
blkdev_cd_change (unitnum, currprefs.cdslots[unitnum].name);
}

View File

@ -770,7 +770,6 @@ static uae_u32 REGPARAM2 bsdsocklib_ReleaseSocket (TrapContext *context)
sockdata->sockpoolflags[i] = flags;
BSDTRACE (("id %d s 0x%x\n", id,s));
} else {
BSDTRACE (("[invalid socket descriptor]\n"));
return -1;

View File

@ -13,6 +13,7 @@
#include "uae.h"
#include "zfile.h"
#define DRIVER
#include <catweasl_usr.h>
struct catweasel_contr cwc;
@ -297,16 +298,17 @@ uae_u32 catweasel_do_bget (uaecptr addr)
return buf2[0];
}
void catweasel_do_bput (uaecptr addr, uae_u32 b)
void catweasel_do_bput (uaecptr addr, uae_u32 b)
{
if (addr >= 0x100)
return;
#if 0
uae_u8 buf[2];
DWORD did_read = 0;
buf[0] = (uae_u8)addr;
buf[1] = b;
#if 0
if (handle != INVALID_HANDLE_VALUE) {
if (!DeviceIoControl (handle, CW_POKEREG_FULL, buf, 2, 0, 0, &did_read, 0))
write_log ("catweasel_do_bput %02x=%02x fail err=%d\n", buf[0], buf[1], GetLastError ());

View File

@ -200,6 +200,8 @@ static int pause_audio (int pause)
static int read_sectors (int start, int length)
{
if (cd_playing)
cdaudiostop ();
#ifdef CDTV_DEBUG_CMD
write_log ("READ DATA sector %d, %d sectors (blocksize=%d)\n", start, length, cdtv_sectorsize);
#endif
@ -209,8 +211,6 @@ static int read_sectors (int start, int length)
cdrom_length = length * cdtv_sectorsize;
cd_motor = 1;
cd_audio_status = AUDIO_STATUS_NOT_SUPPORTED;
if (cd_playing)
cdaudiostop ();
return 0;
}
@ -474,7 +474,7 @@ static int read_toc (int track, int msflsn, uae_u8 *out)
static int cdrom_modeset (uae_u8 *cmd)
{
cdtv_sectorsize = (cmd[2] << 8) | cmd[3];
if (cdtv_sectorsize != 2048 && cdtv_sectorsize != 2336) {
if (cdtv_sectorsize != 2048 && cdtv_sectorsize != 2336 && cdtv_sectorsize != 2352 && cdtv_sectorsize != 2328) {
write_log ("CDTV: tried to set unknown sector size %d\n", cdtv_sectorsize);
cdtv_sectorsize = 2048;
}
@ -633,49 +633,6 @@ static void cdrom_command_thread (uae_u8 b)
}
}
static int read_raw (int sector, uae_u8 *dst, int blocksize)
{
int osector = sector - 150;
static struct zfile *f;
static int track;
int trackcnt;
TCHAR fname[MAX_DPATH];
uae_u32 prevlsn = 0;
struct cd_toc *t = &toc.toc[0];
trackcnt = 0;
for (;;) {
int lsn = t->paddress;
if (t->point >= 0xa0) {
t++;
continue;
}
if (sector < lsn - prevlsn)
break;
trackcnt++;
sector -= lsn - prevlsn;
prevlsn = lsn;
t++;
}
if (track != trackcnt) {
_stprintf (fname, "track%d.bin", trackcnt);
zfile_fclose (f);
f = zfile_fopen (fname, "rb", ZFD_NORMAL);
if (f)
write_log ("opened '%s'\n", fname);
else
write_log ("failed to open '%s'\n", fname);
track = trackcnt;
}
if (f) {
write_log ("CDTV fakeraw: %dx%d=%d\n", sector, blocksize, sector * blocksize);
zfile_fseek (f, sector * blocksize, SEEK_SET);
zfile_fread (dst, blocksize, 1, f);
return 1;
}
return sys_command_cd_rawread (unitnum, dst, osector, blocksize, 1);
}
static void dma_do_thread (void)
{
static int readsector;
@ -697,10 +654,8 @@ static void dma_do_thread (void)
uae_u8 buffer[2352];
if (!didread || readsector != (cdrom_offset / cdtv_sectorsize)) {
readsector = cdrom_offset / cdtv_sectorsize;
// if (readsector > 3000)
// write_log ("");
if (cdtv_sectorsize != 2048)
didread = read_raw (readsector, buffer, cdtv_sectorsize);
didread = sys_command_cd_rawread (unitnum, buffer, readsector, 1, cdtv_sectorsize);
else
didread = sys_command_cd_read (unitnum, buffer, readsector, 1);
if (!didread) {

View File

@ -1323,7 +1323,8 @@ static int cfgfile_parse_host (struct uae_prefs *p, TCHAR *option, TCHAR *value)
*next2++ = 0;
cfgfile_intval (option, next, tmp, &unitnum, 1);
}
_tcsncpy (p->cdslots[i].name, value, sizeof p->cdslots[i].name / sizeof (TCHAR));
if (_tcslen (value) > 0)
_tcsncpy (p->cdslots[i].name, value, sizeof p->cdslots[i].name / sizeof (TCHAR));
p->cdslots[i].name[sizeof p->cdslots[i].name - 1] = 0;
p->cdslots[i].inuse = true;
p->cdslots[i].type = type;
@ -3050,8 +3051,8 @@ int parse_cmdline_option (struct uae_prefs *p, TCHAR c, const TCHAR *arg)
case '2': cmdpath (p->floppyslots[2].df, arg, 255); break;
case '3': cmdpath (p->floppyslots[3].df, arg, 255); break;
case 'r': cmdpath (p->romfile, arg, 255); break;
case 'K': strncpy (p->keyfile, arg, 255); p->keyfile[255] = 0; break;
case 'p': cmdpath (p->prtname, arg, 255); break;
case 'K': cmdpath (p->romextfile, arg, 255); break;
case 'p': _tcsncpy (p->prtname, arg, 255); p->prtname[255] = 0; break;
case 'I': cmdpath (p->sername, arg, 255); currprefs.use_serial = 1; break;
case 'm': case 'M': parse_filesys_spec (p, c == 'M', arg); break;
case 'W': parse_hardfile_spec (p, arg); break;
@ -3500,7 +3501,6 @@ uae_u32 cfgfile_uaelib_modify (uae_u32 index, uae_u32 parms, uae_u32 size, uae_u
break;
}
p[i] = 0;
out_p[0] = 0;
ret = cfgfile_modify (index, parms_p, size, out_p, outsize);
if (out) {
p = out_p;

View File

@ -122,7 +122,7 @@ uae_u8 need_to_preserve[]={1,1,1,1,0,1,1,1};
//#include "compemu_optimizer_x86.c"
STATIC_INLINE uae_u16 swap16 (uae_u16 x)
STATIC_INLINE uae_u16 swap16(uae_u16 x)
{
return ((x&0xff00)>>8)|((x&0x00ff)<<8);
}
@ -1702,7 +1702,7 @@ static uae_u8 *veccode;
#endif
extern int mman_guard_exception (LPEXCEPTION_POINTERS);
int EvalException ( LPEXCEPTION_POINTERS blah, int n_except )
int EvalException (LPEXCEPTION_POINTERS blah, int n_except)
{
PEXCEPTION_RECORD pExceptRecord = NULL;
PCONTEXT pContext = NULL;
@ -1853,11 +1853,11 @@ int EvalException ( LPEXCEPTION_POINTERS blah, int n_except )
#ifdef JIT_DEBUG
if ((addr>=0x10000000 && addr<0x40000000) ||
(addr>=0x50000000)) {
write_log ("JIT: Suspicious address 0x%x in SEGV handler.\n",addr);
write_log ("JIT: Suspicious address 0x%x in SEGV handler.\n",addr);
}
#endif
if (dir==SIG_READ) {
switch(size) {
switch (size) {
case 1: *((uae_u8*)pr)=get_byte (addr); break;
case 2: *((uae_u16*)pr)=swap16(get_word (addr)); break;
case 4: *((uae_u32*)pr)=swap32(get_long (addr)); break;
@ -1865,7 +1865,7 @@ int EvalException ( LPEXCEPTION_POINTERS blah, int n_except )
}
}
else { /* write */
switch(size) {
switch (size) {
case 1: put_byte (addr,*((uae_u8*)pr)); break;
case 2: put_word (addr,swap16(*((uae_u16*)pr))); break;
case 4: put_long (addr,swap32(*((uae_u32*)pr))); break;
@ -1889,7 +1889,7 @@ int EvalException ( LPEXCEPTION_POINTERS blah, int n_except )
#ifdef JIT_DEBUG
if ((addr>=0x10000000 && addr<0x40000000) ||
(addr>=0x50000000)) {
write_log ("JIT: Suspicious address 0x%x in SEGV handler.\n",addr);
write_log ("JIT: Suspicious address 0x%x in SEGV handler.\n",addr);
}
#endif
@ -2262,7 +2262,7 @@ static void vec(int x, struct sigcontext sc)
#endif
signal(SIGSEGV,SIG_DFL); /* returning here will cause a "real" SEGV */
}
# endif
#endif
#endif
/*************************************************************************
@ -2270,15 +2270,15 @@ static void vec(int x, struct sigcontext sc)
*************************************************************************/
struct cpuinfo_x86 {
uae_u8 x86; // CPU family
uae_u8 x86_vendor; // CPU vendor
uae_u8 x86; // CPU family
uae_u8 x86_vendor; // CPU vendor
uae_u8 x86_processor; // CPU canonical processor type
uae_u8 x86_brand_id; // CPU BrandID if supported, yield 0 otherwise
uae_u32 x86_hwcap;
uae_u8 x86_model;
uae_u8 x86_mask;
int cpuid_level; // Maximum supported CPUID level, -1=no CPUID
char x86_vendor_id[16];
int cpuid_level; // Maximum supported CPUID level, -1=no CPUID
char x86_vendor_id[16];
};
struct cpuinfo_x86 cpuinfo;
@ -2391,7 +2391,7 @@ static void cpuid (uae_u32 op, uae_u32 *eax, uae_u32 *ebx, uae_u32 *ecx, uae_u32
cache_free (cpuid_space);
}
static void raw_init_cpu (void)
static void raw_init_cpu(void)
{
struct cpuinfo_x86 *c = &cpuinfo;
uae_u32 xlvl;

File diff suppressed because it is too large Load Diff

View File

@ -58,7 +58,7 @@ static void *console_thread (void *v)
{
uae_set_thread_priority (2);
for (;;) {
char wc = "a"; //console_getch ();
TCHAR wc = "a"; //console_getch ();
char c[2];
write_log ("*");

View File

@ -212,6 +212,7 @@ struct sprite {
};
static struct sprite spr[MAX_SPRITES];
static int plfstrt_sprite;
uaecptr sprite_0;
int sprite_0_width, sprite_0_height, sprite_0_doubled;
@ -1809,6 +1810,7 @@ static void start_bpl_dma (int hpos, int hstart)
}
}
plfstrt_sprite = plfstrt;
fetch_start (hpos);
fetch_cycle = 0;
last_fetch_hpos = hstart;
@ -4779,7 +4781,7 @@ STATIC_INLINE void do_sprites_1 (int num, int cycle, int hpos)
if (cycle && !s->dmacycle)
return; /* Superfrog intro flashing bee fix */
dma = hpos < plfstrt || diwstate != DIW_waiting_stop;
dma = hpos < plfstrt_sprite || diwstate != DIW_waiting_stop;
if (vpos == s->vstop || vpos == sprite_vblank_endline) {
s->dmastate = 0;
posctl = 1;
@ -5629,10 +5631,12 @@ static void hsync_handler (void)
bsdsock_fake_int_handler ();
}
plfstrt_sprite = plfstrt;
/* See if there's a chance of a copper wait ending this line. */
cop_state.hpos = 0;
cop_state.last_write = 0;
compute_spcflag_copper (maxhpos);
serial_hsynchandler ();
#ifdef CUSTOM_SIMPLE
do_sprites (0);

View File

@ -3124,7 +3124,7 @@ static int exalldo (uaecptr exalldata, uae_u32 exalldatasize, uae_u32 type, uaec
put_long (control + 0, get_long (control + 0) + 1);
ret = 1;
end:
xfree (x);
//xaind: xfree (x);
xfree (comment);
return ret;
}
@ -3397,7 +3397,7 @@ static void populate_directory (Unit *unit, a_inode *base)
ok = zfile_readdir_archive(d->zd, fn);
else*/
ok = readdir (d->od);
} while (ok && !d->isarch && fsdb_name_invalid (ok->d_name));
} while (ok /*&& !d->isarch*/ && fsdb_name_invalid (ok->d_name));
if (!ok)
break;
/* This calls init_child_aino, which will notice that the parent is

View File

@ -1640,7 +1640,7 @@ static void gen_opcode (unsigned long int opcode)
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
genamode (curi->dmode, "dstreg", sz_long, "dst", 1, 0, 0);
if (curi->smode == immi) {
c = curi->size == sz_long ? 2 : 4;
// SUBAQ.x is always 8 cycles
c += 4;
} else {
c = curi->size == sz_long ? 2 : 4;
@ -1726,7 +1726,7 @@ static void gen_opcode (unsigned long int opcode)
genamode (curi->smode, "srcreg", curi->size, "src", 1, 0, 0);
genamode (curi->dmode, "dstreg", sz_long, "dst", 1, 0, 0);
if (curi->smode == immi) {
c = curi->size == sz_long ? 2 : 4;
// ADDAQ.x is always 8 cycles
c += 4;
} else {
c = curi->size == sz_long ? 2 : 4;

View File

@ -176,3 +176,66 @@ void gui_message (const char *format,...)
B_WIDTH_AS_USUAL, B_OFFSET_SPACING, B_WARNING_ALERT);
alert->Go();
}
static int guijoybutton[MAX_JPORTS];
static int guijoyaxis[MAX_JPORTS][4];
static bool guijoychange;
void gui_gameport_button_change (int port, int button, int onoff)
{
//write_log ("%d %d %d\n", port, button, onoff);
#ifdef RETROPLATFORM
int mask = 0;
if (button == JOYBUTTON_CD32_PLAY)
mask = RP_JOYSTICK_BUTTON5;
if (button == JOYBUTTON_CD32_RWD)
mask = RP_JOYSTICK_BUTTON6;
if (button == JOYBUTTON_CD32_FFW)
mask = RP_JOYSTICK_BUTTON7;
if (button == JOYBUTTON_CD32_GREEN)
mask = RP_JOYSTICK_BUTTON4;
if (button == JOYBUTTON_3 || button == JOYBUTTON_CD32_YELLOW)
mask = RP_JOYSTICK_BUTTON3;
if (button == JOYBUTTON_1 || button == JOYBUTTON_CD32_RED)
mask = RP_JOYSTICK_BUTTON1;
if (button == JOYBUTTON_2 || button == JOYBUTTON_CD32_BLUE)
mask = RP_JOYSTICK_BUTTON2;
rp_update_gameport (port, mask, onoff);
#endif
if (onoff)
guijoybutton[port] |= 1 << button;
else
guijoybutton[port] &= ~(1 << button);
guijoychange = true;
}
void gui_gameport_axis_change (int port, int axis, int state, int max)
{
int onoff = state ? 100 : 0;
if (axis < 0 || axis > 3)
return;
if (max < 0) {
if (guijoyaxis[port][axis] == 0)
return;
if (guijoyaxis[port][axis] > 0)
guijoyaxis[port][axis]--;
} else {
if (state > max)
state = max;
if (state < 0)
state = 0;
guijoyaxis[port][axis] = max ? state * 127 / max : onoff;
#ifdef RETROPLATFORM
if (axis == DIR_LEFT_BIT)
rp_update_gameport (port, RP_JOYSTICK_LEFT, onoff);
if (axis == DIR_RIGHT_BIT)
rp_update_gameport (port, DIR_RIGHT_BIT, onoff);
if (axis == DIR_UP_BIT)
rp_update_gameport (port, DIR_UP_BIT, onoff);
if (axis == DIR_DOWN_BIT)
rp_update_gameport (port, DIR_DOWN_BIT, onoff);
#endif
}
guijoychange = true;
}

View File

@ -654,3 +654,65 @@ void gui_disk_image_change (int unitnum, const TCHAR *name, bool writeprotected)
void gui_lock (void) {}
void gui_unlock (void) {}
static int guijoybutton[MAX_JPORTS];
static int guijoyaxis[MAX_JPORTS][4];
static bool guijoychange;
void gui_gameport_button_change (int port, int button, int onoff)
{
//write_log ("%d %d %d\n", port, button, onoff);
#ifdef RETROPLATFORM
int mask = 0;
if (button == JOYBUTTON_CD32_PLAY)
mask = RP_JOYSTICK_BUTTON5;
if (button == JOYBUTTON_CD32_RWD)
mask = RP_JOYSTICK_BUTTON6;
if (button == JOYBUTTON_CD32_FFW)
mask = RP_JOYSTICK_BUTTON7;
if (button == JOYBUTTON_CD32_GREEN)
mask = RP_JOYSTICK_BUTTON4;
if (button == JOYBUTTON_3 || button == JOYBUTTON_CD32_YELLOW)
mask = RP_JOYSTICK_BUTTON3;
if (button == JOYBUTTON_1 || button == JOYBUTTON_CD32_RED)
mask = RP_JOYSTICK_BUTTON1;
if (button == JOYBUTTON_2 || button == JOYBUTTON_CD32_BLUE)
mask = RP_JOYSTICK_BUTTON2;
rp_update_gameport (port, mask, onoff);
#endif
if (onoff)
guijoybutton[port] |= 1 << button;
else
guijoybutton[port] &= ~(1 << button);
guijoychange = true;
}
void gui_gameport_axis_change (int port, int axis, int state, int max)
{
int onoff = state ? 100 : 0;
if (axis < 0 || axis > 3)
return;
if (max < 0) {
if (guijoyaxis[port][axis] == 0)
return;
if (guijoyaxis[port][axis] > 0)
guijoyaxis[port][axis]--;
} else {
if (state > max)
state = max;
if (state < 0)
state = 0;
guijoyaxis[port][axis] = max ? state * 127 / max : onoff;
#ifdef RETROPLATFORM
if (axis == DIR_LEFT_BIT)
rp_update_gameport (port, RP_JOYSTICK_LEFT, onoff);
if (axis == DIR_RIGHT_BIT)
rp_update_gameport (port, DIR_RIGHT_BIT, onoff);
if (axis == DIR_UP_BIT)
rp_update_gameport (port, DIR_UP_BIT, onoff);
if (axis == DIR_DOWN_BIT)
rp_update_gameport (port, DIR_DOWN_BIT, onoff);
#endif
}
guijoychange = true;
}

View File

@ -2728,4 +2728,64 @@ int gui_init (void)
void gui_disk_image_change (int unitnum, const TCHAR *name, bool writeprotected) {}
void gui_lock (void) {}
void gui_unlock (void) {}
static int guijoybutton[MAX_JPORTS];
static int guijoyaxis[MAX_JPORTS][4];
static bool guijoychange;
void gui_gameport_button_change (int port, int button, int onoff)
{
//write_log ("%d %d %d\n", port, button, onoff);
#ifdef RETROPLATFORM
int mask = 0;
if (button == JOYBUTTON_CD32_PLAY)
mask = RP_JOYSTICK_BUTTON5;
if (button == JOYBUTTON_CD32_RWD)
mask = RP_JOYSTICK_BUTTON6;
if (button == JOYBUTTON_CD32_FFW)
mask = RP_JOYSTICK_BUTTON7;
if (button == JOYBUTTON_CD32_GREEN)
mask = RP_JOYSTICK_BUTTON4;
if (button == JOYBUTTON_3 || button == JOYBUTTON_CD32_YELLOW)
mask = RP_JOYSTICK_BUTTON3;
if (button == JOYBUTTON_1 || button == JOYBUTTON_CD32_RED)
mask = RP_JOYSTICK_BUTTON1;
if (button == JOYBUTTON_2 || button == JOYBUTTON_CD32_BLUE)
mask = RP_JOYSTICK_BUTTON2;
rp_update_gameport (port, mask, onoff);
#endif
if (onoff)
guijoybutton[port] |= 1 << button;
else
guijoybutton[port] &= ~(1 << button);
guijoychange = true;
}
void gui_gameport_axis_change (int port, int axis, int state, int max)
{
int onoff = state ? 100 : 0;
if (axis < 0 || axis > 3)
return;
if (max < 0) {
if (guijoyaxis[port][axis] == 0)
return;
if (guijoyaxis[port][axis] > 0)
guijoyaxis[port][axis]--;
} else {
if (state > max)
state = max;
if (state < 0)
state = 0;
guijoyaxis[port][axis] = max ? state * 127 / max : onoff;
#ifdef RETROPLATFORM
if (axis == DIR_LEFT_BIT)
rp_update_gameport (port, RP_JOYSTICK_LEFT, onoff);
if (axis == DIR_RIGHT_BIT)
rp_update_gameport (port, DIR_RIGHT_BIT, onoff);
if (axis == DIR_UP_BIT)
rp_update_gameport (port, DIR_UP_BIT, onoff);
if (axis == DIR_DOWN_BIT)
rp_update_gameport (port, DIR_DOWN_BIT, onoff);
#endif
}
guijoychange = true;
}

View File

@ -390,3 +390,66 @@ void gui_message (const char *format,...)
write_log (msg);
}
static int guijoybutton[MAX_JPORTS];
static int guijoyaxis[MAX_JPORTS][4];
static bool guijoychange;
void gui_gameport_button_change (int port, int button, int onoff)
{
//write_log ("%d %d %d\n", port, button, onoff);
#ifdef RETROPLATFORM
int mask = 0;
if (button == JOYBUTTON_CD32_PLAY)
mask = RP_JOYSTICK_BUTTON5;
if (button == JOYBUTTON_CD32_RWD)
mask = RP_JOYSTICK_BUTTON6;
if (button == JOYBUTTON_CD32_FFW)
mask = RP_JOYSTICK_BUTTON7;
if (button == JOYBUTTON_CD32_GREEN)
mask = RP_JOYSTICK_BUTTON4;
if (button == JOYBUTTON_3 || button == JOYBUTTON_CD32_YELLOW)
mask = RP_JOYSTICK_BUTTON3;
if (button == JOYBUTTON_1 || button == JOYBUTTON_CD32_RED)
mask = RP_JOYSTICK_BUTTON1;
if (button == JOYBUTTON_2 || button == JOYBUTTON_CD32_BLUE)
mask = RP_JOYSTICK_BUTTON2;
rp_update_gameport (port, mask, onoff);
#endif
if (onoff)
guijoybutton[port] |= 1 << button;
else
guijoybutton[port] &= ~(1 << button);
guijoychange = true;
}
void gui_gameport_axis_change (int port, int axis, int state, int max)
{
int onoff = state ? 100 : 0;
if (axis < 0 || axis > 3)
return;
if (max < 0) {
if (guijoyaxis[port][axis] == 0)
return;
if (guijoyaxis[port][axis] > 0)
guijoyaxis[port][axis]--;
} else {
if (state > max)
state = max;
if (state < 0)
state = 0;
guijoyaxis[port][axis] = max ? state * 127 / max : onoff;
#ifdef RETROPLATFORM
if (axis == DIR_LEFT_BIT)
rp_update_gameport (port, RP_JOYSTICK_LEFT, onoff);
if (axis == DIR_RIGHT_BIT)
rp_update_gameport (port, DIR_RIGHT_BIT, onoff);
if (axis == DIR_UP_BIT)
rp_update_gameport (port, DIR_UP_BIT, onoff);
if (axis == DIR_DOWN_BIT)
rp_update_gameport (port, DIR_DOWN_BIT, onoff);
#endif
}
guijoychange = true;
}

View File

@ -67,3 +67,65 @@ void gui_disk_image_change (int unitnum, const TCHAR *name, bool writeprotected)
void gui_lock (void) {}
void gui_unlock (void) {}
static int guijoybutton[MAX_JPORTS];
static int guijoyaxis[MAX_JPORTS][4];
static bool guijoychange;
void gui_gameport_button_change (int port, int button, int onoff)
{
//write_log ("%d %d %d\n", port, button, onoff);
#ifdef RETROPLATFORM
int mask = 0;
if (button == JOYBUTTON_CD32_PLAY)
mask = RP_JOYSTICK_BUTTON5;
if (button == JOYBUTTON_CD32_RWD)
mask = RP_JOYSTICK_BUTTON6;
if (button == JOYBUTTON_CD32_FFW)
mask = RP_JOYSTICK_BUTTON7;
if (button == JOYBUTTON_CD32_GREEN)
mask = RP_JOYSTICK_BUTTON4;
if (button == JOYBUTTON_3 || button == JOYBUTTON_CD32_YELLOW)
mask = RP_JOYSTICK_BUTTON3;
if (button == JOYBUTTON_1 || button == JOYBUTTON_CD32_RED)
mask = RP_JOYSTICK_BUTTON1;
if (button == JOYBUTTON_2 || button == JOYBUTTON_CD32_BLUE)
mask = RP_JOYSTICK_BUTTON2;
rp_update_gameport (port, mask, onoff);
#endif
if (onoff)
guijoybutton[port] |= 1 << button;
else
guijoybutton[port] &= ~(1 << button);
guijoychange = true;
}
void gui_gameport_axis_change (int port, int axis, int state, int max)
{
int onoff = state ? 100 : 0;
if (axis < 0 || axis > 3)
return;
if (max < 0) {
if (guijoyaxis[port][axis] == 0)
return;
if (guijoyaxis[port][axis] > 0)
guijoyaxis[port][axis]--;
} else {
if (state > max)
state = max;
if (state < 0)
state = 0;
guijoyaxis[port][axis] = max ? state * 127 / max : onoff;
#ifdef RETROPLATFORM
if (axis == DIR_LEFT_BIT)
rp_update_gameport (port, RP_JOYSTICK_LEFT, onoff);
if (axis == DIR_RIGHT_BIT)
rp_update_gameport (port, DIR_RIGHT_BIT, onoff);
if (axis == DIR_UP_BIT)
rp_update_gameport (port, DIR_UP_BIT, onoff);
if (axis == DIR_DOWN_BIT)
rp_update_gameport (port, DIR_DOWN_BIT, onoff);
#endif
}
guijoychange = true;
}

View File

@ -8,9 +8,6 @@ extern void cdtv_free (void);
extern void CDTV_hsync_handler(void);
extern void cdtv_check_banks (void);
extern void cdtv_entergui (void);
extern void cdtv_exitgui (void);
void cdtv_battram_write (int addr, int v);
uae_u8 cdtv_battram_read (int addr);

View File

@ -21,6 +21,9 @@ extern void gui_disk_image_change (int, const TCHAR *, bool writeprotected);
extern unsigned int gui_ledstate;
extern void gui_display (int shortcut);
extern void gui_gameport_button_change (int port, int button, int onoff);
extern void gui_gameport_axis_change (int port, int axis, int state, int max);
extern bool no_gui, quit_to_gui;
#define LED_CD_ACTIVE 1
@ -54,7 +57,7 @@ struct gui_info
uae_u8 md; /* CD32 or CDTV internal storage */
int fps, idle;
int sndbuf, sndbuf_status;
char df[4][256]; /* inserted image */
TCHAR df[4][256]; /* inserted image */
uae_u32 crc32[4]; /* crc32 of image */
};
#define NUM_LEDS (LED_MAX)

View File

@ -7,6 +7,25 @@
* Copyright 2001-2002 Toni Wilen
*/
#define DIR_LEFT_BIT 0
#define DIR_RIGHT_BIT 1
#define DIR_UP_BIT 2
#define DIR_DOWN_BIT 3
#define DIR_LEFT (1 << DIR_LEFT_BIT)
#define DIR_RIGHT (1 << DIR_RIGHT_BIT)
#define DIR_UP (1 << DIR_UP_BIT)
#define DIR_DOWN (1 << DIR_DOWN_BIT)
#define JOYBUTTON_1 0 /* fire/left mousebutton */
#define JOYBUTTON_2 1 /* 2nd/right mousebutton */
#define JOYBUTTON_3 2 /* 3rd/middle mousebutton */
#define JOYBUTTON_CD32_PLAY 3
#define JOYBUTTON_CD32_RWD 4
#define JOYBUTTON_CD32_FFW 5
#define JOYBUTTON_CD32_GREEN 6
#define JOYBUTTON_CD32_YELLOW 7
#define JOYBUTTON_CD32_RED 8
#define JOYBUTTON_CD32_BLUE 9
#define IDTYPE_JOYSTICK 0
#define IDTYPE_MOUSE 1
@ -248,3 +267,4 @@ extern int inputdevice_testread (int*, int*, int*);
extern int inputdevice_istest (void);
extern void inputdevice_settest (int);
extern int inputdevice_testread_count (void);

View File

@ -57,25 +57,9 @@ extern int bootrom_header, bootrom_items;
int inputdevice_logging = 0;
#define DIR_LEFT 1
#define DIR_RIGHT 2
#define DIR_UP 4
#define DIR_DOWN 8
#define IE_INVERT 0x80
#define IE_CDTV 0x100
#define JOYBUTTON_1 0 /* fire/left mousebutton */
#define JOYBUTTON_2 1 /* 2nd/right mousebutton */
#define JOYBUTTON_3 2 /* 3rd/middle mousebutton */
#define JOYBUTTON_CD32_PLAY 3
#define JOYBUTTON_CD32_RWD 4
#define JOYBUTTON_CD32_FFW 5
#define JOYBUTTON_CD32_GREEN 6
#define JOYBUTTON_CD32_YELLOW 7
#define JOYBUTTON_CD32_RED 8
#define JOYBUTTON_CD32_BLUE 9
#define INPUTEVENT_JOY1_CD32_FIRST INPUTEVENT_JOY1_CD32_PLAY
#define INPUTEVENT_JOY2_CD32_FIRST INPUTEVENT_JOY2_CD32_PLAY
#define INPUTEVENT_JOY1_CD32_LAST INPUTEVENT_JOY1_CD32_BLUE
@ -1850,8 +1834,11 @@ static int getvelocity (int num, int subnum, int pct)
else if (val > 0)
v = 1;
}
if (!mouse_deltanoreset[num][subnum])
if (!mouse_deltanoreset[num][subnum]) {
mouse_delta[num][subnum] -= v;
gui_gameport_axis_change (num, subnum * 2 + 0, 0, -1);
gui_gameport_axis_change (num, subnum * 2 + 1, 0, -1);
}
return v;
}
@ -2886,14 +2873,10 @@ int handle_input_event (int nr, int state, int max, int autofire)
if (state) {
joybutton[joy] |= 1 << ie->data;
#ifdef RETROPLATFORM
rp_update_gameport (joy, RP_JOYSTICK_BUTTON1 << ie->data, 1);
#endif
gui_gameport_button_change (joy, ie->data, 1);
} else {
joybutton[joy] &= ~(1 << ie->data);
#ifdef RETROPLATFORM
rp_update_gameport (joy, RP_JOYSTICK_BUTTON1 << ie->data, 0);
#endif
gui_gameport_button_change (joy, ie->data, 0);
}
if (ie->data == 0 && old != (joybutton[joy] & (1 << ie->data)) && currprefs.cpu_cycle_exact) {
@ -2935,7 +2918,30 @@ int handle_input_event (int nr, int state, int max, int autofire)
delta = -JOYMOUSE_CDTV;
}
mouse_delta[joy][unit] += delta * ((ie->data & IE_INVERT) ? -1 : 1);
if (ie->data & IE_INVERT)
delta = -delta;
mouse_delta[joy][unit] += delta;
max = 32;
if (unit) {
if (delta < 0) {
gui_gameport_axis_change (joy, DIR_UP_BIT, abs (delta), max);
gui_gameport_axis_change (joy, DIR_DOWN_BIT, 0, max);
}
if (delta > 0) {
gui_gameport_axis_change (joy, DIR_DOWN_BIT, abs (delta), max);
gui_gameport_axis_change (joy, DIR_UP_BIT, 0, max);
}
} else {
if (delta < 0) {
gui_gameport_axis_change (joy, DIR_LEFT_BIT, abs (delta), max);
gui_gameport_axis_change (joy, DIR_RIGHT_BIT, 0, max);
}
if (delta > 0) {
gui_gameport_axis_change (joy, DIR_RIGHT_BIT, abs (delta), max);
gui_gameport_axis_change (joy, DIR_LEFT_BIT, 0, max);
}
}
} else if (ie->type & 32) { /* button mouse emulation vertical */
@ -2979,6 +2985,19 @@ int handle_input_event (int nr, int state, int max, int autofire)
}
if (ie->data & IE_INVERT)
state = -state;
if (!unit) {
if (state <= 0)
gui_gameport_axis_change (joy, DIR_UP_BIT, abs (state), max);
if (state >= 0)
gui_gameport_axis_change (joy, DIR_DOWN_BIT, abs (state), max);
} else {
if (state <= 0)
gui_gameport_axis_change (joy, DIR_LEFT_BIT, abs (state), max);
if (state >= 0)
gui_gameport_axis_change (joy, DIR_RIGHT_BIT, abs (state), max);
}
state = state * currprefs.input_analog_joystick_mult / max;
state += (128 * currprefs.input_analog_joystick_mult / 100) + currprefs.input_analog_joystick_offset;
if (state < 0)
@ -2986,6 +3005,8 @@ int handle_input_event (int nr, int state, int max, int autofire)
if (state > 255)
state = 255;
joydirpot[joy][unit] = state;
mouse_deltanoreset[joy][0] = 1;
mouse_deltanoreset[joy][1] = 1;
} else {
@ -3017,6 +3038,8 @@ int handle_input_event (int nr, int state, int max, int autofire)
if (ie->data & DIR_DOWN)
bot = obot[joy] = pos;
}
mouse_deltanoreset[joy][0] = 1;
mouse_deltanoreset[joy][1] = 1;
joydir[joy] = 0;
if (left)
joydir[joy] |= DIR_LEFT;
@ -3026,12 +3049,10 @@ int handle_input_event (int nr, int state, int max, int autofire)
joydir[joy] |= DIR_UP;
if (bot)
joydir[joy] |= DIR_DOWN;
#ifdef RETROPLATFORM
rp_update_gameport (joy, RP_JOYSTICK_LEFT, left);
rp_update_gameport (joy, RP_JOYSTICK_RIGHT, right);
rp_update_gameport (joy, RP_JOYSTICK_DOWN, bot);
rp_update_gameport (joy, RP_JOYSTICK_UP, top);
#endif
gui_gameport_axis_change (joy, DIR_LEFT_BIT, left, 0);
gui_gameport_axis_change (joy, DIR_RIGHT_BIT, right, 0);
gui_gameport_axis_change (joy, DIR_UP_BIT, top, 0);
gui_gameport_axis_change (joy, DIR_DOWN_BIT, bot, 0);
}
break;
case 0: /* ->KEY */

View File

@ -1895,7 +1895,7 @@ err:
#ifndef NATMEM_OFFSET
uae_u8 *mapped_malloc (size_t s, const char *file)
uae_u8 *mapped_malloc (size_t s, const TCHAR *file)
{
return xmalloc (uae_u8, s);
}
@ -2057,7 +2057,7 @@ static void add_shmmaps (uae_u32 start, addrbank *what)
* direct memory access will be disabled and memory allocated via
* malloc().
*/
uae_u8 *mapped_malloc (size_t s, const char *file)
uae_u8 *mapped_malloc (size_t s, const TCHAR *file)
{
int id;
void *answer;
@ -2727,7 +2727,7 @@ void memory_cleanup (void)
if (cardmemory) {
#ifdef CDTV
cdtv_savecardmem (cardmemory, allocated_cardmem);
#endif //CDTV
#endif
mapped_free (cardmemory);
}
if (custmem1)

View File

@ -333,6 +333,12 @@ uae_u32 emulib_target_getcpurate (uae_u32 v, uae_u32 *low)
} else if (v == 2) {
gettimeofday (&_tend, &tz);
}
double t1, t2;
t1 = (double)_tstart.tv_sec + (double)_tstart.tv_usec/(1000*1000);
t2 = (double)_tend.tv_sec + (double)_tend.tv_usec/(1000*1000);
return t2-t1;
*/
#endif
}

View File

@ -14,7 +14,7 @@ hostname = GnoStiC-dv7
uname -m = i686
uname -r = 2.6.32-24-generic
uname -s = Linux
uname -v = #39-Ubuntu SMP Wed Jul 28 06:07:29 UTC 2010
uname -v = #41-Ubuntu SMP Thu Aug 19 01:12:52 UTC 2010
/usr/bin/uname -p = unknown
/bin/uname -X = unknown
@ -445,7 +445,7 @@ configure:4344: $? = 0
configure:4344: result: yes
configure:4350: checking for _doprnt
configure:4350: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
/tmp/ccTFdHnN.o: In function `main':
/tmp/ccySHNQU.o: In function `main':
/home/gnostic/puaex/src/tools/conftest.c:67: undefined reference to `_doprnt'
collect2: ld returned 1 exit status
configure:4350: $? = 1
@ -533,7 +533,7 @@ configure:4364: $? = 0
configure:4364: result: yes
configure:4364: checking for strcmpi
configure:4364: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
/tmp/cc2hgaV2.o: In function `main':
/tmp/cc4ZEZr9.o: In function `main':
/home/gnostic/puaex/src/tools/conftest.c:69: undefined reference to `strcmpi'
collect2: ld returned 1 exit status
configure:4364: $? = 1
@ -613,7 +613,7 @@ configure: failed program was:
configure:4364: result: no
configure:4364: checking for stricmp
configure:4364: gcc -o conftest -g -O2 -Wall -W -Wno-unused conftest.c >&5
/tmp/ccpW3ZCa.o: In function `main':
/tmp/ccH9Ri3d.o: In function `main':
/home/gnostic/puaex/src/tools/conftest.c:69: undefined reference to `stricmp'
collect2: ld returned 1 exit status
configure:4364: $? = 1

View File

@ -336,7 +336,7 @@ static uae_u32 trap_Call68k (TrapContext *context, uaecptr func_addr)
/*
* Handles the emulator's side of a 68k call (from an extended trap)
*/
static uae_u32 REGPARAM2 m68k_call_handler (TrapContext *dummy_ctx)
static uae_u32 REGPARAM3 m68k_call_handler (TrapContext *dummy_ctx)
{
TrapContext *context = current_context;
@ -374,7 +374,7 @@ static uae_u32 REGPARAM2 m68k_call_handler (TrapContext *dummy_ctx)
/*
* Handles the return from a 68k call at the emulator's side.
*/
static uae_u32 REGPARAM2 m68k_return_handler (TrapContext *dummy_ctx)
static uae_u32 REGPARAM3 m68k_return_handler (TrapContext *dummy_ctx)
{
TrapContext *context;
uae_u32 sp;
@ -408,7 +408,7 @@ static uae_u32 REGPARAM2 m68k_return_handler (TrapContext *dummy_ctx)
* Handles completion of an extended trap and passes
* return value from trap function to 68k space.
*/
static uae_u32 REGPARAM2 exit_trap_handler (TrapContext *dummy_ctx)
static uae_u32 REGPARAM3 exit_trap_handler (TrapContext *dummy_ctx)
{
TrapContext *context = current_context;

View File

@ -2328,7 +2328,7 @@ static struct zvolume *zvolume_alloc_2 (const TCHAR *name, struct zfile *z, unsi
root->volume = zv;
root->type = ZNODE_DIR;
i = 0;
if (name[0] != '/' && name[0] != '\\') {
if (name[0] != '/' && name[0] != '\\' && _tcsncmp (name, ".\\", 2) != 0) {
if (_tcschr (name, ':') == 0) {
for (i = _tcslen (name) - 1; i > 0; i--) {
if (name[i] == FSDB_DIR_SEPARATOR) {