Path: chuka.playstation.co.uk!news From: "Steve Dunn" Newsgroups: scee.yaroze.freetalk.english Subject: Re: Tool Support (was Re: New Yaroze Dev FAQ) Date: Wed, 1 Jul 1998 14:56:40 +0100 Organization: Backroom Software Ltd. Lines: 105 Message-ID: <6ndffb$sub13@chuka.playstation.co.uk> References: <6n71c1$4at1@scea> <359e0a8a.18159271@news.playstation.co.uk> <3598D331.C33C9DC2@easynet.co.uk> <3599db5a.22105475@news.reichardt.ch> <35990BCB.576C9429@easynet.co.uk> <3599158b.2586248@news.playstation.co.uk> <35996C8A.E080D423@easynet.co.uk> <3599d64e.1739921@news.reichardt.ch> <6ncqhp$sub11@chuka.playstation.co.uk> <359A203A.58123CAB@easynet.co.uk> <6nd8l5$sub12@chuka.playstation.co.uk> <359A3F13.5AD1DE2D@easynet.co.uk> NNTP-Posting-Host: userk480.uk.uudial.com X-Newsreader: Microsoft Outlook Express 4.72.2106.4 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.2106.4 #include #include #include void usage( ) ; char* pFilename ; void main(int argc, char* argv[]) { FILE* fpIn = NULL ; char* pMem = NULL ; if(argc < 2 ) usage(); pFilename = argv[1]; int nWidth = argv[2] ? atoi(argv[2]) : 10 ; if(!(fpIn = fopen(pFilename,"rb"))) { printf("Cannot open input file!\n"); exit(1); } fseek( fpIn, 0, SEEK_END ) ; long lSize = ftell( fpIn ) ; fseek( fpIn, 0, SEEK_SET ) ; pMem = (char*)malloc( lSize ) ; if ( (long)fread( pMem, sizeof(char), lSize, fpIn ) != lSize ) { printf("file error !\n" ) ; exit( 1 ) ; } printf("unsigned char data[] = {" ) ; for ( long l = 0 ; l < lSize ; l++ ) { if ( l % nWidth == 0) printf("\n" ) ; printf("0x%02x", *(unsigned char*)(pMem+l) ) ; if ( l != lSize-1 ) printf("," ) ; printf(" " ) ; } printf("\n};\n") ; fclose( fpIn ) ; } void usage(void) { printf( "bin2hex by Steve Dunn\n"); printf( "Converts binary files to hex text\n" "for inclusion in source files.\n\n"); printf( "USAGE: bin2hex file [width=10] [>> outfile]\n\n" ) ; exit(1); } Philip Gooch wrote in message <359A3F13.5AD1DE2D@easynet.co.uk>... > > >Steve Dunn wrote: > >> > >> >On a related note, if I produce a game that makes use of MWDebugIO.lib, and >> I >> >want to enter it for Sony's monthly cover CD competition, what can I do? >> Would I >> >need to use the _DEBUG_IO switch to activate the standard OS open(), read() >> etc >> >functions for the CD version? >> > >> Bearing in mind SIOCONS can load CW exes, I'd suggest just before releasing >> your code, to incorporate all files that need loading as static data in your >> source. Theres a tool 'bin2hex' that will do this. Of course, if your >> files exceed the amount of memory, you're stuffed. >> bin2hex is available at http://www.netyaroze-europe.com/~steved To run it, >> just give it a name of a file, like alien.tim and stream the output to a >> filename of your choice, then simply include that filename in your build. >> You can stream any amount of data into one source file. > >Steve - ignore my previous post. This works like a charm. Would you be willing >to release the source code so that I can produce a Mac version (I assume it's >written in standard C?) > >Phil >