(svn r14636) -Add: DOS port of OpenTTD, without network support though.
This commit is contained in:
@@ -773,6 +773,10 @@ void ChangeWorkingDirectory(const char *exe)
|
||||
char *s = strrchr(exe, PATHSEPCHAR);
|
||||
if (s != NULL) {
|
||||
*s = '\0';
|
||||
#if defined(__DJGPP__)
|
||||
/* If we want to go to the root, we can't use cd C:, but we must use '/' */
|
||||
if (s[-1] == ':') chdir("/");
|
||||
#endif
|
||||
if (chdir(exe) != 0) DEBUG(misc, 0, "Directory with the binary does not exist?");
|
||||
*s = PATHSEPCHAR;
|
||||
}
|
||||
@@ -788,7 +792,7 @@ void ChangeWorkingDirectory(const char *exe)
|
||||
void DetermineBasePaths(const char *exe)
|
||||
{
|
||||
char tmp[MAX_PATH];
|
||||
#if defined(__MORPHOS__) || defined(__AMIGA__) || !defined(WITH_PERSONAL_DIR)
|
||||
#if defined(__MORPHOS__) || defined(__AMIGA__) || defined(DOS) || !defined(WITH_PERSONAL_DIR)
|
||||
_searchpaths[SP_PERSONAL_DIR] = NULL;
|
||||
#else
|
||||
const char *homedir = getenv("HOME");
|
||||
@@ -826,7 +830,7 @@ void DetermineBasePaths(const char *exe)
|
||||
AppendPathSeparator(tmp, MAX_PATH);
|
||||
_searchpaths[SP_BINARY_DIR] = strdup(tmp);
|
||||
|
||||
#if defined(__MORPHOS__) || defined(__AMIGA__)
|
||||
#if defined(__MORPHOS__) || defined(__AMIGA__) || defined(DOS)
|
||||
_searchpaths[SP_INSTALLATION_DIR] = NULL;
|
||||
#else
|
||||
snprintf(tmp, MAX_PATH, "%s", GLOBAL_DATA_DIR);
|
||||
|
@@ -161,6 +161,8 @@ void AskExitGame()
|
||||
SetDParam(0, STR_OSNAME_OS2);
|
||||
#elif defined(SUNOS)
|
||||
SetDParam(0, STR_OSNAME_SUNOS);
|
||||
#elif defined(DOS)
|
||||
SetDParam(0, STR_OSNAME_DOS);
|
||||
#else
|
||||
SetDParam(0, STR_OSNAME_UNIX);
|
||||
#endif
|
||||
|
@@ -277,6 +277,7 @@ STR_0131_TOO_MANY_NAMES_DEFINED :{WHITE}Too many
|
||||
STR_0132_CHOSEN_NAME_IN_USE_ALREADY :{WHITE}Chosen name already in use
|
||||
|
||||
STR_OSNAME_WINDOWS :Windows
|
||||
STR_OSNAME_DOS :DOS
|
||||
STR_OSNAME_UNIX :Unix
|
||||
STR_OSNAME_OSX :OS X
|
||||
STR_OSNAME_BEOS :BeOS
|
||||
|
@@ -35,7 +35,7 @@ unsigned __int64 ottd_rdtsc();
|
||||
#endif
|
||||
|
||||
/* rdtsc for all other *nix-en (hopefully). Use GCC syntax */
|
||||
#if defined(__i386__) || defined(__x86_64__) && !defined(RDTSC_AVAILABLE)
|
||||
#if (defined(__i386__) || defined(__x86_64__)) && !defined(__DJGPP__) && !defined(RDTSC_AVAILABLE)
|
||||
uint64 ottd_rdtsc()
|
||||
{
|
||||
uint32 high, low;
|
||||
|
@@ -353,7 +353,7 @@ void NORETURN CDECL usererror(const char *str, ...);
|
||||
void NORETURN CDECL error(const char *str, ...);
|
||||
#define NOT_REACHED() error("NOT_REACHED triggered at line %i of %s", __LINE__, __FILE__)
|
||||
|
||||
#if defined(MORPHOS) || defined(__NDS__)
|
||||
#if defined(MORPHOS) || defined(__NDS__) || defined(__DJGPP__)
|
||||
/* MorphOS and NDS don't have C++ conformant _stricmp... */
|
||||
#define _stricmp stricmp
|
||||
#elif defined(OPENBSD)
|
||||
@@ -361,7 +361,7 @@ void NORETURN CDECL error(const char *str, ...);
|
||||
#define _stricmp strcasecmp
|
||||
#endif
|
||||
|
||||
#if !defined(MORPHOS) && !defined(OPENBSD) && !defined(__NDS__)
|
||||
#if !defined(MORPHOS) && !defined(OPENBSD) && !defined(__NDS__) && !defined(__DJGPP__)
|
||||
/* NDS, MorphOS & OpenBSD don't know wchars, the rest does :( */
|
||||
#define HAS_WCHAR
|
||||
#endif /* !defined(MORPHOS) && !defined(OPENBSD) && !defined(__NDS__) */
|
||||
|
@@ -179,13 +179,19 @@ static bool CreateMainSurface(int w, int h)
|
||||
if (bpp == 0) usererror("Can't use a blitter that blits 0 bpp for normal visuals");
|
||||
set_color_depth(bpp);
|
||||
|
||||
#if defined(DOS)
|
||||
/* Force DOS builds to ALWAYS use full screen as
|
||||
* it can't do windowed. */
|
||||
_fullscreen = true;
|
||||
#endif
|
||||
|
||||
GetVideoModes();
|
||||
GetAvailableVideoMode(&w, &h);
|
||||
if (set_gfx_mode(_fullscreen ? GFX_AUTODETECT_FULLSCREEN : GFX_AUTODETECT_WINDOWED, w, h, 0, 0) != 0) return false;
|
||||
|
||||
_allegro_screen = create_bitmap(screen->w, screen->h);
|
||||
_screen.width = screen->w;
|
||||
_screen.height = screen->h;
|
||||
_allegro_screen = create_bitmap(w, h);
|
||||
_screen.width = w;
|
||||
_screen.height = h;
|
||||
_screen.pitch = ((byte*)screen->line[1] - (byte*)screen->line[0]) / (bitmap_color_depth(screen) / 8);
|
||||
|
||||
poll_mouse();
|
||||
@@ -399,7 +405,7 @@ void VideoDriver_Allegro::Stop()
|
||||
if (--_allegro_instance_count == 0) allegro_exit();
|
||||
}
|
||||
|
||||
#if defined(UNIX) || defined(__OS2__) || defined(PSP)
|
||||
#if defined(UNIX) || defined(__OS2__) || defined(PSP) || defined(DOS)
|
||||
# include <sys/time.h> /* gettimeofday */
|
||||
|
||||
static uint32 GetTime()
|
||||
@@ -490,6 +496,9 @@ bool VideoDriver_Allegro::ChangeResolution(int w, int h)
|
||||
|
||||
bool VideoDriver_Allegro::ToggleFullscreen(bool fullscreen)
|
||||
{
|
||||
#ifdef DOS
|
||||
return false;
|
||||
#else
|
||||
_fullscreen = fullscreen;
|
||||
GetVideoModes(); // get the list of available video modes
|
||||
if (_num_resolutions == 0 || !this->ChangeResolution(_cur_resolution.width, _cur_resolution.height)) {
|
||||
@@ -498,6 +507,7 @@ bool VideoDriver_Allegro::ToggleFullscreen(bool fullscreen)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* WITH_ALLEGRO */
|
||||
|
Reference in New Issue
Block a user