Commit 9657f1c9 authored by GnoStiC's avatar GnoStiC

puae 2.3.1

parent 226404ac
......@@ -14,13 +14,29 @@
#include "puae_mainwindow.h"
//#include "ui_puae_mainwindow.h"
static unsigned int gui_available;
extern "C" {
#include "puae_registry.h"
#include "gui.h"
#include "options.h"
#include "writelog.h"
extern struct uae_prefs workprefs;
extern void romlist_clear (void);
extern int load_keyring (struct uae_prefs *p, const char *path);
extern int scan_roms (int);
}
static unsigned int gui_available;
static int allow_quit;
static int restart_requested;
static int full_property_sheet = 1;
static struct uae_prefs *pguiprefs;
static int currentpage;
static int qs_request_reset;
static int qs_override;
int gui_active;
static int forceroms;
/*
*
*
......@@ -46,12 +62,93 @@ extern "C" void cocoa_gui_early_setup (void)
{
}
void read_rom_list (void)
{
char tmp2[1000];
int idx, idx2;
char tmp[1000];
int size, size2, exists;
romlist_clear ();
exists = regexiststree ("DetectedROMs");
if (!exists || forceroms) {
load_keyring (NULL, NULL);
scan_roms (forceroms ? 0 : 1);
}
forceroms = 0;
}
static void prefs_to_gui (struct uae_prefs *p)
{
workprefs = *p;
/* filesys hack */
workprefs.mountitems = currprefs.mountitems;
memcpy (&workprefs.mountconfig, &currprefs.mountconfig, MOUNT_CONFIG_SIZE * sizeof (struct uaedev_config_info));
//updatewinfsmode (&workprefs);
}
static void gui_to_prefs (void)
{
/* Always copy our prefs to changed_prefs, ... */
changed_prefs = workprefs;
/* filesys hack */
currprefs.mountitems = changed_prefs.mountitems;
memcpy (&currprefs.mountconfig, &changed_prefs.mountconfig, MOUNT_CONFIG_SIZE * sizeof (struct uaedev_config_info));
fixup_prefs (&changed_prefs);
//updatewinfsmode (&changed_prefs);
}
int GetSettings (int all_options)
{
static int init_called = 0;
int first = 0;
gui_active++;
full_property_sheet = all_options;
allow_quit = all_options;
pguiprefs = &currprefs;
memset (&workprefs, 0, sizeof (struct uae_prefs));
default_prefs (&workprefs, 0);
prefs_to_gui (&changed_prefs);
if (!init_called) {
first = 1;
init_called = 1;
}
if (first)
write_log ("Entering GUI idle loop\n");
full_property_sheet = 0;
gui_active--;
return 0;
}
int gui_init (void)
{
// MyThread *QT_GUI_Thread=new MyThread;
// QT_GUI_Thread->start();
int ret;
return 0;
read_rom_list ();
inputdevice_updateconfig (&workprefs);
for (;;) {
ret = GetSettings (1);
if (!restart_requested)
break;
restart_requested = 0;
}
#ifdef AVIOUTPUT
if (ret > 0) {
AVIOutput_Begin ();
}
#endif
return ret;
}
void gui_exit (void)
......@@ -61,6 +158,7 @@ void gui_exit (void)
int gui_update (void)
{
return 1;
}
void gui_display (int shortcut)
......@@ -97,18 +195,85 @@ extern "C" void gui_message (const char *format,...)
void gui_fps (int fps, int idle)
{
gui_data.fps = fps;
gui_data.idle = idle;
gui_led (LED_FPS, 0);
gui_led (LED_CPU, 0);
gui_led (LED_SND, (gui_data.sndbuf_status > 1 || gui_data.sndbuf_status < 0) ? 0 : 1);
}
void gui_handle_events (void)
{
}
void gui_led (int num, int on)
void gui_led (int led, int on)
{
int writing = 0, playing = 0, active2 = 0;
int center = 0;
if (led >= LED_DF0 && led <= LED_DF3) {
} else if (led == LED_POWER) {
} else if (led == LED_HD) {
if (on > 1)
writing = 1;
} else if (led == LED_CD) {
if (on & LED_CD_AUDIO)
playing = 1;
else if (on & LED_CD_ACTIVE2)
active2 = 1;
on &= 1;
} else if (led == LED_FPS) {
double fps = (double)gui_data.fps / 10.0;
if (fps > 999.9)
fps = 999.9;
} else if (led == LED_CPU) {
} else if (led == LED_SND && gui_data.drive_disabled[3]) {
} else if (led == LED_MD) {
}
}
static void gui_flicker_led2 (int led, int unitnum, int status)
{
static int resetcounter[LED_MAX];
uae_u8 old;
uae_u8 *p;
if (led == LED_HD)
p = &gui_data.hd;
else if (led == LED_CD)
p = &gui_data.cd;
else if (led == LED_MD)
p = &gui_data.md;
else
return;
old = *p;
if (status == 0) {
resetcounter[led]--;
if (resetcounter[led] > 0)
return;
}
#ifdef RETROPLATFORM
if (led == LED_HD)
rp_hd_activity (unitnum, status ? 1 : 0, status == 2 ? 1 : 0);
else if (led == LED_CD)
rp_cd_activity (unitnum, status);
#endif
*p = status;
resetcounter[led] = 6;
if (old != *p)
gui_led (led, *p);
}
void gui_flicker_led (int led, int unitnum, int status)
{
if (led < 0) {
gui_flicker_led2 (LED_HD, 0, 0);
gui_flicker_led2 (LED_CD, 0, 0);
gui_flicker_led2 (LED_MD, 0, 0);
} else {
gui_flicker_led2 (led, unitnum, status);
}
}
void gui_gameport_axis_change (int port, int axis, int state, int max)
......
......@@ -16,4 +16,9 @@ typedef long uae_s32;
#define MAX_DPATH 512
#define STATIC_INLINE static __inline__
extern "C" {
extern void inputdevice_updateconfig (struct uae_prefs *prefs);
}
extern void read_rom_list (void);
#endif // PUAE_BRIDGE_H
......@@ -18,7 +18,7 @@ public:
explicit puae_MainWindow(QWidget *parent = 0);
~puae_MainWindow();
//private:
private:
Ui::puae_MainWindow *ui;
private slots:
......
#ifndef PUAE_REGISTRY_H
#define PUAE_REGISTRY_H
struct UAEREG {
char *fkey;
char *inipath;
};
extern int getregmode (void);
extern int reginitializeinit (const char *path);
extern void regstatus (void);
extern int regsetstr (UAEREG*, const char *name, const char *str);
extern int regsetint (UAEREG*, const char *name, int val);
extern int regqueryint (UAEREG*, const char *name, int *val);
extern int regquerystr (UAEREG*, const char *name, char *str, int *size);
extern int regdelete (UAEREG*, const char *name);
extern void regdeletetree (UAEREG*, const char *name);
extern int regsetstr (const char *name, const char *str);
extern int regsetint (const char *name, int val);
extern int regqueryint (const char *name, int *val);
extern int regquerystr (const char *name, char *str, int *size);
extern int regexists (UAEREG*, const char *name);
extern int regexiststree (UAEREG *, const char *name);
extern int regdelete (const char *name);
extern void regdeletetree (const char *name);
extern int regquerydatasize (UAEREG *root, const char *name, int *size);
extern int regsetdata (UAEREG*, const char *name, const void *str, int size);
extern int regquerydata (UAEREG *root, const char *name, void *str, int *size);
extern int regexists (const char *name);
extern int regexiststree (const char *name);
extern int regenumstr (UAEREG*, int idx, char *name, int *nsize, char *str, int *size);
extern int regquerydatasize (const char *name, int *size);
extern int regsetdata (const char *name, const void *str, int size);
extern int regquerydata (const char *name, void *str, int *size);
extern UAEREG *regcreatetree (UAEREG*, const char *name);
extern void regclosetree (UAEREG *key);
extern int regenumstr (int idx, char *name, int *nsize, char *str, int *size);
#endif // PUAE_REGISTRY_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment