mirror of
https://github.com/Michaelangel007/hgr2rgbntsc.git
synced 2025-01-06 13:30:32 +00:00
Add -tv -half rendering options
This commit is contained in:
parent
7b7a5d2071
commit
0c500ed729
60
src/main.cpp
60
src/main.cpp
@ -106,6 +106,7 @@ MSVC2010 Debug:
|
|||||||
#pragma pack(pop)
|
#pragma pack(pop)
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
|
||||||
|
// Video.h
|
||||||
enum VideoFlag_e
|
enum VideoFlag_e
|
||||||
{
|
{
|
||||||
VF_80COL = 0x00000001,
|
VF_80COL = 0x00000001,
|
||||||
@ -117,12 +118,23 @@ MSVC2010 Debug:
|
|||||||
VF_TEXT = 0x00000040
|
VF_TEXT = 0x00000040
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum VideoType_e
|
||||||
|
{
|
||||||
|
VT_COLOR_TV
|
||||||
|
, VT_COLOR_MONITOR
|
||||||
|
, VT_MONO_TV
|
||||||
|
, VT_MONO_MONITOR
|
||||||
|
, NUM_VIDEO_MODES
|
||||||
|
};
|
||||||
|
|
||||||
// Globals (Private ) _____________________________________________________
|
// Globals (Private ) _____________________________________________________
|
||||||
uint8_t gaMemMain[ _64K ];
|
uint8_t gaMemMain[ _64K ];
|
||||||
uint8_t gaMemAux [ _64K ];
|
uint8_t gaMemAux [ _64K ];
|
||||||
uint32_t gaFrameBuffer[ FRAMEBUFFER_H ][ FRAMEBUFFER_W ];
|
uint32_t gaFrameBuffer[ FRAMEBUFFER_H ][ FRAMEBUFFER_W ];
|
||||||
|
|
||||||
int g_bVideoMode;
|
int g_bVideoMode;
|
||||||
|
VideoType_e g_eVideoType;
|
||||||
|
int g_uHalfScanLines;
|
||||||
|
|
||||||
char BAD_TARGA__HEADER_SIZE_Compiler_Packing_not_18[ sizeof( TargaHeader_t ) == 18 ];
|
char BAD_TARGA__HEADER_SIZE_Compiler_Packing_not_18[ sizeof( TargaHeader_t ) == 18 ];
|
||||||
char BAD_BITMAP_HEADER_SIZE_Compiler_Packing_not_54[ sizeof( WinBmpHeader_t ) == (14 + 40) ];
|
char BAD_BITMAP_HEADER_SIZE_Compiler_Packing_not_54[ sizeof( WinBmpHeader_t ) == (14 + 40) ];
|
||||||
@ -292,7 +304,7 @@ printf( "Dst: '%s'\n", pDstFileName );
|
|||||||
uint8_t *pSrc = (uint8_t*) &gaFrameBuffer[0][0];
|
uint8_t *pSrc = (uint8_t*) &gaFrameBuffer[0][0];
|
||||||
uint8_t *pDst;
|
uint8_t *pDst;
|
||||||
|
|
||||||
if( !g_bScanLines50Percent )
|
if( g_uHalfScanLines )
|
||||||
pSrc += SRC_LINE_BYTES; // start on odd scanline
|
pSrc += SRC_LINE_BYTES; // start on odd scanline
|
||||||
|
|
||||||
for( int y = 0; y < FRAMEBUFFER_H; y++ )
|
for( int y = 0; y < FRAMEBUFFER_H; y++ )
|
||||||
@ -308,7 +320,7 @@ printf( "Dst: '%s'\n", pDstFileName );
|
|||||||
}
|
}
|
||||||
fwrite( (void*)&destLine, DST_LINE_BYTES, 1, pDstFile );
|
fwrite( (void*)&destLine, DST_LINE_BYTES, 1, pDstFile );
|
||||||
|
|
||||||
if( !g_bScanLines50Percent )
|
if( g_uHalfScanLines )
|
||||||
{
|
{
|
||||||
fwrite( (void*)&destLine, DST_LINE_BYTES, 1, pDstFile );
|
fwrite( (void*)&destLine, DST_LINE_BYTES, 1, pDstFile );
|
||||||
y++;
|
y++;
|
||||||
@ -321,10 +333,18 @@ printf( "Dst: '%s'\n", pDstFileName );
|
|||||||
int usage()
|
int usage()
|
||||||
{
|
{
|
||||||
printf(
|
printf(
|
||||||
"hgr2rgb, Version 1 by Michael Pohoreski\n"
|
"hgr2rgb, Version 2 by Michael Pohoreski\n"
|
||||||
"usage: [-bmp | -tga] filename\n"
|
"Convert filename.hgr to filename.hgr.tga (default)\n"
|
||||||
"Convert filename to .tga (default)\n"
|
"\n"
|
||||||
|
"usage: [-bmp | -tga] [-tv] [-half] filename.hgr\n"
|
||||||
|
"\n"
|
||||||
|
" -tga Output to .tga (default)\n"
|
||||||
|
" -bmp Output to .bmp\n"
|
||||||
|
" -tv Use Color TV rendering (default is Color Monitor)\n"
|
||||||
|
" -half Line double (default is single line rendering)\n"
|
||||||
|
"\n"
|
||||||
"Source code and examples can be found at:\n"
|
"Source code and examples can be found at:\n"
|
||||||
|
|
||||||
" https://github.com/Michaelangel007/hgr2rgbntsc\n"
|
" https://github.com/Michaelangel007/hgr2rgbntsc\n"
|
||||||
);
|
);
|
||||||
return 0;
|
return 0;
|
||||||
@ -340,9 +360,12 @@ printf( "Dst: '%s'\n", pDstFileName );
|
|||||||
for (int y = 0; y < 384; y++)
|
for (int y = 0; y < 384; y++)
|
||||||
wsLines[y] = g_pFramebufferbits + 4 * FRAMEBUFFER_W * ((FRAMEBUFFER_H - 1) - y - 18) + 80;
|
wsLines[y] = g_pFramebufferbits + 4 * FRAMEBUFFER_W * ((FRAMEBUFFER_H - 1) - y - 18) + 80;
|
||||||
|
|
||||||
|
g_eVideoType = VT_COLOR_MONITOR; // VT_COLOR_TV
|
||||||
|
g_uHalfScanLines = 0;
|
||||||
|
|
||||||
wsVideoInitModel( 1 ); // Apple //e
|
wsVideoInitModel( 1 ); // Apple //e
|
||||||
wsVideoInit();
|
wsVideoInit();
|
||||||
wsVideoStyle( 1, 2 ); // 1=single pixel, 2=double pixel
|
wsVideoStyle( g_eVideoType, g_uHalfScanLines ); // 1=single scan line, 2=double scan line
|
||||||
|
|
||||||
g_bVideoMode = VF_HIRES;
|
g_bVideoMode = VF_HIRES;
|
||||||
init_videomode();
|
init_videomode();
|
||||||
@ -350,20 +373,31 @@ printf( "Dst: '%s'\n", pDstFileName );
|
|||||||
if( nArg > 1 )
|
if( nArg > 1 )
|
||||||
{
|
{
|
||||||
int iArg = 1;
|
int iArg = 1;
|
||||||
if( strcmp( aArg[1], "-bmp" ) == 0 )
|
for( int i = 1; i < nArg; i++ )
|
||||||
{
|
{
|
||||||
|
if( strcmp( aArg[i], "-bmp" ) == 0 )
|
||||||
g_bOutputBMP = true;
|
g_bOutputBMP = true;
|
||||||
iArg = 2;
|
else
|
||||||
|
if( strcmp( aArg[i], "-tga" ) == 0 )
|
||||||
|
g_bOutputBMP = false;
|
||||||
|
else
|
||||||
|
if( strcmp( aArg[i], "-tv" ) == 0 )
|
||||||
|
{
|
||||||
|
g_eVideoType = VT_COLOR_TV;
|
||||||
|
wsVideoStyle( g_eVideoType, g_uHalfScanLines );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if( strcmp( aArg[1], "-tga" ) == 0 )
|
if( strcmp( aArg[i], "-half" ) == 0 )
|
||||||
{
|
{
|
||||||
g_bOutputBMP = false;
|
g_uHalfScanLines = 1;
|
||||||
iArg = 2;
|
wsVideoStyle( g_eVideoType, g_uHalfScanLines );
|
||||||
}
|
}
|
||||||
if( strcmp( aArg[1], "-?" ) == 0 )
|
else
|
||||||
|
if( strcmp( aArg[i], "-?" ) == 0 )
|
||||||
return usage();
|
return usage();
|
||||||
|
iArg = i;
|
||||||
|
}
|
||||||
|
if (iArg < nArg)
|
||||||
convert( aArg[ iArg ] );
|
convert( aArg[ iArg ] );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user