Wolfenstein 3D:

- Fixed hang when saving game: now save and settings are saved by default in "/tmp0/1/wolf4sdl"
 - Now the --configdir parameter works

git-svn-id: svn://kolibrios.org@8655 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
turbocat 2021-03-31 18:43:18 +00:00
parent e7db44fecc
commit 9d6221ab7a
4 changed files with 33 additions and 22 deletions

View File

@ -1,5 +1,5 @@
/// JOYSTICK STUB FOR Wolfenstein 3D port to KolibriOS
/// Ported by maxcodehack
/// Ported by maxcodehack and turbocat2001
/* Set up for C function definitions, even when using C++ */
#ifdef __cplusplus
@ -147,9 +147,6 @@ typedef struct _SDL_Joystick SDL_Joystick;
*/
void SDL_JoystickClose(SDL_Joystick *joystick){};
bool mkdir(const char* dir){};
/* Ends C function definitions when using C++ */
#ifdef __cplusplus
}

View File

@ -1,15 +1,21 @@
#include <SDL.h>
#include <kos32sys.h>
#include <stdlib.h>
#include <sys/stat.h>
#include "../../kolibri-libc/source/include/ksys.h"
void kolibri_set_win_center()
{
struct proc_info *info = (struct proc_info*)malloc(sizeof(struct proc_info));
get_proc_info((char*)info);
pos_t screen_size= max_screen_size();
int new_x = screen_size.x/2-info->width/2;
int new_y = screen_size.y/2-info->height/2;
sys_change_window(new_x,new_y, -1, -1);
ksys_proc_table_t *info = (ksys_proc_table_t*)malloc(sizeof(ksys_proc_table_t));
_ksys_process_info(info, -1);
ksys_pos_t screen_size= _ksys_screen_size();
int new_x = screen_size.x/2-info->winx_size/2;
int new_y = screen_size.y/2-info->winy_size/2;
_ksys_change_window(new_x, new_y, -1, -1);
free(info);
}
int mkdir(const char * path, unsigned)
{
return _ksys_mkdir(path);
}

View File

@ -1887,7 +1887,7 @@ void CheckParameters(int argc, char *argv[])
{
if(hasError) printf("\n");
printf(
"Wolf4SDL v1.7 ($Revision$)\n"
"Wolf4SDL v1.7\n"
"Ported by Chaos-Software (http://www.chaos-software.de.vu)\n"
#ifdef _KOLIBRI
"Ported for KolibriOS by 'turbocat2001' and 'maxcodehack'\n"
@ -1902,10 +1902,10 @@ void CheckParameters(int argc, char *argv[])
" --normal Sets the difficulty to normal for tedlevel\n"
" --hard Sets the difficulty to hard for tedlevel\n"
" --nowait Skips intro screens\n"
#ifndef _KOLIBRI
#ifndef _KOLIBRI
" --windowed[-mouse] Starts the game in a window [and grabs mouse]\n"
" --res <width> <height> Sets the screen resolution\n"
#endif
#endif
" (must be multiple of 320x200 or 320x240)\n"
" --resf <w> <h> Sets any screen resolution >= 320x200\n"
" (which may result in graphic errors)\n"
@ -1915,11 +1915,11 @@ void CheckParameters(int argc, char *argv[])
" --nodblbuf Don't use SDL's double buffering\n"
" --extravbls <vbls> Sets a delay after each frame, which may help to\n"
" reduce flickering (unit is currently 8 ms, default: 0)\n"
#ifndef _KOLIBRI
#ifndef _KOLIBRI
" --joystick <index> Use the index-th joystick if available\n"
" (-1 to disable joystick, default: 0)\n"
" --joystickhat <index> Enables movement with the given coolie hat\n"
#endif
#endif
" --samplerate <rate> Sets the sound sample rate (given in Hz, default: %i)\n"
" --audiobuffer <size> Sets the size of the audio buffer (-> sound latency)\n"
" (given in bytes, default: 2048 / (44100 / samplerate))\n"
@ -1928,6 +1928,10 @@ void CheckParameters(int argc, char *argv[])
" --configdir <dir> Directory where config file and save games are stored\n"
#if defined(_arch_dreamcast) || defined(_WIN32)
" (default: current directory)\n"
#endif
#ifdef _KOLIBRI
" (default: /tmp0/1/wolf4sdl)\n"
#else
" (default: $HOME/.wolf4sdl)\n"
#endif

View File

@ -3989,11 +3989,14 @@ void
CheckForEpisodes (void)
{
struct stat statbuf;
/*
// On Linux like systems, the configdir defaults to $HOME/.wolf4sdl
#if !defined(_WIN32) && !defined(_arch_dreamcast)
#if !defined(_WIN32) && !defined(_arch_dreamcast)
if(configdir[0] == 0)
{
#ifdef _KOLIBRI
strcpy(configdir, "/tmp0/1/wolf4sdl");
#else
// Set config location to home directory for multi-user support
char *homedir = getenv("HOME");
if(homedir == NULL)
@ -4006,8 +4009,9 @@ CheckForEpisodes (void)
Quit("Your $HOME directory path is too long. It cannot be used for saving games.");
}
snprintf(configdir, sizeof(configdir), "%s" WOLFDIR, homedir);
#endif
}
#endif*/
#endif
if(configdir[0] != 0)
{