early-access version 2835

This commit is contained in:
pineappleEA
2022-07-15 04:00:50 +02:00
parent 5c0ee5eba6
commit 0e7aef7e36
1173 changed files with 55320 additions and 18881 deletions
+14 -12
View File
@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
Copyright (C) 1997-2021 Sam Lantinga <slouken@libsdl.org>
Copyright (C) 1997-2022 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -31,6 +31,7 @@
#define INCL_DOSFILEMGR
#define INCL_DOSPROCESS
#define INCL_DOSMODULEMGR
#define INCL_DOSERRORS
#include <os2.h>
@@ -42,30 +43,31 @@ SDL_GetBasePath(void)
PPIB pib;
ULONG ulRC = DosGetInfoBlocks(&tib, &pib);
PCHAR pcEnd;
ULONG cbResult;
CHAR acBuf[CCHMAXPATH];
if (ulRC != NO_ERROR) {
debug_os2("DosGetInfoBlocks() failed, rc = %u", ulRC);
SDL_SetError("Can't get process information block (E%lu)", ulRC);
return NULL;
}
pcEnd = SDL_strrchr(pib->pib_pchcmd, '\\');
ulRC = DosQueryModuleName(pib->pib_hmte, sizeof(acBuf), acBuf);
if (ulRC != NO_ERROR) {
SDL_SetError("Can't query the module name (E%lu)", ulRC);
return NULL;
}
pcEnd = SDL_strrchr(acBuf, '\\');
if (pcEnd != NULL)
pcEnd++;
pcEnd[1] = '\0';
else {
if (pib->pib_pchcmd[1] == ':')
pcEnd = &pib->pib_pchcmd[2];
if (acBuf[1] == ':') /* e.g. "C:FOO" */
acBuf[2] = '\0';
else {
SDL_SetError("No path in pib->pib_pchcmd");
SDL_SetError("No path in module name");
return NULL;
}
}
cbResult = pcEnd - pib->pib_pchcmd;
SDL_memcpy(acBuf, pib->pib_pchcmd, cbResult);
acBuf[cbResult] = '\0';
return OS2_SysToUTF8(acBuf);
}