return true;
}
+static struct cd_toc *get_track (int startlsn)
+{
+ for (int 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 (L"tried to play data track %d!\n", s->track);
- s++;
+ s = get_track (startlsn + 150);
+ if (s && (s->control & 0x0c) == 0x04) {
+ write_log (L"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;
#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;
}
uae_u8 buffer[2048];
if (sys_command_cd_read (unitnum, buffer, 16, 1)) {
- if (!memcmp (buffer + 8, "CDTV", 4) || !memcmp (buffer + 8, "CD32", 4)) {
+ if (!memcmp (buffer + 8, "CDTV", 4) || !memcmp (buffer + 8, "CD32", 4) || !memcmp (buffer + 8, "COMM", 4)) {
uae_u32 crc;
write_log (L"CD32 or CDTV");
if (sys_command_cd_read (unitnum, buffer, 21, 1)) {
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);
} 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;
cdu->cd_last_pos = sector;
ret = sectorsize * size;
-
} else {
+
uae_u8 sectortype = extra >> 16;
uae_u8 cmd9 = extra >> 8;
int sync = (cmd9 >> 7) & 1;
}
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;
}
}
+ zfile_fclose (zimg);
+ zfile_fclose (zsub);
return cdu->tracks;
}
{
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)
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;
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);
}
static int read_sectors (int start, int length)
{
+ if (cd_playing)
+ cdaudiostop ();
#ifdef CDTV_DEBUG_CMD
write_log (L"READ DATA sector %d, %d sectors (blocksize=%d)\n", start, length, cdtv_sectorsize);
#endif
cdrom_length = length * cdtv_sectorsize;
cd_motor = 1;
cd_audio_status = AUDIO_STATUS_NOT_SUPPORTED;
- if (cd_playing)
- cdaudiostop ();
return 0;
}
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 (L"CDTV: tried to set unknown sector size %d\n", cdtv_sectorsize);
cdtv_sectorsize = 2048;
}
}
}
-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, L"track%d.bin", trackcnt);
- zfile_fclose (f);
- f = zfile_fopen (fname, L"rb", ZFD_NORMAL);
- if (f)
- write_log (L"opened '%s'\n", fname);
- track = trackcnt;
- }
- if (f) {
- write_log (L"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;
uae_u8 buffer[2352];
if (!didread || readsector != (cdrom_offset / cdtv_sectorsize)) {
readsector = cdrom_offset / cdtv_sectorsize;
- if (readsector > 3000)
- write_log (L"");
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) {
}
#endif
-
-void cdtv_entergui (void)
-{
- if (cd_playing && !cd_paused)
- write_comm_pipe_u32 (&requests, 0x102, 1);
-}
-void cdtv_exitgui (void)
-{
- if (cd_playing && !cd_paused)
- write_comm_pipe_u32 (&requests, 0x103, 1);
-}
}
if (_tcscmp (option, L"joyportfriendlyname0") == 0 || _tcscmp (option, L"joyportfriendlyname1") == 0) {
- inputdevice_joyport_config (p, value, _tcscmp (option, L"joyportfriendlyname0") == 0 ? 0 : 1, 0, 2);
+ inputdevice_joyport_config (p, value, _tcscmp (option, L"joyportfriendlyname0") == 0 ? 0 : 1, -1, 2);
return 1;
}
if (_tcscmp (option, L"joyportfriendlyname2") == 0 || _tcscmp (option, L"joyportfriendlyname3") == 0) {
- inputdevice_joyport_config (p, value, _tcscmp (option, L"joyportfriendlyname2") == 0 ? 2 : 3, 0, 2);
+ inputdevice_joyport_config (p, value, _tcscmp (option, L"joyportfriendlyname2") == 0 ? 2 : 3, -1, 2);
return 1;
}
if (_tcscmp (option, L"joyportname0") == 0 || _tcscmp (option, L"joyportname1") == 0) {
- inputdevice_joyport_config (p, value, _tcscmp (option, L"joyportname0") == 0 ? 0 : 1, 0, 1);
+ inputdevice_joyport_config (p, value, _tcscmp (option, L"joyportname0") == 0 ? 0 : 1, -1, 1);
return 1;
}
if (_tcscmp (option, L"joyportname2") == 0 || _tcscmp (option, L"joyportname3") == 0) {
- inputdevice_joyport_config (p, value, _tcscmp (option, L"joyportname2") == 0 ? 2 : 3, 0, 1);
+ inputdevice_joyport_config (p, value, _tcscmp (option, L"joyportname2") == 0 ? 2 : 3, -1, 1);
return 1;
}
if (_tcscmp (option, L"joyport0") == 0 || _tcscmp (option, L"joyport1") == 0) {
- inputdevice_joyport_config (p, value, _tcscmp (option, L"joyport0") == 0 ? 0 : 1, 0, 0);
+ inputdevice_joyport_config (p, value, _tcscmp (option, L"joyport0") == 0 ? 0 : 1, -1, 0);
return 1;
}
if (_tcscmp (option, L"joyport2") == 0 || _tcscmp (option, L"joyport3") == 0) {
- inputdevice_joyport_config (p, value, _tcscmp (option, L"joyport2") == 0 ? 2 : 3, 0, 0);
+ inputdevice_joyport_config (p, value, _tcscmp (option, L"joyport2") == 0 ? 2 : 3, -1, 0);
return 1;
}
if (cfgfile_strval (option, value, L"joyport0mode", &p->jports[0].mode, joyportmodes, 0))
}
#endif
-int cmdlineparser (TCHAR *s, TCHAR *outp[], int max)
+int cmdlineparser (const TCHAR *s, TCHAR *outp[], int max)
{
int j, cnt = 0;
int slash = 0;
int quote = 0;
TCHAR tmp1[MAX_DPATH];
- TCHAR *prev;
+ const TCHAR *prev;
int doout;
doout = 0;
};
static struct sprite spr[MAX_SPRITES];
+static int plfstrt_sprite;
uaecptr sprite_0;
int sprite_0_width, sprite_0_height, sprite_0_doubled;
}
}
+ plfstrt_sprite = plfstrt;
fetch_start (hpos);
fetch_cycle = 0;
last_fetch_hpos = hstart;
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;
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);
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;
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;
extern int akiko_init (void);
extern void akiko_free (void);
-extern void akiko_entergui (void);
-extern void akiko_exitgui (void);
extern void AKIKO_hsync_handler (void);
extern void akiko_mute (int);
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);
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
* 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
extern void default_prefs (struct uae_prefs *, int);
extern void discard_prefs (struct uae_prefs *, int);
-int parse_cmdline_option (struct uae_prefs *, TCHAR, const TCHAR *);
+int parse_cmdline_option (struct uae_prefs *, TCHAR, const TCHAR*);
extern int cfgfile_yesno (const TCHAR *option, const TCHAR *value, const TCHAR *name, bool *location);
extern int cfgfile_intval (const TCHAR *option, const TCHAR *value, const TCHAR *name, int *location, int scale);
extern TCHAR *cfgfile_subst_path (const TCHAR *path, const TCHAR *subst, const TCHAR *file);
extern TCHAR *target_expand_environment (const TCHAR *path);
-extern int target_parse_option (struct uae_prefs *, TCHAR *option, TCHAR *value);
+extern int target_parse_option (struct uae_prefs *, const TCHAR *option, const TCHAR *value);
extern void target_save_options (struct zfile*, struct uae_prefs *);
extern void target_default_options (struct uae_prefs *, int type);
extern void target_fixup_options (struct uae_prefs *);
-extern int target_cfgfile_load (struct uae_prefs *, TCHAR *filename, int type, int isdefault);
+extern int target_cfgfile_load (struct uae_prefs *, const TCHAR *filename, int type, int isdefault);
extern void cfgfile_save_options (struct zfile *f, struct uae_prefs *p, int type);
extern int cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int *type, int ignorelink, int userconfig);
extern void cfgfile_addcfgparam (TCHAR *);
extern int built_in_prefs (struct uae_prefs *p, int model, int config, int compa, int romcheck);
extern int built_in_chipset_prefs (struct uae_prefs *p);
-extern int cmdlineparser (TCHAR *s, TCHAR *outp[], int max);
-extern int cfgfile_configuration_change(int);
+extern int cmdlineparser (const TCHAR *s, TCHAR *outp[], int max);
+extern int cfgfile_configuration_change (int);
extern void fixup_prefs_dimensions (struct uae_prefs *prefs);
extern void fixup_prefs (struct uae_prefs *prefs);
extern void fixup_cpu (struct uae_prefs *prefs);
#include "zfile.h"
#include "cia.h"
#include "autoconf.h"
-#include "rp.h"
-#include "dongle.h"
-#include "cdtv.h"
#ifdef RETROPLATFORM
#include "rp.h"
-#include "cloanto/RetroPlatformIPC.h"
#endif
+#include "dongle.h"
+#include "cdtv.h"
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
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;
}
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) {
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 */
}
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)
if (state > 255)
state = 255;
joydirpot[joy][unit] = state;
+ mouse_deltanoreset[joy][0] = 1;
+ mouse_deltanoreset[joy][1] = 1;
} else {
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;
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 */
FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER|FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, err, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&lpMsgBuf, 0, NULL);
- if (log_scsi)
- write_log (L"IOCTL: unit=%d,%s,%d: %s\n", unitnum, buf, err, (TCHAR*)lpMsgBuf);
+ write_log (L"IOCTL ERR: unit=%d,%s,%d: %s\n", unitnum, buf, err, (TCHAR*)lpMsgBuf);
va_end (arglist);
return err;
}
int len = spti_read (ciw, unitnum, data, sector, sectorsize);
if (len) {
if (data) {
- if (sectorsize >= 2352) {
- memcpy (data, p, sectorsize);
- data += sectorsize;
- ret += sectorsize;
- } else {
- memcpy (data, p + 16, sectorsize);
- data += sectorsize;
- ret += sectorsize;
- }
+ memcpy (data, p, sectorsize);
+ data += sectorsize;
+ ret += sectorsize;
}
got = true;
}
if (oldplay != ciw->cdda_play) {
idleframes = 0;
+ bool seensub = false;
struct _timeb tb1, tb2;
_ftime (&tb1);
cdda_pos = ciw->cdda_start;
sub_deinterleave (dst + 2352, subbuf);
if (seenindex) {
for (int i = 2 * SUB_ENTRY_SIZE; i < SUB_CHANNEL_SIZE; i++) {
- if (subbuf[i]) { // non-zero R-W subchannels
+ if (subbuf[i]) { // non-zero R-W subchannels?
int diff = cdda_pos - sector + 2;
write_log (L"-> CD+G start pos fudge -> %d (%d)\n", sector, -diff);
idleframes -= diff;
cdda_pos = sector;
+ seensub = true;
break;
}
}
diff -= ciw->cdda_delay;
if (idleframes >= 0 && diff < 0 && ciw->cdda_play > 0)
Sleep (-diff);
+ if (diff > 0 && !seensub) {
+ int ch = diff / 7 + 25;
+ if (ch > idleframes)
+ ch = idleframes;
+ idleframes -= ch;
+ cdda_pos += ch;
+ }
+
setstate (ciw, AUDIO_STATUS_IN_PROGRESS);
}
static void cdda_stop (struct dev_info_ioctl *ciw)
{
- if (ciw->cdda_play > 0) {
+ if (ciw->cdda_play != 0) {
ciw->cdda_play = -1;
while (ciw->cdda_play) {
Sleep (10);
if (!ciw)
return 0;
+ if (ciw->usesptiread)
+ return ioctl_command_rawread (unitnum, data, sector, size, 2048, 0);
+
+ cdda_stop (ciw);
+
DWORD dtotal;
int cnt = 3;
uae_u8 *p = ciw->tempbuffer;
if (!open_createfile (ciw, 0))
return 0;
- cdda_stop (ciw);
ciw->cd_last_pos = sector;
while (cnt-- > 0) {
gui_flicker_led (LED_CD, unitnum, LED_CD_ACTIVE);
return 0;
}
if (dtotal == 0) {
+ static int reported;
/* ESS Mega (CDTV) "fake" data area returns zero bytes and no error.. */
spti_read (ciw, unitnum, data, sector, 2048);
- if (log_scsi)
+ if (reported++ < 100)
write_log (L"IOCTL unit %d, sector %d: ReadFile()==0. SPTI=%d\n", unitnum, sector, GetLastError ());
return 1;
}
ioctl_command_stop (unitnum);
update_device_info (unitnum);
ciw->open = true;
+ //ciw->usesptiread = true;
write_log (L"IOCTL: device '%s' (%s/%s/%s) opened succesfully (unit=%d,media=%d)\n",
ciw->devname, ciw->di.vendorid, ciw->di.productid, ciw->di.revision,
unitnum, ciw->di.media_inserted);
int i, blocks;
TCHAR name[100];
FILE *f;
+ bool needfree = false;
- blocks = (buf[132] << 24) | (buf[133] << 16) | (buf[134] << 8) | (buf[135] << 0);
- if (blocks < 0 || blocks > 100000)
- return;
+ if (buf) {
+ blocks = (buf[132] << 24) | (buf[133] << 16) | (buf[134] << 8) | (buf[135] << 0);
+ if (blocks < 0 || blocks > 100000)
+ return;
+ } else {
+ blocks = 16383;
+ buf = (uae_u8*)VirtualAlloc (NULL, CACHE_SIZE, MEM_COMMIT, PAGE_READWRITE);
+ needfree = true;
+ }
_stprintf (name, L"rdb_dump_%d.rdb", cnt);
f = _tfopen (name, L"wb");
if (!f)
offset += blocksize;
}
fclose (f);
+ if (needfree)
+ VirtualFree (buf, 0, MEM_RELEASE);
+ write_log (L"'%s' saved\n", name);
cnt++;
}
#define CA "Commodore\0Amiga\0"
static int safetycheck (HANDLE h, const TCHAR *name, uae_u64 offset, uae_u8 *buf, int blocksize)
{
+ uae_u64 origoffset = offset;
int i, j, blocks = 63, empty = 1;
DWORD outlen;
LONG high;
}
if (!memcmp (buf + 2, "CIS@", 4) && !memcmp (buf + 16, CA, strlen (CA))) {
+ if (do_rdbdump)
+ rdbdump (h, offset, NULL, blocksize);
write_log (L"hd accepted (PCMCIA RAM)\n");
return -2;
}
regclosetree (fkey);
}
if (match) {
+ if (do_rdbdump > 1)
+ rdbdump (h, origoffset, NULL, blocksize);
write_log (L"hd accepted, enabled in registry!\n");
return -7;
}
}
mounted = ismounted (name, h);
if (!mounted) {
+ if (do_rdbdump > 1)
+ rdbdump (h, origoffset, NULL, blocksize);
write_log (L"hd accepted, not empty and not mounted in Windows\n");
return -8;
}
//write_log (L"hd ignored, not empty and no RDB detected or Windows mounted\n");
//return 0;
}
+ if (do_rdbdump > 1)
+ rdbdump (h, origoffset, NULL, blocksize);
write_log (L"hd accepted (empty)\n");
return -9;
}
<ClCompile Include="..\..\prowizard\rippers\FutureComposer13.c" />
<ClCompile Include="..\..\prowizard\rippers\FutureComposer14.c" />
<ClCompile Include="..\..\prowizard\rippers\FuzzacPacker.c" />
- <ClCompile Include="..\..\prowizard\rippers\GameMusicCreator.c" />
+ <ClCompile Include="..\..\prowizard\rippers\GMC.c" />
<ClCompile Include="..\..\prowizard\rippers\GNUPacker12.c" />
<ClCompile Include="..\..\prowizard\rippers\GnuPlayer.c" />
<ClCompile Include="..\..\prowizard\rippers\GPMO.c" />
<ClCompile Include="..\..\prowizard\rippers\NoiseFromHeaven.c" />
<ClCompile Include="..\..\prowizard\rippers\NoisePacker1.c" />
<ClCompile Include="..\..\prowizard\rippers\NoisePacker2.c" />
- <ClCompile Include="..\..\prowizard\rippers\NoisePacker3.c" />
<ClCompile Include="..\..\prowizard\rippers\NoiseRunner.c" />
<ClCompile Include="..\..\prowizard\rippers\NovoTrade.c" />
+ <ClCompile Include="..\..\prowizard\rippers\NP3.c" />
<ClCompile Include="..\..\prowizard\rippers\PhaPacker.c" />
<ClCompile Include="..\..\prowizard\rippers\PolkaPacker.c" />
<ClCompile Include="..\..\prowizard\rippers\PowerMusic.c" />
<ClCompile Include="..\..\prowizard\rippers\FuzzacPacker.c">
<Filter>Source Files\Rippers</Filter>
</ClCompile>
- <ClCompile Include="..\..\prowizard\rippers\GameMusicCreator.c">
- <Filter>Source Files\Rippers</Filter>
- </ClCompile>
<ClCompile Include="..\..\prowizard\rippers\GNUPacker12.c">
<Filter>Source Files\Rippers</Filter>
</ClCompile>
<ClCompile Include="..\..\prowizard\rippers\NoisePacker2.c">
<Filter>Source Files\Rippers</Filter>
</ClCompile>
- <ClCompile Include="..\..\prowizard\rippers\NoisePacker3.c">
- <Filter>Source Files\Rippers</Filter>
- </ClCompile>
<ClCompile Include="..\..\prowizard\rippers\NoiseRunner.c">
<Filter>Source Files\Rippers</Filter>
</ClCompile>
<ClCompile Include="..\..\prowizard\rippers\ZenPacker.c">
<Filter>Source Files\Rippers</Filter>
</ClCompile>
+ <ClCompile Include="..\..\prowizard\rippers\GMC.c">
+ <Filter>Source Files\Rippers</Filter>
+ </ClCompile>
+ <ClCompile Include="..\..\prowizard\rippers\NP3.c">
+ <Filter>Source Files\Rippers</Filter>
+ </ClCompile>
</ItemGroup>
</Project>
\ No newline at end of file
#include "blkdev.h"
#ifdef RETROPLATFORM
#include "rp.h"
+#include "cloanto/RetroPlatformIPC.h"
#endif
extern int harddrive_dangerous, do_rdbdump, aspi_allow_all, no_rawinput;
static int multi_display = 1;
static TCHAR *inipath = NULL;
+static int guijoybutton[MAX_JPORTS];
+static int guijoyaxis[MAX_JPORTS][4];
+static bool guijoychange;
+
static int timeend (void)
{
if (!timeon)
if (pause_emulation > priority)
return;
resumesoundpaused ();
-#ifdef CD32
- akiko_exitgui ();
-#endif
-#ifdef CDTV
- cdtv_exitgui ();
-#endif
blkdev_exitgui ();
if (pausemouseactive)
setmouseactive (-1);
return;
pause_emulation = priority;
setsoundpaused ();
-#ifdef CD32
- akiko_entergui ();
-#endif
-#ifdef CDTV
- cdtv_entergui ();
-#endif
blkdev_entergui ();
pausemouseactive = 1;
if (isfullscreen () <= 0) {
setmouseactive (0);
}
+void gui_gameport_button_change (int port, int button, int onoff)
+{
+ //write_log (L"%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;
+}
+
+
void setmouseactivexy (int x, int y, int dir)
{
int diff = 8;
return 0;
}
+static void plot (LPDRAWITEMSTRUCT lpDIS, int x, int y, int dx, int dy, int idx)
+{
+ COLORREF rgb;
+
+ x += dx;
+ y += dy;
+ if (idx == 0)
+ rgb = RGB(0x00,0x00,0xff);
+ else if (idx == 1)
+ rgb = RGB(0xff,0x00,0x00);
+ else if (idx == 2)
+ rgb = RGB(0xff,0xff,0x00);
+ else if (idx == 3)
+ rgb = RGB(0x00,0xff,0x00);
+ else
+ rgb = RGB(0x00,0x00,0x00);
+
+ SetPixel (lpDIS->hDC, x, y, rgb);
+
+ SetPixel (lpDIS->hDC, x + 1, y, rgb);
+ SetPixel (lpDIS->hDC, x - 1, y, rgb);
+
+ SetPixel (lpDIS->hDC, x, y + 1, rgb);
+ SetPixel (lpDIS->hDC, x, y - 1, rgb);
+}
+
static LRESULT CALLBACK MainWindowProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
static RECT myrect;
{
LPDRAWITEMSTRUCT lpDIS = (LPDRAWITEMSTRUCT)lParam;
if (lpDIS->hwndItem == hStatusWnd) {
- DWORD flags, tflags;
- COLORREF oc;
- TCHAR *txt = (TCHAR*)lpDIS->itemData;
- tflags = txt[_tcslen (txt) + 1];
- SetBkMode (lpDIS->hDC, TRANSPARENT);
- if ((tflags & 2) == 0)
- tflags &= ~(4 | 8 | 16);
- if (tflags & 4) {
- oc = SetTextColor (lpDIS->hDC, RGB(0xcc, 0x00, 0x00)); // writing
- } else if (tflags & 8) {
- oc = SetTextColor (lpDIS->hDC, RGB(0x00, 0xcc, 0x00)); // playing
- } else {
- oc = SetTextColor (lpDIS->hDC, GetSysColor ((tflags & 2) ? COLOR_BTNTEXT : COLOR_GRAYTEXT));
- }
- flags = DT_VCENTER | DT_SINGLELINE;
- if (tflags & 1) {
- flags |= DT_CENTER;
- lpDIS->rcItem.left++;
- lpDIS->rcItem.right -= 3;
+ if (lpDIS->itemID > 0 && lpDIS->itemID <= window_led_joy_start) {
+ int port = lpDIS->itemID - 1;
+ int x = (lpDIS->rcItem.right - lpDIS->rcItem.left + 1) / 2 + lpDIS->rcItem.left - 1;
+ int y = (lpDIS->rcItem.bottom - lpDIS->rcItem.top + 1) / 2 + lpDIS->rcItem.top - 1;
+ FillRect (lpDIS->hDC, &lpDIS->rcItem, (HBRUSH)(COLOR_3DFACE + 1));
+ for (int i = 0; i < 2; i++) {
+ int buttons = guijoybutton[port + i * 2];
+ int m = i == 0 ? 1 : 2;
+ bool got = false;
+ if (buttons & (1 << JOYBUTTON_CD32_BLUE)) {
+ plot (lpDIS, x - 1, y, 0, 0, 0);
+ got = true;
+ }
+ if (buttons & (1 << JOYBUTTON_CD32_RED)) {
+ plot (lpDIS, x + 1, y, 0, 0, 1);
+ got = true;
+ }
+ if (buttons & (1 << JOYBUTTON_CD32_YELLOW)) {
+ plot (lpDIS, x, y - 1, 0, 0, 2);
+ got = true;
+ }
+ if (buttons & (1 << JOYBUTTON_CD32_GREEN)) {
+ plot (lpDIS, x, y + 1, 0, 0, 3);
+ got = true;
+ }
+ if (!got) {
+ if (buttons & 1)
+ plot (lpDIS, x, y, 0, 0, 1);
+ if (buttons & 2)
+ plot (lpDIS, x, y, 0, 0, 0);
+ if (buttons & ~(1 | 2))
+ plot (lpDIS, x, y, 0, 0, -1);
+ }
+ for (int j = 0; j < 4; j++) {
+ int dx = 0, dy = 0;
+ int axis = guijoyaxis[port + i * 2][j];
+ if (j == DIR_LEFT_BIT)
+ dx = -1;
+ if (j == DIR_RIGHT_BIT)
+ dx = +1;
+ if (j == DIR_UP_BIT)
+ dy = -1;
+ if (j == DIR_DOWN_BIT)
+ dy = +1;
+ if (axis && (dx || dy)) {
+ dx *= axis * 8 / 127;
+ dy *= axis * 8 / 127;
+ plot (lpDIS, x, y, dx, dy, -1);
+ }
+ }
+ }
} else {
- flags |= DT_LEFT;
- lpDIS->rcItem.right--;
- lpDIS->rcItem.left += 2;
+ DWORD flags, tflags;
+ COLORREF oc;
+ TCHAR *txt = (TCHAR*)lpDIS->itemData;
+ tflags = txt[_tcslen (txt) + 1];
+ SetBkMode (lpDIS->hDC, TRANSPARENT);
+ if ((tflags & 2) == 0)
+ tflags &= ~(4 | 8 | 16);
+ if (tflags & 4) {
+ oc = SetTextColor (lpDIS->hDC, RGB(0xcc, 0x00, 0x00)); // writing
+ } else if (tflags & 8) {
+ oc = SetTextColor (lpDIS->hDC, RGB(0x00, 0xcc, 0x00)); // playing
+ } else {
+ oc = SetTextColor (lpDIS->hDC, GetSysColor ((tflags & 2) ? COLOR_BTNTEXT : COLOR_GRAYTEXT));
+ }
+ flags = DT_VCENTER | DT_SINGLELINE;
+ if (tflags & 1) {
+ flags |= DT_CENTER;
+ lpDIS->rcItem.left++;
+ lpDIS->rcItem.right -= 3;
+ } else {
+ flags |= DT_LEFT;
+ lpDIS->rcItem.right--;
+ lpDIS->rcItem.left += 2;
+ }
+ DrawText (lpDIS->hDC, txt, _tcslen (txt), &lpDIS->rcItem, flags);
+ SetTextColor (lpDIS->hDC, oc);
}
- DrawText (lpDIS->hDC, txt, _tcslen (txt), &lpDIS->rcItem, flags);
- SetTextColor (lpDIS->hDC, oc);
}
break;
}
int was_paused = 0;
static int cnt;
+ if (guijoychange && window_led_joy_start > 0) {
+ guijoychange = false;
+ for (int i = 0; i < window_led_joy_start; i++)
+ PostMessage (hStatusWnd, SB_SETTEXT, (WPARAM)((i + 1) | SBT_OWNERDRAW), (LPARAM)L"");
+ }
+
while (pause_emulation) {
if (pause_emulation && was_paused == 0) {
setpaused (pause_emulation);
L"killwinkeys", L"sound_force_primary", L"iconified_highpriority",
L"sound_sync", L"sound_tweak", L"directx6", L"sound_style",
L"file_path", L"iconified_nospeed", L"activepriority", L"magic_mouse",
- L"filesystem_codepage",
+ L"filesystem_codepage", L"aspi",
0
};
-int target_parse_option (struct uae_prefs *p, TCHAR *option, TCHAR *value)
+int target_parse_option (struct uae_prefs *p, const TCHAR *option, const TCHAR *value)
{
TCHAR tmpbuf[CONFIG_BLEN];
int i, v;
- bool vb;
int result = (cfgfile_yesno (option, value, L"middle_mouse", &p->win32_middle_mouse)
|| cfgfile_yesno (option, value, L"map_drives", &p->win32_automount_drives)
return 1;
}
- if (cfgfile_yesno (option, value, L"aspi", &vb)) {
- p->win32_uaescsimode = 0;
- if (vb)
- p->win32_uaescsimode = get_aspi (0);
- if (p->win32_uaescsimode < UAESCSI_ASPI_FIRST)
- p->win32_uaescsimode = UAESCSI_ADAPTECASPI;
- return 1;
- }
-
if (cfgfile_string (option, value, L"rtg_vblank", tmpbuf, sizeof tmpbuf / sizeof (TCHAR))) {
if (!_tcscmp (tmpbuf, L"real")) {
p->win32_rtgvblankrate = -1;
}
if (cfgfile_strval (option, value, L"uaescsimode", &p->win32_uaescsimode, scsimode, 0)) {
- // do not forget me!
- p->win32_uaescsimode = UAESCSI_CDEMU;
+ // force SCSIEMU if pre 2.3 configuration
+ if (p->config_version < ((2 << 16) | (3 << 8)))
+ p->win32_uaescsimode = UAESCSI_CDEMU;
return 1;
}
do_rdbdump = 1;
return 1;
}
+ if (!_tcscmp (arg, L"hddump")) {
+ do_rdbdump = 2;
+ return 1;
+ }
if (!_tcscmp (arg, L"disableharddrivesafetycheck")) {
//harddrive_dangerous = 0x1234dead;
return 1;
}
#endif
#endif
+ SetDllDirectory (L"");
/* Make sure we do an InitCommonControls() to get some advanced controls */
InitCommonControls ();
#define WINUAEPUBLICBETA 1
#define LANG_DLL 1
-#define WINUAEBETA L"12"
-#define WINUAEDATE MAKEBD(2010, 8, 21)
+#define WINUAEBETA L"13"
+#define WINUAEDATE MAKEBD(2010, 8, 27)
#define WINUAEEXTRA L""
#define WINUAEREV L""
int display_change_requested, normal_display_change_starting;
int window_led_drives, window_led_drives_end;
int window_led_hd, window_led_hd_end;
+int window_led_joys, window_led_joys_end, window_led_joy_start;
extern int console_logging;
int window_extra_width, window_extra_height;
RECT rc;
HLOCAL hloc;
LPINT lpParts;
- int drive_width, hd_width, cd_width, power_width, fps_width, idle_width, snd_width;
- int num_parts = 11;
+ int drive_width, hd_width, cd_width, power_width, fps_width, idle_width, snd_width, joy_width;
+ int joys = 0;
+ int num_parts = 11 + joys;
double scaleX, scaleY;
WINDOWINFO wi;
int extra;
fps_width = (int)(64 * scaleX);
idle_width = (int)(64 * scaleX);
snd_width = (int)(72 * scaleX);
+ joy_width = (int)(24 * scaleX);
GetClientRect (hMainWnd, &rc);
/* Allocate an array for holding the right edge coordinates. */
- hloc = LocalAlloc (LHND, sizeof (int) * num_parts);
+ hloc = LocalAlloc (LHND, sizeof (int) * (num_parts + 1));
if (hloc) {
+ int i = 0, i1, j;
lpParts = (LPINT)LocalLock (hloc);
- /* Calculate the right edge coordinate for each part, and copy the coords
- * to the array. */
- lpParts[0] = rc.right - (drive_width * 4) - power_width - idle_width - fps_width - cd_width - hd_width - snd_width - extra;
- lpParts[1] = lpParts[0] + snd_width;
- lpParts[2] = lpParts[1] + idle_width;
- lpParts[3] = lpParts[2] + fps_width;
- lpParts[4] = lpParts[3] + power_width;
- lpParts[5] = lpParts[4] + hd_width;
- lpParts[6] = lpParts[5] + cd_width;
- lpParts[7] = lpParts[6] + drive_width;
- lpParts[8] = lpParts[7] + drive_width;
- lpParts[9] = lpParts[8] + drive_width;
- lpParts[10] = lpParts[9] + drive_width;
- window_led_drives = lpParts[6];
- window_led_drives_end = lpParts[10];
- window_led_hd = lpParts[4];
- window_led_hd_end = lpParts[5];
+ /* Calculate the right edge coordinate for each part, and copy the coords to the array. */
+ int startx = rc.right - (drive_width * 4) - power_width - idle_width - fps_width - cd_width - hd_width - snd_width - joys * joy_width - extra;
+ for (j = 0; j < joys; j++) {
+ lpParts[i] = startx;
+ i++;
+ startx += joy_width;
+ }
+ window_led_joy_start = i;
+ // snd
+ lpParts[i] = startx;
+ i++;
+ // cpu
+ lpParts[i] = lpParts[i - 1] + snd_width;
+ i++;
+ // fps
+ lpParts[i] = lpParts[i - 1] + idle_width;
+ i++;
+ // power
+ lpParts[i] = lpParts[i - 1] + fps_width;
+ i++;
+ i1 = i;
+ // hd
+ lpParts[i] = lpParts[i - 1] + power_width;
+ i++;
+ // cd
+ lpParts[i] = lpParts[i - 1] + hd_width;
+ i++;
+ // df0
+ lpParts[i] = lpParts[i - 1] + cd_width;
+ i++;
+ // df1
+ lpParts[i] = lpParts[i - 1] + drive_width;
+ i++;
+ // df2
+ lpParts[i] = lpParts[i - 1] + drive_width;
+ i++;
+ // df3
+ lpParts[i] = lpParts[i - 1] + drive_width;
+ i++;
+ // edge
+ lpParts[i] = lpParts[i - 1] + drive_width;
+
+ window_led_joys = lpParts[0];
+ window_led_joys_end = lpParts[1];
+ window_led_hd = lpParts[i1];
+ window_led_hd_end = lpParts[i1 + 1];
+ window_led_drives = lpParts[i1 + 2];
+ window_led_drives_end = lpParts[i1 + 6];
/* Create the parts */
SendMessage (hStatusWnd, SB_SETPARTS, (WPARAM)num_parts, (LPARAM)lpParts);
extern HWND hStatusWnd;
extern int default_freq;
extern int normal_display_change_starting;
-extern int window_led_drives, window_led_drives_end;
+extern int window_led_drives, window_led_drives_end, window_led_joy_start;
extern int window_led_hd, window_led_hd_end;
+extern int window_led_joys, window_led_joys_end;
extern HDC gethdc (void);
extern void releasehdc (HDC hdc);
#include "statusline.h"
#include "zarchive.h"
#include "win32_uaenet.h"
+#ifdef RETROPLATFORM
+#include "rp.h"
+#endif
#define ARCHIVE_STRING L"*.zip;*.7z;*.rar;*.lha;*.lzh;*.lzx"
return 0;
}
-int target_cfgfile_load (struct uae_prefs *p, TCHAR *filename, int type, int isdefault)
+int target_cfgfile_load (struct uae_prefs *p, const TCHAR *filename, int type, int isdefault)
{
int v, i, type2;
int ct, ct2, size;
inprec_open (full_path, 1);
break;
}
- if (!nosavepath) {
+ if (!nosavepath || 1) {
if (flag == 0 || flag == 1) {
amiga_path = _tcsstr (openFileName.lpstrFile, openFileName.lpstrFileTitle);
if (amiga_path && amiga_path != openFileName.lpstrFile) {
id = floppybuttonsq[num][0];
else
id = floppybuttons[num][0];
+ if (id < 0)
+ return;
ti.cbSize = sizeof (TOOLINFO);
ti.uFlags = TTF_SUBCLASS | TTF_IDISHWND;
ti.hwnd = hDlg;
f_text = floppybuttons[n][0];
else
f_text = IDC_DISKTEXT;
- addfloppyhistory_2 (hDlg, n, f_text, iscd (n) ? HISTORY_CD : HISTORY_FLOPPY);
+ if (f_text >= 0)
+ addfloppyhistory_2 (hDlg, n, f_text, iscd (n) ? HISTORY_CD : HISTORY_FLOPPY);
}
}
}
chk = !showcd && disk_getwriteprotect (text) && state == TRUE ? BST_CHECKED : 0;
if (f_wp >= 0)
- CheckDlgButton(hDlg, f_wp, chk);
+ CheckDlgButton (hDlg, f_wp, chk);
chk = !showcd && state && DISK_validate_filename (text, 0, NULL, NULL, NULL) ? TRUE : FALSE;
if (f_wp >= 0) {
ew (hDlg, f_wp, chk);
- ew (hDlg, f_wptext, chk);
+ if (f_wptext >= 0)
+ ew (hDlg, f_wptext, chk);
}
}
ptr[_tcslen (ptr) + 1] |= 8;
if (active2)
ptr[_tcslen (ptr) + 1] |= 16;
+ pos += window_led_joy_start;
PostMessage (hStatusWnd, SB_SETTEXT, (WPARAM)((pos + 1) | type), (LPARAM)ptr);
if (tt != NULL)
PostMessage (hStatusWnd, SB_SETTIPTEXT, (WPARAM)(pos + 1), (LPARAM)tt);
+Beta 13:
+
+- addaq.x #x,Ax and subaq.x #x,Ax had too long cycle count (this was really stupid bug)
+- joystick type (default,mouse,joystick,analog joystick,etc..) was reset to default when
+ configuration was loaded
+- do not decide bitplane dma overriding sprite dma too early, DDFSTRT might get moved few
+ cycles before bitplane dma was originally supposed to start (Heimdall 2 AGA mouse cursor)
+- floppy panel DF0: "write-protected" text was getting disabled
+- SCSI emulation is only forced if version stored in configuration file is older than 2.3
+- CDTV MODE2FORM0 2336 byte sectors didn't work in image mode
+- Sherlock Holmes - Consulting Detective separate video tracks hack removed, working full image is available.
+- mds subchannel data wrong positioning fixed
+- fixed some rare thread syncronization issues when CDA was stopped
+- read also standard 2048 byte sectors using SPTI if CDA required SPTI mode, mixing IOCTL
+ and SPTI does not seem to be reliable
+- Brian the Lion CD32 starts CDA play at the very end of data track, obviously this must not
+ be an error, only return error if both current start and start + 2s is located inside data track
+- files inside archives didn't load if path was relative
+- paused CD32/CDTV was resumed after exiting GUI ("old-style" GUI pause/resume was not removed..)
+- directories selected via "favorite menu" also sets default path
+- prowizard updates
+
+- added ugly joystick/mouse direction status bar pointers (design stolen from Vice and
+ future AF player skin) Not sure if this was good idea..
+
Beta 12:
- <drive letter>: without '\' in harddrive paths was detected as a relative path,
--- /dev/null
+/* testGMC() */
+/* Rip_GMC() */
+/* Depack_GMC() */
+
+#include "globals.h"
+#include "extern.h"
+
+
+short testGMC ( void )
+{
+ /* test #1 */
+ if ( (PW_i<7) || ((PW_Start_Address+444)>PW_in_size) )
+ {
+/*printf ( "#1\n" );*/
+ return BAD;
+ }
+ PW_Start_Address = PW_i-7;
+
+ /* samples descriptions */
+ PW_WholeSampleSize=0;
+ PW_j=0;
+ for ( PW_k = 0 ; PW_k < 15 ; PW_k ++ )
+ {
+ PW_o = (in_data[PW_Start_Address+16*PW_k+4]*256)+in_data[PW_Start_Address+16*PW_k+5];
+ PW_n = (in_data[PW_Start_Address+16*PW_k+12]*256)+in_data[PW_Start_Address+16*PW_k+13];
+ PW_o *= 2;
+ /* volumes */
+ if ( in_data[PW_Start_Address + 7 + (16*PW_k)] > 0x40 )
+ {
+/*printf ( "#2\n" );*/
+ return BAD;
+ }
+ /* size */
+ if ( PW_o > 0xFFFF )
+ {
+/*printf ( "#2,1 Start:%ld\n" , PW_Start_Address );*/
+ return BAD;
+ }
+ if ( PW_n > PW_o )
+ {
+/*printf ( "#2,2 Start:%ld\n" , PW_Start_Address );*/
+ return BAD;
+ }
+ PW_WholeSampleSize += PW_o;
+ if ( PW_o != 0 )
+ PW_j = PW_k+1;
+ }
+ if ( PW_WholeSampleSize <= 4 )
+ {
+/*printf ( "#2,3 Start:%ld\n" , PW_Start_Address );*/
+ return BAD;
+ }
+ /* PW_j is the highest not null sample */
+
+ /* pattern table size */
+ if ( ( in_data[PW_Start_Address+243] > 0x64 ) ||
+ ( in_data[PW_Start_Address+243] == 0x00 ) )
+ {
+ return BAD;
+ }
+
+ /* pattern order table */
+ PW_l=0;
+ for ( PW_n=0 ; PW_n<100 ; PW_n++ )
+ {
+ PW_k = ((in_data[PW_Start_Address+244+PW_n*2]*256)+
+ in_data[PW_Start_Address+245+PW_n*2]);
+ if ( ((PW_k/1024)*1024) != PW_k )
+ {
+/*printf ( "#4 Start:%ld (PW_k:%ld)\n" , PW_Start_Address , PW_k);*/
+ return BAD;
+ }
+ PW_l = ((PW_k/1024)>PW_l) ? PW_k/1024 : PW_l;
+ }
+ PW_l += 1;
+ /* PW_l is the number of pattern */
+ /* 20100822 - was wrong when there was only one pattern */
+ /*if ( (PW_l == 1) || (PW_l >0x64) )*/
+ if ( PW_l >0x64 )
+ {
+/*printf ("#4.5 Start:%ld\n",PW_Start_Address);*/
+ return BAD;
+ }
+
+ /* test pattern data */
+ PW_o = in_data[PW_Start_Address+243];
+ PW_m = 0;
+ for ( PW_k=0 ; PW_k<PW_l ; PW_k++ )
+ {
+ for ( PW_n=0 ; PW_n<256 ; PW_n++ )
+ {
+ if ( ( in_data[PW_Start_Address+444+PW_k*1024+PW_n*4] > 0x03 ) ||
+ ( (in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0x0f) >= 0x90 ))
+ {
+/*printf ( "#5,0 Start:%ld (PW_k:%ld)\n" , PW_Start_Address , PW_k);*/
+ return BAD;
+ }
+ /* 20100822 - following test is removed as there seem to exist GMC with
+ sample number higher than the actual number of sample saved ...
+ seen in Jumping Jack Son game*/
+/* if ( ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0xf0)>>4) > PW_j )
+ {
+printf ( "#5,1 Start:%ld (PW_j:%ld) (where:%ld) (value:%x)\n"
+ , PW_Start_Address , PW_j , PW_Start_Address+444+PW_k*1024+PW_n*4+2
+ , ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0xf0)>>4) );
+ return BAD;
+ }*/
+ /* test volume effect if value is > 64 */
+ if ( ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0x0f) == 3) &&
+ (in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+3] > 0x64) )
+ {
+/*printf ( "#5,2 Start:%ld (PW_j:%ld)\n" , PW_Start_Address , PW_j);*/
+ return BAD;
+ }
+ if ( ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0x0f) == 4) &&
+ (in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+3] > 0x63) )
+ {
+/*printf ( "#5,3 Start:%ld (PW_j:%ld)\n" , PW_Start_Address , PW_j);*/
+ return BAD;
+ }
+ if ( ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0x0f) == 5) &&
+ (in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+3] > PW_o+1) )
+ {
+/*printf ( "#5,4 Start:%ld (effect:5)(PW_o:%ld)(4th note byte:%x)\n" , PW_Start_Address , PW_j , in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+3]);*/
+ return BAD;
+ }
+ if ( ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0x0f) == 6) &&
+ (in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+3] >= 0x02) )
+ {
+/*printf ( "#5,5 Start:%ld (at:%ld)\n" , PW_Start_Address , PW_Start_Address+444+PW_k*1024+PW_n*4+3 );*/
+ return BAD;
+ }
+ if ( ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+2]&0x0f) == 7) &&
+ (in_data[PW_Start_Address+444+PW_k*1024+PW_n*4+3] >= 0x02) )
+ {
+/*printf ( "#5,6 Start:%ld (at:%ld)\n" , PW_Start_Address , PW_Start_Address+444+PW_k*1024+PW_n*4+3 );*/
+ return BAD;
+ }
+ if ( ((in_data[PW_Start_Address+444+PW_k*1024+PW_n*4]&0x0f) > 0x00) || (in_data[PW_Start_Address+445+PW_k*1024+PW_n*4] > 0x00) )
+ PW_m = 1;
+ }
+ }
+ if ( PW_m == 0 )
+ {
+ /* only empty notes */
+ return BAD;
+ }
+ /* PW_WholeSampleSize is the whole sample size */
+
+ return GOOD;
+}
+
+
+void Rip_GMC ( void )
+{
+ /* PW_l is still the number of pattern to play */
+ /* PW_WholeSampleSize is already the whole sample size */
+
+ OutputSize = PW_WholeSampleSize + (PW_l*1024) + 444;
+
+ CONVERT = GOOD;
+ Save_Rip ( "Game Music Creator module", GMC );
+
+ if ( Save_Status == GOOD )
+ PW_i += 444; /* after header */
+}
+
+/*
+ * Game_Music_Creator.c 1997 (c) Sylvain "Asle" Chipaux
+ *
+ * Depacks musics in the Game Music Creator format and saves in ptk.
+ *
+ * update: 30/11/99
+ * - removed open() (and other fread()s and the like)
+ * - general Speed & Size Optmizings
+ *
+ * update: 23/08/10
+ * - clean up
+*/
+
+
+void Depack_GMC ( void )
+{
+ Uchar *Whatever;
+ Uchar Max=0x00;
+ long WholeSampleSize=0;
+ long i=0,j=0;
+ long Where = PW_Start_Address;
+ FILE *out;
+
+ if ( Save_Status == BAD )
+ return;
+
+ sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 );
+ out = PW_fopen ( Depacked_OutName , "w+b" );
+
+ /* title */
+ Whatever = (Uchar *) malloc ( 1084 );
+ BZERO ( Whatever , 1084 );
+
+ /* read and write whole header */
+ /*printf ( "Converting sample headers ... " );*/
+ for ( i=0 ; i<15 ; i++ )
+ {
+ Whatever[(i*30)+42] = in_data[Where+4];
+ Whatever[(i*30)+43] = in_data[Where+5];
+ WholeSampleSize += (((in_data[Where+4]*256)+in_data[Where+5])*2);
+ Whatever[(i*30)+44] = in_data[Where+6];
+ Whatever[(i*30)+45] = in_data[Where+7];
+ Whatever[(i*30)+48] = in_data[Where+12];
+ Whatever[(i*30)+49] = in_data[Where+13];
+
+ if ( (Whatever[(i*30)+48] == 0x00) && (Whatever[(i*30)+49] == 0x02) )
+ Whatever[(i*30)+49] = 0x01;
+
+ /* loop start stuff - must check if there's a loop */
+ if ( ((in_data[Where+12]*256)+in_data[Where+13]) > 2 )
+ {
+ /* ok, there's a loop size. use addresses to get the loop start */
+ /* I know, that could be done some other way ... */
+ unsigned char c=0x00,d;
+ if ( in_data[Where+3] > in_data[Where+11] )
+ {d = in_data[Where+11]+256 - in_data[Where+3]; c += 1;}
+ else
+ d = in_data[Where+11] - in_data[Where+3];
+ if ( in_data[Where+2] > in_data[Where+10] )
+ c += (in_data[Where+10]+256 - in_data[Where+2]);
+ else
+ c += in_data[Where+10] - in_data[Where+2];
+ /* other bytes _must_ be 0 */
+ Whatever[(i*30)+46] = c/2;
+ Whatever[(i*30)+47] = d/2;
+ }
+
+ Where += 16;
+ }
+
+ /* pattern list size */
+ Where = PW_Start_Address + 0xF3;
+ Whatever[950] = in_data[Where++];
+ Whatever[951] = 0x7F;
+
+ /* read and write size of pattern list */
+ /*printf ( "Creating the pattern table ... " );*/
+ Max = 0x00;
+ for ( i=0 ; i<100 ; i++ )
+ {
+ Whatever[952+i] = ((in_data[Where]*256)+in_data[Where+1])/1024;
+ Where += 2;
+ if ( Whatever[952+i] > Max )
+ Max = Whatever[952+i];
+ }
+
+ /* write ID */
+ Whatever[1080] = 'M';
+ Whatever[1081] = '.';
+ Whatever[1082] = 'K';
+ Whatever[1083] = '.';
+ fwrite ( Whatever , 1084 , 1 , out );
+
+
+ /* pattern data */
+ /*printf ( "Converting pattern datas " );*/
+ Where = PW_Start_Address + 444;
+ for ( i=0 ; i<=Max ; i++ )
+ {
+ BZERO ( Whatever , 1024 );
+ for ( j=0 ; j<1024 ; j++ ) Whatever[j] = in_data[Where++];
+ for ( j=0 ; j<256 ; j++ )
+ {
+ switch ( Whatever[(j*4)+2]&0x0f )
+ {
+ case 3: /* replace by C */
+ Whatever[(j*4)+2] += 0x09;
+ break;
+ case 4: /* replace by D */
+ Whatever[(j*4)+2] += 0x09;
+ break;
+ case 5: /* replace by B */
+ Whatever[(j*4)+2] += 0x06;
+ break;
+ case 6: /* replace by E0 */
+ Whatever[(j*4)+2] += 0x08;
+ break;
+ case 7: /* replace by E0 */
+ Whatever[(j*4)+2] += 0x07;
+ break;
+ case 8: /* replace by F */
+ Whatever[(j*4)+2] += 0x07;
+ break;
+ default:
+ break;
+ }
+ }
+ fwrite ( Whatever , 1024 , 1 , out );
+ }
+ free ( Whatever );
+
+ /* sample data */
+ /*printf ( "Saving sample data ... " );*/
+ fwrite ( &in_data[Where] , WholeSampleSize , 1 , out );
+
+ /* crap */
+ Crap ( "Game Music Creator" , BAD , BAD , out );
+
+ fflush ( out );
+ fclose ( out );
+
+ printf ( "done\n" );
+ return; /* useless ... but */
+}
--- /dev/null
+/* testNoisepacker3() */
+/* Rip_Noisepacker3() */
+/* Depack_Noisepacker3() */
+
+#include "globals.h"
+#include "extern.h"
+
+short testNoisepacker3 ( void )
+{
+ if ( PW_i < 9 )
+ {
+ return BAD;
+ }
+ PW_Start_Address = PW_i-9;
+
+ /* size of the pattern table */
+ PW_j = (in_data[PW_Start_Address+2]*256)+in_data[PW_Start_Address+3];
+ if ( (((PW_j/2)*2) != PW_j) || (PW_j == 0) )
+ {
+/*printf ( "#2 Start:%ld\n" , PW_Start_Address );*/
+ return BAD;
+ }
+ /* PW_j is the size of the pattern list (*2) */
+
+ /* test nbr of samples */
+ if ( (in_data[PW_Start_Address+1]&0x0f) != 0x0C )
+ {
+/*printf ( "#3,0 Start:%ld (nbr sample : %d)\n" , PW_Start_Address, in_data[PW_Start_Address+1]&0x0f);*/
+ return BAD;
+ }
+ PW_l = ((in_data[PW_Start_Address]<<4)&0xf0)|((in_data[PW_Start_Address+1]>>4)&0x0f);
+ if ( (PW_l > 0x1F) || (PW_l == 0) || ((PW_Start_Address+8+PW_j+PW_l*8)>PW_in_size))
+ {
+/*printf ( "#3 Start:%ld\n" , PW_Start_Address );*/
+ return BAD;
+ }
+ /* PW_l is the number of samples */
+
+ /* test volumes */
+ for ( PW_k=0 ; PW_k<PW_l ; PW_k++ )
+ {
+ if ( in_data[PW_Start_Address+9+PW_k*16] > 0x40 )
+ {
+ return BAD;
+ }
+ }
+
+ /* test sample sizes */
+ PW_WholeSampleSize=0;
+ for ( PW_k=0 ; PW_k<PW_l ; PW_k++ )
+ {
+ PW_o = (in_data[PW_Start_Address+PW_k*16+14]*256)+in_data[PW_Start_Address+PW_k*16+15];
+ PW_m = (in_data[PW_Start_Address+PW_k*16+20]*256)+in_data[PW_Start_Address+PW_k*16+21];
+ PW_n = (in_data[PW_Start_Address+PW_k*16+22]*256)+in_data[PW_Start_Address+PW_k*16+23];
+ PW_o *= 2;
+ PW_m *= 2;
+ PW_n *= 2;
+ if ( (PW_o > 0xFFFF) ||
+ (PW_m > 0xFFFF) ||
+ (PW_n > 0xFFFF) )
+ {
+/*printf ( "#5 Start:%ld\n" , PW_Start_Address );*/
+ return BAD;
+ }
+ if ( (PW_m + PW_n) > (PW_o+2) )
+ {
+/*printf ( "#5,1 Start:%ld\n" , PW_Start_Address );*/
+ return BAD;
+ }
+ if ( (PW_n != 0) && (PW_m == 0) )
+ {
+/*printf ( "#5,2 Start:%ld\n" , PW_Start_Address );*/
+ return BAD;
+ }
+ PW_WholeSampleSize += PW_o;
+ }
+ if ( PW_WholeSampleSize <= 4 )
+ {
+/*printf ( "#5,3 Start:%ld\n" , PW_Start_Address );*/
+ return BAD;
+ }
+
+
+ /* small shit to gain some vars */
+ PW_l *= 16;
+ PW_l += 8;
+ PW_l += 4;
+ /* PW_l is now the size of the header 'til the end of sample descriptions */
+ if ( (PW_l+PW_Start_Address) > PW_in_size )
+ {
+/*printf ( "NP3 Header bigger than file size (%ld > %ld)\n", PW_l, PW_in_size);*/
+ return BAD;
+ }
+
+
+ /* test pattern table */
+ PW_n=0;
+ for ( PW_k=0 ; PW_k<PW_j ; PW_k += 2 )
+ {
+ PW_m = ((in_data[PW_Start_Address+PW_l+PW_k]*256)+in_data[PW_Start_Address+PW_l+PW_k+1]);
+ if ( ((PW_m/8)*8) != PW_m )
+ {
+/*printf ( "#6 Start:%ld\n" , PW_Start_Address );*/
+ return BAD;
+ }
+ if ( PW_m > PW_n )
+ PW_n = PW_m;
+ }
+ PW_l += PW_j;
+ PW_l += PW_n;
+ PW_l += 8; /*paske on a que l'address du dernier pattern .. */
+ /* PW_l is now the size of the header 'til the end of the track list */
+ /* PW_j is now available for use :) */
+ /* PW_n is the highest pattern number (*8) */
+
+ /* test track data size */
+ PW_k = (in_data[PW_Start_Address+6]*256)+in_data[PW_Start_Address+7];
+ if ( (PW_k <= 63) || ((PW_k+PW_l+PW_Start_Address)>PW_in_size))
+ {
+/*printf ( "#7 Start:%ld\n" , PW_Start_Address );*/
+ return BAD;
+ }
+
+ /* test notes */
+ /* re-calculate the number of sample */
+ /* PW_k is the track data size */
+ PW_j = ((in_data[PW_Start_Address]<<4)&0xf0)|((in_data[PW_Start_Address+1]>>4)&0x0f);
+ for ( PW_m=0 ; PW_m < PW_k ; PW_m++ )
+ {
+ if ( (in_data[PW_Start_Address+PW_l+PW_m]&0x80) == 0x80 )
+ continue;
+ /* si note trop grande et si effet = A */
+ if ( (in_data[PW_Start_Address+PW_l+PW_m] > 0x49)||
+ ((in_data[PW_Start_Address+PW_l+PW_m+1]&0x0f) == 0x0A) )
+ {
+/*printf ( "#8,1 Start:%ld (at %x)(PW_k:%x)(PW_l:%x)(PW_m:%x)\n" , PW_Start_Address,PW_Start_Address+PW_l+PW_m,PW_k,PW_l,PW_m );*/
+ return BAD;
+ }
+ /* si effet D et arg > 0x64 */
+ if ( ((in_data[PW_Start_Address+PW_l+PW_m+1]&0x0f) == 0x0D )&&
+ (in_data[PW_Start_Address+PW_l+PW_m+2] > 0x64 ) )
+ {
+/*printf ( "#8,2 Start:%ld (at %ld)(effet:%x)(arg:%x)\n"
+ , PW_Start_Address
+ , PW_Start_Address+PW_l+PW_m
+ , in_data[PW_Start_Address+PW_l+PW_m+1]&0x0f
+ , in_data[PW_Start_Address+PW_l+PW_m+2] );*/
+ return BAD;
+ }
+ /* sample nbr > ce qui est defini au debut ? */
+/* if ( (((in_data[PW_Start_Address+PW_l+PW_m]<<4)&0x10)|
+ ((in_data[PW_Start_Address+PW_l+PW_m+1]>>4)&0x0f)) > PW_j )
+ {
+printf ( "#8,1 Start:%ld (at %x)(PW_k:%x)(PW_l:%x)(PW_m:%x)(PW_j:%ld),(smp nbr given:%d)\n"
+, PW_Start_Address
+,PW_Start_Address+PW_l+PW_m
+,PW_k
+,PW_l
+,PW_m
+,PW_j,
+(((in_data[PW_Start_Address+PW_l+PW_m]<<4)&0x10)| ((in_data[PW_Start_Address+PW_l+PW_m+1]>>4)&0x0f)));
+
+ return BAD;
+ }*/
+ /* all is empty ?!? ... cannot be ! */
+ if ( (in_data[PW_Start_Address+PW_l+PW_m] == 0) &&
+ (in_data[PW_Start_Address+PW_l+PW_m+1] == 0) &&
+ (in_data[PW_Start_Address+PW_l+PW_m+2] == 0) && (PW_m<(PW_k-3)) )
+ {
+/*printf ( "#8,3 Start:%ld (at %x)(PW_k:%x)(PW_l:%x)(PW_m:%x)(PW_j:%ld)\n" , PW_Start_Address,PW_Start_Address+PW_l+PW_m,PW_k,PW_l,PW_m,PW_j );*/
+ return BAD;
+ }
+ PW_m += 2;
+ }
+
+ /* PW_WholeSampleSize is the size of the sample data */
+ /* PW_l is the size of the header 'til the track datas */
+ /* PW_k is the size of the track datas */
+ return GOOD;
+}
+
+
+
+void Rip_Noisepacker3 ( void )
+{
+ OutputSize = PW_k + PW_WholeSampleSize + PW_l;
+ /* printf ( "\b\b\b\b\b\b\b\bNoisePacker v3 module found at %ld !. its size is : %ld\n" , PW_Start_Address , OutputSize );*/
+
+ CONVERT = GOOD;
+ Save_Rip ( "NoisePacker v3 module", Noisepacker3 );
+
+ if ( Save_Status == GOOD )
+ PW_i += 16; /* 15 should do but call it "just to be sure" :) */
+}
+
+
+
+/*
+ * NoisePacker_v3.c 1998 (c) Asle / ReDoX
+ *
+ * Converts NoisePacked MODs back to ptk
+ * Last revision : 26/11/1999 by Sylvain "Asle" Chipaux
+ * reduced to only one FREAD.
+ * Speed-up and Binary smaller.
+ * update : 01/12/99
+ * - removed fopen() and attached funcs.
+ * update : 23/08/10
+ * - Whatever wasn't cleaned up when writing patternlist (showed only if one pattern)
+ * - cleaned up a bit
+*/
+void Depack_Noisepacker3 ( void )
+{
+ Uchar *Whatever;
+ Uchar c1=0x00,c2=0x00,c3=0x00,c4=0x00;
+ Uchar Nbr_Pos;
+ Uchar Nbr_Smp;
+ Uchar poss[36][2];
+ Uchar Pat_Max=0x00;
+ long Where=PW_Start_Address;
+ long WholeSampleSize=0;
+ long TrackDataSize;
+ long Track_Addresses[128][4];
+ long Unknown1;
+ long i=0,j=0,k;
+ long Track_Data_Start_Address;
+ long SampleDataAddress=0;
+ FILE *out;
+
+ if ( Save_Status == BAD )
+ return;
+
+ fillPTKtable(poss);
+
+ BZERO ( Track_Addresses , 128*4*4 );
+
+ sprintf ( Depacked_OutName , "%ld.mod" , Cpt_Filename-1 );
+ out = PW_fopen ( Depacked_OutName , "w+b" );
+
+ /* read number of sample */
+ Nbr_Smp = ((in_data[Where]<<4)&0xf0) | ((in_data[Where+1]>>4)&0x0f);
+ /*printf ( "\nNumber of sample : %d (%x)\n" , Nbr_Smp , Nbr_Smp );*/
+
+ /* write title */
+ Whatever = (Uchar *) malloc ( 1084 );
+ BZERO ( Whatever , 1084 );
+ /*fwrite ( Whatever , 20 , 1 , out );*/
+
+ /* read size of pattern list */
+ Nbr_Pos = in_data[Where+3]/2;
+ /*printf ( "Size of pattern list : %d\n" , Nbr_Pos );*/
+
+ /* read 2 unknown bytes which size seem to be of some use ... */
+ Unknown1 = (in_data[Where+4]*256)+in_data[Where+5];
+
+ /* read track data size */
+ TrackDataSize = (in_data[Where+6]*256)+in_data[Where+7];
+ /*printf ( "TrackDataSize : %ld\n" , TrackDataSize );*/
+
+ /* read sample descriptions */
+ Where += 8;
+ for ( i=0 ; i<Nbr_Smp ; i++ )
+ {
+ /* sample name */
+ /*fwrite ( Whatever , 22 , 1 , out );*/
+ /* size */
+ Whatever[(i*30)+42] = in_data[Where+6];
+ Whatever[(i*30)+43] = in_data[Where+7];
+ /*fwrite ( &in_data[Where+6] , 2 , 1 , out );*/
+ WholeSampleSize += (((in_data[Where+6]*256)+in_data[Where+7])*2);
+ /* write finetune,vol */
+ Whatever[(i*30)+44] = in_data[Where];
+ Whatever[(i*30)+45] = in_data[Where+1];
+ /*fwrite ( &in_data[Where] , 2 , 1 , out );*/
+ /* write loop start */
+ Whatever[(i*30)+46] = in_data[Where+14];
+ Whatever[(i*30)+47] = in_data[Where+15];
+ /*fwrite ( &in_data[Where+14] , 2 , 1 , out );*/
+ /* write loop size */
+ Whatever[(i*30)+48] = in_data[Where+12];
+ Whatever[(i*30)+49] = in_data[Where+13];
+ /*fwrite ( &in_data[Where+12] , 2 , 1 , out );*/
+ Where += 16;
+ }
+ /*printf ( "Whole sample size : %ld\n" , WholeSampleSize );*/
+
+ /* write size of pattern list */
+ Whatever[950] = Nbr_Pos;
+ /*fwrite ( &Nbr_Pos , 1 , 1 , out );*/
+
+ /* write noisetracker byte */
+ Whatever[951] = 0x7f;
+ /*c1 = 0x7f;
+ fwrite ( &c1 , 1 , 1 , out );*/
+
+ /* bypass 2 bytes ... seems always the same as in $02 */
+ /* & bypass 2 other bytes which meaning is beside me */
+ Where += 4;
+
+ /* read pattern table */
+ Pat_Max = 0x00;
+ for ( i=0 ; i<Nbr_Pos ; i++ )
+ {
+ Whatever[i+952] = ((in_data[Where+(i*2)]*256)+in_data[Where+(i*2)+1])/8;
+ /*printf ( "%d," , Whatever[i+952] );*/
+ if ( Whatever[i+952] > Pat_Max )
+ Pat_Max = Whatever[i+952];
+ }
+ Where += Nbr_Pos*2;
+ Pat_Max += 1;
+ /*printf ( "Number of pattern : %d\n" , Pat_Max );*/
+
+ /* write pattern table */
+ /*fwrite ( Whatever , 128 , 1 , out );*/
+
+ /* write ptk's ID */
+ Whatever[1080] = 'M';
+ Whatever[1081] = '.';
+ Whatever[1082] = 'K';
+ Whatever[1083] = '.';
+ /*fwrite ( Whatever , 4 , 1 , out );*/
+ fwrite ( Whatever , 1084 , 1 , out );
+
+ /* read tracks addresses per pattern */
+ /*printf ( "\nWhere : %ld\n" , Where );*/
+ for ( i=0 ; i<Pat_Max ; i++ )
+ {
+ Track_Addresses[i][0] = (in_data[Where+(i*8)]*256)+in_data[Where+(i*8)+1];
+ Track_Addresses[i][1] = (in_data[Where+(i*8)+2]*256)+in_data[Where+(i*8)+3];
+ Track_Addresses[i][2] = (in_data[Where+(i*8)+4]*256)+in_data[Where+(i*8)+5];
+ Track_Addresses[i][3] = (in_data[Where+(i*8)+6]*256)+in_data[Where+(i*8)+7];
+ }
+ Track_Data_Start_Address = (Where + (Pat_Max*8));
+ /*printf ( "Track_Data_Start_Address : %ld\n" , Track_Data_Start_Address );*/
+
+ /* the track data now ... */
+ for ( i=0 ; i<Pat_Max ; i++ )
+ {
+ BZERO ( Whatever , 1084 );
+ for ( j=0 ; j<4 ; j++ )
+ {
+ Where = Track_Data_Start_Address + Track_Addresses[i][3-j];
+ for ( k=0 ; k<64 ; k++ )
+ {
+ c1 = in_data[Where];
+ Where += 1;
+ if ( c1 >= 0x80 )
+ {
+ k += ((0x100-c1)-1);
+ continue;
+ }
+ c2 = in_data[Where];
+ Where += 1;
+ c3 = in_data[Where];
+ Where += 1;
+
+ Whatever[k*16+j*4] = (c1<<4)&0x10;
+ c4 = (c1 & 0xFE)/2;
+ Whatever[k*16+j*4] |= poss[c4][0];
+ Whatever[k*16+j*4+1] = poss[c4][1];
+ if ( (c2&0x0f) == 0x08 )
+ c2 &= 0xf0;
+ if ( (c2&0x0f) == 0x07 )
+ {
+ c2 = (c2&0xf0)+0x0A;
+ if ( c3 > 0x80 )
+ c3 = 0x100-c3;
+ else
+ c3 = (c3<<4)&0xf0;
+ }
+ if ( (c2&0x0f) == 0x06 )
+ {
+ if ( c3 > 0x80 )
+ c3 = 0x100-c3;
+ else
+ c3 = (c3<<4)&0xf0;
+ }
+ if ( (c2&0x0f) == 0x05 )
+ {
+ if ( c3 > 0x80 )
+ c3 = 0x100-c3;
+ else
+ c3 = (c3<<4)&0xf0;
+ }
+ if ( (c2&0x0f) == 0x0E )
+ {
+ c3 = 0x01;
+ }
+ if ( (c2&0x0f) == 0x0B )
+ {
+ c3 += 0x04;
+ c3 /= 2;
+ }
+ Whatever[k*16+j*4+2] = c2;
+ Whatever[k*16+j*4+3] = c3;
+ if ( (c2&0x0f) == 0x0D )
+ k = 100; /* to leave the loop */
+ }
+ if ( Where > SampleDataAddress )
+ SampleDataAddress = Where;
+ }
+ fwrite ( Whatever , 1024 , 1 , out );
+ }
+ free ( Whatever );
+
+ /* sample data */
+ if ( (((SampleDataAddress-PW_Start_Address)/2)*2) != SampleDataAddress )
+ SampleDataAddress += 1;
+ Where = SampleDataAddress;
+ /*printf ( "Starting address of sample data : %x\n" , ftell ( in ) );*/
+ fwrite ( &in_data[SampleDataAddress] , WholeSampleSize , 1 , out );
+
+ Crap ( " NoisePacker v3 " , BAD , BAD , out );
+
+ fclose ( out );
+
+ printf ( "done\n" );
+ return; /* useless ... but */
+}
* - overall speed and size optimizings.
* Update: 19/04/00 (all pointed out by Thomas Neumann)
* - replen bug correction
- * Update: 15/05/10
+ * Update: 15/08/10
* - rewrote depacker for patternlist generation
+ * update : 23 aug 2010
+ * - fixed yet another patternlist bug
*/
void Depack_PP10 ( void )
Header[951] = in_data[Where];
Where += 1;
- // now, where = 0xFA
+ /* now, where = 0xFA*/
for (i=0;i<Header[950];i++)
{
ReadPat[i] = (in_data[Where+i]*256*256*256) +
k = m;
for (i=0; i<Header[950] ; i++)
if (ReadPat[i] == k)
- Header[952+i] = (unsigned char)l;
+ {
+ Header[952+i] = (unsigned char)l;
+ j++;
+ }
+ j--;
l++;
}
if ( l != Header[950] )
* - rewrote depacker (no more useless patterns)
* update : 20100815
* - removed unused var and ;
+ * update : 23 aug 2010
+ * - fixed yet another patternlist bug
*/
void Depack_PP21 ( void )
for (j=0; j<Header[950] ; j++)
{
m = 0x7fffffff; /* min */
+ /*fprintf (info,"[%ld]pattern[%ld]",l,j);*/
/*search for min */
for (i=0; i<Header[950] ; i++)
if ((ReadPat[i]<m) && (ReadPat[i]>k))
+ {
m = ReadPat[i];
+ /*fprintf (info,"(i:%ld)(min:%ld)(k:%ld)",i,m,k);*/
+ }
/* if k == m then an already existing ref was found */
if (k==m)
+ {
+ /*fprintf (info," <- pattern known (k:%ld - m:%ld)\n",k,m);*/
continue;
+ }
+/* else
+ fprintf (info,"\n");*/
/* m is the next minimum */
k = m;
for (i=0; i<Header[950] ; i++)
if (ReadPat[i] == k)
- Header[952+i] = (unsigned char)l;
+ {
+ /*fprintf (info,"-> pos %ld gets %ld\n",i,l);*/
+ Header[952+i] = (unsigned char)l;
+ j++;
+ }
+ j--;
l++;
}
- if ( l != Header[950] )
- l -= 1;
+ /*fprintf (info,"\nnumber of pattern stored : %ld",l);*/
/*fprintf (info,"number of pattern stored : %ld\n\n",l);*/
- //fflush (info);
+ /*fprintf (info," (%ld)\n",l);*/
/* write ptk's ID */
Header[1080] = 'M';
for (i=0;i<l;i++)
{
/*fprintf (info,"pattern %ld (/%ld)\n",i,l);*/
- //fflush (info);
+ /*fflush (info);*/
BZERO(Pattern,1024);
/* which pattern is it now ? */
for (j=0;j<Header[950];j++)
/*printf ( "#6 (vol > 40 at : %ld)\n" , PW_Start_Address+PW_k+766+PW_j*4+2 );*/
return BAD;
}
- /* break > 40 ? */
+ /* break > 64 ? */
if ( ((in_data[PW_Start_Address+PW_k+766+PW_j*4+2]&0x0f)==0x0d) &&
- (in_data[PW_Start_Address+PW_k+766+PW_j*4+3] > 0x40 ) )
+ (in_data[PW_Start_Address+PW_k+766+PW_j*4+3] > 0x64 ) )
{
-/*printf ( "#6,1\n" );*/
+/*printf ( "#6,1 Start:%ld\n",PW_Start_Address );*/
return BAD;
}
/* jump > 128 */
if ( ((in_data[PW_Start_Address+PW_k+766+PW_j*4+2]&0x0f)==0x0b) &&
(in_data[PW_Start_Address+PW_k+766+PW_j*4+3] > 0x7f ) )
{
-/*printf ( "#6,2\n" );*/
+/*printf ( "#6,2 Start:%ld\n",PW_Start_Address );*/
return BAD;
}
/* smp > 1f ? */
if ((in_data[PW_Start_Address+PW_k+766+PW_j*4]&0xf0)>0x10)
{
-/*printf ( "#6,3\n" );*/
+/*printf ( "#6,3 Start:%ld\n",PW_Start_Address );*/
return BAD;
}
}
* - no more fopen ()
* update : 16 aug 2010
* - rewrotte depacker for patternlist generation
+ * update : 23 aug 2010
+ * - fixed yet another patternlist bug
*/
void Depack_PP30 ( void )
Header[951] = in_data[Where];
Where += 1;
- // now, where = 0xFA
+ /* now, where = 0xFA */
for (i=0;i<Header[950];i++)
{
ReadPat[i] = (in_data[Where+i]*256*256*256) +
k = m;
for (i=0; i<Header[950] ; i++)
if (ReadPat[i] == k)
- Header[952+i] = (unsigned char)l;
+ {
+ Header[952+i] = (unsigned char)l;
+ j++;
+ }
+ j--;
l++;
}
- if ( l != Header[950] )
- l -= 1;
/* write ptk's ID */
/* l is the number of stored patterns */
/* rebuild pattern data now */
whereTableRef = ((Highest_Track + 1)*128) + 4 + Where;
- //printf ( "\nwhereTableRef : %ld\n",whereTableRef);
+ /*printf ( "\nwhereTableRef : %ld\n",whereTableRef);*/
for (i=0;i<l;i++)
{
BZERO(Pattern,1024);
root->volume = zv;
root->type = ZNODE_DIR;
i = 0;
- if (name[0] != '/' && name[0] != '\\') {
+ if (name[0] != '/' && name[0] != '\\' && _tcsncmp (name, L".\\", 2) != 0) {
if (_tcschr (name, ':') == 0) {
for (i = _tcslen (name) - 1; i > 0; i--) {
if (name[i] == FSDB_DIR_SEPARATOR) {