Some OS/2 specific changes. Patches are not complete yet

This commit is contained in:
Jochen Sch„fer 2025-03-29 10:35:37 +01:00
parent 36888dc377
commit 57fc5831d3
10 changed files with 32 additions and 18 deletions

View File

@ -1,4 +1,9 @@
echo off
bash autogen.sh
dash configure
REM since cpu cores need a lot of memory,
REM we don't want to build parallel
cd src\cpu
make
cd ..\..
make -j4

View File

@ -372,8 +372,9 @@ fi
dnl Some needed libraries for OS2
dnl perhaps join this with the other target depended checks. move them upwards
if test x$host = xi386-pc-os2-emx ; then
CXXFLAGS="$CXXFLAGS -Zmt"
LDFLAGS="$LDFLAGS -Zomf -Zmt"
CXXFLAGS="$CXXFLAGS -DOS2 -march=pentium4 -idirafter /@unixroot/usr/include/os2tk45"
CFLAGS="$CFLAGS -DOS2 -march=pentium4 -idirafter /@unixroot/usr/include/os2tk45"
LDFLAGS="$LDFLAGS -Zomf -Zhigh-mem -lcx"
fi
dnl I would like to know of any concerns given by the C++ compiler.

View File

@ -132,7 +132,7 @@
#define be64toh(x) betoh64(x)
#define le64toh(x) letoh64(x)
#elif defined(__HAIKU__)
#elif defined(__HAIKU__) || defined(OS2)
#include <endian.h>

View File

@ -44,7 +44,7 @@
#include <stdlib.h>
#include "zlib.h"
#if defined(__APPLE__) || defined(USE_FILE32API)
#if defined(__APPLE__) || defined(USE_FILE32API) || defined(OS2)
#define fopen64 fopen
#define ftello64 ftell
#define fseeko64 fseek

View File

@ -27,7 +27,7 @@
#define MAX_PATH PATH_MAX
#endif
#ifdef WIN32
#if defined(WIN32) || defined(OS2)
# define BYTESEX_LITTLE
# define _G_DIR_SEPARATOR '\\'
#elif defined(EMSCRIPTEN)

View File

@ -133,6 +133,9 @@ bool CheckDBCSCP(int32_t codepage);
#define INCL DOSFILEMGR
#define INCL_DOSERRORS
#include "os2.h"
typedef char host_cnv_char_t;
host_cnv_char_t *CodePageGuestToHost(const char *s);
#endif
#if defined(WIN32)
@ -10302,7 +10305,7 @@ void DOS_SetupPrograms(void) {
"Return Color #7 to the default color value\n\n SETCOLOR 3 +\n\n"
"Return Color #3 to the preset color value\n\n SETCOLOR MONO\n\n"
"Display current MONO mode status\n\n"
"To change the current background and foreground colors, use COLORPGM command.\n");
"To change the current background and foreground colors, use COLOR command.\n");
MSG_Add("PROGRAM_SETCOLOR_STATUS","MONO mode status: %s (video mode %d)\n");
MSG_Add("PROGRAM_SETCOLOR_ACTIVE","active");
MSG_Add("PROGRAM_SETCOLOR_INACTIVE","inactive");

View File

@ -156,9 +156,9 @@ void DOS_Drive_Cache::SetBaseDir(const char* baseDir, DOS_Drive *drive) {
#else // OS2
//TODO determine whether cdrom or not!
FSINFO fsinfo;
ULONG drivenumber = drive[0];
ULONG drivenumber = drives[0];
if (drivenumber > 26) { // drive letter was lowercase
drivenumber = drive[0] - 'a' + 1;
drivenumber = drives[0] - 'a' + 1;
}
APIRET rc = DosQueryFSInfo(drivenumber, FSIL_VOLSER, &fsinfo, sizeof(FSINFO));
if (rc == NO_ERROR) {

View File

@ -2995,6 +2995,8 @@ bool LocalFile::Close() {
extern int errno;
LOG_MSG("Set time failed (%s)", strerror(errno));
}
#elif defined(OS2)
LOG_MSG("File set time TBD");
#elif !defined(RISCOS) // Linux (TODO: What about Mac OS X/Darwin?)
// NTS: Do not attempt futime, Linux doesn't have it.
// Do not attempt futimes, Linux man pages LIE about having it. It's even there in the freaking header, but not recognized!

View File

@ -1033,10 +1033,13 @@ static SDLKey sdlkey_map[MAX_SCANCODES] = { // Convert hardware scancode (XKB =
};
#else // !MACOSX && !Linux
#if defined(__FreeBSD__)
#if defined(__FreeBSD__) || defined(OS2)
// Todo: recheck sdl mapping
#define SDLK_JP_RO (SDLKey)0x73
#define SDLK_JP_YEN (SDLKey)0x7d
#if defined(OS2)
#define SDLK_KP_COMMA SDLK_COMMA
#endif
#endif
#define MAX_SCANCODES 0xdf
static SDLKey sdlkey_map[MAX_SCANCODES] = {

View File

@ -172,7 +172,7 @@ static char *cvtCodepageToUtf8(const char *cpstr)
size_t cplen = len;
size_t unilen = len;
size_t subs = 0;
UniChar *uc2ptr = __PHYSFS_smallAlloc(len * sizeof (UniChar));
UniChar *uc2ptr = (UniChar*)__PHYSFS_smallAlloc(len * sizeof (UniChar));
UniChar *uc2str = uc2ptr;
BAIL_IF(!uc2ptr, PHYSFS_ERR_OUT_OF_MEMORY, NULL);
@ -268,9 +268,9 @@ static void prepUnicodeSupport(void)
int ok = 0;
char buf[CCHMAXPATH];
UniChar defstr[] = { 0 };
if (DosLoadModule(buf, sizeof (buf) - 1, "uconv", &uconvdll) == NO_ERROR)
if (DosLoadModule((PSZ)buf, sizeof (buf) - 1, (PCSZ)"uconv", &uconvdll) == NO_ERROR)
{
#define LOAD(x) (DosQueryProcAddr(uconvdll,0,#x,(PFN*)&p##x)==NO_ERROR)
#define LOAD(x) (DosQueryProcAddr(uconvdll,0,(PCSZ)#x,(PFN*)&p##x)==NO_ERROR)
ok = LOAD(UniCreateUconvObject) &&
LOAD(UniFreeUconvObject) &&
LOAD(UniUconvToUcs) &&
@ -284,7 +284,7 @@ static void prepUnicodeSupport(void)
if (uconvdll)
{
if (uconv)
pUniFreeUconvObject(uconv);
pUniFreeUconvObject(&uconv);
DosFreeModule(uconvdll);
uconvdll = 0;
} /* if */
@ -303,7 +303,7 @@ void __PHYSFS_platformDeinit(void)
{
if (uconvdll)
{
pUniFreeUconvObject(uconv);
pUniFreeUconvObject(&uconv);
uconv = 0;
DosFreeModule(uconvdll);
uconvdll = 0;
@ -551,7 +551,7 @@ static HFILE openFile(const char *filename, const ULONG flags, const ULONG mode)
BAIL_IF_ERRPASS(!cpfname, 0);
rc = DosOpen(cpfname, &hfile, &action, 0, FILE_NORMAL, flags, mode, NULL);
rc = DosOpen((PCSZ)cpfname, &hfile, &action, 0, FILE_NORMAL, flags, mode, NULL);
allocator.Free(cpfname);
BAIL_IF(rc != NO_ERROR, errcodeFromAPIRET(rc), 0);
@ -690,9 +690,9 @@ int __PHYSFS_platformDelete(const char *path)
int retval = 0;
BAIL_IF_ERRPASS(!cppath, 0);
rc = DosQueryPathInfo(cppath, FIL_STANDARD, &fs, sizeof (fs));
rc = DosQueryPathInfo((PCSZ)cppath, FIL_STANDARD, &fs, sizeof (fs));
GOTO_IF(rc != NO_ERROR, errcodeFromAPIRET(rc), done);
rc = (fs.attrFile & FILE_DIRECTORY) ? DosDeleteDir(path) : DosDelete(path);
rc = (fs.attrFile & FILE_DIRECTORY) ? DosDeleteDir((PCSZ)path) : DosDelete((PCSZ)path);
GOTO_IF(rc != NO_ERROR, errcodeFromAPIRET(rc), done);
retval = 1; /* success */
@ -730,7 +730,7 @@ int __PHYSFS_platformStat(const char *filename, PHYSFS_Stat *stat, const int fol
BAIL_IF_ERRPASS(!cpfname, 0);
rc = DosQueryPathInfo(cpfname, FIL_STANDARD, &fs, sizeof (fs));
rc = DosQueryPathInfo((PCSZ)cpfname, FIL_STANDARD, &fs, sizeof (fs));
GOTO_IF(rc != NO_ERROR, errcodeFromAPIRET(rc), done);
if (fs.attrFile & FILE_DIRECTORY)