Skip to content

Commit

Permalink
Improve support for other game paks
Browse files Browse the repository at this point in the history
  • Loading branch information
amlib committed Dec 7, 2016
1 parent 4d5cd5f commit 3a6a1ba
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 9 deletions.
4 changes: 3 additions & 1 deletion common/common.c
Expand Up @@ -1799,6 +1799,8 @@ static void COM_AddGameDirectory(const char *base, const char *dir)
}
#endif

printf("Adding game directory: %s\n", com_gamedir);

// add the directory to the search path
search = (searchpath_t*)Hunk_Alloc(sizeof(searchpath_t));
strcpy(search->filename, com_gamedir);
Expand Down Expand Up @@ -1920,7 +1922,7 @@ static void COM_InitFilesystem(void)
strcpy(com_basedir, host_parms.basedir);

// start up with id1 by default
COM_AddGameDirectory(com_basedir, "");
COM_AddGameDirectory(com_basedir, "id1");

#ifdef NQ_HACK
if (COM_CheckParm("-rogue"))
Expand Down
26 changes: 18 additions & 8 deletions common/libretro.c
Expand Up @@ -28,6 +28,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#endif
#include <stdlib.h>
#include <string.h>
#include <libgen.h>
#include <sys/stat.h>
#include <sys/types.h>
#ifdef _WIN32
Expand Down Expand Up @@ -755,8 +756,13 @@ void retro_unset_rumble_strong(void)
bool retro_load_game(const struct retro_game_info *info)
{
char g_rom_dir[256], g_pak_path[256];
char *path_lower;
quakeparms_t parms;

path_lower = strdup(info->path);
for (int i=0; path_lower[i]; ++i)
path_lower[i] = tolower(path_lower[i]);

struct retro_input_descriptor desc[] = {
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_LEFT, "D-Pad Left" },
{ 0, RETRO_DEVICE_JOYPAD, 0, RETRO_DEVICE_ID_JOYPAD_UP, "D-Pad Up" },
Expand Down Expand Up @@ -791,14 +797,10 @@ bool retro_load_game(const struct retro_game_info *info)

MEMSIZE_MB = DEFAULT_MEMSIZE_MB;

if (
strstr(info->path, "quoth") ||
strstr(info->path, "hipnotic") ||
strstr(info->path, "rogue") ||
strstr(info->path, "HIPNOTIC") ||
strstr(info->path, "ROGUE") ||
strstr(info->path, "QUOTH")
)
if ( strstr(path_lower, "id1") ||
strstr(path_lower, "quoth") ||
strstr(path_lower, "hipnotic") ||
strstr(path_lower, "rogue") )
{
#if (defined(HW_RVL) && !defined(WIIU)) || defined(_XBOX1)
MEMSIZE_MB = 16;
Expand Down Expand Up @@ -828,6 +830,14 @@ bool retro_load_game(const struct retro_game_info *info)
parms.argc++;
argv[1] = "-quoth";
}
else if (!strstr(g_pak_path, "id1/"))
{
parms.argc++;
argv[1] = "-game";
parms.argc++;
argv[2] = basename(g_rom_dir);
extract_directory(g_rom_dir, g_rom_dir, sizeof(g_rom_dir));
}

parms.argv = argv;

Expand Down

0 comments on commit 3a6a1ba

Please sign in to comment.