mirror of
https://github.com/digarok/gsplus.git
synced 2024-11-23 15:30:50 +00:00
attempt more warning cleanup
This commit is contained in:
parent
9337414c17
commit
d5ef2a2a11
1
.gitignore
vendored
1
.gitignore
vendored
@ -13,5 +13,6 @@ src/size_c.h
|
||||
gsplus
|
||||
gsportx
|
||||
gsport
|
||||
*.exe
|
||||
|
||||
*.gsp
|
||||
|
@ -1,21 +1,21 @@
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2010 - 2011 by GSport contributors
|
||||
|
||||
|
||||
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
Extensively rewritten to provide full emulation of the Apple ImageWriter II
|
||||
and LQ printers.
|
||||
|
||||
Information used to write this emulator was provided by
|
||||
Information used to write this emulator was provided by
|
||||
Apple's "ImageWriter II Technical Reference Manual"
|
||||
ISBN# 0-201-17766-8
|
||||
and
|
||||
@ -56,14 +56,14 @@
|
||||
|
||||
//#include "png.h"
|
||||
//#pragma comment( lib, "libpng.lib" )
|
||||
//#pragma comment (lib, "zdll.lib" )
|
||||
//#pragma comment (lib, "zdll.lib" )
|
||||
|
||||
static Imagewriter* defaultImagewriter = NULL;
|
||||
|
||||
static FILE *textPrinterFile = NULL;
|
||||
static FILE *textPrinterFile = NULL;
|
||||
#ifdef WIN32
|
||||
const char* const textPrinterFileName = ".\\printer.txt";
|
||||
#else
|
||||
#else
|
||||
const char* const textPrinterFileName = "./printer.txt";
|
||||
#endif
|
||||
|
||||
@ -129,25 +129,25 @@ Imagewriter::Imagewriter(Bit16u dpi, Bit16u paperSize, Bit16u bannerSize, char*
|
||||
this->dpi = dpi;
|
||||
// Create page
|
||||
page = SDL_CreateRGBSurface(
|
||||
SDL_SWSURFACE,
|
||||
(Bitu)(defaultPageWidth*dpi),
|
||||
(Bitu)(defaultPageHeight*dpi),
|
||||
8,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
SDL_SWSURFACE,
|
||||
(Bitu)(defaultPageWidth*dpi),
|
||||
(Bitu)(defaultPageHeight*dpi),
|
||||
8,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0);
|
||||
|
||||
// Set a grey palette
|
||||
SDL_Palette* palette = page->format->palette;
|
||||
|
||||
|
||||
for (Bitu i=0; i<32; i++)
|
||||
{
|
||||
palette->colors[i].r =255;
|
||||
palette->colors[i].g =255;
|
||||
palette->colors[i].b =255;
|
||||
}
|
||||
|
||||
|
||||
// 0 = all white needed for logic 000
|
||||
FillPalette( 0, 0, 0, 1, palette);
|
||||
// 1 = magenta* 001
|
||||
@ -187,9 +187,9 @@ Imagewriter::Imagewriter(Bit16u dpi, Bit16u paperSize, Bit16u bannerSize, char*
|
||||
// correct resulting color.
|
||||
// i.e. magenta on blank page yyy=001
|
||||
// then yellow on magenta 001 | 100 = 101 = red
|
||||
|
||||
|
||||
color=COLOR_BLACK;
|
||||
|
||||
|
||||
curFont = NULL;
|
||||
charRead = false;
|
||||
autoFeed = false;
|
||||
@ -204,28 +204,28 @@ Imagewriter::Imagewriter(Bit16u dpi, Bit16u paperSize, Bit16u bannerSize, char*
|
||||
|
||||
ShowCursor(1);
|
||||
PRINTDLG pd;
|
||||
pd.lStructSize = sizeof(PRINTDLG);
|
||||
pd.hDevMode = (HANDLE) NULL;
|
||||
pd.hDevNames = (HANDLE) NULL;
|
||||
pd.Flags = PD_RETURNDC | PD_USEDEVMODECOPIESANDCOLLATE;
|
||||
pd.hwndOwner = NULL;
|
||||
pd.hDC = (HDC) NULL;
|
||||
pd.nFromPage = 0xFFFF;
|
||||
pd.lStructSize = sizeof(PRINTDLG);
|
||||
pd.hDevMode = (HANDLE) NULL;
|
||||
pd.hDevNames = (HANDLE) NULL;
|
||||
pd.Flags = PD_RETURNDC | PD_USEDEVMODECOPIESANDCOLLATE;
|
||||
pd.hwndOwner = NULL;
|
||||
pd.hDC = (HDC) NULL;
|
||||
pd.nFromPage = 0xFFFF;
|
||||
pd.nToPage = 0xFFFF;
|
||||
pd.nMinPage = 1;
|
||||
pd.nMaxPage = 0xFFFF;
|
||||
pd.nCopies = 1;
|
||||
pd.hInstance = NULL;
|
||||
pd.lCustData = 0L;
|
||||
pd.lpfnPrintHook = (LPPRINTHOOKPROC) NULL;
|
||||
pd.lpfnSetupHook = (LPSETUPHOOKPROC) NULL;
|
||||
pd.lpPrintTemplateName = (LPCSTR) NULL;
|
||||
pd.lpSetupTemplateName = (LPCSTR) NULL;
|
||||
pd.hPrintTemplate = (HANDLE) NULL;
|
||||
pd.nMinPage = 1;
|
||||
pd.nMaxPage = 0xFFFF;
|
||||
pd.nCopies = 1;
|
||||
pd.hInstance = NULL;
|
||||
pd.lCustData = 0L;
|
||||
pd.lpfnPrintHook = (LPPRINTHOOKPROC) NULL;
|
||||
pd.lpfnSetupHook = (LPSETUPHOOKPROC) NULL;
|
||||
pd.lpPrintTemplateName = (LPCSTR) NULL;
|
||||
pd.lpSetupTemplateName = (LPCSTR) NULL;
|
||||
pd.hPrintTemplate = (HANDLE) NULL;
|
||||
pd.hSetupTemplate = (HANDLE) NULL;
|
||||
if(!PrintDlg(&pd))
|
||||
{
|
||||
//If user presses cancel, warn them with a dialog and switch output to bitmap files
|
||||
//If user presses cancel, warn them with a dialog and switch output to bitmap files
|
||||
this->output = "bmp";
|
||||
MessageBox(NULL,"You did not select a printer.\nAll printer output will be saved as bitmap files.\nTo select a printer, press F4 and select 'Reset Virtual ImageWriter'",NULL,MB_ICONEXCLAMATION);
|
||||
}
|
||||
@ -252,7 +252,7 @@ void Imagewriter::resetPrinterHard()
|
||||
void Imagewriter::resetPrinter()
|
||||
{
|
||||
#ifdef HAVE_SDL
|
||||
printRes = 0;
|
||||
printRes = 0;
|
||||
color=COLOR_BLACK;
|
||||
curX = curY = 0.0;
|
||||
ESCSeen = false;
|
||||
@ -364,11 +364,11 @@ void Imagewriter::updateFont()
|
||||
default:
|
||||
fontName = g_imagewriter_fixed_font;
|
||||
}
|
||||
|
||||
|
||||
if (FT_New_Face(FTlib, fontName, 0, &curFont))
|
||||
{
|
||||
|
||||
printf("Unable to load font %s\n");
|
||||
|
||||
printf("Unable to load font %s\n", fontName);
|
||||
//LOG_MSG("Unable to load font %s", fontName);
|
||||
curFont = NULL;
|
||||
}
|
||||
@ -393,7 +393,7 @@ void Imagewriter::updateFont()
|
||||
actcpi = 20.0;
|
||||
horizPoints *= 10.0/20.0;
|
||||
vertPoints *= 10.0/12.0;
|
||||
}
|
||||
}
|
||||
} else if (style & STYLE_CONDENSED) horizPoints /= 2.0;
|
||||
|
||||
|
||||
@ -413,7 +413,7 @@ void Imagewriter::updateFont()
|
||||
}
|
||||
|
||||
FT_Set_Char_Size(curFont, (Bit16u)horizPoints*64, (Bit16u)vertPoints*64, dpi, dpi);
|
||||
|
||||
|
||||
if (style & STYLE_ITALICS || charTables[curCharTable] == 0)
|
||||
{
|
||||
FT_Matrix matrix;
|
||||
@ -532,8 +532,8 @@ bool Imagewriter::processCommandChar(Bit8u ch)
|
||||
neededParam = 2;
|
||||
break;
|
||||
case 0x4c: // Set left margin at column nnn (ESC L nnn) IW
|
||||
case 0x67: // Print graphics for next nnn * 8 databytes (ESC g nnn) IW
|
||||
case 0x75: // Add one tab stop at nnn (ESC u nnn) IW
|
||||
case 0x67: // Print graphics for next nnn * 8 databytes (ESC g nnn) IW
|
||||
case 0x75: // Add one tab stop at nnn (ESC u nnn) IW
|
||||
neededParam = 3;
|
||||
break;
|
||||
case 0x28: // Set horizontal tabs (ESC ( nnn,) IW
|
||||
@ -563,7 +563,7 @@ bool Imagewriter::processCommandChar(Bit8u ch)
|
||||
default:
|
||||
/*LOG_MSG("PRINTER: Unknown command %c (%02Xh) %c , unable to skip parameters.",
|
||||
(ESCCmd & 0x800)?"FS":"ESC",ESCCmd, ESCCmd);*/
|
||||
|
||||
|
||||
neededParam = 0;
|
||||
ESCCmd = 0;
|
||||
return true;
|
||||
@ -900,7 +900,7 @@ bool Imagewriter::processCommandChar(Bit8u ch)
|
||||
break;
|
||||
}
|
||||
case 0x4b: // Select printing color (ESC K) IW
|
||||
|
||||
|
||||
switch (paramc(0))
|
||||
{
|
||||
case 0: break;
|
||||
@ -912,7 +912,7 @@ bool Imagewriter::processCommandChar(Bit8u ch)
|
||||
case 6: params[0] = 3; break;
|
||||
}
|
||||
if(paramc(0)==0) color = COLOR_BLACK;
|
||||
else color = params[0]<<5;
|
||||
else color = params[0]<<5;
|
||||
break;
|
||||
case 0x3d: // Internal font ID (ESC = n) IW LQ
|
||||
//Ignore for now
|
||||
@ -934,7 +934,7 @@ bool Imagewriter::processCommandChar(Bit8u ch)
|
||||
x = 0;
|
||||
ESCCmd = 0;
|
||||
while (x < PARAM3(0))
|
||||
{
|
||||
{
|
||||
printChar(params[3]);
|
||||
x++;
|
||||
}
|
||||
@ -982,7 +982,7 @@ bool Imagewriter::processCommandChar(Bit8u ch)
|
||||
x = 0;
|
||||
while (x < numHorizTabs)
|
||||
{
|
||||
if (horiztabs[x] == (Real64)PARAM3(0)*(1/(Real64)cpi))
|
||||
if (horiztabs[x] == (Real64)PARAM3(0)*(1/(Real64)cpi))
|
||||
{ printf("Tab Found %d\n",PARAM3(0));
|
||||
horiztabs[x] = 0;
|
||||
}
|
||||
@ -1038,7 +1038,7 @@ bool Imagewriter::processCommandChar(Bit8u ch)
|
||||
while (x < numHorizTabs)
|
||||
{
|
||||
if (horiztabs[x] == (Real64)PARAM3(0)*(1/(Real64)cpi))
|
||||
{
|
||||
{
|
||||
//printf("We have this tab already! at list entry: %d\n", x);
|
||||
haveStop = true;
|
||||
}
|
||||
@ -1190,7 +1190,7 @@ void Imagewriter::newPage(bool save, bool resetx)
|
||||
{
|
||||
//PIC_RemoveEvents(PRINTER_EventHandler);
|
||||
if(printer_timout) timeout_dirty=false;
|
||||
|
||||
|
||||
#ifdef HAVE_SDL
|
||||
if (save)
|
||||
outputPage();
|
||||
@ -1251,11 +1251,11 @@ void Imagewriter::printChar(Bit8u ch)
|
||||
// Do not print if no font is available
|
||||
if (!curFont) return;
|
||||
if(ch==0x1) ch=0x20;
|
||||
|
||||
|
||||
// Find the glyph for the char to render
|
||||
FT_UInt index = FT_Get_Char_Index(curFont, curMap[ch]);
|
||||
|
||||
// Load the glyph
|
||||
|
||||
// Load the glyph
|
||||
FT_Load_Glyph(curFont, index, FT_LOAD_DEFAULT);
|
||||
|
||||
|
||||
@ -1301,7 +1301,7 @@ void Imagewriter::printChar(Bit8u ch)
|
||||
curX += x_advance;
|
||||
|
||||
// Draw lines if desired
|
||||
if ((score != SCORE_NONE) && (style &
|
||||
if ((score != SCORE_NONE) && (style &
|
||||
(STYLE_UNDERLINE)))
|
||||
{
|
||||
// Find out where to put the line
|
||||
@ -1336,7 +1336,7 @@ void Imagewriter::blitGlyph(FT_Bitmap bitmap, Bit16u destx, Bit16u desty, bool a
|
||||
if (source > 0 && (destx+x < page->w) && (desty+y < page->h) ) {
|
||||
Bit8u* target = (Bit8u*)page->pixels + (x+destx) + (y+desty)*page->pitch;
|
||||
source>>=3;
|
||||
|
||||
|
||||
if (add) {
|
||||
if (((*target)&0x1f )+ source > 31) *target |= (color|0x1f);
|
||||
else {
|
||||
@ -1518,7 +1518,7 @@ void Imagewriter::printBitGraph(Bit8u ch)
|
||||
SDL_LockSurface(page);
|
||||
|
||||
// When page dpi is greater than graphics dpi, the drawn pixels get "bigger"
|
||||
Bitu pixsizeX=1;
|
||||
Bitu pixsizeX=1;
|
||||
Bitu pixsizeY=1;
|
||||
if(bitGraph.adjacent) {
|
||||
pixsizeX = dpi/bitGraph.horizDens > 0? dpi/bitGraph.horizDens : 1;
|
||||
@ -1593,10 +1593,10 @@ static void findNextName(char* front, char* ext, char* fname)
|
||||
do
|
||||
{
|
||||
strcpy(fname, document_path);
|
||||
printf(fname);
|
||||
printf("%s",fname);
|
||||
#ifdef WIN32
|
||||
const char* const pathstring = ".\\%s%d%s";
|
||||
#else
|
||||
#else
|
||||
const char* const pathstring = "./%s%d%s";
|
||||
#endif
|
||||
sprintf(fname+strlen(fname), pathstring, front,i++,ext);
|
||||
@ -1607,7 +1607,7 @@ static void findNextName(char* front, char* ext, char* fname)
|
||||
while (test != NULL );
|
||||
}
|
||||
|
||||
void Imagewriter::outputPage()
|
||||
void Imagewriter::outputPage()
|
||||
{/*
|
||||
SDL_Surface *screen;
|
||||
screen = SDL_SetVideoMode(1024, 768, 16, SDL_DOUBLEBUF | SDL_RESIZABLE);
|
||||
@ -1619,20 +1619,20 @@ SDL_LockSurface(page);
|
||||
image = SDL_DisplayFormat(page);
|
||||
SDL_UnlockSurface(page);
|
||||
SDL_Rect src, dest;
|
||||
|
||||
|
||||
src.x = 0;
|
||||
src.y = 0;
|
||||
src.w = image->w;
|
||||
src.h = image->h;
|
||||
|
||||
|
||||
dest.x = 100;
|
||||
dest.y = 100;
|
||||
dest.w = image->w;
|
||||
dest.h = image->h;
|
||||
|
||||
|
||||
SDL_BlitSurface(image, &src, screen, &dest);
|
||||
SDL_Flip(screen);
|
||||
|
||||
|
||||
SDL_Delay(2000);
|
||||
SDL_FreeSurface(image);*/
|
||||
char fname[200];
|
||||
@ -1643,30 +1643,30 @@ SDL_FreeSurface(image);*/
|
||||
{
|
||||
ShowCursor(1);
|
||||
PRINTDLG pd;
|
||||
pd.lStructSize = sizeof(PRINTDLG);
|
||||
pd.hDevMode = (HANDLE) NULL;
|
||||
pd.hDevNames = (HANDLE) NULL;
|
||||
pd.Flags = PD_RETURNDC | PD_USEDEVMODECOPIESANDCOLLATE;
|
||||
pd.hwndOwner = NULL;
|
||||
pd.hDC = (HDC) NULL;
|
||||
pd.nFromPage = 0xFFFF;
|
||||
pd.lStructSize = sizeof(PRINTDLG);
|
||||
pd.hDevMode = (HANDLE) NULL;
|
||||
pd.hDevNames = (HANDLE) NULL;
|
||||
pd.Flags = PD_RETURNDC | PD_USEDEVMODECOPIESANDCOLLATE;
|
||||
pd.hwndOwner = NULL;
|
||||
pd.hDC = (HDC) NULL;
|
||||
pd.nFromPage = 0xFFFF;
|
||||
pd.nToPage = 0xFFFF;
|
||||
pd.nMinPage = 1;
|
||||
pd.nMaxPage = 0xFFFF;
|
||||
pd.nCopies = 1;
|
||||
pd.hInstance = NULL;
|
||||
pd.lCustData = 0L;
|
||||
pd.lpfnPrintHook = (LPPRINTHOOKPROC) NULL;
|
||||
pd.lpfnSetupHook = (LPSETUPHOOKPROC) NULL;
|
||||
pd.lpPrintTemplateName = (LPCSTR) NULL;
|
||||
pd.lpSetupTemplateName = (LPCSTR) NULL;
|
||||
pd.hPrintTemplate = (HANDLE) NULL;
|
||||
pd.hSetupTemplate = (HANDLE) NULL;
|
||||
pd.nMinPage = 1;
|
||||
pd.nMaxPage = 0xFFFF;
|
||||
pd.nCopies = 1;
|
||||
pd.hInstance = NULL;
|
||||
pd.lCustData = 0L;
|
||||
pd.lpfnPrintHook = (LPPRINTHOOKPROC) NULL;
|
||||
pd.lpfnSetupHook = (LPSETUPHOOKPROC) NULL;
|
||||
pd.lpPrintTemplateName = (LPCSTR) NULL;
|
||||
pd.lpSetupTemplateName = (LPCSTR) NULL;
|
||||
pd.hPrintTemplate = (HANDLE) NULL;
|
||||
pd.hSetupTemplate = (HANDLE) NULL;
|
||||
if(!PrintDlg(&pd))
|
||||
{
|
||||
//If user clicks cancel, show warning dialog and force all output to bitmaps as failsafe.
|
||||
MessageBox(NULL,"You did not select a printer.\nAll output from this print job will be saved as bitmap files.",NULL,MB_ICONEXCLAMATION);
|
||||
findNextName("page", ".bmp", &fname[0]);
|
||||
findNextName((char *)"page", (char *)".bmp", &fname[0]);
|
||||
SDL_SaveBMP(page, fname); //Save first page as bitmap.
|
||||
outputHandle = printerDC;
|
||||
printerDC = NULL;
|
||||
@ -1682,7 +1682,7 @@ SDL_FreeSurface(image);*/
|
||||
}
|
||||
if (!printerDC) //Fall thru for subsequent pages if printer dialog was cancelled.
|
||||
{
|
||||
findNextName("page", ".bmp", &fname[0]);
|
||||
findNextName((char *)"page", (char *)".bmp", &fname[0]);
|
||||
SDL_SaveBMP(page, fname); //Save remaining pages.
|
||||
return;
|
||||
}
|
||||
@ -1781,8 +1781,8 @@ SDL_FreeSurface(image);*/
|
||||
else if (strcasecmp(output, "png") == 0)
|
||||
{
|
||||
// Find a page that does not exists
|
||||
findNextName("page", ".png", &fname[0]);
|
||||
|
||||
findNextName((char *)"page", (char *)".png", &fname[0]);
|
||||
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr;
|
||||
png_bytep * row_pointers;
|
||||
@ -1791,7 +1791,7 @@ SDL_FreeSurface(image);*/
|
||||
|
||||
/* Open the actual file */
|
||||
FILE * fp=fopen(fname,"wb");
|
||||
if (!fp)
|
||||
if (!fp)
|
||||
{
|
||||
//LOG(LOG_MISC,LOG_ERROR)("PRINTER: Can't open file %s for printer output", fname);
|
||||
return;
|
||||
@ -1809,7 +1809,7 @@ SDL_FreeSurface(image);*/
|
||||
/* Finalize the initing of png library */
|
||||
png_init_io(png_ptr, fp);
|
||||
png_set_compression_level(png_ptr,Z_BEST_COMPRESSION);
|
||||
|
||||
|
||||
/* set other zlib parameters */
|
||||
png_set_compression_mem_level(png_ptr, 8);
|
||||
png_set_compression_strategy(png_ptr,Z_DEFAULT_STRATEGY);
|
||||
@ -1817,11 +1817,11 @@ SDL_FreeSurface(image);*/
|
||||
png_set_compression_method(png_ptr, 8);
|
||||
png_set_compression_buffer_size(png_ptr, 8192);
|
||||
|
||||
|
||||
|
||||
png_set_IHDR(png_ptr, info_ptr, page->w, page->h,
|
||||
8, PNG_COLOR_TYPE_PALETTE, PNG_INTERLACE_NONE,
|
||||
PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT);
|
||||
for (i=0;i<256;i++)
|
||||
for (i=0;i<256;i++)
|
||||
{
|
||||
palette[i].red = page->format->palette->colors[i].r;
|
||||
palette[i].green = page->format->palette->colors[i].g;
|
||||
@ -1833,12 +1833,12 @@ SDL_FreeSurface(image);*/
|
||||
|
||||
// Allocate an array of scanline pointers
|
||||
row_pointers = (png_bytep*)malloc(page->h*sizeof(png_bytep));
|
||||
for (i=0; i<page->h; i++)
|
||||
for (i=0; i<page->h; i++)
|
||||
row_pointers[i] = ((Bit8u*)page->pixels+(i*page->pitch));
|
||||
|
||||
|
||||
// tell the png library what to encode.
|
||||
png_set_rows(png_ptr, info_ptr, row_pointers);
|
||||
|
||||
|
||||
// Write image to file
|
||||
png_write_png(png_ptr, info_ptr, 0, NULL);
|
||||
|
||||
@ -1846,13 +1846,13 @@ SDL_FreeSurface(image);*/
|
||||
|
||||
|
||||
SDL_UnlockSurface(page);
|
||||
|
||||
|
||||
/*close file*/
|
||||
fclose(fp);
|
||||
|
||||
|
||||
/*Destroy PNG structs*/
|
||||
png_destroy_write_struct(&png_ptr, &info_ptr);
|
||||
|
||||
|
||||
/*clean up dynamically allocated RAM.*/
|
||||
free(row_pointers);
|
||||
}
|
||||
@ -1860,7 +1860,7 @@ SDL_FreeSurface(image);*/
|
||||
else if (strcasecmp(output, "colorps") == 0)
|
||||
{
|
||||
FILE* psfile = NULL;
|
||||
|
||||
|
||||
// Continue postscript file?
|
||||
if (outputHandle != NULL)
|
||||
psfile = (FILE*)outputHandle;
|
||||
@ -1869,12 +1869,12 @@ SDL_FreeSurface(image);*/
|
||||
if (psfile == NULL)
|
||||
{
|
||||
if (!multipageOutput)
|
||||
findNextName("page", ".ps", &fname[0]);
|
||||
findNextName((char *)"page", (char *)".ps", &fname[0]);
|
||||
else
|
||||
findNextName("doc", ".ps", &fname[0]);
|
||||
findNextName((char *)"doc", (char *)".ps", &fname[0]);
|
||||
|
||||
psfile = fopen(fname, "wb");
|
||||
if (!psfile)
|
||||
if (!psfile)
|
||||
{
|
||||
//LOG(LOG_MISC,LOG_ERROR)("PRINTER: Can't open file %s for printer output", fname);
|
||||
return;
|
||||
@ -1945,7 +1945,7 @@ SDL_FreeSurface(image);*/
|
||||
{
|
||||
// Find end of heterogenous area
|
||||
Bit8u diffCount = 1;
|
||||
while (diffCount < 128 && diffCount+pix < numpix &&
|
||||
while (diffCount < 128 && diffCount+pix < numpix &&
|
||||
(
|
||||
(diffCount+pix < numpix-2)
|
||||
|| (templine[pix+diffCount] != templine[pix+diffCount+1])
|
||||
@ -1985,7 +1985,7 @@ SDL_FreeSurface(image);*/
|
||||
{
|
||||
FILE* psfile = NULL;
|
||||
printf("%d\n",getPixel(2));
|
||||
|
||||
|
||||
// Continue postscript file?
|
||||
if (outputHandle != NULL)
|
||||
psfile = (FILE*)outputHandle;
|
||||
@ -1994,12 +1994,12 @@ SDL_FreeSurface(image);*/
|
||||
if (psfile == NULL)
|
||||
{
|
||||
if (!multipageOutput)
|
||||
findNextName("page", ".ps", &fname[0]);
|
||||
findNextName((char *)"page", (char *)".ps", &fname[0]);
|
||||
else
|
||||
findNextName("doc", ".ps", &fname[0]);
|
||||
findNextName((char *)"doc", (char *)".ps", &fname[0]);
|
||||
|
||||
psfile = fopen(fname, "wb");
|
||||
if (!psfile)
|
||||
if (!psfile)
|
||||
{
|
||||
//LOG(LOG_MISC,LOG_ERROR)("PRINTER: Can't open file %s for printer output", fname);
|
||||
return;
|
||||
@ -2052,7 +2052,7 @@ SDL_FreeSurface(image);*/
|
||||
{
|
||||
// Find end of heterogenous area
|
||||
Bit8u diffCount = 1;
|
||||
while (diffCount < 128 && diffCount+pix < numpix &&
|
||||
while (diffCount < 128 && diffCount+pix < numpix &&
|
||||
(
|
||||
(diffCount+pix < numpix-2)
|
||||
|| (getPixel(pix+diffCount) != getPixel(pix+diffCount+1))
|
||||
@ -2088,9 +2088,9 @@ SDL_FreeSurface(image);*/
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
// Find a page that does not exists
|
||||
findNextName("page", ".bmp", &fname[0]);
|
||||
findNextName((char *)"page", (char *)".bmp", &fname[0]);
|
||||
SDL_SaveBMP(page, fname);
|
||||
}
|
||||
}
|
||||
@ -2129,7 +2129,7 @@ void Imagewriter::fprintASCII85(FILE* f, Bit16u b)
|
||||
// Make sure a line never starts with a % (which may be mistaken as start of a comment)
|
||||
if (ASCII85CurCol == 0 && buffer[0] == '%')
|
||||
fprintf(f, " ");
|
||||
|
||||
|
||||
for (int i=0; i<((b != 257)?5:ASCII85BufferPos+1); i++)
|
||||
{
|
||||
fprintf(f, "%c", buffer[i]);
|
||||
@ -2231,9 +2231,8 @@ Bit8u Imagewriter::getPixel(Bit32u num) {
|
||||
}
|
||||
#endif // HAVE_SDL
|
||||
|
||||
|
||||
//Interfaces to C code
|
||||
|
||||
|
||||
extern "C" void imagewriter_init(int pdpi, int ppaper, int banner, char* poutput, bool mpage)
|
||||
{
|
||||
if (defaultImagewriter != NULL) return; //if Imagewriter on this port is initialized, reuse it
|
||||
|
@ -1,23 +1,23 @@
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2010 - 2011 by GSport contributors
|
||||
|
||||
|
||||
Copyright (C) 2010 by GSport contributors
|
||||
|
||||
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
@ -44,7 +44,7 @@
|
||||
Extensively rewritten to provide full emulation of the Apple ImageWriter II
|
||||
printer.
|
||||
|
||||
Information used to write this emulator was provided by
|
||||
Information used to write this emulator was provided by
|
||||
Apple's "ImageWriter II Technical Reference Manual"
|
||||
ISBN# 0-201-17766-8
|
||||
|
||||
@ -134,7 +134,7 @@ public:
|
||||
// Hard Reset (like switching printer off and on)
|
||||
void resetPrinterHard();
|
||||
|
||||
// Set Autofeed value
|
||||
// Set Autofeed value
|
||||
void setAutofeed(bool feed);
|
||||
|
||||
// Get Autofeed value
|
||||
@ -143,7 +143,7 @@ public:
|
||||
// True if printer is unable to process more data right now (do not use printChar)
|
||||
bool isBusy();
|
||||
|
||||
// True if the last sent character was received
|
||||
// True if the last sent character was received
|
||||
bool ack();
|
||||
|
||||
// Manual formfeed
|
||||
@ -165,7 +165,7 @@ private:
|
||||
// Closes a multipage document
|
||||
void finishMultipage();
|
||||
|
||||
// Output current page
|
||||
// Output current page
|
||||
void outputPage();
|
||||
|
||||
#ifdef HAVE_SDL
|
||||
@ -182,7 +182,7 @@ private:
|
||||
|
||||
// Reconfigures printer parameters after changing soft-switches with ESC Z and ESC D
|
||||
void updateSwitch();
|
||||
|
||||
|
||||
// Overprints a slash over zero if softswitch B-1 is set
|
||||
void slashzero(Bit16u penX, Bit16u penY);
|
||||
|
||||
@ -300,7 +300,7 @@ private:
|
||||
|
||||
//Interfaces to C code
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
extern "C"
|
||||
{
|
||||
#else
|
||||
#include <stdbool.h>
|
||||
|
@ -1651,7 +1651,7 @@ static void findNextName(char* front, char* ext, char* fname)
|
||||
do
|
||||
{
|
||||
strcpy(fname, document_path);
|
||||
printf(fname);
|
||||
printf("%s",fname);
|
||||
#ifdef WIN32
|
||||
const char* const pathstring = ".\\%s%d%s";
|
||||
#else
|
||||
@ -1887,9 +1887,9 @@ SDL_FreeSurface(image);*/
|
||||
if (psfile == NULL)
|
||||
{
|
||||
if (!multipageOutput)
|
||||
findNextName("page", ".ps", &fname[0]);
|
||||
findNextName((char *)"page", (char *)".ps", &fname[0]);
|
||||
else
|
||||
findNextName("doc", ".ps", &fname[0]);
|
||||
findNextName((char *)"doc", (char *)".ps", &fname[0]);
|
||||
|
||||
psfile = fopen(fname, "wb");
|
||||
if (!psfile)
|
||||
@ -1983,7 +1983,7 @@ SDL_FreeSurface(image);*/
|
||||
else
|
||||
{
|
||||
// Find a page that does not exists
|
||||
findNextName("page", ".bmp", &fname[0]);
|
||||
findNextName((char *)"page", (char *)".bmp", &fname[0]);
|
||||
SDL_SaveBMP(page, fname);
|
||||
}
|
||||
}
|
||||
|
@ -1,23 +1,23 @@
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
|
||||
Copyright (C) 2010 - 2012 by GSport contributors
|
||||
|
||||
|
||||
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
This program is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
||||
for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
@ -225,7 +225,7 @@ scc_socket_open_outgoing(int port, double dcycs)
|
||||
/* ARO: inspect the ATDT command to see if there is a decimal port number declared & if so, use it */
|
||||
/* Format: ATDT<host>,<port> */
|
||||
/* Example ATDT192.168.1.21,4001 */
|
||||
char *comma_ptr = strchr(&scc_ptr->modem_cmd_str[0], ',');
|
||||
char *comma_ptr = strchr((const char *)&scc_ptr->modem_cmd_str[0], ',');
|
||||
if (comma_ptr != NULL) {
|
||||
long custom_port = strtol(comma_ptr + 1, NULL, 10);
|
||||
*comma_ptr = '\0'; /* null terminate the hostname string at the position of the comma */
|
||||
@ -446,7 +446,7 @@ scc_socket_telnet_reqs(int port, double dcycs)
|
||||
int i, j;
|
||||
|
||||
scc_ptr = &(scc_stat[port]);
|
||||
|
||||
|
||||
for(i = 0; i < 64; i++) {
|
||||
j = i >> 5;
|
||||
mask = 1 << (i & 31);
|
||||
@ -1004,7 +1004,7 @@ scc_socket_do_cmd_str(int port, double dcycs)
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
scc_ptr->modem_dial_or_acc_mode = 1;
|
||||
scc_socket_open_outgoing(port, dcycs);
|
||||
|
19
src/sound.c
19
src/sound.c
@ -1,7 +1,7 @@
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
|
||||
Copyright (C) 2010 - 2012 by GSport contributors
|
||||
|
||||
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
|
||||
@ -46,6 +46,7 @@ int g_doc_saved_ctl = 0;
|
||||
int g_queued_samps = 0;
|
||||
int g_queued_nonsamps = 0;
|
||||
int g_num_osc_interrupting = 0;
|
||||
int g_sound_play_depth = 0;
|
||||
|
||||
/* Workaround - gcc in cygwin wasn't defining _WIN32, substituted WIN_SOUND instead */
|
||||
#if defined(HPUX) || defined(__linux__) || defined(WIN_SOUND) || defined(MAC) || defined(HAVE_SDL)
|
||||
@ -639,7 +640,6 @@ send_sound(int real_samps, int size)
|
||||
{
|
||||
// real_samps = 1, size = 1602
|
||||
word32 tmp;
|
||||
int ret;
|
||||
|
||||
if(g_audio_enable == 0) {
|
||||
printf("Entered send_sound but audio off!\n");
|
||||
@ -657,16 +657,15 @@ send_sound(int real_samps, int size)
|
||||
(real_samps << 30) + size);
|
||||
// Workaround - gcc in cygwin wasn't defining _WIN32
|
||||
#if defined(WIN_SOUND) || defined(MAC) && !defined(HAVE_SDL)
|
||||
ret = 0;
|
||||
child_sound_playit(tmp);
|
||||
#elif defined(HAVE_SDL)
|
||||
sound_write_sdl( real_samps, size);
|
||||
//sdl_send_audio(&g_sound_shm_addr[g_sound_shm_pos], size, real_samps);
|
||||
#elif defined(__OS2__)
|
||||
|
||||
#else
|
||||
/* Although this looks like a big/little-endian issue, since the */
|
||||
/* child is also reading an int, it just works with no byte swap */
|
||||
int ret = 0;
|
||||
ret = write(g_pipe_fd[1], &tmp, 4);
|
||||
if(ret != 4) {
|
||||
halt_printf("send_sound, wr ret: %d, errno: %d\n", ret, errno);
|
||||
@ -674,14 +673,12 @@ send_sound(int real_samps, int size)
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
show_c030_state()
|
||||
void show_c030_state()
|
||||
{
|
||||
show_c030_samps(&(g_samp_buf[0]), 100);
|
||||
}
|
||||
|
||||
void
|
||||
show_c030_samps(int *outptr, int num)
|
||||
void show_c030_samps(int *outptr, int num)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -699,10 +696,7 @@ show_c030_samps(int *outptr, int num)
|
||||
}
|
||||
}
|
||||
|
||||
int g_sound_play_depth = 0;
|
||||
|
||||
void
|
||||
sound_play(double dsamps)
|
||||
void sound_play(double dsamps)
|
||||
{
|
||||
register word32 start_time1, start_time2, start_time3, start_time4;
|
||||
register word32 end_time1, end_time2, end_time3;
|
||||
@ -1191,7 +1185,6 @@ doc_sound_end(int osc, int can_repeat, double eff_dsamps, double dsamps)
|
||||
Doc_reg *rptr, *orptr;
|
||||
int mode, omode;
|
||||
int other_osc;
|
||||
int one_shot_stop;
|
||||
int ctl;
|
||||
|
||||
/* handle osc stopping and maybe interrupting */
|
||||
|
@ -61,7 +61,9 @@ void win32snd_shutdown();
|
||||
void child_sound_init_win32();
|
||||
int win32_send_audio(byte *ptr, int size);
|
||||
|
||||
/* prototypes for sdl(2)snd_driver.c functions */
|
||||
void sound_shutdown_sdl();
|
||||
void sdlsnd_init(word32 *shmaddr);
|
||||
|
||||
|
||||
/* Prototypes for macsnd_driver.c functions */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
GSPLUS - Advanced Apple IIGS Emulator Environment
|
||||
Copyright (C) 2016 - Dagen Brock
|
||||
|
||||
|
||||
Copyright (C) 2010 - 2012 by GSport contributors
|
||||
|
||||
Based on the KEGS emulator written by and Copyright (C) 2003 Kent Dickey
|
||||
@ -78,7 +78,7 @@ void
|
||||
reliable_buf_write(word32 *shm_addr, int pos, int size)
|
||||
{
|
||||
byte *ptr;
|
||||
int ret;
|
||||
int ret = 0;
|
||||
|
||||
if(size < 1 || pos < 0 || pos > SOUND_SHM_SAMP_SIZE ||
|
||||
size > SOUND_SHM_SAMP_SIZE ||
|
||||
@ -144,7 +144,7 @@ child_sound_loop(int read_fd, int write_fd, word32 *shm_addr)
|
||||
|
||||
#if defined(HAVE_SDL)
|
||||
//child_sound_init_sdl();
|
||||
long rate = sound_init_device_sdl();
|
||||
sound_init_device_sdl(); // ignores long return value of sample rate
|
||||
return;
|
||||
#elif defined(__linux__) || defined(OSS)
|
||||
child_sound_init_linux();
|
||||
|
Loading…
Reference in New Issue
Block a user