static const TCHAR *magiccursors[] = { L"both", L"native", L"host", 0 };
static const TCHAR *autoscale[] = { L"none", L"scale", L"resize", 0 };
static const TCHAR *joyportmodes[] = { L"", L"mouse", L"djoy", L"ajoy", L"cdtvjoy", L"cd32joy", L"lightpen", 0 };
-static const TCHAR *joyaf[] = { L"none", L"pushpull", L"toggle", 0 };
+static const TCHAR *joyaf[] = { L"none", L"normal", L"toggle", 0 };
static const TCHAR *epsonprinter[] = { L"none", L"ascii", L"epson_matrix_9pin", L"epson_matrix_24pin", L"epson_matrix_48pin", 0 };
static const TCHAR *aspects[] = { L"none", L"vga", L"tv", 0 };
static const TCHAR *vsyncmodes[] = { L"false", L"true", L"autoswitch", 0 };
void setmousestate (int mouse, int axis, int data, int isabs);
extern int getmousestate (int mouse);
extern void inputdevice_updateconfig (struct uae_prefs *prefs);
-extern void inputdevice_mergeconfig (struct uae_prefs *prefs);
extern void inputdevice_devicechange (struct uae_prefs *prefs);
extern int inputdevice_translatekeycode (int keyboard, int scancode, int state);
extern struct inputevent *inputdevice_get_eventinfo (int evt);
extern void inputdevice_get_eventname (const struct inputevent *ie, TCHAR *out);
extern void inputdevice_compa_prepare_custom (struct uae_prefs *prefs, int index);
+extern void inputdevice_compa_clear (struct uae_prefs *prefs, int index);
extern int intputdevice_compa_get_eventtype (int evt, int **axistable);
};
#define JPORT_NONE -1
#define JPORT_CUSTOM -2
+#define JPORT_AF_NORMAL 1
+#define JPORT_AF_TOGGLE 2
#define MAX_SPARE_DRIVES 20
#define MAX_CUSTOM_MEMORY_ADDRS 2
};
#define ArchiveFormat7Zip '7z '
-#define ArchiveFormatXZ 'xz '
#define ArchiveFormatRAR 'rar '
#define ArchiveFormatZIP 'zip '
#define ArchiveFormatLHA 'lha '
#define ArchiveFormatTAR 'tar '
#define PEEK_BYTES 1024
+#define FILE_PEEK 1
-extern int zfile_is_ignore_ext(const TCHAR *name);
+extern int zfile_is_ignore_ext (const TCHAR *name);
-extern struct zvolume *zvolume_alloc(struct zfile *z, unsigned int id, void *handle, const TCHAR*);
-extern struct zvolume *zvolume_alloc_empty(struct zvolume *zv, const TCHAR *name);
+extern struct zvolume *zvolume_alloc (struct zfile *z, unsigned int id, void *handle, const TCHAR*);
+extern struct zvolume *zvolume_alloc_empty (struct zvolume *zv, const TCHAR *name);
-extern struct znode *zvolume_addfile_abs(struct zvolume *zv, struct zarchive_info*);
-extern struct znode *zvolume_adddir_abs(struct zvolume *zv, struct zarchive_info *zai);
-extern struct znode *znode_adddir(struct znode *parent, const TCHAR *name, struct zarchive_info*);
+extern struct znode *zvolume_addfile_abs (struct zvolume *zv, struct zarchive_info*);
+extern struct znode *zvolume_adddir_abs (struct zvolume *zv, struct zarchive_info *zai);
+extern struct znode *znode_adddir (struct znode *parent, const TCHAR *name, struct zarchive_info*);
extern struct zvolume *archive_directory_plain (struct zfile *zf);
extern struct zfile *archive_access_plain (struct znode *zn);
extern struct zfile *archive_access_zip (struct znode *zn, int flags);
extern struct zvolume *archive_directory_7z (struct zfile *z);
extern struct zfile *archive_access_7z (struct znode *zn);
-extern struct zvolume *archive_directory_xz (struct zfile *z);
-extern struct zfile *archive_access_xz (struct znode *zn);
extern struct zvolume *archive_directory_rar (struct zfile *z);
extern struct zfile *archive_access_rar (struct znode *zn);
extern struct zvolume *archive_directory_lzx (struct zfile *in_file);
extern void archive_access_close (void *handle, unsigned int id);
-extern struct zfile *archive_getzfile(struct znode *zn, unsigned int id, int flags);
+extern struct zfile *archive_getzfile (struct znode *zn, unsigned int id, int flags);
extern struct zfile *decompress_zfd (struct zfile*);
\ No newline at end of file
extern struct zfile *zfile_fopen (const TCHAR *, const TCHAR *, int mask);
extern struct zfile *zfile_fopen2 (const TCHAR *, const TCHAR *, int mask, int index);
extern struct zfile *zfile_fopen_empty (struct zfile*, const TCHAR *name, uae_u64 size);
+extern struct zfile *zfile_fopen_empty (struct zfile*, const TCHAR *name);
extern struct zfile *zfile_fopen_data (const TCHAR *name, uae_u64 size, uae_u8 *data);
extern struct zfile *zfile_fopen_parent (struct zfile*, const TCHAR*, uae_u64 offset, uae_u64 size);
*
* joystick/mouse emulation
*
-* Copyright 2001-2008 Toni Wilen
+* Copyright 2001-2010 Toni Wilen
*
* new fetures:
* - very configurable (and very complex to configure :)
_tcscpy (dst->jports[num].name, src->jports[num].name);
dst->jports[num].id = src->jports[num].id;
dst->jports[num].mode = src->jports[num].mode;
+ dst->jports[num].autofire = src->jports[num].autofire;
}
static void out_config (struct zfile *f, int id, int num, TCHAR *s1, TCHAR *s2)
case 1:
v = ((pra & dra) | (dra ^ 0xff)) & 0x7;
if (parport_joystick_enabled) {
- if (getbuttonstate (2, 0)) v &= ~4;
- if (getbuttonstate (3, 0)) v &= ~1;
+ if (getbuttonstate (2, 0))
+ v &= ~4;
+ if (getbuttonstate (3, 0))
+ v &= ~1;
}
return v;
default:
}
}
+/* p5 is 1 or floating = cd32 2-button mode */
+static bool cd32padmode (uae_u16 p5dir, uae_u16 p5dat)
+{
+ if (!(potgo_value & p5dir) || ((potgo_value & p5dat) && (potgo_value & p5dir)))
+ return false;
+ return true;
+}
+
+
static void charge_cap (int joy, int idx, int charge)
{
if (charge < -1 || charge > 1)
int charge = 0, dong, joypot;
uae_u16 pdir = 0x0200 << (joy * 4 + i * 2); /* output enable */
uae_u16 pdat = 0x0100 << (joy * 4 + i * 2); /* data */
+ uae_u16 p5dir = 0x0200 << (joy * 4);
+ uae_u16 p5dat = 0x0100 << (joy * 4);
int isbutton = getbuttonstate (joy, i == 0 ? JOYBUTTON_3 : JOYBUTTON_2);
- if (cd32_pad_enabled[joy])
- continue;
+ if (cd32_pad_enabled[joy]) {
+ if (i != 0) // 3rd button?
+ continue;
+ if (cd32padmode (p5dir, p5dat))
+ continue;
+ // only red and blue can be read if CD32 pad and only if it is in normal pad mode
+ isbutton |= getbuttonstate (joy, JOYBUTTON_CD32_BLUE);
+ }
+
dong = dongle_analogjoy (joy, i);
if (dong >= 0) {
isbutton = 0;
uae_u16 p5dir = 0x0200 << (i * 4);
uae_u16 p5dat = 0x0100 << (i * 4);
but |= 0x40 << i;
- /* Red button is connected to fire when p5 is 1 or floating */
- if (!(potgo_value & p5dir) || ((potgo_value & p5dat) && (potgo_value & p5dir))) {
+ if (!cd32padmode (p5dir, p5dat)) {
if (getbuttonstate (i, JOYBUTTON_CD32_RED))
but &= ~(0x40 << i);
}
uae_u16 p5dir = 0x0200 << (i * 4); /* output enable P5 */
uae_u16 p5dat = 0x0100 << (i * 4); /* data P5 */
- if (cd32_pad_enabled[i]) {
+ if (cd32_pad_enabled[i] && cd32padmode (p5dir, p5dat)) {
/* p5 is floating in input-mode */
potgor &= ~p5dat;
if (cd32_shifter[i] >= 2 && (joybutton[i] & ((1 << JOYBUTTON_CD32_PLAY) << (cd32_shifter[i] - 2))))
potgor &= ~p9dat;
- } else {
+ } else {
potgor &= ~p5dat;
if (pot_cap[i][0] > 100)
potgor |= p5dat;
- potgor &= ~p9dat;
- if (pot_cap[i][1] > 100)
- potgor |= p9dat;
+
+ if (!cd32_pad_enabled[i]) {
+ potgor &= ~p9dat;
+ if (pot_cap[i][1] > 100)
+ potgor |= p9dat;
+ }
}
}
static void clearkbrevent (struct uae_input_device *uid, int evt)
{
for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) {
- bool found = false;
for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) {
if (uid->eventid[i][j] == evt) {
uid->eventid[i][j] = 0;
freejport (prefs, index);
resetjport (prefs, index);
if (mode == 0)
- mode = index == 0 ? JSEM_MODE_MOUSE : JSEM_MODE_JOYSTICK;
+ mode = index == 0 ? JSEM_MODE_MOUSE : (prefs->cs_cd32cd ? JSEM_MODE_JOYSTICK_CD32 : JSEM_MODE_JOYSTICK);
prefs->jports[index].mode = mode;
prefs->jports[index].id = -2;
remove_compa_config (prefs, index);
}
+// clear device before switching to new one
+void inputdevice_compa_clear (struct uae_prefs *prefs, int index)
+{
+ freejport (prefs, index);
+ resetjport (prefs, index);
+ remove_compa_config (prefs, index);
+}
+
static void cleardev (struct uae_input_device *uid, int num)
{
for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) {
for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) {
uid[num].eventid[i][j] = 0;
+ uid[num].flags[i][j] = 0;
+ xfree (uid[num].custom[i][j]);
+ uid[num].custom[i][j] = NULL;
}
}
}
-static void setjoyinputs (struct uae_prefs *prefs, int port)
-{
- joyinputs[port] = NULL;
- switch (joymodes[port])
- {
- case JSEM_MODE_JOYSTICK:
- if (port >= 2)
- joyinputs[port] = port == 3 ? ip_parjoy2 : ip_parjoy1;
- else
- joyinputs[port] = port == 1 ? ip_joy2 : ip_joy1;
- break;
- case JSEM_MODE_JOYSTICK_CD32:
- joyinputs[port] = port ? ip_joycd322 : ip_joycd321;
- break;
- case JSEM_MODE_JOYSTICK_ANALOG:
- joyinputs[port] = port ? ip_analog2 : ip_analog1;
- break;
- case JSEM_MODE_MOUSE:
- joyinputs[port] = port ? ip_mouse2 : ip_mouse1;
- break;
- case JSEM_MODE_LIGHTPEN:
- joyinputs[port] = port ? ip_lightpen2 : ip_lightpen1;
- break;
- case JSEM_MODE_MOUSE_CDTV:
- joyinputs[port] = ip_mousecdtv;
- break;
- }
-}
static void enablejoydevice (struct uae_input_device *uid, int evtnum)
{
enablejoydevice (&prefs->mouse_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum);
enablejoydevice (&prefs->keyboard_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum);
}
- for (int i = 0; axistable[i] >= 0; i += 3) {
- if (evtnum == axistable[i] || evtnum == axistable[i + 1] || evtnum == axistable[i + 2]) {
+ for (int k = 0; axistable[k] >= 0; k += 3) {
+ if (evtnum == axistable[k] || evtnum == axistable[k + 1] || evtnum == axistable[k + 2]) {
for (int j = 0; j < 3; j++) {
- int evtnum2 = axistable[i + j];
+ int evtnum2 = axistable[k + j];
for (int l = 0; l < MAX_INPUT_DEVICES; l++) {
enablejoydevice (&prefs->joystick_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum2);
enablejoydevice (&prefs->mouse_settings[GAMEPORT_INPUT_SETTINGS][l], evtnum2);
}
}
+static void setjoyinputs (struct uae_prefs *prefs, int port)
+{
+ joyinputs[port] = NULL;
+ switch (joymodes[port])
+ {
+ case JSEM_MODE_JOYSTICK:
+ if (port >= 2)
+ joyinputs[port] = port == 3 ? ip_parjoy2 : ip_parjoy1;
+ else
+ joyinputs[port] = port == 1 ? ip_joy2 : ip_joy1;
+ break;
+ case JSEM_MODE_JOYSTICK_CD32:
+ joyinputs[port] = port ? ip_joycd322 : ip_joycd321;
+ break;
+ case JSEM_MODE_JOYSTICK_ANALOG:
+ joyinputs[port] = port ? ip_analog2 : ip_analog1;
+ break;
+ case JSEM_MODE_MOUSE:
+ joyinputs[port] = port ? ip_mouse2 : ip_mouse1;
+ break;
+ case JSEM_MODE_LIGHTPEN:
+ joyinputs[port] = port ? ip_lightpen2 : ip_lightpen1;
+ break;
+ case JSEM_MODE_MOUSE_CDTV:
+ joyinputs[port] = ip_mousecdtv;
+ break;
+ }
+}
+
static void setautofire (struct uae_input_device *uid, int port, int af)
{
int *afp = af_ports[port];
for (int i = 0; i < MAX_INPUT_DEVICE_EVENTS; i++) {
for (int j = 0; j < MAX_INPUT_SUB_EVENT; j++) {
if (uid->eventid[i][j] == afp[k]) {
- uid->flags[i][j] |= ID_FLAG_AUTOFIRE;
+ uid->flags[i][j] &= ~(ID_FLAG_AUTOFIRE | ID_FLAG_TOGGLE);
+ if (af >= JPORT_AF_NORMAL)
+ uid->flags[i][j] |= ID_FLAG_AUTOFIRE;
+ if (af == JPORT_AF_TOGGLE)
+ uid->flags[i][j] |= ID_FLAG_TOGGLE;
}
}
}
case JSEM_MODE_JOYSTICK_CD32:
default:
{
- int iscd32 = mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd);
- joymodes[i] = mode == JSEM_MODE_JOYSTICK_CD32 ? JSEM_MODE_JOYSTICK_CD32 : JSEM_MODE_JOYSTICK;
+ bool iscd32 = mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd);
+ joymodes[i] = iscd32 ? JSEM_MODE_JOYSTICK_CD32 : JSEM_MODE_JOYSTICK;
if (!iscd32)
joyinputs[i] = i ? ip_joy2 : ip_joy1;
else
break;
}
} else if (prefs->jports[i].id >= 0) {
- prefs->jports[i].mode = joymodes[i] = i ? JSEM_MODE_JOYSTICK : JSEM_MODE_MOUSE;
+ joymodes[i] = i ? JSEM_MODE_JOYSTICK : JSEM_MODE_MOUSE;
joyinputs[i] = i ? ip_joy2 : ip_mouse1;
}
}
case JSEM_MODE_JOYSTICK_CD32:
default:
{
- int iscd32 = mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd);
+ bool iscd32 = mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd);
input_get_default_joystick (joysticks, joy, i, iscd32 ? JSEM_MODE_JOYSTICK_CD32 : 0);
- joymodes[i] = mode == JSEM_MODE_JOYSTICK_CD32 ? JSEM_MODE_JOYSTICK_CD32 : JSEM_MODE_JOYSTICK;
+ joymodes[i] = iscd32 ? JSEM_MODE_JOYSTICK_CD32 : JSEM_MODE_JOYSTICK;
break;
}
case JSEM_MODE_JOYSTICK_ANALOG:
int mode = prefs->jports[i].mode;
for (joy = 0; used[joy]; joy++);
if (JSEM_ISANYKBD (i, prefs)) {
- int cd32 = mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd);
+ bool cd32 = mode == JSEM_MODE_JOYSTICK_CD32 || (mode == JSEM_MODE_DEFAULT && prefs->cs_cd32cd);
if (JSEM_ISNUMPAD (i, prefs)) {
if (cd32)
kb = keyboard_default_kbmaps[KBR_DEFAULT_MAP_CD32_NP];
}
}
}
- for (i = 0; i < MAX_JPORTS; i++) {
- if (prefs->jports[i].autofire)
- setautofires (prefs, i, prefs->jports[i].autofire);
- }
+ for (i = 0; i < MAX_JPORTS; i++)
+ setautofires (prefs, i, prefs->jports[i].autofire);
for (i = 0; i < MAX_JPORTS; i++) {
setjoyinputs (prefs, i);
}
}
-static void inputdevice_updateconfig2 (struct uae_prefs *prefs)
+void inputdevice_updateconfig (struct uae_prefs *prefs)
{
int i;
config_changed = 1;
}
-void inputdevice_mergeconfig (struct uae_prefs *prefs)
-{
- inputdevice_updateconfig2 (prefs);
-}
-void inputdevice_updateconfig (struct uae_prefs *prefs)
-{
- inputdevice_updateconfig2 (prefs);
-}
-
-
/* called when devices get inserted or removed
* store old devices temporarily, enumerate all devices
* restore old devices back (order may have changed)
#define STEALTHF_SPECIAL 0x02
#define STEALTHF_E1KEY 0x01
-static void sendmmcodes(int code, int newstate)
+static void sendmmcodes (int code, int newstate)
{
uae_u8 b;
uid->eventid[i][j] = swaps[1 - k][kk];
found = true;
} else {
-#if 1
for (int jj = 0; axistable[jj] >= 0; jj += 3) {
if (evtnum == axistable[jj] || evtnum == axistable[jj + 1] || evtnum == axistable[jj + 2]) {
for (int ii = 0; ii < 3; ii++) {
}
}
}
-#endif
}
}
}
{
if (testmode) {
inputdevice_testrecord (IDTYPE_JOYSTICK, joy, IDEV_WIDGET_BUTTON, button, state);
+ if (state < 0)
+ inputdevice_testrecord (IDTYPE_JOYSTICK, joy, IDEV_WIDGET_BUTTON, button, 0);
return;
}
#if 0
{
fixup_prefs_dim2 (&prefs->gfx_size_fs);
fixup_prefs_dim2 (&prefs->gfx_size_win);
- if (prefs->gfx_filter == 0 && prefs->gfx_filter_autoscale)
+ if (prefs->gfx_filter == 0 && prefs->gfx_filter_autoscale && !prefs->gfx_api)
prefs->gfx_filter = 1;
if (prefs->gfx_filter_autoscale) {
prefs->gfx_filter_horiz_zoom_mult = 0;
+#if 0
+#define XFD 0
#include <windows.h>
f = _tfopen(L"xfd-out-text.txt", L"rb");
if (f) {
char tmp[1000];
- int first = 1;
while (fgets(tmp, sizeof tmp, f)) {
if (strlen(tmp) <= 1)
continue;
- if (first) {
- first = 0;
- continue;
+ for (int i = 0; tmp[i]; i++) {
+ if (tmp[i] == -101 || (tmp[i] == 27 && tmp[i + 1] == '[')) {
+ int j = i + 1;
+ if (tmp[i] == 27)
+ j++;
+ while (tmp[j] > 0 && tmp[j] < 0x40)
+ j++;
+ if (tmp[j])
+ j++;
+ memmove (tmp + i, tmp + j, strlen(tmp + j) + 1);
+ }
}
if (tmp[strlen(tmp)-1] == 10)
tmp[strlen(tmp)-1] = 0;
int wmain (int argc, wchar_t *argv[], wchar_t *envp[])
{
- //return runxfd (argc, argv);
+#if XFD
+ return runxfd (argc, argv);
+#else
return runmain (argc, argv);
+#endif
}
+
+#endif
*
* Win32 DirectInput/Windows XP RAWINPUT interface
*
-* Copyright 2002 - 2004 Toni Wilen
+* Copyright 2002 - 2010 Toni Wilen
*/
#define _WIN32_WINNT 0x501 /* enable RAWINPUT support */
did->axissort[2] = 2;
did->axisname[2] = my_strdup (L"Wheel");
addplusminus (did, 2);
- if (rdim->fHasHorizontalWheel) {
+ if (1 || rdim->fHasHorizontalWheel) { // why is this always false?
did->axissort[3] = 3;
did->axisname[3] = my_strdup (L"HWheel");
did->axles++;
}
lastmbr[num] = rm->ulRawButtons;
}
- if (rm->usButtonFlags & RI_MOUSE_WHEEL) {
- int val = (short)rm->usButtonData;
- int bnum = did->buttons_real;
- setmousestate (num, 2, val, 0);
- if (val < 0)
- setmousebuttonstate (num, bnum + 0, -1);
- else if (val > 0)
- setmousebuttonstate (num, bnum + 1, -1);
+ for (i = 0; i < 2; i++) {
+ int bnum = did->buttons_real + (i * 2);
+ // RI_MOUSE_WHEEL << 1 = HWHEEL
+ if (rm->usButtonFlags & (RI_MOUSE_WHEEL << i)) {
+ int val = (short)rm->usButtonData;
+ setmousestate (num, 2, val, 0);
+ if (istest)
+ setmousestate (num, 2, 0, 0);
+ if (val < 0)
+ setmousebuttonstate (num, bnum + 0, -1);
+ else if (val > 0)
+ setmousebuttonstate (num, bnum + 1, -1);
+ }
}
if (istest) {
if (abs (rm->lLastX - lastx[num]) > 7) {
if (scancode == 0xaa)
return;
-#if 1
for (num = 0; num < num_keyboard; num++) {
did = &di_keyboard[num];
if (did->acquired && did->rawinput == raw->header.hDevice)
inputdevice_add_inputcode (AKS_ENTERGUI, 1);
return;
}
-#endif
- if (rawkeystate[scancode] == pressed)
+
+ if (rawkeystate[scancode] == pressed) {
return;
+ }
rawkeystate[scancode] = pressed;
if (istest) {
if (pressed && (scancode == DIK_F12 || scancode == DIK_F11))
}
}
-#if 0
-static void read_rawinput (void)
-{
- RAWINPUT raw;
- int size, ret;
-
- for(;;) {
- size = sizeof (RAWINPUT);
- ret = pGetRawInputBuffer (&raw, &size, sizeof (RAWINPUTHEADER));
- if (ret <= 0)
- return;
- handle_rawinput_2 (&raw);
- }
-}
-#endif
-
void handle_rawinput (LPARAM lParam)
{
UINT dwSize;
}
}
}
+ memset (rawkeystate, 0, sizeof rawkeystate);
}
static int kb_np[] = { DIK_NUMPAD4, -1, DIK_NUMPAD6, -1, DIK_NUMPAD8, -1, DIK_NUMPAD2, -1, DIK_NUMPAD0, DIK_NUMPAD5, -1, DIK_DECIMAL, DIK_DIVIDE, DIK_NUMPADENTER, -1, -1 };
static int kb_ck[] = { DIK_LEFT, -1, DIK_RIGHT, -1, DIK_UP, -1, DIK_DOWN, -1, DIK_RCONTROL, DIK_RMENU, -1, DIK_RSHIFT, -1, -1 };
static int kb_se[] = { DIK_A, -1, DIK_D, -1, DIK_W, -1, DIK_S, -1, DIK_LMENU, -1, DIK_LSHIFT, -1, -1 };
-static int kb_cd32_np[] = { DIK_NUMPAD4, -1, DIK_NUMPAD6, -1, DIK_NUMPAD8, -1, DIK_NUMPAD2, -1, DIK_NUMPAD1, -1, DIK_NUMPAD3, -1, DIK_NUMPAD7, -1, DIK_NUMPAD9, -1, DIK_DIVIDE, -1, DIK_SUBTRACT, -1, DIK_MULTIPLY, -1, -1 };
-static int kb_cd32_ck[] = { DIK_LEFT, -1, DIK_RIGHT, -1, DIK_UP, -1, DIK_DOWN, -1, DIK_NUMPAD1, -1, DIK_NUMPAD3, -1, DIK_NUMPAD7, -1, DIK_NUMPAD9, -1, DIK_DIVIDE, -1, DIK_SUBTRACT, -1, DIK_MULTIPLY, -1, -1 };
-static int kb_cd32_se[] = { DIK_A, -1, DIK_D, -1, DIK_W, -1, DIK_S, -1, DIK_NUMPAD1, -1, DIK_NUMPAD3, -1, DIK_NUMPAD7, -1, DIK_NUMPAD9, -1, DIK_DIVIDE, -1, DIK_SUBTRACT, -1, DIK_MULTIPLY, -1, -1 };
+
+static int kb_cd32_np[] = { DIK_NUMPAD4, -1, DIK_NUMPAD6, -1, DIK_NUMPAD8, -1, DIK_NUMPAD2, -1, DIK_NUMPAD0, DIK_NUMPAD5, DIK_NUMPAD1, -1, DIK_DECIMAL, DIK_NUMPAD3, -1, DIK_NUMPAD7, -1, DIK_NUMPAD9, -1, DIK_DIVIDE, -1, DIK_SUBTRACT, -1, DIK_MULTIPLY, -1, -1 };
+static int kb_cd32_ck[] = { DIK_LEFT, -1, DIK_RIGHT, -1, DIK_UP, -1, DIK_DOWN, -1, DIK_RCONTROL, -1, DIK_RMENU, -1, DIK_NUMPAD7, -1, DIK_NUMPAD9, -1, DIK_DIVIDE, -1, DIK_SUBTRACT, -1, DIK_MULTIPLY, -1, -1 };
+static int kb_cd32_se[] = { DIK_A, -1, DIK_D, -1, DIK_W, -1, DIK_S, -1, -1, DIK_LMENU, -1, DIK_LSHIFT, -1, DIK_NUMPAD7, -1, DIK_NUMPAD9, -1, DIK_DIVIDE, -1, DIK_SUBTRACT, -1, DIK_MULTIPLY, -1, -1 };
+
static int kb_xa1[] = { DIK_NUMPAD4, -1, DIK_NUMPAD6, -1, DIK_NUMPAD8, -1, DIK_NUMPAD2, DIK_NUMPAD5, -1, DIK_LCONTROL, -1, DIK_LMENU, -1, DIK_SPACE, -1, -1 };
static int kb_xa2[] = { DIK_D, -1, DIK_G, -1, DIK_R, -1, DIK_F, -1, DIK_A, -1, DIK_S, -1, DIK_Q, -1 };
static int kb_arcadia[] = { DIK_F2, -1, DIK_1, -1, DIK_2, -1, DIK_5, -1, DIK_6, -1, -1 };
static int kb_arcadiaxa[] = { DIK_1, -1, DIK_2, -1, DIK_3, -1, DIK_4, -1, DIK_6, -1, DIK_LBRACKET, DIK_LSHIFT, -1, DIK_RBRACKET, -1, DIK_C, -1, DIK_5, -1, DIK_Z, -1, DIK_X, -1, -1 };
+
static int *kbmaps[] = { kb_np, kb_ck, kb_se, kb_cd32_np, kb_cd32_ck, kb_cd32_se, kb_xa1, kb_xa2, kb_arcadia, kb_arcadiaxa };
extern int ispressed (int key);
return capslockstate;
}
-#ifdef ARCADIA
-
-static int handlearcadia (int scancode, int state)
-{
- int e = 0;
- if (!arcadia_bios)
- return 0;
- switch (scancode)
- {
- case DIK_F2:
- e = INPUTEVENT_SPC_ARCADIA_DIAGNOSTICS;
- break;
- case DIK_1:
- e = INPUTEVENT_SPC_ARCADIA_PLAYER1;
- break;
- case DIK_2:
- e = INPUTEVENT_SPC_ARCADIA_PLAYER2;
- break;
- case DIK_5:
- e = INPUTEVENT_SPC_ARCADIA_COIN1;
- break;
- case DIK_6:
- e = INPUTEVENT_SPC_ARCADIA_COIN2;
- break;
- }
- if (!e)
- return 0;
- handle_input_event (e, state, 1, 0);
- return 1;
-}
-
-#endif
-
void clearallkeys (void)
{
inputdevice_updateconfig (&currprefs);
#define IDS_CD 361
#define IDS_BUFFER_SINGLE 362
#define IDS_BUFFER_DOUBLE 363
-#define IDS_BUFFER_TRIPPLE 364
#define IDS_BUFFER_TRIPLE 364
#define IDS_QS_MODELS 1000
#define IDS_QS_MODEL_A500 1001
#define IDC_PORT2_JOYS 1031
#define IDC_PORT3_JOYS 1032
#define IDC_PARALLEL 1033
+#define IDC_PORT0_AF 1033
+#define IDC_PORT0_AF2 1034
+#define IDC_PORT1_AF 1034
#define IDC_JULIAN 1040
#define IDC_FOCUSMINIMIZE 1041
#define IDC_FASTTEXT 1043
#define IDC_DD_SURFACETYPE 1791
#define IDC_RTG_SCALE_ALLOW 1791
#define IDC_CPU_FREQUENCY 1791
-#define IDC_PORT0_AUTOFIRE 1791
#define IDC_RTG_SCALE_ASPECTRATIO 1792
#define IDC_ASSOCIATE_ON 1792
#define IDC_DD_SURFACETYPE2 1792
#define IDC_DXMODE 1792
-#define IDC_PORT1_AUTOFIRE 1792
#define IDC_RTG_VBLANKRATE 1793
#define IDC_DF0WPTEXTQ 1793
#define IDC_DF1WPTEXTQ 1794
GROUPBOX "Mouse and Joystick settings",IDC_STATIC,0,3,299,181\r
RTEXT "Port 0:",IDC_STATIC,11,16,25,15,SS_CENTERIMAGE\r
COMBOBOX IDC_PORT0_JOYS,45,17,241,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
- COMBOBOX IDC_PORT0_JOYSMODE,104,35,87,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
- PUSHBUTTON "Test [] Test Port 0 (mouse) configuration.",IDC_PORT0_TEST,196,35,44,14\r
- PUSHBUTTON "Remap [] Remap Port 0 configurarion.",IDC_PORT0_REMAP,245,35,41,14\r
+ COMBOBOX IDC_PORT0_JOYSMODE,127,35,87,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
+ PUSHBUTTON "Test [] Test Port 0 (mouse) configuration.",IDC_PORT0_TEST,218,35,34,14\r
+ PUSHBUTTON "Remap [] Remap Port 0 configurarion.",IDC_PORT0_REMAP,256,35,31,14\r
RTEXT "Port 1:",IDC_STATIC,11,52,25,15,SS_CENTERIMAGE\r
COMBOBOX IDC_PORT1_JOYS,45,53,241,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
- PUSHBUTTON "Swap ports [] Swap ports 0 and 1.",IDC_SWAP,113,93,53,14\r
- COMBOBOX IDC_PORT1_JOYSMODE,104,70,88,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
- PUSHBUTTON "Test [] Test Port 1 (joystick) configuration.",IDC_PORT1_TEST,196,70,44,14\r
- PUSHBUTTON "Remap [] Remap Port 1 configuration.",IDC_PORT1_REMAP,245,70,41,14\r
- LTEXT "Parallel port joystick adapter",IDC_STATIC,10,96,95,15,SS_CENTERIMAGE\r
- LTEXT "X-Arcade layout information []#1",IDC_STATIC,177,96,109,15,SS_NOTIFY | SS_CENTERIMAGE\r
+ PUSHBUTTON "Swap ports [] Swap ports 0 and 1.",IDC_SWAP,118,93,53,14\r
+ COMBOBOX IDC_PORT1_JOYSMODE,127,70,88,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
+ PUSHBUTTON "Test [] Test Port 1 (joystick) configuration.",IDC_PORT1_TEST,218,70,34,14\r
+ PUSHBUTTON "Remap [] Remap Port 1 configuration.",IDC_PORT1_REMAP,256,70,31,14\r
+ LTEXT "Parallel port joystick adapter",IDC_STATIC,10,96,99,15,SS_CENTERIMAGE\r
+ LTEXT "X-Arcade layout information []#1",IDC_STATIC,184,96,109,15,SS_NOTIFY | SS_CENTERIMAGE\r
COMBOBOX IDC_PORT2_JOYS,45,114,241,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
PUSHBUTTON "Test [] Test Parallel port joystick port 0 configuration.",IDC_PORT2_TEST,196,131,44,14\r
PUSHBUTTON "Remap [] Remap Parallel port joystick port 0 configurarion.",IDC_PORT2_REMAP,245,131,41,14\r
COMBOBOX IDC_PORT_TABLET_CURSOR,167,214,119,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
CONTROL "Full tablet input emulation",IDC_PORT_TABLET_FULL,\r
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,167,233,121,10\r
- CONTROL "Autofire",IDC_PORT0_AUTOFIRE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,46,37,53,10\r
- CONTROL "Autofire",IDC_PORT1_AUTOFIRE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,46,72,53,10\r
+ COMBOBOX IDC_PORT0_AF,45,35,78,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
+ COMBOBOX IDC_PORT1_AF,45,70,78,130,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP\r
END\r
\r
IDD_CONTRIBUTORS DIALOGEX 0, 0, 411, 242\r
reopen_console ();
fetch_path (L"ConfigurationPath", path, sizeof (path) / sizeof (TCHAR));
path[_tcslen (path) - 1] = 0;
- createdir (path);
- _tcscat (path, L"\\Host");
- createdir (path);
- fetch_path (L"ConfigurationPath", path, sizeof (path) / sizeof (TCHAR));
- _tcscat (path, L"Hardware");
- createdir (path);
+ if (GetFileAttributes (path) == 0xffffffff) {
+ createdir (path);
+ _tcscat (path, L"\\Host");
+ createdir (path);
+ fetch_path (L"ConfigurationPath", path, sizeof (path) / sizeof (TCHAR));
+ _tcscat (path, L"Hardware");
+ createdir (path);
+ }
fetch_path (L"StatefilePath", path, sizeof (path) / sizeof (TCHAR));
createdir (path);
_tcscat (path, L"default.uss");
#define WINUAEPUBLICBETA 1
#define LANG_DLL 1
-#define WINUAEBETA L"2"
-#define WINUAEDATE MAKEBD(2010, 5, 15)
+#define WINUAEBETA L"3"
+#define WINUAEDATE MAKEBD(2010, 5, 19)
#define WINUAEEXTRA L""
#define WINUAEREV L""
int filter_vert_zoom_mult = currprefs.gfx_filter_vert_zoom_mult;
int filter_horiz_offset = currprefs.gfx_filter_horiz_offset;
int filter_vert_offset = currprefs.gfx_filter_vert_offset;
- if (!usedfilter) {
+
+ if (!usedfilter && !currprefs.gfx_api) {
filter_horiz_zoom = filter_vert_zoom = 0;
filter_horiz_zoom_mult = filter_vert_zoom_mult = 1000;
filter_horiz_offset = filter_vert_offset = 0;
int devnum;
int flags, status;
TCHAR name[256];
- bool found = false;
int *atp = axistable;
int atpidx;
int item;
+ bool found = false;
+ TCHAR target[MAX_DPATH];
+ target[0] = 0;
if (list) {
lvstruct.mask = LVIF_TEXT | LVIF_PARAM;
lvstruct.pszText = (TCHAR*)evt->name;
while (atpidx >= 0) {
devnum = 0;
while ((status = inputdevice_get_device_status (devnum)) >= 0) {
- if (1 || status) {
+ if ((1 || status) && !found) {
for (int j = 0; j < inputdevice_get_widget_num (devnum); j++) {
for (int sub = 0; sub < MAX_INPUT_SUB_EVENT; sub++) {
- if (inputdevice_get_mapped_name (devnum, j, &flags, NULL, NULL, sub) == evtnum && !found) {
- TCHAR tmp[MAX_DPATH];
+ if (inputdevice_get_mapped_name (devnum, j, &flags, NULL, NULL, sub) == evtnum) {
inputdevice_get_widget_type (devnum, j, name);
if (list) {
- _tcscpy (tmp, name);
- _tcscat (tmp, L",");
- _tcscat (tmp, inputdevice_get_device_name2 (devnum));
- ListView_SetItemText (list, item, 1, tmp);
+ if (_tcslen (target) < MAX_DPATH / 2) {
+ if (target[0])
+ _tcscat (target, L" ");
+ _tcscat (target, name);
+ _tcscat (target, L",");
+ _tcscat (target, inputdevice_get_device_name2 (devnum));
+ }
found = true;
} else if (currentdevnum == devnum) {
if (currentwidgetnum == j) {
evtnum = *atp++;
atpidx--;
}
+ if (found)
+ ListView_SetItemText (list, item, 1, target);
cnt++;
}
}
const GUID pathsguid = { 0x5674338c, 0x7a0b, 0x4565, { 0xbf, 0x75, 0x62, 0x8c, 0x80, 0x4a, 0xef, 0xf7 } };
void create_afnewdir(int);
static int recursive;
- static int ptypes[3], numtypes;
+ static int ptypes[10], numtypes;
int val, selpath = 0;
TCHAR tmp[MAX_DPATH], pathmode[32];
break;
case 4:
*fs = 2;
- if (workprefs.gfx_filter == 0 && *fs != ofs) {
+ if (workprefs.gfx_filter == 0 && *fs != ofs && !workprefs.gfx_api) {
workprefs.gfx_filter = 1;
workprefs.gfx_filter_horiz_zoom = 0;
workprefs.gfx_filter_vert_zoom = 0;
static int joys[] = { IDC_PORT0_JOYS, IDC_PORT1_JOYS, IDC_PORT2_JOYS, IDC_PORT3_JOYS };
static int joysm[] = { IDC_PORT0_JOYSMODE, IDC_PORT1_JOYSMODE, -1, -1 };
-static int joysaf[] = { IDC_PORT0_AUTOFIRE, IDC_PORT1_AUTOFIRE, -1, -1 };
+static int joysaf[] = { IDC_PORT0_AF, IDC_PORT1_AF, -1, -1 };
static void updatejoyport (HWND hDlg)
{
idx = 0;
SendDlgItemMessage (hDlg, id, CB_SETCURSEL, idx, 0);
if (joysaf[i] >= 0)
- CheckDlgButton (hDlg, joysaf[i], workprefs.jports[i].autofire);
+ SendDlgItemMessage (hDlg, joysaf[i], CB_SETCURSEL, workprefs.jports[i].autofire, 0);
}
}
}
if (joysaf[i] >= 0) {
- int is = ischecked (hDlg, joysaf[i]) ? 1 : 0;
- if (is != workprefs.jports[i].autofire)
+ int af = SendDlgItemMessage (hDlg, joysaf[i], CB_GETCURSEL, 0, 0L);
+ if (af != CB_ERR && af != workprefs.jports[i].autofire)
workprefs.input_selected_setting = GAMEPORT_INPUT_SETTINGS;
- workprefs.jports[i].autofire = is;
+ workprefs.jports[i].autofire = af;
}
if (*port != prevport)
changed = 1;
static void processport (HWND hDlg, bool reset, int port)
{
if (reset)
- inputdevice_compa_prepare_custom (&workprefs, port);
+ inputdevice_compa_clear (&workprefs, port);
values_from_gameportsdlg (hDlg, 0);
enable_for_gameportsdlg (hDlg);
updatejoyport (hDlg);
joyxprevious[3] = -1;
}
+ for (i = 0; joysaf[i] >= 0; i++) {
+ int id = joysaf[i];
+ SendDlgItemMessage (hDlg, id, CB_RESETCONTENT, 0, 0L);
+ SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)L"No autofire");
+ SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)L"Autofire");
+ SendDlgItemMessage (hDlg, id, CB_ADDSTRING, 0, (LPARAM)L"Autofire (toggle)");
+ }
+
SendDlgItemMessage (hDlg, IDC_PORT_TABLET_CURSOR, CB_RESETCONTENT, 0, 0L);
WIN32GUI_LoadUIString (IDS_TABLET_BOTH_CURSORS, tmp, MAX_DPATH);
SendDlgItemMessage (hDlg, IDC_PORT_TABLET_CURSOR, CB_ADDSTRING, 0, (LPARAM)tmp);
joyxprevious[1] = temp;
enable_for_gameportsdlg (hDlg);
updatejoyport (hDlg);
- } else if (LOWORD (wParam) == IDC_PORT0_AUTOFIRE) {
- processport (hDlg, false, 0);
- } else if (LOWORD (wParam) == IDC_PORT1_AUTOFIRE) {
- processport (hDlg, false, 1);
} else if (LOWORD (wParam) == IDC_PORT0_REMAP) {
ports_remap (hDlg, 0);
} else if (LOWORD (wParam) == IDC_PORT1_REMAP) {
} else if (HIWORD (wParam) == CBN_SELCHANGE) {
switch (LOWORD (wParam))
{
+ case IDC_PORT0_AF:
+ processport (hDlg, false, 0);
+ break;
+ case IDC_PORT1_AF:
+ processport (hDlg, false, 1);
+ break;
case IDC_PORT0_JOYS:
case IDC_PORT1_JOYS:
case IDC_PORT2_JOYS:
} else {
// input panel
+ if (od != devnum)
+ init_inputdlg (hDlg);
+ else
+ init_inputdlg_2 (hDlg);
+
static int toggle, skipactive;
if (cnt == 2 && !skipactive) {
toggle ^= 1;
inputdevice_set_device_status (devnum, TRUE);
values_to_inputdlg (hDlg);
}
- if (od != devnum)
- init_inputdlg (hDlg);
- else
- init_inputdlg_2 (hDlg);
ListView_EnsureVisible (GetDlgItem (hDlg, IDC_INPUTLIST), input_selected_widget, FALSE);
ListView_SetItemState (GetDlgItem (hDlg, IDC_INPUTLIST), -1, 0, LVIS_SELECTED | LVIS_FOCUSED);
ListView_SetItemState (GetDlgItem (hDlg, IDC_INPUTLIST), input_selected_widget, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
vv3 = TRUE;
if (v && uf->x[0])
vv4 = TRUE;
- if (workprefs.gfx_api && isfilter)
+ if (workprefs.gfx_api)
v = vv = vv2 = vv3 = vv4 = TRUE;
ew (hDlg, IDC_FILTERHZ, v);
hw3d_changed = 1;
}
}
- if (workprefs.gfx_filter == 0)
+ if (workprefs.gfx_filter == 0 && !workprefs.gfx_api)
workprefs.gfx_filter_autoscale = 0;
}
item = SendDlgItemMessage (hDlg, IDC_FILTEROVERLAY, CB_GETCURSEL, 0, 0L);
item = SendDlgItemMessage (hDlg, IDC_FILTERAUTOSCALE, CB_GETCURSEL, 0, 0L);
if (item != CB_ERR) {
workprefs.gfx_filter_autoscale = item;
- if (workprefs.gfx_filter_autoscale && workprefs.gfx_filter == 0)
+ if (workprefs.gfx_filter_autoscale && workprefs.gfx_filter == 0 && !workprefs.gfx_api)
workprefs.gfx_filter = 1; // NULL
values_to_hw3ddlg (hDlg);
enable_for_hw3ddlg (hDlg);
handlerawinput (msg.hwnd, msg.message, msg.wParam, msg.lParam);
continue;
}
- // eat all keyboard accelerators
- if (msg.message == WM_KEYDOWN)
+ // eat all accelerators
+ if (msg.message == WM_KEYDOWN || msg.message == WM_MOUSEMOVE || msg.message == WM_MOUSEWHEEL
+ || msg.message == WM_MOUSEHWHEEL || msg.message == WM_LBUTTONDOWN)
continue;
}
// IsDialogMessage() eats WM_INPUT messages?!?!
{2C44DD04-F5D6-4CC3-B0D6-1F4E51A0D962}.FullRelease|Win32.ActiveCfg = Release|Win32
{2C44DD04-F5D6-4CC3-B0D6-1F4E51A0D962}.FullRelease|x64.ActiveCfg = Release|Win32
{2C44DD04-F5D6-4CC3-B0D6-1F4E51A0D962}.Release|Win32.ActiveCfg = Release|Win32
- {2C44DD04-F5D6-4CC3-B0D6-1F4E51A0D962}.Release|x64.ActiveCfg = Release|Win32
+ {2C44DD04-F5D6-4CC3-B0D6-1F4E51A0D962}.Release|x64.ActiveCfg = Release|x64
{8627DA33-98D1-4F60-B404-ECCEE0EE7BF9}.Debug|Win32.ActiveCfg = Debug|Win32
{8627DA33-98D1-4F60-B404-ECCEE0EE7BF9}.Debug|x64.ActiveCfg = Debug|Win32
{8627DA33-98D1-4F60-B404-ECCEE0EE7BF9}.FullRelease|Win32.ActiveCfg = Release|Win32
+Beta 3:
+
+- added XZ compressed file support
+- Paths panel "Reset to defaults" was unreliable if more than 3 choices was available
+- mouse horizontal wheel (HWheel) works in raw mouse mode, it is now always listed because
+ for some unknown reason RID_DEVICE_INFO_MOUSE.fHasHorizontalWheel is always false,
+ even when mouse has working horizontal scroll wheel
+- fixed unreliable device switching in input test/remap mode
+- fixed CD32 extra buttons not automatically getting enabled when joystick/pad was in
+ "default" mode
+- "default" was changed to "joystick" or "mouse" when switching between device types
+- CD32 default button change, Red and Blue buttons are automatically read as a fire
+ and second button if pad is read in standard 2-button mode (previously they did nothing
+ in normal mode, required fire and 2nd button mapped)
+- CD32 2-button mode 2nd button (CD32 Blue button as 2nd button) fixed, never worked previously
+- Game Ports Test mode now shows mappings that have multiple input targets
+- added "toggle" autofire mode to ports panel
+- D3D "none" filter allows again all filter setting adjustments
+
Beta 2:
- reverted filesystem indirect memory change, it can't never work because filesystem
return 1;
}
-int wmain (int argc, wchar_t *argv[], wchar_t *envp[])
+int __cdecl wmain (int argc, wchar_t *argv[], wchar_t *envp[])
{
int ok = 0, i;
int list = 0, xtract = 0, extract = 0;
_tprintf (L"Supported archive formats:\n");
_tprintf (L" 7ZIP, LHA, LZX, RAR (unrar.dll), TAR, ZIP, ArchiveAccess.DLL\n");
_tprintf (L"Miscellaneous formats:\n");
- _tprintf (L" RDB partition table, GZIP\n");
-
-
+ _tprintf (L" RDB partition table, GZIP, XZ\n");
}
return 0;
}
static struct zfile *zlist = 0;
-const TCHAR *uae_archive_extensions[] = { L"zip", L"rar", L"7z", L"xz", L"lha", L"lzh", L"lzx", L"tar", NULL };
+const TCHAR *uae_archive_extensions[] = { L"zip", L"rar", L"7z", L"lha", L"lzh", L"lzx", L"tar", NULL };
#define MAX_CACHE_ENTRIES 10
return unwarp (z);
}
+#include "7z/xz.h"
+#include "7z/lzmadec.h"
+#include "7z/7zcrc.h"
+
+static void *SzAlloc (void *p, size_t size)
+{
+ return xmalloc (uae_u8, size);
+}
+static void SzFree(void *p, void *address)
+{
+ xfree (address);
+}
+#define XZ_OUT_SIZE 10000
+#define XZ_IN_SIZE 10000
+static struct zfile *xz (struct zfile *z)
+{
+ static bool iscrc;
+ ISzAlloc allocImp;
+ CXzUnpacker cx;
+ ECoderStatus status;
+ struct zfile *zo = NULL;
+ uae_u8 out[XZ_OUT_SIZE], in[XZ_IN_SIZE];
+
+ memset (&cx, 0, sizeof cx);
+ allocImp.Alloc = SzAlloc;
+ allocImp.Free = SzFree;
+ if (!iscrc)
+ CrcGenerateTable ();
+ iscrc = true;
+ if (XzUnpacker_Create (&cx, &allocImp) != SZ_OK)
+ return NULL;
+ int outwritten = 0;
+ int towrite = 0;
+ bool first = true;
+ for (;;) {
+ int read = zfile_fread (in, 1, XZ_IN_SIZE, z);
+ if (first) {
+ if (!(in[0] == 0xfd && in[1] == 0x37 && in[2] == 0x7a && in[3] == 0x58 && in[4] == 0x5a && in[5] == 0))
+ break;
+ }
+ first = false;
+ if (read == 0)
+ break;
+ if (read < 0) {
+ zfile_fclose (zo);
+ zo = NULL;
+ break;
+ }
+ if (!zo)
+ zo = zfile_fopen_empty (z, z->name);
+ if (!zo)
+ break;
+ uae_u8 *inp = in;
+ for (;;) {
+ SizeT srclen = read;
+ SizeT outlen = XZ_OUT_SIZE;
+ if (XzUnpacker_Code (&cx, out, &outlen, inp, &srclen, LZMA_FINISH_ANY, &status) != SZ_OK) {
+ zfile_fclose (zo);
+ zo = NULL;
+ break;
+ }
+ if (status != CODER_STATUS_NEEDS_MORE_INPUT && status != CODER_STATUS_NOT_FINISHED) {
+ zfile_fclose (zo);
+ zo = NULL;
+ break;
+ }
+ zfile_fwrite (out, outlen, 1, zo);
+ if (status == CODER_STATUS_FINISHED_WITH_MARK)
+ break;
+ if (srclen == read)
+ break;
+ inp += srclen;
+ read -= srclen;
+ }
+ }
+ XzUnpacker_Free (&cx);
+ return zo;
+}
+
static struct zfile *dms (struct zfile *z, int index, int *retcode)
{
int ret;
L"hdf", L"tar",
NULL
};
-static const TCHAR *plugins_7z[] = { L"7z", L"xz", L"rar", L"zip", L"lha", L"lzh", L"lzx", L"adf", L"dsq", L"hdf", L"tar", NULL };
-static const uae_char *plugins_7z_x[] = { "7z", "xz", "Rar!", "MK", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
+static const TCHAR *plugins_7z[] = { L"7z", L"rar", L"zip", L"lha", L"lzh", L"lzx", L"adf", L"dsq", L"hdf", L"tar", NULL };
+static const uae_char *plugins_7z_x[] = { "7z", "Rar!", "MK", NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL };
static const int plugins_7z_t[] = {
- ArchiveFormat7Zip, ArchiveFormatXZ, ArchiveFormatRAR, ArchiveFormatZIP, ArchiveFormatLHA, ArchiveFormatLHA, ArchiveFormatLZX,
+ ArchiveFormat7Zip, ArchiveFormatRAR, ArchiveFormatZIP, ArchiveFormatLHA, ArchiveFormatLHA, ArchiveFormatLZX,
ArchiveFormatADF, ArchiveFormatADF, ArchiveFormatADF, ArchiveFormatTAR
};
static const int plugins_7z_m[] = {
- ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ARCHIVE,
+ ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ARCHIVE, ZFD_ARCHIVE,
ZFD_ADF, ZFD_ADF, ZFD_ADF, ZFD_ARCHIVE
};
return ArchiveFormat7Zip;
return 0;
}
- if (!strcasecmp (ext, L".xz")) {
- if (header[1] == '7' && header[2] == 'z' && header[3] == 'X' && header[4] == 'Z')
- return ArchiveFormatXZ;
- return 0;
- }
if (!strcasecmp (ext, L".rar")) {
if (header[0] == 'R' && header[1] == 'a' && header[2] == 'r' && header[3] == '!')
return ArchiveFormatRAR;
if (mask & ZFD_ARCHIVE) {
if (strcasecmp (ext, L"7z") == 0)
return archive_access_select (parent, z, ArchiveFormat7Zip, dodefault, retcode, index);
- if (strcasecmp (ext, L"xz") == 0)
- return archive_access_select (parent, z, ArchiveFormatXZ, dodefault, retcode, index);
if (strcasecmp (ext, L"zip") == 0)
return archive_access_select (parent, z, ArchiveFormatZIP, dodefault, retcode, index);
if (strcasecmp (ext, L"lha") == 0 || strcasecmp (ext, L"lzh") == 0)
return zfile_gunzip (z);
if (strcasecmp (ext, L"wrp") == 0)
return wrp (z);
+ if (strcasecmp (ext, L"xz") == 0)
+ return xz (z);
}
if (strcasecmp (ext, L"dms") == 0)
return dms (z, index, retcode);
return NULL;
return vhd (z);
}
-
if (mask & ZFD_UNPACK) {
if (index == 0) {
if (header[0] == 0x1f && header[1] == 0x8b)
return zfile_gunzip (z);
if (header[0] == 'P' && header[1] == 'K' && header[2] == 'D')
return dsq (z, 0);
+ if (header[0] == 0xfd && header[1] == 0x37 && header[2] == 0x7a && header[3] == 0x58 && header[4] == 0x5a && header[5] == 0)
+ return xz (z);
}
if (header[0] == 'D' && header[1] == 'M' && header[2] == 'S' && header[3] == '!')
return dms (z, index, retcode);
}
return l;
}
+struct zfile *zfile_fopen_empty (struct zfile *prev, const TCHAR *name)
+{
+ return zfile_fopen_empty (prev, name, 10000);
+}
struct zfile *zfile_fopen_parent (struct zfile *z, const TCHAR *name, uae_u64 offset, uae_u64 size)
{
return z->zfileread (b, l1, l2, z);
if (z->data) {
if (z->datasize < z->size && z->seek + l1 * l2 > z->datasize) {
- ;
+ write_log (L"zfile_fread(%s) attempted to read past PEEK_BYTES\n", z->name);
+
+ return 0;
}
if (z->seek + l1 * l2 > z->size) {
if (l1)
int off = z->seek + l1 * l2;
if (off > z->size) {
z->data = xrealloc (uae_u8, z->data, off);
- z->size = off;
+ z->datasize = z->size = off;
}
memcpy (z->data + z->seek, b, l1 * l2);
z->seek += l1 * l2;
zv = archive_directory_zip (zf);
if (strcasecmp (ext, L"7z") == 0)
zv = archive_directory_7z (zf);
- if (strcasecmp (ext, L"xz") == 0)
- zv = archive_directory_xz (zf);
if (strcasecmp (ext, L"lzx") == 0)
zv = archive_directory_lzx (zf);
if (strcasecmp (ext, L"rar") == 0)
#include <zlib.h>
-
-
static time_t fromdostime (uae_u32 dd)
{
struct tm tm;
case ArchiveFormat7Zip:
zv = archive_directory_7z (zf);
break;
- case ArchiveFormatXZ:
- zv = archive_directory_xz (zf);
- break;
case ArchiveFormatRAR:
zv = archive_directory_rar (zf);
break;
if (zf->zipname && zf->zipname[0] == '#' && _tstol (zf->zipname + 1) == zipcnt)
select = -1;
if (select && we_have_file < 10) {
- struct zfile *zt = archive_getzfile (zn, id, 1);
+ struct zfile *zt = archive_getzfile (zn, id, FILE_PEEK);
if (zt) {
int ft = zfile_gettype (zt);
TCHAR *ext = _tcsrchr (zn->fullname, '.');
return 0;
z = zfile_fopen_empty (NULL, zn->fullname, zn->size);
if (z) {
-// if (flags)
+// if (flags & FILE_PEEK)
// z->datasize = PEEK_BYTES;
err = unzReadCurrentFile (uz, z->data, z->datasize);
}
#define EPOCH_DIFF 0x019DB1DED53E8000LL /* 116444736000000000 nsecs */
#define RATE_DIFF 10000000 /* 100 nsecs */
-struct zvolume *archive_directory_xz (struct zfile *z)
-{
- return NULL;
-}
-
struct zvolume *archive_directory_7z (struct zfile *z)
{
SRes res;
return zv;
}
-struct zfile *archive_access_xz (struct znode *zn)
-{
- return NULL;
-}
-
struct zfile *archive_access_7z (struct znode *zn)
{
SRes res;
HANDLE hArcData;
};
-static int rar_resetf (struct zfile *z)
-{
- z->f = _tfopen (z->name, z->mode);
- if (!z->f) {
- zfile_fclose (z);
- return 0;
- }
- return 1;
-}
-
static void archive_close_rar (void *ctx)
{
struct RARContext* rc = (struct RARContext*)ctx;
return archive_directory_arcacc (z, ArchiveFormatRAR);
rc = xcalloc (struct RARContext, 1);
zv = zvolume_alloc (z, ArchiveFormatRAR, rc, NULL);
- //fclose (z->f); /* bleh, unrar.dll fails to open the archive if it is already open.. */
- //z->f = NULL;
rc->OpenArchiveData.ArcNameW = z->name;
rc->OpenArchiveData.OpenMode = RAR_OM_LIST;
rc->hArcData = pRAROpenArchiveEx (&rc->OpenArchiveData);
if (rc->OpenArchiveData.OpenResult != 0) {
xfree (rc);
-// if (!rar_resetf (z)) {
-// zfile_fclose_archive (zv);
-// return NULL;
-// }
zfile_fclose_archive (zv);
return archive_directory_arcacc (z, ArchiveFormatRAR);
}