Added support to automatically load/mount ZIP files at startup, giving option to dynamically override or replace game content; Updated docs
This commit is contained in:
parent
0529a5320b
commit
0a86348aab
|
@ -1,5 +1,9 @@
|
|||
D1X-Rebirth Changelog
|
||||
|
||||
20100815
|
||||
--------
|
||||
INSTALL.txt, include/physfsx.h, main/inferno.c, misc/physfsx.c: Added support to automatically load/mount ZIP files at startup, giving option to dynamically override or replace game content; Updated docs
|
||||
|
||||
20100814
|
||||
--------
|
||||
main/game.c: Tidy up for EVENT_IDLE case in game_handler, hopefully fixing obscure 'optimise threads' bug
|
||||
|
|
35
INSTALL.txt
35
INSTALL.txt
|
@ -88,27 +88,28 @@ Optional files:
|
|||
|
||||
D1X-Rebirth is expandable. You can add additional content to the game.
|
||||
|
||||
HiRes Briefing Images and Fonts:
|
||||
--------------------------------
|
||||
Available at http://www.dxx-rebirth.com/download/dxx/res/d1xrdata.zip
|
||||
To add those, copy the ZIP file to the D1X-Rebirth directory or - on *NIX systems -
|
||||
into Sharepath or ~/.d1x-rebirth.
|
||||
The Mac data files are already hires.
|
||||
|
||||
Custom/AddOn missions:
|
||||
----------------------
|
||||
Missions:
|
||||
---------
|
||||
Those can be found on several websites. Add them to the game by copying them to subdirectory
|
||||
‘missions/’. They can also go in subdirectories of 'missions/', unlike with the original version.
|
||||
|
||||
Language Packs:
|
||||
---------------
|
||||
German translation: http://www.dxx-rebirth.com/download/dxx/res/D1XBDE01.zip
|
||||
Copy the txb-files to the Sharepath (non-Mac OS *NIX)/program directory (otherwise).
|
||||
Custom Music (MP3, OGG, AIF, etc.):
|
||||
-----------------------------------
|
||||
Custom Music can be played via the CUSTOM MUSIC options by specifying it in the Sound Options menu.
|
||||
Please note that all custom music has to be in 44Khz format. Supported formats depend on the capabilities of SDL_mixer.
|
||||
|
||||
Custom Music (like MP3 or OGG):
|
||||
-------------------------------
|
||||
Custom Music can be played via the Jukebox by specifying the path to your music in the Sound Options menu.
|
||||
Please note that all custom music has to be in 44Khz format.
|
||||
AddOn Packs:
|
||||
------------
|
||||
Custom AddOn packs will expand the game in many differnt ways. These are usually provided as ZIP or 7Z and can easily
|
||||
be installed by putting them to where your game content resides (OS-dependent - see above).
|
||||
NO EXTRACTION OR ADDITIONAL CONFIGURATION NEEDED.
|
||||
A list of currently available packs:
|
||||
- Hires background images and fonts:
|
||||
http://www.dxx-rebirth.com/download/dxx/res/d1xr-hires.zip
|
||||
- German briefings:
|
||||
http://www.dxx-rebirth.com/download/dxx/res/d1xr-briefings-ger.zip
|
||||
- Soundtrack in OGG format (if your MIDI output just does not kick ass):
|
||||
http://www.dxx-rebirth.com/download/dxx/res/d1xr-music-ogg.zip
|
||||
|
||||
|
||||
Launching the program
|
||||
|
|
|
@ -166,5 +166,7 @@ extern PHYSFS_sint64 PHYSFSX_getFreeDiskSpace();
|
|||
extern PHYSFS_file *PHYSFSX_openReadBuffered(char *filename);
|
||||
extern PHYSFS_file *PHYSFSX_openWriteBuffered(char *filename);
|
||||
extern PHYSFS_file *PHYSFSX_openDataFile(char *filename);
|
||||
extern void PHYSFSX_addArchiveContent();
|
||||
extern void PHYSFSX_removeArchiveContent();
|
||||
|
||||
#endif /* PHYSFSX_H */
|
||||
|
|
|
@ -361,8 +361,7 @@ int main(int argc, char *argv[])
|
|||
PHYSFS_freeList(list);
|
||||
}
|
||||
|
||||
if (cfile_init("d1xrdata.zip", 0))
|
||||
con_printf(CON_NORMAL, "Added d1xrdata.zip for additional content\n");
|
||||
PHYSFSX_addArchiveContent();
|
||||
|
||||
arch_init();
|
||||
|
||||
|
@ -460,6 +459,7 @@ int main(int argc, char *argv[])
|
|||
args_exit();
|
||||
newmenu_free_background();
|
||||
free_mission();
|
||||
PHYSFSX_removeArchiveContent();
|
||||
|
||||
return(0); //presumably successful exit
|
||||
}
|
||||
|
|
117
misc/physfsx.c
117
misc/physfsx.c
|
@ -15,6 +15,8 @@
|
|||
#endif
|
||||
|
||||
#include "physfsx.h"
|
||||
#include "object.h"
|
||||
#include "newdemo.h"
|
||||
|
||||
// Initialise PhysicsFS, set up basic search paths and add arguments from .ini file.
|
||||
// The .ini file can be in either the user directory or the same directory as the program.
|
||||
|
@ -343,3 +345,118 @@ PHYSFS_file *PHYSFSX_openDataFile(char *filename)
|
|||
return fp;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add archives to the game.
|
||||
* 1) archives from Sharepath/Data to extend/replace builtin game content
|
||||
* 2) archived demos
|
||||
*/
|
||||
void PHYSFSX_addArchiveContent()
|
||||
{
|
||||
char **list = NULL;
|
||||
char *archive_exts[] = { ".zip", ".7z", NULL }, *file[2];
|
||||
int i = 0;
|
||||
|
||||
// find files in Searchpath ...
|
||||
list = PHYSFSX_findFiles("", archive_exts);
|
||||
// if found, add them...
|
||||
for (i = 0; list[i] != NULL; i++)
|
||||
{
|
||||
MALLOC(file[0], char, PATH_MAX);
|
||||
MALLOC(file[1], char, PATH_MAX);
|
||||
snprintf(file[0], sizeof(char)*PATH_MAX, "%s", list[i]);
|
||||
PHYSFSX_getRealPath(file[0],file[1]);
|
||||
PHYSFS_addToSearchPath(file[1], 0);
|
||||
d_free(file[0]);
|
||||
d_free(file[1]);
|
||||
}
|
||||
PHYSFS_freeList(list);
|
||||
list = NULL;
|
||||
|
||||
// find files in DATA_DIR ...
|
||||
list = PHYSFSX_findFiles("Data/", archive_exts);
|
||||
// if found, add them...
|
||||
for (i = 0; list[i] != NULL; i++)
|
||||
{
|
||||
MALLOC(file[0], char, PATH_MAX);
|
||||
MALLOC(file[1], char, PATH_MAX);
|
||||
snprintf(file[0], sizeof(char)*PATH_MAX, "%s%s", "Data/", list[i]);
|
||||
PHYSFSX_getRealPath(file[0],file[1]);
|
||||
PHYSFS_addToSearchPath(file[1], 0);
|
||||
d_free(file[0]);
|
||||
d_free(file[1]);
|
||||
}
|
||||
PHYSFS_freeList(list);
|
||||
list = NULL;
|
||||
|
||||
// find files in DEMO_DIR ...
|
||||
list = PHYSFSX_findFiles(DEMO_DIR, archive_exts);
|
||||
// if found, add them...
|
||||
for (i = 0; list[i] != NULL; i++)
|
||||
{
|
||||
MALLOC(file[0], char, PATH_MAX);
|
||||
MALLOC(file[1], char, PATH_MAX);
|
||||
snprintf(file[0], sizeof(char)*PATH_MAX, "%s%s", DEMO_DIR, list[i]);
|
||||
PHYSFSX_getRealPath(file[0],file[1]);
|
||||
PHYSFS_mount(file[1], DEMO_DIR, 0);
|
||||
d_free(file[0]);
|
||||
d_free(file[1]);
|
||||
}
|
||||
PHYSFS_freeList(list);
|
||||
list = NULL;
|
||||
}
|
||||
|
||||
// Removes content added above when quitting game
|
||||
void PHYSFSX_removeArchiveContent()
|
||||
{
|
||||
char **list = NULL;
|
||||
char *archive_exts[] = { ".zip", ".7z", NULL }, *file[2];
|
||||
int i = 0;
|
||||
|
||||
// find files in Searchpath ...
|
||||
list = PHYSFSX_findFiles("", archive_exts);
|
||||
// if found, remove them...
|
||||
for (i = 0; list[i] != NULL; i++)
|
||||
{
|
||||
MALLOC(file[0], char, PATH_MAX);
|
||||
MALLOC(file[1], char, PATH_MAX);
|
||||
snprintf(file[0], sizeof(char)*PATH_MAX, "%s", list[i]);
|
||||
PHYSFSX_getRealPath(file[0],file[1]);
|
||||
PHYSFS_removeFromSearchPath(file[1]);
|
||||
d_free(file[0]);
|
||||
d_free(file[1]);
|
||||
}
|
||||
PHYSFS_freeList(list);
|
||||
list = NULL;
|
||||
|
||||
// find files in DATA_DIR ...
|
||||
list = PHYSFSX_findFiles("Data/", archive_exts);
|
||||
// if found, remove them...
|
||||
for (i = 0; list[i] != NULL; i++)
|
||||
{
|
||||
MALLOC(file[0], char, PATH_MAX);
|
||||
MALLOC(file[1], char, PATH_MAX);
|
||||
snprintf(file[0], sizeof(char)*PATH_MAX, "%s%s", "Data/", list[i]);
|
||||
PHYSFSX_getRealPath(file[0],file[1]);
|
||||
PHYSFS_removeFromSearchPath(file[1]);
|
||||
d_free(file[0]);
|
||||
d_free(file[1]);
|
||||
}
|
||||
PHYSFS_freeList(list);
|
||||
list = NULL;
|
||||
|
||||
// find files in DEMO_DIR ...
|
||||
list = PHYSFSX_findFiles(DEMO_DIR, archive_exts);
|
||||
// if found, remove them...
|
||||
for (i = 0; list[i] != NULL; i++)
|
||||
{
|
||||
MALLOC(file[0], char, PATH_MAX);
|
||||
MALLOC(file[1], char, PATH_MAX);
|
||||
snprintf(file[0], sizeof(char)*PATH_MAX, "%s%s", DEMO_DIR, list[i]);
|
||||
PHYSFSX_getRealPath(file[0],file[1]);
|
||||
PHYSFS_removeFromSearchPath(file[1]);
|
||||
d_free(file[0]);
|
||||
d_free(file[1]);
|
||||
}
|
||||
PHYSFS_freeList(list);
|
||||
list = NULL;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue