Code cleanup

Reformatted code for improved readability. Fixed type casting. Selective
merge from uae4arm (android)
This commit is contained in:
Dimitris Panokostas 2016-09-01 00:02:17 +02:00
parent 89aaed4a53
commit efb894781e
20 changed files with 7723 additions and 6797 deletions

File diff suppressed because it is too large Load diff

View file

@ -18,7 +18,7 @@
#include "gensound.h" #include "gensound.h"
#include "audio.h" #include "audio.h"
#include "sd-pandora/sound.h" #include "sd-pandora/sound.h"
#include "memory.h" #include "include/memory.h"
#include "custom.h" #include "custom.h"
#include "newcpu.h" #include "newcpu.h"
#include "cia.h" #include "cia.h"

View file

@ -14,7 +14,7 @@
#include "options.h" #include "options.h"
#include "uae.h" #include "uae.h"
#include "memory.h" #include "include/memory.h"
#include "rommgr.h" #include "rommgr.h"
#include "autoconf.h" #include "autoconf.h"
#include "newcpu.h" #include "newcpu.h"

View file

@ -4,6 +4,7 @@
* Copyright 1996-1998 Bernd Schmidt * Copyright 1996-1998 Bernd Schmidt
*/ */
#pragma once
#define MAX_PLANES 8 #define MAX_PLANES 8
/* According to the HRM, pixel data spends a couple of cycles somewhere in the chips /* According to the HRM, pixel data spends a couple of cycles somewhere in the chips
@ -52,7 +53,8 @@ extern int framecnt;
* *
* !!! See color_reg_xxx functions below before touching !!! * !!! See color_reg_xxx functions below before touching !!!
*/ */
struct color_entry { struct color_entry
{
uae_u16 color_regs_ecs[32]; uae_u16 color_regs_ecs[32];
xcolnr acolors[256]; xcolnr acolors[256];
uae_u32 color_regs_aga[256]; uae_u32 color_regs_aga[256];
@ -74,7 +76,8 @@ STATIC_INLINE uae_u16 CONVERT_RGB(uae_u32 c)
"ubfx %[v], %[c], #3, #5 \n\t" "ubfx %[v], %[c], #3, #5 \n\t"
"orr %[v], %[v], r1, lsl #11 \n\t" "orr %[v], %[v], r1, lsl #11 \n\t"
"orr %[v], %[v], r2, lsl #5 \n\t" "orr %[v], %[v], r2, lsl #5 \n\t"
: [v] "=r" (ret) : [c] "r" (c) : "r1", "r2" ); : [v] "=r" (ret) : [c] "r" (c) : "r1",
"r2");
return ret; return ret;
} }
#endif #endif
@ -126,7 +129,8 @@ STATIC_INLINE void color_reg_cpy (struct color_entry *dst, struct color_entry *s
*/ */
#define COLOR_CHANGE_BRDBLANK 0x80000000 #define COLOR_CHANGE_BRDBLANK 0x80000000
struct color_change { struct color_change
{
int linepos; int linepos;
int regno; int regno;
unsigned int value; unsigned int value;
@ -148,7 +152,8 @@ struct sprite_entry
bool has_attached; bool has_attached;
}; };
union sps_union { union sps_union
{
uae_u8 bytes[MAX_SPR_PIXELS]; uae_u8 bytes[MAX_SPR_PIXELS];
uae_u32 words[MAX_SPR_PIXELS / 4]; uae_u32 words[MAX_SPR_PIXELS / 4];
}; };
@ -167,7 +172,8 @@ extern struct draw_info curr_drawinfo[2 * (MAXVPOS + 2) + 1];
/* struct decision contains things we save across drawing frames for /* struct decision contains things we save across drawing frames for
* comparison (smart update stuff). */ * comparison (smart update stuff). */
struct decision { struct decision
{
/* Records the leftmost access of BPL1DAT. */ /* Records the leftmost access of BPL1DAT. */
int plfleft, plfright, plflinelen; int plfleft, plfright, plflinelen;
/* Display window: native coordinates, depend on lores state. */ /* Display window: native coordinates, depend on lores state. */
@ -184,7 +190,8 @@ struct decision {
/* Anything related to changes in hw registers during the DDF for one /* Anything related to changes in hw registers during the DDF for one
* line. */ * line. */
struct draw_info { struct draw_info
{
int first_sprite_entry, last_sprite_entry; int first_sprite_entry, last_sprite_entry;
int first_color_change, last_color_change; int first_color_change, last_color_change;
int nr_color_changes, nr_sprites; int nr_color_changes, nr_sprites;

View file

@ -39,8 +39,8 @@ struct inputdevice_functions {
void (*unacquire)(int); void (*unacquire)(int);
void (*read)(void); void (*read)(void);
int (*get_num)(void); int (*get_num)(void);
TCHAR* (*get_friendlyname)(int); const TCHAR* (*get_friendlyname)(int);
TCHAR* (*get_uniquename)(int); const TCHAR* (*get_uniquename)(int);
int (*get_widget_num)(int); int (*get_widget_num)(int);
int (*get_widget_type)(int,int,TCHAR*,uae_u32*); int (*get_widget_type)(int,int,TCHAR*,uae_u32*);
int (*get_widget_first)(int,int); int (*get_widget_first)(int,int);

View file

@ -7,13 +7,15 @@
* Copyright 1995-2001 Bernd Schmidt * Copyright 1995-2001 Bernd Schmidt
*/ */
#pragma once
#define UAEMAJOR 2 #define UAEMAJOR 2
#define UAEMINOR 5 #define UAEMINOR 5
#define UAESUBREV 1 #define UAESUBREV 1
extern long int version; extern long int version;
struct strlist { struct strlist
{
struct strlist *next; struct strlist *next;
TCHAR *option, *value; TCHAR *option, *value;
int unknown; int unknown;
@ -35,7 +37,8 @@ struct strlist {
#define MAX_INPUT_SUB_EVENT_ALL 9 #define MAX_INPUT_SUB_EVENT_ALL 9
#define SPARE_SUB_EVENT 8 #define SPARE_SUB_EVENT 8
struct uae_input_device { struct uae_input_device
{
TCHAR *name; TCHAR *name;
TCHAR *configname; TCHAR *configname;
uae_s16 eventid[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT_ALL]; uae_s16 eventid[MAX_INPUT_DEVICE_EVENTS][MAX_INPUT_SUB_EVENT_ALL];
@ -49,7 +52,8 @@ struct uae_input_device {
#define MAX_JPORTS 4 #define MAX_JPORTS 4
#define NORMAL_JPORTS 2 #define NORMAL_JPORTS 2
#define MAX_JPORTNAME 128 #define MAX_JPORTNAME 128
struct jport { struct jport
{
int id; int id;
int mode; // 0=def,1=mouse,2=joy,3=anajoy,4=lightpen int mode; // 0=def,1=mouse,2=joy,3=anajoy,4=lightpen
int autofire; int autofire;
@ -83,13 +87,15 @@ struct floppyslot
int dfxtype; int dfxtype;
}; };
struct wh { struct wh
{
int x, y; int x, y;
int width, height; int width, height;
}; };
#define MOUNT_CONFIG_SIZE 30 #define MOUNT_CONFIG_SIZE 30
struct uaedev_config_info { struct uaedev_config_info
{
TCHAR devname[MAX_DPATH]; TCHAR devname[MAX_DPATH];
TCHAR volname[MAX_DPATH]; TCHAR volname[MAX_DPATH];
TCHAR rootdir[MAX_DPATH]; TCHAR rootdir[MAX_DPATH];
@ -110,7 +116,8 @@ struct uaedev_config_info {
int pcyls, pheads, psecs; int pcyls, pheads, psecs;
}; };
struct uae_prefs { struct uae_prefs
{
struct strlist *all_lines; struct strlist *all_lines;
TCHAR description[256]; TCHAR description[256];
@ -225,7 +232,6 @@ struct uae_prefs {
struct uae_input_device mouse_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES]; struct uae_input_device mouse_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES];
struct uae_input_device keyboard_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES]; struct uae_input_device keyboard_settings[MAX_INPUT_SETTINGS][MAX_INPUT_DEVICES];
TCHAR input_config_name[GAMEPORT_INPUT_SETTINGS][256]; TCHAR input_config_name[GAMEPORT_INPUT_SETTINGS][256];
}; };
/* Contains the filename of .uaerc */ /* Contains the filename of .uaerc */
@ -244,11 +250,24 @@ extern void cfgfile_dwrite_str (struct zfile *f, const TCHAR *option, const TCHA
extern void cfgfile_target_write_str(struct zfile *f, const TCHAR *option, const TCHAR *value); extern void cfgfile_target_write_str(struct zfile *f, const TCHAR *option, const TCHAR *value);
extern void cfgfile_target_dwrite_str(struct zfile *f, const TCHAR *option, const TCHAR *value); extern void cfgfile_target_dwrite_str(struct zfile *f, const TCHAR *option, const TCHAR *value);
extern struct uaedev_config_info *add_filesys_config (struct uae_prefs *p, int index, extern struct uaedev_config_info *add_filesys_config(struct uae_prefs *p,
const TCHAR *devname, const TCHAR *volname, const TCHAR *rootdir, bool readonly, int index,
int cyls, int secspertrack, int surfaces, int reserved, const TCHAR *devname,
int blocksize, int bootpri, const TCHAR *filesysdir, int hdc, int flags, const TCHAR *volname,
int pcyls, int pheads, int psecs); const TCHAR *rootdir,
bool readonly,
int cyls,
int secspertrack,
int surfaces,
int reserved,
int blocksize,
int bootpri,
const TCHAR *filesysdir,
int hdc,
int flags,
int pcyls,
int pheads,
int psecs);
extern void default_prefs(struct uae_prefs *, int); extern void default_prefs(struct uae_prefs *, int);
extern void discard_prefs(struct uae_prefs *, int); extern void discard_prefs(struct uae_prefs *, int);

View file

@ -171,7 +171,10 @@ typedef unsigned char uae_u8;
typedef signed char uae_s8; typedef signed char uae_s8;
typedef char uae_char; typedef char uae_char;
typedef struct { uae_u8 RGB[3]; } RGB; typedef struct
{
uae_u8 RGB[3];
} RGB;
#if SIZEOF_SHORT == 2 #if SIZEOF_SHORT == 2
typedef unsigned short uae_u16; typedef unsigned short uae_u16;
@ -438,14 +441,22 @@ extern void gui_message (const TCHAR *,...);
#ifdef ARMV6_ASSEMBLY #ifdef ARMV6_ASSEMBLY
STATIC_INLINE uae_u32 do_byteswap_32(uae_u32 v) {__asm__ ( STATIC_INLINE uae_u32 do_byteswap_32(uae_u32 v)
{
__asm__(
"rev %0, %0" "rev %0, %0"
: "=r" (v) : "0" (v) ); return v;} : "=r" (v) : "0" (v));
return v;
}
STATIC_INLINE uae_u32 do_byteswap_16(uae_u32 v) {__asm__ ( STATIC_INLINE uae_u32 do_byteswap_16(uae_u32 v)
{
__asm__(
"revsh %0, %0\n\t" "revsh %0, %0\n\t"
"uxth %0, %0" "uxth %0, %0"
: "=r" (v) : "0" (v) ); return v;} : "=r" (v) : "0" (v));
return v;
}
#endif #endif

View file

@ -36,7 +36,7 @@
#include "options.h" #include "options.h"
#include "uae.h" #include "uae.h"
#include "memory.h" #include "include/memory.h"
#include "custom.h" #include "custom.h"
#include "newcpu.h" #include "newcpu.h"
#include "cpu_prefetch.h" #include "cpu_prefetch.h"
@ -56,7 +56,10 @@
#else #else
/* Need to have these somewhere */ /* Need to have these somewhere */
static void build_comp(void) {} static void build_comp(void) {}
bool check_prefs_changed_comp (void) { return false; } bool check_prefs_changed_comp(void)
{
return false;
}
#endif #endif
/* Opcode of faulting instruction */ /* Opcode of faulting instruction */

File diff suppressed because it is too large Load diff

View file

@ -11,7 +11,7 @@
#include "sysdeps.h" #include "sysdeps.h"
#include "config.h" #include "config.h"
#include "options.h" #include "options.h"
#include "memory.h" #include "include/memory.h"
#include "uae.h" #include "uae.h"
#include "autoconf.h" #include "autoconf.h"
#include "filesys.h" #include "filesys.h"
@ -22,6 +22,8 @@
#define DIALOG_WIDTH 520 #define DIALOG_WIDTH 520
#define DIALOG_HEIGHT 202 #define DIALOG_HEIGHT 202
extern std::string volName;
static bool dialogResult = false; static bool dialogResult = false;
static bool dialogFinished = false; static bool dialogFinished = false;
@ -52,7 +54,10 @@ class FilesysVirtualActionListener : public gcn::ActionListener
strncpy(tmp, txtPath->getText().c_str(), MAX_PATH); strncpy(tmp, txtPath->getText().c_str(), MAX_PATH);
wndEditFilesysVirtual->releaseModalFocus(); wndEditFilesysVirtual->releaseModalFocus();
if (SelectFolder("Select folder", tmp)) if (SelectFolder("Select folder", tmp))
{
txtPath->setText(tmp); txtPath->setText(tmp);
txtVolume->setText(volName);
}
wndEditFilesysVirtual->requestModalFocus(); wndEditFilesysVirtual->requestModalFocus();
cmdPath->requestFocus(); cmdPath->requestFocus();
} }
@ -301,9 +306,24 @@ bool EditFilesysVirtual(int unit_no)
int bp = tweakbootpri(atoi(txtBootPri->getText().c_str()), chkAutoboot->isSelected() ? 1 : 0, 0); int bp = tweakbootpri(atoi(txtBootPri->getText().c_str()), chkAutoboot->isSelected() ? 1 : 0, 0);
extractPath((char *) txtPath->getText().c_str(), currentDir); extractPath((char *) txtPath->getText().c_str(), currentDir);
uci = add_filesys_config(&changed_prefs, unit_no, (char *) txtDevice->getText().c_str(), uci = add_filesys_config(&changed_prefs,
(char *) txtVolume->getText().c_str(), (char *) txtPath->getText().c_str(), unit_no,
!chkReadWrite->isSelected(), 0, 0, 0, 0, 0, bp, 0, 0, 0, 0, 0, 0); (char *) txtDevice->getText().c_str(),
(char *) txtVolume->getText().c_str(),
(char *) txtPath->getText().c_str(),
!chkReadWrite->isSelected(),
0,
0,
0,
0,
0,
bp,
0,
0,
0,
0,
0,
0);
if (uci) if (uci)
filesys_media_change(uci->rootdir, 1, uci); filesys_media_change(uci->rootdir, 1, uci);
} }

View file

@ -123,8 +123,9 @@ void InGameMessage(const char *msg)
// Now we let the Gui object draw itself. // Now we let the Gui object draw itself.
msg_gui->draw(); msg_gui->draw();
// Finally we update the screen. // Finally we update the screen.
//SDL_Flip(prSDLScreen); if (!drawn)
flush_screen (); SDL_Flip(prSDLScreen);
drawn = true;
} }
msg_top->remove(wndMsg); msg_top->remove(wndMsg);

View file

@ -11,7 +11,7 @@
#include "sysdeps.h" #include "sysdeps.h"
#include "config.h" #include "config.h"
#include "options.h" #include "options.h"
#include "memory.h" #include "include/memory.h"
#include "uae.h" #include "uae.h"
#include "gui.h" #include "gui.h"
#include "gui_handling.h" #include "gui_handling.h"
@ -47,29 +47,34 @@ class MemorySliderActionListener : public gcn::ActionListener
public: public:
void action(const gcn::ActionEvent& actionEvent) void action(const gcn::ActionEvent& actionEvent)
{ {
if (actionEvent.getSource() == sldChipmem) { if (actionEvent.getSource() == sldChipmem)
{
changed_prefs.chipmem_size = ChipMem_values[(int)(sldChipmem->getValue())]; changed_prefs.chipmem_size = ChipMem_values[(int)(sldChipmem->getValue())];
if ((changed_prefs.chipmem_size > 0x200000) && (changed_prefs.fastmem_size > 0)) if ((changed_prefs.chipmem_size > 0x200000) && (changed_prefs.fastmem_size > 0))
changed_prefs.fastmem_size = 0; changed_prefs.fastmem_size = 0;
} }
if (actionEvent.getSource() == sldSlowmem) { if (actionEvent.getSource() == sldSlowmem)
{
changed_prefs.bogomem_size = SlowMem_values[(int)(sldSlowmem->getValue())]; changed_prefs.bogomem_size = SlowMem_values[(int)(sldSlowmem->getValue())];
} }
if (actionEvent.getSource() == sldFastmem) { if (actionEvent.getSource() == sldFastmem)
{
changed_prefs.fastmem_size = FastMem_values[(int)(sldFastmem->getValue())]; changed_prefs.fastmem_size = FastMem_values[(int)(sldFastmem->getValue())];
if (changed_prefs.fastmem_size > 0 && changed_prefs.chipmem_size > 0x200000) if (changed_prefs.fastmem_size > 0 && changed_prefs.chipmem_size > 0x200000)
changed_prefs.chipmem_size = 0x200000; changed_prefs.chipmem_size = 0x200000;
} }
if (actionEvent.getSource() == sldZ3mem) { if (actionEvent.getSource() == sldZ3mem)
{
changed_prefs.z3fastmem_size = FastMem_values[(int)(sldZ3mem->getValue())]; changed_prefs.z3fastmem_size = FastMem_values[(int)(sldZ3mem->getValue())];
if (changed_prefs.z3fastmem_size > max_z3fastmem) if (changed_prefs.z3fastmem_size > max_z3fastmem)
changed_prefs.z3fastmem_size = max_z3fastmem; changed_prefs.z3fastmem_size = max_z3fastmem;
} }
if (actionEvent.getSource() == sldGfxmem) { if (actionEvent.getSource() == sldGfxmem)
{
changed_prefs.rtgmem_size = FastMem_values[(int)(sldGfxmem->getValue())]; changed_prefs.rtgmem_size = FastMem_values[(int)(sldGfxmem->getValue())];
changed_prefs.rtgmem_type = 1; changed_prefs.rtgmem_type = 1;
} }

View file

@ -19,7 +19,7 @@
#define DIALOG_WIDTH 520 #define DIALOG_WIDTH 520
#define DIALOG_HEIGHT 400 #define DIALOG_HEIGHT 400
#ifdef RASPBERRY #if defined(RASPBERRY) || defined(ANDROID)
#define FILE_SELECT_KEEP_POSITION #define FILE_SELECT_KEEP_POSITION
#endif #endif
@ -380,7 +380,8 @@ bool SelectFile(const char *title, char *value, const char *filter[], bool creat
{ {
InitSelectFile(title); InitSelectFile(title);
Already_init = 1; Already_init = 1;
} else }
else
{ {
strncpy(value, workingDir, MAX_PATH); strncpy(value, workingDir, MAX_PATH);
gui_top->add(wndSelectFile); gui_top->add(wndSelectFile);
@ -392,10 +393,10 @@ bool SelectFile(const char *title, char *value, const char *filter[], bool creat
#else #else
InitSelectFile(title); InitSelectFile(title);
#endif #endif
extractPath(value, workingDir); extractPath(value, workingDir);
checkfoldername(workingDir); checkfoldername(workingDir);
checkfilename(value); checkfilename(value);
SelectFileLoop(); SelectFileLoop();
#ifdef FILE_SELECT_KEEP_POSITION #ifdef FILE_SELECT_KEEP_POSITION
wndSelectFile->releaseModalFocus(); wndSelectFile->releaseModalFocus();

View file

@ -17,6 +17,7 @@
#define DIALOG_WIDTH 520 #define DIALOG_WIDTH 520
#define DIALOG_HEIGHT 400 #define DIALOG_HEIGHT 400
std::string volName;
static bool dialogResult = false; static bool dialogResult = false;
static bool dialogFinished = false; static bool dialogFinished = false;
static char workingDir[MAX_PATH]; static char workingDir[MAX_PATH];
@ -107,6 +108,7 @@ class ListBoxActionListener : public gcn::ActionListener
strcpy(foldername, workingDir); strcpy(foldername, workingDir);
strcat(foldername, "/"); strcat(foldername, "/");
strcat(foldername, dirList.getElementAt(selected_item).c_str()); strcat(foldername, dirList.getElementAt(selected_item).c_str());
volName = dirList.getElementAt(selected_item).c_str();
checkfoldername(foldername); checkfoldername(foldername);
} }
}; };

View file

@ -356,7 +356,7 @@ int create_configfilename(char *dest, char *basename, int fromDir)
const char *kickstarts_rom_names[] = { "kick12.rom\0", "kick13.rom\0", "kick20.rom\0", "kick31.rom\0", "aros-amiga-m68k-rom.bin\0" }; const char *kickstarts_rom_names[] = { "kick12.rom\0", "kick13.rom\0", "kick20.rom\0", "kick31.rom\0", "aros-amiga-m68k-rom.bin\0" };
const char *extended_rom_names[] = { "\0", "\0", "\0", "\0", "aros-amiga-m68k-ext.bin\0" }; const char *extended_rom_names[] = { "\0", "\0", "\0", "\0", "aros-amiga-m68k-ext.bin\0" };
const char *kickstarts_names[] = { "KS ROM v1.2\0", "KS ROM v1.3\0", "KS ROM v2.05\0", "KS ROM v3.1\0", "\0" }; const char *kickstarts_names[] = { "KS ROM v1.2\0", "KS ROM v1.3\0", "KS ROM v2.05\0", "KS ROM v3.1\0", "\0" };
#ifdef ANDROIDSDL #ifdef ANDROID
const char *af_kickstarts_rom_names[] = { "amiga-os-120.rom\0", "amiga-os-130.rom\0", "amiga-os-204.rom\0", "amiga-os-310-a1200.rom\0" }; const char *af_kickstarts_rom_names[] = { "amiga-os-120.rom\0", "amiga-os-130.rom\0", "amiga-os-204.rom\0", "amiga-os-310-a1200.rom\0" };
#endif #endif
@ -411,7 +411,8 @@ int loadconfig_old(struct uae_prefs *p, const char *orgpath)
} }
FILE *f = fopen(path, "rt"); FILE *f = fopen(path, "rt");
if (!f){ if (!f)
{
write_log("No config file %s!\n", path); write_log("No config file %s!\n", path);
return 0; return 0;
} }
@ -503,9 +504,15 @@ int loadconfig_old(struct uae_prefs *p, const char *orgpath)
p->immediate_blits = (p->chipset_mask & 0x100) == 0x100; p->immediate_blits = (p->chipset_mask & 0x100) == 0x100;
switch (p->chipset_mask & 0xff) switch (p->chipset_mask & 0xff)
{ {
case 1: p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE; break; case 1:
case 2: p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE | CSMASK_AGA; break; p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE;
default: p->chipset_mask = CSMASK_ECS_AGNUS; break; break;
case 2:
p->chipset_mask = CSMASK_ECS_AGNUS | CSMASK_ECS_DENISE | CSMASK_AGA;
break;
default:
p->chipset_mask = CSMASK_ECS_AGNUS;
break;
} }
fscanf(f, "cpu=%d\n", &p->m68k_speed); fscanf(f, "cpu=%d\n", &p->m68k_speed);
if (p->m68k_speed < 0) if (p->m68k_speed < 0)
@ -622,36 +629,6 @@ int loadconfig_old(struct uae_prefs *p, const char *orgpath)
if (p->fastmem_size > 0 && p->fastmem_size < 10) if (p->fastmem_size > 0 && p->fastmem_size < 10)
// Was saved in old format // Was saved in old format
p->fastmem_size = 0x080000 << p->fastmem_size; p->fastmem_size = 0x080000 << p->fastmem_size;
#ifdef ANDROIDSDL
fscanf(f,"onscreen=%d\n",&mainMenu_onScreen);
fscanf(f,"onScreen_textinput=%d\n",&mainMenu_onScreen_textinput);
fscanf(f,"onScreen_dpad=%d\n",&mainMenu_onScreen_dpad);
fscanf(f,"onScreen_button1=%d\n",&mainMenu_onScreen_button1);
fscanf(f,"onScreen_button2=%d\n",&mainMenu_onScreen_button2);
fscanf(f,"onScreen_button3=%d\n",&mainMenu_onScreen_button3);
fscanf(f,"onScreen_button4=%d\n",&mainMenu_onScreen_button4);
fscanf(f,"onScreen_button5=%d\n",&mainMenu_onScreen_button5);
fscanf(f,"onScreen_button6=%d\n",&mainMenu_onScreen_button6);
fscanf(f,"custom_position=%d\n",&mainMenu_custom_position);
fscanf(f,"pos_x_textinput=%d\n",&mainMenu_pos_x_textinput);
fscanf(f,"pos_y_textinput=%d\n",&mainMenu_pos_y_textinput);
fscanf(f,"pos_x_dpad=%d\n",&mainMenu_pos_x_dpad);
fscanf(f,"pos_y_dpad=%d\n",&mainMenu_pos_y_dpad);
fscanf(f,"pos_x_button1=%d\n",&mainMenu_pos_x_button1);
fscanf(f,"pos_y_button1=%d\n",&mainMenu_pos_y_button1);
fscanf(f,"pos_x_button2=%d\n",&mainMenu_pos_x_button2);
fscanf(f,"pos_y_button2=%d\n",&mainMenu_pos_y_button2);
fscanf(f,"pos_x_button3=%d\n",&mainMenu_pos_x_button3);
fscanf(f,"pos_y_button3=%d\n",&mainMenu_pos_y_button3);
fscanf(f,"pos_x_button4=%d\n",&mainMenu_pos_x_button4);
fscanf(f,"pos_y_button4=%d\n",&mainMenu_pos_y_button4);
fscanf(f,"pos_x_button5=%d\n",&mainMenu_pos_x_button5);
fscanf(f,"pos_y_button5=%d\n",&mainMenu_pos_y_button5);
fscanf(f,"pos_x_button6=%d\n",&mainMenu_pos_x_button6);
fscanf(f,"pos_y_button6=%d\n",&mainMenu_pos_y_button6);
fscanf(f,"quick_switch=%d\n",&mainMenu_quickSwitch);
fscanf(f,"FloatingJoystick=%d\n",&mainMenu_FloatingJoystick);
#endif
fclose(f); fclose(f);
} }

View file

@ -15,14 +15,20 @@
#include <png.h> #include <png.h>
#include <SDL.h> #include <SDL.h>
#include <SDL_image.h> #include <SDL/SDL_image.h>
#include <SDL_gfxPrimitives.h> #ifndef ANDROID
#include <SDL/SDL_gfxPrimitives.h>
#endif
#include <SDL/SDL_ttf.h> #include <SDL/SDL_ttf.h>
#ifdef ANDROIDSDL #ifdef ANDROID
#include <android/log.h> #include <android/log.h>
#endif #endif
#ifdef ANDROIDSDL
#include <SDL_screenkeyboard.h>
#endif
#include <linux/fb.h> #include <linux/fb.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
@ -33,16 +39,16 @@
#define OMAPFB_WAITFORVSYNC_FRAME _IOWR('O', 70, unsigned int) #define OMAPFB_WAITFORVSYNC_FRAME _IOWR('O', 70, unsigned int)
#endif #endif
/* SDL variable for output of emulation */ /* SDL variable for output of emulation */
SDL_Surface *prSDLScreen = NULL; SDL_Surface *prSDLScreen = NULL;
static int fbdev = -1; static int fbdev = -1;
static unsigned int current_vsync_frame = 0; static unsigned int current_vsync_frame = 0;
/* Possible screen modes (x and y resolutions) */ /* Possible screen modes (x and y resolutions) */
#define MAX_SCREEN_MODES 6
static int x_size_table[MAX_SCREEN_MODES] = { 640, 640, 800, 1024, 1152, 1280 }; #define MAX_SCREEN_MODES 11
static int y_size_table[MAX_SCREEN_MODES] = { 400, 480, 480, 768, 864, 960 }; static int x_size_table[MAX_SCREEN_MODES] = { 640, 640, 720, 800, 800, 960, 1024, 1024, 1280, 1280, 1920 };
static int y_size_table[MAX_SCREEN_MODES] = { 400, 480, 400, 480, 600, 540, 768, 600, 720, 800, 1080 };
static int red_bits, green_bits, blue_bits; static int red_bits, green_bits, blue_bits;
static int red_shift, green_shift, blue_shift; static int red_shift, green_shift, blue_shift;
@ -363,8 +369,9 @@ void flush_screen ()
current_vsync_frame += currprefs.gfx_framerate; current_vsync_frame += currprefs.gfx_framerate;
} }
last_synctime = read_processor_time(); // Android swapped SDL_Flip & last_synctime for fixing performance
SDL_Flip(prSDLScreen); SDL_Flip(prSDLScreen);
last_synctime = read_processor_time();
if(!screen_is_picasso) if(!screen_is_picasso)
gfxvidinfo.bufmem = (uae_u8 *)prSDLScreen->pixels; gfxvidinfo.bufmem = (uae_u8 *)prSDLScreen->pixels;
@ -734,7 +741,7 @@ void picasso_InitResolutions (void)
modesList(); modesList();
DisplayModes = Displays[0].DisplayModes; DisplayModes = Displays[0].DisplayModes;
} }
#endif
bool vsync_switchmode (int hz) bool vsync_switchmode (int hz)
{ {
@ -799,7 +806,7 @@ bool target_graphics_buffer_update (void)
return true; return true;
} }
#ifdef PICASSO96
void gfx_set_picasso_state (int on) void gfx_set_picasso_state (int on)
{ {
if (on == screen_is_picasso) if (on == screen_is_picasso)

View file

@ -14,7 +14,7 @@
#include "gui.h" #include "gui.h"
#include "od-pandora/gui/SelectorEntry.hpp" #include "od-pandora/gui/SelectorEntry.hpp"
#include "gui/gui_handling.h" #include "gui/gui_handling.h"
#include "memory.h" #include "include/memory.h"
#include "rommgr.h" #include "rommgr.h"
#include "newcpu.h" #include "newcpu.h"
#include "custom.h" #include "custom.h"
@ -36,17 +36,19 @@
#ifdef RASPBERRY #ifdef RASPBERRY
#include <linux/kd.h> #include <linux/kd.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#endif RASPBERRY #endif //RASPBERRY
int emulating = 0; int emulating = 0;
extern int screen_is_picasso; extern int screen_is_picasso;
struct gui_msg { struct gui_msg
{
int num; int num;
const char *msg; const char *msg;
}; };
struct gui_msg gui_msglist[] = { struct gui_msg gui_msglist[] =
{
{ NUMSG_NEEDEXT2, "The software uses a non-standard floppy disk format. You may need to use a custom floppy disk image file instead of a standard one. This message will not appear again." }, { NUMSG_NEEDEXT2, "The software uses a non-standard floppy disk format. You may need to use a custom floppy disk image file instead of a standard one. This message will not appear again." },
{ NUMSG_NOROM, "Could not load system ROM, trying system ROM replacement." }, { NUMSG_NOROM, "Could not load system ROM, trying system ROM replacement." },
{ NUMSG_NOROMKEY, "Could not find system ROM key file." }, { NUMSG_NOROMKEY, "Could not find system ROM key file." },
@ -129,7 +131,7 @@ void ClearAvailableROMList(void)
} }
} }
static void addrom(struct romdata *rd, char *path) static void addrom(struct romdata *rd, const char *path)
{ {
AvailableROM *tmp; AvailableROM *tmp;
char tmpName[MAX_DPATH]; char tmpName[MAX_DPATH];
@ -143,7 +145,8 @@ static void addrom(struct romdata *rd, char *path)
romlist_add(path, rd); romlist_add(path, rd);
} }
struct romscandata { struct romscandata
{
uae_u8 *keybuf; uae_u8 *keybuf;
int keysize; int keysize;
}; };
@ -161,30 +164,39 @@ static struct romdata *scan_single_rom_2 (struct zfile *f)
if (size > 524288 * 2) /* don't skip KICK disks or 1M ROMs */ if (size > 524288 * 2) /* don't skip KICK disks or 1M ROMs */
return 0; return 0;
zfile_fread(buffer, 1, 11, f); zfile_fread(buffer, 1, 11, f);
if (!memcmp (buffer, "KICK", 4)) { if (!memcmp(buffer, "KICK", 4))
{
zfile_fseek(f, 512, SEEK_SET); zfile_fseek(f, 512, SEEK_SET);
if (size > 262144) if (size > 262144)
size = 262144; size = 262144;
} else if (!memcmp (buffer, "AMIROMTYPE1", 11)) { }
else if (!memcmp(buffer, "AMIROMTYPE1", 11))
{
cl = 1; cl = 1;
size -= 11; size -= 11;
} else { }
else
{
zfile_fseek(f, 0, SEEK_SET); zfile_fseek(f, 0, SEEK_SET);
} }
rombuf = xcalloc(uae_u8, size); rombuf = xcalloc(uae_u8, size);
if (!rombuf) if (!rombuf)
return 0; return 0;
zfile_fread(rombuf, 1, size, f); zfile_fread(rombuf, 1, size, f);
if (cl > 0) { if (cl > 0)
{
decode_cloanto_rom_do(rombuf, size, size); decode_cloanto_rom_do(rombuf, size, size);
cl = 0; cl = 0;
} }
if (!cl) { if (!cl)
{
rd = getromdatabydata(rombuf, size); rd = getromdatabydata(rombuf, size);
if (!rd && (size & 65535) == 0) { if (!rd && (size & 65535) == 0)
{
/* check byteswap */ /* check byteswap */
int i; int i;
for (i = 0; i < size; i+=2) { for (i = 0; i < size; i += 2)
{
uae_u8 b = rombuf[i]; uae_u8 b = rombuf[i];
rombuf[i] = rombuf[i + 1]; rombuf[i] = rombuf[i + 1];
rombuf[i + 1] = b; rombuf[i + 1] = b;
@ -227,7 +239,8 @@ static int isromext(char *path)
if (!stricmp(ext, "rom") || !stricmp(ext, "adf") || !stricmp(ext, "key") if (!stricmp(ext, "rom") || !stricmp(ext, "adf") || !stricmp(ext, "key")
|| !stricmp(ext, "a500") || !stricmp(ext, "a1200") || !stricmp(ext, "a4000")) || !stricmp(ext, "a500") || !stricmp(ext, "a1200") || !stricmp(ext, "a4000"))
return 1; return 1;
for (i = 0; uae_archive_extensions[i]; i++) { for (i = 0; uae_archive_extensions[i]; i++)
{
if (!stricmp(ext, uae_archive_extensions[i])) if (!stricmp(ext, uae_archive_extensions[i]))
return 1; return 1;
} }
@ -251,7 +264,8 @@ static void scan_rom(char *path)
{ {
struct romdata *rd; struct romdata *rd;
if (!isromext(path)) { if (!isromext(path))
{
//write_log("ROMSCAN: skipping file '%s', unknown extension\n", path); //write_log("ROMSCAN: skipping file '%s', unknown extension\n", path);
return; return;
} }
@ -284,7 +298,8 @@ void RescanROMs(void)
} }
int id = 1; int id = 1;
for (;;) { for (;;)
{
struct romdata *rd = getromdatabyid(id); struct romdata *rd = getromdatabyid(id);
if (!rd) if (!rd)
break; break;
@ -435,8 +450,10 @@ static void after_leave_gui(void)
int update = 0; int update = 0;
int num; int num;
for(num = 0; num < 2; ++num) { for (num = 0; num < 2; ++num)
if(changed_prefs.jports[num].id == JSEM_JOYS && changed_prefs.jports[num].autofire != new_af) { {
if (changed_prefs.jports[num].id == JSEM_JOYS && changed_prefs.jports[num].autofire != new_af)
{
changed_prefs.jports[num].autofire = new_af; changed_prefs.jports[num].autofire = new_af;
update = 1; update = 1;
} }
@ -593,7 +610,6 @@ void gui_handle_events (void)
int triggerL = keystate[SDLK_RSHIFT]; int triggerL = keystate[SDLK_RSHIFT];
int triggerR = keystate[SDLK_RCTRL]; int triggerR = keystate[SDLK_RCTRL];
if (keystate[SDLK_LCTRL] && keystate[SDLK_LSUPER] && (keystate[SDLK_RSUPER] || keystate[SDLK_MENU])) if (keystate[SDLK_LCTRL] && keystate[SDLK_LSUPER] && (keystate[SDLK_RSUPER] || keystate[SDLK_MENU]))
uae_reset(0, 1); uae_reset(0, 1);
@ -751,11 +767,13 @@ void gui_led (int led, int on)
{ {
if (currprefs.kbd_led_num == led || currprefs.kbd_led_num == LED_DFs) if (currprefs.kbd_led_num == led || currprefs.kbd_led_num == LED_DFs)
{ {
if (on) kbd_led_status |= LED_NUM; else kbd_led_status &= ~LED_NUM; if (on) kbd_led_status |= LED_NUM;
else kbd_led_status &= ~LED_NUM;
} }
if (currprefs.kbd_led_scr == led || currprefs.kbd_led_scr == LED_DFs) if (currprefs.kbd_led_scr == led || currprefs.kbd_led_scr == LED_DFs)
{ {
if (on) kbd_led_status |= LED_SCR; else kbd_led_status &= ~LED_SCR; if (on) kbd_led_status |= LED_SCR;
else kbd_led_status &= ~LED_SCR;
} }
} }
@ -764,11 +782,13 @@ void gui_led (int led, int on)
{ {
if (currprefs.kbd_led_num == led) if (currprefs.kbd_led_num == led)
{ {
if (on) kbd_led_status |= LED_NUM; else kbd_led_status &= ~LED_NUM; if (on) kbd_led_status |= LED_NUM;
else kbd_led_status &= ~LED_NUM;
} }
if (currprefs.kbd_led_scr == led) if (currprefs.kbd_led_scr == led)
{ {
if (on) kbd_led_status |= LED_SCR; else kbd_led_status &= ~LED_SCR; if (on) kbd_led_status |= LED_SCR;
else kbd_led_status &= ~LED_SCR;
} }
} }
ioctl(0, KDSETLED, kbd_led_status); ioctl(0, KDSETLED, kbd_led_status);
@ -789,7 +809,8 @@ void gui_flicker_led (int led, int unitnum, int status)
break; break;
case LED_HD: case LED_HD:
if (status == 0) { if (status == 0)
{
hd_resetcounter--; hd_resetcounter--;
if (hd_resetcounter > 0) if (hd_resetcounter > 0)
return; return;
@ -940,11 +961,13 @@ bool hardfile_testrdb (const TCHAR *filename)
if (!f) if (!f)
return false; return false;
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++)
{
zfile_fseek(f, i * 512, SEEK_SET); zfile_fseek(f, i * 512, SEEK_SET);
memset(tmp, 0, sizeof tmp); memset(tmp, 0, sizeof tmp);
zfile_fread(tmp, 1, sizeof tmp, f); zfile_fread(tmp, 1, sizeof tmp, f);
if (!memcmp (tmp, "RDSK\0\0\0", 7) || !memcmp (tmp, "DRKS\0\0", 6) || (tmp[0] == 0x53 && tmp[1] == 0x10 && tmp[2] == 0x9b && tmp[3] == 0x13 && tmp[4] == 0 && tmp[5] == 0)) { if (!memcmp(tmp, "RDSK\0\0\0", 7) || !memcmp(tmp, "DRKS\0\0", 6) || (tmp[0] == 0x53 && tmp[1] == 0x10 && tmp[2] == 0x9b && tmp[3] == 0x13 && tmp[4] == 0 && tmp[5] == 0))
{
// RDSK or ADIDE "encoded" RDSK // RDSK or ADIDE "encoded" RDSK
isrdb = true; isrdb = true;
break; break;

View file

@ -42,7 +42,7 @@ static int get_mouse_num (void)
return 2; return 2;
} }
static TCHAR *get_mouse_friendlyname (int mouse) static const TCHAR *get_mouse_friendlyname(int mouse)
{ {
if (mouse == 0) if (mouse == 0)
return "Nubs as mouse"; return "Nubs as mouse";
@ -50,7 +50,7 @@ static TCHAR *get_mouse_friendlyname (int mouse)
return "dPad as mouse"; return "dPad as mouse";
} }
static TCHAR *get_mouse_uniquename (int mouse) static const TCHAR *get_mouse_uniquename(int mouse)
{ {
if (mouse == 0) if (mouse == 0)
return "MOUSE0"; return "MOUSE0";
@ -65,7 +65,8 @@ static int get_mouse_widget_num (int mouse)
static int get_mouse_widget_first(int mouse, int type) static int get_mouse_widget_first(int mouse, int type)
{ {
switch (type) { switch (type)
{
case IDEV_WIDGET_BUTTON: case IDEV_WIDGET_BUTTON:
return FIRST_MOUSE_BUTTON; return FIRST_MOUSE_BUTTON;
case IDEV_WIDGET_AXIS: case IDEV_WIDGET_AXIS:
@ -78,12 +79,16 @@ static int get_mouse_widget_first (int mouse, int type)
static int get_mouse_widget_type(int mouse, int num, TCHAR *name, uae_u32 *code) static int get_mouse_widget_type(int mouse, int num, TCHAR *name, uae_u32 *code)
{ {
if (num >= MAX_MOUSE_AXES && num < MAX_MOUSE_AXES + MAX_MOUSE_BUTTONS) { if (num >= MAX_MOUSE_AXES && num < MAX_MOUSE_AXES + MAX_MOUSE_BUTTONS)
{
if (name) if (name)
sprintf(name, "Button %d", num + 1 - MAX_MOUSE_AXES); sprintf(name, "Button %d", num + 1 - MAX_MOUSE_AXES);
return IDEV_WIDGET_BUTTON; return IDEV_WIDGET_BUTTON;
} else if (num < MAX_MOUSE_AXES) { }
if (name) { else if (num < MAX_MOUSE_AXES)
{
if (name)
{
if (num == 0) if (num == 0)
sprintf(name, "X Axis"); sprintf(name, "X Axis");
else if (num == 1) else if (num == 1)
@ -98,7 +103,8 @@ static int get_mouse_widget_type (int mouse, int num, TCHAR *name, uae_u32 *code
static void read_mouse(void) static void read_mouse(void)
{ {
if(currprefs.input_tablet > TABLET_OFF) { if (currprefs.input_tablet > TABLET_OFF)
{
// Mousehack active // Mousehack active
int x, y; int x, y;
SDL_GetMouseState(&x, &y); SDL_GetMouseState(&x, &y);
@ -106,7 +112,8 @@ static void read_mouse (void)
setmousestate(0, 1, y, 1); setmousestate(0, 1, y, 1);
} }
if(currprefs.jports[0].id == JSEM_MICE + 1 || currprefs.jports[1].id == JSEM_MICE + 1) { if (currprefs.jports[0].id == JSEM_MICE + 1 || currprefs.jports[1].id == JSEM_MICE + 1)
{
// dPad is mouse // dPad is mouse
Uint8 *keystate = SDL_GetKeyState(NULL); Uint8 *keystate = SDL_GetKeyState(NULL);
int mouseScale = currprefs.input_joymouse_multiplier / 4; int mouseScale = currprefs.input_joymouse_multiplier / 4;
@ -135,10 +142,18 @@ static int get_mouse_flags (int num)
return 0; return 0;
} }
struct inputdevice_functions inputdevicefunc_mouse = { struct inputdevice_functions inputdevicefunc_mouse =
init_mouse, close_mouse, acquire_mouse, unacquire_mouse, read_mouse, {
get_mouse_num, get_mouse_friendlyname, get_mouse_uniquename, init_mouse,
get_mouse_widget_num, get_mouse_widget_type, close_mouse,
acquire_mouse,
unacquire_mouse,
read_mouse,
get_mouse_num,
get_mouse_friendlyname,
get_mouse_uniquename,
get_mouse_widget_num,
get_mouse_widget_type,
get_mouse_widget_first, get_mouse_widget_first,
get_mouse_flags get_mouse_flags
}; };
@ -199,12 +214,12 @@ static int get_kb_num (void)
return 1; return 1;
} }
static TCHAR *get_kb_friendlyname (int kb) static const TCHAR *get_kb_friendlyname(int kb)
{ {
return strdup("Default Keyboard"); return strdup("Default Keyboard");
} }
static TCHAR *get_kb_uniquename (int kb) static const TCHAR *get_kb_uniquename(int kb)
{ {
return strdup("KEYBOARD0"); return strdup("KEYBOARD0");
} }
@ -231,17 +246,26 @@ static int get_kb_flags (int num)
return 0; return 0;
} }
struct inputdevice_functions inputdevicefunc_keyboard = { struct inputdevice_functions inputdevicefunc_keyboard =
init_kb, close_kb, acquire_kb, unacquire_kb, read_kb, {
get_kb_num, get_kb_friendlyname, get_kb_uniquename, init_kb,
get_kb_widget_num, get_kb_widget_type, close_kb,
acquire_kb,
unacquire_kb,
read_kb,
get_kb_num,
get_kb_friendlyname,
get_kb_uniquename,
get_kb_widget_num,
get_kb_widget_type,
get_kb_widget_first, get_kb_widget_first,
get_kb_flags get_kb_flags
}; };
int input_get_default_keyboard(int num) int input_get_default_keyboard(int num)
{ {
if (num == 0) { if (num == 0)
{
return 1; return 1;
} }
return 0; return 0;
@ -259,7 +283,6 @@ static char JoystickName[MAX_INPUT_DEVICES][80];
static SDL_Joystick* Joysticktable[MAX_INPUT_DEVICES]; static SDL_Joystick* Joysticktable[MAX_INPUT_DEVICES];
static int get_joystick_num(void) static int get_joystick_num(void)
{ {
// Keep joystick 0 as Pandora implementation... // Keep joystick 0 as Pandora implementation...
@ -304,7 +327,7 @@ static void unacquire_joystick (int num)
{ {
} }
static TCHAR *get_joystick_friendlyname (int joy) static const TCHAR *get_joystick_friendlyname(int joy)
{ {
if (joy == 0) if (joy == 0)
return "dPad as joystick"; return "dPad as joystick";
@ -312,7 +335,7 @@ static TCHAR *get_joystick_friendlyname (int joy)
return JoystickName[joy - 1]; return JoystickName[joy - 1];
} }
static TCHAR *get_joystick_uniquename (int joy) static const TCHAR *get_joystick_uniquename(int joy)
{ {
if (joy == 0) if (joy == 0)
return "JOY0"; return "JOY0";
@ -332,7 +355,6 @@ static TCHAR *get_joystick_uniquename (int joy)
return "JOY7"; return "JOY7";
} }
static int get_joystick_widget_num(int joy) static int get_joystick_widget_num(int joy)
{ {
return MAX_JOY_AXES + MAX_JOY_BUTTONS; return MAX_JOY_AXES + MAX_JOY_BUTTONS;
@ -340,7 +362,8 @@ static int get_joystick_widget_num (int joy)
static int get_joystick_widget_first(int joy, int type) static int get_joystick_widget_first(int joy, int type)
{ {
switch (type) { switch (type)
{
case IDEV_WIDGET_BUTTON: case IDEV_WIDGET_BUTTON:
return FIRST_JOY_BUTTON; return FIRST_JOY_BUTTON;
case IDEV_WIDGET_AXIS: case IDEV_WIDGET_AXIS:
@ -353,8 +376,10 @@ static int get_joystick_widget_first (int joy, int type)
static int get_joystick_widget_type(int joy, int num, TCHAR *name, uae_u32 *code) static int get_joystick_widget_type(int joy, int num, TCHAR *name, uae_u32 *code)
{ {
if (num >= MAX_JOY_AXES && num < MAX_JOY_AXES + MAX_JOY_BUTTONS) { if (num >= MAX_JOY_AXES && num < MAX_JOY_AXES + MAX_JOY_BUTTONS)
if (name) { {
if (name)
{
switch (num) switch (num)
{ {
case FIRST_JOY_BUTTON: case FIRST_JOY_BUTTON:
@ -381,8 +406,11 @@ static int get_joystick_widget_type (int joy, int num, TCHAR *name, uae_u32 *cod
} }
} }
return IDEV_WIDGET_BUTTON; return IDEV_WIDGET_BUTTON;
} else if (num < MAX_JOY_AXES) { }
if (name) { else if (num < MAX_JOY_AXES)
{
if (name)
{
if (num == 0) if (num == 0)
sprintf(name, "X Axis"); sprintf(name, "X Axis");
else if (num == 1) else if (num == 1)
@ -411,7 +439,8 @@ static void read_joystick (void)
Uint8 *keystate = SDL_GetKeyState(NULL); Uint8 *keystate = SDL_GetKeyState(NULL);
if (!keystate[SDLK_RCTRL]) if (!keystate[SDLK_RCTRL])
{ // Right shoulder + dPad -> cursor keys {
// Right shoulder + dPad -> cursor keys
int axis = (keystate[SDLK_LEFT] ? -32767 : (keystate[SDLK_RIGHT] ? 32767 : 0)); int axis = (keystate[SDLK_LEFT] ? -32767 : (keystate[SDLK_RIGHT] ? 32767 : 0));
if (!joyXviaCustom) if (!joyXviaCustom)
setjoystickstate(0, 0, axis, 32767); setjoystickstate(0, 0, axis, 32767);
@ -429,7 +458,8 @@ static void read_joystick (void)
setjoybuttonstate(0, 3, keystate[SDLK_PAGEUP]); setjoybuttonstate(0, 3, keystate[SDLK_PAGEUP]);
int cd32_start = 0, cd32_ffw = 0, cd32_rwd = 0; int cd32_start = 0, cd32_ffw = 0, cd32_rwd = 0;
if(keystate[SDLK_LALT]) { // Pandora Start button if (keystate[SDLK_LALT]) // Pandora Start button
{
if (keystate[SDLK_RSHIFT]) // Left shoulder if (keystate[SDLK_RSHIFT]) // Left shoulder
cd32_rwd = 1; cd32_rwd = 1;
else if (keystate[SDLK_RCTRL]) // Right shoulder else if (keystate[SDLK_RCTRL]) // Right shoulder
@ -453,16 +483,14 @@ static void read_joystick (void)
if (hat & SDL_HAT_RIGHT) if (hat & SDL_HAT_RIGHT)
setjoystickstate(hostjoyid + 1, 0, 32767, 32767); setjoystickstate(hostjoyid + 1, 0, 32767, 32767);
else else if (hat & SDL_HAT_LEFT)
if (hat & SDL_HAT_LEFT)
setjoystickstate(hostjoyid + 1, 0, -32767, 32767); setjoystickstate(hostjoyid + 1, 0, -32767, 32767);
else else
setjoystickstate(hostjoyid + 1, 0, val, 32767); setjoystickstate(hostjoyid + 1, 0, val, 32767);
val = SDL_JoystickGetAxis(Joysticktable[hostjoyid], 1); val = SDL_JoystickGetAxis(Joysticktable[hostjoyid], 1);
if (hat & SDL_HAT_UP) if (hat & SDL_HAT_UP)
setjoystickstate(hostjoyid + 1, 1, -32767, 32767); setjoystickstate(hostjoyid + 1, 1, -32767, 32767);
else else if (hat & SDL_HAT_DOWN)
if (hat & SDL_HAT_DOWN)
setjoystickstate(hostjoyid + 1, 1, 32767, 32767); setjoystickstate(hostjoyid + 1, 1, 32767, 32767);
else else
setjoystickstate(hostjoyid + 1, 1, val, 32767); setjoystickstate(hostjoyid + 1, 1, val, 32767);
@ -479,10 +507,18 @@ static void read_joystick (void)
} }
} }
struct inputdevice_functions inputdevicefunc_joystick = { struct inputdevice_functions inputdevicefunc_joystick =
init_joystick, close_joystick, acquire_joystick, unacquire_joystick, {
read_joystick, get_joystick_num, get_joystick_friendlyname, get_joystick_uniquename, init_joystick,
get_joystick_widget_num, get_joystick_widget_type, close_joystick,
acquire_joystick,
unacquire_joystick,
read_joystick,
get_joystick_num,
get_joystick_friendlyname,
get_joystick_uniquename,
get_joystick_widget_num,
get_joystick_widget_type,
get_joystick_widget_first, get_joystick_widget_first,
get_joystick_flags get_joystick_flags
}; };
@ -491,7 +527,8 @@ int input_get_default_joystick (struct uae_input_device *uid, int num, int port,
{ {
int h, v; int h, v;
h = port ? INPUTEVENT_JOY2_HORIZ : INPUTEVENT_JOY1_HORIZ;; h = port ? INPUTEVENT_JOY2_HORIZ : INPUTEVENT_JOY1_HORIZ;
;
v = port ? INPUTEVENT_JOY2_VERT : INPUTEVENT_JOY1_VERT; v = port ? INPUTEVENT_JOY2_VERT : INPUTEVENT_JOY1_VERT;
setid(uid, num, ID_AXIS_OFFSET + 0, 0, port, h, gp); setid(uid, num, ID_AXIS_OFFSET + 0, 0, port, h, gp);
@ -501,7 +538,8 @@ int input_get_default_joystick (struct uae_input_device *uid, int num, int port,
setid(uid, num, ID_BUTTON_OFFSET + 1, 0, port, port ? INPUTEVENT_JOY2_2ND_BUTTON : INPUTEVENT_JOY1_2ND_BUTTON, gp); setid(uid, num, ID_BUTTON_OFFSET + 1, 0, port, port ? INPUTEVENT_JOY2_2ND_BUTTON : INPUTEVENT_JOY1_2ND_BUTTON, gp);
setid(uid, num, ID_BUTTON_OFFSET + 2, 0, port, port ? INPUTEVENT_JOY2_3RD_BUTTON : INPUTEVENT_JOY1_3RD_BUTTON, gp); setid(uid, num, ID_BUTTON_OFFSET + 2, 0, port, port ? INPUTEVENT_JOY2_3RD_BUTTON : INPUTEVENT_JOY1_3RD_BUTTON, gp);
if (mode == JSEM_MODE_JOYSTICK_CD32) { if (mode == JSEM_MODE_JOYSTICK_CD32)
{
setid_af(uid, num, ID_BUTTON_OFFSET + 0, 0, port, port ? INPUTEVENT_JOY2_CD32_RED : INPUTEVENT_JOY1_CD32_RED, af, gp); setid_af(uid, num, ID_BUTTON_OFFSET + 0, 0, port, port ? INPUTEVENT_JOY2_CD32_RED : INPUTEVENT_JOY1_CD32_RED, af, gp);
setid(uid, num, ID_BUTTON_OFFSET + 1, 0, port, port ? INPUTEVENT_JOY2_CD32_BLUE : INPUTEVENT_JOY1_CD32_BLUE, gp); setid(uid, num, ID_BUTTON_OFFSET + 1, 0, port, port ? INPUTEVENT_JOY2_CD32_BLUE : INPUTEVENT_JOY1_CD32_BLUE, gp);
setid(uid, num, ID_BUTTON_OFFSET + 2, 0, port, port ? INPUTEVENT_JOY2_CD32_GREEN : INPUTEVENT_JOY1_CD32_GREEN, gp); setid(uid, num, ID_BUTTON_OFFSET + 2, 0, port, port ? INPUTEVENT_JOY2_CD32_GREEN : INPUTEVENT_JOY1_CD32_GREEN, gp);
@ -510,7 +548,8 @@ int input_get_default_joystick (struct uae_input_device *uid, int num, int port,
setid(uid, num, ID_BUTTON_OFFSET + 5, 0, port, port ? INPUTEVENT_JOY2_CD32_FFW : INPUTEVENT_JOY1_CD32_FFW, gp); setid(uid, num, ID_BUTTON_OFFSET + 5, 0, port, port ? INPUTEVENT_JOY2_CD32_FFW : INPUTEVENT_JOY1_CD32_FFW, gp);
setid(uid, num, ID_BUTTON_OFFSET + 6, 0, port, port ? INPUTEVENT_JOY2_CD32_PLAY : INPUTEVENT_JOY1_CD32_PLAY, gp); setid(uid, num, ID_BUTTON_OFFSET + 6, 0, port, port ? INPUTEVENT_JOY2_CD32_PLAY : INPUTEVENT_JOY1_CD32_PLAY, gp);
} }
if (num == 0) { if (num == 0)
{
return 1; return 1;
} }
return 0; return 0;
@ -524,7 +563,8 @@ int input_get_default_joystick_analog (struct uae_input_device *uid, int num, in
void SimulateMouseOrJoy(int code, int keypressed) void SimulateMouseOrJoy(int code, int keypressed)
{ {
switch(code) { switch (code)
{
case REMAP_MOUSEBUTTON_LEFT: case REMAP_MOUSEBUTTON_LEFT:
mouseBut1viaCustom = keypressed; mouseBut1viaCustom = keypressed;
setmousebuttonstate(0, 0, keypressed); setmousebuttonstate(0, 0, keypressed);

File diff suppressed because it is too large Load diff