mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
Restructure the GRP scanning functionality. Outwardly, this allows GRP selections with special handling (the add-ons and NAM) to function properly when the Windows or GTK startup windows do not run, namely with the OS X startup window, and using the -gamegrp command line parameter on any other platform, or on all of the both under dedicated server mode,
git-svn-id: https://svn.eduke32.com/eduke32@5103 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
5c5019d9d8
commit
fe17d41b14
11 changed files with 177 additions and 306 deletions
|
@ -19,15 +19,10 @@
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
struct grpfile *p;
|
|
||||||
|
|
||||||
list = [[NSMutableArray alloc] init];
|
list = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
for (p = foundgrps; p; p=p->next) {
|
for (grpfile_t const *p = foundgrps; p; p=p->next) {
|
||||||
struct grpfile const * const group = GetInternalGroup(p->crcval);
|
[list addObject:[[GrpFile alloc] initWithGrpfile:p]];
|
||||||
if (group == NULL)
|
|
||||||
continue;
|
|
||||||
[list addObject:[[GrpFile alloc] initWithGrpfile:p andName:[NSString stringWithCString:group->name encoding:NSUTF8StringEncoding]]];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,13 +13,14 @@
|
||||||
|
|
||||||
@interface GrpFile : NSObject
|
@interface GrpFile : NSObject
|
||||||
{
|
{
|
||||||
NSString *name;
|
NSString *namestring;
|
||||||
struct grpfile *fg;
|
NSString *grpnamestring;
|
||||||
|
grpfile_t const *fg;
|
||||||
}
|
}
|
||||||
- (id)initWithGrpfile:(struct grpfile *)grpfile andName:(NSString*)aName;
|
- (id)initWithGrpfile:(grpfile_t const *)grpfile;
|
||||||
- (void)dealloc;
|
- (void)dealloc;
|
||||||
- (NSString *)name;
|
- (NSString *)name;
|
||||||
- (NSString *)grpname;
|
- (NSString *)grpname;
|
||||||
- (struct grpfile *)entryptr;
|
- (grpfile_t const *)entryptr;
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
|
|
@ -10,30 +10,33 @@
|
||||||
#include "GrpFile.game.h"
|
#include "GrpFile.game.h"
|
||||||
|
|
||||||
@implementation GrpFile
|
@implementation GrpFile
|
||||||
- (id)initWithGrpfile:(struct grpfile *)grpfile andName:(NSString*)aName
|
- (id)initWithGrpfile:(grpfile_t const *)grpfile
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self) {
|
if (self) {
|
||||||
fg = grpfile;
|
fg = grpfile;
|
||||||
name = aName;
|
namestring = [NSString stringWithCString:fg->type->name encoding:NSUTF8StringEncoding];
|
||||||
[aName retain];
|
[namestring retain];
|
||||||
|
grpnamestring = [NSString stringWithCString:fg->filename encoding:NSUTF8StringEncoding];
|
||||||
|
[grpnamestring retain];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
[name release];
|
[namestring release];
|
||||||
|
[grpnamestring release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
- (NSString *)name
|
- (NSString *)name
|
||||||
{
|
{
|
||||||
return name;
|
return namestring;
|
||||||
}
|
}
|
||||||
- (NSString *)grpname
|
- (NSString *)grpname
|
||||||
{
|
{
|
||||||
return [NSString stringWithCString:(fg->name) encoding:NSUTF8StringEncoding];
|
return grpnamestring;
|
||||||
}
|
}
|
||||||
- (struct grpfile *)entryptr
|
- (grpfile_t const *)entryptr
|
||||||
{
|
{
|
||||||
return fg;
|
return fg;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,12 +22,11 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "common_game.h"
|
#include "common_game.h"
|
||||||
|
|
||||||
|
struct grpfile_t const *g_selectedGrp;
|
||||||
|
|
||||||
int32_t g_gameType = GAMEFLAG_DUKE;
|
int32_t g_gameType = GAMEFLAG_DUKE;
|
||||||
|
|
||||||
int32_t g_dependencyCRC = 0;
|
|
||||||
int32_t g_groupCRC;
|
|
||||||
int32_t g_usingAddon = 0;
|
int32_t g_usingAddon = 0;
|
||||||
void (*g_postprocessing)(int32_t);
|
|
||||||
|
|
||||||
// g_gameNamePtr can point to one of: grpfiles[].name (string literal), string
|
// g_gameNamePtr can point to one of: grpfiles[].name (string literal), string
|
||||||
// literal, malloc'd block (XXX: possible leak)
|
// literal, malloc'd block (XXX: possible leak)
|
||||||
|
@ -374,40 +373,46 @@ void G_ScanGroups(void)
|
||||||
{
|
{
|
||||||
ScanGroups();
|
ScanGroups();
|
||||||
|
|
||||||
// try and identify the 'defaultgamegrp' in the set of GRPs.
|
g_selectedGrp = NULL;
|
||||||
// if it is found, set up the environment accordingly for the game it represents.
|
|
||||||
// if it is not found, choose the first GRP from the list
|
|
||||||
struct grpfile *fg, *first = NULL;
|
|
||||||
|
|
||||||
for (fg = foundgrps; fg; fg=fg->next)
|
char const * const currentGrp = G_GrpFile();
|
||||||
|
|
||||||
|
for (grpfile_t const *fg = foundgrps; fg; fg=fg->next)
|
||||||
{
|
{
|
||||||
struct grpfile *grp;
|
if (!Bstrcasecmp(fg->filename, currentGrp))
|
||||||
for (grp = listgrps; grp; grp=grp->next)
|
|
||||||
if (fg->crcval == grp->crcval) break;
|
|
||||||
|
|
||||||
if (grp == NULL)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
fg->game = grp->game;
|
|
||||||
if (!first) first = fg;
|
|
||||||
if (!Bstrcasecmp(fg->name, G_DefaultGrpFile()))
|
|
||||||
{
|
{
|
||||||
g_gameType = grp->game;
|
g_selectedGrp = fg;
|
||||||
g_gameNamePtr = grp->name;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!fg && first)
|
}
|
||||||
{
|
|
||||||
if (g_grpNamePtr == NULL)
|
static int32_t G_TryLoadingGrp(char const * const grpfile)
|
||||||
{
|
{
|
||||||
clearGrpNamePtr();
|
int32_t i;
|
||||||
g_grpNamePtr = dup_filename(first->name);
|
|
||||||
}
|
if ((i = initgroupfile(grpfile)) == -1)
|
||||||
g_gameType = first->game;
|
initprintf("Warning: could not find main data file \"%s\"!\n", grpfile);
|
||||||
g_gameNamePtr = listgrps->name;
|
else
|
||||||
}
|
initprintf("Using \"%s\" as main game data file.\n", grpfile);
|
||||||
else if (!fg) g_gameNamePtr = NULL;
|
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int32_t G_LoadGrpDependencyChain(grpfile_t const * const grp)
|
||||||
|
{
|
||||||
|
if (!grp)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (grp->type->dependency)
|
||||||
|
G_LoadGrpDependencyChain(FindGroup(grp->type->dependency));
|
||||||
|
|
||||||
|
int32_t const i = G_TryLoadingGrp(grp->filename);
|
||||||
|
|
||||||
|
if (grp->type->postprocessing)
|
||||||
|
grp->type->postprocessing(grp->type->crcval);
|
||||||
|
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
void G_LoadGroups(int32_t autoload)
|
void G_LoadGroups(int32_t autoload)
|
||||||
|
@ -440,28 +445,32 @@ void G_LoadGroups(int32_t autoload)
|
||||||
if (g_usingAddon)
|
if (g_usingAddon)
|
||||||
G_LoadAddon();
|
G_LoadAddon();
|
||||||
|
|
||||||
|
const char *grpfile;
|
||||||
int32_t i;
|
int32_t i;
|
||||||
const char *grpfile = G_GrpFile();
|
|
||||||
|
|
||||||
if (g_dependencyCRC)
|
if ((i = G_LoadGrpDependencyChain(g_selectedGrp)) != -1)
|
||||||
{
|
{
|
||||||
struct grpfile *grp = FindGroup(g_dependencyCRC);
|
grpfile = g_selectedGrp->filename;
|
||||||
if (grp)
|
|
||||||
{
|
clearGrpNamePtr();
|
||||||
if ((i = initgroupfile(grp->name)) == -1)
|
g_grpNamePtr = dup_filename(grpfile);
|
||||||
initprintf("Warning: could not find main data file \"%s\"!\n", grp->name);
|
|
||||||
else
|
grpinfo_t const * const type = g_selectedGrp->type;
|
||||||
initprintf("Using \"%s\" as main game data file.\n", grp->name);
|
|
||||||
}
|
g_gameType = type->game;
|
||||||
|
g_gameNamePtr = type->name;
|
||||||
|
|
||||||
|
if (type->scriptname && g_scriptNamePtr == NULL)
|
||||||
|
g_scriptNamePtr = dup_filename(type->scriptname);
|
||||||
|
|
||||||
|
if (type->defname && g_defNamePtr == NULL)
|
||||||
|
g_defNamePtr = dup_filename(type->defname);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((i = initgroupfile(grpfile)) == -1)
|
|
||||||
initprintf("Warning: could not find main data file \"%s\"!\n", grpfile);
|
|
||||||
else
|
else
|
||||||
initprintf("Using \"%s\" as main game data file.\n", grpfile);
|
{
|
||||||
|
grpfile = G_GrpFile();
|
||||||
if (g_postprocessing)
|
i = G_TryLoadingGrp(grpfile);
|
||||||
g_postprocessing(g_groupCRC);
|
}
|
||||||
|
|
||||||
if (autoload)
|
if (autoload)
|
||||||
{
|
{
|
||||||
|
@ -560,7 +569,6 @@ const char * G_GetInstallPath(int32_t insttype)
|
||||||
|
|
||||||
static void G_LoadAddon(void)
|
static void G_LoadAddon(void)
|
||||||
{
|
{
|
||||||
struct grpfile * grp;
|
|
||||||
int32_t crc = 0; // compiler-happy
|
int32_t crc = 0; // compiler-happy
|
||||||
|
|
||||||
switch (g_usingAddon)
|
switch (g_usingAddon)
|
||||||
|
@ -578,30 +586,10 @@ static void G_LoadAddon(void)
|
||||||
|
|
||||||
if (!crc) return;
|
if (!crc) return;
|
||||||
|
|
||||||
grp = FindGroup(crc);
|
grpfile_t const * const grp = FindGroup(crc);
|
||||||
|
|
||||||
if (grp && FindGroup(DUKE15_CRC))
|
if (grp)
|
||||||
{
|
g_selectedGrp = grp;
|
||||||
clearGrpNamePtr();
|
|
||||||
g_grpNamePtr = dup_filename(FindGroup(DUKE15_CRC)->name);
|
|
||||||
|
|
||||||
G_AddGroup(grp->name);
|
|
||||||
|
|
||||||
for (grp = listgrps; grp; grp=grp->next)
|
|
||||||
if (crc == grp->crcval) break;
|
|
||||||
|
|
||||||
if (grp != NULL && grp->scriptname)
|
|
||||||
{
|
|
||||||
clearScriptNamePtr();
|
|
||||||
g_scriptNamePtr = dup_filename(grp->scriptname);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (grp != NULL && grp->defname)
|
|
||||||
{
|
|
||||||
clearDefNamePtr();
|
|
||||||
g_defNamePtr = dup_filename(grp->defname);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined EDUKE32_OSX || defined __linux__ || defined EDUKE32_BSD
|
#if defined EDUKE32_OSX || defined __linux__ || defined EDUKE32_BSD
|
||||||
|
|
|
@ -7,6 +7,8 @@
|
||||||
#ifndef EDUKE32_COMMON_GAME_H_
|
#ifndef EDUKE32_COMMON_GAME_H_
|
||||||
#define EDUKE32_COMMON_GAME_H_
|
#define EDUKE32_COMMON_GAME_H_
|
||||||
|
|
||||||
|
#include "grpscan.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
@ -23,12 +25,11 @@ extern int32_t usecwd;
|
||||||
#define GAMEFLAGMASK 0x0000007F // flags allowed from grpinfo
|
#define GAMEFLAGMASK 0x0000007F // flags allowed from grpinfo
|
||||||
#define GAMEFLAG_NWINTER 0x00000080
|
#define GAMEFLAG_NWINTER 0x00000080
|
||||||
|
|
||||||
|
extern struct grpfile_t const *g_selectedGrp;
|
||||||
|
|
||||||
extern int32_t g_gameType;
|
extern int32_t g_gameType;
|
||||||
|
|
||||||
extern int32_t g_usingAddon;
|
extern int32_t g_usingAddon;
|
||||||
extern int32_t g_dependencyCRC;
|
|
||||||
extern int32_t g_groupCRC;
|
|
||||||
extern void (*g_postprocessing)(int32_t);
|
|
||||||
|
|
||||||
#define DUKE (g_gameType & GAMEFLAG_DUKE)
|
#define DUKE (g_gameType & GAMEFLAG_DUKE)
|
||||||
#define NAM (g_gameType & GAMEFLAG_NAM)
|
#define NAM (g_gameType & GAMEFLAG_NAM)
|
||||||
|
|
|
@ -11553,16 +11553,16 @@ int32_t app_main(int32_t argc, const char **argv)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
flushlogwindow = 0;
|
||||||
|
G_LoadGroups(!g_noAutoLoad && !ud.config.NoAutoLoad);
|
||||||
|
// flushlogwindow = 1;
|
||||||
|
|
||||||
if (WW2GI || NAM)
|
if (WW2GI || NAM)
|
||||||
{
|
{
|
||||||
Bstrcpy(GametypeNames[0],"GruntMatch (Spawn)");
|
Bstrcpy(GametypeNames[0],"GruntMatch (Spawn)");
|
||||||
Bstrcpy(GametypeNames[2],"GruntMatch (No Spawn)");
|
Bstrcpy(GametypeNames[2],"GruntMatch (No Spawn)");
|
||||||
}
|
}
|
||||||
|
|
||||||
flushlogwindow = 0;
|
|
||||||
G_LoadGroups(!g_noAutoLoad && !ud.config.NoAutoLoad);
|
|
||||||
// flushlogwindow = 1;
|
|
||||||
|
|
||||||
if (!usecwd)
|
if (!usecwd)
|
||||||
G_CleanupSearchPaths();
|
G_CleanupSearchPaths();
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ static void process_vacapp15(int32_t crcval);
|
||||||
// custom GRP support for the startup window, file format reflects the structure below
|
// custom GRP support for the startup window, file format reflects the structure below
|
||||||
#define GAMELISTFILE "games.list"
|
#define GAMELISTFILE "games.list"
|
||||||
// name crc size flags dependency scriptname defname postprocessing
|
// name crc size flags dependency scriptname defname postprocessing
|
||||||
struct grpfile internalgrpfiles[] =
|
static grpinfo_t const internalgrpfiles[] =
|
||||||
{
|
{
|
||||||
{ "Duke Nukem 3D", DUKE13_CRC, 26524524, GAMEFLAG_DUKE, 0, NULL, NULL, NULL, NULL },
|
{ "Duke Nukem 3D", DUKE13_CRC, 26524524, GAMEFLAG_DUKE, 0, NULL, NULL, NULL, NULL },
|
||||||
{ "Duke Nukem 3D (South Korean Censored)", DUKEKR_CRC, 26385383, GAMEFLAG_DUKE, 0, NULL, NULL, NULL, NULL },
|
{ "Duke Nukem 3D (South Korean Censored)", DUKEKR_CRC, 26385383, GAMEFLAG_DUKE, 0, NULL, NULL, NULL, NULL },
|
||||||
|
@ -61,24 +61,11 @@ struct grpfile internalgrpfiles[] =
|
||||||
{ "WWII GI", WW2GI_CRC, 77939508, GAMEFLAG_WW2GI|GAMEFLAG_NAM, 0, NULL, NULL, NULL, NULL },
|
{ "WWII GI", WW2GI_CRC, 77939508, GAMEFLAG_WW2GI|GAMEFLAG_NAM, 0, NULL, NULL, NULL, NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
struct grpfile const * GetInternalGroup(int32_t crcval)
|
struct grpfile_t *foundgrps = NULL;
|
||||||
{
|
struct grpinfo_t *listgrps = NULL;
|
||||||
for (size_t i = 0; i < ARRAY_SIZE(internalgrpfiles); i++)
|
|
||||||
if (crcval == internalgrpfiles[i].crcval)
|
|
||||||
return &internalgrpfiles[i];
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
struct grpfile *foundgrps = NULL;
|
|
||||||
struct grpfile *listgrps = NULL;
|
|
||||||
|
|
||||||
static void LoadList(const char * filename)
|
static void LoadList(const char * filename)
|
||||||
{
|
{
|
||||||
struct grpfile *fg;
|
|
||||||
|
|
||||||
char *grpend = NULL;
|
|
||||||
|
|
||||||
scriptfile *script = scriptfile_fromfile(filename);
|
scriptfile *script = scriptfile_fromfile(filename);
|
||||||
|
|
||||||
if (!script)
|
if (!script)
|
||||||
|
@ -130,6 +117,7 @@ static void LoadList(const char * filename)
|
||||||
{
|
{
|
||||||
int32_t gsize = 0, gcrcval = 0, gflags = GAMEFLAG_DUKE, gdepcrc = DUKE15_CRC;
|
int32_t gsize = 0, gcrcval = 0, gflags = GAMEFLAG_DUKE, gdepcrc = DUKE15_CRC;
|
||||||
char *gname = NULL, *gscript = NULL, *gdef = NULL;
|
char *gname = NULL, *gscript = NULL, *gdef = NULL;
|
||||||
|
char *grpend = NULL;
|
||||||
|
|
||||||
static const tokenlist grpinfotokens[] =
|
static const tokenlist grpinfotokens[] =
|
||||||
{
|
{
|
||||||
|
@ -170,7 +158,7 @@ static void LoadList(const char * filename)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
fg = (struct grpfile *)Xcalloc(1, sizeof(struct grpfile));
|
grpinfo_t * const fg = (grpinfo_t *)Xcalloc(1, sizeof(grpinfo_t));
|
||||||
fg->next = listgrps;
|
fg->next = listgrps;
|
||||||
listgrps = fg;
|
listgrps = fg;
|
||||||
|
|
||||||
|
@ -202,12 +190,9 @@ static void LoadList(const char * filename)
|
||||||
|
|
||||||
static void LoadGameList(void)
|
static void LoadGameList(void)
|
||||||
{
|
{
|
||||||
struct grpfile *fg;
|
|
||||||
CACHE1D_FIND_REC *srch, *sidx;
|
|
||||||
|
|
||||||
for (size_t i = 0; i < ARRAY_SIZE(internalgrpfiles); i++)
|
for (size_t i = 0; i < ARRAY_SIZE(internalgrpfiles); i++)
|
||||||
{
|
{
|
||||||
fg = (struct grpfile *)Xcalloc(1, sizeof(struct grpfile));
|
grpinfo_t * const fg = (grpinfo_t *)Xcalloc(1, sizeof(grpinfo_t));
|
||||||
|
|
||||||
fg->name = Xstrdup(internalgrpfiles[i].name);
|
fg->name = Xstrdup(internalgrpfiles[i].name);
|
||||||
fg->crcval = internalgrpfiles[i].crcval;
|
fg->crcval = internalgrpfiles[i].crcval;
|
||||||
|
@ -227,21 +212,18 @@ static void LoadGameList(void)
|
||||||
listgrps = fg;
|
listgrps = fg;
|
||||||
}
|
}
|
||||||
|
|
||||||
srch = klistpath("/", "*.grpinfo", CACHE1D_FIND_FILE);
|
CACHE1D_FIND_REC * const srch = klistpath("/", "*.grpinfo", CACHE1D_FIND_FILE);
|
||||||
|
|
||||||
for (sidx = srch; sidx; sidx = sidx->next)
|
for (CACHE1D_FIND_REC *sidx = srch; sidx; sidx = sidx->next)
|
||||||
LoadList(srch->name);
|
LoadList(sidx->name);
|
||||||
|
|
||||||
klistfree(srch);
|
klistfree(srch);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FreeGameList(void)
|
static void FreeGameList(void)
|
||||||
{
|
{
|
||||||
struct grpfile *fg;
|
|
||||||
|
|
||||||
while (listgrps)
|
while (listgrps)
|
||||||
{
|
{
|
||||||
fg = listgrps->next;
|
|
||||||
Bfree(listgrps->name);
|
Bfree(listgrps->name);
|
||||||
|
|
||||||
if (listgrps->scriptname)
|
if (listgrps->scriptname)
|
||||||
|
@ -250,6 +232,7 @@ static void FreeGameList(void)
|
||||||
if (listgrps->defname)
|
if (listgrps->defname)
|
||||||
Bfree(listgrps->defname);
|
Bfree(listgrps->defname);
|
||||||
|
|
||||||
|
grpinfo_t * const fg = listgrps->next;
|
||||||
Bfree(listgrps);
|
Bfree(listgrps);
|
||||||
listgrps = fg;
|
listgrps = fg;
|
||||||
}
|
}
|
||||||
|
@ -302,68 +285,65 @@ static int32_t LoadGroupsCache(void)
|
||||||
|
|
||||||
static void FreeGroupsCache(void)
|
static void FreeGroupsCache(void)
|
||||||
{
|
{
|
||||||
struct grpcache *fg;
|
|
||||||
|
|
||||||
while (grpcache)
|
while (grpcache)
|
||||||
{
|
{
|
||||||
fg = grpcache->next;
|
struct grpcache * const fg = grpcache->next;
|
||||||
Bfree(grpcache);
|
Bfree(grpcache);
|
||||||
grpcache = fg;
|
grpcache = fg;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void RemoveGroup(int32_t crcval)
|
static void RemoveGroup(grpfile_t *igrp)
|
||||||
{
|
{
|
||||||
struct grpfile *grp;
|
for (grpfile_t *prev = NULL, *grp = foundgrps; grp; grp=grp->next)
|
||||||
|
|
||||||
for (grp = foundgrps; grp; grp=grp->next)
|
|
||||||
{
|
{
|
||||||
if (grp->crcval == crcval)
|
if (grp == igrp)
|
||||||
{
|
{
|
||||||
if (grp == foundgrps)
|
if (grp == foundgrps)
|
||||||
foundgrps = grp->next;
|
foundgrps = grp->next;
|
||||||
else
|
else
|
||||||
{
|
prev->next = grp->next;
|
||||||
struct grpfile *fg;
|
|
||||||
|
|
||||||
for (fg = foundgrps; fg; fg=fg->next)
|
Bfree((char *)grp->filename);
|
||||||
{
|
|
||||||
if (fg->next == grp)
|
|
||||||
{
|
|
||||||
fg->next = grp->next;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Bfree((char *)grp->name);
|
|
||||||
Bfree(grp);
|
Bfree(grp);
|
||||||
|
|
||||||
RemoveGroup(crcval);
|
return;
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
prev = grp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct grpfile * FindGroup(int32_t crcval)
|
grpfile_t * FindGroup(int32_t crcval)
|
||||||
{
|
{
|
||||||
struct grpfile *grp;
|
grpfile_t *grp;
|
||||||
|
|
||||||
for (grp = foundgrps; grp; grp=grp->next)
|
for (grp = foundgrps; grp; grp=grp->next)
|
||||||
{
|
{
|
||||||
if (grp->crcval == crcval)
|
if (grp->type->crcval == crcval)
|
||||||
return grp;
|
return grp;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static grpinfo_t const * FindGrpInfo(int32_t crcval, int32_t size)
|
||||||
|
{
|
||||||
|
grpinfo_t *grpinfo;
|
||||||
|
|
||||||
|
for (grpinfo = listgrps; grpinfo; grpinfo=grpinfo->next)
|
||||||
|
{
|
||||||
|
if (grpinfo->crcval == crcval && grpinfo->size == size)
|
||||||
|
return grpinfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static void ProcessGroups(CACHE1D_FIND_REC *srch)
|
static void ProcessGroups(CACHE1D_FIND_REC *srch)
|
||||||
{
|
{
|
||||||
CACHE1D_FIND_REC *sidx;
|
CACHE1D_FIND_REC *sidx;
|
||||||
struct grpcache *fg, *fgg;
|
struct grpcache *fg, *fgg;
|
||||||
struct grpfile *grp;
|
|
||||||
char *fn;
|
char *fn;
|
||||||
struct Bstat st;
|
struct Bstat st;
|
||||||
|
|
||||||
|
@ -388,12 +368,15 @@ static void ProcessGroups(CACHE1D_FIND_REC *srch)
|
||||||
Bfree(fn);
|
Bfree(fn);
|
||||||
if (fg->size == (int32_t)st.st_size && fg->mtime == (int32_t)st.st_mtime)
|
if (fg->size == (int32_t)st.st_size && fg->mtime == (int32_t)st.st_mtime)
|
||||||
{
|
{
|
||||||
grp = (struct grpfile *)Xcalloc(1, sizeof(struct grpfile));
|
grpinfo_t const * const grptype = FindGrpInfo(fg->crcval, fg->size);
|
||||||
grp->name = Xstrdup(sidx->name);
|
if (grptype)
|
||||||
grp->crcval = fg->crcval;
|
{
|
||||||
grp->size = fg->size;
|
grpfile_t * const grp = (grpfile_t *)Xcalloc(1, sizeof(grpfile_t));
|
||||||
grp->next = foundgrps;
|
grp->filename = Xstrdup(sidx->name);
|
||||||
foundgrps = grp;
|
grp->type = grptype;
|
||||||
|
grp->next = foundgrps;
|
||||||
|
foundgrps = grp;
|
||||||
|
}
|
||||||
|
|
||||||
fgg = (struct grpcache *)Xcalloc(1, sizeof(struct grpcache));
|
fgg = (struct grpcache *)Xcalloc(1, sizeof(struct grpcache));
|
||||||
strcpy(fgg->name, fg->name);
|
strcpy(fgg->name, fg->name);
|
||||||
|
@ -424,12 +407,15 @@ static void ProcessGroups(CACHE1D_FIND_REC *srch)
|
||||||
close(fh);
|
close(fh);
|
||||||
initprintf(" Done\n");
|
initprintf(" Done\n");
|
||||||
|
|
||||||
grp = (struct grpfile *)Xcalloc(1, sizeof(struct grpfile));
|
grpinfo_t const * const grptype = FindGrpInfo(crcval, st.st_size);
|
||||||
grp->name = Xstrdup(sidx->name);
|
if (grptype)
|
||||||
grp->crcval = crcval;
|
{
|
||||||
grp->size = st.st_size;
|
grpfile_t * const grp = (grpfile_t *)Xcalloc(1, sizeof(grpfile_t));
|
||||||
grp->next = foundgrps;
|
grp->filename = Xstrdup(sidx->name);
|
||||||
foundgrps = grp;
|
grp->type = grptype;
|
||||||
|
grp->next = foundgrps;
|
||||||
|
foundgrps = grp;
|
||||||
|
}
|
||||||
|
|
||||||
fgg = (struct grpcache *)Xcalloc(1, sizeof(struct grpcache));
|
fgg = (struct grpcache *)Xcalloc(1, sizeof(struct grpcache));
|
||||||
Bstrncpy(fgg->name, sidx->name, BMAX_PATH);
|
Bstrncpy(fgg->name, sidx->name, BMAX_PATH);
|
||||||
|
@ -448,7 +434,6 @@ int32_t ScanGroups(void)
|
||||||
{
|
{
|
||||||
CACHE1D_FIND_REC *srch;
|
CACHE1D_FIND_REC *srch;
|
||||||
struct grpcache *fg, *fgg;
|
struct grpcache *fg, *fgg;
|
||||||
struct grpfile *grp;
|
|
||||||
|
|
||||||
initprintf("Searching for game data...\n");
|
initprintf("Searching for game data...\n");
|
||||||
|
|
||||||
|
@ -465,39 +450,19 @@ int32_t ScanGroups(void)
|
||||||
|
|
||||||
FreeGroupsCache();
|
FreeGroupsCache();
|
||||||
|
|
||||||
for (grp = foundgrps; grp; /*grp=grp->next*/)
|
for (grpfile_t *grp = foundgrps; grp; grp=grp->next)
|
||||||
{
|
{
|
||||||
struct grpfile *igrp;
|
if (grp->type->dependency)
|
||||||
for (igrp = listgrps; igrp; igrp=igrp->next)
|
|
||||||
if (grp->crcval == igrp->crcval) break;
|
|
||||||
|
|
||||||
if (igrp == NULL)
|
|
||||||
{
|
{
|
||||||
grp = grp->next;
|
if (FindGroup(grp->type->dependency) == NULL) // couldn't find dependency
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (igrp->dependency)
|
|
||||||
{
|
|
||||||
struct grpfile *depgrp;
|
|
||||||
|
|
||||||
//initprintf("found grp with dep\n");
|
|
||||||
for (depgrp = foundgrps; depgrp; depgrp=depgrp->next)
|
|
||||||
if (depgrp->crcval == igrp->dependency) break;
|
|
||||||
|
|
||||||
if (depgrp == NULL || depgrp->crcval != igrp->dependency) // couldn't find dependency
|
|
||||||
{
|
{
|
||||||
//initprintf("removing %s\n", grp->name);
|
//initprintf("removing %s\n", grp->name);
|
||||||
RemoveGroup(igrp->crcval);
|
RemoveGroup(grp);
|
||||||
grp = foundgrps;
|
grp = foundgrps;
|
||||||
|
// start from the beginning so we can remove anything that depended on this grp
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (igrp->game && !grp->game)
|
|
||||||
grp->game = igrp->game;
|
|
||||||
|
|
||||||
grp=grp->next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (usedgrpcache)
|
if (usedgrpcache)
|
||||||
|
@ -529,12 +494,10 @@ int32_t ScanGroups(void)
|
||||||
|
|
||||||
void FreeGroups(void)
|
void FreeGroups(void)
|
||||||
{
|
{
|
||||||
struct grpfile *fg;
|
|
||||||
|
|
||||||
while (foundgrps)
|
while (foundgrps)
|
||||||
{
|
{
|
||||||
fg = foundgrps->next;
|
Bfree((char *)foundgrps->filename);
|
||||||
Bfree((char *)foundgrps->name);
|
grpfile_t * const fg = foundgrps->next;
|
||||||
Bfree(foundgrps);
|
Bfree(foundgrps);
|
||||||
foundgrps = fg;
|
foundgrps = fg;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ enum addon_t {
|
||||||
NUMADDONS
|
NUMADDONS
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct grpfile {
|
typedef struct grpinfo_t {
|
||||||
char *name;
|
char *name;
|
||||||
int32_t crcval;
|
int32_t crcval;
|
||||||
int32_t size;
|
int32_t size;
|
||||||
|
@ -68,16 +68,20 @@ typedef struct grpfile {
|
||||||
char *scriptname;
|
char *scriptname;
|
||||||
char *defname;
|
char *defname;
|
||||||
void (*postprocessing)(int32_t);
|
void (*postprocessing)(int32_t);
|
||||||
struct grpfile *next;
|
struct grpinfo_t *next;
|
||||||
} grpfile_type;
|
} grpinfo_t;
|
||||||
|
|
||||||
extern struct grpfile internalgrpfiles[];
|
typedef struct grpfile_t {
|
||||||
extern struct grpfile *foundgrps;
|
char *filename;
|
||||||
extern struct grpfile *listgrps;
|
struct grpinfo_t const *type;
|
||||||
|
struct grpfile_t *next;
|
||||||
|
} grpfile_t;
|
||||||
|
|
||||||
extern struct grpfile const * GetInternalGroup(int32_t crcval);
|
extern grpfile_t *foundgrps;
|
||||||
|
extern grpinfo_t *listgrps;
|
||||||
|
|
||||||
|
extern grpfile_t * FindGroup(int32_t crcval);
|
||||||
|
|
||||||
extern struct grpfile * FindGroup(int32_t crcval);
|
|
||||||
int32_t ScanGroups(void);
|
int32_t ScanGroups(void);
|
||||||
void FreeGroups(void);
|
void FreeGroups(void);
|
||||||
|
|
||||||
|
|
|
@ -107,6 +107,7 @@ static struct
|
||||||
|
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
|
grpfile_t const * grp;
|
||||||
int32_t fullscreen;
|
int32_t fullscreen;
|
||||||
#ifdef POLYMER
|
#ifdef POLYMER
|
||||||
int32_t polymer;
|
int32_t polymer;
|
||||||
|
@ -115,10 +116,7 @@ static struct
|
||||||
int32_t forcesetup;
|
int32_t forcesetup;
|
||||||
int32_t autoload;
|
int32_t autoload;
|
||||||
int32_t usemouse, usejoy;
|
int32_t usemouse, usejoy;
|
||||||
int32_t game;
|
|
||||||
int32_t crcval;
|
|
||||||
char *custommoddir;
|
char *custommoddir;
|
||||||
char selectedgrp[BMAX_PATH];
|
|
||||||
} settings;
|
} settings;
|
||||||
|
|
||||||
static int32_t retval = -1, mode = TAB_MESSAGES;
|
static int32_t retval = -1, mode = TAB_MESSAGES;
|
||||||
|
@ -235,15 +233,13 @@ static void on_gamelist_selection_changed(GtkTreeSelection *selection, gpointer
|
||||||
{
|
{
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
GtkTreeModel *model;
|
GtkTreeModel *model;
|
||||||
struct grpfile *fg;
|
|
||||||
UNREFERENCED_PARAMETER(user_data);
|
UNREFERENCED_PARAMETER(user_data);
|
||||||
|
|
||||||
if (gtk_tree_selection_get_selected(selection, &model, &iter))
|
if (gtk_tree_selection_get_selected(selection, &model, &iter))
|
||||||
{
|
{
|
||||||
|
grpfile_t const *fg;
|
||||||
gtk_tree_model_get(model, &iter, 2, (gpointer)&fg, -1);
|
gtk_tree_model_get(model, &iter, 2, (gpointer)&fg, -1);
|
||||||
strcpy(settings.selectedgrp, fg->name);
|
settings.grp = fg;
|
||||||
settings.game = fg->game;
|
|
||||||
settings.crcval = fg->crcval;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,7 +433,6 @@ static void PopulateForm(unsigned char pgs)
|
||||||
|
|
||||||
if ((pgs == ALL) || (pgs == POPULATE_GAME))
|
if ((pgs == ALL) || (pgs == POPULATE_GAME))
|
||||||
{
|
{
|
||||||
struct grpfile *fg;
|
|
||||||
GtkListStore *list;
|
GtkListStore *list;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
GtkTreeView *gamelist;
|
GtkTreeView *gamelist;
|
||||||
|
@ -446,18 +441,11 @@ static void PopulateForm(unsigned char pgs)
|
||||||
list = GTK_LIST_STORE(gtk_tree_view_get_model(gamelist));
|
list = GTK_LIST_STORE(gtk_tree_view_get_model(gamelist));
|
||||||
gtk_list_store_clear(list);
|
gtk_list_store_clear(list);
|
||||||
|
|
||||||
for (fg = foundgrps; fg; fg=fg->next)
|
for (grpfile_t const * fg = foundgrps; fg; fg=fg->next)
|
||||||
{
|
{
|
||||||
struct grpfile *grp;
|
|
||||||
for (grp = listgrps; grp; grp=grp->next)
|
|
||||||
if (fg->crcval == grp->crcval) break;
|
|
||||||
|
|
||||||
if (grp == NULL)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
gtk_list_store_append(list, &iter);
|
gtk_list_store_append(list, &iter);
|
||||||
gtk_list_store_set(list, &iter, 0, grp->name, 1, fg->name, 2, (gpointer)fg, -1);
|
gtk_list_store_set(list, &iter, 0, fg->type->name, 1, fg->filename, 2, (gpointer)fg, -1);
|
||||||
if (!Bstrcasecmp(fg->name, settings.selectedgrp))
|
if (settings.grp == fg)
|
||||||
{
|
{
|
||||||
GtkTreeSelection *sel = gtk_tree_view_get_selection(gamelist);
|
GtkTreeSelection *sel = gtk_tree_view_get_selection(gamelist);
|
||||||
g_signal_handlers_block_by_func(sel, (gpointer)on_gamelist_selection_changed, NULL);
|
g_signal_handlers_block_by_func(sel, (gpointer)on_gamelist_selection_changed, NULL);
|
||||||
|
@ -890,8 +878,7 @@ int32_t startwin_run(void)
|
||||||
settings.usejoy = ud.config.UseJoystick;
|
settings.usejoy = ud.config.UseJoystick;
|
||||||
settings.custommoddir = g_modDir;
|
settings.custommoddir = g_modDir;
|
||||||
settings.forcesetup = ud.config.ForceSetup;
|
settings.forcesetup = ud.config.ForceSetup;
|
||||||
settings.game = g_gameType;
|
settings.grp = g_selectedGrp;
|
||||||
Bstrncpyz(settings.selectedgrp, G_GrpFile(), BMAX_PATH);
|
|
||||||
if (ud.config.NoAutoLoad) settings.autoload = FALSE;
|
if (ud.config.NoAutoLoad) settings.autoload = FALSE;
|
||||||
else settings.autoload = TRUE;
|
else settings.autoload = TRUE;
|
||||||
#ifdef POLYMER
|
#ifdef POLYMER
|
||||||
|
@ -915,37 +902,14 @@ int32_t startwin_run(void)
|
||||||
ud.config.UseMouse = settings.usemouse;
|
ud.config.UseMouse = settings.usemouse;
|
||||||
ud.config.UseJoystick = settings.usejoy;
|
ud.config.UseJoystick = settings.usejoy;
|
||||||
ud.config.ForceSetup = settings.forcesetup;
|
ud.config.ForceSetup = settings.forcesetup;
|
||||||
|
g_selectedGrp = settings.grp;
|
||||||
|
|
||||||
clearGrpNamePtr();
|
|
||||||
g_grpNamePtr = dup_filename(settings.selectedgrp);
|
|
||||||
|
|
||||||
g_gameType = settings.game;
|
|
||||||
if (settings.custommoddir != NULL)
|
if (settings.custommoddir != NULL)
|
||||||
Bstrcpy(g_modDir, settings.custommoddir);
|
Bstrcpy(g_modDir, settings.custommoddir);
|
||||||
else Bsprintf(g_modDir, "/");
|
else Bsprintf(g_modDir, "/");
|
||||||
|
|
||||||
if (settings.autoload) ud.config.NoAutoLoad = FALSE;
|
if (settings.autoload) ud.config.NoAutoLoad = FALSE;
|
||||||
else ud.config.NoAutoLoad = TRUE;
|
else ud.config.NoAutoLoad = TRUE;
|
||||||
|
|
||||||
{
|
|
||||||
struct grpfile *grp;
|
|
||||||
for (grp = listgrps; grp; grp=grp->next)
|
|
||||||
if (settings.crcval == grp->crcval) break;
|
|
||||||
|
|
||||||
if (grp)
|
|
||||||
{
|
|
||||||
g_gameNamePtr = grp->name;
|
|
||||||
g_dependencyCRC = grp->dependency;
|
|
||||||
g_groupCRC = grp->crcval;
|
|
||||||
g_postprocessing = grp->postprocessing;
|
|
||||||
|
|
||||||
if (grp->scriptname && g_scriptNamePtr == NULL)
|
|
||||||
g_scriptNamePtr = dup_filename(grp->scriptname);
|
|
||||||
|
|
||||||
if (grp->defname && g_defNamePtr == NULL)
|
|
||||||
g_defNamePtr = dup_filename(grp->defname);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
|
@ -17,11 +17,10 @@
|
||||||
static id nsapp;
|
static id nsapp;
|
||||||
|
|
||||||
static struct {
|
static struct {
|
||||||
|
grpfile_t const * grp;
|
||||||
int fullscreen;
|
int fullscreen;
|
||||||
int xdim3d, ydim3d, bpp3d;
|
int xdim3d, ydim3d, bpp3d;
|
||||||
int forcesetup;
|
int forcesetup;
|
||||||
char selectedgrp[BMAX_PATH+1];
|
|
||||||
int game;
|
|
||||||
int samplerate, bitspersample, channels;
|
int samplerate, bitspersample, channels;
|
||||||
} settings;
|
} settings;
|
||||||
|
|
||||||
|
@ -218,11 +217,7 @@ static struct soundQuality_t {
|
||||||
|
|
||||||
int row = [[gameList documentView] selectedRow];
|
int row = [[gameList documentView] selectedRow];
|
||||||
if (row >= 0) {
|
if (row >= 0) {
|
||||||
struct grpfile *p = [[gamelistsrc grpAtIndex:row] entryptr];
|
settings.grp = [[gamelistsrc grpAtIndex:row] entryptr];
|
||||||
if (p) {
|
|
||||||
strcpy(settings.selectedgrp, p->name);
|
|
||||||
settings.game = p->game;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
settings.forcesetup = [alwaysShowButton state] == NSOnState;
|
settings.forcesetup = [alwaysShowButton state] == NSOnState;
|
||||||
|
@ -248,7 +243,7 @@ static struct soundQuality_t {
|
||||||
[[gameList documentView] setDataSource:gamelistsrc];
|
[[gameList documentView] setDataSource:gamelistsrc];
|
||||||
[[gameList documentView] deselectAll:nil];
|
[[gameList documentView] deselectAll:nil];
|
||||||
|
|
||||||
int row = [gamelistsrc findIndexForGrpname:[NSString stringWithCString:settings.selectedgrp encoding:NSUTF8StringEncoding]];
|
int row = [gamelistsrc findIndexForGrpname:[NSString stringWithCString:settings.grp->filename encoding:NSUTF8StringEncoding]];
|
||||||
if (row >= 0) {
|
if (row >= 0) {
|
||||||
[[gameList documentView] scrollRowToVisible:row];
|
[[gameList documentView] scrollRowToVisible:row];
|
||||||
#if defined(MAC_OS_X_VERSION_10_3) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_3)
|
#if defined(MAC_OS_X_VERSION_10_3) && (MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_X_VERSION_10_3)
|
||||||
|
@ -422,8 +417,7 @@ int startwin_run(void)
|
||||||
settings.bitspersample = ud.config.NumBits;
|
settings.bitspersample = ud.config.NumBits;
|
||||||
settings.channels = ud.config.NumChannels;
|
settings.channels = ud.config.NumChannels;
|
||||||
settings.forcesetup = ud.config.ForceSetup;
|
settings.forcesetup = ud.config.ForceSetup;
|
||||||
// settings.game = gametype;
|
settings.grp = g_selectedGrp;
|
||||||
strncpy(settings.selectedgrp, G_GrpFile(), BMAX_PATH);
|
|
||||||
|
|
||||||
[startwin setupRunMode];
|
[startwin setupRunMode];
|
||||||
|
|
||||||
|
@ -444,9 +438,7 @@ int startwin_run(void)
|
||||||
ud.config.NumBits = settings.bitspersample;
|
ud.config.NumBits = settings.bitspersample;
|
||||||
ud.config.NumChannels = settings.channels;
|
ud.config.NumChannels = settings.channels;
|
||||||
ud.config.ForceSetup = settings.forcesetup;
|
ud.config.ForceSetup = settings.forcesetup;
|
||||||
clearGrpNamePtr();
|
g_selectedGrp = settings.grp;
|
||||||
g_grpNamePtr = dup_filename(settings.selectedgrp);
|
|
||||||
// gametype = settings.game;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
|
@ -56,14 +56,12 @@ static struct audioenumdrv *wavedevs = NULL;
|
||||||
|
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
|
struct grpfile_t const * grp;
|
||||||
int32_t flags; // bitfield
|
int32_t flags; // bitfield
|
||||||
int32_t xdim, ydim, bpp;
|
int32_t xdim, ydim, bpp;
|
||||||
int32_t forcesetup;
|
int32_t forcesetup;
|
||||||
int32_t usemouse, usejoy;
|
int32_t usemouse, usejoy;
|
||||||
int32_t game;
|
|
||||||
int32_t crcval; // for finding the grp in the list again
|
|
||||||
char *gamedir;
|
char *gamedir;
|
||||||
char selectedgrp[BMAX_PATH];
|
|
||||||
}
|
}
|
||||||
settings;
|
settings;
|
||||||
|
|
||||||
|
@ -249,29 +247,19 @@ static void PopulateForm(int32_t pgs)
|
||||||
|
|
||||||
if (pgs & POPULATE_GAME)
|
if (pgs & POPULATE_GAME)
|
||||||
{
|
{
|
||||||
struct grpfile *fg;
|
|
||||||
int32_t j;
|
int32_t j;
|
||||||
char buf[1024];
|
char buf[1024];
|
||||||
|
|
||||||
hwnd = GetDlgItem(pages[TAB_CONFIG], IDCDATA);
|
hwnd = GetDlgItem(pages[TAB_CONFIG], IDCDATA);
|
||||||
|
|
||||||
for (fg = foundgrps; fg; fg=fg->next)
|
for (grpfile_t const * fg = foundgrps; fg; fg=fg->next)
|
||||||
{
|
{
|
||||||
struct grpfile *grp;
|
Bsprintf(buf, "%s\t%s", fg->type->name, fg->filename);
|
||||||
for (grp = listgrps; grp; grp=grp->next)
|
|
||||||
if (fg->crcval == grp->crcval) break;
|
|
||||||
|
|
||||||
if (grp == NULL)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
Bsprintf(buf, "%s\t%s", grp->name, fg->name);
|
|
||||||
j = ListBox_AddString(hwnd, buf);
|
j = ListBox_AddString(hwnd, buf);
|
||||||
(void)ListBox_SetItemData(hwnd, j, (LPARAM)fg);
|
(void)ListBox_SetItemData(hwnd, j, (LPARAM)fg);
|
||||||
if (!Bstrcasecmp(fg->name, settings.selectedgrp))
|
if (settings.grp == fg)
|
||||||
{
|
{
|
||||||
(void)ListBox_SetCurSel(hwnd, j);
|
(void)ListBox_SetCurSel(hwnd, j);
|
||||||
settings.game = fg->game;
|
|
||||||
settings.crcval = fg->crcval;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -377,9 +365,7 @@ static INT_PTR CALLBACK ConfigPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
|
||||||
if (i != CB_ERR) i = ListBox_GetItemData((HWND)lParam, i);
|
if (i != CB_ERR) i = ListBox_GetItemData((HWND)lParam, i);
|
||||||
if (i != CB_ERR)
|
if (i != CB_ERR)
|
||||||
{
|
{
|
||||||
strcpy(settings.selectedgrp, ((struct grpfile *)i)->name);
|
settings.grp = (grpfile_t const *)i;
|
||||||
settings.game = ((struct grpfile *)i)->game;
|
|
||||||
settings.crcval = ((struct grpfile *)i)->crcval;
|
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -746,9 +732,7 @@ int32_t startwin_run(void)
|
||||||
settings.forcesetup = ud.config.ForceSetup;
|
settings.forcesetup = ud.config.ForceSetup;
|
||||||
settings.usemouse = ud.config.UseMouse;
|
settings.usemouse = ud.config.UseMouse;
|
||||||
settings.usejoy = ud.config.UseJoystick;
|
settings.usejoy = ud.config.UseJoystick;
|
||||||
settings.game = g_gameType;
|
settings.grp = g_selectedGrp;
|
||||||
// settings.crcval = 0;
|
|
||||||
Bstrncpyz(settings.selectedgrp, G_GrpFile(), BMAX_PATH);
|
|
||||||
settings.gamedir = g_modDir;
|
settings.gamedir = g_modDir;
|
||||||
PopulateForm(-1);
|
PopulateForm(-1);
|
||||||
|
|
||||||
|
@ -786,35 +770,11 @@ int32_t startwin_run(void)
|
||||||
ud.config.ForceSetup = settings.forcesetup;
|
ud.config.ForceSetup = settings.forcesetup;
|
||||||
ud.config.UseMouse = settings.usemouse;
|
ud.config.UseMouse = settings.usemouse;
|
||||||
ud.config.UseJoystick = settings.usejoy;
|
ud.config.UseJoystick = settings.usejoy;
|
||||||
|
g_selectedGrp = settings.grp;
|
||||||
clearGrpNamePtr();
|
|
||||||
g_grpNamePtr = dup_filename(settings.selectedgrp);
|
|
||||||
|
|
||||||
g_gameType = settings.game;
|
|
||||||
|
|
||||||
if (g_noSetup == 0 && settings.gamedir != NULL)
|
if (g_noSetup == 0 && settings.gamedir != NULL)
|
||||||
Bstrcpy(g_modDir,settings.gamedir);
|
Bstrcpy(g_modDir,settings.gamedir);
|
||||||
else Bsprintf(g_modDir,"/");
|
else Bsprintf(g_modDir,"/");
|
||||||
|
|
||||||
{
|
|
||||||
struct grpfile *grp;
|
|
||||||
for (grp = listgrps; grp; grp=grp->next)
|
|
||||||
if (settings.crcval == grp->crcval) break;
|
|
||||||
|
|
||||||
if (grp)
|
|
||||||
{
|
|
||||||
g_gameNamePtr = grp->name;
|
|
||||||
g_dependencyCRC = grp->dependency;
|
|
||||||
g_groupCRC = grp->crcval;
|
|
||||||
g_postprocessing = grp->postprocessing;
|
|
||||||
|
|
||||||
if (grp->scriptname && g_scriptNamePtr == NULL)
|
|
||||||
g_scriptNamePtr = dup_filename(grp->scriptname);
|
|
||||||
|
|
||||||
if (grp->defname && g_defNamePtr == NULL)
|
|
||||||
g_defNamePtr = dup_filename(grp->defname);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (wavedevs)
|
if (wavedevs)
|
||||||
|
|
Loading…
Reference in a new issue