Patch adding Wii support by tueidj, part 8: system-specific changes

- conditionally compiles out some code intended for the PC platforms
- compat.c: get home directory routine, access() implementation
- game.c: don't use ioctl(), lower cache1d size to 8 MiB, Wii-specific
  initialization code and application directory ("apps/eduke32")

git-svn-id: https://svn.eduke32.com/eduke32@2628 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2012-05-01 12:40:08 +00:00
parent 4ec6ffcef8
commit dfa212aaf9
5 changed files with 46 additions and 4 deletions

View File

@ -377,7 +377,7 @@ int32_t baselayer_init(void)
void makeasmwriteable(void)
{
#ifndef NOASM
#if !defined(NOASM) && !defined(GEKKO)
extern int32_t dep_begin, dep_end;
# if defined _WIN32
DWORD oldprot;

View File

@ -396,6 +396,14 @@ char *Bgethomedir(void)
if (s) s = Bstrdup(s);
CFRelease(str);
return s;
#elif defined(GEKKO)
// return current drive's name
char *drv, cwd[BMAX_PATH] = {0};
getcwd(cwd, BMAX_PATH);
drv = strchr(cwd, ':');
if (drv)
drv[1] = '\0';
return Bstrdup(cwd);
#else
char *e = getenv("HOME");
if (!e) return NULL;
@ -845,7 +853,7 @@ uint32_t Bgetsysmemsize(void)
}
return siz;
#elif (defined(_SC_PAGE_SIZE) || defined(_SC_PAGESIZE)) && defined(_SC_PHYS_PAGES)
#elif (defined(_SC_PAGE_SIZE) || defined(_SC_PAGESIZE)) && defined(_SC_PHYS_PAGES) && !defined(GEKKO)
uint32_t siz = UINT_MAX;
int64_t scpagesiz, scphyspages;
@ -867,5 +875,16 @@ uint32_t Bgetsysmemsize(void)
#endif
}
#ifdef GEKKO
int access(const char *pathname, int mode)
{
struct stat st;
if (stat(pathname, &st)==-1)
return -1;
// TODO: Check mode against st_mode
return 0;
}
#endif

View File

@ -242,7 +242,7 @@ void setvsync(int32_t sync)
static void attach_debugger_here(void) {}
/* XXX: libexecinfo could be used on systems without gnu libc. */
#if defined __GNUC__ && !defined __OpenBSD__ && !(defined __APPLE__ && defined __BIG_ENDIAN__)
#if defined __GNUC__ && !defined __OpenBSD__ && !(defined __APPLE__ && defined __BIG_ENDIAN__) && !defined(GEKKO)
# define PRINTSTACKONSEGV 1
# include <execinfo.h>
#endif

View File

@ -76,7 +76,9 @@ extern int32_t G_GetVersionFromWebsite(char *buffer);
#define UPDATEINTERVAL 604800 // 1w
#else
static int32_t usecwd = 0;
#ifndef GEKKO
#include <sys/ioctl.h>
#endif
#endif /* _WIN32 */
int32_t g_quitDeadline = 0;
@ -183,7 +185,11 @@ static char user_quote[MAXUSERQUOTES][178];
// This was 32 for a while, but I think lowering it to 24 will help things like the Dingoo.
// Ideally, we would look at our memory usage on our most cramped platform and figure out
// how much of that is needed for the underlying OS and things like SDL instead of guessing
#ifndef GEKKO
static int32_t MAXCACHE1DSIZE = (24*1048576);
#else
static int32_t MAXCACHE1DSIZE = (8*1048576);
#endif
int32_t tempwallptr;
@ -9792,6 +9798,12 @@ void app_crashhandler(void)
}
#endif
#ifdef GEKKO
void L2Enhance();
void CON_EnableGecko(int channel,int safe);
bool fatInit (uint32_t cacheSize, bool setAsDefaultDevice);
#endif
int32_t app_main(int32_t argc, const char **argv)
{
int32_t i = 0, j;
@ -9803,6 +9815,13 @@ int32_t app_main(int32_t argc, const char **argv)
ENetCallbacks callbacks = { NULL, NULL, NULL };
#endif
#ifdef GEKKO
L2Enhance();
CON_EnableGecko(1, 1);
printf("Console started\n");
fatInit(28, true);
#endif
#ifdef RENDERTYPEWIN
if (argc > 1)
{
@ -9925,6 +9944,8 @@ int32_t app_main(int32_t argc, const char **argv)
"EDuke32 Settings"
#elif defined(__APPLE__)
"Library/Application Support/EDuke32"
#elif defined(GEKKO)
"apps/eduke32"
#else
".eduke32"
#endif
@ -10586,7 +10607,9 @@ MAIN_LOOP_RESTART:
static uint32_t bufpos = 0;
static char buf[128];
#ifndef GEKKO
ioctl(0, FIONBIO, &flag);
#endif
if ((nb = read(0, &ch, 1)) > 0 && bufpos < sizeof(buf))
{

View File

@ -41,7 +41,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "sdl_inc.h"
#include "music.h"
#if !defined _WIN32
#if !defined _WIN32 && !defined(GEKKO)
# define FORK_EXEC_MIDI 1
#endif