home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ST-Computer Leser 2002 January
/
STC_CD_01_2002.iso
/
JAGUAR
/
JAG_SRC
/
SOURCE
/
MAIN.C
< prev
next >
Wrap
C/C++ Source or Header
|
2001-08-17
|
6KB
|
135 lines
////////////////////////////////////////////////////////////////////////////////
// Jagulator: Atari Jaguar Console Emulation Project (main.c)
// -----------------------------------------------------------------------------
// Jagulator is the Copyright (c) RealityMan 1998-2001 and is provided "as is"
// without any expressed or implied warranty. I have no Trademarks, Legal or
// otherwise. Atari, Jaguar and the Atari Logo are copyright Hasbro Inc. All
// other Copyrights and Trademarks are acknowledged. This project is in no way
// linked to Atari/Hasbro or other associated Atari companies.
//
// 07-07-2001 GH: New Source, Rewritten for Release 1.5.0
// 00-00-0000 GH: All Previous Source Considered as Development Code Only
#include "core.h"
////////////////////////////////////////////////////////////////////////////////
// Globals
static HANDLE emuthreadhandle; // Main Emulation Thread Handle
CFGDATA cfg; // Configuration Data
STATE st; // Main Emulator State
////////////////////////////////////////////////////////////////////////////////
// Appends '\' to Path if it Doesn't Contain One
void FixPath( char *path, int striplastname )
{
char *p; // String Pointer
if( !*path ) return; // Return if No Path Passed
if( striplastname ) // Strip Executable Name from Path
{
p = path + strlen(path); // Set String Pointer
while( p > path + 1 && *p != ':' && *p != '\\' ) p--;
}
else
p = path + strlen(path) - 1; // Set Pointer to End of Path
if( p[0] != '\\' ) *++p = '\\'; // Append '\\' if Not at End
p[1] = 0; // Null Terminate String
}
////////////////////////////////////////////////////////////////////////////////
// Load Configuration Data
void LoadConfig( void )
{
static char buf[MAX_PATH]; // Temporary Buffer
// Retrieve Path and Filename of Executable and
// Append '\' to Path if it Doesn't Have One
GetModuleFileName( NULL, cfg.rootpath, sizeof(cfg.rootpath) );
FixPath( cfg.rootpath, 1 );
// Setup Path/Filename to Configuration File
strcpy( buf, cfg.rootpath );
strcat( buf, "jagulator.ini" );
// Load [Default] Settings from Configuration File
GetPrivateProfileString( "default", "rompath", ".",
cfg.rompath, sizeof(cfg.rompath), buf );
FixPath( cfg.rompath, 0 );
GetPrivateProfileString( "default", "bootpath", ".",
cfg.bootpath, sizeof(cfg.bootpath), buf );
FixPath( cfg.bootpath, 0 );
// Load [Audio] Settings from Configuration File
cfg.sound = GetPrivateProfileInt( "audio", "sound", 1, buf );
// Load [Video] Settings from Configuration File
cfg.graphics = GetPrivateProfileInt( "video", "graphics", 1, buf );
cfg.hres = GetPrivateProfileInt( "video", "hres", 512, buf );
cfg.vres = GetPrivateProfileInt( "video", "vres", 384, buf );
cfg.fullscreen = GetPrivateProfileInt( "video", "fullscreen", 0, buf );
cfg.frameskip = GetPrivateProfileInt( "video", "frameskip", 0, buf );
}
////////////////////////////////////////////////////////////////////////////////
// Display Copyright Information
void printcopyright( void )
{
print( WHITE"--------------------------------------------------------" );
print( "------------------------\n" );
print( WHITE"%s v%i.%i.%i - %s (%s)",
APPNAME, MAJORREV, MINORREV, PATCHLVL, TITLE, PLATFORM );
print( "\n\x1\xf"COPYRIGHT );
print( "\n\n" );
print( GRAY"Atari, Jaguar and the Atari Logo are the copyright of " );
print( "Hasbro Inc.\n" );
print( GRAY"All other copyrights and Trademarks are " );
print( "acknowledged. This project \n" );
print( GRAY"is in no way " );
print( "linked to Atari/Hasbro. This software is provided \"as is\" \n");
print( GRAY"without any expressed or implied warranty.\n\n" );
print( GRAY"Starscream v0.26a 680x0 emulation library by Neill Corlett\n" );
print( GRAY"(corlett@elwha.nrrc.ncsu.edu)\n" );
print( WHITE"---------------------------------------------------------" );
print( "-----------------------\n\n" );
}
////////////////////////////////////////////////////////////////////////////////
// Main Emulation Thread - Started Before Main Win32 GUI is Activated
void main_thread( void )
{
LoadConfig(); // Load INI Settings
// Get Thread Handle of this Thread
emuthreadhandle = GetCurrentThread();
// Open Debug Console
view_open();
view_changed( VIEW_RESIZE );
flushdisplay();
Sleep(100); // Give Time for UI to Redraw Fully
printcopyright();
#ifndef RELEASE
print( "Root Path - %s\n", cfg.rootpath );
print( "Boot Path - %s\n", cfg.bootpath );
print( "Rom Path - %s\n", cfg.rompath );
// Display Help Text
print( "\n\x1\x3""Type 'help' for help or press F5 to start.\n\n" );
#endif
debugui(); // Main Debug User Interface Loop
view_close(); // Close Debug Console
}