mirror of
https://github.com/mauiaaron/apple2.git
synced 2025-01-10 23:29:43 +00:00
moar ifdefs for various macro conditional codepaths
* INTERFACE_CLASSIC : specifies the "classic" (current) menuing system * AUDIO_ENABLED : specifies whether audio code is enabled
This commit is contained in:
parent
a1e952984f
commit
e57f332ff6
@ -17,7 +17,9 @@
|
|||||||
#ifndef _A2_H_
|
#ifndef _A2_H_
|
||||||
#define _A2_H_
|
#define _A2_H_
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#define BANK2 0x10000
|
#define BANK2 0x10000
|
||||||
|
|
||||||
|
@ -179,9 +179,11 @@ E(read_random)
|
|||||||
ret
|
ret
|
||||||
|
|
||||||
E(read_speaker_toggle_pc)
|
E(read_speaker_toggle_pc)
|
||||||
|
#ifdef AUDIO_ENABLED
|
||||||
pushal
|
pushal
|
||||||
call SN(SpkrToggle)
|
call SN(SpkrToggle)
|
||||||
popal // FIXME, do we need to set %al to something here?
|
popal // FIXME, do we need to set %al to something here?
|
||||||
|
#endif
|
||||||
ret
|
ret
|
||||||
|
|
||||||
E(read_switch_primary_page)
|
E(read_switch_primary_page)
|
||||||
|
@ -106,9 +106,14 @@ void c_eject_6(int drive) {
|
|||||||
const char* const err = def(disk6.disk[drive].file_name);
|
const char* const err = def(disk6.disk[drive].file_name);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
|
ERRLOG("OOPS: An error occurred when attempting to compress a disk image : %s", err);
|
||||||
|
#ifdef INTERFACE_CLASSIC
|
||||||
snprintf(&zlibmenu[4][2], 37, "%s", err);
|
snprintf(&zlibmenu[4][2], 37, "%s", err);
|
||||||
c_interface_print_submenu_centered(zlibmenu[0], ZLIB_SUBMENU_W, ZLIB_SUBMENU_H);
|
c_interface_print_submenu_centered(zlibmenu[0], ZLIB_SUBMENU_W, ZLIB_SUBMENU_H);
|
||||||
while ((ch = c_mygetch(1)) == -1) { }
|
while ((ch = c_mygetch(1)) == -1) {
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -158,14 +163,12 @@ int c_new_diskette_6(int drive, char *file_name, int cmpr, int nib, int force) {
|
|||||||
|
|
||||||
if (!force)
|
if (!force)
|
||||||
{
|
{
|
||||||
/* Open read only */
|
|
||||||
disk6.disk[drive].fp = fopen(disk6.disk[drive].file_name, "r+");
|
disk6.disk[drive].fp = fopen(disk6.disk[drive].file_name, "r+");
|
||||||
disk6.disk[drive].is_protected = 0;
|
disk6.disk[drive].is_protected = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((disk6.disk[drive].fp == NULL) || (force))
|
if ((disk6.disk[drive].fp == NULL) || (force))
|
||||||
{
|
{
|
||||||
/* Open for read AND write */
|
|
||||||
disk6.disk[drive].fp = fopen(disk6.disk[drive].file_name, "r");
|
disk6.disk[drive].fp = fopen(disk6.disk[drive].file_name, "r");
|
||||||
disk6.disk[drive].is_protected = 1; /* disk is write protected! */
|
disk6.disk[drive].is_protected = 1; /* disk is write protected! */
|
||||||
}
|
}
|
||||||
|
@ -121,6 +121,7 @@ static void c_calculate_pc_joystick_parms()
|
|||||||
js_adjusthigh_y = (float)HALF_JOY_RANGE / (float)js_upperrange_y;
|
js_adjusthigh_y = (float)HALF_JOY_RANGE / (float)js_upperrange_y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef INTERFACE_CLASSIC
|
||||||
/* -------------------------------------------------------------------------
|
/* -------------------------------------------------------------------------
|
||||||
c_calibrate_pc_joystick() - calibrates joystick. determines extreme
|
c_calibrate_pc_joystick() - calibrates joystick. determines extreme
|
||||||
and center coordinates. assumes that it can write to the interface
|
and center coordinates. assumes that it can write to the interface
|
||||||
@ -143,10 +144,6 @@ static void c_calibrate_pc_joystick()
|
|||||||
"| Is the proper kernel module loaded? |",
|
"| Is the proper kernel module loaded? |",
|
||||||
"| |",
|
"| |",
|
||||||
"||||||||||||||||||||||||||||||||||||||||" };
|
"||||||||||||||||||||||||||||||||||||||||" };
|
||||||
#define JOYERR_SHOWERR(ERR) \
|
|
||||||
copy_and_pad_string(&errmenu[3][2], ERR, ' ', JOYERR_PAD, ' '); \
|
|
||||||
c_interface_print_submenu_centered(errmenu[0], JOYERR_SUBMENU_W, JOYERR_SUBMENU_H); \
|
|
||||||
while (c_mygetch(1) == -1) { }
|
|
||||||
|
|
||||||
/* reset all the extremes */
|
/* reset all the extremes */
|
||||||
js_max_x = INT_MIN;
|
js_max_x = INT_MIN;
|
||||||
@ -159,7 +156,15 @@ static void c_calibrate_pc_joystick()
|
|||||||
{
|
{
|
||||||
if (c_open_pc_joystick())
|
if (c_open_pc_joystick())
|
||||||
{
|
{
|
||||||
JOYERR_SHOWERR(strerror(errno));
|
const char *err = strerror(errno);
|
||||||
|
ERRLOG("OOPS, cannot open pc joystick : %s", err);
|
||||||
|
#ifdef INTERFACE_CLASSIC
|
||||||
|
copy_and_pad_string(&errmenu[3][2], err, ' ', JOYERR_PAD, ' ');
|
||||||
|
c_interface_print_submenu_centered(errmenu[0], JOYERR_SUBMENU_W, JOYERR_SUBMENU_H);
|
||||||
|
while (c_mygetch(1) == -1) {
|
||||||
|
// ...
|
||||||
|
}
|
||||||
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -317,9 +322,10 @@ static void c_calibrate_pc_joystick()
|
|||||||
nanosleep(&ts, NULL);
|
nanosleep(&ts, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif // INTERFACE_CLASSIC
|
||||||
#endif // LINUX_JOYSTICK
|
#endif // LINUX_JOYSTICK
|
||||||
|
|
||||||
#ifdef KEYPAD_JOYSTICK
|
#if defined(KEYPAD_JOYSTICK) && defined(INTERFACE_CLASSIC)
|
||||||
static void c_calibrate_keypad_joystick()
|
static void c_calibrate_keypad_joystick()
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -426,7 +432,7 @@ static void c_calibrate_keypad_joystick()
|
|||||||
nanosleep(&ts, NULL);
|
nanosleep(&ts, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // KEYPAD_JOYSTICK
|
#endif // KEYPAD_JOYSTICK && INTERFACE_CLASSIC
|
||||||
|
|
||||||
#ifdef TOUCH_JOYSTICK
|
#ifdef TOUCH_JOYSTICK
|
||||||
// TBD ...
|
// TBD ...
|
||||||
@ -465,6 +471,7 @@ void c_close_joystick()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef INTERFACE_CLASSIC
|
||||||
void c_calibrate_joystick()
|
void c_calibrate_joystick()
|
||||||
{
|
{
|
||||||
#ifdef LINUX_JOYSTICK
|
#ifdef LINUX_JOYSTICK
|
||||||
@ -481,6 +488,7 @@ void c_calibrate_joystick()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif // INTERFACE_CLASSIC
|
||||||
|
|
||||||
void c_joystick_reset()
|
void c_joystick_reset()
|
||||||
{
|
{
|
||||||
|
@ -241,11 +241,14 @@ void c_handle_input(int scancode, int pressed)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pthread_mutex_lock(&interface_mutex);
|
pthread_mutex_lock(&interface_mutex);
|
||||||
|
#ifdef AUDIO_ENABLED
|
||||||
SoundSystemPause();
|
SoundSystemPause();
|
||||||
|
#endif
|
||||||
in_interface = true;
|
in_interface = true;
|
||||||
|
|
||||||
switch (current_key)
|
switch (current_key)
|
||||||
{
|
{
|
||||||
|
#ifdef INTERFACE_CLASSIC
|
||||||
case kF1:
|
case kF1:
|
||||||
c_interface_select_diskette( 0 );
|
c_interface_select_diskette( 0 );
|
||||||
break;
|
break;
|
||||||
@ -253,6 +256,7 @@ void c_handle_input(int scancode, int pressed)
|
|||||||
case kF2:
|
case kF2:
|
||||||
c_interface_select_diskette( 1 );
|
c_interface_select_diskette( 1 );
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
case kPAUSE:
|
case kPAUSE:
|
||||||
while (c_mygetch(1) == -1)
|
while (c_mygetch(1) == -1)
|
||||||
@ -262,6 +266,7 @@ void c_handle_input(int scancode, int pressed)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
#ifdef INTERFACE_CLASSIC
|
||||||
case kF5:
|
case kF5:
|
||||||
c_interface_keyboard_layout();
|
c_interface_keyboard_layout();
|
||||||
break;
|
break;
|
||||||
@ -279,12 +284,15 @@ void c_handle_input(int scancode, int pressed)
|
|||||||
case kF10:
|
case kF10:
|
||||||
c_interface_parameters();
|
c_interface_parameters();
|
||||||
break;
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef AUDIO_ENABLED
|
||||||
SoundSystemUnpause();
|
SoundSystemUnpause();
|
||||||
|
#endif
|
||||||
c_joystick_reset();
|
c_joystick_reset();
|
||||||
pthread_mutex_unlock(&interface_mutex);
|
pthread_mutex_unlock(&interface_mutex);
|
||||||
in_interface = false;
|
in_interface = false;
|
||||||
|
@ -1284,6 +1284,7 @@ void do_debug_command() {
|
|||||||
main debugging console
|
main debugging console
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
#ifdef INTERFACE_CLASSIC
|
||||||
void c_interface_debugging() {
|
void c_interface_debugging() {
|
||||||
|
|
||||||
static char lex_initted = 0;
|
static char lex_initted = 0;
|
||||||
@ -1371,4 +1372,5 @@ void c_interface_debugging() {
|
|||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
@ -744,8 +744,10 @@ void reinitialize(void)
|
|||||||
|
|
||||||
void c_initialize_firsttime()
|
void c_initialize_firsttime()
|
||||||
{
|
{
|
||||||
|
#ifdef INTERFACE_CLASSIC
|
||||||
/* read in system files and calculate system defaults */
|
/* read in system files and calculate system defaults */
|
||||||
c_load_interface_font();
|
c_load_interface_font();
|
||||||
|
#endif
|
||||||
|
|
||||||
/* initialize the video system */
|
/* initialize the video system */
|
||||||
video_init();
|
video_init();
|
||||||
|
23
src/prefs.c
23
src/prefs.c
@ -209,11 +209,11 @@ void load_settings(void)
|
|||||||
config_file = fopen(config_filename, "r");
|
config_file = fopen(config_filename, "r");
|
||||||
if (config_file == NULL)
|
if (config_file == NULL)
|
||||||
{
|
{
|
||||||
printf(
|
ERRLOG(
|
||||||
"Warning. Cannot open the .apple2 system defaults file.\n"
|
"Warning. Cannot open the .apple2 system defaults file.\n"
|
||||||
"Make sure it's readable in your home directory.");
|
"Make sure it's readable in your home directory.");
|
||||||
printf("Press RETURN to continue...");
|
ERRLOG("Press RETURN to continue...");
|
||||||
getchar();
|
getchar(); // HACK FIXME -- this needs to be decoupled from both testing and mobile targets
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,7 +236,7 @@ void load_settings(void)
|
|||||||
switch (main_match)
|
switch (main_match)
|
||||||
{
|
{
|
||||||
case PRM_NONE:
|
case PRM_NONE:
|
||||||
fprintf(stderr, "Unrecognized config parameter `%s'", parameter);
|
ERRLOG("Unrecognized config parameter `%s'", parameter);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PRM_SPEED:
|
case PRM_SPEED:
|
||||||
@ -352,6 +352,11 @@ bool save_settings(void)
|
|||||||
|
|
||||||
LOG("Saving preferences...");
|
LOG("Saving preferences...");
|
||||||
|
|
||||||
|
#define PREFS_ERRPRINT() \
|
||||||
|
ERRLOG( \
|
||||||
|
"Cannot open the .apple2/apple2.cfg system defaults file for writing.\n" \
|
||||||
|
"Make sure it has rw permission in your home directory.")
|
||||||
|
|
||||||
#define ERROR_SUBMENU_H 9
|
#define ERROR_SUBMENU_H 9
|
||||||
#define ERROR_SUBMENU_W 40
|
#define ERROR_SUBMENU_W 40
|
||||||
int ch = -1;
|
int ch = -1;
|
||||||
@ -370,14 +375,13 @@ bool save_settings(void)
|
|||||||
config_file = fopen(config_filename, "w");
|
config_file = fopen(config_filename, "w");
|
||||||
if (config_file == NULL)
|
if (config_file == NULL)
|
||||||
{
|
{
|
||||||
printf(
|
PREFS_ERRPRINT();
|
||||||
"Cannot open the .apple2/apple2.cfg system defaults file for writing.\n"
|
#ifdef INTERFACE_CLASSIC
|
||||||
"Make sure it has rw permission in your home directory.");
|
|
||||||
c_interface_print_submenu_centered(submenu[0], ERROR_SUBMENU_W, ERROR_SUBMENU_H);
|
c_interface_print_submenu_centered(submenu[0], ERROR_SUBMENU_W, ERROR_SUBMENU_H);
|
||||||
while ((ch = c_mygetch(1)) == -1)
|
while ((ch = c_mygetch(1)) == -1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -417,10 +421,13 @@ bool save_settings(void)
|
|||||||
|
|
||||||
if (anErr)
|
if (anErr)
|
||||||
{
|
{
|
||||||
|
PREFS_ERRPRINT();
|
||||||
|
#ifdef INTERFACE_CLASSIC
|
||||||
c_interface_print_submenu_centered(submenu[0], ERROR_SUBMENU_W, ERROR_SUBMENU_H);
|
c_interface_print_submenu_centered(submenu[0], ERROR_SUBMENU_W, ERROR_SUBMENU_H);
|
||||||
while ((ch = c_mygetch(1)) == -1)
|
while ((ch = c_mygetch(1)) == -1)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,10 +95,12 @@ static void _timing_initialize(double scale)
|
|||||||
|
|
||||||
g_fCurrentCLK6502 = CLK_6502 * scale;
|
g_fCurrentCLK6502 = CLK_6502 * scale;
|
||||||
// this is extracted out of SetClksPerSpkrSample -- speaker.c
|
// this is extracted out of SetClksPerSpkrSample -- speaker.c
|
||||||
|
#ifdef AUDIO_ENABLED
|
||||||
g_fClksPerSpkrSample = (double) (UINT) (g_fCurrentCLK6502 / (double)SPKR_SAMPLE_RATE);
|
g_fClksPerSpkrSample = (double) (UINT) (g_fCurrentCLK6502 / (double)SPKR_SAMPLE_RATE);
|
||||||
SpkrReinitialize();
|
SpkrReinitialize();
|
||||||
|
|
||||||
LOG("timing_initialize() ... ClockRate:%0.2lf ClockCyclesPerSpeakerSample:%0.2lf", g_fCurrentCLK6502, g_fClksPerSpkrSample);
|
LOG("timing_initialize() ... ClockRate:%0.2lf ClockCyclesPerSpeakerSample:%0.2lf", g_fCurrentCLK6502, g_fClksPerSpkrSample);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _switch_to_fullspeed(double scale)
|
static void _switch_to_fullspeed(double scale)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user