add prettier, but hacky, logging

This commit is contained in:
Dagen Brock 2016-10-28 11:42:50 -05:00
parent 77efd643a9
commit aa32d6f08f
12 changed files with 65 additions and 50 deletions

View File

@ -3,7 +3,7 @@
#@todo: remove all packaging junk and move to packaging scripts in CI
OBJECTS1 = adb.o clock.o config.o debug.o dis.o engine_c.o scc.o iwm.o \
joystick_driver.o moremem.o paddles.o parallel.o printer.o sim65816.o \
smartport.o sound.o sound_driver.o video.o scc_socket_driver.o \
smartport.o sound.o sound_driver.o video.o scc_socket_driver.o glog.o \
imagewriter.o scc_imagewriter.o scc_llap.o
ATOBJ = atbridge/aarp.o atbridge/atbridge.o atbridge/elap.o atbridge/llap.o atbridge/port.o
PCAPOBJ = atbridge/pcap_delay.o

View File

@ -1653,19 +1653,19 @@ adb_increment_speed()
str = "";
switch(g_limit_speed) {
case 0:
str = "...as fast as possible!";
str = "... as fast as possible!";
break;
case 1:
str = "...1.024MHz!";
str = "... 1.024MHz";
break;
case 2:
str = "...2.8MHz!";
str = "... 2.8MHz";
break;
case 3:
str = "...8.0MHz!";
str = "... 8.0MHz";
break;
}
printf("Toggling g_limit_speed to %d%s\n", g_limit_speed, str);
gloghead(); printf("Setting g_limit_speed = %d %s\n", g_limit_speed, str);
}
void
@ -1731,7 +1731,7 @@ adb_physical_key_update(int a2code, int is_up)
/* Only process reset requests here */
if(is_up == 0 && a2code == 0x7f && CTRL_DOWN) {
/* Reset pressed! */
printf("Reset pressed since CTRL_DOWN: %d\n", CTRL_DOWN);
gloghead(); printf("Reset pressed since CTRL_DOWN: %d\n", CTRL_DOWN);
do_reset();
return;
}
@ -1740,7 +1740,7 @@ adb_physical_key_update(int a2code, int is_up)
switch(special) {
case 0x04: /* F4 - emulator config panel */
if (CMD_DOWN) {
printf("Quit!\n");
glog("Quit!");
iwm_shut();
my_exit(1);
}
@ -1765,7 +1765,7 @@ adb_physical_key_update(int a2code, int is_up)
break;
case 0x07: /* F7 - fast disk emul */
g_fast_disk_emul = !g_fast_disk_emul;
printf("g_fast_disk_emul is now %d\n",
gloghead(); printf("g_fast_disk_emul is now %d\n",
g_fast_disk_emul);
break;
case 0x08: /* F8 - warp pointer */
@ -1778,11 +1778,11 @@ adb_physical_key_update(int a2code, int is_up)
case 0x09: /* F9 - swap paddles */
if(SHIFT_DOWN) {
g_swap_paddles = !g_swap_paddles;
printf("Swap paddles is now: %d\n",
gloghead(); printf("Swap paddles is now: %d\n",
g_swap_paddles);
} else {
g_invert_paddles = !g_invert_paddles;
printf("Invert paddles is now: %d\n",
gloghead(); printf("Invert paddles is now: %d\n",
g_invert_paddles);
}
break;

View File

@ -872,7 +872,7 @@ config_load_roms()
return;
}
printf("Read: %d bytes of ROM\n", ret);
gloghead(); printf("Read: %d bytes of ROM\n", ret);
if(ret != len) {
fatal_printf("errno: %d\n", errno);
g_config_control_panel = 1;
@ -1033,7 +1033,7 @@ config_parse_config_gsplus_file()
int ret;
int i;
printf("Parsing configuration file\n");
glog("Parsing configuration file");
clk_bram_zero();

View File

@ -10,6 +10,7 @@
#include <string.h>
#include "defc.h"
#include "debug.h"
#include "glog.h"
// DISASSEMBLER STUFF
enum {
@ -756,14 +757,14 @@ void debug_init()
{
if (g_dbg_enable_port > 0) {
// g_dbg_enable_port should be enabled by
printf("Debug port enabled on: %d\n", g_dbg_enable_port);
gloghead(); printf("Debug port enabled on: %d\n", g_dbg_enable_port);
debug_setup_socket();
debug_server_poll();
debug_wait_hello();
// message is not popped off here because default behavior to send our cpu hello info to client
} else {
end_server = TRUE;
printf("Debug port not enabled\n");
glog("Debug port not enabled");
}
}

View File

@ -266,18 +266,21 @@ joystick_init()
{
int i;
if( SDL_Init( SDL_INIT_JOYSTICK ) < 0 ) {
printf( "SDL could not initialize joystick! SDL Error: %s\n", SDL_GetError() );
gloghead(); printf( "SDL could not initialize joystick! SDL Error: %s\n", SDL_GetError() );
} else {
printf( "SDL initialize joystick successfully.\n");
glog("SDL2 joystick initialized");
}
if (SDL_NumJoysticks()<1) {
printf ("No joysticks detected\n");
glog("No joysticks detected");
SDL_QuitSubSystem(SDL_INIT_JOYSTICK);
}
gGameController = SDL_JoystickOpen( 0 );
if( gGameController == NULL ) {
printf( "Warning: Unable to open game controller! SDL Error: %s\n", SDL_GetError() );
}
} else {
// @todo: make controller configurable
// @todo: add multiple controller support
gGameController = SDL_JoystickOpen( 0 );
if( gGameController == NULL ) {
gloghead(); printf( "Warning: Unable to open game controller! SDL Error: %s\n", SDL_GetError() );
}
}
g_joystick_native_type = 2;
g_joystick_native_type1 = 2;
g_joystick_native_type2 = -1;

View File

@ -69,6 +69,7 @@ extern "C" char* g_printer_font_courier;
extern "C" char* g_printer_font_prestige;
extern "C" char* g_printer_font_script;
extern "C" char* g_printer_font_ocra;
extern "C" void gloghead();
Bit8u paramc = '0';
#include "printer_charmaps.h"
@ -366,7 +367,7 @@ void CPrinter::updateFont()
if (FT_New_Face(FTlib, fontName, 0, &curFont))
{
gloghead();
printf("Unable to load font\n");
//LOG_MSG("Unable to load font %s", fontName);
curFont = NULL;

View File

@ -298,10 +298,10 @@ dev_video_init_sdl()
// Check that the window was successfully created
if (window == NULL) {
// In the case that the window could not be made...
printf("Could not create window: %s\n", SDL_GetError());
gloghead(); printf("Could not create window: %s\n", SDL_GetError());
//@todo die, i guess
} else {
printf("SDL Window has been created\n");
glog("SDL2 graphics initialized");
}
// SET WINDOW ICON
@ -320,7 +320,6 @@ dev_video_init_sdl()
// The window is open: could enter program loop here (see SDL_PollEvent())
SDL_ShowCursor(SDL_DISABLE);
}

View File

@ -19,7 +19,7 @@
#include "SDL.h"
#include "defc.h"
#include "glog.h"
#include "sound.h"
#include <assert.h>
extern word32 *g_sound_shm_addr;
@ -39,12 +39,11 @@ static int g_zeroes_seen;
void sdlsnd_init(word32 *shmaddr)
{
printf("sdlsnd_init\n");
if (SDL_Init(SDL_INIT_AUDIO) < 0) {
printf("Cannot initialize SDL audio\n");
glog("Could not initialize SDL2 audio");
g_audio_enable = 0;
} else {
printf("SDL AUDIO INITIALIZED\n");
glog("SDL2 audio initialized");
}
child_sound_loop(-1, -1, shmaddr);
@ -86,12 +85,12 @@ sound_write_sdl(int real_samps, int size)
SDL_UnlockAudio();
}
if(g_sound_paused && (g_playbuf_buffered > 0)) {
printf("Unpausing sound, %d buffered\n",g_playbuf_buffered);
gloghead(); printf("Unpausing sound, %d buffered\n",g_playbuf_buffered);
g_sound_paused = 0;
SDL_PauseAudio(0);
}
if(!g_sound_paused && (g_playbuf_buffered <= 0)) {
printf("Pausing sound\n");
glog("Pausing sound");
g_sound_paused = 1;
SDL_PauseAudio(1);
}
@ -179,7 +178,7 @@ sound_init_device_sdl()
goto snd_error;
g_playbuf_buffered = 0;
printf ("Sound shared memory size=%d\n",
gloghead(); printf("Sound shared memory size=%d\n",
SOUND_SHM_SAMP_SIZE * SAMPLE_CHAN_SIZE);
g_sound_shm_addr = malloc(SOUND_SHM_SAMP_SIZE * SAMPLE_CHAN_SIZE);

View File

@ -26,6 +26,7 @@
#include "printer.h"
#include "imagewriter.h"
#include "debug.h"
#include "glog.h"
extern const char *g_config_gsplus_name_list[];
extern char *g_config_gsplus_screenshot_dir;
@ -893,7 +894,7 @@ memory_ptr_init()
*/
g_memory_ptr = memalloc_align(mem_size, 256, &g_memory_alloc_ptr);
printf("RAM size is 0 - %06x (%.2fMB)\n", mem_size,
gloghead(); printf("RAM size is 0 - %06x (%.2fMB)\n", mem_size,
(double)mem_size/(1024.0*1024.0));
}
@ -919,6 +920,16 @@ char g_display_env[512];
int g_force_depth = -1;
int g_screen_depth = 8;
void banner() {
printf("\x1b[32m _______ _______ _ \x1b[0m \n");
printf("\x1b[32m | ____|| _____| _| |_ \x1b[0m \n");
printf("\x1b[33m | | __ | |_____ |_ _| \x1b[0m \n");
printf("\x1b[31m | | | ||_____ | |_|\x1b[0m \n");
printf("\x1b[35m | |__| | _____| | \x1b[0m \n");
printf("\x1b[34m |_______||_______| \x1b[0m \n\n");
printf("\x1b[37m GSplus v0.12s \x1b[0m \n\n");
}
int
gsplusmain(int argc, char **argv)
@ -929,13 +940,12 @@ gsplusmain(int argc, char **argv)
int i;
char *final_arg = 0;
// just for fun
banner();
// OG Restoring globals
sim65816_initglobals();
moremem_init();
//OG Disabling argument parsing
#ifndef ACTIVEGS
/* parse args */
for(i = 1; i < argc; i++) {
if(!strcmp("-badrd", argv[i])) {
@ -1009,7 +1019,6 @@ gsplusmain(int argc, char **argv)
printf("Setting Verbose = 0x%03x\n", tmp1);
Verbose = tmp1;
i++;
#ifndef __NeXT__
} else if(!strcmp("-display", argv[i])) {
if((i+1) >= argc) {
printf("Missing argument\n");
@ -1019,7 +1028,6 @@ gsplusmain(int argc, char **argv)
sprintf(g_display_env, "DISPLAY=%s", argv[i+1]);
putenv(&g_display_env[0]);
i++;
#endif
} else if(!strcmp("-noshm", argv[i])) {
printf("Not using X shared memory\n");
g_use_shmem = 0;
@ -1076,7 +1084,7 @@ gsplusmain(int argc, char **argv)
}
}
}
#endif
check_engine_asm_defines();
fixed_memory_ptrs_init();
@ -1322,7 +1330,7 @@ setup_gsplus_file(char *outname, int maxlen, int ok_if_missing,
strcpy(outname, &(local_path[0]));
strncat(outname, *cur_name_ptr, 255-strlen(outname));
if(!ok_if_missing) {
printf("Trying '%s'\n", outname);
gloghead(); printf("Trying '%s'\n", outname);
}
ret = stat(outname, &stat_buf);
if(ret == 0) {
@ -1341,7 +1349,7 @@ setup_gsplus_file(char *outname, int maxlen, int ok_if_missing,
/* couldn't find it, print out all the attempts */
path_ptr = save_path_ptr;
fatal_printf("Could not find required file \"%s\" in any of these "
gloghead(); fatal_printf("Could not find required file \"%s\" in any of these "
"directories:\n", *name_ptr);
while(*path_ptr) {
fatal_printf(" %s\n", *path_ptr++);
@ -2714,14 +2722,14 @@ fatal_printf(const char *fmt, ...)
if(g_fatal_log < 0) {
g_fatal_log = 0;
}
ret = gsport_vprintf(fmt, ap);
ret = gsplus_vprintf(fmt, ap);
va_end(ap);
return ret;
}
int
gsport_vprintf(const char *fmt, va_list ap)
gsplus_vprintf(const char *fmt, va_list ap)
{
char *bufptr, *buf2ptr;
int len;

View File

@ -22,6 +22,7 @@
*/
#include "defc.h"
#include "glog.h"
extern int Verbose;
extern int Halt_on;
@ -552,7 +553,7 @@ do_read_c7(int unit_num, word32 buf, int blk)
image_start = iwm.smartport[unit_num].image_start;
image_size = iwm.smartport[unit_num].image_size;
if(!file) {
printf("c7_file is null!\n");
glog("Trying mapped file to $C7xx, but it's null!");
#if 0
if(blk != 2 && blk != 0) {
/* don't print error if only reading directory */
@ -785,7 +786,9 @@ do_c700(word32 ret)
engine.kpc = 0x801;
if(ret != 0) {
printf("Failure reading boot disk in s7d1!\n");
glog("Failure reading boot disk in s7d1!");
glog("- Press <F4> to enter config menu, or edit your config file");
glog("- if you intended to use slot slot 7.");
engine.kpc = 0xff59; /* Jump to monitor, fix $36-$39 */
}
}

View File

@ -266,7 +266,7 @@ sound_init()
void
sound_init_general()
{
printf("SOUND INIT GENERAL\n");
/* Workaround - gcc in cygwin wasn't defining _WIN32 */
#if !defined(WIN_SOUND) && !defined(__CYGWIN__) && !defined(MAC) && !defined(__OS2__) && !defined(HAVE_SDL)
int pid;

View File

@ -23,6 +23,7 @@
#include "defc.h"
#include "sound.h"
#include "glog.h"
#ifdef HPUX
# include <sys/audio.h>
@ -228,7 +229,7 @@ child_sound_playit(word32 tmp)
reliable_buf_write(g_childsnd_shm_addr, g_childsnd_pos, size);
if(g_sound_paused) {
printf("Unpausing sound, zb: %d\n", g_zeroes_buffered);
gloghead(); printf("Unpausing sound, zb: %d\n", g_zeroes_buffered);
g_sound_paused = 0;
}
@ -244,7 +245,7 @@ child_sound_playit(word32 tmp)
reliable_zero_write(size);
if(g_zeroes_seen >= ZERO_PAUSE_NUM_SAMPS) {
printf("Pausing sound\n");
glog("Pausing sound");
g_sound_paused = 1;
}
}